@stacksjs/dtsx 0.9.13 → 0.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +4 -8
  2. package/dist/bin/cli.js +6 -6
  3. package/dist/branded-types.d.ts +10 -18
  4. package/dist/chunk-14gh6ezz.js +80 -0
  5. package/dist/chunk-285mqzvx.js +16 -0
  6. package/dist/chunk-2n1bbm2c.js +448 -0
  7. package/dist/chunk-2r21f44d.js +25 -0
  8. package/dist/chunk-3xqchdwd.js +2 -0
  9. package/dist/{chunk-e0gx49tv.js → chunk-3zjt21t1.js} +1 -1
  10. package/dist/chunk-4s9jv983.js +3 -0
  11. package/dist/chunk-5hzvjjt0.js +2 -0
  12. package/dist/chunk-83e9a4fq.js +4 -0
  13. package/dist/chunk-8cv1t8qg.js +2 -0
  14. package/dist/{chunk-pdt5pc9f.js → chunk-8g7jyxbr.js} +1 -1
  15. package/dist/chunk-8z31rkfp.js +3 -0
  16. package/dist/chunk-a3txc27m.js +33 -0
  17. package/dist/chunk-bh9ey0vw.js +2 -0
  18. package/dist/chunk-bsxtpwx6.js +2 -0
  19. package/dist/{chunk-0f9tt1yd.js → chunk-c09v68yx.js} +1 -1
  20. package/dist/{chunk-emwe4zbk.js → chunk-f4c389mj.js} +1 -1
  21. package/dist/{chunk-hbd2nj9p.js → chunk-fef6249b.js} +1 -1
  22. package/dist/{chunk-57agx6g8.js → chunk-gssantc8.js} +1 -1
  23. package/dist/chunk-j2yw0d45.js +6 -0
  24. package/dist/{chunk-ns3hznyf.js → chunk-mcdb3q06.js} +1 -1
  25. package/dist/{chunk-tzrvp0n2.js → chunk-mn46jafe.js} +1 -1
  26. package/dist/{chunk-mrk48ejm.js → chunk-mxam9312.js} +8 -8
  27. package/dist/chunk-nf54b52t.js +6 -0
  28. package/dist/{chunk-f0mvmcmj.js → chunk-npj0c002.js} +1 -1
  29. package/dist/chunk-pep9jyxn.js +2 -0
  30. package/dist/chunk-qrht3d5g.js +2 -0
  31. package/dist/chunk-rh2bqn7v.js +2 -0
  32. package/dist/{chunk-ck86m3vf.js → chunk-sw3m29sw.js} +1 -1
  33. package/dist/{chunk-a592hfkt.js → chunk-tne5n3h1.js} +1 -1
  34. package/dist/{chunk-1t76q5wk.js → chunk-trm0gptj.js} +1 -1
  35. package/dist/chunk-vpjw38x7.js +34 -0
  36. package/dist/chunk-w71syh0b.js +2 -0
  37. package/dist/chunk-w8d9jjsa.js +2 -0
  38. package/dist/{chunk-188ep5ns.js → chunk-xhs0tsnn.js} +1 -1
  39. package/dist/{chunk-e38jw5aa.js → chunk-xmje6xfw.js} +1 -1
  40. package/dist/{chunk-vf7ywnxz.js → chunk-xtee8g1a.js} +1 -1
  41. package/dist/chunk-y581wnfe.js +19 -0
  42. package/dist/{chunk-6qv7p9sg.js → chunk-zf17s33e.js} +18 -11
  43. package/dist/compat.d.ts +5 -2
  44. package/dist/extractor/cache.d.ts +6 -2
  45. package/dist/extractor/directives.d.ts +0 -4
  46. package/dist/generator.d.ts +1 -1
  47. package/dist/logger.d.ts +4 -0
  48. package/dist/optimizer.d.ts +4 -0
  49. package/dist/process-source.d.ts +1 -0
  50. package/dist/processor/cache.d.ts +4 -2
  51. package/dist/processor/imports.d.ts +1 -0
  52. package/dist/src/index.js +52 -51
  53. package/dist/src/plugins/bun.js +1 -1
  54. package/dist/src/plugins/esbuild.js +1 -1
  55. package/dist/src/plugins/index.js +1 -1
  56. package/dist/src/plugins/tsup.js +1 -1
  57. package/dist/src/plugins/vite.js +1 -1
  58. package/dist/src/plugins/webpack.js +1 -1
  59. package/dist/transformers.d.ts +4 -1
  60. package/dist/type-mappings.d.ts +16 -16
  61. package/dist/types.d.ts +2 -0
  62. package/package.json +3 -3
  63. package/dist/chunk-2vw7w2j4.js +0 -23
  64. package/dist/chunk-365avtde.js +0 -32
  65. package/dist/chunk-446n992h.js +0 -2
  66. package/dist/chunk-49b3ran6.js +0 -4
  67. package/dist/chunk-50hbgzrj.js +0 -3
  68. package/dist/chunk-6jpqpjkc.js +0 -3
  69. package/dist/chunk-94h87sgb.js +0 -449
  70. package/dist/chunk-at36dtgx.js +0 -2
  71. package/dist/chunk-b0bkjk0p.js +0 -19
  72. package/dist/chunk-chbk4344.js +0 -2
  73. package/dist/chunk-ez568rby.js +0 -2
  74. package/dist/chunk-hwm87z68.js +0 -2
  75. package/dist/chunk-jfk0hw36.js +0 -75
  76. package/dist/chunk-myvmq7hz.js +0 -2
  77. package/dist/chunk-nd0xbpbz.js +0 -2
  78. package/dist/chunk-nfeqwqca.js +0 -6
  79. package/dist/chunk-nr1gxnen.js +0 -2
  80. package/dist/chunk-pdvve1gm.js +0 -33
  81. package/dist/chunk-sv136qag.js +0 -17
  82. package/dist/chunk-te9r0j9z.js +0 -6
  83. package/dist/chunk-trftkghj.js +0 -2
  84. package/dist/chunk-xqymptjk.js +0 -2
  85. package/dist/extractor/extract.d.ts +0 -10
  86. package/dist/extractor/scanner.d.ts +0 -6
package/dist/src/index.js CHANGED
@@ -1,56 +1,57 @@
1
1
  // @bun
