@visulima/vis 1.0.0-alpha.28 → 1.0.0-alpha.29

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 (125) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE.md +24 -24
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/packem_chunks/bin.js +297 -297
  6. package/dist/packem_chunks/bloom-status.js +1 -1
  7. package/dist/packem_chunks/bloom-sync.js +1 -1
  8. package/dist/packem_chunks/config.js +12 -12
  9. package/dist/packem_chunks/doctor-probe.js +1 -1
  10. package/dist/packem_chunks/fix.js +1 -1
  11. package/dist/packem_chunks/handler.js +1 -1
  12. package/dist/packem_chunks/handler10.js +1 -2
  13. package/dist/packem_chunks/handler11.js +5 -1
  14. package/dist/packem_chunks/handler12.js +1 -5
  15. package/dist/packem_chunks/handler13.js +27 -1
  16. package/dist/packem_chunks/handler14.js +5 -27
  17. package/dist/packem_chunks/handler15.js +1 -5
  18. package/dist/packem_chunks/handler16.js +1 -1
  19. package/dist/packem_chunks/handler17.js +1 -1
  20. package/dist/packem_chunks/handler18.js +1 -1
  21. package/dist/packem_chunks/handler19.js +1 -1
  22. package/dist/packem_chunks/handler2.js +1 -1
  23. package/dist/packem_chunks/handler20.js +5 -1
  24. package/dist/packem_chunks/handler21.js +2 -5
  25. package/dist/packem_chunks/handler22.js +2 -2
  26. package/dist/packem_chunks/handler23.js +1 -2
  27. package/dist/packem_chunks/handler24.js +1 -1
  28. package/dist/packem_chunks/handler25.js +5 -1
  29. package/dist/packem_chunks/handler26.js +1 -5
  30. package/dist/packem_chunks/handler27.js +3 -1
  31. package/dist/packem_chunks/handler28.js +1 -3
  32. package/dist/packem_chunks/handler29.js +7 -1
  33. package/dist/packem_chunks/handler3.js +4 -4
  34. package/dist/packem_chunks/handler30.js +32 -6
  35. package/dist/packem_chunks/handler31.js +3 -33
  36. package/dist/packem_chunks/handler32.js +8 -3
  37. package/dist/packem_chunks/handler33.js +1 -1
  38. package/dist/packem_chunks/handler34.js +2 -2
  39. package/dist/packem_chunks/handler35.js +11 -3
  40. package/dist/packem_chunks/handler36.js +3 -22
  41. package/dist/packem_chunks/handler37.js +21 -60
  42. package/dist/packem_chunks/handler38.js +61 -3
  43. package/dist/packem_chunks/handler39.js +3 -6
  44. package/dist/packem_chunks/handler4.js +1 -1
  45. package/dist/packem_chunks/handler40.js +6 -24
  46. package/dist/packem_chunks/handler41.js +24 -153
  47. package/dist/packem_chunks/handler42.js +153 -25
  48. package/dist/packem_chunks/handler43.js +25 -10
  49. package/dist/packem_chunks/handler44.js +10 -708
  50. package/dist/packem_chunks/handler45.js +708 -24
  51. package/dist/packem_chunks/handler46.js +24 -322
  52. package/dist/packem_chunks/handler47.js +322 -48
  53. package/dist/packem_chunks/handler48.js +48 -3
  54. package/dist/packem_chunks/handler49.js +3 -27
  55. package/dist/packem_chunks/handler5.js +7 -7
  56. package/dist/packem_chunks/handler50.js +21 -189
  57. package/dist/packem_chunks/handler51.js +194 -33
  58. package/dist/packem_chunks/handler52.js +34 -0
  59. package/dist/packem_chunks/handler6.js +1 -1
  60. package/dist/packem_chunks/handler7.js +1 -1
  61. package/dist/packem_chunks/handler8.js +1 -1
  62. package/dist/packem_chunks/handler9.js +1 -1
  63. package/dist/packem_chunks/heal-accept.js +1 -1
  64. package/dist/packem_chunks/heal.js +1 -1
  65. package/dist/packem_chunks/help-command.js +4 -4
  66. package/dist/packem_chunks/index.js +2 -2
  67. package/dist/packem_chunks/keys-refresh.js +1 -1
  68. package/dist/packem_chunks/list.js +1 -1
  69. package/dist/packem_chunks/loader.js +1 -1
  70. package/dist/packem_chunks/loader2.js +1 -1
  71. package/dist/packem_chunks/prune.js +1 -1
  72. package/dist/packem_chunks/run.js +1 -1
  73. package/dist/packem_chunks/status.js +1 -1
  74. package/dist/packem_chunks/sync.js +1 -1
  75. package/dist/packem_chunks/sync2.js +1 -1
  76. package/dist/packem_chunks/tripwire.js +2 -2
  77. package/dist/packem_chunks/verify-lockfile.js +1 -1
  78. package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +12 -0
  79. package/dist/packem_shared/{advisories-BxXiKFbL.js → advisories-DpgSuWDH.js} +1 -1
  80. package/dist/packem_shared/{affected-shas-Dm7eqcI8.js → affected-shas-BkXXecyi.js} +1 -1
  81. package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
  82. package/dist/packem_shared/{ai-fix-BGbnrWCz.js → ai-fix-CfFWatGY.js} +7 -7
  83. package/dist/packem_shared/{applyDefaults-KxZkvlp3.js → applyDefaults-DLvOqXGX.js} +1 -1
  84. package/dist/packem_shared/{build-scripts-3E2pmscY.js → build-scripts-D-ysm_bS.js} +1 -1
  85. package/dist/packem_shared/{cyclonedx-C2k2HmvI.js → cyclonedx-B04lIvwu.js} +3 -3
  86. package/dist/packem_shared/{dependency-scan-Bki15Yi-.js → dependency-scan-B9wTcLxf.js} +1 -1
  87. package/dist/packem_shared/{docker-k-Sl8b-w.js → docker-DxA80dRx.js} +1 -1
  88. package/dist/packem_shared/{failure-log-C3bG1bCA.js → failure-log-n3j_-w8s.js} +1 -1
  89. package/dist/packem_shared/index-BDF8gawl.js +29 -0
  90. package/dist/packem_shared/{index-DBq4TVu5.js → index-BfG9_znI.js} +1 -1
  91. package/dist/packem_shared/{lifecycle-B91p_ra8.js → lifecycle-NHIKDiCh.js} +1 -1
  92. package/dist/packem_shared/lockfile-CoeFxWAv.js +1 -0
  93. package/dist/packem_shared/lockfile-DAuTDwow.js +1 -0
  94. package/dist/packem_shared/{manifests-Z3spBpxv.js → manifests-B7wUR3Rk.js} +1 -1
  95. package/dist/packem_shared/{min-release-age-B1Jm1_JY.js → min-release-age-YyNI7gqV.js} +1 -1
  96. package/dist/packem_shared/{native-config-sync-Cnpj2xcn.js → native-config-sync-CgRIIRZV.js} +7 -7
  97. package/dist/packem_shared/{osv-bloom-ep8GlDGT.js → osv-bloom-BQSIHt5h.js} +2 -2
  98. package/dist/packem_shared/{pm-runner-COoPLGKi.js → pm-runner-Ta_yz2uP.js} +1 -1
  99. package/dist/packem_shared/{provenance-DbkJRDqt.js → provenance-DoEp2uOo.js} +1 -1
  100. package/dist/packem_shared/{readFileSync-CGmzMUF2-D6rUjGDn.js → readFileSync-4c_c6Qey-6SWMDNdw.js} +1 -1
  101. package/dist/packem_shared/{registry-keys-SylX07bs.js → registry-keys-CD1xHavV.js} +1 -1
  102. package/dist/packem_shared/{resolve-explicit-CJ_5wYSu.js → resolve-explicit-DpSc7RN2.js} +1 -1
  103. package/dist/packem_shared/{runtime-check-DgXsKCsv.js → runtime-check-Cbtb_Utb.js} +1 -1
  104. package/dist/packem_shared/{s1ngularity-DlS-4a6K.js → s1ngularity-CIX7UcT5.js} +1 -1
  105. package/dist/packem_shared/scan-progress-CTVVf9WW.js +2 -0
  106. package/dist/packem_shared/{selectors-BE2BCnTR.js → selectors-BU8aTRQm.js} +1 -1
  107. package/dist/packem_shared/{signatures-B-1u4t-c.js → signatures-BHM7cnqB.js} +1 -1
  108. package/dist/packem_shared/{spinner-B9ZPv1iT.js → spinner-C8xs6QZv.js} +1 -1
  109. package/dist/packem_shared/{tabs-C-qFIoUv.js → tabs-xZkm6Y_J.js} +1 -1
  110. package/dist/packem_shared/{toolchain-Jx2lkAYy.js → toolchain-juKl-WgV.js} +1 -1
  111. package/dist/packem_shared/typosquats-DRKU6d2S.js +1 -0
  112. package/dist/packem_shared/{use-measured-height-kIDCuc76.js → use-measured-height-Lea6TCVD.js} +1 -1
  113. package/dist/packem_shared/{verify-C8EAHql6.js → verify-DA80ja1b.js} +1 -1
  114. package/dist/packem_shared/{vis-update-app-COYmjGKv.js → vis-update-app-BCKzlqj8.js} +1 -1
  115. package/dist/packem_shared/{watch-BSVsZ_1I.js → watch-DdR-pFzX.js} +1 -1
  116. package/dist/packem_shared/{watch-loop-CP318TfG.js → watch-loop-C8csFvRU.js} +1 -1
  117. package/index.d.ts +201 -201
  118. package/index.js +567 -751
  119. package/package.json +13 -13
  120. package/dist/packem_shared/Table-CwC2kW07-EjFLNV0q.js +0 -12
  121. package/dist/packem_shared/ai-analysis-BnmDFqc8.js +0 -68
  122. package/dist/packem_shared/index-2r730kXY.js +0 -29
  123. package/dist/packem_shared/lockfile-DmDfgKaT.js +0 -1
  124. package/dist/packem_shared/scan-progress-CU4ttEHQ.js +0 -2
  125. package/dist/packem_shared/typosquats-BxCOUvTJ.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/vis",
3
- "version": "1.0.0-alpha.28",
3
+ "version": "1.0.0-alpha.29",
4
4
  "description": "A monorepo dev toolkit — task runner, remote caching, security scanning, git hooks, and AI agent integrations — powered by @visulima/task-runner",
5
5
  "keywords": [
6
6
  "build",
@@ -78,10 +78,10 @@
78
78
  "LICENSE.md"
79
79
  ],
80
80
  "dependencies": {
81
- "@visulima/secret-scanner": "1.0.0-alpha.4",
82
- "@visulima/tabular": "4.0.0-alpha.12",
83
- "@visulima/task-runner": "1.0.0-alpha.18",
84
- "@visulima/tui": "1.0.0-alpha.21",
81
+ "@visulima/secret-scanner": "1.0.0-alpha.5",
82
+ "@visulima/tabular": "4.0.0-alpha.13",
83
+ "@visulima/task-runner": "1.0.0-alpha.19",
84
+ "@visulima/tui": "1.0.0-alpha.22",
85
85
  "jiti": "^2.7.0",
86
86
  "module-replacements": "^2.11.0",
87
87
  "module-replacements-codemods": "^1.2.1",
@@ -110,14 +110,14 @@
110
110
  }
111
111
  },
112
112
  "optionalDependencies": {
113
- "@visulima/vis-binding-darwin-arm64": "1.0.0-alpha.28",
114
- "@visulima/vis-binding-linux-arm64-gnu": "1.0.0-alpha.28",
115
- "@visulima/vis-binding-darwin-x64": "1.0.0-alpha.28",
116
- "@visulima/vis-binding-linux-x64-gnu": "1.0.0-alpha.28",
117
- "@visulima/vis-binding-linux-arm64-musl": "1.0.0-alpha.28",
118
- "@visulima/vis-binding-win32-arm64-msvc": "1.0.0-alpha.28",
119
- "@visulima/vis-binding-linux-x64-musl": "1.0.0-alpha.28",
120
- "@visulima/vis-binding-win32-x64-msvc": "1.0.0-alpha.28"
113
+ "@visulima/vis-binding-darwin-arm64": "1.0.0-alpha.29",
114
+ "@visulima/vis-binding-darwin-x64": "1.0.0-alpha.29",
115
+ "@visulima/vis-binding-linux-arm64-gnu": "1.0.0-alpha.29",
116
+ "@visulima/vis-binding-linux-x64-musl": "1.0.0-alpha.29",
117
+ "@visulima/vis-binding-linux-x64-gnu": "1.0.0-alpha.29",
118
+ "@visulima/vis-binding-linux-arm64-musl": "1.0.0-alpha.29",
119
+ "@visulima/vis-binding-win32-arm64-msvc": "1.0.0-alpha.29",
120
+ "@visulima/vis-binding-win32-x64-msvc": "1.0.0-alpha.29"
121
121
  },
122
122
  "engines": {
123
123
  "node": "^22.14.0 || >=24.10.0"
@@ -1,12 +0,0 @@
1
- var hi=Object.defineProperty;var E=(t,e)=>hi(t,"name",{value:e,configurable:!0});import{createRequire as ci}from"node:module";const li=ci(import.meta.url),ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,di=E(t=>{if(typeof ft<"u"&&ft.versions&&ft.versions.node){const[e,i]=ft.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return ft.getBuiltinModule(t)}return li(t)},"__cjs_getBuiltinModule"),{createRequire:ui}=di("node:module"),vt=0,H=1,mt=2,G=3;var fi=Object.defineProperty,mi=E((t,e)=>fi(t,"name",{value:e,configurable:!0}),"p$2"),gi=Object.defineProperty,pi=mi((t,e)=>gi(t,"name",{value:e,configurable:!0}),"C"),bi=Object.defineProperty,$t=pi((t,e)=>bi(t,"name",{value:e,configurable:!0}),"u");const wi=/^-{1,2}(no-color|no-colors|color=false|color=never)$/,yi=/^-{1,2}(color=256)$/,vi=/^-{1,2}(color=16m|color=full|color=truecolor)$/,xi=/^-{1,2}(color|colors|color=true|color=always)$/,Bi=/-mono|dumb/i,Ri=/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/,Wi=/-256(color)?$/i,Si=/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i,Te=$t(t=>{const e=globalThis,i=e.Deno!=null,r=e.process??e.Deno??{},h=r.argv??r.args??[],s=$t(g=>{const p=h.indexOf("--"),u=h.findIndex(x=>g.test(x));return u!==-1&&(p===-1||u<p)},"oneOfFlags");let o={};try{o=i?r.env.toObject():r.env??{}}catch{}const a="FORCE_COLOR",n=a in o,l=o[a]??void 0,d=Object.prototype.toString.call(l).slice(8,-1)==="String",c=typeof l=="number";let m;if(l==="true"?m=H:l==="false"?m=vt:d&&l.length===0?m=H:d&&l.length>0?m=Math.min(Number.parseInt(l,10),3):c&&(m=Math.min(l,3)),l!=="true"&&l!=="false"&&m!==void 0&&m<4)return m;if("NO_COLOR"in o||n&&m===0||s(wi))return vt;if(s(yi))return mt;if(s(vi))return G;if(s(xi))return H;const b=m??vt;if("TF_BUILD"in o&&"AGENT_NAME"in o)return H;if(o.TERM&&Bi.test(o.TERM))return b;if((i?e.Deno.build.os:r.platform)==="win32")try{const g=(i?e.Deno.osRelease():r.os.release()).split(".");return Number(g[0])>=10&&Number(g[2])>=10586?Number(g[2])>=14931?G:mt:H}catch{}if("CI"in o)return["GITEA_ACTIONS","CIRCLECI","GITHUB_WORKFLOW","GITHUB_ACTIONS"].some(g=>g in o)?G:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(g=>g in o)||o.CI_NAME==="codeship"?H:b;if(o.TERMINAL_EMULATOR?.includes("JediTerm"))return G;if("TEAMCITY_VERSION"in o)return Ri.test(o.TEAMCITY_VERSION)?H:vt;if(o.COLORTERM==="truecolor"||o.TERM==="xterm-kitty"||o.TERM==="xterm-ghostty"||o.TERM==="wezterm")return G;if("TERM_PROGRAM"in o){const g=Number.parseInt((o.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(o.TERM_PROGRAM==="iTerm.app")return g>=3?G:mt;if(o.TERM_PROGRAM==="Apple_Terminal")return mt}if(Wi.test(o.TERM))return mt;let f;return i?f=t==="out"?e.Deno.stdout.isTerminal():e.Deno.stderr.isTerminal():"PM2_HOME"in o&&"pm_id"in o?f=!0:f=r[`std${t}`]&&"isTTY"in r[`std${t}`],f&&Si.test(o.TERM)||"COLORTERM"in o?H:b},"isColorSupportedFactory"),ji=$t(()=>Te("out"),"isStdoutColorSupported");$t(()=>Te("err"),"isStderrColorSupported");var Oi=Object.defineProperty,ke=E((t,e)=>Oi(t,"name",{value:e,configurable:!0}),"B$2"),Ai=Object.defineProperty,q=ke((t,e)=>Ai(t,"name",{value:e,configurable:!0}),"u"),Ci=Object.defineProperty,Ii=q((t,e)=>Ci(t,"name",{value:e,configurable:!0}),"e$1");function Pt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}E(Pt,"x");ke(Pt,"N");q(Pt,"t$1");Ii(Pt,"ansiRegex");var Mi=Object.defineProperty,$i=q((t,e)=>Mi(t,"name",{value:e,configurable:!0}),"n$1");const V=$i((t,e,i)=>e>t?e:Math.min(t,i),"clamp");var Ei=Object.defineProperty,Ti=q((t,e)=>Ei(t,"name",{value:e,configurable:!0}),"a$1");const ki=/([a-f\d]{3,6})/i,Ni=Ti(t=>{let[,e]=ki.exec(t)??[];const i=e?e.length:0;if(i===3){const h=e.charAt(0),s=e.charAt(1),o=e.charAt(2);e=h+h+s+s+o+o}else if(i!==6)return[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},"convertHexToRgb");var Pi=Object.defineProperty,ne=q((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"e");const Ne=ne((t,e,i)=>t===e&&e===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(i/51),"rgbToAnsi256"),Kt=ne(t=>{let e,i,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=i=r=((t-232)*10+8)/255;else{t-=16;const o=t%36;e=Math.floor(t/36)/5,i=Math.floor(o/6)/5,r=o%6/5}const h=Math.max(e,i,r)*2;if(h===0)return 30;const s=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(e));return h===2?s+60:s},"ansi256To16"),ue=ne((t,e,i)=>Kt(Ne(t,e,i)),"rgbToAnsi16");var Li=Object.defineProperty,T=q((t,e)=>Li(t,"name",{value:e,configurable:!0}),"b");const C=39,I=49,fe=10,Zt=ji(),Pe={close:"",open:""},y=Zt>0?(t,e)=>({close:`\x1B[${String(e)}m`,open:`\x1B[${String(t)}m`}):()=>Pe,me=T(t=>(e,i,r)=>t(Ne(Number(e),Number(i),Number(r))),"createRgbFunction"),ge=T(t=>e=>{const[i,r,h]=Ni(e);return t(i,r,h)},"createHexFunction");let Xt=T(t=>y(`38;5;${String(t)}`,C),"createAnsi256"),Qt=T(t=>y(`48;5;${String(t)}`,I),"createBgAnsi256"),Et=T((t,e,i)=>y(`38;2;${String(t)};${String(e)};${String(i)}`,C),"createRgb"),Tt=T((t,e,i)=>y(`48;2;${String(t)};${String(e)};${String(i)}`,I),"createBgRgb");Zt===1?(Xt=T(t=>y(Kt(Number(t)),C),"createAnsi256"),Qt=T(t=>y(Kt(Number(t))+fe,I),"createBgAnsi256"),Et=T((t,e,i)=>y(ue(Number(t),Number(e),Number(i)),C),"createRgb"),Tt=T((t,e,i)=>y(ue(Number(t),Number(e),Number(i))+fe,I),"createBgRgb")):Zt===2&&(Et=me(Xt),Tt=me(Qt));const pe={bold:y(1,22),dim:y(2,22),hidden:y(8,28),inverse:y(7,27),italic:y(3,23),overline:y(53,55),reset:y(0,0),strike:y(9,29),strikethrough:y(9,29),underline:y(4,24),visible:Pe},be={bgBlack:y(40,I),bgBlackBright:y(100,I),bgBlue:y(44,I),bgBlueBright:y(104,I),bgCyan:y(46,I),bgCyanBright:y(106,I),bgGray:y(100,I),bgGreen:y(42,I),bgGreenBright:y(102,I),bgGrey:y(100,I),bgMagenta:y(45,I),bgMagentaBright:y(105,I),bgRed:y(41,I),bgRedBright:y(101,I),bgWhite:y(47,I),bgWhiteBright:y(107,I),bgYellow:y(43,I),bgYellowBright:y(103,I),black:y(30,C),blackBright:y(90,C),blue:y(34,C),blueBright:y(94,C),cyan:y(36,C),cyanBright:y(96,C),gray:y(90,C),green:y(32,C),greenBright:y(92,C),grey:y(90,C),magenta:y(35,C),magentaBright:y(95,C),red:y(31,C),redBright:y(91,C),white:y(37,C),whiteBright:y(97,C),yellow:y(33,C),yellowBright:y(93,C)},we={bg:T(t=>Qt(V(t,0,255)),"bg"),bgHex:ge(Tt),bgRgb:T((t,e,i)=>Tt(V(t,0,255),V(e,0,255),V(i,0,255)),"bgRgb"),fg:T(t=>Xt(V(t,0,255)),"fg"),hex:ge(Et),rgb:T((t,e,i)=>Et(V(t,0,255),V(e,0,255),V(i,0,255)),"rgb")};var Fi=Object.defineProperty,_i=q((t,e)=>Fi(t,"name",{value:e,configurable:!0}),"s");const Ji=_i((t,e,i)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const h=e.length;let s=0,o="";for(;~r;)o+=t.slice(s,r)+i,s=r+h,r=t.indexOf(e,s);return o+t.slice(s)},"stringReplaceAll");var Hi=Object.defineProperty,bt=q((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"a");const z={};let te=null;const Gi=bt((t,e,i)=>{if(!t)return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let h=i;h;h=h.props)r=Ji(r,h.close,h.open);return r.includes(`
2
- `)&&(r=r.replace(/(\r*\n)/g,`${i.closeStack}$1${i.openStack}`)),i.openStack+r+i.closeStack},"wrapText"),ee=bt(({props:t},{close:e,open:i})=>{const r=(t?.openStack??"")+i,h=e+(t?.closeStack??""),s=bt((o,...a)=>Gi(o,a,s.props),"style");return Object.setPrototypeOf(s,te),s.props={close:e,closeStack:h,open:i,openStack:r,props:t},s.open=r,s.close=h,s},"createStyle"),Vi=bt(function(){const t=bt(e=>String(e),"self");t.strip=e=>e.replaceAll(Pt(),"");for(const e in be)z[e]={get(){const i=ee(this,be[e]);return Object.defineProperty(this,e,{value:i}),i}};for(const e in pe)z[e]={get(){const i=ee(this,pe[e]);return Object.defineProperty(this,e,{value:i}),i}};return te=Object.defineProperties({},z),Object.setPrototypeOf(t,te),t},"Colorize");for(const t in we)z[t]={get(){return(...e)=>ee(this,we[t](...e))}};z.ansi256=z.fg;z.bgAnsi256=z.bg;const U=new Vi,dn=U.bold,un=U.cyan,fn=U.dim,mn=U.green,gn=U.inverse,pn=U.magenta,bn=U.red,wn=U.yellow;var Di=Object.defineProperty,_=E((t,e)=>Di(t,"name",{value:e,configurable:!0}),"j"),zi=Object.defineProperty,S=_((t,e)=>zi(t,"name",{value:e,configurable:!0}),"$");const Yi=ui(import.meta.url),at=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,se=S(t=>{if(typeof at<"u"&&at.versions&&at.versions.node){const[e,i]=at.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return at.getBuiltinModule(t)}return Yi(t)},"__cjs_getBuiltinModule"),X=at,{execFileSync:qi}=se("node:child_process"),pt=se("node:fs"),Ui=se("node:tty");var Ki=Object.defineProperty,ae=S((t,e)=>Ki(t,"name",{value:e,configurable:!0}),"u$5"),Zi=Object.defineProperty,Lt=ae((t,e)=>Zi(t,"name",{value:e,configurable:!0}),"l");const Xi=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Qi=12288,tr=65510,er=[12288,12288,65281,65376,65504,65510],ir=8361,rr=65518,or=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],nr=32,sr=10630,ar=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],hr=4352,cr=262141,Le=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var lr=Object.defineProperty,dr=Lt((t,e)=>lr(t,"name",{value:e,configurable:!0}),"r$1");const wt=dr((t,e)=>{let i=0,r=Math.floor(t.length/2)-1;for(;i<=r;){const h=Math.floor((i+r)/2),s=h*2;if(e<t[s])r=h-1;else if(e>t[s+1])i=h+1;else return!0}return!1},"isInRange");var ur=Object.defineProperty,tt=Lt((t,e)=>ur(t,"name",{value:e,configurable:!0}),"r");const ye=19968,[fr,mr]=ct(Le);function ct(t){let e=t[0],i=t[1];for(let r=0;r<t.length;r+=2){const h=t[r],s=t[r+1];if(ye>=h&&ye<=s)return[h,s];s-h>i-e&&(e=h,i=s)}return[e,i]}E(ct,"nt");_(ct,"ge");S(ct,"c$2");ae(ct,"f");Lt(ct,"k");tt(ct,"findWideFastPathRange");const Fe=tt(t=>t<161||t>1114109?!1:wt(Xi,t),"isAmbiguous"),_e=tt(t=>t<Qi||t>tr?!1:wt(er,t),"isFullWidth"),gr=tt(t=>t<ir||t>rr?!1:wt(or,t),"isHalfWidth"),pr=tt(t=>t<nr||t>sr?!1:wt(ar,t),"isNarrow"),Je=tt(t=>t>=fr&&t<=mr?!0:t<hr||t>cr?!1:wt(Le,t),"isWide");function lt(t){return Fe(t)?"ambiguous":_e(t)?"fullwidth":gr(t)?"halfwidth":pr(t)?"narrow":Je(t)?"wide":"neutral"}E(lt,"rt");_(lt,"be");S(lt,"g$4");ae(lt,"S");Lt(lt,"getCategory");tt(lt,"getCategory");var br=Object.defineProperty,Ft=S((t,e)=>br(t,"name",{value:e,configurable:!0}),"i$4"),wr=Object.defineProperty,_t=Ft((t,e)=>wr(t,"name",{value:e,configurable:!0}),"a"),yr=Object.defineProperty,he=_t((t,e)=>yr(t,"name",{value:e,configurable:!0}),"e");function et(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}E(et,"U$1");_(et,"ee");S(et,"s$1");Ft(et,"s");_t(et,"r");he(et,"validate");function it(t){return et(t),lt(t)}E(it,"Z");_(it,"te");S(it,"r$3");Ft(it,"p");_t(it,"eastAsianWidthType");he(it,"eastAsianWidthType");function yt(t,{ambiguousAsWide:e=!1}={}){return et(t),_e(t)||Je(t)||e&&Fe(t)?2:1}E(yt,"yt");_(yt,"je");S(yt,"o$2");Ft(yt,"W");_t(yt,"eastAsianWidth");he(yt,"eastAsianWidth");var vr=Object.defineProperty,xr=S((t,e)=>vr(t,"name",{value:e,configurable:!0}),"p$3"),Br=Object.defineProperty,He=xr((t,e)=>Br(t,"name",{value:e,configurable:!0}),"e"),Rr=Object.defineProperty,Wr=He((t,e)=>Rr(t,"name",{value:e,configurable:!0}),"E");const Ge=String.raw,ve=Ge`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Sr=Wr(()=>new RegExp(Ge`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${ve}(?:\u200D${ve})*`,"gu"),"default");var jr=Object.defineProperty,Or=He((t,e)=>jr(t,"name",{value:e,configurable:!0}),"p");const dt=new Set(["\x1B","›"]),Jt="\x07",Ve="[",ce="m",kt="]8;;",Ar=39,Cr=/[\u200B\uFEFF\u2060-\u2064]/g,Ir=new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${kt}(?<uri>.*)${Jt})`),Mr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),Z=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,xe=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,Be=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,xt=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Ct=Sr();Or(t=>t.replace(Ct,""),"stripEmoji");var $r=Object.defineProperty,Er=S((t,e)=>$r(t,"name",{value:e,configurable:!0}),"E$1"),Tr=Object.defineProperty,kr=Er((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"A"),Nr=Object.defineProperty,Ht=kr((t,e)=>Nr(t,"name",{value:e,configurable:!0}),"d");const Re=new Map,Bt=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,It=Ht(t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other","getCharType"),Pr=Ht((t,e)=>{const i=Math.floor(t/65536),r=t%65536;let h=Re.get(i);if(h||(h=new Map,Re.set(i,h)),h.has(r))return h.get(r);let s;if(It(t)==="latin")s=e.width.regular;else if(It(t)==="control")s=e.width.control;else if(It(t)==="wide")s=e.width.wide;else switch(it(t)){case"ambiguous":{s=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{s=e.width.fullWidth;break}case"wide":{s=e.width.wide;break}default:s=e.width.regular}return h.set(r,s),s},"getCachedCharWidth"),Lr=Ht(t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,"isCombiningCharacter"),ht=Ht((t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const i={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?ht(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},r=Math.max(0,i.truncation.limit-i.truncation.ellipsisWidth),{length:h}=t,s=h>1e4;let o=0,a=0,n=h,l=!1;const d=t.includes("\x1B")||t.includes("›");for(;o<h;){if(d&&(t[o]==="\x1B"||t[o]==="›")){if(t.startsWith("\x1B]8;;",o)){const p="\x1B]8;;\x07",u=p.length,x=t.indexOf("\x07",o+5);if(x!==-1){const w=t.indexOf(p,x+1);if(w!==-1){const v=w+u,B=t.slice(x+1,w).replace(Z,""),R=ht(B,{ambiguousIsNarrow:i.width.ambiguousIsNarrow,ansiWidth:i.width.ansi,controlWidth:i.width.control,countAnsiEscapeCodes:!1,ellipsis:i.truncation.ellipsis,ellipsisWidth:i.truncation.ellipsisWidth,emojiWidth:i.width.emoji,fullWidth:i.width.fullWidth,halfWidth:i.width.halfWidth,limit:Math.max(0,r-a),regularWidth:i.width.regular,tabWidth:i.width.tab,wideWidth:i.width.wide}),j=R.width;if(R.truncated)l=!0,n=Math.min(n,o);else if(a+j>r&&(n=Math.min(n,o),l=!0,a+j>i.truncation.limit))break;if(a+=j,o=v,l&&a>=i.truncation.limit)break;continue}}}if(Z.lastIndex=o,Z.test(t)){const p=Z.lastIndex-o,u=i.truncation.countAnsiEscapeCodes?p:i.width.ansi;if(a+u>r&&(n=Math.min(n,o),a+u>i.truncation.limit)){l=!0;break}a+=u,o=Z.lastIndex;continue}}const b=t.codePointAt(o);if(b===8203||b===65279||b>=8288&&b<=8292){o+=1;continue}if(b===9){if(a+i.width.tab>r&&(n=Math.min(n,o),a+i.width.tab>i.truncation.limit)){l=!0;break}a+=i.width.tab,o+=1;continue}if(Bt.lastIndex=o,Bt.test(t)){const p=(Bt.lastIndex-o)*i.width.regular;if(a+p>r){const u=Math.floor((r-a)/i.width.regular);if(n=Math.min(n,o+u),a+p>i.truncation.limit){l=!0;break}}a+=p,o=Bt.lastIndex;continue}if((b<=31||b>=127&&b<=159)&&(xt.lastIndex=o,xt.test(t))){const p=(xt.lastIndex-o)*i.width.control;if(a+p>r&&(n=Math.min(n,o+Math.floor((r-a)/i.width.control)),a+p>i.truncation.limit)){l=!0;break}a+=p,o=xt.lastIndex;continue}if(Ct.lastIndex=o,Ct.test(t)){if(a+i.width.emoji>r&&(n=Math.min(n,o),a+i.width.emoji>i.truncation.limit)){l=!0;break}a+=i.width.emoji,o=Ct.lastIndex;continue}const f=t.codePointAt(o)??0;if(Lr(f)){o+=f>65535?2:1;continue}let g;if(s)g=Pr(f,i);else switch(It(f)){case"control":{g=i.width.control;break}case"latin":{g=i.width.regular;break}case"wide":{g=i.width.wide;break}case"zero":{g=0;break}default:switch(it(f)){case"ambiguous":{g=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{g=i.width.fullWidth;break}case"wide":{g=i.width.wide;break}default:g=i.width.regular}}if(a+g>r&&(n=Math.min(n,o),a+g>i.truncation.limit)){l=!0;break}a+=g,o+=f>65535?2:1}let c=a,m=!1;return l&&i.truncation.limit>=i.truncation.ellipsisWidth&&(c=i.truncation.limit,m=!0),{ellipsed:m,index:l?n:h,truncated:l,width:c}},"getStringTruncatedWidth");var Fr=Object.defineProperty,_r=S((t,e)=>Fr(t,"name",{value:e,configurable:!0}),"i$2"),Jr=Object.defineProperty,Hr=_r((t,e)=>Jr(t,"name",{value:e,configurable:!0}),"e"),Gr=Object.defineProperty,Vr=Hr((t,e)=>Gr(t,"name",{value:e,configurable:!0}),"r");const M=Vr((t,e={})=>ht(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var Dr=Object.defineProperty,De=S((t,e)=>Dr(t,"name",{value:e,configurable:!0}),"i$1"),zr=Object.defineProperty,ze=De((t,e)=>zr(t,"name",{value:e,configurable:!0}),"r"),Yr=Object.defineProperty,qr=ze((t,e)=>Yr(t,"name",{value:e,configurable:!0}),"c");let Ur=class{static{E(this,"ki")}static{_(this,"Si")}static{S(this,"l")}static{De(this,"y")}static{ze(this,"s")}static{qr(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(e=>e!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,e){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(i=>i!==t);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(t,e),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(e=>e!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Kr=Object.defineProperty,Zr=S((t,e)=>Kr(t,"name",{value:e,configurable:!0}),"S$1"),Xr=Object.defineProperty,Qr=Zr((t,e)=>Xr(t,"name",{value:e,configurable:!0}),"w"),to=Object.defineProperty,ut=Qr((t,e)=>to(t,"name",{value:e,configurable:!0}),"y");const We=new Ur(100),eo=new Intl.Segmenter("en",{granularity:"grapheme"}),io=/^[\u0000-\u007F]*$/,ro=new Set(["0","22","23","24","27","28","29","39","49"]),oo=new Set(["1","3","4","7","8","9"]),Se=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),Rt=ut(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),Wt=ut(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),no=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],je=ut((t,e)=>{let i=-1;for(const r of e){const h=t.indexOf(r);h!==-1&&(i===-1||h<i)&&(i=h)}return i},"findFirstPositionOfAny"),so=ut((t,e)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:M(t,e.width)}];const i=We.get(t);if(i)return i;const r=[],h=[];let s=0,o;for(Z.lastIndex=0;(o=Z.exec(t))!==null;){const d=o[0];r.push(t.slice(s,o.index)),h.push(d),s=o.index+d.length}s<t.length&&r.push(t.slice(s));const a=[];for(const d of h){if(d==="\x1B[0m"||d==="\x1B]8;;\x07"){a.push(d);continue}if(d.startsWith("\x1B[")&&d.endsWith("m")){const c=d.slice(2,-1);if(ro.has(c)){a.push(d);continue}}}const n=new Set,l=[];for(const[d,c]of r.entries()){if(d>0&&h[d-1]){const f=h[d-1];if(f==="\x1B[0m")n.clear();else if(f==="\x1B]8;;\x07"){for(const g of n)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){n.delete(g);break}}else if(f.startsWith("\x1B[")&&f.endsWith("m")){const g=f.slice(2,-1);if(g==="39"){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Rt(u)){n.delete(p);break}}}else if(g==="49"){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Wt(u)){n.delete(p);break}}}else if(Se.has(g)){const p=Se.get(g);for(const u of n)if(u===`\x1B[${p}m`){n.delete(u);break}}else{if(Rt(g)){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Rt(u)){n.delete(p);break}}}else if(Wt(g)){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Wt(u)){n.delete(p);break}}}else if(oo.has(g)){const p=`\x1B[${g}m`;n.has(p)&&n.delete(p)}n.add(f)}}else if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){for(const g of n)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){n.delete(g);break}n.add(f)}}if(c==="")continue;let m="";if(n.size>0)if(a.includes("\x1B[0m"))m="\x1B[0m";else{const f=[];let g=!1;for(const w of n)if(w.startsWith("\x1B]8;;")&&!w.endsWith("\x1B]8;;\x07")){g=!0;break}g&&a.includes("\x1B]8;;\x07")&&f.push("\x1B]8;;\x07");let p=!1,u=!1;for(const w of n)if(w.startsWith("\x1B[")&&w.endsWith("m")){const v=w.slice(2,-1);Rt(v)?p=!0:Wt(v)&&(u=!0)}if(p&&u){const w=je(t,["\x1B[3","\x1B[9","\x1B[38;"]),v=je(t,["\x1B[4","\x1B[10","\x1B[48;"]);w>=0&&v>=0?w>v?f.push("\x1B[39m","\x1B[49m"):f.push("\x1B[49m","\x1B[39m"):f.push("\x1B[39m","\x1B[49m")}else p&&f.push("\x1B[39m"),u&&f.push("\x1B[49m");p&&u&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(f.length-=2,f.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(f.length-=2,f.push("\x1B[49m","\x1B[39m")));const x=no.filter(w=>n.has(w.open)).map(w=>({position:t.indexOf(w.open),style:w})).filter(w=>w.position>=0).toSorted((w,v)=>v.position-w.position);for(const w of x){const v=w;a.includes(v.style.close)&&f.push(v.style.close)}m=f.join("")}const b=[...n].join("");l.push({after:m,before:b,content:c,visibleLength:M(c,{fullWidth:1,wideWidth:1})})}return We.set(t,l),l},"processIntoStyledSegments"),ao=ut((t,e,i,r)=>{const h=[...r.segmenter.segment(t)],s=[];let o=0,a=!1;for(const n of h){const l=M(n.segment,r.width),d=o,c=o+l;if(!a)if(d<e){o=c;continue}else a=!0;if(d>=i||c>i)break;s.push(n.segment),o=c}return s.join("")},"fastSlice"),D=ut((t,e=0,i=Number.MAX_SAFE_INTEGER,r={})=>{const h={segmenter:eo,...r};if(e>=i||t==="")return"";const s=M(t,h.width);if(e===0&&i>=s)return t;if(e<0||i<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return io.test(t)?t.slice(e,i):ao(t,e,i,h);if(xe.lastIndex=0,Be.lastIndex=0,!xe.test(t)&&!Be.test(t))return t;const o=so(t,h);if(o.length===0)return"";let a=0;const n=[];for(const[c,m]of o.entries()){const b=a,f=a+m.visibleLength;if(f>e&&b<i){const g=Math.max(0,e-b),p=Math.min(m.visibleLength,i-b);n.push({end:p,index:c,segment:m,start:g})}a=f}if(n.length===0)return"";const l=[],d=n[0].segment;l.push(d.before);for(let c=0;c<n.length;c++){const{end:m,segment:b,start:f}=n[c];if(f===0&&m===b.visibleLength)l.push(b.content);else{const g=[...h.segmenter.segment(b.content)];l.push(g.slice(f,m).map(p=>p.segment).join(""))}if(c<n.length-1){const g=n[c+1].segment,p=b.after,u=g.before;p!==u&&(p||u)&&l.push(p,u)}}return l.push(n.at(-1).segment.after),l.join("")},"slice");var ho=Object.defineProperty,co=S((t,e)=>ho(t,"name",{value:e,configurable:!0}),"x"),lo=Object.defineProperty,uo=co((t,e)=>lo(t,"name",{value:e,configurable:!0}),"T"),fo=Object.defineProperty,Gt=uo((t,e)=>fo(t,"name",{value:e,configurable:!0}),"f");const Oe="…",mo=3,St=Gt((t,e,i=!1)=>{if(t.charAt(e)===" ")return e;const r=i?1:-1,h=Math.min(mo,i?t.length-e:e);for(let s=1;s<=h;s++){const o=e+s*r;if(t.charAt(o)===" ")return o}return e},"findNearestSpace"),jt=Gt((t,e,i)=>ht(t,{...i,ellipsis:"",ellipsisWidth:0,limit:e}).index,"widthToIndex"),Ot=Gt((t,e,i)=>M(t.slice(0,e),i),"indexToWidth"),Ae=Gt((t,e,i={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof e}`);if(t===""||e<=0)return"";const r=t.normalize("NFC"),{ellipsis:h=Oe,position:s="end",preferTruncationOnSpace:o=!1}=i;let a=i.ellipsisWidth??h===Oe?1:void 0;a??=ht(h,{...i.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:n}=ht(r,{...i.width,ellipsis:h,ellipsisWidth:a});if(n<=e)return r;switch(s){case"end":{if(o){const l=e-a,d=jt(r,l,i.width),c=St(r,d),m=Ot(r,c,i.width);return D(r,0,m,{width:i.width})+h}return D(r,0,e-a,{width:i.width})+h}case"middle":{const l=Math.floor(e/2),d=Math.max(0,e-a),c=Math.min(l,d),m=Math.max(0,d-c);if(o){const b=jt(r,c,i.width),f=St(r,b),g=Ot(r,f,i.width),p=n-m,u=jt(r,p,i.width),x=St(r,u,!0),w=Ot(r,x,i.width);return D(r,0,g,{width:i.width})+h+D(r,w,n,{width:i.width}).trim()}return D(r,0,c,{width:i.width})+h+D(r,n-m,n,{width:i.width})}case"start":{if(o){const l=n-e+a,d=jt(r,l,i.width),c=St(r,d,!0),m=Ot(r,c,i.width);return h+D(r,m,n,{width:i.width}).trim()}return h+D(r,n-e+a,n,{width:i.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${s}'`)}},"truncate");var go=Object.defineProperty,Ye=S((t,e)=>go(t,"name",{value:e,configurable:!0}),"b$2"),po=Object.defineProperty,rt=Ye((t,e)=>po(t,"name",{value:e,configurable:!0}),"d"),bo=Object.defineProperty,wo=rt((t,e)=>bo(t,"name",{value:e,configurable:!0}),"a");const yo=/\x1B\[(\d+)m/;class qe{static{E(this,"he")}static{_(this,"at")}static{S(this,"T")}static{Ye(this,"T")}static{rt(this,"d")}static{wo(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const i=yo.exec(e);if(!i)return;const r=Number.parseInt(i[1],10);switch(r){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const h={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];h&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(h)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const i={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(r=>{const h=i[r];h&&e.push(h)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}var vo=Object.defineProperty,Ue=rt((t,e)=>vo(t,"name",{value:e,configurable:!0}),"o");const Ke=Ue((t,e)=>{if(!dt.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const i=!0,r=t.slice(e+1,e+1+kt.length).join("")===kt;return{isInsideEscape:i,isInsideLinkEscape:r}},"checkEscapeSequence"),xo=Ue((t,e={})=>{const i=new qe;let r="",h=!1,s="",o="",a=!1;const n=[...t];for(let l=0;l<n.length;l++){const d=n[l];if(d&&dt.has(d)){if(r){const g=e.getWidth?.(r)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:r,width:g};if(a&&(p.isHyperlink=!0,p.hyperlinkUrl=o),e.onSegment?.(p,i)===!1)return;r=""}h=!0,s=d;const b=Ke(n,l),{isInsideLinkEscape:f}=b;if(f){let g=l+1;for(o="";g<n.length;){const u=n[g];if(u===Jt)break;o+=u,g+=1}o=o.slice(4);const p={hyperlinkUrl:o,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(p,i)===!1)return;l=g,a=!0,h=!1,s="";continue}if(l+1<n.length&&n[l+1]==="\\"&&a){const g={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(g,i)===!1)return;a=!1,o="",l+=1,h=!1,s="";continue}}if(h){if(s!==d&&(s+=d),d===ce){h=!1,i.processEscape(s);const b={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};if(e.onSegment?.(b,i)===!1)return;s=""}continue}r+=d;const c=e.getWidth?.(r)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:r,width:c};if(a&&(m.isHyperlink=!0,m.hyperlinkUrl=o),e.onSegment?.(m,i)===!1)return;r=""}if(r){const l=e.getWidth?.(r)??0,d={isEscapeSequence:!1,isGrapheme:!0,text:r,width:l};a&&(d.isHyperlink=!0,d.hyperlinkUrl=o),e.onSegment?.(d,i)}if(s){const l={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};e.onSegment?.(l,i)}},"processAnsiString");var Bo=Object.defineProperty,Ro=rt((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"t$1");const Ce=Ro(t=>`${dt.values().next().value}${Ve}${String(t)}${ce}`,"wrapAnsiCode");var Wo=Object.defineProperty,So=rt((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"s");const Ie=So(t=>`${dt.values().next().value}${kt}${t}${Jt}`,"wrapAnsiHyperlink");var jo=Object.defineProperty,Oo=rt((t,e)=>jo(t,"name",{value:e,configurable:!0}),"l");const Ao=Oo(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",i,r;const h=t.join(`
3
- `),s=[...h];let o=0;for(const[a,n]of s.entries()){if(e+=n,dt.has(n)){const d=Ir.exec(h.slice(o))?.groups??{};if(d.code!==void 0){const c=Number.parseFloat(d.code);i=c===Ar?void 0:c}else d.uri!==void 0&&(r=d.uri.length===0?void 0:d.uri)}const l=Mr.get(Number(i));s[a+1]===`
4
- `?(r&&(e+=Ie("")),i&&l&&(e+=Ce(l))):n===`
5
- `&&(i&&l&&(e+=Ce(i)),r&&(e+=Ie(r))),o+=n.length}return e},"preserveAnsi");var Co=Object.defineProperty,Y=rt((t,e)=>Co(t,"name",{value:e,configurable:!0}),"f");const Ze=/(?=\s)|(?<=\s)/,Xe=/^\s+$/,qt=Y(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),Q=Y(t=>{const e=t.split(" ");let i=e.length;for(;i>0&&M(e[i-1])===0;)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},"stringVisibleTrimSpacesRight"),Qe=Y((t,e,i)=>{if(t.length===0)return[""];if(e<=0)return[t];const r=[],h=new qe;let s="",o=0,a=!1,n=!1,l="",d=0;for(;d<t.length;){const c=t[d];if(dt.has(c)){a=!0,l=c,s+=c,n=Ke([...t],d).isInsideLinkEscape,d+=1;continue}if(a){l+=c,s+=c,n?c===Jt&&(a=n=!1):c===ce&&(a=!1,h.processEscape(l)),d+=1;continue}const m=M(c),b=c===" ";if(m===0){s+=c,d+=1;continue}if(o+m>e&&(s&&r.push(s+h.getEndEscapesForAllActiveAttributes()),s=h.getStartEscapesForAllActiveAttributes(),o=M(s),b&&i)){for(;d<t.length&&t[d]===" ";)d+=1;continue}if(s+=c,o+=m,o===e&&d<t.length-1&&(r.push(s+h.getEndEscapesForAllActiveAttributes()),s=h.getStartEscapesForAllActiveAttributes(),o=M(s),d+1<t.length&&t[d+1]===" "&&i)){for(d+=1;d<t.length&&t[d]===" ";)d+=1;continue}d+=1}return s&&r.push(s+h.getEndEscapesForAllActiveAttributes()),i?r.map(c=>Q(c)):r},"wrapWithBreakAtWidth"),Io=Y((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const h=[];let s="",o=0;return xo(r,{getWidth:M,onSegment:Y((a,n)=>{const l=a.text??"";if(a.isEscapeSequence)s+=l;else{const d=l===" ";if(a.width===0)return s+=l,!0;if(o+a.width>e&&(s&&h.push(s),s=n.getStartEscapesForAllActiveAttributes(),o=0,d))return i||h.push(n.getStartEscapesForAllActiveAttributes()+l),!0;s+=l,o+=a.width}return!0},"onSegment")}),s&&h.push(s),i?h.map(a=>Q(a)):h},"wrapCharByChar"),Mo=Y((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const h=r.split(Ze),s=[];let o="",a=0,n=0;for(;n<h.length;){const l=h[n],d=Xe.test(l),c=M(l);if(l.length===0){n+=1;continue}if(i&&d&&a===0){n+=1;continue}if(a+c>e&&a>0){i?s.push(Q(o)):s.push(o),o="",a=0;continue}o+=l,a+=c,n+=1}return o&&(i?s.push(Q(o)):s.push(o)),s},"wrapWithWordBoundaries"),$o=Y((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const h=r.split(Ze),s=[];let o="",a=0,n=0;for(;n<h.length;){const l=h[n],d=Xe.test(l),c=M(l);if(l.length===0){n+=1;continue}if(i&&d&&a===0){n+=1;continue}if(c>e){o&&s.push(qt(i?Q(o):o));const m=Qe(l,e,i);if(m.length>0){for(let b=0;b<m.length-1;b+=1)s.push(m[b]);o=m.at(-1),a=M(o)}else o="",a=0;n+=1;continue}if(a+c>e&&a>0&&(s.push(qt(i?Q(o):o)),o="",a=0,i&&d)){n+=1;continue}o+=l,a+=c,n+=1}return o&&s.push(qt(i?Q(o):o)),s},"wrapAndBreakWords"),At={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Eo=Y((t,e={})=>{const{removeZeroWidthCharacters:i=!0,trim:r=!0,width:h=80,wrapMode:s=At.PRESERVE_WORDS}=e;if(r&&t.trim()==="")return"";let o=t.normalize("NFC").replaceAll(`\r
6
- `,`
7
- `);return i&&(o=o.replaceAll(Cr,"")),o.split(`
8
- `).map(a=>{if(r&&a.trim()==="")return"";let n;switch(s){case At.BREAK_AT_CHARACTERS:{n=Io(a,h,r);break}case At.BREAK_WORDS:{n=$o(a,h,r);break}case At.STRICT_WIDTH:{n=Qe(a,h,r);break}default:n=Mo(a,h,r)}return Ao(n)}).join(`
9
- `)},"wordWrap");var To=Object.defineProperty,K=S((t,e)=>To(t,"name",{value:e,configurable:!0}),"n$3");const ti=80,ei=24,ie=K((t,e,{shell:i,env:r}={})=>qi(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:i,env:r}).trim(),"exec"),Mt=K((t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),"create"),ii=K((t,e)=>{const{columns:i,rows:r}=Mt(t,e);if(!(Number.isNaN(i)||Number.isNaN(r))&&!(i===ti&&r===ei))return{columns:i,rows:r}},"createIfNotDefault"),ko=K(()=>{if(X.platform!=="linux")return!0;try{const t=pt.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const i=t.slice(e+2).trim().split(/\s+/),r=Number.parseInt(i[2],10),h=Number.parseInt(i[5],10);return Number.isNaN(r)||Number.isNaN(h)||h<=0?!1:r===h}catch{return!1}},"isForegroundProcess");function Vt(){const{env:t,stdout:e,stderr:i}=X;if(e?.columns&&e?.rows)return Mt(e.columns,e.rows);if(i?.columns&&i?.rows)return Mt(i.columns,i.rows);if(t.COLUMNS&&t.LINES)return Mt(t.COLUMNS,t.LINES);const r={columns:ti,rows:ei};return X.platform==="win32"?Ut()??r:X.platform==="darwin"?Me()??Ut()??r:Me()??Ut()??No()??r}E(Vt,"Tt");_(Vt,"bt");S(Vt,"O");K(Vt,"terminalSize");const Me=K(()=>{try{const t=X.platform==="darwin"?pt.constants.O_EVTONLY|pt.constants.O_NONBLOCK:pt.constants.O_NONBLOCK,{columns:e,rows:i}=Ui.WriteStream(pt.openSync("/dev/tty",t));return{columns:e,rows:i}}catch{}},"devTty"),Ut=K(()=>{try{const t=ie("tput",["cols"],{env:{TERM:"dumb",...X.env}}),e=ie("tput",["lines"],{env:{TERM:"dumb",...X.env}});if(t&&e)return ii(t,e)}catch{}},"tput"),No=K(()=>{try{if(!ko())return;const t=ie("resize",["-u"]).match(/\d+/g);if(t.length===2)return ii(t[0],t[1])}catch{}},"resize");var Po=Object.defineProperty,ri=S((t,e)=>Po(t,"name",{value:e,configurable:!0}),"e");const nt=ri((t,e)=>{switch(e){case"bottom":return{body:t.bottomBody,join:t.bottomJoin,left:t.bottomLeft,right:t.bottomRight};case"middle":return{body:t.joinBody,join:t.joinJoin,left:t.joinLeft,right:t.joinRight};case"top":return{body:t.topBody,join:t.topJoin,left:t.topLeft,right:t.topRight};default:throw new Error(`Invalid borderType: ${String(e)}`)}},"getHorizontalBorderChars"),Lo=ri(t=>({join:t.bodyJoin,left:t.bodyLeft,right:t.bodyRight}),"getVerticalBorderChars");var Fo=Object.defineProperty,_o=S((t,e)=>Fo(t,"name",{value:e,configurable:!0}),"n$1");const Nt=_o((t,e,i)=>{let r=0;for(let h=0;h<i;h+=1)r+=t[e+h]??0;return i>1&&(r+=i-1),r},"calculateCellTotalWidth");var Jo=Object.defineProperty,Ho=S((t,e)=>Jo(t,"name",{value:e,configurable:!0}),"a");const re=Ho((t,e,i,r)=>{let h=e;for(;h>0&&t[h-1]?.[i]===r;)h-=1;let s=e;for(;s<t.length-1&&t[s+1]?.[i]===r;)s+=1;let o;const a=s-h+1;if(a===1)o=!0;else switch(r.vAlign){case"bottom":{o=e===s;break}case"middle":{const n=h+Math.floor(a/2);o=e===n;break}case"top":{o=e===h;break}default:o=e===h}return{firstRow:h,lastRow:s,showContent:o}},"determineCellVerticalPosition");var Go=Object.defineProperty,Vo=S((t,e)=>Go(t,"name",{value:e,configurable:!0}),"F");const Do=Vo((t,e,i,r,h)=>{if(t.length===0)return[];let s=t.length-1;for(let n=0;n<t.length;n+=1){const l=t[n];if(l){for(const[d,c]of l.entries())if(c&&h(t,n,d,c)===n){const m=re(t,n,d,c);s=Math.max(s,m.lastRow)}}}const o=Array.from({length:s+1}).fill(1);for(let n=0;n<t.length;n+=1){const l=t[n];if(l)for(let d=0;d<i.columns;d+=1){const c=l[d];if(c&&h(t,n,d,c)===n&&(c.rowSpan??1)===1){const m=c.colSpan??1,b=Nt(e,d,m),f=r(c,b).length;o[n]=Math.max(o[n]??1,f)}}}const a=Array.from({length:o.length}).fill(!1);if(i.fixedRowHeights)for(let n=0;n<o.length;n+=1){let l;i.fixedRowHeights[n]!==void 0?l=i.fixedRowHeights[n]:i.fixedRowHeights.length===1&&i.fixedRowHeights[0]!==void 0&&(l=i.fixedRowHeights[0]),l!==void 0&&(o[n]=Math.max(1,l),a[n]=!0)}for(let n=0;n<t.length;n+=1){const l=t[n];if(l)for(let d=0;d<i.columns;d+=1){const c=l[d];if(c&&h(t,n,d,c)===n&&(c.rowSpan??1)>1){const m=c.colSpan??1,b=Nt(e,d,m),f=r(c,b).length-1,g=re(t,n,d,c),{firstRow:p,lastRow:u}=g;let x=0,w=0;for(let B=p;B<=u&&B<o.length;B+=1)x+=o[B]??1,a[B]||(w+=1);const v=f-x;if(v>0)if(w>0){const B=Math.ceil(v/w);let R=0;for(let j=p;j<=u&&j<o.length;j+=1)if(!a[j]){const O=Math.min(B,v-R);if(o[j]=(o[j]??1)+O,R+=O,R>=v)break}}else console.warn(`[calculateRowHeights] Content of spanning cell exceeds fixed height allocated. Cell: ${JSON.stringify(c.content)}, Required: ${String(f)}, Allocated: ${String(x)} (fixed).`)}}}return o},"calculateRowHeights");var zo=Object.defineProperty,Yo=S((t,e)=>zo(t,"name",{value:e,configurable:!0}),"i");const st=Yo((t,e,i,r)=>{let h=e;for(;h>0&&t[h-1]?.[i]===r;)h-=1;return h},"findFirstOccurrenceRow");var qo=Object.defineProperty,Uo=S((t,e)=>qo(t,"name",{value:e,configurable:!0}),"n");const oe="__EMPTY__",$e=Uo(t=>{if(typeof t=="string")return{content:t};if(typeof t=="number"||typeof t=="bigint"||typeof t=="boolean")return{content:String(t)};if(t==null)return{content:oe};if(typeof t=="object"&&"content"in t){let{content:e}=t;if(typeof e=="number"||typeof e=="bigint"||typeof e=="boolean")e=String(e);else if(e==null)e=oe;else if(typeof e!="string")throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`);return{...t,content:e}}throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`)},"normalizeGridCell");var Ko=Object.defineProperty,Zo=S((t,e)=>Ko(t,"name",{value:e,configurable:!0}),"p");const Xo=Zo((t,e,i,r,h)=>{const s=M(t),o=" ".repeat(Math.max(0,r)),a=" ".repeat(Math.max(0,h));if(s===0)return o+" ".repeat(Math.max(0,e))+a;const n=Math.max(0,e-s);switch(i){case"center":{const l=Math.floor(n/2),d=n-l;return o+" ".repeat(l)+t+" ".repeat(d)+a}case"right":return o+" ".repeat(n)+t+a;default:return o+t+" ".repeat(n)+a}},"padAndAlignContent");var Qo=Object.defineProperty,le=S((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"H");const gt=/\r?\n/,Ee=/\s+/,W=le((t,e)=>!t||!e?t:typeof e=="function"?e(t):e.open+t+e.close,"applyColor");class Dt{static{E(this,"It")}static{_(this,"Te")}static{S(this,"Grid")}static{le(this,"Grid")}#t;#o=[];#e;#n=new WeakMap;#i=new WeakMap;static createGridLayout(){return[]}constructor(e){const i={autoColumns:1,autoFlow:"row",autoRows:1,balancedWidths:!1,gap:0,paddingLeft:1,paddingRight:1,rows:0,showBorders:e.border!==void 0,truncate:!1,truncateOverflow:!0,wordWrap:!1};let r;Array.isArray(e.fixedRowHeights)?r=e.fixedRowHeights:typeof e.fixedRowHeights=="number"&&(r=[e.fixedRowHeights]),this.#t={...i,...e,columns:e.columns,fixedRowHeights:r,showBorders:e.border!==void 0||(e.showBorders??!1)};let{terminalWidth:h}=this.#t;if(h===void 0){const{columns:s}=Vt();h=s}this.#e=h,this.#t.maxWidth&&(this.#t.maxWidth=Math.min(this.#t.maxWidth,this.#e))}addItem(e){return this.#o.push($e(e)),this}addItems(e){return this.#o.push(...e.map(i=>$e(i))),this}setColumns(e){return this.#t.columns=e,this}setRows(e){return this.#t.rows=e,this}setBorder(e){return this.#t.border=e,this}setShowBorders(e){return this.#t.showBorders=e,this}setMaxWidth(e){return this.#t.maxWidth=e,this}toString(){const e=Dt.createGridLayout();if(this.placeItems(e),e.length===0||e[0]?.length===0)return"";let i=this.calculateColumnWidths(e);const r=this.calculateTotalGridWidth(i),h=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#e):this.#e;return r>h&&(i=this.adjustColumnWidthsForTerminal(i,r)),this.renderGrid(e,i)}placeItems(e){let i=0,r=0;const h=this.#t.rows>0?this.#t.rows:Number.POSITIVE_INFINITY;for(let s=0;s<this.#o.length;s+=1){const o=this.#o[s];if(o.content===oe&&!(o.rowSpan&&o.rowSpan>1)&&!(o.colSpan&&o.colSpan>1)){if(this.#t.autoFlow==="row")r+=1,r>=this.#t.columns&&(r=0,i+=1);else{i+=1;const f=e.length>0?e.length:h;i>=f&&f!==Number.POSITIVE_INFINITY?(i=0,r+=1):e.length===0&&f===Number.POSITIVE_INFINITY&&(r+=1)}continue}const a=o.colSpan??1,n=o.rowSpan??1;let l=!1,d=i,c=r,m=0;const b=(e.length+n+5)*this.#t.columns;for(;!l&&d<h&&m<b;){for(m+=1;d+n>e.length;)e.push(Array.from({length:this.#t.columns}).fill(void 0));if(this.canPlaceItem(e,d,c,a,n))if(this.placeItem(e,d,c,o),l=!0,this.#t.autoFlow==="row")r=c+a,i=d,r>=this.#t.columns&&(r=0,i+=1);else{i=d+n,r=c;const f=e.length>0?e.length:h;i>=f&&(i=0,r+=1)}else if(this.#t.autoFlow==="row")c+=1,c>=this.#t.columns&&(c=0,d+=1);else{for(d+=1;d+n>e.length;)e.push(Array.from({length:this.#t.columns}).fill(void 0));const f=e.length>0?e.length:h;if(d>=f&&(d=0,c+=1,c>=this.#t.columns))break}}if(!l)if(console.warn(`@visulima/tabular: Could not find position for item: ${JSON.stringify(o)} after ${String(m)} attempts. Grid might be too small or layout impossible.`),this.#t.autoFlow==="row")r+=1,r>=this.#t.columns&&(r=0,i+=1);else{i+=1;const f=e.length>0?e.length:h;i>=f&&(i=0,r+=1)}if(m>=b)break}if(this.#t.rows===0)for(;e.length>0&&e.at(-1)?.every(s=>s===void 0);)e.pop()}canPlaceItem(e,i,r,h,s,o=!1){if(r+h>this.#t.columns)return!1;for(let a=i;a<i+s;a+=1)if(a<e.length){if(!e[a])return console.warn(`Grid layout unexpectedly missing row ${String(a)} during canPlaceItem check.`),!1;for(let n=r;n<r+h;n+=1)if(e[a]?.[n]!==void 0)return!1}else if(!o)return!1;return!0}computeWrappedContentWidth(e,i,r,h){let s=e;if(h){if(s>20){let o=0;for(const a of i){const n=a.split(Ee);for(const l of n)o=Math.max(o,Math.min(M(l),r))}s=Math.min(s,Math.max(o+4,12))}}else{let o=0;for(const a of i){const n=a.split(Ee);for(const l of n)o=Math.max(o,Math.min(M(l),r))}s=Math.min(s,Math.max(o+12,20))}return s}placeItem(e,i,r,h){const s=h.rowSpan??1,o=h.colSpan??1;for(let a=i;a<i+s;a+=1){for(;a>=e.length;)e.push(Array.from({length:this.#t.columns}).fill(void 0));for(let n=r;n<r+o;n+=1)n<this.#t.columns&&(e[a]||(console.error(`Logic error: Row ${String(a)} not found in placeItem despite check.`),e[a]=Array.from({length:this.#t.columns}).fill(void 0)),e[a][n]=h)}}calculateTotalGridWidth(e){let i=0;const r=this.#t.showBorders?this.#t.border:void 0;r&&(i+=r.bodyLeft.width,i+=r.bodyRight.width);const h=e.length,s=this.#t.showBorders?r?.bodyJoin.width??0:0,o=this.#t.gap;for(let a=0;a<h;a+=1)i+=e[a]??0,a<h-1&&(i+=o,i+=s);return i}adjustColumnWidthsForTerminal(e,i){const r=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth??0,this.#e):this.#e;if(i<=r)return e;let h=0;const s=e.length,o=this.#t.showBorders?this.#t.border:void 0;if(o&&(h+=o.bodyLeft.width,h+=o.bodyRight.width),s>1){h+=(s-1)*this.#t.gap;const c=o?.bodyJoin.width??0;h+=(s-1)*c}if(h>=r)return Array.from({length:s}).fill(1);const a=r-h,n=e.reduce((c,m)=>c+m,0);if(n===0){const c=Math.floor(a/s);return Array.from({length:s}).fill(c)}const l=e.map(c=>{const m=c/n;return Math.max(1,Math.floor(a*m))});let d=a-l.reduce((c,m)=>c+m,0);if(d>0){const c=l.map((m,b)=>{const f=n>0?(e[b]??0)/n:1/s;return{index:b,remainder:a*f%1}}).toSorted((m,b)=>b.remainder-m.remainder);for(const m of c){if(d<=0)break;const{index:b}=m;l[b]!==void 0&&(l[b]+=1,d-=1)}}return l}calculateBalancedColumnWidths(e){const i=this.calculateMinimumColumnWidthsWithGrowableInfo(e),r=i.widths,{growableColumns:h}=i,s=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#e):this.#e,o=this.#t.showBorders?this.#t.border:void 0;let a=0;if(o&&(a+=o.bodyLeft.width,a+=o.bodyRight.width),this.#t.columns>1){a+=(this.#t.columns-1)*this.#t.gap;const d=o?.bodyJoin.width??0;a+=(this.#t.columns-1)*d}const n=Math.max(0,s-a);if(r.reduce((d,c)=>d+c,0)>0){const d=Math.floor(n/this.#t.columns),c=Array.from({length:this.#t.columns}).fill(d),m=d*this.#t.columns;let b=n-m;for(let u=0;u<c.length&&b>0;u+=1)c[u]=(c[u]??0)+1,b-=1;const f=[];let g=0;for(let u=0;u<this.#t.columns;u+=1){const x=c[u]??0,w=r[u]??0,v=Math.max(x,w);f.push(v),g+=v}if(g>n){const u=n/g,x=f.map(B=>Math.max(3,Math.floor(B*u))),w=x.reduce((B,R)=>B+R,0);let v=n-w;for(let B=0;B<x.length&&v>0;B+=1)x[B]=(x[B]??0)+1,v-=1;return x}let p=n-g;if(p>0){const u=h.length>0?h:f.map((x,w)=>w);for(;p>0&&u.length>0;)for(const x of u){if(p<=0)break;f[x]=(f[x]??0)+1,p-=1}}return f}const l=Math.floor(n/this.#t.columns);return Array.from({length:this.#t.columns}).fill(l)}calculateMinimumColumnWidthsWithGrowableInfo(e){const i=Array.from({length:this.#t.columns}).fill(0),r=[],h=this.#t.paddingLeft+this.#t.paddingRight,s=this.#t.gap+(this.#t.showBorders?this.#t.border?.bodyJoin.width??0:0);for(let o=0;o<this.#t.columns;o+=1)for(let a=0;a<e.length;a+=1){const n=e[a]?.[o];if(!n||st(e,a,o,n)!==a||o>0&&e[a]?.[o-1]===n)continue;const l=n.colSpan??1,d=n.maxWidth??Number.POSITIVE_INFINITY,c=String(n.content??"").split(gt),m=this.#t.wordWrap&&n.wordWrap!==!1;let b=0;for(const f of c)b=Math.max(b,Math.min(M(f),d));b=this.computeWrappedContentWidth(b,c,d,m),l===1&&(i[o]=Math.max(i[o]??0,b+h),m&&!r.includes(o)&&r.push(o))}for(let o=0;o<e.length;o+=1)for(let a=0;a<this.#t.columns;a+=1){const n=e[o]?.[a];if(!n||st(e,o,a,n)!==o||a>0&&e[o]?.[a-1]===n)continue;const l=n.colSpan??1;if(l>1){const d=n.maxWidth??Number.POSITIVE_INFINITY,c=String(n.content??"").split(gt),m=this.#t.wordWrap&&n.wordWrap!==!1;let b=0;for(const u of c)b=Math.max(b,Math.min(M(u),d));b=this.computeWrappedContentWidth(b,c,d,m);const f=(l-1)*s,g=b+h+f;let p=0;for(let u=a;u<a+l;u+=1)p+=i[u]??0;if(g>p){const u=g-p,x=Math.ceil(u/l);for(let w=0;w<l&&a+w<this.#t.columns;w+=1)i[a+w]=Math.max(i[a+w]??0,x)}}}return{growableColumns:r,widths:i}}calculateColumnWidths(e){if(this.#t.fixedColumnWidths&&this.#t.fixedColumnWidths.length===this.#t.columns){const s=this.#t.fixedColumnWidths;if(!s.some(o=>o===void 0||!Number.isFinite(o)))return[...s];if(this.#t.balancedWidths){const o=Array.from({length:s.length}).fill(0),a=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#e):this.#e,n=this.calculateTotalGridWidth(Array.from({length:o.length}).fill(0)),l=Math.max(0,a-n);let d=0;const c=[];for(const[f,g]of s.entries())typeof g=="number"&&Number.isFinite(g)?(o[f]=g,d+=g):c.push(f);let m=Math.max(0,l-d);const b=c.length>0?Math.floor(m/c.length):0;for(const f of c)o[f]=b;m-=b*c.length;for(const f of c){if(m<=0)break;o[f]+=1,m-=1}return o}}if(this.#t.balancedWidths)return this.calculateBalancedColumnWidths(e);const i=Array.from({length:this.#t.columns}).fill(0),r=this.#t.paddingLeft+this.#t.paddingRight,h=this.#t.gap+(this.#t.showBorders?this.#t.border?.bodyJoin.width??0:0);for(let s=0;s<this.#t.columns;s+=1)for(let o=0;o<e.length;o+=1){const a=e[o]?.[s];if(!a||st(e,o,s,a)!==o||s>0&&e[o]?.[s-1]===a)continue;const n=a.colSpan??1,l=a.maxWidth??Number.POSITIVE_INFINITY,d=String(a.content??"").split(gt);let c=0;for(const m of d)c=Math.max(c,Math.min(M(m),l));n===1&&(i[s]=Math.max(i[s]??0,c+r))}for(let s=0;s<e.length;s+=1)for(let o=0;o<this.#t.columns;o+=1){const a=e[s]?.[o];if(!a||st(e,s,o,a)!==s||o>0&&e[s]?.[o-1]===a)continue;const n=a.colSpan??1;if(n>1){const l=a.maxWidth??Number.POSITIVE_INFINITY,d=String(a.content??"").split(gt),c=this.#t.wordWrap&&a.wordWrap!==!1;let m=0;for(const u of d)m=Math.max(m,Math.min(M(u),l));m=this.computeWrappedContentWidth(m,d,l,c);let b=0;for(let u=o;u<o+n;u+=1)b+=i[u]??0;const f=n>1?(n-1)*h:0,g=m+r+f,p=b+f;if(g>p){const u=g-p,x=Math.floor(u/n);let w=0;for(let v=0;v<n&&o+v<this.#t.columns;v+=1){const B=Math.min(x,u-w);if(i[o+v]=(i[o+v]??0)+B,w+=B,w>=u)break}}}}if(this.#t.maxWidth){const s=this.calculateTotalGridWidth(i);if(s>this.#t.maxWidth)return this.adjustColumnWidthsForTerminal(i,s)}return i}renderVisualRowContent(e,i,r,h,s){const o=e[i];if(!o)return"";const a=this.#t.borderColor??this.#t.foregroundColor??void 0,n=[],l=this.#t.showBorders&&this.#t.border?Lo(this.#t.border):void 0,d=l&&l.left.width>0?l.left.char:"",c=l&&l.right.width>0?l.right.char:"",m=l&&l.join.width>0?l.join.char:"",b=" ".repeat(this.#t.gap);d&&n.push(W(W(d,a),this.#t.backgroundColor));let f=0;for(;f<this.#t.columns;){const g=o[f]??void 0;let p=1,u;if(g){const x=g.colSpan??1;p=x;const w=st(e,i,f,g),v=Nt(h,f,x),B=this.alignCellContent(g,v),R=B.length,j=this.getCachedCellVerticalPosition(e,i,f,g);j.firstRow!==w&&console.warn(`Mismatch between findFirstOccurrenceRow (${String(w)}) and determineCellVerticalPosition (${String(j.firstRow)})`);const O=s.slice(w,j.lastRow+1).reduce((A,P)=>A+P,0),$=j.lastRow-j.firstRow+1;let k=r,N=0;for(let A=w;A<i;A+=1)A<s.length&&(k+=s[A]??1),A<j.lastRow&&(N+=1);k+=N;const J=g.vAlign??"top";let F;switch(J){case"bottom":{let A=r;for(let L=w;L<i;L+=1)A+=s[L]??1;const P=O-R;F=A>=P?A-P:-1;break}case"middle":{const A=Math.round((O-R)/2);let P=r;for(let L=w;L<i;L+=1)P+=s[L]??1;F=P>=A&&P<A+R?P-A:-1;break}case"top":{F=k;break}default:F=k}const zt=F>=0&&F<R;if(u=" ".repeat(Math.max(0,v)),zt){let A=!1;J==="middle"&&$%2===0&&F===0&&(A=!0),A||(u=B[F]??u)}g.colSpan&&g.colSpan>1&&(u+=b.repeat(g.colSpan)),g.foregroundColor?u=W(u,g.foregroundColor):this.#t.foregroundColor&&(u=W(u,this.#t.foregroundColor)),g.backgroundColor?u=W(u,g.backgroundColor):this.#t.backgroundColor&&(u=W(u,this.#t.backgroundColor))}else{const x=this.#t.paddingLeft+this.#t.paddingRight,w=Math.max(0,(h[f]??0)-x),v=" ".repeat(this.#t.paddingLeft+w+this.#t.paddingRight);u=W(W(r===0?v:" ".repeat(v.length),this.#t.foregroundColor),this.#t.backgroundColor)}n.push(u),f+p<this.#t.columns&&(n.push(b),this.#t.showBorders&&m&&n.push(W(W(m,a),this.#t.backgroundColor)),this.#t.gap>0&&n.push(b)),f+=p}return c&&n.push(W(W(c,a),this.#t.backgroundColor)),n.join("")}alignCellContent(e,i){const r=this.#n.get(e);if(r?.has(i))return r.get(i);const{paddingLeft:h,paddingRight:s}=this.#t,o=h+s,a=i-o;if(a<=0){const c=[" ".repeat(o+this.#t.gap)];return r?r.set(i,c):this.#n.set(e,new Map([[i,c]])),c}let n;const l=String(e.content??"");if(n=l.includes(`
10
- `)||l.includes("\r")?l.split(gt):[l],this.#t.wordWrap&&e.wordWrap!==!1){const c=typeof this.#t.wordWrap=="object"?this.#t.wordWrap:{},m=typeof e.wordWrap=="object"?e.wordWrap:c;n=Eo(l,{...m,width:a}).split(`
11
- `)}if(this.#t.truncate&&e.truncate!==!1){const c=typeof this.#t.truncate=="object"?this.#t.truncate:{},m=typeof e.truncate=="object"?e.truncate:c;n=n.map(b=>Ae(b,a,m))}else this.#t.truncateOverflow&&(n=n.map(c=>M(c)>a?Ae(c,a,{}):c));const d=n.map(c=>Xo(c,a,e.hAlign??"left",h,s));return r?r.set(i,d):this.#n.set(e,new Map([[i,d]])),d}renderHorizontalBorder(e,i,r,h,s,o=-1){if(!this.#t.showBorders||!this.#t.border)return"";const a=this.#t.border,n=nt(a,s),l=n.body.char,d=n.body.width,c=a.bodyJoin.char;if(s!=="middle"&&d===0)return"";let m=n.left.char,b=n.right.char;if(s==="middle"&&o!==-1){const u=e[r]?.[0]??void 0,x=e[o]?.[0]??void 0;u&&x&&u===x&&(m=c);const w=this.#t.columns-1,v=e[r]?.[w]??void 0,B=e[o]?.[w]??void 0;v&&B&&v===B&&(b=c)}const f=[],g=" ".repeat(this.#t.gap);m&&f.push(W(W(m,this.#t.borderColor),this.#t.backgroundColor));let p;for(let u=0;u<this.#t.columns;u+=1){const x=e[r]?.[u]??void 0,w=s==="middle"&&o!==-1?e[o]?.[u]??void 0:void 0;let v,B=!1;if(x&&(u===0||e[r]?.[u-1]!==x)&&(v=x,B=!0),x&&!B)continue;if(!x){const O=h[u]??0;if(p=d>0?l.repeat(O):" ".repeat(O),f.push(W(W(p,this.#t.borderColor),this.#t.backgroundColor)),u<this.#t.columns-1){const $=this.determineJoinChar(s,e,r,o,u,u+1);f.push(g),$.width>0&&f.push(W(W($.char,this.#t.borderColor),this.#t.backgroundColor))}continue}const R=v?.colSpan??1;if(s==="middle"&&s==="middle"&&w&&x===w&&v){const O=v.vAlign==="middle",{firstRow:$,lastRow:k}=this.getCachedCellVerticalPosition(e,r,u,v),N=k-$+1,J=N%2===0,F=$+Math.ceil(N/2)-1,zt=Nt(h,u,R),A=this.alignCellContent(v,zt),P=A.length;if(O&&J&&r===F)p=W(A[0]??"",this.#t.borderColor);else{let L=0;for(let ot=$;ot<=r;ot+=1)L+=i[ot]??1,ot<r&&(L+=1);const Yt=L;if(Yt>=0&&Yt<P)p=W(A[Yt]??"",this.#t.foregroundColor);else{const ot=h.slice(u,u+R).reduce((si,ai)=>si+ai,0)+(R-1)*(this.#t.gap+this.#t.border.bodyJoin.width);p=W(" ".repeat(ot),this.#t.borderColor)}}f.push(W(p,this.#t.backgroundColor))}else{const O=[];for(let $=u;$<u+R;$+=1){const k=h[$]??0,N=d>0?l:" ";if(O.push(N.repeat(k+this.#t.gap)),$<u+R-1){const J=this.determineJoinChar(s,e,r,o,$,$+1);J.width>0&&O.push(J.char)}}p=O.join(""),f.push(W(W(p,this.#t.borderColor),this.#t.backgroundColor))}const j=u+R-1;if(j<this.#t.columns-1){const O=this.determineJoinChar(s,e,r,o,j,j+1);O.width>0&&f.push(W(W(O.char,this.#t.borderColor),this.#t.backgroundColor))}u+=R-1}return b&&f.push(W(W(b,this.#t.borderColor),this.#t.backgroundColor)),f.join("")}determineJoinChar(e,i,r,h,s,o=-1){if(!this.#t.showBorders||!this.#t.border)return{char:" ",width:this.#t.gap};const a=this.#t.border;if(e!=="middle"){const B=nt(a,e),R=i[r]?.[s]??void 0,j=o===-1?s+1:o,O=i[r]?.[j]??void 0,$=R!==void 0&&O!==void 0&&R===O?B.body:B.join,{char:k,width:N}=$;return{char:k,width:N>0?N:this.#t.gap}}if(h===-1||o===-1)return{char:" ",width:this.#t.gap};const n=a.bodyJoin,l=i[r]?.[s]??void 0,d=i[h]?.[s]??void 0,c=i[r]?.[o]??void 0,m=i[h]?.[o]??void 0,b=l!==void 0&&d!==void 0&&l===d,f=c!==void 0&&m!==void 0&&c===m,g=l!==void 0&&c!==void 0&&l===c,p=d!==void 0&&m!==void 0&&d===m;let u;const x=nt(a,"middle");b&&f?u=g?{char:" ",width:n.width}:n:b?u=a.joinLeft:f?u=a.joinRight:g&&p?u=x.body:g?u=a.topJoin:p?u=a.bottomJoin:u=a.joinJoin;const{char:w,width:v}=u;return{char:w,width:v>0?v:this.#t.gap}}renderGrid(e,i){if(e.length===0)return"";const r=[],h=Do(e,i,this.#t,this.alignCellContent.bind(this),st),s=this.#t.showBorders&&this.#t.border?nt(this.#t.border,"top"):void 0;s&&s.body.width>0&&r.push(this.renderHorizontalBorder(e,h,0,i,"top"));for(let a=0;a<e.length;a+=1){const n=h[a]??1;for(let d=0;d<n;d+=1)r.push(this.renderVisualRowContent(e,a,d,i,h));const l=this.#t.showBorders&&this.#t.border?nt(this.#t.border,"middle"):void 0;if(a<e.length-1&&l&&l.body.width>0){const d=e[a],c=e[a+1];let m=!1;if(d&&c)for(let b=0;b<this.#t.columns;b+=1){const f=d[b],g=c[b];if(f!==g){m=!0;break}}m&&r.push(this.renderHorizontalBorder(e,h,a,i,"middle",a+1))}}const o=this.#t.showBorders&&this.#t.border?nt(this.#t.border,"bottom"):void 0;return o&&o.body.width>0&&r.push(this.renderHorizontalBorder(e,h,e.length-1,i,"bottom")),r.join(`
12
- `)}getCachedCellVerticalPosition(e,i,r,h){const s=this.#i.get(h);if(s)return s;const o=re(e,i,r,h);return this.#i.set(h,o),o}}le(t=>new Dt(t),"createGrid");const tn={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"└",width:1},bottomRight:{char:"┘",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"┌",width:1},topRight:{char:"┐",width:1}},yn={bodyJoin:{char:" ",width:1},bodyLeft:{char:" ",width:1},bodyRight:{char:" ",width:1},bottomBody:{char:"-",width:1},bottomJoin:{char:"-",width:1},bottomLeft:{char:"-",width:1},bottomRight:{char:"-",width:1},joinBody:{char:"-",width:1},joinJoin:{char:"-",width:1},joinLeft:{char:"-",width:1},joinRight:{char:"-",width:1},topBody:{char:"-",width:1},topJoin:{char:"-",width:1},topLeft:{char:"-",width:1},topRight:{char:"-",width:1}},vn={bodyJoin:{char:"║",width:1},bodyLeft:{char:"║",width:1},bodyRight:{char:"║",width:1},bottomBody:{char:"═",width:1},bottomJoin:{char:"╩",width:1},bottomLeft:{char:"╚",width:1},bottomRight:{char:"╝",width:1},joinBody:{char:"═",width:1},joinJoin:{char:"╬",width:1},joinLeft:{char:"╠",width:1},joinRight:{char:"╣",width:1},topBody:{char:"═",width:1},topJoin:{char:"╦",width:1},topLeft:{char:"╔",width:1},topRight:{char:"╗",width:1}},xn={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"╰",width:1},bottomRight:{char:"╯",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"╭",width:1},topRight:{char:"╮",width:1}},Bn={bodyJoin:{char:"┊",width:1},bodyLeft:{char:"┊",width:1},bodyRight:{char:"┊",width:1},bottomBody:{char:"┈",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"└",width:1},bottomRight:{char:"┘",width:1},joinBody:{char:"┈",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"┈",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"┌",width:1},topRight:{char:"┐",width:1}},Rn={bodyJoin:{char:"|",width:1},bodyLeft:{char:"|",width:1},bodyRight:{char:"|",width:1},bottomBody:{char:"-",width:1},bottomJoin:{char:"|",width:1},bottomLeft:{char:"|",width:1},bottomRight:{char:"|",width:1},joinBody:{char:"-",width:1},joinJoin:{char:"|",width:1},joinLeft:{char:"|",width:1},joinRight:{char:"|",width:1},topBody:{char:"-",width:1},topJoin:{char:"|",width:1},topLeft:{char:"|",width:1},topRight:{char:"|",width:1}},Wn={bodyJoin:{char:"|",width:1},bodyLeft:{char:"|",width:1},bodyRight:{char:"|",width:1},bottomBody:{char:"-",width:1},bottomJoin:{char:"+",width:1},bottomLeft:{char:"+",width:1},bottomRight:{char:"+",width:1},joinBody:{char:"-",width:1},joinJoin:{char:"+",width:1},joinLeft:{char:"+",width:1},joinRight:{char:"+",width:1},topBody:{char:"-",width:1},topJoin:{char:"+",width:1},topLeft:{char:"+",width:1},topRight:{char:"+",width:1}},Sn={bodyJoin:{char:"",width:0},bodyLeft:{char:"",width:0},bodyRight:{char:"",width:0},bottomBody:{char:"",width:0},bottomJoin:{char:"",width:0},bottomLeft:{char:"",width:0},bottomRight:{char:"",width:0},joinBody:{char:"",width:0},joinJoin:{char:"",width:0},joinLeft:{char:"",width:0},joinRight:{char:"",width:0},topBody:{char:"",width:0},topJoin:{char:"",width:0},topLeft:{char:"",width:0},topRight:{char:"",width:0}},jn={bodyJoin:{char:"█",width:1},bodyLeft:{char:"█",width:1},bodyRight:{char:"█",width:1},bottomBody:{char:"█",width:1},bottomJoin:{char:"█",width:1},bottomLeft:{char:"█",width:1},bottomRight:{char:"█",width:1},joinBody:{char:"█",width:1},joinJoin:{char:"█",width:1},joinLeft:{char:"█",width:1},joinRight:{char:"█",width:1},topBody:{char:"█",width:1},topJoin:{char:"█",width:1},topLeft:{char:"█",width:1},topRight:{char:"█",width:1}},On={bodyJoin:{char:"┃",width:1},bodyLeft:{char:"┃",width:1},bodyRight:{char:"┃",width:1},bottomBody:{char:"━",width:1},bottomJoin:{char:"┻",width:1},bottomLeft:{char:"┗",width:1},bottomRight:{char:"┛",width:1},joinBody:{char:"━",width:1},joinJoin:{char:"╋",width:1},joinLeft:{char:"┣",width:1},joinRight:{char:"┫",width:1},topBody:{char:"━",width:1},topJoin:{char:"┳",width:1},topLeft:{char:"┏",width:1},topRight:{char:"┓",width:1}};var en=Object.defineProperty,oi=E((t,e)=>en(t,"name",{value:e,configurable:!0}),"p"),rn=Object.defineProperty,de=oi((t,e)=>rn(t,"name",{value:e,configurable:!0}),"g"),on=Object.defineProperty,nn=de((t,e)=>on(t,"name",{value:e,configurable:!0}),"u");const sn=nn(t=>t.reduce((e,i)=>i===null?e+1:typeof i=="object"&&!Array.isArray(i)?(i.colSpan??=1,i.colSpan<=0?e+1:e+i.colSpan):e+1,0),"computeRowLogicalWidth");var an=Object.defineProperty,ni=de((t,e)=>an(t,"name",{value:e,configurable:!0}),"b");class hn{static{E(this,"H")}static{oi(this,"$")}static{de(this,"Table")}static{ni(this,"Table")}#t;#o=[];#e=[];#n=[];#i=!0;#r=void 0;constructor(e={}){this.#t={...e,showFooter:e.showFooter??!0,showHeader:e.showHeader??!0,style:{border:tn,paddingLeft:1,paddingRight:1,...e.style}}}setHeaders(e){return e.length>0&&!Array.isArray(e[0])?this.#e=[e]:this.#e=e.map(i=>Array.isArray(i)?i:[i]),this.#i=!0,this.#r=void 0,this}setFooter(e){return e.length>0&&!Array.isArray(e[0])?this.#n=[e]:this.#n=e.map(i=>Array.isArray(i)?i:[i]),this.#i=!0,this.#r=void 0,this}addRow(e){if(!Array.isArray(e))throw new TypeError("Row must be an array");return this.#o.push(e),this.#i=!0,this.#r=void 0,this}addRows(...e){for(const i of e)this.addRow(i);return this.#i=!0,this.#r=void 0,this}toString(){if(!this.#i&&this.#r!==void 0)return this.#r;const e=this.#t.showHeader?this.#e:[],i=this.#t.showFooter?this.#n:[],r=[...e,...this.#o,...i];if(r.length===0)return this.#r="",this.#i=!1,"";let h=0;for(const c of r){const m=c;Array.isArray(m)?h=Math.max(h,sn(m)):console.error("Unexpected non-array element found while calculating columns:",m)}if(h===0)return this.#r="",this.#i=!1,"";let s;Array.isArray(this.#t.columnWidths)?s=this.#t.columnWidths.length>=h?this.#t.columnWidths.slice(0,h):[...this.#t.columnWidths,...Array.from({length:h-this.#t.columnWidths.length}).fill(void 0)]:typeof this.#t.columnWidths=="number"&&(s=Array.from({length:h}).fill(this.#t.columnWidths));let o;const a=r.length;if(Array.isArray(this.#t.rowHeights)?o=this.#t.rowHeights:typeof this.#t.rowHeights=="number"&&(o=Array.from({length:a}).fill(this.#t.rowHeights)),s&&Array.isArray(s)){const c=[...s];for(const m of r){const b=m;for(const[f,g]of b.entries()){let p={};if(typeof g=="object"&&g!==null&&!Array.isArray(g)){const{content:u,href:x,...w}=g;p=w}p.width!==void 0?c[f]=p.width:p.maxWidth!==void 0&&c[f]!==void 0&&(c[f]=Math.min(c[f],p.maxWidth))}}s=c}const n={autoFlow:"row",backgroundColor:this.#t.style?.backgroundColor,balancedWidths:this.#t.balancedWidths??!1,border:this.#t.style?.border,borderColor:this.#t.style?.borderColor,columns:h,fixedColumnWidths:s,fixedRowHeights:o,foregroundColor:this.#t.style?.foregroundColor,gap:this.#t.gap??0,maxWidth:this.#t.maxWidth,paddingLeft:this.#t.style?.paddingLeft,paddingRight:this.#t.style?.paddingRight,terminalWidth:this.#t.terminalWidth,truncate:this.#t.truncate??(s?.every(c=>typeof c=="number")||this.#t.maxWidth!==void 0&&!this.#t.balancedWidths),truncateOverflow:this.#t.truncateOverflow??!0,wordWrap:this.#t.wordWrap??!1},l=new Dt(n),d=[];for(const[c,m]of r.entries()){const b=m;if(!Array.isArray(b)){console.error("Skipping non-array row while creating GridItems:",b);continue}const f=this.#t.showHeader?this.#e.length:0,g=this.#o.length,p=this.#t.showHeader&&c<f,u=this.#t.showFooter&&c>=f+g,x=p&&b.length===1&&h>1,w=u&&b.length===1&&h>1;for(const v of b){let B=v,R={};if(typeof B=="object"&&B!==null&&!Array.isArray(B)){const{content:k,href:N,...J}=B;B=N?`\x1B]8;;${N}\x1B\\${String(k)}\x1B]8;;\x1B\\`:k,R=J}x&&(R.colSpan=h),w&&(R.colSpan=h);const j=this.#t.transformTabToSpace&&typeof B=="string"?B.replaceAll(" "," ".repeat(this.#t.transformTabToSpace)):B,{maxWidth:O,width:$}=R;d.push({backgroundColor:R.backgroundColor,colSpan:R.colSpan,content:j,foregroundColor:R.foregroundColor,hAlign:R.hAlign,maxWidth:O,rowSpan:R.rowSpan,truncate:R.truncate??(O===void 0?void 0:!0),vAlign:R.vAlign,width:$,wordWrap:R.wordWrap})}}return l.addItems(d),this.#r=l.toString(),this.#i=!1,this.#r}}const An=ni(t=>new hn(t),"createTable");export{ji as B,An as D,fn as E,hn as H,mn as I,gn as N,pn as P,On as R,bn as T,Rn as a,Wn as c,Bn as d,wn as e,U as g,yn as h,vn as i,dn as j,xn as o,un as q,Sn as r,tn as t,jn as w};
@@ -1,68 +0,0 @@
1
- var H=Object.defineProperty;var k=(e,r)=>H(e,"name",{value:r,configurable:!0});import{createRequire as F}from"node:module";import{c as z,d as v,a6 as U,n as y,y as W,aj as K,ak as G,al as Y,am as X}from"../packem_chunks/bin.js";const B=F(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return B(e)},"__cjs_getBuiltinModule"),{spawn:D,execFileSync:O}=$("node:child_process"),{existsSync:C}=$("node:fs"),{platform:J,homedir:R}=$("node:os"),{join:g}=$("node:path"),Q=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,Z=5e3,ee=1e4,re=3e5,te=4096,E=J()==="win32",M=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ae=Object.defineProperty,ne=k((e,r)=>ae(e,"name",{value:r,configurable:!0}),"A$1"),ie=Object.defineProperty,m=ne((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o"),oe=Object.defineProperty,se=m((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a$6");const ce={alternateCommands:[],buildArgs:se((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var le=Object.defineProperty,ue=m((e,r)=>le(e,"name",{value:r,configurable:!0}),"t$8");const de={alternateCommands:[],buildArgs:ue((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var me=Object.defineProperty,pe=m((e,r)=>me(e,"name",{value:r,configurable:!0}),"a$4");const ge={alternateCommands:["openai-codex"],buildArgs:pe((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var fe=Object.defineProperty,he=m((e,r)=>fe(e,"name",{value:r,configurable:!0}),"l");const ve={alternateCommands:[],buildArgs:he((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var ye=Object.defineProperty,be=m((e,r)=>ye(e,"name",{value:r,configurable:!0}),"n$2");const ke={alternateCommands:[],buildArgs:be((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var we=Object.defineProperty,Ae=m((e,r)=>we(e,"name",{value:r,configurable:!0}),"t$5");const $e={alternateCommands:["cursor"],buildArgs:Ae((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Se=Object.defineProperty,Pe=m((e,r)=>Se(e,"name",{value:r,configurable:!0}),"i");const Ce={alternateCommands:[],buildArgs:Pe((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var je=Object.defineProperty,Te=m((e,r)=>je(e,"name",{value:r,configurable:!0}),"o$1");const Oe={alternateCommands:["gemini-cli"],buildArgs:Te((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Re=Object.defineProperty,Ee=m((e,r)=>Re(e,"name",{value:r,configurable:!0}),"o");const Me={alternateCommands:[],buildArgs:Ee((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var _e=Object.defineProperty,xe=m((e,r)=>_e(e,"name",{value:r,configurable:!0}),"r");const Ie={alternateCommands:[],buildArgs:xe((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Ne=Object.defineProperty,Le=m((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"n");const qe={alternateCommands:["qwen-code"],buildArgs:Le((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var Ve=Object.defineProperty,f=m((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"s");const _={amp:ce,claude:de,codex:ge,copilot:ve,crush:ke,cursor:$e,droid:Ce,gemini:Oe,kimi:Me,opencode:Ie,qwen:qe},j=f(e=>e.startsWith("~")?g(R(),e.slice(1)):e,"resolveHome"),He=f(e=>{try{const r=O(E?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:Z}).trim().split(`
2
- `)[0]?.trim();return r&&r.length>0?r:void 0}catch{return}},"whichCommand"),Fe=f(e=>{const r=R();if(E){const a=process.env.APPDATA??"",t=process.env.LOCALAPPDATA??"",n=process.env.ProgramFiles??"";return[g(a,"npm",`${e}.cmd`),g(a,"npm",e),g(t,"Programs",e,`${e}.exe`),g(n,e,`${e}.exe`),g(r,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,g(r,".npm-global","bin",e),g(r,".local","bin",e),g(r,".cargo","bin",e)]},"getKnownPaths"),S=f(e=>{try{const r=O(e,["--version"],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}),a=Q.exec(r);return a?a[1]:void 0}catch{return}},"detectVersion"),x=f(e=>{const r=_[e],a={available:!1,name:e},t=process.env[r.envVariable];if(t&&C(j(t))){const i=j(t);return{...a,available:!0,detectionMethod:"envvar",path:i,version:S(i)}}const n=[r.command,...r.alternateCommands];for(const i of n){const o=He(i);if(o)return{...a,available:!0,detectionMethod:"which",path:o,version:S(o)}}for(const i of n)for(const o of Fe(i))if(C(o))return{...a,available:!0,detectionMethod:"known-path",path:o,version:S(o)};return a},"detectProvider"),Be=f(()=>M.map(e=>x(e)),"detectAllProviders"),De=f(()=>Be().filter(e=>e.available),"detectAvailableProviders"),Je=f((e,r,a={})=>{const t=_[e],n=a.model??t.defaultModel,i=a.maxTokens??te;return t.buildArgs(r,n,i)},"buildCliArgs"),ze=f(async(e,r,a={})=>{if(!e.available||!e.path)throw new Error(`AI provider "${e.name}" is not available.`);const t=Je(e.name,r,a),n=a.timeoutMs??re;return new Promise((i,o)=>{const p={env:{...process.env,FORCE_COLOR:"0",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]},s=D(e.path,t,p);s.stdin.end();let c="",d="",u=!1;const b=setTimeout(()=>{u=!0,s.kill("SIGTERM"),o(new Error(`${e.name} CLI timed out after ${String(n)}ms`))},n);s.stdout.on("data",h=>{c+=h.toString("utf8")}),s.stderr.on("data",h=>{d+=h.toString("utf8")}),s.on("close",h=>{clearTimeout(b),!u&&(h===0?i({provider:e.name,stderr:d,stdout:c}):o(new Error(`${e.name} CLI exited with code ${String(h)}: ${d||c}`)))}),s.on("error",h=>{clearTimeout(b),u||o(new Error(`Failed to spawn ${e.name} CLI: ${h.message}`))})})},"runProvider");var Ue=Object.defineProperty,I=k((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"i");const We=12e4,Ke=2,Ge=1e3,Ye=I(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),N=I(async(e,r,a=Ke)=>{let t;for(let n=0;n<=a;n+=1)try{return(await ze(e,r,{timeoutMs:We})).stdout}catch(i){if(t=i instanceof Error?i:new Error(String(i)),t.message.includes("timed out"))throw t;if(n<a){const o=Ge*2**n;await Ye(o)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var Xe=Object.defineProperty,l=k((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"c");const Qe={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Ze=l(e=>{if(e?.provider){if(!M.includes(e.provider))return;const t=x(e.provider);return t.available?t:void 0}const r=De();if(r.length===0)return;const a={...Qe,...e?.priority};return r.toSorted((t,n)=>(a[n.name]??0)-(a[t.name]??0))[0]},"resolveProvider"),er=new Set(["defer","review","skip","update"]),rr=new Set(["critical","high","low","medium"]),tr=new Set(["high","low","medium"]),ar=50,P=30,nr=l(e=>e.map(r=>{const a=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(n=>`${n.severity} ${n.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const n=Math.round(r.socketReport.score.overall*100),i=[`score:${String(n)}%`];if(r.socketReport.alerts.length>0){const o={};for(const s of r.socketReport.alerts)o[s.severity]=(o[s.severity]??0)+1;const p=Object.entries(o).map(([s,c])=>`${String(c)} ${s}`).join(", ");i.push(`alerts: ${p}`)}i.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${a}${t}`}).join(`
3
- `),"buildPackageList"),A=`Respond ONLY with valid JSON in this exact structure:
4
- {
5
- "summary": "Brief overall summary",
6
- "recommendations": [
7
- {
8
- "package": "package-name",
9
- "action": "update|skip|review|defer",
10
- "reason": "explanation",
11
- "riskLevel": "low|medium|high|critical",
12
- "breakingChanges": ["change1"],
13
- "effort": "low|medium|high"
14
- }
15
- ],
16
- "warnings": ["warning1"]
17
- }`,ir={compatibility:l(e=>`Analyze the compatibility of these package updates:
18
-
19
- ${e}
20
-
21
- For each package:
22
- 1. Check peer dependency compatibility
23
- 2. Identify potential conflicts with other packages in the list
24
- 3. Assess API compatibility between current and target versions
25
- 4. Check for deprecated features being removed
26
- 5. Evaluate Node.js version requirements
27
-
28
- ${A}`,"compatibility"),impact:l(e=>`Analyze the impact of updating these npm packages:
29
-
30
- ${e}
31
-
32
- For each package, provide:
33
- 1. Risk level (low/medium/high/critical)
34
- 2. Recommended action (update/skip/review/defer)
35
- 3. Reason for recommendation
36
- 4. Known breaking changes (if any)
37
- 5. Estimated migration effort (low/medium/high)
38
-
39
- ${A}`,"impact"),recommend:l(e=>`Provide smart recommendations for updating these packages:
40
-
41
- ${e}
42
-
43
- Consider:
44
- 1. Update priority based on security, features, and stability
45
- 2. Grouping related packages for atomic updates
46
- 3. Best practices for the specific package ecosystem
47
- 4. Risk vs. benefit analysis
48
- 5. Suggested update order
49
- 6. If Socket.dev scores are provided, prioritize packages with low supply chain or quality scores
50
-
51
- ${A}`,"recommend"),security:l(e=>`Analyze the security implications of these package updates:
52
-
53
- ${e}
54
-
55
- For each package:
56
- 1. Check if the update fixes known vulnerabilities (use the vulnerability data above)
57
- 2. Assess if the new version introduces security risks
58
- 3. Evaluate if this is a security-sensitive package (auth, crypto, session, etc.)
59
- 4. Recommend urgency of the update based on vulnerability severity
60
- 5. Flag any packages where skipping the update poses security risk
61
- 6. If Socket.dev scores are provided, factor in supply chain and quality scores — low scores indicate higher risk
62
-
63
- ${A}`,"security")},or=new Set(["compatibility","impact","recommend","security"]),yr=l(e=>or.has(e)?e:"impact","validateAnalysisType"),L=l((e,r="impact")=>{const a=nr(e);return ir[r](a)},"buildAnalysisPrompt"),sr=/```(?:json)?\s*([\s\S]*?)```/,cr=/\{[\s\S]*\}/,lr=l(e=>{try{return JSON.parse(e)}catch{}const r=sr.exec(e);if(r?.[1])try{return JSON.parse(r[1])}catch{}const a=cr.exec(e);if(a?.[0])try{return JSON.parse(a[0])}catch{}},"extractJson"),ur=l(e=>({action:er.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:tr.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:rr.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),q=l((e,r,a)=>{const t=lr(e);if(!t||typeof t!="object")return{analysisType:a,provider:r,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const n=t,i=Array.isArray(n.recommendations)?n.recommendations:[];return{analysisType:a,provider:r,recommendations:i.map(o=>ur(o)),summary:typeof n.summary=="string"?n.summary:"",warnings:Array.isArray(n.warnings)?n.warnings:[]}},"parseAiResponse"),dr={eslint:["ESLint 9.0: Flat config required","ESLint 8.0+: New rule formats"],next:["Next.js 13+: App router changes","Next.js 14+: Server components default"],react:["React 17 to 18: Concurrent features","React 18+: Strict mode changes"],typescript:["TypeScript 5.0: New decorators","TypeScript 4.7+: ESM changes"],vite:["Vite 5: Node.js 18+ required"],vue:["Vue 3: Composition API","Vue 3: Breaking template changes"],webpack:["Webpack 5: Node.js polyfills removed"]},mr=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),T=l((e,r)=>{const a=e.map(t=>{const n=t.vulnerabilities&&t.vulnerabilities.length>0,i=mr.has(t.packageName),o=dr[t.packageName]??[];let p="low",s="update",c="low",d="Patch/minor update, safe to apply.";return t.updateType==="major"?(p="high",s=o.length>0?"review":"update",c="medium",d=o.length>0?`Major update with known breaking changes: ${o[0]}`:"Major version update, review changelog before applying."):t.updateType==="minor"&&(p="medium",d="Minor update, generally safe."),n&&(p="high",s="update",d="Security update — current version has known vulnerabilities."),i&&t.updateType==="major"&&(s="review",d="Security-sensitive package with major update, careful review needed.",c="high"),{action:s,breakingChanges:o,effort:c,package:t.packageName,reason:d,riskLevel:p}});return{analysisType:r,provider:"rule-engine",recommendations:a,summary:`Rule-based ${r} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),pr=l(async(e,r,a)=>{const t=L(r,a),n=await N(e,t);return q(n,e.name,a)},"analyzeChunk"),gr=l((e,r,a)=>{const t=[],n=[],i=[];for(const o of e)t.push(...o.recommendations),n.push(...o.warnings),o.summary&&i.push(o.summary);return{analysisType:a,provider:r,recommendations:t,summary:i.length===1?i[0]??"":`Analyzed ${String(t.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(n)]}},"mergeResults"),V={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},br=l(e=>{const r=`${V[e.analysisType]??e.analysisType} Analysis (${e.provider})`,a=e.recommendations.flatMap(n=>{const i=[{action:n.action,effort:n.effort,package:n.package,reason:n.reason,risk:n.riskLevel}];return n.breakingChanges.length>0&&i.push({action:"",effort:"",package:"",reason:`Breaking: ${n.breakingChanges.join("; ")}`,risk:""}),i}),t=process.stdout.columns||80;return z(v.createElement(U,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},v.createElement(y,{bold:!0},r),v.createElement(y,null,""),v.createElement(y,null,e.summary),v.createElement(y,null,""),v.createElement(W,{borderStyle:"none",data:a}),...e.warnings.length>0?[v.createElement(y,null,""),...e.warnings.map((n,i)=>v.createElement(y,{dimColor:!0,key:String(i)},` ${n}`))]:[]),{columns:t})},"formatAiAnalysis");l(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const kr=l(async(e,r,a,t="impact")=>{const n=Ze(a);if(!n)return r.info(`No AI CLI tool found, using rule-based analysis.
64
- `),T(e,t);const i=K(n.name,t,e),o=G(i);if(o)return r.info(`Using cached ${t} analysis from ${o.provider}.
65
- `),o;const p=V[t]??t;r.info(`Running ${p.toLowerCase()} analysis with ${n.name}...
66
- `);try{let s;if(e.length>ar){r.info(`Splitting ${String(e.length)} packages into batches of ${String(P)}...
67
- `);const c=[];for(let u=0;u<e.length;u+=P)c.push(e.slice(u,u+P));const d=[];for(let u=0;u<c.length;u+=1){r.info(` Batch ${String(u+1)}/${String(c.length)}...`);const b=c[u];b&&d.push(await pr(n,b,t))}s=gr(d,n.name,t)}else{const c=await N(n,L(e,t));s=q(c,n.name,t)}return Y(i,s,X(t,a?.cacheTtl)),s}catch(s){const c=s instanceof Error?s.message:String(s);return r.warn(`AI analysis failed (${c}), falling back to rule engine.
68
- `),T(e,t)}},"runAiAnalysis");export{yr as H,ze as O,Qe as R,br as Z,Be as _,Ze as b,kr as e,N as r,lr as w};