2
- import{a as b9,b as P9,c as x9}from"../chunk-49b3ran6.js";import{d as O8,e as A8,f as G8,g as B8,h as z8,i as N8,j as j8,k as R8}from"../chunk-emwe4zbk.js";import{l as m9,m as p9,n as d9,o as c9,p as l9,q as o9,r as s9}from"../chunk-nfeqwqca.js";import{s as w9,t as I9,u as T9,v as S9,w as k9,x as C9,y as v9}from"../chunk-188ep5ns.js";import{A as I6,B as T6,C as S6,D as k6,E as C6,F as v6,G as b6,H as P6,z as w6}from"../chunk-mrk48ejm.js";import{I as f8,J as u8,K as m8,L as p8,M as d8,N as c8,O as l8,P as o8}from"../chunk-d0p3jzwb.js";import{Q as x6,R as y6,S as h6,T as g6,U as f6,V as u6,W as m6,X as p6,Y as d6}from"../chunk-te9r0j9z.js";import{$ as g9,Z as y9,_ as h9,aa as f9,ba as u9}from"../chunk-6qv7p9sg.js";import{$a as h8,Aa as M6,Ba as c6,Ca as l6,Da as o6,Ea as QX,Fa as s6,Ga as a6,Ha as i6,Ia as n6,Ja as r6,Ka as t6,La as F8,Ma as D8,Na as E8,Oa as L8,Pa as M8,Qa as w8,Ra as I8,Sa as T8,Ta as S8,Ua as k8,Va as C8,Wa as v8,Xa as b8,Ya as P8,Za as x8,_a as y8,ab as g8,bb as s8,cb as a8,db as i8,eb as n8,fb as r8,gb as t8,hb as mX,ib as e8,jb as X9,kb as Z9,lb as A9,mb as G9,nb as B9,ob as z9,pb as N9,qb as j9,rb as R9,sb as F9,tb as E9,ua as j6,ub as L9,va as R6,vb as M9,wa as F6,xa as D6,ya as E6,za as L6}from"../chunk-jfk0hw36.js";import{$b as _6,Ab as v4,Bb as gZ,Cb as fZ,Db as p4,Eb as d4,Fb as c4,Gb as l4,Hb as o4,Ib as s4,Jb as a4,Kb as i4,Lb as n4,Mb as r4,Nb as t4,Ob as e4,Pb as X6,Qb as Z6,Rb as $6,Sb as J6,Tb as Q6,Ub as q6,Vb as Y6,Wb as V6,Xb as W6,Yb as K6,Zb as H6,_b as U6,ac as O6,bc as A6,cc as G6,dc as B6,ec as EX,fc as z6,gc as N6,wb as T4,xb as S4,yb as k4,zb as C4}from"../chunk-b0bkjk0p.js";import{hc as SZ}from"../chunk-94h87sgb.js";import{ic as D9}from"../chunk-6jpqpjkc.js";import"../chunk-50hbgzrj.js";import"../chunk-2vw7w2j4.js";import{Ac as O9,Bc as LX,oc as uZ,pc as $9,qc as J9,rc as Q9,sc as q9,tc as Y9,uc as V9,vc as W9,wc as K9,xc as H9,yc as U9,zc as _9}from"../chunk-pdvve1gm.js";import{Ec as b4,Fc as P4,Gc as x4,Hc as y4,Ic as h4,Jc as hZ,Kc as g4,Lc as f4,Mc as u4,Nc as m4}from"../chunk-sv136qag.js";import{Oc as V8,Pc as W8,Qc as K8,Rc as H8,Sc as U8,Tc as _8}from"../chunk-365avtde.js";import{$c as Y8,Uc as e6,Vc as X8,Wc as Z8,Xc as $8,Yc as J8,Zc as Q8,_c as q8}from"../chunk-57agx6g8.js";import{ad as TZ,cd as v}from"../chunk-ns3hznyf.js";function C0(X){if(!X||typeof X!=="string")throw Error("Invalid file path: must be a non-empty string");return X}function v0(X){if(!X||typeof X!=="string")throw Error("Invalid directory path: must be a non-empty string");return X}function b0(X){if(!X||typeof X!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return X}function P0(X){if(typeof X!=="string")throw TypeError("Invalid source code: must be a string");return X}function x0(X){if(typeof X!=="string")throw TypeError("Invalid DTS content: must be a string");return X}function y0(X){if(!X||typeof X!=="string")throw Error("Invalid module specifier: must be a non-empty string");return X}function h0(X){if(!X||typeof X!=="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(X)&&!/^[A-Z_$]/.test(X));return X}function g0(X){if(!X||typeof X!=="string")throw Error("Invalid declaration name: must be a non-empty string");return X}function f0(X){if(!X||typeof X!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!X.startsWith("/")&&!/^[A-Z]:/i.test(X))throw Error("Invalid absolute path: must start with / or drive letter");return X}function u0(X){if(!X||typeof X!=="string")throw Error("Invalid relative path: must be a non-empty string");if(X.startsWith("/")||/^[A-Z]:/i.test(X))throw Error("Invalid relative path: must not be absolute");return X}function m0(X){if(typeof X!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(X)}catch{throw Error("Invalid JSON string: must be valid JSON")}return X}function p0(X,Z){return typeof X==="string"||typeof X==="number"}function d0(X){return X}var c0={join(X,...Z){let{join:$}=v("path");return $(X,...Z)},dirname(X){let{dirname:Z}=v("path");return Z(X)},basename(X){let{basename:Z}=v("path");return Z(X)},resolve(...X){let{resolve:Z}=v("path");return Z(...X)},isAbsolute(X){let{isAbsolute:Z}=v("path");return Z(X)},relative(X,Z){let{relative:$}=v("path");return $(X,Z)}};function nX(X,Z){let $=X.length,J=Z.length,Q=Array.from({length:$+1},()=>Array(J+1).fill(0));for(let q=1;q<=$;q++)for(let Y=1;Y<=J;Y++)if(X[q-1]===Z[Y-1])Q[q][Y]=Q[q-1][Y-1]+1;else Q[q][Y]=Math.max(Q[q-1][Y],Q[q][Y-1]);return Q}function rX(X,Z,$,J,Q){let q=[];while(J>0||Q>0)if(J>0&&Q>0&&Z[J-1]===$[Q-1])q.unshift({op:"equal",oldIdx:J-1,newIdx:Q-1,line:Z[J-1]}),J--,Q--;else if(Q>0&&(J===0||X[J][Q-1]>=X[J-1][Q]))q.unshift({op:"add",newIdx:Q-1,line:$[Q-1]}),Q--;else if(J>0)q.unshift({op:"remove",oldIdx:J-1,line:Z[J-1]}),J--;return q}function JX(X,Z){let $=X;if(Z.ignoreWhitespace)$=$.replace(/\s+/g," ").trim();return $}function d(X,Z,$,J={}){let{context:Q=3,ignoreWhitespace:q=!1,ignoreBlankLines:Y=!1}=J,V=X.split(`
3
- `),W=Z.split(`
4
- `);if(V[V.length-1]==="")V.pop();if(W[W.length-1]==="")W.pop();let K=V.map((F)=>JX(F,{ignoreWhitespace:q})),U=W.map((F)=>JX(F,{ignoreWhitespace:q})),O=K,H=U,A=V.map((F,w)=>w),_=W.map((F,w)=>w);if(Y)O=[],H=[],A=[],_=[],K.forEach((F,w)=>{if(F.trim())O.push(F),A.push(w)}),U.forEach((F,w)=>{if(F.trim())H.push(F),_.push(w)});let G=nX(O,H),B=rX(G,O,H,O.length,H.length),z=B.every((F)=>F.op==="equal"),j=0,N=0,R=0;for(let F of B)if(F.op==="add")j++;else if(F.op==="remove")N++;else R++;let k=tX(B,V,W,A,_,Q);return{filePath:$,identical:z,hunks:k,stats:{additions:j,deletions:N,unchanged:R},oldContent:X,newContent:Z}}function tX(X,Z,$,J,Q,q){let Y=[],V=[];if(X.forEach((U,O)=>{if(U.op!=="equal")V.push(O)}),V.length===0)return Y;let W=[],K=[V[0]];for(let U=1;U<V.length;U++)if(V[U]-V[U-1]<=q*2+1)K.push(V[U]);else W.push(K),K=[V[U]];W.push(K);for(let U of W){let O=Math.max(0,U[0]-q),H=Math.min(X.length-1,U[U.length-1]+q),A=X.slice(O,H+1),_=[],G=1,B=1,z=0,j=0;for(let N=0;N<O;N++){let R=X[N];if(R.op==="equal"||R.op==="remove")G++;if(R.op==="equal"||R.op==="add")B++}for(let N of A)if(N.op==="equal")_.push(` ${N.line}`),z++,j++;else if(N.op==="remove")_.push(`-${N.line}`),z++;else if(N.op==="add")_.push(`+${N.line}`),j++;Y.push({operation:"equal",lines:_,oldStart:G,oldCount:z,newStart:B,newCount:j})}return Y}function s0(X){if(X.identical)return"";let Z=[];Z.push(`--- a/${X.filePath}`),Z.push(`+++ b/${X.filePath}`);for(let $ of X.hunks)Z.push(`@@ -${$.oldStart},${$.oldCount} +${$.newStart},${$.newCount} @@`),Z.push(...$.lines);return Z.join(`
5
- `)}function eX(X){if(X.identical)return`\x1B[32m\u2713 ${X.filePath} (unchanged)\x1B[0m`;let Z=[],$=`+${X.stats.additions} -${X.stats.deletions}`;Z.push(`\x1B[1m${X.filePath}\x1B[0m \x1B[90m(${$})\x1B[0m`),Z.push("");for(let J of X.hunks){Z.push(`\x1B[36m@@ -${J.oldStart},${J.oldCount} +${J.newStart},${J.newCount} @@\x1B[0m`);for(let Q of J.lines)if(Q.startsWith("+"))Z.push(`\x1B[32m${Q}\x1B[0m`);else if(Q.startsWith("-"))Z.push(`\x1B[31m${Q}\x1B[0m`);else Z.push(`\x1B[90m${Q}\x1B[0m`);Z.push("")}return Z.join(`
6
- `)}function a0(X){if(X.identical)return`${X.filePath}: unchanged`;return`${X.filePath}: +${X.stats.additions} -${X.stats.deletions} lines`}async function XZ(X,Z,$={}){let J="";try{let Q=QX(X);if(await Q.exists())J=await Q.text();else if(!$.treatMissingAsEmpty)return d("",Z,X,$)}catch{if(!$.treatMissingAsEmpty)return d("",Z,X,$)}return d(J,Z,X,$)}async function i0(X,Z={}){let $=new Map;for(let[J,Q]of X){let q=await XZ(J,Q,Z);$.set(J,q)}return $}function ZZ(X){let Z=0,$=0,J=0,Q=0,q=0;for(let Y of X.values())if(Y.identical)$++;else if(Z++,J+=Y.stats.additions,Q+=Y.stats.deletions,!Y.oldContent)q++;return{totalFiles:X.size,changedFiles:Z,unchangedFiles:$,totalAdditions:J,totalDeletions:Q,newFiles:q}}function $Z(X){console.log(eX(X))}function n0(X,Z=!1){for(let J of X.values()){if(J.identical&&!Z)continue;$Z(J)}let $=ZZ(X);if(console.log(""),console.log(`\x1B[1mSummary:\x1B[0m ${$.totalFiles} files, ${$.changedFiles} changed, ${$.unchangedFiles} unchanged`),$.changedFiles>0)console.log(` \x1B[32m+${$.totalAdditions}\x1B[0m \x1B[31m-${$.totalDeletions}\x1B[0m lines`);if($.newFiles>0)console.log(` ${$.newFiles} new files`)}var YX=["builtin","external","internal","parent","sibling","index","type","unknown"];function VX(X){let Z=X.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+["']([^"']+)["']/);if(!Z){let O=X.match(/^import\s+['"]([^'"]+)['"]/);if(O)return{statement:X,source:O[1],isTypeOnly:!1,group:c(O[1]),specifiers:[]};return null}let[,,$,J,Q]=Z,q=!!$,Y,V,W=[],K=J.trim(),U=K.match(/^\*\s+as\s+(\w+)$/);if(U)V=U[1];else if(K.includes("{")){let O=K.match(/^(\w+)\s*,/);if(O)Y=O[1];let H=K.match(/\{([^}]+)\}/);if(H){let A=H[1].split(",").map((_)=>_.trim()).filter(Boolean);W.push(...A)}}else if(/^\w+$/.test(K))Y=K;else{let O=K.match(/\{([^}]+)\}/);if(O){let H=O[1].split(",").map((A)=>A.trim()).filter(Boolean);W.push(...H)}}return{statement:X,source:Q,isTypeOnly:q,group:c(Q,q),specifiers:W,defaultImport:Y,namespaceImport:V}}function c(X,Z=!1){if(Z)return"type";if(X.startsWith("node:")||JZ(X))return"builtin";if(X.startsWith("./"))return"sibling";if(X.startsWith("../"))return"parent";if(X==="."||X==="./index")return"index";if(X.startsWith("@/")||X.startsWith("~/")||X.startsWith("#"))return"internal";if(X.startsWith("@")||/^[a-z]/.test(X))return"external";return"unknown"}function JZ(X){return["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"].includes(X)}function WX(X,Z={}){let{order:$=[],groupByType:J=!0,groups:Q=YX,alphabetize:q=!0,caseInsensitive:Y=!0,typeImportsLast:V=!1,separateTypeImports:W=!1}=Z,K=[];for(let O of X){let H=VX(O);if(H)K.push(H);else K.push({statement:O,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let U=(O,H)=>{if($.length>0){let A=qX(O.source,$),_=qX(H.source,$);if(A!==_)return A-_}if(J){let A=Q.indexOf(O.group),_=Q.indexOf(H.group),G=A>=0?A:Q.length,B=_>=0?_:Q.length;if(G!==B)return G-B}if(V&&O.isTypeOnly!==H.isTypeOnly)return O.isTypeOnly?1:-1;if(q){let A=Y?O.source.toLowerCase():O.source,_=Y?H.source.toLowerCase():H.source;return A.localeCompare(_)}return 0};if(K.sort(U),J){let O=[],H=null;for(let A of K){if(H!==null&&A.group!==H){let _=Q.indexOf(H),G=Q.indexOf(A.group);if(_>=0&&G>=0&&_!==G)O.push("")}O.push(A.statement),H=A.group}return O}return K.map((O)=>O.statement)}function qX(X,Z){for(let $=0;$<Z.length;$++){let J=Z[$];if(J.startsWith("^"))try{if(new RegExp(J).test(X))return $}catch{if(X.startsWith(J.slice(1)))return $}else if(X.startsWith(J)||X.includes(`/${J}`))return $}return Z.length}function QZ(X,Z={}){let $=X.split(`
7
- `),J=[],Q=[],q=-1;for(let K=0;K<$.length;K++){let U=$[K].trim();if(U.startsWith("import "))J.push($[K]),Q.push(K),q=K;else if(J.length>0&&U==="")continue;else if(J.length>0&&!U.startsWith("import "))break}if(J.length===0)return X;let Y=WX(J,Z),V=$.slice(0,Q[0]),W=$.slice(q+1);while(W.length>0&&W[0].trim()==="")W.shift();return[...V,...Y,"",...W].join(`
8
- `)}function t0(X={}){return{sort:(Z)=>WX(Z,X),sortContent:(Z)=>QZ(Z,X),parse:VX,detectGroup:c}}var e0={default:{groupByType:!0,groups:YX,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};import{createHash as KX}from"crypto";import{mkdir as qZ,readFile as HX,stat as l,writeFile as YZ}from"fs/promises";import{dirname as VZ,join as b}from"path";var g="1.0.0",WZ=".dtsx-cache",UX="manifest.json";class KZ{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(X={}){this.config={enabled:X.enabled??!0,cacheDir:X.cacheDir??WZ,format:X.format??"json",maxAge:X.maxAge??86400000,force:X.force??!1,validateCache:X.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await qZ(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:g,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let X=b(this.config.cacheDir,UX);try{let Z=await HX(X,"utf-8");if(this.manifest=JSON.parse(Z),this.manifest.version!==g){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:g,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let X=b(this.config.cacheDir,UX);this.manifest.updatedAt=Date.now(),await YZ(X,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(X,Z){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let $=this.manifest.entries[X];if(!$)return this.stats.misses++,null;if($.configHash!==Z)return this.stats.misses++,null;if(Date.now()-$.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[X],this.dirty=!0,null;if(this.config.validateCache)try{let Q=(await l(X)).mtimeMs;if(Q!==$.mtime){let q=await HX(X,"utf-8");if(this.hashContent(q)!==$.hash)return this.stats.misses++,null;$.mtime=Q,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[X],this.dirty=!0,null}for(let J of $.dependencies){let Q=this.manifest.entries[J];if(Q)try{if((await l(J)).mtimeMs!==Q.mtime)return this.stats.misses++,null}catch{return this.stats.misses++,null}}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),$}async set(X,Z,$,J,Q,q){if(!this.config.enabled||!this.manifest)return;let Y=Date.now();try{Y=(await l(X)).mtimeMs}catch{}let V={filePath:X,hash:this.hashContent(Z),mtime:Y,declarations:$,dtsContent:J,dependencies:Q,cachedAt:Date.now(),configHash:q};this.manifest.entries[X]=V,this.stats.totalEntries=Object.keys(this.manifest.entries).length,this.dirty=!0}invalidate(X){if(!this.manifest)return;delete this.manifest.entries[X],this.dirty=!0;for(let[Z,$]of Object.entries(this.manifest.entries))if($.dependencies.includes(X))delete this.manifest.entries[Z]}async clear(){this.manifest={version:g,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(X){return KX("sha256").update(X).digest("hex").slice(0,16)}updateHitRatio(){let X=this.stats.hits+this.stats.misses;this.stats.hitRatio=X>0?this.stats.hits/X:0}static hashConfig(X){let Z={outdir:X.outdir,clean:X.clean,tsconfigPath:X.tsconfigPath};return KX("sha256").update(JSON.stringify(Z)).digest("hex").slice(0,16)}}function Q1(X,Z){let $=[],J=[],Q=[];return{async needsRebuild(q){return await X.get(q,Z)===null},async getCachedDeclarations(q){let Y=await X.get(q,Z);if(Y)return J.push(q),Y.declarations;return null},async getCachedDts(q){let Y=await X.get(q,Z);if(Y)return Y.dtsContent;return null},async cacheResult(q,Y,V,W,K=[]){await X.set(q,Y,V,W,K,Z),$.push(q)},skip(q){Q.push(q)},getResult(){return{rebuilt:$,cached:J,skipped:Q,stats:X.getStats()}},async save(){await X.save()}}}async function q1(X,Z=604800000){let $=X.getStats();if($.totalEntries>1000)return await X.clear(),$.totalEntries;return 0}function Y1(X){let Z=[];return Z.push("Incremental Build Results:"),Z.push(` Rebuilt: ${X.rebuilt.length} files`),Z.push(` From cache: ${X.cached.length} files`),Z.push(` Skipped: ${X.skipped.length} files`),Z.push(""),Z.push("Cache Statistics:"),Z.push(` Total entries: ${X.stats.totalEntries}`),Z.push(` Hit ratio: ${(X.stats.hitRatio*100).toFixed(1)}%`),Z.push(` Time saved: ~${X.stats.timeSavedMs}ms`),Z.join(`
9
- `)}function V1(X,Z){let $=[],J=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,Q;while((Q=J.exec(X))!==null){let q=Q[1];if(q.startsWith(".")){let Y=b(VZ(Z),q);$.push(Y),$.push(`${Y}.ts`),$.push(`${Y}.tsx`),$.push(b(Y,"index.ts")),$.push(b(Y,"index.tsx"))}}return $}import{createReadStream as HZ,createWriteStream as UZ,statSync as _Z}from"fs";import{createInterface as OZ}from"readline";class _X{config;profiles=[];cleanupTimer=null;constructor(X={}){this.config={maxMemoryMB:X.maxMemoryMB??512,chunkSize:X.chunkSize??65536,aggressiveGC:X.aggressiveGC??!0,maxDeclarationsInMemory:X.maxDeclarationsInMemory??1e4,profile:X.profile??!1,cleanupInterval:X.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 X=process.memoryUsage();return{heapUsed:X.heapUsed,heapTotal:X.heapTotal,external:X.external,arrayBuffers:X.arrayBuffers,rss:X.rss,heapUsedMB:Math.ceil(X.heapUsed/1024/1024),percentUsed:Math.min(100,Math.round(X.heapUsed/X.heapTotal*100))}}async profile(X,Z){if(!this.config.profile)return Z();let $=this.getMemoryStats(),J=Date.now();try{return await Z()}finally{let Q=this.getMemoryStats(),q=Date.now()-J;this.profiles.push({timestamp:Date.now(),operation:X,memoryBefore:$,memoryAfter:Q,duration:q})}}getProfiles(){return[...this.profiles]}clearProfiles(){this.profiles=[]}async*streamFile(X){let Z=HZ(X,{encoding:"utf-8",highWaterMark:this.config.chunkSize}),$=OZ({input:Z,crlfDelay:1/0});for await(let J of $)yield J}async processFileInChunks(X,Z,$=1000){let J=[],Q=[];for await(let q of this.streamFile(X))if(Q.push(q),Q.length>=$){let Y=await Z(Q);J.push(...Y),Q=[],this.checkMemoryAndCleanup()}if(Q.length>0){let q=await Z(Q);J.push(...q)}return J}async streamWrite(X,Z){let $=UZ(X,{encoding:"utf-8"});return new Promise((J,Q)=>{let q=async()=>{try{for await(let Y of Z)if(!$.write(Y))await new Promise((W)=>$.once("drain",()=>W()));$.end(),$.once("finish",J)}catch(Y){Q(Y)}};$.once("error",Q),q()})}}class AZ{declarations=new Map;registry=new FinalizationRegistry((X)=>{this.declarations.delete(X)});maxSize;constructor(X=1e4){this.maxSize=X}add(X,Z){if(this.declarations.size>=this.maxSize)this.evictOldest();let $=new WeakRef(Z);this.declarations.set(X,$),this.registry.register(Z,X)}get(X){return this.declarations.get(X)?.deref()}has(X){return this.declarations.get(X)?.deref()!==void 0}delete(X){this.declarations.delete(X)}clear(){this.declarations.clear()}get size(){return this.declarations.size}evictOldest(){let X=Math.ceil(this.maxSize*0.2),Z=Array.from(this.declarations.keys());for(let $=0;$<X&&$<Z.length;$++)this.declarations.delete(Z[$])}}class GZ{value=null;loaded=!1;loader;constructor(X){this.loader=X}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 BZ{strings=new Map;maxSize;constructor(X=50000){this.maxSize=X}intern(X){if(X.length>100)return X;let Z=this.strings.get(X);if(Z!==void 0)return Z;if(this.strings.size>=this.maxSize){let $=Array.from(this.strings.keys());for(let J=0;J<$.length/2;J++)this.strings.delete($[J])}return this.strings.set(X,X),X}get size(){return this.strings.size}clear(){this.strings.clear()}}class zZ{pool=[];factory;reset;maxSize;constructor(X,Z,$=1000){this.factory=X,this.reset=Z,this.maxSize=$}acquire(){if(this.pool.length>0)return this.pool.pop();return this.factory()}release(X){if(this.pool.length<this.maxSize)this.reset(X),this.pool.push(X)}get size(){return this.pool.length}clear(){this.pool=[]}}function U1(X,Z={}){return{...X,memory:{maxMemoryMB:Z.maxMemoryMB??512,chunkSize:Z.chunkSize??65536,aggressiveGC:Z.aggressiveGC??!0,maxDeclarationsInMemory:Z.maxDeclarationsInMemory??1e4,profile:Z.profile??!1,cleanupInterval:Z.cleanupInterval??5000}}}function _1(X){let $=_Z(X).size/1024/1024,J=$*4,Q=65536;if($>10)Q=32768;if($>50)Q=16384;return{fileSizeMB:Math.round($*100)/100,estimatedMemoryMB:Math.round(J*100)/100,recommendedChunkSize:Q}}function O1(X){return[`Heap: ${X.heapUsedMB}MB / ${Math.round(X.heapTotal/1024/1024)}MB (${X.percentUsed}%)`,`RSS: ${Math.round(X.rss/1024/1024)}MB`,`External: ${Math.round(X.external/1024/1024)}MB`].join(" | ")}function A1(X={}){return new _X(X)}function B1(X,Z={}){let{mergeInterfaces:$=!0,mergeNamespaces:J=!0,mergeTypes:Q=!1,mergeEnums:q=!0,deduplicateIdentical:Y=!0,conflictStrategy:V="last",preserveAllComments:W=!0}=Z,K=[],U=0,O=new Map;for(let _ of X){let G=`${_.kind}:${_.name}`,B=O.get(G)||[];B.push(_),O.set(G,B)}let H=[],A=new Set;for(let _ of X){let G=`${_.kind}:${_.name}`;if(A.has(G))continue;A.add(G);let B=O.get(G);if(B.length===1){H.push(_);continue}if(!(_.kind==="interface"&&$||_.kind==="module"&&J||_.kind==="type"&&Q||_.kind==="enum"&&q)){H.push(...B);continue}let j=B;if(Y)j=NZ(B);if(j.length===1){H.push(j[0]);continue}let N;switch(_.kind){case"interface":N=RZ(j,V,W);break;case"module":N=FZ(j,V,W);break;case"enum":N=DZ(j,V,W);break;case"type":N=EZ(j,V,W);break;default:N=j[0]}H.push(N),U+=j.length-1,K.push({name:_.name,kind:_.kind,sourceCount:j.length,memberCount:N.members?.length||0})}return{declarations:H,mergedCount:U,merges:K}}function NZ(X){let Z=new Map;for(let $ of X){let J=jZ($.text);if(!Z.has(J))Z.set(J,$);else{let Q=Z.get(J);if(($.leadingComments?.length||0)>(Q.leadingComments?.length||0))Z.set(J,$)}}return Array.from(Z.values())}function jZ(X){return X.replace(/\s+/g," ").replace(/;\s*/g,";").trim()}function RZ(X,Z,$){let J=X[0],Q=new Map,q=[];for(let _ of X){if($&&_.leadingComments){for(let G of _.leadingComments)if(!q.includes(G))q.push(G)}if(_.members)for(let G of _.members)if(!Q.get(G.name))Q.set(G.name,G);else switch(Z){case"first":break;case"last":Q.set(G.name,G);break;case"error":throw Error(`Conflicting member '${G.name}' in interface '${J.name}'`)}}let Y=Array.from(Q.values()),V=Y.map((_)=>` ${_.text}`).join(`
10
- `),W=J.generics||"",K=J.extends||"",U=new Set;for(let _ of X)if(_.extends){let G=_.extends.replace("extends","").trim().split(",");for(let B of G)U.add(B.trim())}if(U.size>0)K=`extends ${Array.from(U).join(", ")}`;let O=J.isExported?"export ":"",H=J.modifiers?.includes("declare")?"declare ":"",A=`${O}${H}interface ${J.name}${W} ${K} {
11
- ${V}
12
- }`;return{...J,members:Y,leadingComments:q.length>0?q:J.leadingComments,text:A.replace(/\s+\{/," {").replace(/\{\s*\n\s*\n/,`{
13
- `),extends:K||void 0}}function FZ(X,Z,$){let J=X[0],Q=new Map,q=[];for(let O of X){if($&&O.leadingComments){for(let H of O.leadingComments)if(!q.includes(H))q.push(H)}if(O.members)for(let H of O.members){let A=`${H.kind}:${H.name}`;if(!Q.get(A))Q.set(A,H);else switch(Z){case"first":break;case"last":Q.set(A,H);break;case"error":throw Error(`Conflicting member '${H.name}' in namespace '${J.name}'`)}}}let Y=Array.from(Q.values()),V=Y.map((O)=>` ${O.text}`).join(`
14
- `),W=J.isExported?"export ":"",K=J.modifiers?.includes("declare")?"declare ":"",U=`${W}${K}namespace ${J.name} {
15
- ${V}
16
- }`;return{...J,members:Y,leadingComments:q.length>0?q:J.leadingComments,text:U}}function DZ(X,Z,$){let J=X[0],Q=new Map,q=[];for(let H of X){if($&&H.leadingComments){for(let A of H.leadingComments)if(!q.includes(A))q.push(A)}if(H.members)for(let A of H.members)if(!Q.get(A.name))Q.set(A.name,A);else switch(Z){case"first":break;case"last":Q.set(A.name,A);break;case"error":throw Error(`Conflicting member '${A.name}' in enum '${J.name}'`)}}let Y=Array.from(Q.values()),V=Y.map((H)=>` ${H.name}${H.value!==void 0?` = ${H.value}`:""}`).join(`,
17
- `),W=J.isExported?"export ":"",K=J.modifiers?.includes("declare")?"declare ":"",U=J.modifiers?.includes("const")?"const ":"",O=`${W}${K}${U}enum ${J.name} {
18
- ${V}
19
- }`;return{...J,members:Y,leadingComments:q.length>0?q:J.leadingComments,text:O}}function EZ(X,Z,$){let J=X[0],Q=[],q=[];for(let U of X){if($&&U.leadingComments){for(let O of U.leadingComments)if(!Q.includes(O))Q.push(O)}if(U.typeAnnotation){if(!q.includes(U.typeAnnotation))q.push(U.typeAnnotation)}}if(q.length<=1)return{...J,leadingComments:Q.length>0?Q:J.leadingComments};let Y=q.join(" | "),V=J.isExported?"export ":"",W=J.generics||"",K=`${V}type ${J.name}${W} = ${Y}`;return{...J,typeAnnotation:Y,leadingComments:Q.length>0?Q:J.leadingComments,text:K}}function z1(X,Z={}){let $=X.split(`
20
- `),J=new Map,Q=null,q=0;for(let K=0;K<$.length;K++){let U=$[K],O=U.match(/^(export\s+)?(declare\s+)?interface\s+(\w+)/);if(O&&!Q){Q={name:O[3],start:K,lines:[U]},q=(U.match(/\{/g)||[]).length-(U.match(/\}/g)||[]).length;continue}if(Q){if(Q.lines.push(U),q+=(U.match(/\{/g)||[]).length-(U.match(/\}/g)||[]).length,q<=0){let H=J.get(Q.name)||[];H.push({start:Q.start,end:K,content:Q.lines}),J.set(Q.name,H),Q=null,q=0}}}let Y=Array.from(J.entries()).filter(([,K])=>K.length>1);if(Y.length===0)return X;let V=[...$],W=new Set;for(let[K,U]of Y){if(U.length<=1)continue;let[O,...H]=U,A=[],_=new Set;for(let z of U)for(let j of z.content){let N=j.trim();if(N.startsWith("interface")||N.startsWith("export")||N==="{"||N==="}")continue;if(N&&!_.has(N))_.add(N),A.push(j)}for(let z of H)for(let j=z.start;j<=z.end;j++)W.add(j);let G=O.content[0],B=[G.endsWith("{")?G:`${G} {`,...A,"}"];for(let z=O.start;z<=O.end;z++)W.add(z);V[O.start]=B.join(`
21
- `)}return V.filter((K,U)=>!W.has(U)||V[U].includes("interface")).join(`
2
+ import{a as i$,b as n$,c as r$}from"../chunk-83e9a4fq.js";import{d as S9,e as T9,f as k9,g as v9,h as C9,i as b9,j as P9,k as x9}from"../chunk-f4c389mj.js";import{l as Q2,m as X2,n as q2,o as V2,p as Y2,q as W2,r as K2}from"../chunk-j2yw0d45.js";import{s as p$,t as d$,u as c$,v as l$,w as o$,x as s$,y as a$}from"../chunk-xhs0tsnn.js";import{A as p8,B as d8,C as c8,D as l8,E as o8,F as s8,G as a8,H as i8,z as m8}from"../chunk-mxam9312.js";import{I as Z$,J as $$,K as J$,L as Q$,M as X$,N as q$,O as V$,P as Y$}from"../chunk-d0p3jzwb.js";import{Q as n8,R as r8,S as t8,T as e8,U as Z9,V as $9,W as J9,X as Q9,Y as X9}from"../chunk-nf54b52t.js";import{$ as Z2,Z as t$,_ as e$,aa as $2,ba as J2}from"../chunk-zf17s33e.js";import{$a as t9,Aa as u8,Ba as q9,Ca as V9,Da as Y9,Ea as QZ,Fa as W9,Ga as K9,Ha as H9,Ia as U9,Ja as O9,Ka as G9,La as y9,Ma as h9,Na as g9,Oa as f9,Pa as u9,Qa as m9,Ra as p9,Sa as d9,Ta as c9,Ua as l9,Va as o9,Wa as s9,Xa as a9,Ya as i9,Za as n9,_a as r9,ab as e9,bb as W$,cb as K$,db as H$,eb as U$,fb as O$,gb as G$,hb as uZ,ib as _$,jb as z$,kb as A$,lb as T$,mb as k$,nb as v$,ob as C$,pb as b$,qb as P$,rb as x$,sb as y$,tb as f$,ua as P8,ub as u$,va as x8,vb as m$,wa as y8,xa as h8,ya as g8,za as f8}from"../chunk-14gh6ezz.js";import{$b as I8,Ab as s6,Bb as s0,Cb as a0,Db as Q8,Eb as X8,Fb as q8,Gb as V8,Hb as Y8,Ib as W8,Jb as K8,Kb as H8,Lb as U8,Mb as O8,Nb as G8,Ob as _8,Pb as z8,Qb as A8,Rb as B8,Sb as j8,Tb as N8,Ub as R8,Vb as F8,Wb as D8,Xb as E8,Yb as L8,Zb as w8,_b as M8,ac as S8,bc as T8,cc as k8,dc as v8,ec as FZ,fc as C8,gc as b8,wb as d6,xb as c6,yb as l6,zb as o6}from"../chunk-y581wnfe.js";import{hc as g0}from"../chunk-2n1bbm2c.js";import{ic as h$,jc as g$}from"../chunk-4s9jv983.js";import{lc as KZ}from"../chunk-8z31rkfp.js";import"../chunk-2r21f44d.js";import{Ac as I$,Bc as S$,Cc as DZ,pc as i0,qc as B$,rc as j$,sc as N$,tc as R$,uc as F$,vc as D$,wc as E$,xc as L$,yc as w$,zc as M$}from"../chunk-vpjw38x7.js";import{Fc as a6,Gc as i6,Hc as n6,Ic as r6,Jc as t6,Kc as o0,Lc as e6,Mc as Z8,Nc as $8,Oc as J8}from"../chunk-285mqzvx.js";import{Pc as D9,Qc as E9,Rc as L9,Sc as w9,Tc as M9,Uc as I9}from"../chunk-a3txc27m.js";import{$c as R9,Vc as _9,Wc as z9,Xc as A9,Yc as B9,Zc as j9,_c as N9,ad as F9}from"../chunk-gssantc8.js";import{bd as h0,dd as n0}from"../chunk-mcdb3q06.js";import{basename as rZ,dirname as tZ,isAbsolute as eZ,join as Z0,relative as $0,resolve as J0}from"path";function l1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid file path: must be a non-empty string");return Z}function o1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid directory path: must be a non-empty string");return Z}function s1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return Z}function a1(Z){if(typeof Z!=="string")throw TypeError("Invalid source code: must be a string");return Z}function i1(Z){if(typeof Z!=="string")throw TypeError("Invalid DTS content: must be a string");return Z}function n1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid module specifier: must be a non-empty string");return Z}function r1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(Z)&&!/^[A-Z_$]/.test(Z));return Z}function t1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid declaration name: must be a non-empty string");return Z}function e1(Z){if(!Z||typeof Z!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!Z.startsWith("/")&&!/^[A-Z]:/i.test(Z))throw Error("Invalid absolute path: must start with / or drive letter");return Z}function Z3(Z){if(!Z||typeof Z!=="string")throw Error("Invalid relative path: must be a non-empty string");if(Z.startsWith("/")||/^[A-Z]:/i.test(Z))throw Error("Invalid relative path: must not be absolute");return Z}function $3(Z){if(typeof Z!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(Z)}catch{throw Error("Invalid JSON string: must be valid JSON")}return Z}function J3(Z,$){return typeof Z==="string"||typeof Z==="number"}function Q3(Z){return Z}var X3={join(Z,...$){return Z0(Z,...$)},dirname(Z){return tZ(Z)},basename(Z){return rZ(Z)},resolve(...Z){return J0(...Z)},isAbsolute(Z){return eZ(Z)},relative(Z,$){return $0(Z,$)}};function Q0(Z,$){let J=Z.length,Q=$.length,X=Array.from({length:J+1},()=>Array(Q+1).fill(0));for(let q=1;q<=J;q++)for(let V=1;V<=Q;V++)if(Z[q-1]===$[V-1])X[q][V]=X[q-1][V-1]+1;else X[q][V]=Math.max(X[q-1][V],X[q][V-1]);return X}function X0(Z,$,J,Q,X){let q=[];while(Q>0||X>0)if(Q>0&&X>0&&$[Q-1]===J[X-1])q.unshift({op:"equal",oldIdx:Q-1,newIdx:X-1,line:$[Q-1]}),Q--,X--;else if(X>0&&(Q===0||Z[Q][X-1]>=Z[Q-1][X]))q.unshift({op:"add",newIdx:X-1,line:J[X-1]}),X--;else if(Q>0)q.unshift({op:"remove",oldIdx:Q-1,line:$[Q-1]}),Q--;return q}function JZ(Z,$){let J=Z;if($.ignoreWhitespace)J=J.replace(/\s+/g," ").trim();return J}function p(Z,$,J,Q={}){let{context:X=3,ignoreWhitespace:q=!1,ignoreBlankLines:V=!1}=Q,Y=Z.split(`
3
+ `),W=$.split(`
4
+ `);if(Y[Y.length-1]==="")Y.pop();if(W[W.length-1]==="")W.pop();let K=Y.map((F)=>JZ(F,{ignoreWhitespace:q})),H=W.map((F)=>JZ(F,{ignoreWhitespace:q})),A=K,_=H,O=Y.map((F,M)=>M),G=W.map((F,M)=>M);if(V)A=[],_=[],O=[],G=[],K.forEach((F,M)=>{if(F.trim())A.push(F),O.push(M)}),H.forEach((F,M)=>{if(F.trim())_.push(F),G.push(M)});let U=Q0(A,_),z=X0(U,A,_,A.length,_.length),B=z.every((F)=>F.op==="equal"),j=0,N=0,R=0;for(let F of z)if(F.op==="add")j++;else if(F.op==="remove")N++;else R++;let k=q0(z,Y,W,O,G,X);return{filePath:J,identical:B,hunks:k,stats:{additions:j,deletions:N,unchanged:R},oldContent:Z,newContent:$}}function q0(Z,$,J,Q,X,q){let V=[],Y=[];if(Z.forEach((H,A)=>{if(H.op!=="equal")Y.push(A)}),Y.length===0)return V;let W=[],K=[Y[0]];for(let H=1;H<Y.length;H++)if(Y[H]-Y[H-1]<=q*2+1)K.push(Y[H]);else W.push(K),K=[Y[H]];W.push(K);for(let H of W){let A=Math.max(0,H[0]-q),_=Math.min(Z.length-1,H[H.length-1]+q),O=Z.slice(A,_+1),G=[],U=1,z=1,B=0,j=0;for(let N=0;N<A;N++){let R=Z[N];if(R.op==="equal"||R.op==="remove")U++;if(R.op==="equal"||R.op==="add")z++}for(let N of O)if(N.op==="equal")G.push(` ${N.line}`),B++,j++;else if(N.op==="remove")G.push(`-${N.line}`),B++;else if(N.op==="add")G.push(`+${N.line}`),j++;V.push({operation:"equal",lines:G,oldStart:U,oldCount:B,newStart:z,newCount:j})}return V}function Y3(Z){if(Z.identical)return"";let $=[];$.push(`--- a/${Z.filePath}`),$.push(`+++ b/${Z.filePath}`);for(let J of Z.hunks)$.push(`@@ -${J.oldStart},${J.oldCount} +${J.newStart},${J.newCount} @@`),$.push(...J.lines);return $.join(`
5
+ `)}function V0(Z){if(Z.identical)return`\x1B[32m\u2713 ${Z.filePath} (unchanged)\x1B[0m`;let $=[],J=`+${Z.stats.additions} -${Z.stats.deletions}`;$.push(`\x1B[1m${Z.filePath}\x1B[0m \x1B[90m(${J})\x1B[0m`),$.push("");for(let Q of Z.hunks){$.push(`\x1B[36m@@ -${Q.oldStart},${Q.oldCount} +${Q.newStart},${Q.newCount} @@\x1B[0m`);for(let X of Q.lines)if(X.startsWith("+"))$.push(`\x1B[32m${X}\x1B[0m`);else if(X.startsWith("-"))$.push(`\x1B[31m${X}\x1B[0m`);else $.push(`\x1B[90m${X}\x1B[0m`);$.push("")}return $.join(`
6
+ `)}function W3(Z){if(Z.identical)return`${Z.filePath}: unchanged`;return`${Z.filePath}: +${Z.stats.additions} -${Z.stats.deletions} lines`}async function Y0(Z,$,J={}){let Q="";try{let X=QZ(Z);if(await X.exists())Q=await X.text();else if(!J.treatMissingAsEmpty)return p("",$,Z,J)}catch{if(!J.treatMissingAsEmpty)return p("",$,Z,J)}return p(Q,$,Z,J)}async function K3(Z,$={}){let J=new Map;for(let[Q,X]of Z){let q=await Y0(Q,X,$);J.set(Q,q)}return J}function W0(Z){let $=0,J=0,Q=0,X=0,q=0;for(let V of Z.values())if(V.identical)J++;else if($++,Q+=V.stats.additions,X+=V.stats.deletions,!V.oldContent)q++;return{totalFiles:Z.size,changedFiles:$,unchangedFiles:J,totalAdditions:Q,totalDeletions:X,newFiles:q}}function K0(Z){console.log(V0(Z))}function H3(Z,$=!1){for(let Q of Z.values()){if(Q.identical&&!$)continue;K0(Q)}let J=W0(Z);if(console.log(""),console.log(`\x1B[1mSummary:\x1B[0m ${J.totalFiles} files, ${J.changedFiles} changed, ${J.unchangedFiles} unchanged`),J.changedFiles>0)console.log(` \x1B[32m+${J.totalAdditions}\x1B[0m \x1B[31m-${J.totalDeletions}\x1B[0m lines`);if(J.newFiles>0)console.log(` ${J.newFiles} new files`)}var XZ=["builtin","external","internal","parent","sibling","index","type","unknown"];function qZ(Z){let $=Z.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/);if(!$){let A=Z.match(/^import\s+['"]([^'"]+)['"]/);if(A)return{statement:Z,source:A[1],isTypeOnly:!1,group:d(A[1]),specifiers:[]};return null}let[,,J,Q,X]=$,q=!!J,V,Y,W=[],K=Q.trim(),H=K.match(/^\*\s+as\s+(\w+)$/);if(H)Y=H[1];else if(K.includes("{")){let A=K.match(/^(\w+)\s*,/);if(A)V=A[1];let _=K.match(/\{([^}]+)\}/);if(_){let O=_[1].split(",").map((G)=>G.trim()).filter(Boolean);W.push(...O)}}else if(/^\w+$/.test(K))V=K;else{let A=K.match(/\{([^}]+)\}/);if(A){let _=A[1].split(",").map((O)=>O.trim()).filter(Boolean);W.push(..._)}}return{statement:Z,source:X,isTypeOnly:q,group:d(X,q),specifiers:W,defaultImport:V,namespaceImport:Y}}function d(Z,$=!1){if($)return"type";if(Z.startsWith("node:")||U0(Z))return"builtin";if(Z.startsWith("./"))return"sibling";if(Z.startsWith("../"))return"parent";if(Z==="."||Z==="./index")return"index";if(Z.startsWith("@/")||Z.startsWith("~/")||Z.startsWith("#"))return"internal";if(Z.startsWith("@")||/^[a-z]/.test(Z))return"external";return"unknown"}var H0=new Set(["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"]);function U0(Z){return H0.has(Z)}function VZ(Z,$={}){let{order:J=[],groupByType:Q=!0,groups:X=XZ,alphabetize:q=!0,caseInsensitive:V=!0,typeImportsLast:Y=!1,separateTypeImports:W=!1}=$,K=[];for(let U of Z){let z=qZ(U);if(z)K.push(z);else K.push({statement:U,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let H=J.length>0?J.map((U)=>{if(U.startsWith("^"))try{return{regex:new RegExp(U),prefix:U.slice(1)}}catch{return{prefix:U.slice(1)}}return{prefix:U}}):[],A=(U)=>{for(let z=0;z<H.length;z++){let B=H[z];if(B.regex){if(B.regex.test(U))return z}else if(U.startsWith(B.prefix)||U.includes(`/${B.prefix}`))return z}return H.length},_=new Map,O=(U)=>{let z=_.get(U);if(z!==void 0)return z;let B=X.indexOf(U),j=B>=0?B:X.length;return _.set(U,j),j},G=(U,z)=>{if(H.length>0){let B=A(U.source),j=A(z.source);if(B!==j)return B-j}if(Q){let B=O(U.group),j=O(z.group);if(B!==j)return B-j}if(Y&&U.isTypeOnly!==z.isTypeOnly)return U.isTypeOnly?1:-1;if(q){let B=V?U.source.toLowerCase():U.source,j=V?z.source.toLowerCase():z.source;return B.localeCompare(j)}return 0};if(K.sort(G),Q){let U=[],z=null;for(let B of K){if(z!==null&&B.group!==z){let j=X.indexOf(z),N=X.indexOf(B.group);if(j>=0&&N>=0&&j!==N)U.push("")}U.push(B.statement),z=B.group}return U}return K.map((U)=>U.statement)}function O0(Z,$={}){let J=Z.split(`
7
+ `),Q=[],X=[],q=-1;for(let K=0;K<J.length;K++){let H=J[K].trim();if(H.startsWith("import "))Q.push(J[K]),X.push(K),q=K;else if(Q.length>0&&H==="")continue;else if(Q.length>0&&!H.startsWith("import "))break}if(Q.length===0)return Z;let V=VZ(Q,$),Y=J.slice(0,X[0]),W=J.slice(q+1);while(W.length>0&&W[0].trim()==="")W.shift();return[...Y,...V,"",...W].join(`
8
+ `)}function O3(Z={}){return{sort:($)=>VZ($,Z),sortContent:($)=>O0($,Z),parse:qZ,detectGroup:d}}var G3={default:{groupByType:!0,groups:XZ,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};import{createHash as G0}from"crypto";import{mkdir as _0,readFile as YZ,stat as c,writeFile as z0}from"fs/promises";import{dirname as A0,join as C}from"path";var h="1.0.0",B0=".dtsx-cache",WZ="manifest.json";class j0{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(Z={}){this.config={enabled:Z.enabled??!0,cacheDir:Z.cacheDir??B0,format:Z.format??"json",maxAge:Z.maxAge??86400000,force:Z.force??!1,validateCache:Z.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await _0(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:h,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let Z=C(this.config.cacheDir,WZ);try{let $=await YZ(Z,"utf-8");if(this.manifest=JSON.parse($),this.manifest.version!==h){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:h,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let Z=C(this.config.cacheDir,WZ);this.manifest.updatedAt=Date.now(),await z0(Z,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(Z,$){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let J=this.manifest.entries[Z];if(!J)return this.stats.misses++,null;if(J.configHash!==$)return this.stats.misses++,null;if(Date.now()-J.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[Z],this.dirty=!0,null;if(this.config.validateCache)try{let X=(await c(Z)).mtimeMs;if(X!==J.mtime){let q=await YZ(Z,"utf-8");if(this.hashContent(q)!==J.hash)return this.stats.misses++,null;J.mtime=X,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[Z],this.dirty=!0,null}if(J.dependencies.length>0){if((await Promise.all(J.dependencies.map(async(X)=>{let q=this.manifest.entries[X];if(!q)return!0;try{return(await c(X)).mtimeMs===q.mtime}catch{return!1}}))).some((X)=>!X))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),J}async set(Z,$,J,Q,X,q){if(!this.config.enabled||!this.manifest)return;let V=Date.now();try{V=(await c(Z)).mtimeMs}catch{}let Y={filePath:Z,hash:this.hashContent($),mtime:V,declarations:J,dtsContent:Q,dependencies:X,cachedAt:Date.now(),configHash:q};if(!(Z in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[Z]=Y,this.dirty=!0}invalidate(Z){if(!this.manifest)return;delete this.manifest.entries[Z],this.dirty=!0;for(let[$,J]of Object.entries(this.manifest.entries))if(J.dependencies.includes(Z))delete this.manifest.entries[$]}async clear(){this.manifest={version:h,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(Z){return String(KZ(Z))}updateHitRatio(){let Z=this.stats.hits+this.stats.misses;this.stats.hitRatio=Z>0?this.stats.hits/Z:0}static hashConfig(Z){let $={outdir:Z.outdir,clean:Z.clean,tsconfigPath:Z.tsconfigPath};return G0("sha256").update(JSON.stringify($)).digest("hex").slice(0,16)}}function N3(Z,$){let J=[],Q=[],X=[];return{async needsRebuild(q){return await Z.get(q,$)===null},async getCachedDeclarations(q){let V=await Z.get(q,$);if(V)return Q.push(q),V.declarations;return null},async getCachedDts(q){let V=await Z.get(q,$);if(V)return V.dtsContent;return null},async cacheResult(q,V,Y,W,K=[]){await Z.set(q,V,Y,W,K,$),J.push(q)},skip(q){X.push(q)},getResult(){return{rebuilt:J,cached:Q,skipped:X,stats:Z.getStats()}},async save(){await Z.save()}}}async function R3(Z,$=604800000){let J=Z.getStats();if(J.totalEntries>1000)return await Z.clear(),J.totalEntries;return 0}function F3(Z){let $=[];return $.push("Incremental Build Results:"),$.push(` Rebuilt: ${Z.rebuilt.length} files`),$.push(` From cache: ${Z.cached.length} files`),$.push(` Skipped: ${Z.skipped.length} files`),$.push(""),$.push("Cache Statistics:"),$.push(` Total entries: ${Z.stats.totalEntries}`),$.push(` Hit ratio: ${(Z.stats.hitRatio*100).toFixed(1)}%`),$.push(` Time saved: ~${Z.stats.timeSavedMs}ms`),$.join(`
9
+ `)}function D3(Z,$){let J=[],Q=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,X;while((X=Q.exec(Z))!==null){let q=X[1];if(q.startsWith(".")){let V=C(A0($),q);J.push(V),J.push(`${V}.ts`),J.push(`${V}.tsx`),J.push(C(V,"index.ts")),J.push(C(V,"index.tsx"))}}return J}import{createReadStream as N0,createWriteStream as R0,statSync as F0}from"fs";import{createInterface as D0}from"readline";class HZ{config;profiles=[];cleanupTimer=null;constructor(Z={}){this.config={maxMemoryMB:Z.maxMemoryMB??512,chunkSize:Z.chunkSize??65536,aggressiveGC:Z.aggressiveGC??!0,maxDeclarationsInMemory:Z.maxDeclarationsInMemory??1e4,profile:Z.profile??!1,cleanupInterval:Z.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 Z=process.memoryUsage();return{heapUsed:Z.heapUsed,heapTotal:Z.heapTotal,external:Z.external,arrayBuffers:Z.arrayBuffers,rss:Z.rss,heapUsedMB:Math.ceil(Z.heapUsed/1024/1024),percentUsed:Math.min(100,Math.round(Z.heapUsed/Z.heapTotal*100))}}async profile(Z,$){if(!this.config.profile)return $();let J=this.getMemoryStats(),Q=Date.now();try{return await $()}finally{let X=this.getMemoryStats(),q=Date.now()-Q;this.profiles.push({timestamp:Date.now(),operation:Z,memoryBefore:J,memoryAfter:X,duration:q})}}getProfiles(){return[...this.profiles]}clearProfiles(){this.profiles=[]}async*streamFile(Z){let $=N0(Z,{encoding:"utf-8",highWaterMark:this.config.chunkSize}),J=D0({input:$,crlfDelay:1/0});for await(let Q of J)yield Q}async processFileInChunks(Z,$,J=1000){let Q=[],X=[];for await(let q of this.streamFile(Z))if(X.push(q),X.length>=J){let V=await $(X);Q.push(...V),X=[],this.checkMemoryAndCleanup()}if(X.length>0){let q=await $(X);Q.push(...q)}return Q}async streamWrite(Z,$){let J=R0(Z,{encoding:"utf-8"});return new Promise((Q,X)=>{let q=async()=>{try{for await(let V of $)if(!J.write(V))await new Promise((W)=>J.once("drain",()=>W()));J.end(),J.once("finish",Q)}catch(V){X(V)}};J.once("error",X),q()})}}class E0{declarations=new Map;registry=new FinalizationRegistry((Z)=>{this.declarations.delete(Z)});maxSize;constructor(Z=1e4){this.maxSize=Z}add(Z,$){if(this.declarations.size>=this.maxSize)this.evictOldest();let J=new WeakRef($);this.declarations.set(Z,J),this.registry.register($,Z)}get(Z){return this.declarations.get(Z)?.deref()}has(Z){return this.declarations.get(Z)?.deref()!==void 0}delete(Z){this.declarations.delete(Z)}clear(){this.declarations.clear()}get size(){return this.declarations.size}evictOldest(){let Z=Math.ceil(this.maxSize*0.2),$=Array.from(this.declarations.keys());for(let J=0;J<Z&&J<$.length;J++)this.declarations.delete($[J])}}class L0{value=null;loaded=!1;loader;constructor(Z){this.loader=Z}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 w0{strings=new Map;maxSize;constructor(Z=50000){this.maxSize=Z}intern(Z){if(Z.length>100)return Z;let $=this.strings.get(Z);if($!==void 0)return $;if(this.strings.size>=this.maxSize){let J=Array.from(this.strings.keys());for(let Q=0;Q<J.length/2;Q++)this.strings.delete(J[Q])}return this.strings.set(Z,Z),Z}get size(){return this.strings.size}clear(){this.strings.clear()}}class M0{pool=[];factory;reset;maxSize;constructor(Z,$,J=1000){this.factory=Z,this.reset=$,this.maxSize=J}acquire(){if(this.pool.length>0)return this.pool.pop();return this.factory()}release(Z){if(this.pool.length<this.maxSize)this.reset(Z),this.pool.push(Z)}get size(){return this.pool.length}clear(){this.pool=[]}}function M3(Z,$={}){return{...Z,memory:{maxMemoryMB:$.maxMemoryMB??512,chunkSize:$.chunkSize??65536,aggressiveGC:$.aggressiveGC??!0,maxDeclarationsInMemory:$.maxDeclarationsInMemory??1e4,profile:$.profile??!1,cleanupInterval:$.cleanupInterval??5000}}}function I3(Z){let J=F0(Z).size/1024/1024,Q=J*4,X=65536;if(J>10)X=32768;if(J>50)X=16384;return{fileSizeMB:Math.round(J*100)/100,estimatedMemoryMB:Math.round(Q*100)/100,recommendedChunkSize:X}}function S3(Z){return[`Heap: ${Z.heapUsedMB}MB / ${Math.round(Z.heapTotal/1024/1024)}MB (${Z.percentUsed}%)`,`RSS: ${Math.round(Z.rss/1024/1024)}MB`,`External: ${Math.round(Z.external/1024/1024)}MB`].join(" | ")}function T3(Z={}){return new HZ(Z)}function v3(Z,$={}){let{mergeInterfaces:J=!0,mergeNamespaces:Q=!0,mergeTypes:X=!1,mergeEnums:q=!0,deduplicateIdentical:V=!0,conflictStrategy:Y="last",preserveAllComments:W=!0}=$,K=[],H=0,A=new Map,_=[];for(let G of Z){let U=`${G.kind}:${G.name}`,z=A.get(U);if(!z)z=[],A.set(U,z),_.push(U);z.push(G)}let O=[];for(let G of _){let U=A.get(G),z=U[0];if(U.length===1){O.push(z);continue}if(!(z.kind==="interface"&&J||z.kind==="module"&&Q||z.kind==="type"&&X||z.kind==="enum"&&q)){O.push(...U);continue}let j=U;if(V)j=I0(U);if(j.length===1){O.push(j[0]);continue}let N;switch(z.kind){case"interface":N=T0(j,Y,W);break;case"module":N=k0(j,Y,W);break;case"enum":N=v0(j,Y,W);break;case"type":N=C0(j,Y,W);break;default:N=j[0]}O.push(N),H+=j.length-1,K.push({name:z.name,kind:z.kind,sourceCount:j.length,memberCount:N.members?.length||0})}return{declarations:O,mergedCount:H,merges:K}}function I0(Z){let $=new Map;for(let J of Z){let Q=S0(J.text);if(!$.has(Q))$.set(Q,J);else{let X=$.get(Q);if((J.leadingComments?.length||0)>(X.leadingComments?.length||0))$.set(Q,J)}}return Array.from($.values())}function S0(Z){return Z.replace(/\s+/g," ").replace(/;\s*/g,";").trim()}function T0(Z,$,J){let Q=Z[0],X=new Map,q=[],V=J?new Set:null;for(let U of Z){if(J&&U.leadingComments&&V){for(let z of U.leadingComments)if(!V.has(z))V.add(z),q.push(z)}if(U.members)for(let z of U.members)if(!X.get(z.name))X.set(z.name,z);else switch($){case"first":break;case"last":X.set(z.name,z);break;case"error":throw Error(`Conflicting member '${z.name}' in interface '${Q.name}'`)}}let Y=Array.from(X.values()),W=Y.map((U)=>` ${U.text}`).join(`
10
+ `),K=Q.generics||"",H=Q.extends||"",A=new Set;for(let U of Z)if(U.extends){let z=U.extends.split(",");for(let B of z){let j=B.trim();if(j)A.add(j)}}if(A.size>0)H=`extends ${Array.from(A).join(", ")}`;let _=Q.isExported?"export ":"",O=Q.modifiers?.includes("declare")?"declare ":"",G=`${_}${O}interface ${Q.name}${K} ${H} {
11
+ ${W}
12
+ }`;return{...Q,members:Y,leadingComments:q.length>0?q:Q.leadingComments,text:G.replace(/\s+\{/," {").replace(/\{\s*\n\s*\n/,`{
13
+ `),extends:H||void 0}}function k0(Z,$,J){let Q=Z[0],X=new Map,q=[],V=J?new Set:null;for(let _ of Z){if(J&&_.leadingComments&&V){for(let O of _.leadingComments)if(!V.has(O))V.add(O),q.push(O)}if(_.members)for(let O of _.members){let G=`${O.kind}:${O.name}`;if(!X.get(G))X.set(G,O);else switch($){case"first":break;case"last":X.set(G,O);break;case"error":throw Error(`Conflicting member '${O.name}' in namespace '${Q.name}'`)}}}let Y=Array.from(X.values()),W=Y.map((_)=>` ${_.text}`).join(`
14
+ `),K=Q.isExported?"export ":"",H=Q.modifiers?.includes("declare")?"declare ":"",A=`${K}${H}namespace ${Q.name} {
15
+ ${W}
16
+ }`;return{...Q,members:Y,leadingComments:q.length>0?q:Q.leadingComments,text:A}}function v0(Z,$,J){let Q=Z[0],X=new Map,q=[],V=J?new Set:null;for(let O of Z){if(J&&O.leadingComments&&V){for(let G of O.leadingComments)if(!V.has(G))V.add(G),q.push(G)}if(O.members)for(let G of O.members)if(!X.get(G.name))X.set(G.name,G);else switch($){case"first":break;case"last":X.set(G.name,G);break;case"error":throw Error(`Conflicting member '${G.name}' in enum '${Q.name}'`)}}let Y=Array.from(X.values()),W=Y.map((O)=>` ${O.name}${O.value!==void 0?` = ${O.value}`:""}`).join(`,
17
+ `),K=Q.isExported?"export ":"",H=Q.modifiers?.includes("declare")?"declare ":"",A=Q.modifiers?.includes("const")?"const ":"",_=`${K}${H}${A}enum ${Q.name} {
18
+ ${W}
19
+ }`;return{...Q,members:Y,leadingComments:q.length>0?q:Q.leadingComments,text:_}}function C0(Z,$,J){let Q=Z[0],X=[],q=J?new Set:null,V=[],Y=new Set;for(let _ of Z){if(J&&_.leadingComments&&q){for(let O of _.leadingComments)if(!q.has(O))q.add(O),X.push(O)}if(_.typeAnnotation&&!Y.has(_.typeAnnotation))Y.add(_.typeAnnotation),V.push(_.typeAnnotation)}if(V.length<=1)return{...Q,leadingComments:X.length>0?X:Q.leadingComments};let W=V.join(" | "),K=Q.isExported?"export ":"",H=Q.generics||"",A=`${K}type ${Q.name}${H} = ${W}`;return{...Q,typeAnnotation:W,leadingComments:X.length>0?X:Q.leadingComments,text:A}}function C3(Z,$={}){let J=Z.split(`
20
+ `),Q=new Map,X=null,q=0;for(let K=0;K<J.length;K++){let H=J[K],A=H.match(/^(export\s+)?(declare\s+)?interface\s+(\w+)/);if(A&&!X){X={name:A[3],start:K,lines:[H]},q=(H.match(/\{/g)||[]).length-(H.match(/\}/g)||[]).length;continue}if(X){if(X.lines.push(H),q+=(H.match(/\{/g)||[]).length-(H.match(/\}/g)||[]).length,q<=0){let _=Q.get(X.name)||[];_.push({start:X.start,end:K,content:X.lines}),Q.set(X.name,_),X=null,q=0}}}let V=Array.from(Q.entries()).filter(([,K])=>K.length>1);if(V.length===0)return Z;let Y=[...J],W=new Set;for(let[K,H]of V){if(H.length<=1)continue;let[A,..._]=H,O=[],G=new Set;for(let B of H)for(let j of B.content){let N=j.trim();if(N.startsWith("interface")||N.startsWith("export")||N==="{"||N==="}")continue;if(N&&!G.has(N))G.add(N),O.push(j)}for(let B of _)for(let j=B.start;j<=B.end;j++)W.add(j);let U=A.content[0],z=[U.endsWith("{")?U:`${U} {`,...O,"}"];for(let B=A.start;B<=A.end;B++)W.add(B);Y[A.start]=z.join(`
21
+ `)}return Y.filter((K,H)=>!W.has(H)||Y[H].includes("interface")).join(`
22
22
  `).replace(/\n{3,}/g,`
23
23
 
24
- `)}var GX=["import","type","interface","enum","class","function","variable","export","module","namespace","unknown"],LZ=["builtin","external","scoped","internal","parent","sibling","index","type"];function MZ(X,Z={}){let{lineEnding:$="lf",trailingNewline:J=!0,maxBlankLines:Q=1,trimTrailingWhitespace:q=!0,normalizeIndentation:Y=!0,indent:V={style:"spaces",size:2},declarationOrder:W,importGrouping:K,preserveComments:U=!0,insertFinalNewline:O=!0}=Z,H=X;if(H=BX(H,$),K?.enabled!==!1)H=RX(H,K||{});if(W)H=FX(H,W);if(q)H=zX(H);if(H=NX(H,Q),Y)H=wZ(H,V);if(J||O)H=jX(H);return H}function BX(X,Z){let $=X.replace(/\r\n/g,`
25
- `).replace(/\r/g,`
26
- `);if(Z==="crlf")$=$.replace(/\n/g,`\r
27
- `);return $}function j1(X){let Z=(X.match(/\r\n/g)||[]).length,$=(X.match(/(?<!\r)\n/g)||[]).length;if(Z>$)return"crlf";return"lf"}function zX(X){return X.split(`
28
- `).map((Z)=>Z.replace(/[\t ]+$/,"")).join(`
29
- `)}function NX(X,Z){let $=new RegExp(`\\n{${Z+2},}`,"g");return X.replace($,`
30
- `.repeat(Z+1))}function jX(X){return`${X.replace(/\s+$/,"")}
31
- `}function wZ(X,Z){let{style:$="spaces",size:J=2}=Z,Q=$==="tabs"?"\t":" ".repeat(J),q=X.split(`
32
- `),Y=[];for(let V of q){let W=V.match(/^([\t ]*)(.*)$/);if(!W){Y.push(V);continue}let[,K,U]=W;if(!U){Y.push("");continue}let O=K.replace(/\t/g," "),H=Math.floor(O.length/2);Y.push(Q.repeat(H)+U)}return Y.join(`
33
- `)}function RX(X,Z){let{groups:$=LZ,separateGroups:J=!0,alphabetize:Q=!0}=Z,q=X.split(`
34
- `),Y=[],V=[],W=-1;for(let _=0;_<q.length;_++){let G=q[_],B=OX(G);if(B)Y.push({line:G,source:B.source,group:B.group,isType:B.isType}),W=_;else if(Y.length>0&&G.trim()==="")continue;else if(Y.length>0||G.trim()!==""){if(Y.length===0||_>W+1)V.push(G)}}if(Y.length===0)return X;let K=new Map;for(let _ of $)K.set(_,[]);for(let _ of Y)(K.get(_.group)||K.get("external")||[]).push(_);if(Q)for(let[,_]of K)_.sort((G,B)=>{if(G.isType!==B.isType)return G.isType?1:-1;return G.source.localeCompare(B.source)});let U=[],O=null;for(let _ of $){let G=K.get(_)||[];if(G.length===0)continue;if(J&&O!==null)U.push("");for(let B of G)U.push(B.line);O=_}let H=q.slice(0,q.findIndex((_)=>OX(_)!==null)),A=V;while(A.length>0&&A[0].trim()==="")A.shift();return[...H,...U,"",...A].join(`
35
- `)}function OX(X){let Z=X.trim(),$=Z.match(/^import\s+(type\s+)?.*from\s+['"]([^'"]+)['"]/);if(!$){let q=Z.match(/^import\s+['"]([^'"]+)['"]/);if(q)return{source:q[1],group:AX(q[1]),isType:!1};return null}let J=!!$[1],Q=$[2];return{source:Q,group:J?"type":AX(Q),isType:J}}function AX(X){if(X.startsWith("node:"))return"builtin";let Z=["assert","buffer","child_process","cluster","crypto","dgram","dns","events","fs","http","https","net","os","path","querystring","readline","stream","url","util","zlib"];if(Z.includes(X)||Z.includes(X.split("/")[0]))return"builtin";if(X==="."||X==="./index"||X==="./index.js"||X==="./index.ts")return"index";if(X.startsWith("./"))return"sibling";if(X.startsWith("../"))return"parent";if(X.startsWith("@/")||X.startsWith("~/")||X.startsWith("#"))return"internal";if(X.startsWith("@"))return"scoped";return"external"}function FX(X,Z){let{kinds:$=GX,alphabetize:J=!1,groupExports:Q=!0}=Z,q=X.split(`
36
- `),Y=[],V=[],W=[],K=null,U=0,O=!0;for(let _=0;_<q.length;_++){let G=q[_],B=G.trim();U+=(G.match(/\{/g)||[]).length,U-=(G.match(/\}/g)||[]).length;let z=IZ(B);if(O&&z&&z.kind!=="import"&&!B.startsWith("//")&&!B.startsWith("/*"))O=!1;if(O){V.push(G);continue}if(z&&U<=1){if(K)Y.push(K);K={lines:[G],kind:z.kind,name:z.name,isExport:z.isExport}}else if(K)K.lines.push(G);else{if(B==="")continue;W.push(G)}}if(K)Y.push(K);Y.sort((_,G)=>{if(Q&&_.isExport!==G.isExport)return _.isExport?-1:1;let B=$.indexOf(_.kind),z=$.indexOf(G.kind),j=B>=0?B:$.length,N=z>=0?z:$.length;if(j!==N)return j-N;if(J)return _.name.localeCompare(G.name);return 0});let H=[...V],A=null;for(let _ of Y){if(A!==null&&_.kind!==A)H.push("");H.push(..._.lines),A=_.kind}if(W.length>0)H.push(""),H.push(...W);return H.join(`
37
- `)}function IZ(X){let Z=X.startsWith("export "),$=Z?X.slice(7):X;if(X.startsWith("import "))return{kind:"import",name:X.match(/from\s+['"]([^'"]+)['"]/)?.[1]||"",isExport:!1};if($.startsWith("type ")||$.startsWith("declare type "))return{kind:"type",name:$.match(/type\s+(\w+)/)?.[1]||"",isExport:Z};if($.startsWith("interface ")||$.startsWith("declare interface "))return{kind:"interface",name:$.match(/interface\s+(\w+)/)?.[1]||"",isExport:Z};if($.startsWith("class ")||$.startsWith("abstract class ")||$.startsWith("declare class ")||$.startsWith("declare abstract class "))return{kind:"class",name:$.match(/class\s+(\w+)/)?.[1]||"",isExport:Z};if($.startsWith("enum ")||$.startsWith("const enum ")||$.startsWith("declare enum ")||$.startsWith("declare const enum "))return{kind:"enum",name:$.match(/enum\s+(\w+)/)?.[1]||"",isExport:Z};if($.startsWith("function ")||$.startsWith("async function ")||$.startsWith("declare function ")||$.startsWith("declare async function "))return{kind:"function",name:$.match(/function\s+(\w+)/)?.[1]||"",isExport:Z};if($.startsWith("const ")||$.startsWith("let ")||$.startsWith("var ")||$.startsWith("declare const ")||$.startsWith("declare let ")||$.startsWith("declare var "))return{kind:"variable",name:$.match(/(?:const|let|var)\s+(\w+)/)?.[1]||"",isExport:Z};if($.startsWith("namespace ")||$.startsWith("declare namespace "))return{kind:"namespace",name:$.match(/namespace\s+(\w+)/)?.[1]||"",isExport:Z};if($.startsWith("module ")||$.startsWith("declare module "))return{kind:"module",name:$.match(/module\s+['"]?(\w+)['"]?/)?.[1]||"",isExport:Z};if(X.startsWith("export {")||X.startsWith("export *")||X.startsWith("export type {"))return{kind:"export",name:"",isExport:!0};return null}function R1(X){let Z=X.split(`
38
- `),$=[];for(let J=0;J<Z.length;J++){let Q=Z[J],q=Q.trim();if(q.startsWith("/**")||q.startsWith("*")||q.startsWith("*/")){$.push(Q);continue}if(q.startsWith("//")){$.push(Q);continue}if(q.startsWith("/*")||q.endsWith("*/")){$.push(Q);continue}$.push(Q)}return $.join(`
39
- `)}function F1(X={}){return{normalize:(Z)=>MZ(Z,X),normalizeLineEndings:(Z)=>BX(Z,X.lineEnding||"lf"),removeTrailingWhitespace:zX,normalizeBlankLines:(Z)=>NX(Z,X.maxBlankLines||1),ensureTrailingNewline:jX,processImports:(Z)=>RX(Z,X.importGrouping||{}),orderDeclarations:(Z)=>FX(Z,X.declarationOrder||{})}}var D1={default:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},minimal:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:2,trimTrailingWhitespace:!0,normalizeIndentation:!1,importGrouping:{enabled:!1}},strict:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0},declarationOrder:{kinds:GX,alphabetize:!0,groupExports:!0}},windows:{lineEnding:"crlf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},tabs:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"tabs",size:1},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}}};var T=TZ(SZ(),1);import{readFile as MX}from"fs/promises";import{dirname as kZ,resolve as wX}from"path";async function CZ(X,Z=process.cwd()){let $=new Map;for(let J of X){let Q=wX(Z,J),q=await vZ(Q,Z);$.set(Q,{path:Q,dependencies:q,dependents:new Set,state:"pending"})}for(let[J,Q]of $)for(let q of Q.dependencies){let Y=$.get(q);if(Y)Y.dependents.add(J)}return $}async function vZ(X,Z){let $=new Set;try{let Y=function(V){if(T.default.isImportDeclaration(V)){let W=V.moduleSpecifier;if(T.default.isStringLiteral(W)){let K=W.text;if(K.startsWith(".")||K.startsWith("/")){let U=DX(K,q,Z);if(U)$.add(U)}}}else if(T.default.isExportDeclaration(V)&&V.moduleSpecifier){if(T.default.isStringLiteral(V.moduleSpecifier)){let W=V.moduleSpecifier.text;if(W.startsWith(".")||W.startsWith("/")){let K=DX(W,q,Z);if(K)$.add(K)}}}T.default.forEachChild(V,Y)},J=await MX(X,"utf-8"),Q=T.default.createSourceFile(X,J,T.default.ScriptTarget.Latest,!0,T.default.ScriptKind.TS),q=kZ(X);Y(Q)}catch{}return $}function DX(X,Z,$){let J=[".ts",".tsx",".d.ts","/index.ts","/index.tsx"],Q=wX(Z,X);for(let q of J){let Y=Q+q;if(!Y.includes("node_modules"))return Y}if(X.endsWith(".ts")||X.endsWith(".tsx"))return Q;return null}function bZ(X){let Z=[];for(let[$,J]of X){if(J.state!=="pending")continue;let Q=!0;for(let q of J.dependencies){let Y=X.get(q);if(Y&&Y.state!=="completed"){Q=!1;break}}if(Q)Z.push($)}return Z}async function PZ(X,Z={}){let $=await MX(X,"utf-8"),J=EX($,X,Z.keepComments??!0);return LX(J,{filePath:X,sourceCode:$,declarations:J})}async function T1(X,Z={}){let $=performance.now(),{maxConcurrency:J=4,rootDir:Q=process.cwd(),config:q={},onProgress:Y,onError:V}=Z,W=await CZ(X,Q),K=new Map,U=new Map,O=[],H=0,A=0,_=0,G=W.size;while(_<G){let B=bZ(W);if(B.length===0){let N=[...W.values()].filter((R)=>R.state==="pending");if(N.length>0)for(let R of N)R.state="failed",R.error=Error("Circular dependency detected or dependency failed"),U.set(R.path,R.error),_++;break}let z=B.slice(0,J-A);for(let N of z){let R=W.get(N);R.state="processing",A++}H=Math.max(H,A);let j=z.map(async(N)=>{let R=W.get(N),k=performance.now();try{let F=await PZ(N,q);R.state="completed",R.result=F,R.duration=performance.now()-k,K.set(N,F),O.push(N)}catch(F){if(R.state="failed",R.error=F instanceof Error?F:Error(String(F)),R.duration=performance.now()-k,U.set(N,R.error),V&&!V(N,R.error))throw Error("Processing aborted by error handler")}finally{A--,_++,Y?.(_,G,N)}});await Promise.all(j)}return{success:K,failed:U,totalTimeMs:performance.now()-$,maxConcurrent:H,processingOrder:O}}function S1(X){let Z=[],$=new Set,J=new Set;function Q(q){if($.has(q))return;if(J.has(q))return;J.add(q);let Y=X.get(q);if(Y){for(let V of Y.dependencies)if(X.has(V))Q(V)}J.delete(q),$.add(q),Z.push(q)}for(let q of X.keys())Q(q);return Z}function xZ(X){let Z=[];for(let[$,J]of X){let Q=!1;for(let q of J.dependencies)if(X.has(q)){Q=!0;break}if(!Q)Z.push($)}return Z}function yZ(X){let Z=[],$=new Set;while($.size<X.size){let J=[];for(let[Q,q]of X){if($.has(Q))continue;let Y=!0;for(let V of q.dependencies)if(X.has(V)&&!$.has(V)){Y=!1;break}if(Y)J.push(Q)}if(J.length===0){for(let Q of X.keys())if(!$.has(Q))J.push(Q)}for(let Q of J)$.add(Q);Z.push(J)}return Z}function k1(X){let Z=yZ(X),$=xZ(X),J=Math.max(...Z.map((q)=>q.length)),Q=X.size/Z.length;return{totalFiles:X.size,independentFiles:$.length,maxParallelism:J,levels:Z.length,estimatedSpeedup:Q}}function TX(X){let Z=X,$=!0;while($){$=!1;let J=Z.trimStart();if(J.startsWith("/*")){let Q=J.indexOf("*/",2);if(Q!==-1){Z=J.slice(Q+2),$=!0;continue}}if(J.startsWith("//")){let Q=J.indexOf(`
40
- `);if(Q!==-1)Z=J.slice(Q+1),$=!0;else Z="",$=!0}}return Z.trim()}function v1(X,Z){let J=X.substring(0,Z).split(`
41
- `),Q=[],q=J.length-1,Y=!1,V=[];while(q>=0){let W=J[q].trim();if(W.endsWith("*/")&&!Y)Y=!0,V.unshift(W);else if(W.startsWith("/*")&&Y)V.unshift(W),Q.unshift(...V),V=[],Y=!1;else if(Y)V.unshift(W);else if(W.startsWith("//"))Q.unshift(W);else if(W.startsWith("*")&&(q>0&&J[q-1].trim().startsWith("/*")))Q.unshift(W);else if(W===""&&Q.length>0);else if(W!=="")break;q--}return Q}function b1(X){let Z=!1,$="",J=!1;for(let Q=0;Q<X.length;Q++){let q=X[Q];if(!J&&!Z&&(q==='"'||q==="'"||q==="`"))Z=!0,$=q;else if(!J&&Z&&q===$)Z=!1;else if(q==="\\"&&!J){J=!0;continue}else if(!Z&&q==="/"&&Q<X.length-1){if(X[Q+1]==="/")return X.substring(Q)}J=!1}return null}function IX(X,Z,$){let J=0,Q=!1,q="",Y=!1;if(!X.startsWith(Z))return null;for(let V=0;V<X.length;V++){let W=X[V];if(!Y&&(W==='"'||W==="'"||W==="`")){if(!Q)Q=!0,q=W;else if(W===q)Q=!1}if(W==="\\"&&!Y){Y=!0;continue}if(Y=!1,!Q){if(X.substring(V,V+Z.length)===Z)J++;else if(X.substring(V,V+$.length)===$){if(J--,J===0)return{content:X.substring(0,V+$.length),rest:X.substring(V+$.length)}}}}return null}function P1(X){let Z=TX(X).trim(),$=Z.match(/^(export\s+)?(async\s+)?function\s*(\*?)([a-zA-Z_$][\w$]*)/);if(!$)return null;let J=[];if($[1])J.push("export");if($[2])J.push("async");if($[3])J.push("generator");let Q=$[4],q=Z.substring($[0].length).trim(),Y="";if(q.startsWith("<")){let K=IX(q,"<",">");if(K)Y=K.content,q=K.rest.trim()}let V="";if(q.startsWith("(")){let K=IX(q,"(",")");if(K)V=K.content.slice(1,-1).trim(),q=K.rest.trim()}let W="void";if(q.startsWith(":")){let K=q.match(/^:\s*([^{;]+)/);if(K)W=K[1].trim()}return{name:Q,generics:Y,parameters:V,returnType:W,modifiers:J}}function x1(X){return/^\s*export\s+/.test(X)}function y1(X){return/^\s*export\s+type\s+/.test(X)}function h1(X){let Z=TX(X).trim(),$=Z.match(/^(export\s+)?(const|let|var)\s+([a-zA-Z_$][\w$]*)/);if(!$)return null;let J=$[2],Q=$[3],q=Z.substring($[0].length).trim(),Y;if(q.startsWith(":")){let W=q.indexOf("=");if(W!==-1)Y=q.substring(1,W).trim(),q=q.substring(W).trim();else Y=q.substring(1).replace(/;?\s*$/,"").trim(),q=""}let V;if(q.startsWith("="))V=q.substring(1).replace(/;?\s*$/,"").trim();return{kind:J,name:Q,typeAnnotation:Y,value:V}}class kX{config;memorySamples=[];cpuSamples=[];ioOperations=[];startTime=0;memoryInterval=null;cpuInterval=null;lastCpuUsage=null;isRunning=!1;constructor(X={}){this.config={memory:X.memory??!1,memoryLimit:X.memoryLimit??1024,cpu:X.cpu??!1,samplingInterval:X.samplingInterval??100,io:X.io??!1,trackOperations:X.trackOperations??["read","write"],outputFile:X.outputFile??""}}start(){if(this.isRunning)return;if(this.isRunning=!0,this.startTime=Date.now(),this.memorySamples=[],this.cpuSamples=[],this.ioOperations=[],this.lastCpuUsage=null,this.config.memory)this.sampleMemory(),this.memoryInterval=setInterval(()=>this.sampleMemory(),this.config.samplingInterval);if(this.config.cpu)this.sampleCpu(),this.cpuInterval=setInterval(()=>this.sampleCpu(),this.config.samplingInterval)}stop(){if(!this.isRunning)return;if(this.isRunning=!1,this.memoryInterval)clearInterval(this.memoryInterval),this.memoryInterval=null;if(this.cpuInterval)clearInterval(this.cpuInterval),this.cpuInterval=null}sampleMemory(){let X=SX();this.memorySamples.push(X)}sampleCpu(){let X=mZ();if(this.lastCpuUsage){let Z={timestamp:Date.now(),user:X.user-this.lastCpuUsage.user,system:X.system-this.lastCpuUsage.system,total:X.user-this.lastCpuUsage.user+(X.system-this.lastCpuUsage.system)};this.cpuSamples.push(Z)}this.lastCpuUsage=X}recordIo(X,Z,$,J){if(!this.config.io)return;if(!this.config.trackOperations.includes(X))return;this.ioOperations.push({timestamp:Date.now(),operation:X,path:Z,size:$,durationMs:J})}getResults(){let X=Date.now(),Z=[],$=this.memorySamples[0]||SX(),J=0;for(let A of this.memorySamples){if(J+=A.heapUsed,A.heapUsed>$.heapUsed)$=A;let _=A.heapUsed/1048576;if(_>this.config.memoryLimit)Z.push(`Memory limit exceeded at ${new Date(A.timestamp).toISOString()}: ${_.toFixed(2)}MB > ${this.config.memoryLimit}MB`)}let Q=this.memorySamples.length>0?J/this.memorySamples.length:0,q=0,Y=0;for(let A of this.cpuSamples)q+=A.user,Y+=A.system;let V=0,W=0,K=0,U=0,O=0,H=0;for(let A of this.ioOperations)if(A.operation==="read")V++,K+=A.size,O+=A.durationMs;else W++,U+=A.size,H+=A.durationMs;return{startTime:this.startTime,endTime:X,durationMs:X-this.startTime,memory:{samples:this.memorySamples,peak:$,average:{timestamp:0,heapUsed:Q,heapTotal:0,external:0,arrayBuffers:0,rss:0},warnings:Z},cpu:{samples:this.cpuSamples,totalUser:q,totalSystem:Y},io:{operations:this.ioOperations,totalReads:V,totalWrites:W,totalReadBytes:K,totalWriteBytes:U,totalReadMs:O,totalWriteMs:H}}}formatResults(){let X=this.getResults(),Z=["=== Profiling Results ===",""];if(Z.push(`Duration: ${X.durationMs}ms`),Z.push(""),this.config.memory){if(Z.push("Memory:"),Z.push(` Samples: ${X.memory.samples.length}`),Z.push(` Peak heap: ${f(X.memory.peak.heapUsed)}`),Z.push(` Average heap: ${f(X.memory.average.heapUsed)}`),X.memory.warnings.length>0){Z.push(" Warnings:");for(let $ of X.memory.warnings)Z.push(` - ${$}`)}Z.push("")}if(this.config.cpu)Z.push("CPU:"),Z.push(` Samples: ${X.cpu.samples.length}`),Z.push(` Total user time: ${(X.cpu.totalUser/1000).toFixed(2)}ms`),Z.push(` Total system time: ${(X.cpu.totalSystem/1000).toFixed(2)}ms`),Z.push("");if(this.config.io)Z.push("I/O:"),Z.push(` Total reads: ${X.io.totalReads}`),Z.push(` Total writes: ${X.io.totalWrites}`),Z.push(` Total read: ${f(X.io.totalReadBytes)} in ${X.io.totalReadMs.toFixed(2)}ms`),Z.push(` Total write: ${f(X.io.totalWriteBytes)} in ${X.io.totalWriteMs.toFixed(2)}ms`),Z.push("");return Z.join(`
42
- `)}async writeResults(){if(!this.config.outputFile)return;let X=this.getResults(),Z=JSON.stringify(X,null,2);try{await(await import("fs/promises")).writeFile(this.config.outputFile,Z,"utf-8")}catch{await Bun.write(this.config.outputFile,Z)}}}function SX(){if(typeof process<"u"&&process.memoryUsage){let X=process.memoryUsage();return{timestamp:Date.now(),heapUsed:X.heapUsed,heapTotal:X.heapTotal,external:X.external,arrayBuffers:X.arrayBuffers||0,rss:X.rss}}return{timestamp:Date.now(),heapUsed:0,heapTotal:0,external:0,arrayBuffers:0,rss:0}}function mZ(){if(typeof process<"u"&&process.cpuUsage){let X=process.cpuUsage();return{user:X.user,system:X.system}}return{user:0,system:0}}function f(X){if(X===0)return"0 B";let Z=["B","KB","MB","GB"],$=1024,J=Math.floor(Math.log(X)/Math.log($));return`${Number.parseFloat((X/$**J).toFixed(2))} ${Z[J]}`}function pZ(X){return new kX(X)}async function p1(X,Z){let $=pZ({memory:!0,cpu:!0,...Z});$.start();try{return{result:await X(),profile:$.getResults()}}finally{$.stop()}}function d1(X){return{async read(Z,$){let J=Date.now();try{let Q=await $(),q=typeof Q==="string"?Q.length:0;return X.recordIo("read",Z,q,Date.now()-J),Q}catch(Q){throw X.recordIo("read",Z,0,Date.now()-J),Q}},async write(Z,$,J){let Q=Date.now();try{await $(),X.recordIo("write",Z,J,Date.now()-Q)}catch(q){throw X.recordIo("write",Z,0,Date.now()-Q),q}}}}class CX{marks=new Map;durations=new Map;mark(X){this.marks.set(X,performance.now())}measure(X,Z){let $=this.marks.get(Z);if($===void 0)throw Error(`Mark "${Z}" not found`);let J=performance.now()-$,Q=this.durations.get(X)||[];return Q.push(J),this.durations.set(X,Q),J}getDurations(X){return this.durations.get(X)||[]}getAverage(X){let Z=this.getDurations(X);if(Z.length===0)return 0;return Z.reduce(($,J)=>$+J,0)/Z.length}getSummary(){let X=new Map;for(let[Z,$]of this.durations)X.set(Z,{count:$.length,total:$.reduce((J,Q)=>J+Q,0),average:$.reduce((J,Q)=>J+Q,0)/$.length,min:Math.min(...$),max:Math.max(...$)});return X}clear(){this.marks.clear(),this.durations.clear()}}function c1(){return new CX}import{lstat as dZ,realpath as cZ,stat as lZ}from"fs/promises";import{isAbsolute as o,normalize as bX,relative as oZ,resolve as vX}from"path";var S={rootDir:process.cwd(),maxFileSize:10485760,maxTotalSize:104857600,timeout:30000,followSymlinks:!1,maxFiles:1e4,blockedPatterns:["**/.git/**","**/node_modules/**","**/.env*","**/secrets/**","**/*.key","**/*.pem"]};class I extends Error{code;path;constructor(X,Z,$){super(X);this.code=Z;this.path=$;this.name="SecurityError"}}function m(X,Z={}){let{rootDir:$=process.cwd()}=Z,J=bX(X),Q=o(J)?J:vX($,J),q=vX(Q),Y=oZ($,q);if(Y.startsWith("..")||o(Y))throw new I(`Path traversal detected: "${X}" resolves outside root directory`,"PATH_TRAVERSAL",X);return q}function sZ(X,Z={}){return X.map(($)=>m($,Z))}function PX(X,Z={}){let $=Z.blockedPatterns||S.blockedPatterns;for(let J of $)if(aZ(X,J))return!0;return!1}function aZ(X,Z){let $=X.replace(/\\/g,"/"),J=Z.replace(/\*\*/g,"<<GLOBSTAR>>").replace(/\*/g,"<<STAR>>").replace(/\?/g,"<<QUESTION>>");return J=J.replace(/[.+^${}()|[\]\\]/g,"\\$&"),J=J.replace(/^<<GLOBSTAR>>\//,"(.*\\/)?"),J=J.replace(/\/<<GLOBSTAR>>$/,"(\\/.*)?"),J=J.replace(/\/<<GLOBSTAR>>\//g,"(\\/.*)?\\/"),J=J.replace(/<<GLOBSTAR>>/g,".*"),J=J.replace(/<<STAR>>/g,"[^/]*"),J=J.replace(/<<QUESTION>>/g,"[^/]"),new RegExp(`^${J}$`).test($)}async function iZ(X,Z={}){let $=Z.maxFileSize??S.maxFileSize;try{let J=await lZ(X);if(J.size>$)throw new I(`File too large: "${X}" is ${u(J.size)}, max is ${u($)}`,"FILE_TOO_LARGE",X);return J.size}catch(J){if(J instanceof I)throw J;throw new I(`Failed to check file size: ${X}`,"INVALID_PATH",X)}}async function nZ(X){try{return(await dZ(X)).isSymbolicLink()}catch{return!1}}async function rZ(X,Z={}){let $=Z.followSymlinks??S.followSymlinks;if(await nZ(X)){if(!$)throw new I(`Symbolic links not allowed: "${X}"`,"SYMLINK_NOT_ALLOWED",X);let J=await cZ(X);return m(J,Z)}return X}async function s(X,Z={}){let $=m(X,Z);if(PX($,Z))throw new I(`Path matches blocked pattern: "${X}"`,"BLOCKED_PATTERN",X);let J=await rZ($,Z),Q=await iZ(J,Z);return{path:J,size:Q}}async function xX(X,Z={}){let $=Z.maxFiles??S.maxFiles,J=Z.maxTotalSize??S.maxTotalSize;if(X.length>$)throw new I(`Too many files: ${X.length} exceeds maximum of ${$}`,"MAX_FILES_EXCEEDED");let Q=[],q=0;for(let Y of X){let V=await s(Y,Z);if(Q.push(V.path),q+=V.size,q>J)throw new I(`Total size exceeded: ${u(q)} exceeds maximum of ${u(J)}`,"TOTAL_SIZE_EXCEEDED")}return{paths:Q,totalSize:q}}function a(X,Z,$="Operation"){return new Promise((J,Q)=>{let q=setTimeout(()=>{Q(new I(`${$} timed out after ${Z}ms`,"TIMEOUT"))},Z);X.then((Y)=>{clearTimeout(q),J(Y)}).catch((Y)=>{clearTimeout(q),Q(Y)})})}function tZ(X,Z={}){let $=Z.timeout??S.timeout;return async(J)=>{let{path:Q}=await s(J,Z);return a(X(Q),$,`Processing ${J}`)}}function a1(X,Z={}){let $=Z.timeout??S.timeout;return async(J)=>{let{paths:Q}=await xX(J,Z);return a(X(Q),$,`Processing ${J.length} files`)}}function i1(X){let Z=X.replace(/\\/g,"/").replace(/\0/g,"").replace(/^\/+/,"").replace(/^[A-Z]:/i,""),$="";while($!==Z)$=Z,Z=Z.replace(/\.\.\/|\.\.$/g,"").replace(/\/+/g,"/");return Z.replace(/^\/+|\/+$/g,"")}function n1(X){if(X.includes("\x00"))return!1;if(bX(X).includes(".."))return!1;if(o(X)&&!X.startsWith(process.cwd()))return!1;return!0}function u(X){if(X===0)return"0 B";let Z=["B","KB","MB","GB"],$=1024,J=Math.floor(Math.log(X)/Math.log($));return`${Number.parseFloat((X/$**J).toFixed(2))} ${Z[J]}`}function r1(X={}){let Z={...S,...X};return{validatePath:($)=>m($,Z),validatePaths:($)=>sZ($,Z),validateFile:($)=>s($,Z),validateBatch:($)=>xX($,Z),withTimeout:($,J)=>a($,Z.timeout,J),secureProcessor:($)=>tZ($,Z),isBlocked:($)=>PX($,Z),getConfig:()=>Z}}import{readFile as eZ,writeFile as X0}from"fs/promises";import{basename as Z0,dirname as yX,relative as $0,resolve as J0}from"path";class hX{file;sourceRoot;sources=[];sourcesContent=[];names=[];mappings=[];sourceIndexMap=new Map;nameIndexMap=new Map;constructor(X){this.file=X.file,this.sourceRoot=X.sourceRoot}addSource(X,Z){let $=this.sourceIndexMap.get(X);if($===void 0)$=this.sources.length,this.sources.push(X),this.sourcesContent.push(Z??null),this.sourceIndexMap.set(X,$);else if(Z&&!this.sourcesContent[$])this.sourcesContent[$]=Z;return $}addName(X){let Z=this.nameIndexMap.get(X);if(Z===void 0)Z=this.names.length,this.names.push(X),this.nameIndexMap.set(X,Z);return Z}addMapping(X){let Z=this.addSource(X.source),$;if(X.name)$=this.addName(X.name);this.mappings.push({generated:X.generated,original:X.original,sourceIndex:Z,nameIndex:$})}generate(X=!1){this.mappings.sort(($,J)=>{if($.generated.line!==J.generated.line)return $.generated.line-J.generated.line;return $.generated.column-J.generated.column});let Z={version:3,file:this.file,sources:this.sources,names:this.names,mappings:this.encodeMappings()};if(this.sourceRoot)Z.sourceRoot=this.sourceRoot;if(X)Z.sourcesContent=this.sourcesContent;return Z}encodeMappings(){let X=[],Z=0,$=0,J=0,Q=0,q=0,Y=0,V=[];for(let W of this.mappings){while(Z<W.generated.line)X.push(V.join(",")),V=[],Z++,$=0;let K=[];if(K.push(W.generated.column-$),$=W.generated.column,K.push(W.sourceIndex-J),J=W.sourceIndex,K.push(W.original.line-Q),Q=W.original.line,K.push(W.original.column-q),q=W.original.column,W.nameIndex!==void 0)K.push(W.nameIndex-Y),Y=W.nameIndex;V.push(Q0(K))}return X.push(V.join(",")),X.join(";")}toString(X=!1){return JSON.stringify(this.generate(X))}toDataUrl(X=!1){let Z=this.toString(X);return`data:application/json;charset=utf-8;base64,${Buffer.from(Z).toString("base64")}`}toComment(X=!1){return`//# sourceMappingURL=${this.toDataUrl(X)}`}}class i{map;decodedMappings=null;constructor(X){this.map=typeof X==="string"?JSON.parse(X):X}originalPositionFor(X){let Z=this.getMappings(),$=0,J=Z.length-1,Q=null;while($<=J){let q=Math.floor(($+J)/2),Y=Z[q];if(Y.generated.line===X.line)if(Y.generated.column===X.column){Q=Y;break}else if(Y.generated.column<X.column)Q=Y,$=q+1;else J=q-1;else if(Y.generated.line<X.line)$=q+1;else J=q-1}if(!Q)return{source:null,line:null,column:null,name:null};return{source:this.map.sources[Q.sourceIndex]||null,line:Q.original.line,column:Q.original.column,name:Q.nameIndex!==void 0?this.map.names[Q.nameIndex]:null}}generatedPositionFor(X){let Z=this.map.sources.indexOf(X.source);if(Z===-1)return null;let $=this.getMappings();for(let J of $)if(J.sourceIndex===Z&&J.original.line===X.line&&J.original.column<=X.column)return J.generated;return null}getMappings(){if(!this.decodedMappings)this.decodedMappings=Y0(this.map.mappings);return this.decodedMappings}sourceContentFor(X){let Z=this.map.sources.indexOf(X);if(Z===-1||!this.map.sourcesContent)return null;return this.map.sourcesContent[Z]}}function Q0(X){return X.map(q0).join("")}function q0(X){let q="",Y=X<0?-X<<1|1:X<<1;do{let V=Y&31;if(Y>>>=5,Y>0)V|=32;q+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[V]}while(Y>0);return q}function Y0(X){let Z=[],$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J=0,Q=0,q=0,Y=0,V=0,W=0,K=X.split(";");for(let U of K){if(Q=0,U){let O=U.split(",");for(let H of O){if(!H)continue;let A=V0(H,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");if(A.length>=1)Q+=A[0];if(A.length>=4){q+=A[1],Y+=A[2],V+=A[3];let _={generated:{line:J,column:Q},original:{line:Y,column:V},sourceIndex:q};if(A.length>=5)W+=A[4],_.nameIndex=W;Z.push(_)}}}J++}return Z}function V0(X,Z){let J=[],Q=0,q=0;for(let Y of X){let V=Z.indexOf(Y);if(V===-1)continue;let W=V&32;if(q+=(V&31)<<Q,W)Q+=5;else{let K=q&1;q>>=1,J.push(K?-q:q),q=0,Q=0}}return J}function Z3(X){let Z=new hX({file:Z0(X.generatedFile),sourceRoot:X.sourceRoot}),$=$0(yX(X.generatedFile),X.sourceFile);Z.addSource($,X.sourceContent);for(let J of X.mappings)Z.addMapping({generated:{line:J.generatedLine,column:J.generatedColumn},original:{line:J.originalLine,column:J.originalColumn},source:$,name:J.name});return Z}function $3(X,Z){return`${X}
43
- //# sourceMappingURL=${Z}`}function J3(X,Z,$=!1){return`${X}
44
- ${Z.toComment($)}`}async function Q3(X,Z,$=!1){await X0(X,Z.toString($))}async function W0(X){let Z=await eZ(X,"utf-8");return new i(Z)}async function q3(X,Z){let $=X.match(/\/\/# sourceMappingURL=data:application\/json[^,]+,(\S+)/);if($){let Q=$[1],q=Buffer.from(Q,"base64").toString("utf-8");return new i(q)}let J=X.match(/\/\/# sourceMappingURL=(.+)$/);if(J){let Q=J0(yX(Z),J[1].trim());try{return await W0(Q)}catch{return null}}return null}function Y3(X,Z){let $=X,J=Z,Q=$.split(`
45
- `),q=[],Y=0,V=0;for(let W of J){while(Y+Q[V].length+1<=W.generatedStart&&V<Q.length-1)Y+=Q[V].length+1,V++;let K=W.generatedStart-Y;q.push({generatedLine:V,generatedColumn:Math.max(0,K),originalLine:W.originalLine,originalColumn:W.originalColumn,name:W.name})}return q}class gX{config;types=new Map;imports=new Map;relationships=[];usageMap=new Map;constructor(X={}){this.config={types:!1,relationships:!1,usage:!1,imports:!1,importUsage:!1,importRelationships:!1,...X}}trackType(X,Z){if(!this.config.types)return;if(["interface","type","class","enum"].includes(X.kind)){if(this.types.get(X.name))return;let J={name:X.name,kind:X.kind,file:Z,usedBy:new Set,references:new Set,extendsFrom:X.extends?[X.extends]:void 0,implementsFrom:X.implements};if(this.types.set(X.name,J),this.config.relationships){if(X.extends)this.relationships.push({from:X.name,to:X.extends,kind:"extends",file:Z});if(X.implements)for(let Q of X.implements)this.relationships.push({from:X.name,to:Q,kind:"implements",file:Z})}}}trackTypeUsage(X,Z,$){if(!this.config.usage)return;let J=this.types.get(X);if(J)J.usedBy.add(Z);let Q=this.usageMap.get(X)||new Set;if(Q.add(`${$}:${Z}`),this.usageMap.set(X,Q),this.config.relationships)this.relationships.push({from:Z,to:X,kind:"uses",file:$})}trackImport(X,Z,$,J){if(!this.config.imports)return;let Q={source:X,specifiers:Z,isTypeOnly:$,file:J,usedSpecifiers:new Set,unusedSpecifiers:new Set(Z)},q=this.imports.get(J)||[];q.push(Q),this.imports.set(J,q)}trackImportUsage(X,Z){if(!this.config.importUsage)return;let $=this.imports.get(Z);if(!$)return;for(let J of $)if(J.specifiers.includes(X))J.usedSpecifiers.add(X),J.unusedSpecifiers.delete(X)}trackTypeReference(X,Z){if(!this.config.types)return;let $=this.types.get(X);if($)$.references.add(Z)}getResults(){let X=[],Z=[];for(let[Q,q]of this.types)if(q.usedBy.size===0&&q.references.size===0)X.push(Q);for(let Q of this.imports.values())for(let q of Q)if(q.unusedSpecifiers.size===q.specifiers.length)Z.push(q);let $=this.detectCircularReferences(),J={totalTypes:this.types.size,usedTypes:this.types.size-X.length,unusedTypes:X.length,totalImports:Array.from(this.imports.values()).flat().length,usedImports:Array.from(this.imports.values()).flat().filter((Q)=>Q.usedSpecifiers.size>0).length,unusedImports:Z.length,totalRelationships:this.relationships.length,circularDependencies:$.length};return{types:this.types,imports:this.imports,relationships:this.relationships,unusedTypes:X,unusedImports:Z,circularReferences:$,statistics:J}}detectCircularReferences(){let X=[],Z=new Set,$=[],J=(Q)=>{if($.includes(Q)){let Y=$.indexOf(Q);X.push($.slice(Y));return}if(Z.has(Q))return;Z.add(Q),$.push(Q);let q=this.relationships.filter((Y)=>Y.from===Q&&(Y.kind==="extends"||Y.kind==="implements"||Y.kind==="references")).map((Y)=>Y.to);for(let Y of q)J(Y);$.pop()};for(let Q of this.types.keys())J(Q);return X}clear(){this.types.clear(),this.imports.clear(),this.relationships=[],this.usageMap.clear()}formatResults(){let X=this.getResults(),Z=["=== Tracking Results ===",""];if(Z.push("Statistics:"),Z.push(` Total types: ${X.statistics.totalTypes}`),Z.push(` Used types: ${X.statistics.usedTypes}`),Z.push(` Unused types: ${X.statistics.unusedTypes}`),Z.push(` Total imports: ${X.statistics.totalImports}`),Z.push(` Used imports: ${X.statistics.usedImports}`),Z.push(` Unused imports: ${X.statistics.unusedImports}`),Z.push(` Type relationships: ${X.statistics.totalRelationships}`),Z.push(` Circular dependencies: ${X.statistics.circularDependencies}`),Z.push(""),X.unusedTypes.length>0){Z.push("Unused types:");for(let $ of X.unusedTypes){let J=X.types.get($);Z.push(` - ${$} (${J?.kind}) in ${J?.file}`)}Z.push("")}if(X.unusedImports.length>0){Z.push("Unused imports:");for(let $ of X.unusedImports)Z.push(` - ${$.source} in ${$.file}`),Z.push(` Specifiers: ${Array.from($.unusedSpecifiers).join(", ")}`);Z.push("")}if(X.circularReferences.length>0){Z.push("Circular references:");for(let $ of X.circularReferences)Z.push(` - ${$.join(" -> ")} -> ${$[0]}`);Z.push("")}return Z.join(`
46
- `)}}function fX(X){return new gX(X)}function uX(X,Z,$){for(let J of X){if($.trackType(J,Z),J.typeAnnotation){let Q=K0(J.typeAnnotation);for(let q of Q)$.trackTypeUsage(q,J.name,Z)}if(J.extends)$.trackTypeUsage(J.extends,J.name,Z);if(J.implements)for(let Q of J.implements)$.trackTypeUsage(Q,J.name,Z);if(J.kind==="import"&&J.source&&J.specifiers)$.trackImport(J.source,J.specifiers.map((Q)=>Q.name),J.isTypeOnly||!1,Z)}}function K0(X){let Z=[],$=new Set(["string","number","boolean","any","unknown","void","never","null","undefined","object","symbol","bigint","true","false","readonly","keyof","typeof","infer","extends","in","out"]),J=/\b([A-Z]\w*)\b/g,Q;while((Q=J.exec(X))!==null){let q=Q[1];if(!$.has(q.toLowerCase())&&!Z.includes(q))Z.push(q)}return Z}function W3(X,Z){let $=fX({imports:!0,importUsage:!0,importRelationships:!0,...Z});for(let[J,Q]of X)uX(Q,J,$);return $.getResults()}function K3(X,Z){let $=fX({types:!0,relationships:!0,usage:!0,...Z});for(let[J,Q]of X)uX(Q,J,$);return $.getResults()}function H0(X,Z,$,J={}){return{kind:X,name:Z,text:$,isExported:J.isExported??!1,...J}}function U0(X){return JSON.parse(JSON.stringify(X))}function pX(X,Z,$=null){for(let J of X){Z.enter?.(J,$);let Q=Z[J.kind];if(Q)Q(J,$);if(J.members&&J.members.length>0)pX(J.members,Z,J);Z.leave?.(J,$)}}function _3(X,Z){let $=[];return pX(X,{enter:(J)=>{if(Z(J))$.push(J)}}),$}async function _0(X,Z,$){let J=[],Q=X.length;for(let q=0;q<X.length;q++){let Y=X[q],V={...$,index:q,total:Q,allDeclarations:X},W=await Z(Y,V);if(W===null)continue;else if(W===void 0)J.push(Y);else if(Array.isArray(W))J.push(...W);else J.push(W)}return J}function O3(...X){return async(Z,$)=>{let J=Z;for(let Q of X){if(J===null)return null;if(Array.isArray(J)){let q=[];for(let Y of J){let V=await Q(Y,$);if(V===null)continue;if(V===void 0)q.push(Y);else if(Array.isArray(V))q.push(...V);else q.push(V)}J=q.length>0?q:null}else{let q=await Q(J,$);if(q===null)J=null;else if(q===void 0);else J=q}}return J}}function P(X,Z){let $=new Set(Array.isArray(X)?X:[X]);return async(J,Q)=>{if($.has(J.kind))return Z(J,Q);return}}function A3(X,Z){return async($,J)=>{if(X($))return Z($,J);return}}function p(X){let Z={createDeclaration:H0,cloneDeclaration:U0,modifyText:($,J)=>({...$,text:J}),addModifier:($,J)=>({...$,modifiers:[...$.modifiers||[],J]}),removeModifier:($,J)=>({...$,modifiers:($.modifiers||[]).filter((Q)=>Q!==J)})};return mX({name:X.name,version:X.version,description:X.description,onBeforeFile:X.beforeParse?async($)=>{return X.beforeParse($.content,{filePath:$.filePath,phase:"before"})}:void 0,onDeclarations:X.transform?async($)=>{return _0($.declarations,X.transform,{filePath:$.filePath,sourceCode:$.sourceCode,...Z})}:void 0,onAfterFile:X.afterGenerate?async($)=>{return X.afterGenerate($.content,{filePath:$.filePath,phase:"after"})}:void 0})}function G3(X,Z){let $=typeof X==="string"?new RegExp(X):X;return(J)=>{if($.test(J.name)){let Q=typeof Z==="function"?Z(J.name,J):J.name.replace($,Z),q=J.text.replace(new RegExp(`\\b${x(J.name)}\\b`),Q);return{...J,name:Q,text:q}}return}}function O0(X,Z){return($)=>{if($.kind==="import")return;if(Z&&!Z($))return;let J=`${X}${$.name}`,Q=$.text.replace(new RegExp(`\\b${x($.name)}\\b`),J);return{...$,name:J,text:Q}}}function B3(X,Z){return($)=>{if($.kind==="import")return;if(Z&&!Z($))return;let J=`${$.name}${X}`,Q=$.text.replace(new RegExp(`\\b${x($.name)}\\b`),J);return{...$,name:J,text:Q}}}function A0(X){let Z=typeof X==="function"?X:($)=>{return(typeof X==="string"?new RegExp(X):X).test($.name)};return($)=>{if(Z($))return null;return}}function z3(X){return(Z)=>{let $=X(Z);if(!$)return;let Q=(Array.isArray($)?$:[$]).map((q)=>{if(q.startsWith("/**"))return q;if(q.startsWith("/*"))return q;return`/** ${q} */`});return{...Z,leadingComments:[...Z.leadingComments||[],...Q]}}}function N3(X){return(Z)=>{if(!Z.typeAnnotation)return;let $=X(Z.typeAnnotation,Z);if($===null)return null;if($===void 0)return;let J=Z.text.replace(new RegExp(`:[ ]*${x(Z.typeAnnotation)}`),`: ${$}`);return{...Z,typeAnnotation:$,text:J}}}function j3(X){return P("function",(Z)=>{if(!Z.returnType)return;let $=X(Z.returnType,Z);if($===null)return null;if($===void 0)return;let J=Z.text.replace(new RegExp(`\\):[ ]*${x(Z.returnType)}`),`): ${$}`);return{...Z,returnType:$,text:J}})}function R3(X){return P(["function","class"],(Z)=>{if(!Z.parameters)return;let $=X(Z.parameters,Z);if($===null)return null;if($===void 0)return;let J=$.map((q)=>{let Y="";if(q.rest)Y+="...";if(Y+=q.name,q.optional)Y+="?";if(q.type)Y+=`: ${q.type}`;if(q.defaultValue)Y+=` = ${q.defaultValue}`;return Y}).join(", "),Q=Z.text.replace(/\([^)]*\)/,`(${J})`);return{...Z,parameters:$,text:Q}})}function G0(X,Z){return($)=>{if(Z&&!Z($))return;if($.modifiers?.includes(X))return;let J=[...$.modifiers||[],X],Q=$.text;if(!Q.includes(X)){let q=["function","class","interface","type","enum","const","let","var"];for(let Y of q){let V=Q.indexOf(Y);if(V>=0){Q=`${Q.slice(0,V)}${X} ${Q.slice(V)}`;break}}}return{...$,modifiers:J,text:Q}}}var B0=P(["interface","type"],(X)=>{let Z=X.text.replace(/(\n\s*)(\w+)(\??:\s)/g,"$1readonly $2$3");if(Z===X.text)return;return{...X,text:Z}}),F3=P(["interface","type"],(X)=>{let Z=X.text.replace(/(\w+)\?:/g,"$1:");if(Z===X.text)return;return{...X,text:Z}}),D3=P(["interface","type"],(X)=>{let Z=X.text.replace(/(\w+)(?<!\?):/g,"$1?:");if(Z===X.text)return;return{...X,text:Z}});function E3(X){let Z=new RegExp(`@(${X.join("|")})\\b[^@]*`,"g");return($)=>{if(!$.leadingComments?.length)return;let J=$.leadingComments.map((q)=>{return q.replace(Z,"").replace(/\n\s*\*\s*\n/g,`
47
- `)});if(!J.some((q,Y)=>q!==$.leadingComments[Y]))return;return{...$,leadingComments:J}}}function L3(X,Z){return($)=>{if(Z&&!Z($))return;if(!$.typeAnnotation)return;let J=`${X}<${$.typeAnnotation}>`,Q=$.text.replace($.typeAnnotation,J);return{...$,typeAnnotation:J,text:Q}}}var M3=p({name:"readonly",version:"1.0.0",description:"Makes all interface properties readonly",transform:B0}),w3=p({name:"strip-private",version:"1.0.0",description:"Strips @internal, @private, and @hidden declarations",transform:A0((X)=>{if(!X.leadingComments)return!1;return X.leadingComments.some((Z)=>/@(internal|private|hidden)\b/.test(Z))})}),I3=p({name:"declare",version:"1.0.0",description:"Adds declare keyword to all declarations",transform:G0("declare",(X)=>X.kind!=="import")});function T3(X){return p({name:`namespace-prefix-${X}`,version:"1.0.0",description:`Prefixes exported declarations with ${X}`,transform:O0(`${X}_`,(Z)=>Z.isExported&&Z.kind!=="import")})}function x(X){return X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r(X,Z={}){let{entryPoints:$,keepExported:J=!0,keep:Q=[],remove:q=[],shakableKinds:Y=["type","interface"],debug:V=!1}=Z,W=V?console.log.bind(console,"[tree-shake]"):()=>{},K=new Map;for(let z of X)K.set(z.name,z);let U=t(X);W("Dependency graph:",Object.fromEntries(Array.from(U.entries()).map(([z,j])=>[z,Array.from(j)])));let O=new Set;if($&&$.length>0){for(let z of $)if(K.has(z))O.add(z)}else for(let z of X){if(J&&z.isExported){O.add(z.name);continue}if(n(z.name,Q)){O.add(z.name);continue}if(!Y.includes(z.kind))O.add(z.name)}for(let z of X)if(n(z.name,Q))O.add(z.name);W("Entry points:",Array.from(O));let H=dX(O,U);W("Reachable:",Array.from(H));let A=new Set,_=[];for(let z of X){let j=z.name;if(H.has(j)){A.add(j);continue}if(n(j,q)){_.push(j);continue}if(!Y.includes(z.kind)){A.add(j);continue}_.push(j)}W("Keeping:",Array.from(A)),W("Removing:",_);let G=X.filter((z)=>A.has(z.name)),B={totalBefore:X.length,totalAfter:G.length,removedCount:_.length,reductionPercent:X.length>0?Math.round(_.length/X.length*100):0};return{declarations:G,removed:_,dependencyGraph:U,stats:B}}function t(X){let Z=new Map,$=new Set(X.map((J)=>J.name));for(let J of X){let Q=new Set,q=e(J);for(let Y of q)if($.has(Y)&&Y!==J.name)Q.add(Y);Z.set(J.name,Q)}return Z}function e(X){let Z=new Set;if(X.typeAnnotation)y(X.typeAnnotation,Z);if(X.extends)y(X.extends,Z);if(X.text)z0(X.text,Z);if(X.members)for(let $ of X.members){let J=e($);for(let Q of J)Z.add(Q)}if(X.parameters){for(let $ of X.parameters)if($.type)y($.type,Z)}if(X.returnType)y(X.returnType,Z);return Z}function y(X,Z){let $=new Set(["string","number","boolean","object","any","unknown","never","void","null","undefined","symbol","bigint","true","false","Array","Object","String","Number","Boolean","Function","Symbol","Promise","Map","Set","WeakMap","WeakSet","Record","Partial","Required","Readonly","Pick","Omit","Exclude","Extract","NonNullable","Parameters","ReturnType","InstanceType","ConstructorParameters","ThisParameterType","OmitThisParameter","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","keyof","typeof","infer","extends","readonly","const","new"]),J=/\b([A-Z]\w*)\b/g,Q;while((Q=J.exec(X))!==null){let q=Q[1];if(!$.has(q))Z.add(q)}}function z0(X,Z){y(X,Z)}function dX(X,Z){let $=new Set,J=Array.from(X);while(J.length>0){let Q=J.shift();if($.has(Q))continue;$.add(Q);let q=Z.get(Q);if(q){for(let Y of q)if(!$.has(Y))J.push(Y)}}return $}function n(X,Z){for(let $ of Z)if(typeof $==="string"){if($.includes("*")){if(new RegExp(`^${$.replace(/\*/g,".*").replace(/\?/g,".")}$`).test(X))return!0}else if(X===$)return!0}else if($.test(X))return!0;return!1}function N0(X,Z={}){let $=X.split(`
48
- `),J=[],Q=null;for(let U=0;U<$.length;U++){let O=$[U],H=O.trim();if(!Q&&(H===""||H.startsWith("//")))continue;if(!Q){let A=H.match(/^(export\s+)?(declare\s+)?(interface|type|enum|class|function|const|let|var)\s+(\w+)/);if(A){let[,_,,G,B]=A;if(Q={name:B,kind:G,isExported:!!_,start:U,lines:[O],braceCount:0},Q.braceCount+=(O.match(/\{/g)||[]).length,Q.braceCount-=(O.match(/\}/g)||[]).length,Q.braceCount===0&&(H.endsWith(";")||!H.includes("{")))J.push({name:Q.name,kind:Q.kind,isExported:Q.isExported,start:Q.start,end:U,text:Q.lines.join(`
49
- `)}),Q=null;continue}}if(Q){if(Q.lines.push(O),Q.braceCount+=(O.match(/\{/g)||[]).length,Q.braceCount-=(O.match(/\}/g)||[]).length,Q.braceCount<=0&&(H.endsWith("}")||H.endsWith(";")))J.push({name:Q.name,kind:Q.kind,isExported:Q.isExported,start:Q.start,end:U,text:Q.lines.join(`
50
- `)}),Q=null}}if(J.length===0)return{content:X,removed:[]};let q=J.map((U)=>({name:U.name,kind:U.kind,isExported:U.isExported,text:U.text})),Y=r(q,Z),V=new Set(Y.declarations.map((U)=>U.name)),W=new Set;for(let U of J)if(!V.has(U.name))for(let O=U.start;O<=U.end;O++)W.add(O);return{content:$.filter((U,O)=>!W.has(O)).join(`
24
+ `)}var GZ=["import","type","interface","enum","class","function","variable","export","module","namespace","unknown"],b0=["builtin","external","scoped","internal","parent","sibling","index","type"];function P0(Z,$={}){let{lineEnding:J="lf",trailingNewline:Q=!0,maxBlankLines:X=1,trimTrailingWhitespace:q=!0,normalizeIndentation:V=!0,indent:Y={style:"spaces",size:2},declarationOrder:W,importGrouping:K,preserveComments:H=!0,insertFinalNewline:A=!0}=$,_=Z;if(_=_Z(_,J),K?.enabled!==!1)_=jZ(_,K||{});if(W)_=NZ(_,W);if(q)_=zZ(_);if(_=AZ(_,X),V)_=x0(_,Y);if(Q||A)_=BZ(_);return _}function _Z(Z,$){let J=Z;if(Z.indexOf("\r")!==-1){if(Z.indexOf(`\r
25
+ `)!==-1)J=J.replace(/\r\n/g,`
26
+ `);if(J.indexOf("\r")!==-1)J=J.replace(/\r/g,`
27
+ `)}if($==="crlf")J=J.replace(/\n/g,`\r
28
+ `);return J}function P3(Z){let $=(Z.match(/\r\n/g)||[]).length,J=(Z.match(/(?<!\r)\n/g)||[]).length;if($>J)return"crlf";return"lf"}function zZ(Z){return Z.split(`
29
+ `).map(($)=>$.replace(/[\t ]+$/,"")).join(`
30
+ `)}function AZ(Z,$){let J=new RegExp(`\\n{${$+2},}`,"g");return Z.replace(J,`
31
+ `.repeat($+1))}function BZ(Z){return`${Z.replace(/\s+$/,"")}
32
+ `}function x0(Z,$){let{style:J="spaces",size:Q=2}=$,X=J==="tabs"?"\t":" ".repeat(Q),q=Z.split(`
33
+ `),V=[];for(let Y of q){let W=Y.match(/^([\t ]*)(.*)$/);if(!W){V.push(Y);continue}let[,K,H]=W;if(!H){V.push("");continue}let A=K.replace(/\t/g," "),_=Math.floor(A.length/2);V.push(X.repeat(_)+H)}return V.join(`
34
+ `)}function jZ(Z,$){let{groups:J=b0,separateGroups:Q=!0,alphabetize:X=!0}=$,q=Z.split(`
35
+ `),V=[],Y=[],W=-1;for(let G=0;G<q.length;G++){let U=q[G],z=UZ(U);if(z)V.push({line:U,source:z.source,group:z.group,isType:z.isType}),W=G;else if(V.length>0&&U.trim()==="")continue;else if(V.length>0||U.trim()!==""){if(V.length===0||G>W+1)Y.push(U)}}if(V.length===0)return Z;let K=new Map;for(let G of J)K.set(G,[]);for(let G of V)(K.get(G.group)||K.get("external")||[]).push(G);if(X)for(let[,G]of K)G.sort((U,z)=>{if(U.isType!==z.isType)return U.isType?1:-1;return U.source.localeCompare(z.source)});let H=[],A=null;for(let G of J){let U=K.get(G)||[];if(U.length===0)continue;if(Q&&A!==null)H.push("");for(let z of U)H.push(z.line);A=G}let _=q.slice(0,q.findIndex((G)=>UZ(G)!==null)),O=Y;while(O.length>0&&O[0].trim()==="")O.shift();return[..._,...H,"",...O].join(`
36
+ `)}function UZ(Z){let $=Z.trim(),J=$.match(/^import\s+(type\s+)?.*from\s+['"]([^'"]+)['"]/);if(!J){let q=$.match(/^import\s+['"]([^'"]+)['"]/);if(q)return{source:q[1],group:OZ(q[1]),isType:!1};return null}let Q=!!J[1],X=J[2];return{source:X,group:Q?"type":OZ(X),isType:Q}}function OZ(Z){if(Z.startsWith("node:"))return"builtin";let $=["assert","buffer","child_process","cluster","crypto","dgram","dns","events","fs","http","https","net","os","path","querystring","readline","stream","url","util","zlib"];if($.includes(Z)||$.includes(Z.split("/")[0]))return"builtin";if(Z==="."||Z==="./index"||Z==="./index.js"||Z==="./index.ts")return"index";if(Z.startsWith("./"))return"sibling";if(Z.startsWith("../"))return"parent";if(Z.startsWith("@/")||Z.startsWith("~/")||Z.startsWith("#"))return"internal";if(Z.startsWith("@"))return"scoped";return"external"}function NZ(Z,$){let{kinds:J=GZ,alphabetize:Q=!1,groupExports:X=!0}=$,q=Z.split(`
37
+ `),V=[],Y=[],W=[],K=null,H=0,A=!0;for(let G=0;G<q.length;G++){let U=q[G],z=U.trim();H+=(U.match(/\{/g)||[]).length,H-=(U.match(/\}/g)||[]).length;let B=y0(z);if(A&&B&&B.kind!=="import"&&!z.startsWith("//")&&!z.startsWith("/*"))A=!1;if(A){Y.push(U);continue}if(B&&H<=1){if(K)V.push(K);K={lines:[U],kind:B.kind,name:B.name,isExport:B.isExport}}else if(K)K.lines.push(U);else{if(z==="")continue;W.push(U)}}if(K)V.push(K);V.sort((G,U)=>{if(X&&G.isExport!==U.isExport)return G.isExport?-1:1;let z=J.indexOf(G.kind),B=J.indexOf(U.kind),j=z>=0?z:J.length,N=B>=0?B:J.length;if(j!==N)return j-N;if(Q)return G.name.localeCompare(U.name);return 0});let _=[...Y],O=null;for(let G of V){if(O!==null&&G.kind!==O)_.push("");_.push(...G.lines),O=G.kind}if(W.length>0)_.push(""),_.push(...W);return _.join(`
38
+ `)}function y0(Z){let $=Z.startsWith("export "),J=$?Z.slice(7):Z;if(Z.startsWith("import "))return{kind:"import",name:Z.match(/from\s+['"]([^'"]+)['"]/)?.[1]||"",isExport:!1};if(J.startsWith("type ")||J.startsWith("declare type "))return{kind:"type",name:J.match(/type\s+(\w+)/)?.[1]||"",isExport:$};if(J.startsWith("interface ")||J.startsWith("declare interface "))return{kind:"interface",name:J.match(/interface\s+(\w+)/)?.[1]||"",isExport:$};if(J.startsWith("class ")||J.startsWith("abstract class ")||J.startsWith("declare class ")||J.startsWith("declare abstract class "))return{kind:"class",name:J.match(/class\s+(\w+)/)?.[1]||"",isExport:$};if(J.startsWith("enum ")||J.startsWith("const enum ")||J.startsWith("declare enum ")||J.startsWith("declare const enum "))return{kind:"enum",name:J.match(/enum\s+(\w+)/)?.[1]||"",isExport:$};if(J.startsWith("function ")||J.startsWith("async function ")||J.startsWith("declare function ")||J.startsWith("declare async function "))return{kind:"function",name:J.match(/function\s+(\w+)/)?.[1]||"",isExport:$};if(J.startsWith("const ")||J.startsWith("let ")||J.startsWith("var ")||J.startsWith("declare const ")||J.startsWith("declare let ")||J.startsWith("declare var "))return{kind:"variable",name:J.match(/(?:const|let|var)\s+(\w+)/)?.[1]||"",isExport:$};if(J.startsWith("namespace ")||J.startsWith("declare namespace "))return{kind:"namespace",name:J.match(/namespace\s+(\w+)/)?.[1]||"",isExport:$};if(J.startsWith("module ")||J.startsWith("declare module "))return{kind:"module",name:J.match(/module\s+['"]?(\w+)['"]?/)?.[1]||"",isExport:$};if(Z.startsWith("export {")||Z.startsWith("export *")||Z.startsWith("export type {"))return{kind:"export",name:"",isExport:!0};return null}function x3(Z){let $=Z.split(`
39
+ `),J=[];for(let Q=0;Q<$.length;Q++){let X=$[Q],q=X.trim();if(q.startsWith("/**")||q.startsWith("*")||q.startsWith("*/")){J.push(X);continue}if(q.startsWith("//")){J.push(X);continue}if(q.startsWith("/*")||q.endsWith("*/")){J.push(X);continue}J.push(X)}return J.join(`
40
+ `)}function y3(Z={}){return{normalize:($)=>P0($,Z),normalizeLineEndings:($)=>_Z($,Z.lineEnding||"lf"),removeTrailingWhitespace:zZ,normalizeBlankLines:($)=>AZ($,Z.maxBlankLines||1),ensureTrailingNewline:BZ,processImports:($)=>jZ($,Z.importGrouping||{}),orderDeclarations:($)=>NZ($,Z.declarationOrder||{})}}var h3={default:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},minimal:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:2,trimTrailingWhitespace:!0,normalizeIndentation:!1,importGrouping:{enabled:!1}},strict:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0},declarationOrder:{kinds:GZ,alphabetize:!0,groupExports:!0}},windows:{lineEnding:"crlf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"spaces",size:2},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}},tabs:{lineEnding:"lf",trailingNewline:!0,maxBlankLines:1,trimTrailingWhitespace:!0,normalizeIndentation:!0,indent:{style:"tabs",size:1},importGrouping:{enabled:!0,separateGroups:!0,alphabetize:!0}}};var S=h0(g0(),1);import{readFile as EZ}from"fs/promises";import{dirname as f0,resolve as LZ}from"path";async function u0(Z,$=process.cwd()){let J=new Map;for(let Q of Z){let X=LZ($,Q),q=await m0(X,$);J.set(X,{path:X,dependencies:q,dependents:new Set,state:"pending"})}for(let[Q,X]of J)for(let q of X.dependencies){let V=J.get(q);if(V)V.dependents.add(Q)}return J}async function m0(Z,$){let J=new Set;try{let V=function(Y){if(S.default.isImportDeclaration(Y)){let W=Y.moduleSpecifier;if(S.default.isStringLiteral(W)){let K=W.text;if(K.startsWith(".")||K.startsWith("/")){let H=RZ(K,q,$);if(H)J.add(H)}}}else if(S.default.isExportDeclaration(Y)&&Y.moduleSpecifier){if(S.default.isStringLiteral(Y.moduleSpecifier)){let W=Y.moduleSpecifier.text;if(W.startsWith(".")||W.startsWith("/")){let K=RZ(W,q,$);if(K)J.add(K)}}}S.default.forEachChild(Y,V)},Q=await EZ(Z,"utf-8"),X=S.default.createSourceFile(Z,Q,S.default.ScriptTarget.Latest,!0,S.default.ScriptKind.TS),q=f0(Z);V(X)}catch{}return J}function RZ(Z,$,J){let Q=LZ($,Z);if(Z.endsWith(".ts")||Z.endsWith(".tsx")||Z.endsWith(".d.ts"))return Q.includes("node_modules")?null:Q;let X=`${Q}.ts`;return X.includes("node_modules")?null:X}function p0(Z){let $=[];for(let[J,Q]of Z){if(Q.state!=="pending")continue;let X=!0;for(let q of Q.dependencies){let V=Z.get(q);if(V&&V.state!=="completed"){X=!1;break}}if(X)$.push(J)}return $}async function d0(Z,$={}){let J=await EZ(Z,"utf-8"),Q=FZ(J,Z,$.keepComments??!0);return DZ(Q,{filePath:Z,sourceCode:J,declarations:Q})}async function d3(Z,$={}){let J=performance.now(),{maxConcurrency:Q=4,rootDir:X=process.cwd(),config:q={},onProgress:V,onError:Y}=$,W=await u0(Z,X),K=new Map,H=new Map,A=[],_=0,O=0,G=0,U=W.size;while(G<U){let z=p0(W);if(z.length===0){let N=[...W.values()].filter((R)=>R.state==="pending");if(N.length>0)for(let R of N)R.state="failed",R.error=Error("Circular dependency detected or dependency failed"),H.set(R.path,R.error),G++;break}let B=z.slice(0,Q-O);for(let N of B){let R=W.get(N);R.state="processing",O++}_=Math.max(_,O);let j=B.map(async(N)=>{let R=W.get(N),k=performance.now();try{let F=await d0(N,q);R.state="completed",R.result=F,R.duration=performance.now()-k,K.set(N,F),A.push(N)}catch(F){if(R.state="failed",R.error=F instanceof Error?F:Error(String(F)),R.duration=performance.now()-k,H.set(N,R.error),Y&&!Y(N,R.error))throw Error("Processing aborted by error handler")}finally{O--,G++,V?.(G,U,N)}});await Promise.all(j)}return{success:K,failed:H,totalTimeMs:performance.now()-J,maxConcurrent:_,processingOrder:A}}function c3(Z){let $=[],J=new Set,Q=new Set;function X(q){if(J.has(q))return;if(Q.has(q))return;Q.add(q);let V=Z.get(q);if(V){for(let Y of V.dependencies)if(Z.has(Y))X(Y)}Q.delete(q),J.add(q),$.push(q)}for(let q of Z.keys())X(q);return $}function c0(Z){let $=[];for(let[J,Q]of Z){let X=!1;for(let q of Q.dependencies)if(Z.has(q)){X=!0;break}if(!X)$.push(J)}return $}function l0(Z){let $=[],J=new Set;while(J.size<Z.size){let Q=[];for(let[X,q]of Z){if(J.has(X))continue;let V=!0;for(let Y of q.dependencies)if(Z.has(Y)&&!J.has(Y)){V=!1;break}if(V)Q.push(X)}if(Q.length===0){for(let X of Z.keys())if(!J.has(X))Q.push(X)}for(let X of Q)J.add(X);$.push(Q)}return $}function l3(Z){let $=l0(Z),J=c0(Z),Q=Math.max(...$.map((q)=>q.length)),X=Z.size/$.length;return{totalFiles:Z.size,independentFiles:J.length,maxParallelism:Q,levels:$.length,estimatedSpeedup:X}}function MZ(Z){let $=Z,J=!0;while(J){J=!1;let Q=$.trimStart();if(Q.startsWith("/*")){let X=Q.indexOf("*/",2);if(X!==-1){$=Q.slice(X+2),J=!0;continue}}if(Q.startsWith("//")){let X=Q.indexOf(`
41
+ `);if(X!==-1)$=Q.slice(X+1),J=!0;else $="",J=!0}}return $.trim()}function s3(Z,$){let Q=Z.substring(0,$).split(`
42
+ `),X=[],q=Q.length-1,V=!1,Y=[];while(q>=0){let W=Q[q].trim();if(W.endsWith("*/")&&!V)V=!0,Y.unshift(W);else if(W.startsWith("/*")&&V)Y.unshift(W),X.unshift(...Y),Y=[],V=!1;else if(V)Y.unshift(W);else if(W.startsWith("//"))X.unshift(W);else if(W.startsWith("*")&&(q>0&&Q[q-1].trim().startsWith("/*")))X.unshift(W);else if(W===""&&X.length>0);else if(W!=="")break;q--}return X}function a3(Z){let $=!1,J="",Q=!1;for(let X=0;X<Z.length;X++){let q=Z[X];if(!Q&&!$&&(q==='"'||q==="'"||q==="`"))$=!0,J=q;else if(!Q&&$&&q===J)$=!1;else if(q==="\\"&&!Q){Q=!0;continue}else if(!$&&q==="/"&&X<Z.length-1){if(Z[X+1]==="/")return Z.substring(X)}Q=!1}return null}function wZ(Z,$,J){let Q=0,X=!1,q="",V=!1;if(!Z.startsWith($))return null;for(let Y=0;Y<Z.length;Y++){let W=Z[Y];if(!V&&(W==='"'||W==="'"||W==="`")){if(!X)X=!0,q=W;else if(W===q)X=!1}if(W==="\\"&&!V){V=!0;continue}if(V=!1,!X){if(Z.substring(Y,Y+$.length)===$)Q++;else if(Z.substring(Y,Y+J.length)===J){if(Q--,Q===0)return{content:Z.substring(0,Y+J.length),rest:Z.substring(Y+J.length)}}}}return null}function i3(Z){let $=MZ(Z).trim(),J=$.match(/^(export\s+)?(async\s+)?function\s*(\*?)([a-zA-Z_$][\w$]*)/);if(!J)return null;let Q=[];if(J[1])Q.push("export");if(J[2])Q.push("async");if(J[3])Q.push("generator");let X=J[4],q=$.substring(J[0].length).trim(),V="";if(q.startsWith("<")){let K=wZ(q,"<",">");if(K)V=K.content,q=K.rest.trim()}let Y="";if(q.startsWith("(")){let K=wZ(q,"(",")");if(K)Y=K.content.slice(1,-1).trim(),q=K.rest.trim()}let W="void";if(q.startsWith(":")){let K=q.match(/^:\s*([^{;]+)/);if(K)W=K[1].trim()}return{name:X,generics:V,parameters:Y,returnType:W,modifiers:Q}}function n3(Z){return/^\s*export\s+/.test(Z)}function r3(Z){return/^\s*export\s+type\s+/.test(Z)}function t3(Z){let $=MZ(Z).trim(),J=$.match(/^(export\s+)?(const|let|var)\s+([a-zA-Z_$][\w$]*)/);if(!J)return null;let Q=J[2],X=J[3],q=$.substring(J[0].length).trim(),V;if(q.startsWith(":")){let W=q.indexOf("=");if(W!==-1)V=q.substring(1,W).trim(),q=q.substring(W).trim();else V=q.substring(1).replace(/;?\s*$/,"").trim(),q=""}let Y;if(q.startsWith("="))Y=q.substring(1).replace(/;?\s*$/,"").trim();return{kind:Q,name:X,typeAnnotation:V,value:Y}}class SZ{config;memorySamples=[];cpuSamples=[];ioOperations=[];startTime=0;memoryInterval=null;cpuInterval=null;lastCpuUsage=null;isRunning=!1;constructor(Z={}){this.config={memory:Z.memory??!1,memoryLimit:Z.memoryLimit??1024,cpu:Z.cpu??!1,samplingInterval:Z.samplingInterval??100,io:Z.io??!1,trackOperations:Z.trackOperations??["read","write"],outputFile:Z.outputFile??""}}start(){if(this.isRunning)return;if(this.isRunning=!0,this.startTime=Date.now(),this.memorySamples=[],this.cpuSamples=[],this.ioOperations=[],this.lastCpuUsage=null,this.config.memory)this.sampleMemory(),this.memoryInterval=setInterval(()=>this.sampleMemory(),this.config.samplingInterval);if(this.config.cpu)this.sampleCpu(),this.cpuInterval=setInterval(()=>this.sampleCpu(),this.config.samplingInterval)}stop(){if(!this.isRunning)return;if(this.isRunning=!1,this.memoryInterval)clearInterval(this.memoryInterval),this.memoryInterval=null;if(this.cpuInterval)clearInterval(this.cpuInterval),this.cpuInterval=null}sampleMemory(){let Z=IZ();this.memorySamples.push(Z)}sampleCpu(){let Z=r0();if(this.lastCpuUsage){let $={timestamp:Date.now(),user:Z.user-this.lastCpuUsage.user,system:Z.system-this.lastCpuUsage.system,total:Z.user-this.lastCpuUsage.user+(Z.system-this.lastCpuUsage.system)};this.cpuSamples.push($)}this.lastCpuUsage=Z}recordIo(Z,$,J,Q){if(!this.config.io)return;if(!this.config.trackOperations.includes(Z))return;this.ioOperations.push({timestamp:Date.now(),operation:Z,path:$,size:J,durationMs:Q})}getResults(){let Z=Date.now(),$=[],J=this.memorySamples[0]||IZ(),Q=0;for(let O of this.memorySamples){if(Q+=O.heapUsed,O.heapUsed>J.heapUsed)J=O;let G=O.heapUsed/1048576;if(G>this.config.memoryLimit)$.push(`Memory limit exceeded at ${new Date(O.timestamp).toISOString()}: ${G.toFixed(2)}MB > ${this.config.memoryLimit}MB`)}let X=this.memorySamples.length>0?Q/this.memorySamples.length:0,q=0,V=0;for(let O of this.cpuSamples)q+=O.user,V+=O.system;let Y=0,W=0,K=0,H=0,A=0,_=0;for(let O of this.ioOperations)if(O.operation==="read")Y++,K+=O.size,A+=O.durationMs;else W++,H+=O.size,_+=O.durationMs;return{startTime:this.startTime,endTime:Z,durationMs:Z-this.startTime,memory:{samples:this.memorySamples,peak:J,average:{timestamp:0,heapUsed:X,heapTotal:0,external:0,arrayBuffers:0,rss:0},warnings:$},cpu:{samples:this.cpuSamples,totalUser:q,totalSystem:V},io:{operations:this.ioOperations,totalReads:Y,totalWrites:W,totalReadBytes:K,totalWriteBytes:H,totalReadMs:A,totalWriteMs:_}}}formatResults(){let Z=this.getResults(),$=["=== Profiling Results ===",""];if($.push(`Duration: ${Z.durationMs}ms`),$.push(""),this.config.memory){if($.push("Memory:"),$.push(` Samples: ${Z.memory.samples.length}`),$.push(` Peak heap: ${g(Z.memory.peak.heapUsed)}`),$.push(` Average heap: ${g(Z.memory.average.heapUsed)}`),Z.memory.warnings.length>0){$.push(" Warnings:");for(let J of Z.memory.warnings)$.push(` - ${J}`)}$.push("")}if(this.config.cpu)$.push("CPU:"),$.push(` Samples: ${Z.cpu.samples.length}`),$.push(` Total user time: ${(Z.cpu.totalUser/1000).toFixed(2)}ms`),$.push(` Total system time: ${(Z.cpu.totalSystem/1000).toFixed(2)}ms`),$.push("");if(this.config.io)$.push("I/O:"),$.push(` Total reads: ${Z.io.totalReads}`),$.push(` Total writes: ${Z.io.totalWrites}`),$.push(` Total read: ${g(Z.io.totalReadBytes)} in ${Z.io.totalReadMs.toFixed(2)}ms`),$.push(` Total write: ${g(Z.io.totalWriteBytes)} in ${Z.io.totalWriteMs.toFixed(2)}ms`),$.push("");return $.join(`
43
+ `)}async writeResults(){if(!this.config.outputFile)return;let Z=this.getResults(),$=JSON.stringify(Z,null,2);try{await(await import("fs/promises")).writeFile(this.config.outputFile,$,"utf-8")}catch{await Bun.write(this.config.outputFile,$)}}}function IZ(){if(typeof process<"u"&&process.memoryUsage){let Z=process.memoryUsage();return{timestamp:Date.now(),heapUsed:Z.heapUsed,heapTotal:Z.heapTotal,external:Z.external,arrayBuffers:Z.arrayBuffers||0,rss:Z.rss}}return{timestamp:Date.now(),heapUsed:0,heapTotal:0,external:0,arrayBuffers:0,rss:0}}function r0(){if(typeof process<"u"&&process.cpuUsage){let Z=process.cpuUsage();return{user:Z.user,system:Z.system}}return{user:0,system:0}}function g(Z){if(Z===0)return"0 B";let $=["B","KB","MB","GB"],J=1024,Q=Math.floor(Math.log(Z)/Math.log(J));return`${Number.parseFloat((Z/J**Q).toFixed(2))} ${$[Q]}`}function t0(Z){return new SZ(Z)}async function Q4(Z,$){let J=t0({memory:!0,cpu:!0,...$});J.start();try{return{result:await Z(),profile:J.getResults()}}finally{J.stop()}}function X4(Z){return{async read($,J){let Q=Date.now();try{let X=await J(),q=typeof X==="string"?X.length:0;return Z.recordIo("read",$,q,Date.now()-Q),X}catch(X){throw Z.recordIo("read",$,0,Date.now()-Q),X}},async write($,J,Q){let X=Date.now();try{await J(),Z.recordIo("write",$,Q,Date.now()-X)}catch(q){throw Z.recordIo("write",$,0,Date.now()-X),q}}}}class TZ{marks=new Map;durations=new Map;mark(Z){this.marks.set(Z,performance.now())}measure(Z,$){let J=this.marks.get($);if(J===void 0)throw Error(`Mark "${$}" not found`);let Q=performance.now()-J,X=this.durations.get(Z)||[];return X.push(Q),this.durations.set(Z,X),Q}getDurations(Z){return this.durations.get(Z)||[]}getAverage(Z){let $=this.getDurations(Z);if($.length===0)return 0;return $.reduce((J,Q)=>J+Q,0)/$.length}getSummary(){let Z=new Map;for(let[$,J]of this.durations)Z.set($,{count:J.length,total:J.reduce((Q,X)=>Q+X,0),average:J.reduce((Q,X)=>Q+X,0)/J.length,min:Math.min(...J),max:Math.max(...J)});return Z}clear(){this.marks.clear(),this.durations.clear()}}function q4(){return new TZ}import{lstat as e0,realpath as Z1,stat as $1}from"fs/promises";import{isAbsolute as l,normalize as CZ,relative as J1,resolve as kZ}from"path";var T={rootDir:process.cwd(),maxFileSize:10485760,maxTotalSize:104857600,timeout:30000,followSymlinks:!1,maxFiles:1e4,blockedPatterns:["**/.git/**","**/node_modules/**","**/.env*","**/secrets/**","**/*.key","**/*.pem"]};class I extends Error{code;path;constructor(Z,$,J){super(Z);this.code=$;this.path=J;this.name="SecurityError"}}function u(Z,$={}){let{rootDir:J=process.cwd()}=$,Q=CZ(Z),X=l(Q)?Q:kZ(J,Q),q=kZ(X),V=J1(J,q);if(V.startsWith("..")||l(V))throw new I(`Path traversal detected: "${Z}" resolves outside root directory`,"PATH_TRAVERSAL",Z);return q}function Q1(Z,$={}){return Z.map((J)=>u(J,$))}function bZ(Z,$={}){let J=$.blockedPatterns||T.blockedPatterns;for(let Q of J)if(q1(Z,Q))return!0;return!1}var vZ=new Map;function X1(Z){let $=vZ.get(Z);if($)return $;let J=Z.replace(/\*\*/g,"<<GLOBSTAR>>").replace(/\*/g,"<<STAR>>").replace(/\?/g,"<<QUESTION>>");J=J.replace(/[.+^${}()|[\]\\]/g,"\\$&"),J=J.replace(/^<<GLOBSTAR>>\//,"(.*\\/)?"),J=J.replace(/\/<<GLOBSTAR>>$/,"(\\/.*)?"),J=J.replace(/\/<<GLOBSTAR>>\//g,"(\\/.*)?\\/"),J=J.replace(/<<GLOBSTAR>>/g,".*"),J=J.replace(/<<STAR>>/g,"[^/]*"),J=J.replace(/<<QUESTION>>/g,"[^/]");let Q=new RegExp(`^${J}$`);return vZ.set(Z,Q),Q}function q1(Z,$){let J=Z.indexOf("\\")===-1?Z:Z.replace(/\\/g,"/");return X1($).test(J)}async function V1(Z,$={}){let J=$.maxFileSize??T.maxFileSize;try{let Q=await $1(Z);if(Q.size>J)throw new I(`File too large: "${Z}" is ${f(Q.size)}, max is ${f(J)}`,"FILE_TOO_LARGE",Z);return Q.size}catch(Q){if(Q instanceof I)throw Q;throw new I(`Failed to check file size: ${Z}`,"INVALID_PATH",Z)}}async function Y1(Z){try{return(await e0(Z)).isSymbolicLink()}catch{return!1}}async function W1(Z,$={}){let J=$.followSymlinks??T.followSymlinks;if(await Y1(Z)){if(!J)throw new I(`Symbolic links not allowed: "${Z}"`,"SYMLINK_NOT_ALLOWED",Z);let Q=await Z1(Z);return u(Q,$)}return Z}async function o(Z,$={}){let J=u(Z,$);if(bZ(J,$))throw new I(`Path matches blocked pattern: "${Z}"`,"BLOCKED_PATTERN",Z);let Q=await W1(J,$),X=await V1(Q,$);return{path:Q,size:X}}async function PZ(Z,$={}){let J=$.maxFiles??T.maxFiles,Q=$.maxTotalSize??T.maxTotalSize;if(Z.length>J)throw new I(`Too many files: ${Z.length} exceeds maximum of ${J}`,"MAX_FILES_EXCEEDED");let X=[],q=0;for(let V of Z){let Y=await o(V,$);if(X.push(Y.path),q+=Y.size,q>Q)throw new I(`Total size exceeded: ${f(q)} exceeds maximum of ${f(Q)}`,"TOTAL_SIZE_EXCEEDED")}return{paths:X,totalSize:q}}function s(Z,$,J="Operation"){return new Promise((Q,X)=>{let q=setTimeout(()=>{X(new I(`${J} timed out after ${$}ms`,"TIMEOUT"))},$);Z.then((V)=>{clearTimeout(q),Q(V)}).catch((V)=>{clearTimeout(q),X(V)})})}function K1(Z,$={}){let J=$.timeout??T.timeout;return async(Q)=>{let{path:X}=await o(Q,$);return s(Z(X),J,`Processing ${Q}`)}}function K4(Z,$={}){let J=$.timeout??T.timeout;return async(Q)=>{let{paths:X}=await PZ(Q,$);return s(Z(X),J,`Processing ${Q.length} files`)}}function H4(Z){let $=Z.replace(/\\/g,"/").replace(/\0/g,"").replace(/^\/+/,"").replace(/^[A-Z]:/i,""),J="";while(J!==$)J=$,$=$.replace(/\.\.\/|\.\.$/g,"").replace(/\/+/g,"/");return $.replace(/^\/+|\/+$/g,"")}function U4(Z){if(Z.includes("\x00"))return!1;if(CZ(Z).includes(".."))return!1;if(l(Z)&&!Z.startsWith(process.cwd()))return!1;return!0}function f(Z){if(Z===0)return"0 B";let $=["B","KB","MB","GB"],J=1024,Q=Math.floor(Math.log(Z)/Math.log(J));return`${Number.parseFloat((Z/J**Q).toFixed(2))} ${$[Q]}`}function O4(Z={}){let $={...T,...Z};return{validatePath:(J)=>u(J,$),validatePaths:(J)=>Q1(J,$),validateFile:(J)=>o(J,$),validateBatch:(J)=>PZ(J,$),withTimeout:(J,Q)=>s(J,$.timeout,Q),secureProcessor:(J)=>K1(J,$),isBlocked:(J)=>bZ(J,$),getConfig:()=>$}}import{readFile as H1,writeFile as U1}from"fs/promises";import{basename as O1,dirname as xZ,relative as G1,resolve as _1}from"path";class yZ{file;sourceRoot;sources=[];sourcesContent=[];names=[];mappings=[];sourceIndexMap=new Map;nameIndexMap=new Map;constructor(Z){this.file=Z.file,this.sourceRoot=Z.sourceRoot}addSource(Z,$){let J=this.sourceIndexMap.get(Z);if(J===void 0)J=this.sources.length,this.sources.push(Z),this.sourcesContent.push($??null),this.sourceIndexMap.set(Z,J);else if($&&!this.sourcesContent[J])this.sourcesContent[J]=$;return J}addName(Z){let $=this.nameIndexMap.get(Z);if($===void 0)$=this.names.length,this.names.push(Z),this.nameIndexMap.set(Z,$);return $}addMapping(Z){let $=this.addSource(Z.source),J;if(Z.name)J=this.addName(Z.name);this.mappings.push({generated:Z.generated,original:Z.original,sourceIndex:$,nameIndex:J})}generate(Z=!1){this.mappings.sort((J,Q)=>{if(J.generated.line!==Q.generated.line)return J.generated.line-Q.generated.line;return J.generated.column-Q.generated.column});let $={version:3,file:this.file,sources:this.sources,names:this.names,mappings:this.encodeMappings()};if(this.sourceRoot)$.sourceRoot=this.sourceRoot;if(Z)$.sourcesContent=this.sourcesContent;return $}encodeMappings(){let Z=[],$=0,J=0,Q=0,X=0,q=0,V=0,Y=[];for(let W of this.mappings){while($<W.generated.line)Z.push(Y.join(",")),Y=[],$++,J=0;let K=[];if(K.push(W.generated.column-J),J=W.generated.column,K.push(W.sourceIndex-Q),Q=W.sourceIndex,K.push(W.original.line-X),X=W.original.line,K.push(W.original.column-q),q=W.original.column,W.nameIndex!==void 0)K.push(W.nameIndex-V),V=W.nameIndex;Y.push(z1(K))}return Z.push(Y.join(",")),Z.join(";")}toString(Z=!1){return JSON.stringify(this.generate(Z))}toDataUrl(Z=!1){let $=this.toString(Z);return`data:application/json;charset=utf-8;base64,${Buffer.from($).toString("base64")}`}toComment(Z=!1){return`//# sourceMappingURL=${this.toDataUrl(Z)}`}}class a{map;decodedMappings=null;constructor(Z){this.map=typeof Z==="string"?JSON.parse(Z):Z}originalPositionFor(Z){let $=this.getMappings(),J=0,Q=$.length-1,X=null;while(J<=Q){let q=Math.floor((J+Q)/2),V=$[q];if(V.generated.line===Z.line)if(V.generated.column===Z.column){X=V;break}else if(V.generated.column<Z.column)X=V,J=q+1;else Q=q-1;else if(V.generated.line<Z.line)J=q+1;else Q=q-1}if(!X)return{source:null,line:null,column:null,name:null};return{source:this.map.sources[X.sourceIndex]||null,line:X.original.line,column:X.original.column,name:X.nameIndex!==void 0?this.map.names[X.nameIndex]:null}}generatedPositionFor(Z){let $=this.map.sources.indexOf(Z.source);if($===-1)return null;let J=this.getMappings();for(let Q of J)if(Q.sourceIndex===$&&Q.original.line===Z.line&&Q.original.column<=Z.column)return Q.generated;return null}getMappings(){if(!this.decodedMappings)this.decodedMappings=B1(this.map.mappings);return this.decodedMappings}sourceContentFor(Z){let $=this.map.sources.indexOf(Z);if($===-1||!this.map.sourcesContent)return null;return this.map.sourcesContent[$]}}function z1(Z){return Z.map(A1).join("")}function A1(Z){let q="",V=Z<0?-Z<<1|1:Z<<1;do{let Y=V&31;if(V>>>=5,V>0)Y|=32;q+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[Y]}while(V>0);return q}function B1(Z){let $=[],J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q=0,X=0,q=0,V=0,Y=0,W=0,K=Z.split(";");for(let H of K){if(X=0,H){let A=H.split(",");for(let _ of A){if(!_)continue;let O=j1(_,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");if(O.length>=1)X+=O[0];if(O.length>=4){q+=O[1],V+=O[2],Y+=O[3];let G={generated:{line:Q,column:X},original:{line:V,column:Y},sourceIndex:q};if(O.length>=5)W+=O[4],G.nameIndex=W;$.push(G)}}}Q++}return $}function j1(Z,$){let Q=[],X=0,q=0;for(let V of Z){let Y=$.indexOf(V);if(Y===-1)continue;let W=Y&32;if(q+=(Y&31)<<X,W)X+=5;else{let K=q&1;q>>=1,Q.push(K?-q:q),q=0,X=0}}return Q}function A4(Z){let $=new yZ({file:O1(Z.generatedFile),sourceRoot:Z.sourceRoot}),J=G1(xZ(Z.generatedFile),Z.sourceFile);$.addSource(J,Z.sourceContent);for(let Q of Z.mappings)$.addMapping({generated:{line:Q.generatedLine,column:Q.generatedColumn},original:{line:Q.originalLine,column:Q.originalColumn},source:J,name:Q.name});return $}function B4(Z,$){return`${Z}
44
+ //# sourceMappingURL=${$}`}function j4(Z,$,J=!1){return`${Z}
45
+ ${$.toComment(J)}`}async function N4(Z,$,J=!1){await U1(Z,$.toString(J))}async function N1(Z){let $=await H1(Z,"utf-8");return new a($)}async function R4(Z,$){let J=Z.match(/\/\/# sourceMappingURL=data:application\/json[^,]+,(\S+)/);if(J){let X=J[1],q=Buffer.from(X,"base64").toString("utf-8");return new a(q)}let Q=Z.match(/\/\/# sourceMappingURL=(.+)$/);if(Q){let X=_1(xZ($),Q[1].trim());try{return await N1(X)}catch{return null}}return null}function F4(Z,$){let J=Z,Q=$,X=J.split(`
46
+ `),q=[],V=0,Y=0;for(let W of Q){while(V+X[Y].length+1<=W.generatedStart&&Y<X.length-1)V+=X[Y].length+1,Y++;let K=W.generatedStart-V;q.push({generatedLine:Y,generatedColumn:Math.max(0,K),originalLine:W.originalLine,originalColumn:W.originalColumn,name:W.name})}return q}class hZ{config;types=new Map;imports=new Map;relationships=[];usageMap=new Map;constructor(Z={}){this.config={types:!1,relationships:!1,usage:!1,imports:!1,importUsage:!1,importRelationships:!1,...Z}}trackType(Z,$){if(!this.config.types)return;if(["interface","type","class","enum"].includes(Z.kind)){if(this.types.get(Z.name))return;let Q={name:Z.name,kind:Z.kind,file:$,usedBy:new Set,references:new Set,extendsFrom:Z.extends?[Z.extends]:void 0,implementsFrom:Z.implements};if(this.types.set(Z.name,Q),this.config.relationships){if(Z.extends)this.relationships.push({from:Z.name,to:Z.extends,kind:"extends",file:$});if(Z.implements)for(let X of Z.implements)this.relationships.push({from:Z.name,to:X,kind:"implements",file:$})}}}trackTypeUsage(Z,$,J){if(!this.config.usage)return;let Q=this.types.get(Z);if(Q)Q.usedBy.add($);let X=this.usageMap.get(Z)||new Set;if(X.add(`${J}:${$}`),this.usageMap.set(Z,X),this.config.relationships)this.relationships.push({from:$,to:Z,kind:"uses",file:J})}trackImport(Z,$,J,Q){if(!this.config.imports)return;let X={source:Z,specifiers:$,isTypeOnly:J,file:Q,usedSpecifiers:new Set,unusedSpecifiers:new Set($)},q=this.imports.get(Q)||[];q.push(X),this.imports.set(Q,q)}trackImportUsage(Z,$){if(!this.config.importUsage)return;let J=this.imports.get($);if(!J)return;for(let Q of J)if(Q.specifiers.includes(Z))Q.usedSpecifiers.add(Z),Q.unusedSpecifiers.delete(Z)}trackTypeReference(Z,$){if(!this.config.types)return;let J=this.types.get(Z);if(J)J.references.add($)}getResults(){let Z=[],$=[];for(let[X,q]of this.types)if(q.usedBy.size===0&&q.references.size===0)Z.push(X);for(let X of this.imports.values())for(let q of X)if(q.unusedSpecifiers.size===q.specifiers.length)$.push(q);let J=this.detectCircularReferences(),Q={totalTypes:this.types.size,usedTypes:this.types.size-Z.length,unusedTypes:Z.length,totalImports:Array.from(this.imports.values()).flat().length,usedImports:Array.from(this.imports.values()).flat().filter((X)=>X.usedSpecifiers.size>0).length,unusedImports:$.length,totalRelationships:this.relationships.length,circularDependencies:J.length};return{types:this.types,imports:this.imports,relationships:this.relationships,unusedTypes:Z,unusedImports:$,circularReferences:J,statistics:Q}}detectCircularReferences(){let Z=[],$=new Set,J=[],Q=(X)=>{if(J.includes(X)){let V=J.indexOf(X);Z.push(J.slice(V));return}if($.has(X))return;$.add(X),J.push(X);let q=this.relationships.filter((V)=>V.from===X&&(V.kind==="extends"||V.kind==="implements"||V.kind==="references")).map((V)=>V.to);for(let V of q)Q(V);J.pop()};for(let X of this.types.keys())Q(X);return Z}clear(){this.types.clear(),this.imports.clear(),this.relationships=[],this.usageMap.clear()}formatResults(){let Z=this.getResults(),$=["=== Tracking Results ===",""];if($.push("Statistics:"),$.push(` Total types: ${Z.statistics.totalTypes}`),$.push(` Used types: ${Z.statistics.usedTypes}`),$.push(` Unused types: ${Z.statistics.unusedTypes}`),$.push(` Total imports: ${Z.statistics.totalImports}`),$.push(` Used imports: ${Z.statistics.usedImports}`),$.push(` Unused imports: ${Z.statistics.unusedImports}`),$.push(` Type relationships: ${Z.statistics.totalRelationships}`),$.push(` Circular dependencies: ${Z.statistics.circularDependencies}`),$.push(""),Z.unusedTypes.length>0){$.push("Unused types:");for(let J of Z.unusedTypes){let Q=Z.types.get(J);$.push(` - ${J} (${Q?.kind}) in ${Q?.file}`)}$.push("")}if(Z.unusedImports.length>0){$.push("Unused imports:");for(let J of Z.unusedImports)$.push(` - ${J.source} in ${J.file}`),$.push(` Specifiers: ${Array.from(J.unusedSpecifiers).join(", ")}`);$.push("")}if(Z.circularReferences.length>0){$.push("Circular references:");for(let J of Z.circularReferences)$.push(` - ${J.join(" -> ")} -> ${J[0]}`);$.push("")}return $.join(`
47
+ `)}}function gZ(Z){return new hZ(Z)}function fZ(Z,$,J){for(let Q of Z){if(J.trackType(Q,$),Q.typeAnnotation){let X=R1(Q.typeAnnotation);for(let q of X)J.trackTypeUsage(q,Q.name,$)}if(Q.extends)J.trackTypeUsage(Q.extends,Q.name,$);if(Q.implements)for(let X of Q.implements)J.trackTypeUsage(X,Q.name,$);if(Q.kind==="import"&&Q.source&&Q.specifiers)J.trackImport(Q.source,Q.specifiers.map((X)=>X.name),Q.isTypeOnly||!1,$)}}function R1(Z){let $=[],J=new Set(["string","number","boolean","any","unknown","void","never","null","undefined","object","symbol","bigint","true","false","readonly","keyof","typeof","infer","extends","in","out"]),Q=/\b([A-Z]\w*)\b/g,X;while((X=Q.exec(Z))!==null){let q=X[1];if(!J.has(q.toLowerCase())&&!$.includes(q))$.push(q)}return $}function E4(Z,$){let J=gZ({imports:!0,importUsage:!0,importRelationships:!0,...$});for(let[Q,X]of Z)fZ(X,Q,J);return J.getResults()}function L4(Z,$){let J=gZ({types:!0,relationships:!0,usage:!0,...$});for(let[Q,X]of Z)fZ(X,Q,J);return J.getResults()}function F1(Z,$,J,Q={}){return{kind:Z,name:$,text:J,isExported:Q.isExported??!1,...Q}}function D1(Z){if(typeof structuredClone==="function")return structuredClone(Z);return JSON.parse(JSON.stringify(Z))}function mZ(Z,$,J=null){for(let Q of Z){$.enter?.(Q,J);let X=$[Q.kind];if(X)X(Q,J);if(Q.members&&Q.members.length>0)mZ(Q.members,$,Q);$.leave?.(Q,J)}}function I4(Z,$){let J=[];return mZ(Z,{enter:(Q)=>{if($(Q))J.push(Q)}}),J}async function E1(Z,$,J){let Q=[],X=Z.length;for(let q=0;q<Z.length;q++){let V=Z[q],Y={...J,index:q,total:X,allDeclarations:Z},W=await $(V,Y);if(W===null)continue;else if(W===void 0)Q.push(V);else if(Array.isArray(W))Q.push(...W);else Q.push(W)}return Q}function S4(...Z){return async($,J)=>{let Q=$;for(let X of Z){if(Q===null)return null;if(Array.isArray(Q)){let q=[];for(let V of Q){let Y=await X(V,J);if(Y===null)continue;if(Y===void 0)q.push(V);else if(Array.isArray(Y))q.push(...Y);else q.push(Y)}Q=q.length>0?q:null}else{let q=await X(Q,J);if(q===null)Q=null;else if(q===void 0);else Q=q}}return Q}}function b(Z,$){let J=new Set(Array.isArray(Z)?Z:[Z]);return async(Q,X)=>{if(J.has(Q.kind))return $(Q,X);return}}function T4(Z,$){return async(J,Q)=>{if(Z(J))return $(J,Q);return}}function m(Z){let $={createDeclaration:F1,cloneDeclaration:D1,modifyText:(J,Q)=>({...J,text:Q}),addModifier:(J,Q)=>({...J,modifiers:[...J.modifiers||[],Q]}),removeModifier:(J,Q)=>({...J,modifiers:(J.modifiers||[]).filter((X)=>X!==Q)})};return uZ({name:Z.name,version:Z.version,description:Z.description,onBeforeFile:Z.beforeParse?async(J)=>{return Z.beforeParse(J.content,{filePath:J.filePath,phase:"before"})}:void 0,onDeclarations:Z.transform?async(J)=>{return E1(J.declarations,Z.transform,{filePath:J.filePath,sourceCode:J.sourceCode,...$})}:void 0,onAfterFile:Z.afterGenerate?async(J)=>{return Z.afterGenerate(J.content,{filePath:J.filePath,phase:"after"})}:void 0})}function k4(Z,$){let J=typeof Z==="string"?new RegExp(Z):Z;return(Q)=>{if(J.test(Q.name)){let X=typeof $==="function"?$(Q.name,Q):Q.name.replace(J,$),q=Q.text.replace(new RegExp(`\\b${P(Q.name)}\\b`),X);return{...Q,name:X,text:q}}return}}function L1(Z,$){return(J)=>{if(J.kind==="import")return;if($&&!$(J))return;let Q=`${Z}${J.name}`,X=J.text.replace(new RegExp(`\\b${P(J.name)}\\b`),Q);return{...J,name:Q,text:X}}}function v4(Z,$){return(J)=>{if(J.kind==="import")return;if($&&!$(J))return;let Q=`${J.name}${Z}`,X=J.text.replace(new RegExp(`\\b${P(J.name)}\\b`),Q);return{...J,name:Q,text:X}}}function w1(Z){let $=typeof Z==="function"?Z:(J)=>{return(typeof Z==="string"?new RegExp(Z):Z).test(J.name)};return(J)=>{if($(J))return null;return}}function C4(Z){return($)=>{let J=Z($);if(!J)return;let X=(Array.isArray(J)?J:[J]).map((q)=>{if(q.startsWith("/**"))return q;if(q.startsWith("/*"))return q;return`/** ${q} */`});return{...$,leadingComments:[...$.leadingComments||[],...X]}}}function b4(Z){return($)=>{if(!$.typeAnnotation)return;let J=Z($.typeAnnotation,$);if(J===null)return null;if(J===void 0)return;let Q=$.text.replace(new RegExp(`:[ ]*${P($.typeAnnotation)}`),`: ${J}`);return{...$,typeAnnotation:J,text:Q}}}function P4(Z){return b("function",($)=>{if(!$.returnType)return;let J=Z($.returnType,$);if(J===null)return null;if(J===void 0)return;let Q=$.text.replace(new RegExp(`\\):[ ]*${P($.returnType)}`),`): ${J}`);return{...$,returnType:J,text:Q}})}function x4(Z){return b(["function","class"],($)=>{if(!$.parameters)return;let J=Z($.parameters,$);if(J===null)return null;if(J===void 0)return;let Q=J.map((q)=>{let V="";if(q.rest)V+="...";if(V+=q.name,q.optional)V+="?";if(q.type)V+=`: ${q.type}`;if(q.defaultValue)V+=` = ${q.defaultValue}`;return V}).join(", "),X=$.text.replace(/\([^)]*\)/,`(${Q})`);return{...$,parameters:J,text:X}})}function M1(Z,$){return(J)=>{if($&&!$(J))return;if(J.modifiers?.includes(Z))return;let Q=[...J.modifiers||[],Z],X=J.text;if(!X.includes(Z)){let q=["function","class","interface","type","enum","const","let","var"];for(let V of q){let Y=X.indexOf(V);if(Y>=0){X=`${X.slice(0,Y)}${Z} ${X.slice(Y)}`;break}}}return{...J,modifiers:Q,text:X}}}var I1=b(["interface","type"],(Z)=>{let $=Z.text.replace(/(\n\s*)(\w+)(\??:\s)/g,"$1readonly $2$3");if($===Z.text)return;return{...Z,text:$}}),y4=b(["interface","type"],(Z)=>{let $=Z.text.replace(/(\w+)\?:/g,"$1:");if($===Z.text)return;return{...Z,text:$}}),h4=b(["interface","type"],(Z)=>{let $=Z.text.replace(/(\w+)(?<!\?):/g,"$1?:");if($===Z.text)return;return{...Z,text:$}});function g4(Z){let $=new RegExp(`@(${Z.join("|")})\\b[^@]*`,"g");return(J)=>{if(!J.leadingComments?.length)return;let Q=J.leadingComments.map((q)=>{return q.replace($,"").replace(/\n\s*\*\s*\n/g,`
48
+ `)});if(!Q.some((q,V)=>q!==J.leadingComments[V]))return;return{...J,leadingComments:Q}}}function f4(Z,$){return(J)=>{if($&&!$(J))return;if(!J.typeAnnotation)return;let Q=`${Z}<${J.typeAnnotation}>`,X=J.text.replace(J.typeAnnotation,Q);return{...J,typeAnnotation:Q,text:X}}}var u4=m({name:"readonly",version:"1.0.0",description:"Makes all interface properties readonly",transform:I1}),m4=m({name:"strip-private",version:"1.0.0",description:"Strips @internal, @private, and @hidden declarations",transform:w1((Z)=>{if(!Z.leadingComments)return!1;return Z.leadingComments.some(($)=>/@(internal|private|hidden)\b/.test($))})}),p4=m({name:"declare",version:"1.0.0",description:"Adds declare keyword to all declarations",transform:M1("declare",(Z)=>Z.kind!=="import")});function d4(Z){return m({name:`namespace-prefix-${Z}`,version:"1.0.0",description:`Prefixes exported declarations with ${Z}`,transform:L1(`${Z}_`,($)=>$.isExported&&$.kind!=="import")})}function P(Z){return Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function n(Z,$={}){let{entryPoints:J,keepExported:Q=!0,keep:X=[],remove:q=[],shakableKinds:V=["type","interface"],debug:Y=!1}=$,W=Y?console.log.bind(console,"[tree-shake]"):()=>{},K=new Map;for(let B of Z)K.set(B.name,B);let H=r(Z);W("Dependency graph:",Object.fromEntries(Array.from(H.entries()).map(([B,j])=>[B,Array.from(j)])));let A=new Set;if(J&&J.length>0){for(let B of J)if(K.has(B))A.add(B)}else{let B=new Set(V);for(let j of Z){if(Q&&j.isExported){A.add(j.name);continue}if(i(j.name,X)){A.add(j.name);continue}if(!B.has(j.kind))A.add(j.name)}}if(J&&J.length>0&&X.length>0){for(let B of Z)if(i(B.name,X))A.add(B.name)}W("Entry points:",Array.from(A));let _=dZ(A,H);W("Reachable:",Array.from(_));let O=new Set,G=[];for(let B of Z){let j=B.name;if(_.has(j)){O.add(j);continue}if(i(j,q)){G.push(j);continue}if(!V.includes(B.kind)){O.add(j);continue}G.push(j)}W("Keeping:",Array.from(O)),W("Removing:",G);let U=Z.filter((B)=>O.has(B.name)),z={totalBefore:Z.length,totalAfter:U.length,removedCount:G.length,reductionPercent:Z.length>0?Math.round(G.length/Z.length*100):0};return{declarations:U,removed:G,dependencyGraph:H,stats:z}}function r(Z){let $=new Map,J=new Set;for(let Q=0;Q<Z.length;Q++)J.add(Z[Q].name);for(let Q of Z){let X=new Set,q=t(Q);for(let V of q)if(J.has(V)&&V!==Q.name)X.add(V);$.set(Q.name,X)}return $}function t(Z){let $=new Set;if(Z.typeAnnotation)x(Z.typeAnnotation,$);if(Z.extends)x(Z.extends,$);if(Z.text)T1(Z.text,$);if(Z.members)for(let J of Z.members){let Q=t(J);for(let X of Q)$.add(X)}if(Z.parameters){for(let J of Z.parameters)if(J.type)x(J.type,$)}if(Z.returnType)x(Z.returnType,$);return $}var S1=new Set(["string","number","boolean","object","any","unknown","never","void","null","undefined","symbol","bigint","true","false","Array","Object","String","Number","Boolean","Function","Symbol","Promise","Map","Set","WeakMap","WeakSet","Record","Partial","Required","Readonly","Pick","Omit","Exclude","Extract","NonNullable","Parameters","ReturnType","InstanceType","ConstructorParameters","ThisParameterType","OmitThisParameter","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","keyof","typeof","infer","extends","readonly","const","new"]),pZ=/\b([A-Z]\w*)\b/g;function x(Z,$){pZ.lastIndex=0;let J;while((J=pZ.exec(Z))!==null){let Q=J[1];if(!S1.has(Q))$.add(Q)}}function T1(Z,$){x(Z,$)}function dZ(Z,$){let J=new Set,Q=Array.from(Z);while(Q.length>0){let X=Q.pop();if(J.has(X))continue;J.add(X);let q=$.get(X);if(q){for(let V of q)if(!J.has(V))Q.push(V)}}return J}function i(Z,$){for(let J of $)if(typeof J==="string"){if(J.includes("*")){if(new RegExp(`^${J.replace(/\*/g,".*").replace(/\?/g,".")}$`).test(Z))return!0}else if(Z===J)return!0}else if(J.test(Z))return!0;return!1}function k1(Z,$={}){let J=Z.split(`
49
+ `),Q=[],X=null;for(let H=0;H<J.length;H++){let A=J[H],_=A.trim();if(!X&&(_===""||_.startsWith("//")))continue;if(!X){let O=_.match(/^(export\s+)?(declare\s+)?(interface|type|enum|class|function|const|let|var)\s+(\w+)/);if(O){let[,G,,U,z]=O;if(X={name:z,kind:U,isExported:!!G,start:H,lines:[A],braceCount:0},X.braceCount+=(A.match(/\{/g)||[]).length,X.braceCount-=(A.match(/\}/g)||[]).length,X.braceCount===0&&(_.endsWith(";")||!_.includes("{")))Q.push({name:X.name,kind:X.kind,isExported:X.isExported,start:X.start,end:H,text:X.lines.join(`
50
+ `)}),X=null;continue}}if(X){if(X.lines.push(A),X.braceCount+=(A.match(/\{/g)||[]).length,X.braceCount-=(A.match(/\}/g)||[]).length,X.braceCount<=0&&(_.endsWith("}")||_.endsWith(";")))Q.push({name:X.name,kind:X.kind,isExported:X.isExported,start:X.start,end:H,text:X.lines.join(`
51
+ `)}),X=null}}if(Q.length===0)return{content:Z,removed:[]};let q=Q.map((H)=>({name:H.name,kind:H.kind,isExported:H.isExported,text:H.text})),V=n(q,$),Y=new Set(V.declarations.map((H)=>H.name)),W=new Set;for(let H of Q)if(!Y.has(H.name))for(let A=H.start;A<=H.end;A++)W.add(A);return{content:J.filter((H,A)=>!W.has(A)).join(`
51
52
  `).replace(/\n{3,}/g,`
52
53
 
53
- `),removed:Y.removed}}function j0(X,Z={}){return r(X,{...Z,debug:!1}).removed}function R0(X,Z){let $=t(Z),J=$.get(X)||new Set,Q=dX(new Set([X]),$);Q.delete(X);let q=[];for(let[Y,V]of $)if(Y!==X&&V.has(X))q.push(Y);return{directDependencies:Array.from(J),transitiveDependencies:Array.from(Q),dependents:q}}function k3(X={}){return{shake:(Z)=>r(Z,X),shakeContent:(Z)=>N0(Z,X),findUnused:(Z)=>j0(Z,X),analyzeDependencies:(Z,$)=>R0(Z,$),buildGraph:t,extractRefs:e}}var F0=[{pattern:/^Promise<void>$/,replacement:"Promise<void>",priority:-1},{pattern:/^Record<string,\s*any>$/,replacement:"Record<string, unknown>",priority:0},{pattern:/^Array<([^<>]+)>$/,replacement:"$1[]",priority:0}],D0=[{pattern:/\bany\b/,replacement:"unknown",global:!0,priority:10},{pattern:/^object$/,replacement:"Record<string, unknown>",priority:10},{pattern:/^Function$/,replacement:"(...args: unknown[]) => unknown",priority:10}],E0=[{pattern:/^(\w+)\[\]$/,replacement:"readonly $1[]",priority:5},{pattern:/^Array<(.+)>$/,replacement:"ReadonlyArray<$1>",priority:5},{pattern:/^Map<(.+),\s*(.+)>$/,replacement:"ReadonlyMap<$1, $2>",priority:5},{pattern:/^Set<(.+)>$/,replacement:"ReadonlySet<$1>",priority:5}],L0=[{pattern:/^Partial<Partial<(.+)>>$/,replacement:"Partial<$1>",priority:5},{pattern:/^Required<Required<(.+)>>$/,replacement:"Required<$1>",priority:5},{pattern:/^Pick<Omit<(.+),\s*(.+)>,\s*(.+)>$/,replacement:"Pick<$1, $3>",priority:5}];function M0(X){switch(X){case"strict":return D0;case"readonly":return E0;case"simplified":return L0;case"nullable":return[{pattern:/^(.+)\s*\|\s*undefined$/,replacement:"$1 | undefined",priority:5}];case"branded":return[{pattern:/^string$/,replacement:"string",condition:(Z)=>Z.declarationKind==="variable"&&(Z.declarationName?.includes("path")??!1),priority:5}];default:return[]}}class cX{rules;cache=new Map;constructor(X={rules:[]}){if(this.rules=[],X.includeDefaults!==!1)this.rules.push(...F0);if(X.presets)for(let Z of X.presets)this.rules.push(...M0(Z));this.rules.push(...X.rules),this.rules.sort((Z,$)=>($.priority||0)-(Z.priority||0))}map(X,Z={}){let $=`${X}:${JSON.stringify(Z)}`,J=this.cache.get($);if(J!==void 0)return J;let Q=X,q={type:X,...Z};for(let Y of this.rules){if(Y.condition&&!Y.condition(q))continue;let V=typeof Y.pattern==="string"?new RegExp(Y.pattern.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y.global?"g":""):Y.pattern;if(V.test(Q)){if(Q=Q.replace(V,Y.replacement),!Y.global)break}}return this.cache.set($,Q),Q}mapAll(X,Z={}){return X.map(($)=>this.map($,{...Z,type:$}))}addRule(X){this.rules.push(X),this.rules.sort((Z,$)=>($.priority||0)-(Z.priority||0)),this.cache.clear()}removeRules(X){let Z=this.rules.length;return this.rules=this.rules.filter(($)=>{let J=typeof $.pattern==="string"?$.pattern:$.pattern.source;return typeof X==="string"?J!==X:!X.test(J)}),this.cache.clear(),Z-this.rules.length}clearCache(){this.cache.clear()}getRules(){return this.rules}}function lX(X={rules:[]}){return new cX(X)}var v3=lX({rules:[]}),b3=lX({rules:[],presets:["strict"]});function P3(X,Z,$={}){return X.replace(/:\s*([^;,)\]}]+)/g,(J,Q)=>{return`: ${Z.map(Q.trim(),$)}`})}var x3={makeReadonly:(X)=>{if(X.endsWith("[]"))return`readonly ${X}`;if(X.startsWith("Array<"))return X.replace("Array<","ReadonlyArray<");return X},makeNullable:(X)=>{if(X.includes("| null")||X.includes("| undefined"))return X;return`${X} | null`},makeOptional:(X)=>{if(X.includes("| undefined"))return X;return`${X} | undefined`},makeRequired:(X)=>{return X.replace(/\s*\|\s*null/g,"").replace(/\s*\|\s*undefined/g,"").trim()},promisify:(X)=>{if(X.startsWith("Promise<"))return X;return`Promise<${X}>`},unpromisify:(X)=>{let Z=X.match(/^Promise<(.+)>$/);return Z?Z[1]:X},arrayify:(X)=>{if(X.endsWith("[]")||X.startsWith("Array<"))return X;return`${X}[]`},unarrayify:(X)=>{if(X.endsWith("[]"))return X.slice(0,-2);let Z=X.match(/^(?:Readonly)?Array<(.+)>$/);return Z?Z[1]:X}};import{watch as w0}from"fs";import{readdir as I0,stat as T0}from"fs/promises";import{join as oX,relative as XX}from"path";function S0(X,Z){let{root:$,include:J=["**/*.ts","**/*.tsx"],exclude:Q=["**/node_modules/**","**/*.d.ts","**/dist/**"],debounce:q=100,initialBuild:Y=!0,clearScreen:V=!1,onChange:W,onBuildStart:K,onBuildComplete:U,onError:O}=X,H=[],A=new Set,_=!1,G=new Map,B=null,z=!1;function j(L){let E=XX($,L);for(let M of Q)if(N(E,M))return!1;for(let M of J)if(N(E,M))return!0;return!1}function N(L,E){let M=E.replace(/\./g,"\\.").replace(/\*\*/g,"{{DOUBLESTAR}}").replace(/\*/g,"[^/]*").replace(/\{\{DOUBLESTAR\}\}/g,".*").replace(/\?/g,".");return new RegExp(`^${M}$`).test(L.replace(/\\/g,"/"))}async function R(){if(z||G.size===0)return;z=!0;let L=Array.from(G.values());G.clear();try{for(let D of L)await W?.(D);if(V)console.clear();await K?.();let E=L.filter((D)=>D.type!=="unlink").map((D)=>D.path),M=await Z(E.length>0?E:void 0);await U?.(M)}catch(E){await O?.(E)}finally{if(z=!1,G.size>0)k()}}function k(){if(B)clearTimeout(B);B=setTimeout(()=>{B=null,R()},q)}function F(L,E,M){if(!E||!_)return;let D=oX(M,E);if(!j(D))return;let C={type:L==="rename"?"add":"change",path:D,relativePath:XX($,D)};T0(D).then(()=>{A.add(D)}).catch(()=>{C.type="unlink",A.delete(D)}).finally(()=>{G.set(D,C),k()})}async function w(L){let E=[L];try{let M=await I0(L,{withFileTypes:!0});for(let D of M)if(D.isDirectory()){let C=oX(L,D.name),ZX=XX($,C),$X=!1;for(let h of Q)if(N(ZX,h)||N(`${ZX}/`,h)){$X=!0;break}if(!$X){let h=await w(C);E.push(...h)}}}catch{}return E}async function sX(){if(_)return;_=!0;let L=await w($);for(let E of L)try{let M=w0(E,{persistent:!0},(D,C)=>{F(D,C,E)});M.on("error",(D)=>{O?.(D)}),H.push(M)}catch(M){await O?.(M)}if(Y){await K?.();let E=await Z();await U?.(E)}}function aX(){if(_=!1,B)clearTimeout(B),B=null;for(let L of H)L.close();H.length=0,A.clear(),G.clear()}async function iX(){await K?.();let L=await Z();return await U?.(L),L}return{start:sX,stop:aX,rebuild:iX,isWatching:()=>_,getWatchedFiles:()=>Array.from(A)}}async function u3(X,Z){let $=async(Q)=>{let q=Date.now();try{let Y=await Z(X);return{success:Y.errors.length===0,duration:Date.now()-q,filesProcessed:Y.filesProcessed,errors:Y.errors}}catch(Y){return{success:!1,duration:Date.now()-q,filesProcessed:0,errors:[Y.message]}}},J=S0({root:X.root||X.cwd||process.cwd(),include:X.include,exclude:X.exclude,debounce:X.debounce,initialBuild:X.initialBuild,clearScreen:X.clearScreen,onChange:X.onChange,onBuildStart:X.onBuildStart,onBuildComplete:X.onBuildComplete,onError:X.onError},$);return await J.start(),J}function k0(X){let Z=X.success?"\u2713":"\u2717",$=`${X.duration}ms`;if(X.success)return`${Z} Built ${X.filesProcessed} file(s) in ${$}`;else return`${Z} Build failed in ${$}
54
- ${X.errors.map((J)=>` - ${J}`).join(`
55
- `)}`}function m3(){return{onChange:(X)=>{let Z=X.type==="add"?"+":X.type==="unlink"?"-":"~";console.log(`[${Z}] ${X.relativePath}`)},onBuildStart:()=>{console.log(`
56
- Rebuilding...`)},onBuildComplete:(X)=>{console.log(k0(X))},onError:(X)=>{console.error(`Error: ${X.message}`)}}}export{G9 as writeToFile,r6 as writeTextFile,Q3 as writeSourceMap,s6 as write,b8 as wrapError,a as withTimeout,u3 as watchAndGenerate,M9 as watch,pX as walkDeclarations,rZ as validateSymlink,sZ as validatePaths,m as validatePath,P6 as validateGeneratedDeclarations,iZ as validateFileSize,s as validateFilePath,xX as validateFileBatch,N9 as validateDtsContent,T6 as validateDeclarations,d0 as unwrap,b6 as typeCheckWithConfig,I6 as typeCheck,N0 as treeShakeContent,r as treeShake,uX as trackDeclarations,u8 as toZod,d8 as toYup,m8 as toValibot,f8 as toJsonSchema,p8 as toIoTs,c8 as toArkType,g8 as summarizeErrors,ZZ as summarizeDiffs,w3 as stripPrivatePlugin,e8 as stripInternalPlugin,D0 as strictTypeMappings,b3 as strictTypeMapper,C9 as startLSPServer,a6 as spawnProcess,p9 as sortProjectsByDependencies,QZ as sortImportsInContent,WX as sortImports,L0 as simplifiedTypeMappings,C4 as shouldUseAsyncParsing,o4 as shouldIncludeNonExportedInterface,l4 as shouldIncludeNonExportedFunction,q8 as setTimestamps,Q8 as setLogPrefix,$8 as setLogLevel,Z8 as scopedLogger,i1 as sanitizeFilename,o6 as runtime,o9 as resolveWorkspacePatterns,E6 as resolveEntryFiles,K8 as resetConfig,F3 as requiredTransformer,zX as removeTrailingWhitespace,TX as removeLeadingComments,E0 as readonlyTypeMappings,B0 as readonlyTransformer,M3 as readonlyPlugin,i6 as readTextFile,W0 as readSourceMap,n8 as quickFormat,q1 as pruneCache,p1 as profileExecution,J9 as processVariableDeclaration,q9 as processTypeDeclaration,D9 as processSource,H9 as processModuleDeclaration,Q9 as processInterfaceDeclaration,T1 as processInParallel,RX as processImports,W9 as processImportDeclaration,$9 as processFunctionDeclaration,L9 as processFile,K9 as processExportDeclaration,V9 as processEnumDeclaration,LX as processDeclarations,Y9 as processClassDeclaration,n0 as printDiffs,$Z as printDiff,e0 as presets,R1 as preserveCommentFormatting,t8 as pluginManager,h1 as parseVariableDeclaration,O8 as parseJSDoc,_9 as parseImportStatement,VX as parseImport,P1 as parseFunctionDeclaration,y4 as parseArrayElements,g9 as parallelProcess,FX as orderDeclarations,D3 as optionalTransformer,P9 as optimizeFile,b9 as optimizeDeclarations,Y8 as nullLogger,D1 as normalizerPresets,MZ as normalizeOutput,BX as normalizeLineEndings,wZ as normalizeIndent,NX as normalizeBlankLines,x9 as minifyDts,z1 as mergeDeclarationsInContent,B1 as mergeDeclarations,_0 as mapDeclarations,X8 as logger,w6 as loadCompilerOptions,y1 as isTypeOnlyExport,nZ as isSymlink,n1 as isSafePath,k8 as isParseError,l6 as isNode,f4 as isGenericType,C8 as isFileError,x1 as isExportStatement,S8 as isDtsxError,v8 as isConfigError,c6 as isBun,s4 as isBuiltInType,p0 as isBranded,PX as isBlockedPath,h4 as inferObjectType,P4 as inferNarrowTypeInUnion,b4 as inferNarrowType,g4 as inferFunctionType,x4 as inferArrayType,d4 as hasExportModifier,c4 as hasAsyncModifier,k6 as getTypeAtPosition,S1 as getTopologicalOrder,T4 as getSourceFileCacheSize,S4 as getSourceFileAsync,t6 as getRuntimeInfo,C6 as getQuickInfo,yZ as getProcessingLevels,M0 as getPresetMappings,v4 as getPendingParseCount,p4 as getParameterName,gZ as getNodeText,J8 as getLogLevel,P8 as getLocationFromOffset,t4 as getInterfaceBody,f6 as getGraphSummary,o8 as getFormatExtension,W8 as getConfig,B9 as getAllTypeScriptFiles,d9 as generateWorkspace,N8 as generateTypeDocJSON,c9 as generateMonorepo,G8 as generateMarkdown,z8 as generateJSON,B8 as generateHTML,s9 as generateFromPackageWorkspaces,j8 as generateDocs,R9 as generateDeclarationMap,E9 as generate,k0 as formatWatchResult,s0 as formatUnifiedDiff,v6 as formatTypeCheckResults,O1 as formatMemoryStats,Y1 as formatIncrementalResult,a8 as formatFiles,x8 as formatErrorWithContext,h8 as formatDtsError,s8 as formatDts,a0 as formatDiffSummary,uZ as formatComments,eX as formatColoredDiff,g6 as formatCircularAnalysis,j0 as findUnusedDeclarations,A6 as findReferencedTypes,hZ as findMatchingBracket,xZ as findIndependentFiles,_3 as findDeclarations,u6 as findAllDependents,m6 as findAllDependencies,A3 as filterByPredicate,P as filterByKind,n6 as fileExists,QX as file,W6 as extractVariableStatement,a4 as extractTypesFromModuleText,e as extractTypeReferences,H6 as extractTypeAliasDeclaration,m4 as extractTripleSlashDirectives,b1 as extractTrailingComment,q3 as extractSourceMap,u4 as extractSatisfiesType,G6 as extractReferencedTypeDeclarations,O6 as extractModuleDeclaration,fZ as extractLeadingCommentsFromNode,v1 as extractLeadingComments,fZ as extractJSDocComments,K6 as extractInterfaceDeclaration,Q6 as extractImportDeclaration,V6 as extractFunctionDeclaration,q6 as extractExportDeclaration,Y6 as extractExportAssignment,_6 as extractEnumDeclaration,A8 as extractDocumentation,V1 as extractDependencies,z6 as extractDeclarationsAsync,EX as extractDeclarations,U6 as extractClassDeclaration,IX as extractBalancedSymbols,O9 as extractAllImportedItems,d6 as exportGraphAsJson,p6 as exportGraphAsDot,_1 as estimateMemoryUsage,jX as ensureTrailingNewline,M6 as ensureGitignore,m9 as discoverWorkspaceProjects,l9 as discoverWorkspaceFromPackageJson,i0 as diffFiles,XZ as diffFile,j1 as detectLineEnding,c as detectGroup,y6 as detectCircularDependencies,mX as definePlugin,U8 as defineConfigAsync,H8 as defineConfig,F0 as defaultTypeMappings,v3 as defaultTypeMapper,V8 as defaultConfig,I3 as declarePlugin,L3 as createWrapTypeTransformer,h9 as createWorkerPool,S0 as createWatcher,m3 as createWatchLogger,N3 as createTypeTransformer,lX as createTypeMapper,k3 as createTreeShaker,p as createTransformerPlugin,fX as createTracker,c1 as createTimer,B3 as createSuffixTransformer,E3 as createStripTagsTransformer,A1 as createStreamingProcessor,Z3 as createSourceMap,r1 as createSecurityMiddleware,tZ as createSecureProcessor,a1 as createSecureBatchProcessor,j3 as createReturnTypeTransformer,G3 as createRenameTransformer,A0 as createRemoveTransformer,pZ as createProfiler,d1 as createProfiledIo,O0 as createPrefixTransformer,R3 as createParameterTransformer,F1 as createOutputNormalizer,T3 as createNamespacePrefixPlugin,G0 as createModifierTransformer,U1 as createMemoryOptimizedConfig,e6 as createLogger,z3 as createJSDocTransformer,Q1 as createIncrementalBuilder,t0 as createImportSorter,i8 as createFormatter,Z9 as createFilterPlugin,v9 as createFileWatcher,y8 as createDtsError,R8 as createDocsGenerator,j9 as createDiff,H0 as createDeclaration,D6 as createBundler,X9 as createBannerPlugin,l8 as convertToFormat,_8 as config,d as computeDiff,O3 as composeTransformers,U0 as cloneDeclaration,B6 as clearSourceFileCache,U9 as clearProcessorCaches,z9 as checkIsolatedDeclarationsConfig,S6 as checkIsolatedDeclarations,u9 as calculateOptimalBatchSize,R6 as bundleDtsFiles,j6 as bundleDeclarations,F6 as bundleAndWrite,n4 as buildVariableDeclaration,e4 as buildTypeDeclaration,CZ as buildProcessingGraph,$6 as buildModuleDeclaration,J6 as buildModuleBody,r4 as buildInterfaceDeclaration,i4 as buildFunctionSignature,x6 as buildDependencyGraph,Y3 as buildDeclarationMappings,t as buildDeclarationDependencyGraph,X6 as buildClassDeclaration,Z6 as buildClassBody,k4 as batchParseSourceFiles,f9 as batchFiles,N6 as batchExtractDeclarations,A9 as assertNever,h0 as asTypeName,P0 as asSourceCode,u0 as asRelativePath,y0 as asModuleSpecifier,m0 as asJsonString,b0 as asGlobPattern,C0 as asFilePath,x0 as asDtsContent,v0 as asDirectoryPath,g0 as asDeclarationName,f0 as asAbsolutePath,P3 as applyTypeMappings,$3 as appendSourceMapComment,J3 as appendInlineSourceMap,K3 as analyzeTypes,k1 as analyzeParallelizationPotential,W3 as analyzeImports,R0 as analyzeDependencies,h6 as analyzeCircularDependencies,F9 as addSourceMapComment,y9 as WorkerPool,x3 as TypeTransformers,cX as TypeMapper,gX as Tracker,CX as Timer,I9 as SymbolKind,BZ as StringInterner,_X as StreamingProcessor,hX as SourceMapGenerator,i as SourceMapConsumer,I as SecurityError,kX as Profiler,M8 as ProcessingError,r8 as PluginManager,E8 as ParseError,zZ as ObjectPool,w9 as LspDiagnosticSeverity,GZ as LazyLoader,KZ as IncrementalCache,w8 as FileError,L8 as ExtractionError,F8 as ErrorCodes,k9 as DtsxLanguageServer,D8 as DtsxError,S9 as DocumentHighlightKind,AZ as DeclarationPool,S as DEFAULT_SECURITY_CONFIG,LZ as DEFAULT_IMPORT_GROUP_ORDER,YX as DEFAULT_GROUP_ORDER,GX as DEFAULT_DECLARATION_ORDER,I8 as ConfigError,T9 as CompletionItemKind,T8 as CircularDependencyError,L6 as BuildCache,c0 as BrandedPath};
54
+ `),removed:V.removed}}function v1(Z,$={}){return n(Z,{...$,debug:!1}).removed}function C1(Z,$){let J=r($),Q=J.get(Z)||new Set,X=dZ(new Set([Z]),J);X.delete(Z);let q=[];for(let[V,Y]of J)if(V!==Z&&Y.has(Z))q.push(V);return{directDependencies:Array.from(Q),transitiveDependencies:Array.from(X),dependents:q}}function l4(Z={}){return{shake:($)=>n($,Z),shakeContent:($)=>k1($,Z),findUnused:($)=>v1($,Z),analyzeDependencies:($,J)=>C1($,J),buildGraph:r,extractRefs:t}}var b1=[{pattern:/^Promise<void>$/,replacement:"Promise<void>",priority:-1},{pattern:/^Record<string,\s*any>$/,replacement:"Record<string, unknown>",priority:0},{pattern:/^Array<([^<>]+)>$/,replacement:"$1[]",priority:0}],P1=[{pattern:/\bany\b/,replacement:"unknown",global:!0,priority:10},{pattern:/^object$/,replacement:"Record<string, unknown>",priority:10},{pattern:/^Function$/,replacement:"(...args: unknown[]) => unknown",priority:10}],x1=[{pattern:/^(\w+)\[\]$/,replacement:"readonly $1[]",priority:5},{pattern:/^Array<(.+)>$/,replacement:"ReadonlyArray<$1>",priority:5},{pattern:/^Map<(.+),\s*(.+)>$/,replacement:"ReadonlyMap<$1, $2>",priority:5},{pattern:/^Set<(.+)>$/,replacement:"ReadonlySet<$1>",priority:5}],y1=[{pattern:/^Partial<Partial<(.+)>>$/,replacement:"Partial<$1>",priority:5},{pattern:/^Required<Required<(.+)>>$/,replacement:"Required<$1>",priority:5},{pattern:/^Pick<Omit<(.+),\s*(.+)>,\s*(.+)>$/,replacement:"Pick<$1, $3>",priority:5}];function h1(Z){switch(Z){case"strict":return P1;case"readonly":return x1;case"simplified":return y1;case"nullable":return[{pattern:/^(.+)\s*\|\s*undefined$/,replacement:"$1 | undefined",priority:5}];case"branded":return[{pattern:/^string$/,replacement:"string",condition:($)=>$.declarationKind==="variable"&&($.declarationName?.includes("path")??!1),priority:5}];default:return[]}}var g1=/[.*+?^${}()|[\]\\]/g,cZ=2048;class lZ{rules;compiled=[];cache=new Map;constructor(Z={rules:[]}){if(this.rules=[],Z.includeDefaults!==!1)this.rules.push(...b1);if(Z.presets)for(let $ of Z.presets)this.rules.push(...h1($));this.rules.push(...Z.rules),this.rules.sort(($,J)=>(J.priority||0)-($.priority||0)),this.recompile()}recompile(){let Z=Array(this.rules.length);for(let $=0;$<this.rules.length;$++){let J=this.rules[$],Q=typeof J.pattern==="string"?new RegExp(J.pattern.replace(g1,"\\$&"),J.global?"g":""):J.pattern;Z[$]={rule:J,regex:Q}}this.compiled=Z}map(Z,$={}){let Q=!$.declarationName&&!$.declarationKind&&!$.filePath&&!$.isReturnType&&!$.isParameterType&&!$.isPropertyType?Z:`${Z}\x00${$.declarationName??""}\x00${$.declarationKind??""}\x00${$.filePath??""}\x00${$.isReturnType?"r":""}${$.isParameterType?"p":""}${$.isPropertyType?"P":""}`,X=this.cache.get(Q);if(X!==void 0)return X;let q=Z,V=null;for(let Y=0;Y<this.compiled.length;Y++){let{rule:W,regex:K}=this.compiled[Y];if(W.condition){if(!V)V={type:Z,...$};if(!W.condition(V))continue}if(K.test(q)){if(q=q.replace(K,W.replacement),!W.global)break}}if(this.cache.size>=cZ){let Y=Math.ceil(cZ*0.1),W=0;for(let K of this.cache.keys()){if(W++>=Y)break;this.cache.delete(K)}}return this.cache.set(Q,q),q}mapAll(Z,$={}){return Z.map((J)=>this.map(J,{...$,type:J}))}addRule(Z){this.rules.push(Z),this.rules.sort(($,J)=>(J.priority||0)-($.priority||0)),this.recompile(),this.cache.clear()}removeRules(Z){let $=this.rules.length;return this.rules=this.rules.filter((J)=>{let Q=typeof J.pattern==="string"?J.pattern:J.pattern.source;return typeof Z==="string"?Q!==Z:!Z.test(Q)}),this.recompile(),this.cache.clear(),$-this.rules.length}clearCache(){this.cache.clear()}getRules(){return this.rules}}function oZ(Z={rules:[]}){return new lZ(Z)}var s4=oZ({rules:[]}),a4=oZ({rules:[],presets:["strict"]});function i4(Z,$,J={}){return Z.replace(/:\s*([^;,)\]}]+)/g,(Q,X)=>{return`: ${$.map(X.trim(),J)}`})}var n4={makeReadonly:(Z)=>{if(Z.endsWith("[]"))return`readonly ${Z}`;if(Z.startsWith("Array<"))return Z.replace("Array<","ReadonlyArray<");return Z},makeNullable:(Z)=>{if(Z.includes("| null")||Z.includes("| undefined"))return Z;return`${Z} | null`},makeOptional:(Z)=>{if(Z.includes("| undefined"))return Z;return`${Z} | undefined`},makeRequired:(Z)=>{return Z.replace(/\s*\|\s*null/g,"").replace(/\s*\|\s*undefined/g,"").trim()},promisify:(Z)=>{if(Z.startsWith("Promise<"))return Z;return`Promise<${Z}>`},unpromisify:(Z)=>{let $=Z.match(/^Promise<(.+)>$/);return $?$[1]:Z},arrayify:(Z)=>{if(Z.endsWith("[]")||Z.startsWith("Array<"))return Z;return`${Z}[]`},unarrayify:(Z)=>{if(Z.endsWith("[]"))return Z.slice(0,-2);let $=Z.match(/^(?:Readonly)?Array<(.+)>$/);return $?$[1]:Z}};import{watch as f1}from"fs";import{readdir as u1,stat as m1}from"fs/promises";import{join as sZ,relative as e}from"path";function p1(Z,$){let{root:J,include:Q=["**/*.ts","**/*.tsx"],exclude:X=["**/node_modules/**","**/*.d.ts","**/dist/**"],debounce:q=100,initialBuild:V=!0,clearScreen:Y=!1,onChange:W,onBuildStart:K,onBuildComplete:H,onError:A}=Z,_=[],O=new Set,G=!1,U=new Map,z=null,B=!1;function j(L){let E=e(J,L);for(let w of X)if(N(E,w))return!1;for(let w of Q)if(N(E,w))return!0;return!1}function N(L,E){let w=E.replace(/\./g,"\\.").replace(/\*\*/g,"{{DOUBLESTAR}}").replace(/\*/g,"[^/]*").replace(/\{\{DOUBLESTAR\}\}/g,".*").replace(/\?/g,".");return new RegExp(`^${w}$`).test(L.replace(/\\/g,"/"))}async function R(){if(B||U.size===0)return;B=!0;let L=Array.from(U.values());U.clear();try{for(let D of L)await W?.(D);if(Y)console.clear();await K?.();let E=L.filter((D)=>D.type!=="unlink").map((D)=>D.path),w=await $(E.length>0?E:void 0);await H?.(w)}catch(E){await A?.(E)}finally{if(B=!1,U.size>0)k()}}function k(){if(z)clearTimeout(z);z=setTimeout(()=>{z=null,R()},q)}function F(L,E,w){if(!E||!G)return;let D=sZ(w,E);if(!j(D))return;let v={type:L==="rename"?"add":"change",path:D,relativePath:e(J,D)};m1(D).then(()=>{O.add(D)}).catch(()=>{v.type="unlink",O.delete(D)}).finally(()=>{U.set(D,v),k()})}async function M(L){let E=[L];try{let w=await u1(L,{withFileTypes:!0});for(let D of w)if(D.isDirectory()){let v=sZ(L,D.name),ZZ=e(J,v),$Z=!1;for(let y of X)if(N(ZZ,y)||N(`${ZZ}/`,y)){$Z=!0;break}if(!$Z){let y=await M(v);E.push(...y)}}}catch{}return E}async function aZ(){if(G)return;G=!0;let L=await M(J);for(let E of L)try{let w=f1(E,{persistent:!0},(D,v)=>{F(D,v,E)});w.on("error",(D)=>{A?.(D)}),_.push(w)}catch(w){await A?.(w)}if(V){await K?.();let E=await $();await H?.(E)}}function iZ(){if(G=!1,z)clearTimeout(z),z=null;for(let L of _)L.close();_.length=0,O.clear(),U.clear()}async function nZ(){await K?.();let L=await $();return await H?.(L),L}return{start:aZ,stop:iZ,rebuild:nZ,isWatching:()=>G,getWatchedFiles:()=>Array.from(O)}}async function $6(Z,$){let J=async(X)=>{let q=Date.now();try{let V=await $(Z);return{success:V.errors.length===0,duration:Date.now()-q,filesProcessed:V.filesProcessed,errors:V.errors}}catch(V){return{success:!1,duration:Date.now()-q,filesProcessed:0,errors:[V.message]}}},Q=p1({root:Z.root||Z.cwd||process.cwd(),include:Z.include,exclude:Z.exclude,debounce:Z.debounce,initialBuild:Z.initialBuild,clearScreen:Z.clearScreen,onChange:Z.onChange,onBuildStart:Z.onBuildStart,onBuildComplete:Z.onBuildComplete,onError:Z.onError},J);return await Q.start(),Q}function d1(Z){let $=Z.success?"\u2713":"\u2717",J=`${Z.duration}ms`;if(Z.success)return`${$} Built ${Z.filesProcessed} file(s) in ${J}`;else return`${$} Build failed in ${J}
55
+ ${Z.errors.map((Q)=>` - ${Q}`).join(`
56
+ `)}`}function J6(){return{onChange:(Z)=>{let $=Z.type==="add"?"+":Z.type==="unlink"?"-":"~";console.log(`[${$}] ${Z.relativePath}`)},onBuildStart:()=>{console.log(`
57
+ Rebuilding...`)},onBuildComplete:(Z)=>{console.log(d1(Z))},onError:(Z)=>{console.error(`Error: ${Z.message}`)}}}export{k$ as writeToFile,O9 as writeTextFile,N4 as writeSourceMap,W9 as write,a9 as wrapError,s as withTimeout,$6 as watchAndGenerate,m$ as watch,mZ as walkDeclarations,W1 as validateSymlink,Q1 as validatePaths,u as validatePath,i8 as validateGeneratedDeclarations,V1 as validateFileSize,o as validateFilePath,PZ as validateFileBatch,b$ as validateDtsContent,d8 as validateDeclarations,Q3 as unwrap,a8 as typeCheckWithConfig,p8 as typeCheck,k1 as treeShakeContent,n as treeShake,fZ as trackDeclarations,$$ as toZod,X$ as toYup,J$ as toValibot,Z$ as toJsonSchema,Q$ as toIoTs,q$ as toArkType,e9 as summarizeErrors,W0 as summarizeDiffs,m4 as stripPrivatePlugin,_$ as stripInternalPlugin,P1 as strictTypeMappings,a4 as strictTypeMapper,s$ as startLSPServer,K9 as spawnProcess,X2 as sortProjectsByDependencies,O0 as sortImportsInContent,VZ as sortImports,y1 as simplifiedTypeMappings,o6 as shouldUseAsyncParsing,Y8 as shouldIncludeNonExportedInterface,V8 as shouldIncludeNonExportedFunction,R9 as setTimestamps,N9 as setLogPrefix,B9 as setLogLevel,A9 as scopedLogger,H4 as sanitizeFilename,Y9 as runtime,W2 as resolveWorkspacePatterns,g8 as resolveEntryFiles,L9 as resetConfig,y4 as requiredTransformer,zZ as removeTrailingWhitespace,MZ as removeLeadingComments,x1 as readonlyTypeMappings,I1 as readonlyTransformer,u4 as readonlyPlugin,H9 as readTextFile,N1 as readSourceMap,U$ as quickFormat,R3 as pruneCache,Q4 as profileExecution,j$ as processVariableDeclaration,R$ as processTypeDeclaration,h$ as processSource,w$ as processModuleDeclaration,N$ as processInterfaceDeclaration,d3 as processInParallel,jZ as processImports,E$ as processImportDeclaration,B$ as processFunctionDeclaration,u$ as processFile,L$ as processExportDeclaration,D$ as processEnumDeclaration,DZ as processDeclarations,F$ as processClassDeclaration,H3 as printDiffs,K0 as printDiff,G3 as presets,x3 as preserveCommentFormatting,G$ as pluginManager,t3 as parseVariableDeclaration,S9 as parseJSDoc,I$ as parseImportStatement,qZ as parseImport,i3 as parseFunctionDeclaration,r6 as parseArrayElements,Z2 as parallelProcess,NZ as orderDeclarations,h4 as optionalTransformer,n$ as optimizeFile,i$ as optimizeDeclarations,F9 as nullLogger,h3 as normalizerPresets,P0 as normalizeOutput,_Z as normalizeLineEndings,x0 as normalizeIndent,AZ as normalizeBlankLines,r$ as minifyDts,C3 as mergeDeclarationsInContent,v3 as mergeDeclarations,E1 as mapDeclarations,z9 as logger,m8 as loadCompilerOptions,r3 as isTypeOnlyExport,Y1 as isSymlink,U4 as isSafePath,l9 as isParseError,V9 as isNode,Z8 as isGenericType,o9 as isFileError,n3 as isExportStatement,c9 as isDtsxError,s9 as isConfigError,q9 as isBun,W8 as isBuiltInType,J3 as isBranded,bZ as isBlockedPath,t6 as inferObjectType,i6 as inferNarrowTypeInUnion,a6 as inferNarrowType,e6 as inferFunctionType,n6 as inferArrayType,X8 as hasExportModifier,q8 as hasAsyncModifier,l8 as getTypeAtPosition,c3 as getTopologicalOrder,d6 as getSourceFileCacheSize,c6 as getSourceFileAsync,G9 as getRuntimeInfo,o8 as getQuickInfo,l0 as getProcessingLevels,h1 as getPresetMappings,s6 as getPendingParseCount,Q8 as getParameterName,s0 as getNodeText,j9 as getLogLevel,i9 as getLocationFromOffset,G8 as getInterfaceBody,Z9 as getGraphSummary,Y$ as getFormatExtension,E9 as getConfig,v$ as getAllTypeScriptFiles,q2 as generateWorkspace,b9 as generateTypeDocJSON,V2 as generateMonorepo,k9 as generateMarkdown,C9 as generateJSON,v9 as generateHTML,K2 as generateFromPackageWorkspaces,P9 as generateDocs,x$ as generateDeclarationMap,f$ as generate,d1 as formatWatchResult,Y3 as formatUnifiedDiff,s8 as formatTypeCheckResults,S3 as formatMemoryStats,F3 as formatIncrementalResult,K$ as formatFiles,n9 as formatErrorWithContext,t9 as formatDtsError,W$ as formatDts,W3 as formatDiffSummary,i0 as formatComments,V0 as formatColoredDiff,e8 as formatCircularAnalysis,v1 as findUnusedDeclarations,T8 as findReferencedTypes,o0 as findMatchingBracket,c0 as findIndependentFiles,I4 as findDeclarations,$9 as findAllDependents,J9 as findAllDependencies,T4 as filterByPredicate,b as filterByKind,U9 as fileExists,QZ as file,E8 as extractVariableStatement,K8 as extractTypesFromModuleText,t as extractTypeReferences,w8 as extractTypeAliasDeclaration,J8 as extractTripleSlashDirectives,a3 as extractTrailingComment,R4 as extractSourceMap,$8 as extractSatisfiesType,k8 as extractReferencedTypeDeclarations,S8 as extractModuleDeclaration,a0 as extractLeadingCommentsFromNode,s3 as extractLeadingComments,a0 as extractJSDocComments,L8 as extractInterfaceDeclaration,N8 as extractImportDeclaration,D8 as extractFunctionDeclaration,R8 as extractExportDeclaration,F8 as extractExportAssignment,I8 as extractEnumDeclaration,T9 as extractDocumentation,D3 as extractDependencies,C8 as extractDeclarationsAsync,FZ as extractDeclarations,M8 as extractClassDeclaration,wZ as extractBalancedSymbols,S$ as extractAllImportedItems,X9 as exportGraphAsJson,Q9 as exportGraphAsDot,I3 as estimateMemoryUsage,BZ as ensureTrailingNewline,u8 as ensureGitignore,Q2 as discoverWorkspaceProjects,Y2 as discoverWorkspaceFromPackageJson,K3 as diffFiles,Y0 as diffFile,P3 as detectLineEnding,d as detectGroup,r8 as detectCircularDependencies,uZ as definePlugin,M9 as defineConfigAsync,w9 as defineConfig,b1 as defaultTypeMappings,s4 as defaultTypeMapper,D9 as defaultConfig,p4 as declarePlugin,f4 as createWrapTypeTransformer,e$ as createWorkerPool,p1 as createWatcher,J6 as createWatchLogger,b4 as createTypeTransformer,oZ as createTypeMapper,l4 as createTreeShaker,m as createTransformerPlugin,gZ as createTracker,q4 as createTimer,v4 as createSuffixTransformer,g4 as createStripTagsTransformer,T3 as createStreamingProcessor,A4 as createSourceMap,O4 as createSecurityMiddleware,K1 as createSecureProcessor,K4 as createSecureBatchProcessor,P4 as createReturnTypeTransformer,k4 as createRenameTransformer,w1 as createRemoveTransformer,t0 as createProfiler,X4 as createProfiledIo,L1 as createPrefixTransformer,x4 as createParameterTransformer,y3 as createOutputNormalizer,d4 as createNamespacePrefixPlugin,M1 as createModifierTransformer,M3 as createMemoryOptimizedConfig,_9 as createLogger,C4 as createJSDocTransformer,N3 as createIncrementalBuilder,O3 as createImportSorter,H$ as createFormatter,A$ as createFilterPlugin,a$ as createFileWatcher,r9 as createDtsError,x9 as createDocsGenerator,P$ as createDiff,F1 as createDeclaration,h8 as createBundler,z$ as createBannerPlugin,V$ as convertToFormat,I9 as config,p as computeDiff,S4 as composeTransformers,D1 as cloneDeclaration,v8 as clearSourceFileCache,g$ as clearResultCache,M$ as clearProcessorCaches,C$ as checkIsolatedDeclarationsConfig,c8 as checkIsolatedDeclarations,J2 as calculateOptimalBatchSize,x8 as bundleDtsFiles,P8 as bundleDeclarations,y8 as bundleAndWrite,U8 as buildVariableDeclaration,_8 as buildTypeDeclaration,u0 as buildProcessingGraph,B8 as buildModuleDeclaration,j8 as buildModuleBody,O8 as buildInterfaceDeclaration,H8 as buildFunctionSignature,n8 as buildDependencyGraph,F4 as buildDeclarationMappings,r as buildDeclarationDependencyGraph,z8 as buildClassDeclaration,A8 as buildClassBody,l6 as batchParseSourceFiles,$2 as batchFiles,b8 as batchExtractDeclarations,T$ as assertNever,r1 as asTypeName,a1 as asSourceCode,Z3 as asRelativePath,n1 as asModuleSpecifier,$3 as asJsonString,s1 as asGlobPattern,l1 as asFilePath,i1 as asDtsContent,o1 as asDirectoryPath,t1 as asDeclarationName,e1 as asAbsolutePath,i4 as applyTypeMappings,B4 as appendSourceMapComment,j4 as appendInlineSourceMap,L4 as analyzeTypes,l3 as analyzeParallelizationPotential,E4 as analyzeImports,C1 as analyzeDependencies,t8 as analyzeCircularDependencies,y$ as addSourceMapComment,t$ as WorkerPool,n4 as TypeTransformers,lZ as TypeMapper,hZ as Tracker,TZ as Timer,d$ as SymbolKind,w0 as StringInterner,HZ as StreamingProcessor,yZ as SourceMapGenerator,a as SourceMapConsumer,I as SecurityError,SZ as Profiler,u9 as ProcessingError,O$ as PluginManager,g9 as ParseError,M0 as ObjectPool,p$ as LspDiagnosticSeverity,L0 as LazyLoader,j0 as IncrementalCache,m9 as FileError,f9 as ExtractionError,y9 as ErrorCodes,o$ as DtsxLanguageServer,h9 as DtsxError,l$ as DocumentHighlightKind,E0 as DeclarationPool,T as DEFAULT_SECURITY_CONFIG,b0 as DEFAULT_IMPORT_GROUP_ORDER,XZ as DEFAULT_GROUP_ORDER,GZ as DEFAULT_DECLARATION_ORDER,p9 as ConfigError,c$ as CompletionItemKind,d9 as CircularDependencyError,f8 as BuildCache,X3 as BrandedPath};