@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
@@ -1 +1 @@
1
- var v=Object.defineProperty;var a=(e,r)=>v(e,"name",{value:r,configurable:!0});import{createRequire as _}from"node:module";import{n as j,d as R}from"../packem_chunks/config.js";import{i as h,M as m}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{h as K}from"../packem_chunks/bin.js";const k=_(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=a(e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[r,t]=n.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return n.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{rmSync:d,writeFileSync:C}=b("node:fs");var M=Object.defineProperty,o=a((e,r)=>M(e,"name",{value:r,configurable:!0}),"r");const w=1440*60*1e3,A=15e3,S="https://registry.npmjs.org/-/npm/v1/keys",p=o(()=>m(K(),"registry-keys"),"getRegistryKeysCacheDir"),c=o(()=>m(p(),"npmjs.json"),"cacheFilePath"),T=o(()=>{const e=c();if(h(e))try{const r=j(e),t=Date.now()-r.createdAt>r.ttlMs;return{entry:r,expired:t}}catch{d(e,{force:!0});return}},"readCachedKeys"),D=o((e,r)=>{R(p());const t={createdAt:Date.now(),keys:e,ttlMs:r};C(c(),JSON.stringify(t),"utf8")},"writeCachedKeys"),N=o(async(e={})=>{const r=e.ttlMs??w,t=e.keysUrl??process.env.VIS_NPM_KEYS_URL??S,s=T();if(s!==void 0&&!s.expired&&e.forceRefresh!==!0)return{fromCache:!0,keys:s.entry.keys};const i=new AbortController,g=setTimeout(()=>{i.abort()},A),y=o(()=>{i.abort()},"abortListener");e.signal?.addEventListener("abort",y,{once:!0});try{const f=await fetch(t,{headers:{Accept:"application/json"},signal:i.signal});if(!f.ok)return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0;const u=await f.json(),l=Array.isArray(u.keys)?u.keys:[];return D(l,r),{fromCache:!1,keys:l}}catch{return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0}finally{clearTimeout(g),e.signal?.removeEventListener("abort",y)}},"fetchRegistryKeys"),B=o(()=>{const e=c();return h(e)?(d(e,{force:!0}),!0):!1},"clearRegistryKeysCache");export{B as c,N as f};
1
+ var v=Object.defineProperty;var a=(e,r)=>v(e,"name",{value:r,configurable:!0});import{createRequire as _}from"node:module";import{n as j,b as R}from"../packem_chunks/config.js";import{i as d,M as h}from"./readFileSync-4c_c6Qey-6SWMDNdw.js";import{m as K}from"../packem_chunks/bin.js";const k=_(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=a(e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[r,t]=n.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return n.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{rmSync:m,writeFileSync:C}=b("node:fs");var M=Object.defineProperty,o=a((e,r)=>M(e,"name",{value:r,configurable:!0}),"r");const w=1440*60*1e3,A=15e3,S="https://registry.npmjs.org/-/npm/v1/keys",p=o(()=>h(K(),"registry-keys"),"getRegistryKeysCacheDir"),c=o(()=>h(p(),"npmjs.json"),"cacheFilePath"),T=o(()=>{const e=c();if(d(e))try{const r=j(e),t=Date.now()-r.createdAt>r.ttlMs;return{entry:r,expired:t}}catch{m(e,{force:!0});return}},"readCachedKeys"),D=o((e,r)=>{R(p());const t={createdAt:Date.now(),keys:e,ttlMs:r};C(c(),JSON.stringify(t),"utf8")},"writeCachedKeys"),N=o(async(e={})=>{const r=e.ttlMs??w,t=e.keysUrl??process.env.VIS_NPM_KEYS_URL??S,s=T();if(s!==void 0&&!s.expired&&e.forceRefresh!==!0)return{fromCache:!0,keys:s.entry.keys};const i=new AbortController,g=setTimeout(()=>{i.abort()},A),y=o(()=>{i.abort()},"abortListener");e.signal?.addEventListener("abort",y,{once:!0});try{const f=await fetch(t,{headers:{Accept:"application/json"},signal:i.signal});if(!f.ok)return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0;const u=await f.json(),l=Array.isArray(u.keys)?u.keys:[];return D(l,r),{fromCache:!1,keys:l}}catch{return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0}finally{clearTimeout(g),e.signal?.removeEventListener("abort",y)}},"fetchRegistryKeys"),B=o(()=>{const e=c();return d(e)?(m(e,{force:!0}),!0):!1},"clearRegistryKeysCache");export{B as c,N as f};
@@ -1,4 +1,4 @@
1
- var S=Object.defineProperty;var g=(e,a)=>S(e,"name",{value:a,configurable:!0});import{createRequire as C}from"node:module";import{s as _,i as P,p as y}from"../packem_chunks/bin.js";import{h as O,M as V,r as F,a as L,b as I,c as B,d as W,e as U,f as Y}from"./s1ngularity-DlS-4a6K.js";import{m as f,D as v,g as k,r as q}from"./provenance-DbkJRDqt.js";import{r as H}from"./signatures-B-1u4t-c.js";import{s as z}from"./pm-runner-COoPLGKi.js";import{d as G}from"./utils-DrNg0XTR.js";const E=C(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=g(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[a,s]=w.versions.node.split(".").map(Number);if(a>22||a===22&&s>=3||a===20&&s>=16)return w.getBuiltinModule(e)}return E(e)},"__cjs_getBuiltinModule"),{createInterface:x}=j("node:readline");var J=Object.defineProperty,m=g((e,a)=>J(e,"name",{value:a,configurable:!0}),"s");const K=15,Q=m(e=>{if(e===void 0)return!1;const a=e.trim().toLowerCase();return a!==""&&a!=="0"&&a!=="false"&&a!=="no"},"isTruthyEnv"),X=m(e=>{const a=(e.TERM??"").toLowerCase();return a!=="dumb"&&a!=="unknown"&&a!==""},"shouldAnimateCountdown"),Z=m(async e=>{const a=x({input:process.stdin,output:process.stdout});try{return await new Promise(s=>{a.question(e,r=>{s(r.trim().toLowerCase())})})}finally{a.close()}},"defaultReadline"),N=m(async(e,a)=>{const s=await a(e);return s==="y"||s==="yes"},"promptYesNo"),ee=m(async(e,a,s,r)=>new Promise(c=>{if(r?.aborted){c(!1);return}const o=X(s)&&a.isTTY!==!1;let n=e;const i=m(()=>{o?a.write(`\rContinuing in ${String(n)}s... press Ctrl-C to abort. `):n===e&&a.write(`Warnings present; proceeding in ${String(e)}s.
1
+ var S=Object.defineProperty;var g=(e,a)=>S(e,"name",{value:a,configurable:!0});import{createRequire as C}from"node:module";import{s as _,i as P,p as y}from"../packem_chunks/bin.js";import{h as O,M as V,r as F,a as L,b as I,c as B,d as W,e as U,f as Y}from"./s1ngularity-CIX7UcT5.js";import{m as f,D as v,g as k,r as q}from"./provenance-DoEp2uOo.js";import{r as H}from"./signatures-BHM7cnqB.js";import{s as z}from"./pm-runner-Ta_yz2uP.js";import{d as G}from"./utils-DrNg0XTR.js";const E=C(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=g(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[a,s]=w.versions.node.split(".").map(Number);if(a>22||a===22&&s>=3||a===20&&s>=16)return w.getBuiltinModule(e)}return E(e)},"__cjs_getBuiltinModule"),{createInterface:x}=j("node:readline");var J=Object.defineProperty,m=g((e,a)=>J(e,"name",{value:a,configurable:!0}),"s");const K=15,Q=m(e=>{if(e===void 0)return!1;const a=e.trim().toLowerCase();return a!==""&&a!=="0"&&a!=="false"&&a!=="no"},"isTruthyEnv"),X=m(e=>{const a=(e.TERM??"").toLowerCase();return a!=="dumb"&&a!=="unknown"&&a!==""},"shouldAnimateCountdown"),Z=m(async e=>{const a=x({input:process.stdin,output:process.stdout});try{return await new Promise(s=>{a.question(e,r=>{s(r.trim().toLowerCase())})})}finally{a.close()}},"defaultReadline"),N=m(async(e,a)=>{const s=await a(e);return s==="y"||s==="yes"},"promptYesNo"),ee=m(async(e,a,s,r)=>new Promise(c=>{if(r?.aborted){c(!1);return}const o=X(s)&&a.isTTY!==!1;let n=e;const i=m(()=>{o?a.write(`\rContinuing in ${String(n)}s... press Ctrl-C to abort. `):n===e&&a.write(`Warnings present; proceeding in ${String(e)}s.
2
2
  `)},"render");i();const d=setInterval(()=>{if(n-=1,n<=0){clearInterval(d),r?.removeEventListener("abort",l),o&&a.write(`\rContinuing now.
3
3
  `),c(!0);return}i()},1e3),l=m(()=>{clearInterval(d),o&&a.write(`\rAborted.
4
4
  `),c(!1)},"onAbort");r?.addEventListener("abort",l,{once:!0})}),"runCountdown"),ae=m(async(e,a={})=>{if(e.length===0)return{proceed:!0};const s=a.env??process.env,r=a.isTty??!!process.stdin.isTTY,c=a.isCi??_,o=a.strict??!1,n=a.readline??Z,i=a.output??{isTTY:!!process.stdout.isTTY,write:m(u=>process.stdout.write(u),"write")},d=Q(s.VIS_DISABLE_AUTO_CONTINUE),l=Number.parseInt(s.VIS_AUTO_CONTINUE_SECONDS??"",10),t=a.countdownSeconds??(Number.isFinite(l)&&l>0?l:K);return e.some(u=>u.severity==="error")?o?{proceed:!1,reason:"errors-present"}:c?{proceed:!1,reason:"errors-present"}:r?await N("Proceed despite errors? [y/N] ",n)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:{proceed:!1,reason:"non-tty"}:o?{proceed:!1,reason:"ci-strict"}:r?d?await N("Proceed despite warnings? [y/N] ",n)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:await ee(t,i,s,a.signal)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:{proceed:!0}},"presentMarshallDecision"),Oe=m(async(e,a={})=>{if(e.isEmpty())return!0;const s=e.all(),r=a.output??{isTTY:!!process.stdout.isTTY,write:m(c=>process.stdout.write(c),"write")};for(const c of O(s))r.write(`${c}
@@ -1 +1 @@
1
- var h=Object.defineProperty;var f=(n,r)=>h(n,"name",{value:r,configurable:!0});import{M as m,i as k,$ as v}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as M}from"../packem_chunks/config.js";import{whichBin as $}from"#native";var b=Object.defineProperty,g=f((n,r)=>b(n,"name",{value:r,configurable:!0}),"p");const j=g(n=>{for(const r of[".nvmrc",".node-version"]){const i=m(n,r);if(k(i))try{return v(i).trim().replace(/^v/,"")}catch{}}},"readNodeVersionFile"),l=g((n,r)=>{const i=n.split(/[.\-+]/).map(s=>Number.parseInt(s,10)||0),o=r.split(/[.\-+]/).map(s=>Number.parseInt(s,10)||0),e=Math.max(i.length,o.length);for(let s=0;s<e;s++){const t=i[s]??0,a=o[s]??0;if(t!==a)return t-a}return 0},"compareVersions"),y=g((n,r)=>{const i=r.trim();if(i===""||i==="*")return!0;const o=i.split(/\s+/).filter(Boolean);for(const e of o)if(e.startsWith(">=")){if(l(n,e.slice(2).trim())<0)return!1}else if(e.startsWith("<=")){if(l(n,e.slice(2).trim())>0)return!1}else if(e.startsWith(">")){if(l(n,e.slice(1).trim())<=0)return!1}else if(e.startsWith("<")){if(l(n,e.slice(1).trim())>=0)return!1}else if(/^\d/.test(e)){const s=n.split("."),t=e.split(".");for(const[a,c]of t.entries())if(c!==s[a])return!1}return!0},"satisfiesRange"),V=g(n=>{const r=[],i=m(n,"package.json");let o;try{o=M(i)}catch{return r}const e=process.versions.node;if(o.engines?.node){const t=o.engines.node;y(e,t)||r.push({actual:e,expected:t,kind:"node",message:`package.json engines.node requires ${t}, but the current Node.js is ${e}.`,severity:"error"})}const s=j(n);if(s){const[t,a]=s.split("."),[c,p]=e.split(".");(t!==c||a!==void 0&&a!==p)&&r.push({actual:e,expected:s,kind:"node",message:`.nvmrc pins Node ${s} but the current Node.js is ${e}. Run \`nvm use\` or switch runtimes.`,severity:"warning"})}if(o.packageManager){const[t,a]=o.packageManager.split("@"),c=(process.env.npm_config_user_agent??"").split(" ")[0]??"",[p,u]=c.split("/"),d=t==="aube"&&$("aube")!==null;p&&t&&p!==t?r.push({actual:p,expected:t,kind:"packageManager",message:`package.json packageManager pins ${o.packageManager} but the current invocation is ${c}. Install the correct package manager.`,severity:d?"warning":"error"}):u&&a&&u!==a&&r.push({actual:u,expected:a,kind:"packageManager",message:`package.json packageManager pins ${t}@${a} but the current invocation uses ${t}@${u}.`,severity:"warning"})}return r},"checkRuntimeVersions");export{V as c};
1
+ var h=Object.defineProperty;var f=(n,r)=>h(n,"name",{value:r,configurable:!0});import{M as m,i as k,$ as v}from"./readFileSync-4c_c6Qey-6SWMDNdw.js";import{n as M}from"../packem_chunks/config.js";import{whichBin as $}from"#native";var b=Object.defineProperty,g=f((n,r)=>b(n,"name",{value:r,configurable:!0}),"p");const j=g(n=>{for(const r of[".nvmrc",".node-version"]){const i=m(n,r);if(k(i))try{return v(i).trim().replace(/^v/,"")}catch{}}},"readNodeVersionFile"),l=g((n,r)=>{const i=n.split(/[.\-+]/).map(s=>Number.parseInt(s,10)||0),o=r.split(/[.\-+]/).map(s=>Number.parseInt(s,10)||0),e=Math.max(i.length,o.length);for(let s=0;s<e;s++){const t=i[s]??0,a=o[s]??0;if(t!==a)return t-a}return 0},"compareVersions"),y=g((n,r)=>{const i=r.trim();if(i===""||i==="*")return!0;const o=i.split(/\s+/).filter(Boolean);for(const e of o)if(e.startsWith(">=")){if(l(n,e.slice(2).trim())<0)return!1}else if(e.startsWith("<=")){if(l(n,e.slice(2).trim())>0)return!1}else if(e.startsWith(">")){if(l(n,e.slice(1).trim())<=0)return!1}else if(e.startsWith("<")){if(l(n,e.slice(1).trim())>=0)return!1}else if(/^\d/.test(e)){const s=n.split("."),t=e.split(".");for(const[a,c]of t.entries())if(c!==s[a])return!1}return!0},"satisfiesRange"),V=g(n=>{const r=[],i=m(n,"package.json");let o;try{o=M(i)}catch{return r}const e=process.versions.node;if(o.engines?.node){const t=o.engines.node;y(e,t)||r.push({actual:e,expected:t,kind:"node",message:`package.json engines.node requires ${t}, but the current Node.js is ${e}.`,severity:"error"})}const s=j(n);if(s){const[t,a]=s.split("."),[c,p]=e.split(".");(t!==c||a!==void 0&&a!==p)&&r.push({actual:e,expected:s,kind:"node",message:`.nvmrc pins Node ${s} but the current Node.js is ${e}. Run \`nvm use\` or switch runtimes.`,severity:"warning"})}if(o.packageManager){const[t,a]=o.packageManager.split("@"),c=(process.env.npm_config_user_agent??"").split(" ")[0]??"",[p,u]=c.split("/"),d=t==="aube"&&$("aube")!==null;p&&t&&p!==t?r.push({actual:p,expected:t,kind:"packageManager",message:`package.json packageManager pins ${o.packageManager} but the current invocation is ${c}. Install the correct package manager.`,severity:d?"warning":"error"}):u&&a&&u!==a&&r.push({actual:u,expected:a,kind:"packageManager",message:`package.json packageManager pins ${t}@${a} but the current invocation uses ${t}@${u}.`,severity:"warning"})}return r},"checkRuntimeVersions");export{V as c};
@@ -1 +1 @@
1
- var ie=Object.defineProperty;var p=(r,e)=>ie(r,"name",{value:e,configurable:!0});import{createRequire as oe}from"node:module";import{T as Q,e as j}from"./Table-CwC2kW07-EjFLNV0q.js";import{n as V,d as W}from"../packem_chunks/config.js";import{M as k,i as N}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{h as B,i as b}from"../packem_chunks/bin.js";import{m as D,D as M,g as S}from"./provenance-DbkJRDqt.js";import{s as g}from"./pm-runner-COoPLGKi.js";const ae=oe(import.meta.url),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=p(r=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,t]=E.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return E.getBuiltinModule(r)}return ae(r)},"__cjs_getBuiltinModule"),{rmSync:y,writeFileSync:L,readdirSync:U}=F("node:fs"),{createHash:ce}=F("node:crypto"),{Resolver:de}=F("node:dns/promises");var le=Object.defineProperty,I=p((r,e)=>le(r,"name",{value:e,configurable:!0}),"t$2");class mr{static{p(this,"MarshallFindings")}static{I(this,"MarshallFindings")}entries=[];add(e){this.entries.push(e)}addMany(e){for(const t of e)this.entries.push(t)}all(){return this.entries}errors(){return this.entries.filter(e=>e.severity==="error")}warnings(){return this.entries.filter(e=>e.severity==="warning")}hasErrors(){return this.entries.some(e=>e.severity==="error")}hasWarnings(){return this.entries.some(e=>e.severity==="warning")}isEmpty(){return this.entries.length===0}size(){return this.entries.length}}const pr=I(r=>{if(r.length===0)return[];const e=[],t=r.filter(s=>s.severity==="error"),n=r.filter(s=>s.severity==="warning");if(t.length>0){e.push(Q(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${Q("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${j("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(j(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${j("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${j("→")} ${s.suggestedAction}`)}return e},"formatMarshallFindingsAsTable"),gr=I(r=>({errors:r.filter(e=>e.severity==="error"),findings:[...r],summary:{errorCount:r.filter(e=>e.severity==="error").length,warningCount:r.filter(e=>e.severity==="warning").length},warnings:r.filter(e=>e.severity==="warning")}),"formatMarshallFindingsAsJson");var ue=Object.defineProperty,w=p((r,e)=>ue(r,"name",{value:e,configurable:!0}),"o$1");const he=1440*60*1e3,fe=15e3,ve="https://api.github.com/repos",H=w(()=>k(B(),"archived-repo"),"getArchivedRepoCacheDir"),te=w((r,e)=>k(H(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),"cacheFilePath"),me=w((r,e)=>{const t=te(r,e);if(N(t))try{const n=V(t);if(Date.now()-n.createdAt>n.ttlMs){y(t,{force:!0});return}return n}catch{y(t,{force:!0});return}},"readCachedRepo"),Z=w((r,e,t,n)=>{W(H());const s={createdAt:Date.now(),ttlMs:n,...t};L(te(r,e),JSON.stringify(s),"utf8")},"writeCachedRepo"),pe=w(r=>{if(typeof r!="string"||r.trim()==="")return;const e=r.trim().replace(/^git\+/,""),t=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(t)return{owner:t[1],repo:t[2]};const n=/^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(n)return{owner:n[1],repo:n[2]};const s=/^https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/?#]+?)(?:\.git)?\/?$/i.exec(e);if(s)return{owner:s[1],repo:s[2]}},"parseGitHubUrl"),ge=w(async(r,e,t,n)=>{const s=`${ve}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,c=new AbortController,o=setTimeout(()=>{c.abort()},fe),i=w(()=>{c.abort()},"abortListener");n?.addEventListener("abort",i,{once:!0});const a={Accept:"application/vnd.github+json","User-Agent":"visulima-vis-marshall"};t!==void 0&&t!==""&&(a.Authorization=`Bearer ${t}`);try{const d=await fetch(s,{headers:a,signal:c.signal});if(d.status===404)return{kind:"missing"};if(!d.ok)return{kind:"transient-error"};const l=await d.json(),u=l.archived===!0,h=typeof l.archived_at=="string"?l.archived_at:void 0;return{archived:u,archivedAt:h,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},"fetchGitHubRepo"),we=w((r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),"resolveLatestVersion"),wr=w(async(r,e={})=>{if(b("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??he,s=e.githubToken??process.env.GITHUB_TOKEN,c=e.concurrency??M,o=new Map,i=w(async(a,d)=>{const l=`${a}/${d}`;let u=o.get(l);return u===void 0&&(u=(async()=>{const h=me(a,d);if(h!==void 0)return h.missing===!0?{archived:!1,kind:"missing"}:{archived:h.archived,archivedAt:h.archivedAt,kind:"ok"};const f=await ge(a,d,s,e.signal);return f.kind==="missing"?Z(a,d,{archived:!1,missing:!0},n):f.kind==="ok"&&Z(a,d,{archived:f.archived===!0,archivedAt:f.archivedAt},n),f})(),o.set(l,u)),u},"fetchRepoOnce");return(await D(r,c,async({name:a,version:d})=>{if(t.has(a))return;const l=await S(a,{workspaceRoot:e.workspaceRoot});if(l===void 0)return;const u=l.versions[d]??l.versions[we(Object.keys(l.versions),l["dist-tags"]?.latest)??""];if(u===void 0)return;const h=pe(u.repository?.url);if(h===void 0)return;const f=await i(h.owner,h.repo);if(f.kind!=="transient-error"){if(f.kind==="missing")return{kind:"missing-repo",owner:h.owner,packageName:a,repo:h.repo};if(f.archived===!0)return{...f.archivedAt===void 0?{}:{archivedAt:f.archivedAt},kind:"archived",owner:h.owner,packageName:a,repo:h.repo}}})).filter(a=>a!==void 0)},"runArchivedRepoMarshall");w(()=>{const r=H();if(!N(r))return 0;let e=0;for(const t of U(r))t.endsWith(".json")&&(y(k(r,t),{force:!0}),e+=1);return e},"clearArchivedRepoCache");var ye=Object.defineProperty,O=p((r,e)=>ye(r,"name",{value:e,configurable:!0}),"h$1");const ke={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},$e=1440*60*1e3,J=O((r,e)=>(r-e)/$e,"daysBetween"),C=O(r=>{if(r!==void 0)return r.email??r.name},"userIdentity"),be=O((r,e,t,n,s)=>{const c=r.time?.[t];if(c===void 0)return;const o=new Date(c).getTime();if(!Number.isFinite(o))return;const i=J(n,o);if(i<s.recentVersionErrorDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (error threshold: ${String(s.recentVersionErrorDays)})`,packageName:e,severity:"error",version:t};if(i<s.recentVersionWarnDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (warn threshold: ${String(s.recentVersionWarnDays)})`,packageName:e,severity:"warning",version:t}},"checkRecentVersion"),De=O((r,e,t,n,s)=>{const c=r.versions[t],o=C(c?._npmUser);if(o===void 0)return;const i=Object.keys(r.versions).filter(u=>g.valid(u)!==null).filter(u=>g.lt(u,t));if(i.length===0||i.some(u=>C(r.versions[u]?._npmUser)===o))return;const a=r.time?.[i[0]??""];if(a===void 0)return;const d=new Date(a).getTime();if(!Number.isFinite(d))return;const l=J(n,d);if(!(l<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${l.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},"checkNewPublisher"),Me=O((r,e,t,n,s)=>{const c=r.versions[t],o=C(c?._npmUser);if(o===void 0)return;const i=[];for(const[l,u]of Object.entries(r.versions)){if(l===t||C(u._npmUser)!==o)continue;const h=r.time?.[l];if(h===void 0)continue;const f=new Date(h).getTime();Number.isFinite(f)&&i.push(f)}if(i.length===0)return;const a=Math.max(...i),d=J(n,a);if(d>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(d>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},"checkDormantMaintainer"),yr=O(async(r,e={})=>{if(b("author"))return[];const t=new Set(e.allowlist),n={...ke,...e.thresholds},s=e.now??(()=>Date.now()),c=e.concurrency??M;return(await D(r,c,async({name:o,version:i})=>{if(t.has(o))return[];const a=await S(o,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(a===void 0)return[];const d=s(),l=[],u=be(a,o,i,d,n);u!==void 0&&l.push(u);const h=De(a,o,i,d,n);h!==void 0&&l.push(h);const f=Me(a,o,i,d,n);return f!==void 0&&l.push(f),l})).flat()},"runAuthorMarshall");var Re=Object.defineProperty,$=p((r,e)=>Re(r,"name",{value:e,configurable:!0}),"t$1");const Ae=1440*60*1e3,Ne=15e3,Se=20,Oe=1e4,Ee="https://api.npmjs.org/downloads/point/last-month",z=$(()=>k(B(),"downloads"),"getDownloadsCacheDir"),ne=$(r=>k(z(),`${encodeURIComponent(r)}.json`),"cacheFilePath"),Te=$(r=>{const e=ne(r);if(N(e))try{const t=V(e);if(Date.now()-t.createdAt>t.ttlMs){y(e,{force:!0});return}return t.downloads}catch{y(e,{force:!0});return}},"readCachedDownloads"),je=$((r,e,t)=>{W(z());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};L(ne(r),JSON.stringify(n),"utf8")},"writeCachedDownloads"),Ce=$(async(r,e)=>{const t=`${Ee}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},Ne),c=$(()=>{n.abort()},"abortListener");e?.addEventListener("abort",c,{once:!0});try{const o=await fetch(t,{signal:n.signal});if(o.status===404)return{kind:"no-data"};if(!o.ok)return{kind:"error"};const i=await o.json();return typeof i.downloads=="number"?{downloads:i.downloads,kind:"ok"}:{kind:"no-data"}}catch{return{kind:"error"}}finally{clearTimeout(s),e?.removeEventListener("abort",c)}},"fetchDownloads"),kr=$(async(r,e={})=>{if(b("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??Se,s=e.warnThreshold??Oe,c=e.cacheTtlMs??Ae,o=e.concurrency??M;return(await D(r,o,async i=>{if(t.has(i))return;let a=Te(i);if(a===void 0){const d=await Ce(i,e.signal);if(d.kind==="no-data"||d.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:i,severity:"warning"};a=d.downloads??0,je(i,a,c)}if(a<n)return{downloadsLastMonth:a,kind:"below-error",packageName:i,severity:"error"};if(a<s)return{downloadsLastMonth:a,kind:"below-warning",packageName:i,severity:"warning"}})).filter(i=>i!==void 0)},"runDownloadsMarshall");$(()=>{const r=z();if(!N(r))return 0;let e=0;for(const t of U(r))t.endsWith(".json")&&(y(k(r,t),{force:!0}),e+=1);return e},"clearDownloadsCache");var xe=Object.defineProperty,m=p((r,e)=>xe(r,"name",{value:e,configurable:!0}),"t");const Pe=1440*60*1e3,_e=4e3,Fe=["1.1.1.1","8.8.8.8"],q=m(()=>k(B(),"expired-domains"),"getExpiredDomainsCacheDir"),se=m(r=>{const e=ce("sha256").update(r).digest("hex").slice(0,12);return k(q(),`${e}.json`)},"cacheFilePath"),Le=m(r=>{const e=se(r);if(N(e))try{const t=V(e);if(Date.now()-t.createdAt>t.ttlMs){y(e,{force:!0});return}return t}catch{y(e,{force:!0});return}},"readCachedDomain"),Ue=m((r,e,t)=>{W(q());const n={createdAt:Date.now(),outcome:e,ttlMs:t};L(se(r),JSON.stringify(n),"utf8")},"writeCachedDomain"),Ve=m(r=>{if(typeof r!="string")return;const e=r.lastIndexOf("@");if(e===-1||e===r.length-1)return;const t=r.slice(e+1).trim().toLowerCase();return t===""?void 0:t},"extractDomain"),We=m((r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},"collectMaintainers"),Be=m(async(r,e)=>{let t;try{return await Promise.race([r,new Promise((n,s)=>{t=setTimeout(()=>{s(new Error("ETIMEDOUT"))},e)})])}finally{t!==void 0&&clearTimeout(t)}},"withTimeout"),Ie=m(r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},"isExpiredError"),He=m(async(r,e,t)=>{try{const n=await Be(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Ie(n)?{kind:"expired"}:{kind:"transient-error"}}},"resolveDomain"),Je=m((r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),"resolveLatestVersion"),$r=m(async(r,e={})=>{if(b("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(u=>u.toLowerCase())),s=e.cacheTtlMs??Pe,c=e.perDomainTimeoutMs??_e,o=e.dnsServers??Fe,i=e.concurrency??M,a=e.createResolver===void 0?new de:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const d=new Map,l=m(async u=>{let h=d.get(u);return h===void 0&&(h=(async()=>{const f=Le(u);if(f!==void 0)return{kind:f.outcome==="ok"?"ok":"expired"};const v=await He(a,u,c);return v.kind!=="transient-error"&&Ue(u,v.kind,s),v})(),d.set(u,h)),h},"resolveDomainOnce");return(await D(r,i,async({name:u,version:h})=>{if(t.has(u))return[];const f=await S(u,{workspaceRoot:e.workspaceRoot});if(f===void 0)return[];const v=f.versions[h]??f.versions[Je(Object.keys(f.versions),f["dist-tags"]?.latest)??""];if(v===void 0)return[];const P=We(v.maintainers,v._npmUser),K=new Set,_=[];for(const T of P){const A=Ve(T.email);if(A===void 0||n.has(A))continue;const X=`${A}:${T.email??""}`;if(K.has(X))continue;K.add(X);const Y=await l(A);Y.kind==="expired"?_.push({domain:A,kind:"expired",maintainer:T.email??"",packageName:u,severity:"error"}):Y.kind==="transient-error"&&_.push({domain:A,kind:"unresolved",maintainer:T.email??"",packageName:u,severity:"warning"})}return _})).flat()},"runExpiredDomainsMarshall");m(()=>{const r=q();if(!N(r))return 0;let e=0;for(const t of U(r))t.endsWith(".json")&&(y(k(r,t),{force:!0}),e+=1);return e},"clearExpiredDomainsCache");var ze=Object.defineProperty,R=p((r,e)=>ze(r,"name",{value:e,configurable:!0}),"s");const qe=["readme","license","repo"],Ge=["ERROR: No README data found!","# Security holding package"],Ke=R(r=>{const e=r.trim();return e===""?!0:Ge.some(t=>e.startsWith(t))},"isPlaceholderReadme"),Xe=R((r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},"getReadme"),Ye=R((r,e)=>{const t=Xe(r,e);if(t===void 0)return"missing-readme";if(Ke(t))return"placeholder-readme"},"checkReadme"),Qe=R(r=>{const{license:e}=r;return e===void 0?"missing-license":typeof e=="string"?e.trim()===""?"missing-license":void 0:typeof e.type=="string"&&e.type.trim()!==""?void 0:"missing-license"},"checkLicense"),Ze=R(r=>{const{repository:e}=r;if(e===void 0)return"missing-repo";const t=typeof e.url=="string"?e.url.trim():"";if(t==="")return"missing-repo";let n=t.replace(/^git\+/,"");const s=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(n);return s&&(n=`https://${s[1]}/${s[2]}`),URL.canParse(n)?void 0:"invalid-repo-url"},"checkRepository"),er=R(r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},"resolveLatestVersion"),br=R(async(r,e={})=>{if(b("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??qe),s=e.concurrency??M;return(await D(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await S(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o]??i.versions[er(i)??""];if(a===void 0||a.private===!0)return;const d=[];if(n.has("readme")){const l=Ye(i,a);l!==void 0&&d.push(l)}if(n.has("license")){const l=Qe(a);l!==void 0&&d.push(l)}if(n.has("repo")){const l=Ze(a);l!==void 0&&d.push(l)}if(d.length!==0)return{issues:d,packageName:c,version:o}})).filter(c=>c!==void 0)},"runMetadataMarshall");var rr=Object.defineProperty,G=p((r,e)=>rr(r,"name",{value:e,configurable:!0}),"o");const ee=G((r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},"normalizeBin"),tr=G((r,e)=>g.valid(e)?Object.keys(r.versions).filter(t=>g.valid(t)!==null&&g.lt(t,e)).sort((t,n)=>g.lt(t,n)?1:-1)[0]:void 0,"findImmediatelyPriorVersion"),Dr=G(async(r,e={})=>{if(b("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??M;return(await D(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await S(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o];if(a===void 0)return;const d=tr(i,o);if(d===void 0)return;const l=i.versions[d];if(l===void 0)return;const u=ee(a.bin,c),h=ee(l.bin,c),f=Object.entries(u).filter(([v])=>!(v in h)).filter(([v])=>!n.has(v)).map(([v,P])=>({command:P,name:v}));if(f.length!==0)return{fromVersion:d,newBins:f,packageName:c,toVersion:o}})).filter(c=>c!==void 0)},"runNewBinMarshall");var nr=Object.defineProperty,x=p((r,e)=>nr(r,"name",{value:e,configurable:!0}),"a");const sr=["preinstall","install","postinstall"],re=x((r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,"hasProvenance"),ir=x((r,e)=>{if(g.valid(e)!==null)return Object.keys(r.versions).filter(t=>g.valid(t)!==null&&g.prerelease(t)===null&&g.lt(t,e)).sort((t,n)=>g.lt(t,n)?1:-1)[0]},"findNewestPriorStable"),or=x((r,e)=>{const t=r??{},n=e??{},s=[];for(const c of sr){const o=t[c];if(o===void 0||o==="")continue;const i=n[c];i===void 0||i===""?s.push({command:o,hook:c,kind:"introduced"}):i!==o&&s.push({command:o,hook:c,kind:"changed"})}return s},"installHookChanges"),Mr=x(async(r,e={})=>{if(b("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??M;return(await D(r,n,async({name:s,version:c})=>{if(t.has(s))return;const o=await S(s,{workspaceRoot:e.workspaceRoot});if(o?.versions[c]===void 0)return;const i=ir(o,c);if(i===void 0||!re(o,i)||re(o,c))return;const a=or(o.versions[c]?.scripts,o.versions[i]?.scripts);if(a.length!==0)return{hookChanges:a,packageName:s,priorVersion:i,trustSignal:"provenance-dropped",version:c}})).filter(s=>s!==void 0)},"runS1ngularityMarshall");export{mr as M,Mr as a,Dr as b,br as c,kr as d,$r as e,wr as f,gr as g,pr as h,yr as r};
1
+ var ie=Object.defineProperty;var p=(r,e)=>ie(r,"name",{value:e,configurable:!0});import{createRequire as oe}from"node:module";import{T as Q,e as j}from"./Table-3pFgIUZ2-DABgc6rj.js";import{n as V,b as W}from"../packem_chunks/config.js";import{M as k,i as N}from"./readFileSync-4c_c6Qey-6SWMDNdw.js";import{m as B,i as b}from"../packem_chunks/bin.js";import{m as D,D as M,g as S}from"./provenance-DoEp2uOo.js";import{s as g}from"./pm-runner-Ta_yz2uP.js";const ae=oe(import.meta.url),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,F=p(r=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,t]=E.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return E.getBuiltinModule(r)}return ae(r)},"__cjs_getBuiltinModule"),{rmSync:y,writeFileSync:L,readdirSync:U}=F("node:fs"),{createHash:ce}=F("node:crypto"),{Resolver:de}=F("node:dns/promises");var le=Object.defineProperty,I=p((r,e)=>le(r,"name",{value:e,configurable:!0}),"t$2");class mr{static{p(this,"MarshallFindings")}static{I(this,"MarshallFindings")}entries=[];add(e){this.entries.push(e)}addMany(e){for(const t of e)this.entries.push(t)}all(){return this.entries}errors(){return this.entries.filter(e=>e.severity==="error")}warnings(){return this.entries.filter(e=>e.severity==="warning")}hasErrors(){return this.entries.some(e=>e.severity==="error")}hasWarnings(){return this.entries.some(e=>e.severity==="warning")}isEmpty(){return this.entries.length===0}size(){return this.entries.length}}const pr=I(r=>{if(r.length===0)return[];const e=[],t=r.filter(s=>s.severity==="error"),n=r.filter(s=>s.severity==="warning");if(t.length>0){e.push(Q(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${Q("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${j("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(j(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${j("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${j("→")} ${s.suggestedAction}`)}return e},"formatMarshallFindingsAsTable"),gr=I(r=>({errors:r.filter(e=>e.severity==="error"),findings:[...r],summary:{errorCount:r.filter(e=>e.severity==="error").length,warningCount:r.filter(e=>e.severity==="warning").length},warnings:r.filter(e=>e.severity==="warning")}),"formatMarshallFindingsAsJson");var ue=Object.defineProperty,w=p((r,e)=>ue(r,"name",{value:e,configurable:!0}),"o$1");const he=1440*60*1e3,fe=15e3,ve="https://api.github.com/repos",H=w(()=>k(B(),"archived-repo"),"getArchivedRepoCacheDir"),te=w((r,e)=>k(H(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),"cacheFilePath"),me=w((r,e)=>{const t=te(r,e);if(N(t))try{const n=V(t);if(Date.now()-n.createdAt>n.ttlMs){y(t,{force:!0});return}return n}catch{y(t,{force:!0});return}},"readCachedRepo"),Z=w((r,e,t,n)=>{W(H());const s={createdAt:Date.now(),ttlMs:n,...t};L(te(r,e),JSON.stringify(s),"utf8")},"writeCachedRepo"),pe=w(r=>{if(typeof r!="string"||r.trim()==="")return;const e=r.trim().replace(/^git\+/,""),t=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(t)return{owner:t[1],repo:t[2]};const n=/^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(n)return{owner:n[1],repo:n[2]};const s=/^https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/?#]+?)(?:\.git)?\/?$/i.exec(e);if(s)return{owner:s[1],repo:s[2]}},"parseGitHubUrl"),ge=w(async(r,e,t,n)=>{const s=`${ve}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,c=new AbortController,o=setTimeout(()=>{c.abort()},fe),i=w(()=>{c.abort()},"abortListener");n?.addEventListener("abort",i,{once:!0});const a={Accept:"application/vnd.github+json","User-Agent":"visulima-vis-marshall"};t!==void 0&&t!==""&&(a.Authorization=`Bearer ${t}`);try{const d=await fetch(s,{headers:a,signal:c.signal});if(d.status===404)return{kind:"missing"};if(!d.ok)return{kind:"transient-error"};const l=await d.json(),u=l.archived===!0,h=typeof l.archived_at=="string"?l.archived_at:void 0;return{archived:u,archivedAt:h,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},"fetchGitHubRepo"),we=w((r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),"resolveLatestVersion"),wr=w(async(r,e={})=>{if(b("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??he,s=e.githubToken??process.env.GITHUB_TOKEN,c=e.concurrency??M,o=new Map,i=w(async(a,d)=>{const l=`${a}/${d}`;let u=o.get(l);return u===void 0&&(u=(async()=>{const h=me(a,d);if(h!==void 0)return h.missing===!0?{archived:!1,kind:"missing"}:{archived:h.archived,archivedAt:h.archivedAt,kind:"ok"};const f=await ge(a,d,s,e.signal);return f.kind==="missing"?Z(a,d,{archived:!1,missing:!0},n):f.kind==="ok"&&Z(a,d,{archived:f.archived===!0,archivedAt:f.archivedAt},n),f})(),o.set(l,u)),u},"fetchRepoOnce");return(await D(r,c,async({name:a,version:d})=>{if(t.has(a))return;const l=await S(a,{workspaceRoot:e.workspaceRoot});if(l===void 0)return;const u=l.versions[d]??l.versions[we(Object.keys(l.versions),l["dist-tags"]?.latest)??""];if(u===void 0)return;const h=pe(u.repository?.url);if(h===void 0)return;const f=await i(h.owner,h.repo);if(f.kind!=="transient-error"){if(f.kind==="missing")return{kind:"missing-repo",owner:h.owner,packageName:a,repo:h.repo};if(f.archived===!0)return{...f.archivedAt===void 0?{}:{archivedAt:f.archivedAt},kind:"archived",owner:h.owner,packageName:a,repo:h.repo}}})).filter(a=>a!==void 0)},"runArchivedRepoMarshall");w(()=>{const r=H();if(!N(r))return 0;let e=0;for(const t of U(r))t.endsWith(".json")&&(y(k(r,t),{force:!0}),e+=1);return e},"clearArchivedRepoCache");var ye=Object.defineProperty,O=p((r,e)=>ye(r,"name",{value:e,configurable:!0}),"h$1");const ke={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},$e=1440*60*1e3,J=O((r,e)=>(r-e)/$e,"daysBetween"),C=O(r=>{if(r!==void 0)return r.email??r.name},"userIdentity"),be=O((r,e,t,n,s)=>{const c=r.time?.[t];if(c===void 0)return;const o=new Date(c).getTime();if(!Number.isFinite(o))return;const i=J(n,o);if(i<s.recentVersionErrorDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (error threshold: ${String(s.recentVersionErrorDays)})`,packageName:e,severity:"error",version:t};if(i<s.recentVersionWarnDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (warn threshold: ${String(s.recentVersionWarnDays)})`,packageName:e,severity:"warning",version:t}},"checkRecentVersion"),De=O((r,e,t,n,s)=>{const c=r.versions[t],o=C(c?._npmUser);if(o===void 0)return;const i=Object.keys(r.versions).filter(u=>g.valid(u)!==null).filter(u=>g.lt(u,t));if(i.length===0||i.some(u=>C(r.versions[u]?._npmUser)===o))return;const a=r.time?.[i[0]??""];if(a===void 0)return;const d=new Date(a).getTime();if(!Number.isFinite(d))return;const l=J(n,d);if(!(l<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${l.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},"checkNewPublisher"),Me=O((r,e,t,n,s)=>{const c=r.versions[t],o=C(c?._npmUser);if(o===void 0)return;const i=[];for(const[l,u]of Object.entries(r.versions)){if(l===t||C(u._npmUser)!==o)continue;const h=r.time?.[l];if(h===void 0)continue;const f=new Date(h).getTime();Number.isFinite(f)&&i.push(f)}if(i.length===0)return;const a=Math.max(...i),d=J(n,a);if(d>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(d>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},"checkDormantMaintainer"),yr=O(async(r,e={})=>{if(b("author"))return[];const t=new Set(e.allowlist),n={...ke,...e.thresholds},s=e.now??(()=>Date.now()),c=e.concurrency??M;return(await D(r,c,async({name:o,version:i})=>{if(t.has(o))return[];const a=await S(o,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(a===void 0)return[];const d=s(),l=[],u=be(a,o,i,d,n);u!==void 0&&l.push(u);const h=De(a,o,i,d,n);h!==void 0&&l.push(h);const f=Me(a,o,i,d,n);return f!==void 0&&l.push(f),l})).flat()},"runAuthorMarshall");var Re=Object.defineProperty,$=p((r,e)=>Re(r,"name",{value:e,configurable:!0}),"t$1");const Ae=1440*60*1e3,Ne=15e3,Se=20,Oe=1e4,Ee="https://api.npmjs.org/downloads/point/last-month",z=$(()=>k(B(),"downloads"),"getDownloadsCacheDir"),ne=$(r=>k(z(),`${encodeURIComponent(r)}.json`),"cacheFilePath"),Te=$(r=>{const e=ne(r);if(N(e))try{const t=V(e);if(Date.now()-t.createdAt>t.ttlMs){y(e,{force:!0});return}return t.downloads}catch{y(e,{force:!0});return}},"readCachedDownloads"),je=$((r,e,t)=>{W(z());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};L(ne(r),JSON.stringify(n),"utf8")},"writeCachedDownloads"),Ce=$(async(r,e)=>{const t=`${Ee}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},Ne),c=$(()=>{n.abort()},"abortListener");e?.addEventListener("abort",c,{once:!0});try{const o=await fetch(t,{signal:n.signal});if(o.status===404)return{kind:"no-data"};if(!o.ok)return{kind:"error"};const i=await o.json();return typeof i.downloads=="number"?{downloads:i.downloads,kind:"ok"}:{kind:"no-data"}}catch{return{kind:"error"}}finally{clearTimeout(s),e?.removeEventListener("abort",c)}},"fetchDownloads"),kr=$(async(r,e={})=>{if(b("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??Se,s=e.warnThreshold??Oe,c=e.cacheTtlMs??Ae,o=e.concurrency??M;return(await D(r,o,async i=>{if(t.has(i))return;let a=Te(i);if(a===void 0){const d=await Ce(i,e.signal);if(d.kind==="no-data"||d.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:i,severity:"warning"};a=d.downloads??0,je(i,a,c)}if(a<n)return{downloadsLastMonth:a,kind:"below-error",packageName:i,severity:"error"};if(a<s)return{downloadsLastMonth:a,kind:"below-warning",packageName:i,severity:"warning"}})).filter(i=>i!==void 0)},"runDownloadsMarshall");$(()=>{const r=z();if(!N(r))return 0;let e=0;for(const t of U(r))t.endsWith(".json")&&(y(k(r,t),{force:!0}),e+=1);return e},"clearDownloadsCache");var xe=Object.defineProperty,m=p((r,e)=>xe(r,"name",{value:e,configurable:!0}),"t");const Pe=1440*60*1e3,_e=4e3,Fe=["1.1.1.1","8.8.8.8"],q=m(()=>k(B(),"expired-domains"),"getExpiredDomainsCacheDir"),se=m(r=>{const e=ce("sha256").update(r).digest("hex").slice(0,12);return k(q(),`${e}.json`)},"cacheFilePath"),Le=m(r=>{const e=se(r);if(N(e))try{const t=V(e);if(Date.now()-t.createdAt>t.ttlMs){y(e,{force:!0});return}return t}catch{y(e,{force:!0});return}},"readCachedDomain"),Ue=m((r,e,t)=>{W(q());const n={createdAt:Date.now(),outcome:e,ttlMs:t};L(se(r),JSON.stringify(n),"utf8")},"writeCachedDomain"),Ve=m(r=>{if(typeof r!="string")return;const e=r.lastIndexOf("@");if(e===-1||e===r.length-1)return;const t=r.slice(e+1).trim().toLowerCase();return t===""?void 0:t},"extractDomain"),We=m((r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},"collectMaintainers"),Be=m(async(r,e)=>{let t;try{return await Promise.race([r,new Promise((n,s)=>{t=setTimeout(()=>{s(new Error("ETIMEDOUT"))},e)})])}finally{t!==void 0&&clearTimeout(t)}},"withTimeout"),Ie=m(r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},"isExpiredError"),He=m(async(r,e,t)=>{try{const n=await Be(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Ie(n)?{kind:"expired"}:{kind:"transient-error"}}},"resolveDomain"),Je=m((r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),"resolveLatestVersion"),$r=m(async(r,e={})=>{if(b("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(u=>u.toLowerCase())),s=e.cacheTtlMs??Pe,c=e.perDomainTimeoutMs??_e,o=e.dnsServers??Fe,i=e.concurrency??M,a=e.createResolver===void 0?new de:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const d=new Map,l=m(async u=>{let h=d.get(u);return h===void 0&&(h=(async()=>{const f=Le(u);if(f!==void 0)return{kind:f.outcome==="ok"?"ok":"expired"};const v=await He(a,u,c);return v.kind!=="transient-error"&&Ue(u,v.kind,s),v})(),d.set(u,h)),h},"resolveDomainOnce");return(await D(r,i,async({name:u,version:h})=>{if(t.has(u))return[];const f=await S(u,{workspaceRoot:e.workspaceRoot});if(f===void 0)return[];const v=f.versions[h]??f.versions[Je(Object.keys(f.versions),f["dist-tags"]?.latest)??""];if(v===void 0)return[];const P=We(v.maintainers,v._npmUser),K=new Set,_=[];for(const T of P){const A=Ve(T.email);if(A===void 0||n.has(A))continue;const X=`${A}:${T.email??""}`;if(K.has(X))continue;K.add(X);const Y=await l(A);Y.kind==="expired"?_.push({domain:A,kind:"expired",maintainer:T.email??"",packageName:u,severity:"error"}):Y.kind==="transient-error"&&_.push({domain:A,kind:"unresolved",maintainer:T.email??"",packageName:u,severity:"warning"})}return _})).flat()},"runExpiredDomainsMarshall");m(()=>{const r=q();if(!N(r))return 0;let e=0;for(const t of U(r))t.endsWith(".json")&&(y(k(r,t),{force:!0}),e+=1);return e},"clearExpiredDomainsCache");var ze=Object.defineProperty,R=p((r,e)=>ze(r,"name",{value:e,configurable:!0}),"s");const qe=["readme","license","repo"],Ge=["ERROR: No README data found!","# Security holding package"],Ke=R(r=>{const e=r.trim();return e===""?!0:Ge.some(t=>e.startsWith(t))},"isPlaceholderReadme"),Xe=R((r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},"getReadme"),Ye=R((r,e)=>{const t=Xe(r,e);if(t===void 0)return"missing-readme";if(Ke(t))return"placeholder-readme"},"checkReadme"),Qe=R(r=>{const{license:e}=r;return e===void 0?"missing-license":typeof e=="string"?e.trim()===""?"missing-license":void 0:typeof e.type=="string"&&e.type.trim()!==""?void 0:"missing-license"},"checkLicense"),Ze=R(r=>{const{repository:e}=r;if(e===void 0)return"missing-repo";const t=typeof e.url=="string"?e.url.trim():"";if(t==="")return"missing-repo";let n=t.replace(/^git\+/,"");const s=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(n);return s&&(n=`https://${s[1]}/${s[2]}`),URL.canParse(n)?void 0:"invalid-repo-url"},"checkRepository"),er=R(r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},"resolveLatestVersion"),br=R(async(r,e={})=>{if(b("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??qe),s=e.concurrency??M;return(await D(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await S(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o]??i.versions[er(i)??""];if(a===void 0||a.private===!0)return;const d=[];if(n.has("readme")){const l=Ye(i,a);l!==void 0&&d.push(l)}if(n.has("license")){const l=Qe(a);l!==void 0&&d.push(l)}if(n.has("repo")){const l=Ze(a);l!==void 0&&d.push(l)}if(d.length!==0)return{issues:d,packageName:c,version:o}})).filter(c=>c!==void 0)},"runMetadataMarshall");var rr=Object.defineProperty,G=p((r,e)=>rr(r,"name",{value:e,configurable:!0}),"o");const ee=G((r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},"normalizeBin"),tr=G((r,e)=>g.valid(e)?Object.keys(r.versions).filter(t=>g.valid(t)!==null&&g.lt(t,e)).sort((t,n)=>g.lt(t,n)?1:-1)[0]:void 0,"findImmediatelyPriorVersion"),Dr=G(async(r,e={})=>{if(b("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??M;return(await D(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await S(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o];if(a===void 0)return;const d=tr(i,o);if(d===void 0)return;const l=i.versions[d];if(l===void 0)return;const u=ee(a.bin,c),h=ee(l.bin,c),f=Object.entries(u).filter(([v])=>!(v in h)).filter(([v])=>!n.has(v)).map(([v,P])=>({command:P,name:v}));if(f.length!==0)return{fromVersion:d,newBins:f,packageName:c,toVersion:o}})).filter(c=>c!==void 0)},"runNewBinMarshall");var nr=Object.defineProperty,x=p((r,e)=>nr(r,"name",{value:e,configurable:!0}),"a");const sr=["preinstall","install","postinstall"],re=x((r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,"hasProvenance"),ir=x((r,e)=>{if(g.valid(e)!==null)return Object.keys(r.versions).filter(t=>g.valid(t)!==null&&g.prerelease(t)===null&&g.lt(t,e)).sort((t,n)=>g.lt(t,n)?1:-1)[0]},"findNewestPriorStable"),or=x((r,e)=>{const t=r??{},n=e??{},s=[];for(const c of sr){const o=t[c];if(o===void 0||o==="")continue;const i=n[c];i===void 0||i===""?s.push({command:o,hook:c,kind:"introduced"}):i!==o&&s.push({command:o,hook:c,kind:"changed"})}return s},"installHookChanges"),Mr=x(async(r,e={})=>{if(b("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??M;return(await D(r,n,async({name:s,version:c})=>{if(t.has(s))return;const o=await S(s,{workspaceRoot:e.workspaceRoot});if(o?.versions[c]===void 0)return;const i=ir(o,c);if(i===void 0||!re(o,i)||re(o,c))return;const a=or(o.versions[c]?.scripts,o.versions[i]?.scripts);if(a.length!==0)return{hookChanges:a,packageName:s,priorVersion:i,trustSignal:"provenance-dropped",version:c}})).filter(s=>s!==void 0)},"runS1ngularityMarshall");export{mr as M,Mr as a,Dr as b,br as c,kr as d,$r as e,wr as f,gr as g,pr as h,yr as r};
@@ -0,0 +1,2 @@
1
+ var S=Object.defineProperty;var g=(s,r)=>S(s,"name",{value:r,configurable:!0});import{e as k,E as x,I as T,T as $}from"./Table-3pFgIUZ2-DABgc6rj.js";import{a5 as a,a6 as u,n as l,a7 as d,k as C,R as j,s as E}from"../packem_chunks/bin.js";import{n as R}from"./spinner-C8xs6QZv.js";import{D as w,W as P,T as O,C as A}from"./symbols-CQmER5MT.js";var D=Object.defineProperty,I=g((s,r)=>D(s,"name",{value:r,configurable:!0}),"l");const v=I(({rows:s})=>a.jsx(u,{flexDirection:"column",children:s.map(r=>{let t;switch(r.status){case"error":{t=a.jsx(l,{color:"red",children:A});break}case"ok":{t=a.jsx(l,{color:"green",children:O});break}case"running":{t=a.jsx(l,{color:"white",children:a.jsx(R,{type:"dots"})});break}case"warn":{t=a.jsx(l,{color:"yellow",children:P});break}default:{t=a.jsx(l,{dimColor:!0,children:w});break}}return a.jsxs(u,{children:[a.jsx(u,{width:3,children:t}),a.jsx(u,{flexGrow:1,children:a.jsx(l,{children:r.label})}),r.summary?a.jsx(u,{children:a.jsxs(l,{dimColor:!0,children:[w," ",r.summary]})}):null]},r.id)})}),"ScanProgressApp");var Y=Object.defineProperty,i=g((s,r)=>Y(s,"name",{value:r,configurable:!0}),"e");const G={error:$(d.failure),ok:T(d.success),pending:x(d.dash),skip:x(d.dash),warn:k(d.warning)},M=i((s,r,t)=>{const h=t?`${s} ${x(`— ${t}`)}`:s;return` ${G[r]} ${h}
2
+ `},"formatStaticRow"),L=i((s,r={})=>{const t=r.stream??process.stderr,h=typeof t.isTTY=="boolean"&&t.isTTY&&!E,y=r.live??h,n=new Map;for(const e of s)n.set(e.id,{id:e.id,label:e.label,status:"pending"});if(!y||s.length===0)return{finish:i((e,o,f)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:f}),t.write(M(c.label,o,f)))},"finish"),start:i(e=>{const o=n.get(e);o&&n.set(e,{...o,status:"running"})},"start"),stop:i(()=>{},"stop")};const b=i(()=>s.map(e=>n.get(e.id)),"buildRows");let m=C(j.createElement(v,{rows:b()}),{interactive:!0,patchConsole:!1});const p=i(()=>{m?.rerender(j.createElement(v,{rows:b()}))},"rerender");return{finish:i((e,o,f)=>{const c=n.get(e);c&&(n.set(e,{...c,status:o,summary:f}),p())},"finish"),start:i(e=>{const o=n.get(e);o&&(n.set(e,{...o,status:"running"}),p())},"start"),stop:i(()=>{m&&(p(),m.unmount(),m=void 0)},"stop")}},"startScanProgress");export{L as s};
@@ -1,3 +1,3 @@
1
- var w=Object.defineProperty;var m=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";import{z as b}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";const k=v(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=m(e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[t,r]=j.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return j.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{createInterface:$}=_("node:readline");var T=Object.defineProperty,f=m((e,t)=>T(e,"name",{value:t,configurable:!0}),"g");const q=/^#([\w\-/]+):(.+)$/,x=/^([@\w\-/]+):(.+)$/,P=f(e=>{if(e==="")return;if(e.startsWith(":"))return{kind:"all",target:e.slice(1)};if(e.startsWith("~:"))return{kind:"closest",target:e.slice(2)};const t=q.exec(e);if(t?.[1]&&t[2])return{kind:"tag",tag:t[1],target:t[2]};const r=x.exec(e);return r?.[1]&&r[2]&&(r[1].startsWith("@")||r[1].includes("/")||r[1].includes("-"))?{kind:"project",projects:[r[1]],target:r[2]}:{kind:"all",target:e}},"parseTargetSelector"),N=f(async(e,t,r,a)=>{const s=P(e);if(!s)throw new Error(`Invalid target selector: "${e}"`);const c=Object.keys(t.projects);if(s.kind==="all")return{projects:c,target:s.target};if(s.kind==="project")return{projects:s.projects??[],target:s.target};if(s.kind==="tag"){const o=s.tag;return{projects:c.filter(i=>t.projects[i]?.tags?.includes(o)??!1),target:s.target}}const n=b(a,r)||".";let p,l=-1;for(const[o,i]of Object.entries(t.projects)){const u=i.root;u&&(n===u||n.startsWith(`${u}/`))&&u.length>l&&(l=u.length,p=o)}if(!p){if(process.stdout.isTTY){const o=$({input:process.stdin,output:process.stderr}),i=Object.keys(t.projects).sort();process.stderr.write(`No project found at ${n}. Pick one:
1
+ var w=Object.defineProperty;var m=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";import{z as b}from"./readFileSync-4c_c6Qey-6SWMDNdw.js";const k=v(import.meta.url),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=m(e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[t,r]=j.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return j.getBuiltinModule(e)}return k(e)},"__cjs_getBuiltinModule"),{createInterface:$}=_("node:readline");var T=Object.defineProperty,f=m((e,t)=>T(e,"name",{value:t,configurable:!0}),"g");const q=/^#([\w\-/]+):(.+)$/,x=/^([@\w\-/]+):(.+)$/,P=f(e=>{if(e==="")return;if(e.startsWith(":"))return{kind:"all",target:e.slice(1)};if(e.startsWith("~:"))return{kind:"closest",target:e.slice(2)};const t=q.exec(e);if(t?.[1]&&t[2])return{kind:"tag",tag:t[1],target:t[2]};const r=x.exec(e);return r?.[1]&&r[2]&&(r[1].startsWith("@")||r[1].includes("/")||r[1].includes("-"))?{kind:"project",projects:[r[1]],target:r[2]}:{kind:"all",target:e}},"parseTargetSelector"),N=f(async(e,t,r,a)=>{const s=P(e);if(!s)throw new Error(`Invalid target selector: "${e}"`);const c=Object.keys(t.projects);if(s.kind==="all")return{projects:c,target:s.target};if(s.kind==="project")return{projects:s.projects??[],target:s.target};if(s.kind==="tag"){const o=s.tag;return{projects:c.filter(i=>t.projects[i]?.tags?.includes(o)??!1),target:s.target}}const n=b(a,r)||".";let p,l=-1;for(const[o,i]of Object.entries(t.projects)){const u=i.root;u&&(n===u||n.startsWith(`${u}/`))&&u.length>l&&(l=u.length,p=o)}if(!p){if(process.stdout.isTTY){const o=$({input:process.stdin,output:process.stderr}),i=Object.keys(t.projects).sort();process.stderr.write(`No project found at ${n}. Pick one:
2
2
  `);for(const[d,h]of i.entries())process.stderr.write(` ${String(d+1)}) ${h}
3
3
  `);const u=await new Promise(d=>{o.question("> ",d)});o.close();const g=Number.parseInt(u,10)-1;if(g>=0&&g<i.length)return{projects:[i[g]],target:s.target}}throw new Error(`No project found at or above ${n} for selector "${e}".`)}return{projects:[p],target:s.target}},"resolveSelector"),E=/^(\w+)\s*(!?=)\s*(.+)$/,Q=f(e=>{const t=e.trim();if(t==="")return;const r=t.split("&&").map(o=>o.trim()),a=t.split("||").map(o=>o.trim()),s=r.length>1,c=a.length>1;if(s&&c)throw new Error("Query language does not support mixed && / || — split into multiple --query flags or simplify.");const n=c?a:r,p=c?"||":"&&",l=[];for(const o of n){const i=E.exec(o);if(!i)throw new Error(`Invalid query clause: "${o}". Expected <field>=<value> or <field>!=<value>.`);const[,u,g,d]=i;l.push({field:u,op:g==="!="?"!=":"=",value:d.trim().replaceAll(/^["']|["']$/g,"")})}return{clauses:l,op:p}},"parseQuery"),y=f((e,t,r)=>{const{field:a,op:s,value:c}=e,n=f(l=>{const o=l===c;return s==="="?o:!o},"test"),p=f(l=>{const o=(l??[]).includes(c);return s==="="?o:!o},"testList");switch(a){case"id":case"project":return n(t);case"language":return n(r.language);case"layer":return n(r.layer);case"projectType":case"type":return n(r.projectType);case"stack":return n(r.stack);case"tag":case"tags":return p(r.tags);default:return!1}},"matchClause"),O=f((e,t,r)=>{if(!r||r.trim()==="")return e;const a=Q(r);return a?e.filter(s=>{const c=t.projects[s];return c?a.op==="&&"?a.clauses.every(n=>y(n,s,c)):a.clauses.some(n=>y(n,s,c)):!1}):e},"filterProjectsByQuery");export{O as f,P as p,N as r};
@@ -1,2 +1,2 @@
1
- var b=Object.defineProperty;var y=(s,e)=>b(s,"name",{value:e,configurable:!0});import{createRequire as N}from"node:module";import{m as x,D as B,g as E}from"./provenance-DbkJRDqt.js";import{i as M}from"../packem_chunks/bin.js";import{f as j}from"./registry-keys-SylX07bs.js";const P=N(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=y(s=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[e,i]=g.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return g.getBuiltinModule(s)}return P(s)},"__cjs_getBuiltinModule"),{createPublicKey:S,createVerify:R}=_("node:crypto");var A=Object.defineProperty,h=y((s,e)=>A(s,"name",{value:e,configurable:!0}),"n");const C=h(s=>{const e=["-----BEGIN PUBLIC KEY-----"],i=s.replaceAll(/\s+/g,"");for(let t=0;t<i.length;t+=64)e.push(i.slice(t,t+64));return e.push("-----END PUBLIC KEY-----"),e.join(`
1
+ var b=Object.defineProperty;var y=(s,e)=>b(s,"name",{value:e,configurable:!0});import{createRequire as N}from"node:module";import{m as x,D as B,g as E}from"./provenance-DoEp2uOo.js";import{i as M}from"../packem_chunks/bin.js";import{f as j}from"./registry-keys-CD1xHavV.js";const P=N(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=y(s=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[e,i]=g.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return g.getBuiltinModule(s)}return P(s)},"__cjs_getBuiltinModule"),{createPublicKey:S,createVerify:R}=_("node:crypto");var A=Object.defineProperty,h=y((s,e)=>A(s,"name",{value:e,configurable:!0}),"n");const C=h(s=>{const e=["-----BEGIN PUBLIC KEY-----"],i=s.replaceAll(/\s+/g,"");for(let t=0;t<i.length;t+=64)e.push(i.slice(t,t+64));return e.push("-----END PUBLIC KEY-----"),e.join(`
2
2
  `)},"wrapSpkiPem"),D=h(({keyBase64:s,message:e,signatureBase64:i})=>{try{const t=S({format:"pem",key:C(s)}),o=R("SHA256");return o.update(e),o.end(),o.verify(t,Buffer.from(i,"base64"))}catch{return!1}},"verifyEcdsaSignature");var L=Object.defineProperty,f=y((s,e)=>L(s,"name",{value:e,configurable:!0}),"g");const U=f((s,e)=>{if(s.expires===void 0||s.expires==="")return!1;const i=Date.parse(s.expires);return Number.isNaN(i)?!1:i<=e},"isKeyExpired"),K=f((s,e,i)=>`${s}@${e}:${i}`,"buildSignedMessage"),T=f((s,e)=>e!==void 0&&s.includes(e)?e:s.at(-1),"resolveLatestVersion"),V=f(async(s,e={})=>{if(M("signatures"))return[];const i=new Set(e.allowlist),t=e.treatExpiredAs??"warning",o=e.concurrency??B,k=await j({keysUrl:e.keysUrl,signal:e.signal,ttlMs:e.keysTtlMs});if(k===void 0)return s.filter(({name:r})=>!i.has(r)).map(({name:r,version:a})=>({code:"fetch-failed",message:"Could not fetch registry signing keys.",packageName:r,severity:"warning",version:a}));const v=new Map;for(const r of k.keys)v.set(r.keyid,r);const w=Date.now();return(await x(s,o,async({name:r,version:a})=>{if(i.has(r))return[];const c=await E(r,{workspaceRoot:e.workspaceRoot});if(c===void 0)return[];const l=c.versions[a]??c.versions[T(Object.keys(c.versions),c["dist-tags"]?.latest)??""];if(l===void 0)return[];const p=l.dist?.signatures,m=l.dist?.integrity;if(p===void 0||p.length===0)return[{code:"missing-signature",message:`Package ${r}@${a} has no dist.signatures from the registry.`,packageName:r,severity:"warning",version:a}];if(typeof m!="string"||m==="")return[{code:"missing-signature",message:`Package ${r}@${a} has signatures but no dist.integrity to verify against.`,packageName:r,severity:"warning",version:a}];const $=K(r,a,m),u=[];for(const n of p){const d=v.get(n.keyid);if(d===void 0){u.push({code:"unknown-keyid",keyid:n.keyid,message:`Package ${r}@${a} was signed with an unrecognized keyid (${n.keyid}).`,packageName:r,severity:"error",version:a});continue}if(U(d,w)){u.push({code:"expired-key",keyid:n.keyid,message:`Package ${r}@${a} was signed with an expired key (${n.keyid}, expired ${d.expires??"unknown"}).`,packageName:r,severity:t,version:a});continue}D({keyBase64:d.key,message:$,signatureBase64:n.sig})||u.push({code:"invalid-signature",keyid:n.keyid,message:`Package ${r}@${a} signature did not verify against ${n.keyid}.`,packageName:r,severity:"error",version:a})}return u})).flat()},"runSignatureMarshall");export{V as r};
@@ -1 +1 @@
1
- var T=Object.defineProperty;var u=(e,r)=>T(e,"name",{value:r,configurable:!0});import{r as t,a8 as k,a5 as z,n as L}from"../packem_chunks/bin.js";import{$ as N}from"./spinners-f91Rbo99-Bjf3NcO0.js";var q=Object.defineProperty,y=u((e,r)=>q(e,"name",{value:r,configurable:!0}),"c$1"),w=Object.defineProperty,d=y((e,r)=>w(e,"name",{value:r,configurable:!0}),"c"),B=Object.defineProperty,E=d((e,r)=>B(e,"name",{value:r,configurable:!0}),"l");const I=100,D=2147483647,p={delta:0,frame:0,time:0};function f(e){const{interval:r=I,isActive:n=!0}=e??{},a=l(r),{renderThrottleMs:o,subscribe:x}=t.useContext(k),[i,S]=t.useState(0),[$,g]=t.useState(p),m=t.useRef(0),v=t.useRef(0),h=t.useRef({isActive:n,resetKey:i,safeInterval:a}),b=h.current,C=n&&(a!==b.safeInterval||!b.isActive||i!==b.resetKey),A=t.useCallback(()=>{S(c=>c+1)},[]);return t.useLayoutEffect(()=>{if(!n)return;g(p);let c=0;const{startTime:O,unsubscribe:F}=x(s=>{if(o>0&&s<m.current)return;const P=s-c,K=s-v.current;v.current=s,m.current=s+o,g({delta:K,frame:Math.floor(P/a),time:P})},a);return c=O,v.current=O,m.current=c+o,F},[a,n,x,o,i]),t.useLayoutEffect(()=>{h.current={isActive:n,resetKey:i,safeInterval:a}},[n,a,i]),C?{...p,reset:A}:{...$,reset:A}}u(f,"o");y(f,"N");d(f,"S");E(f,"useAnimation");function l(e){return Number.isFinite(e)?Math.min(D,Math.max(1,e)):I}u(l,"d");y(l,"C");d(l,"F");E(l,"normalizeAnimationInterval");var G=Object.defineProperty,M=u((e,r)=>G(e,"name",{value:r,configurable:!0}),"t"),H=Object.defineProperty,R=M((e,r)=>H(e,"name",{value:r,configurable:!0}),"t"),J=Object.defineProperty,Q=R((e,r)=>J(e,"name",{value:r,configurable:!0}),"t");function j({type:e="dots"}){const r=N(e),{frame:n}=f({interval:r.interval});return z.jsx(L,{children:r.frames[n%r.frames.length]})}u(j,"n");M(j,"l");R(j,"n");Q(j,"Spinner");export{j as n};
1
+ var T=Object.defineProperty;var u=(e,r)=>T(e,"name",{value:r,configurable:!0});import{w as t,a8 as k,a5 as z,n as L}from"../packem_chunks/bin.js";import{$ as N}from"./spinners-f91Rbo99-Bjf3NcO0.js";var q=Object.defineProperty,y=u((e,r)=>q(e,"name",{value:r,configurable:!0}),"c$1"),w=Object.defineProperty,d=y((e,r)=>w(e,"name",{value:r,configurable:!0}),"c"),B=Object.defineProperty,E=d((e,r)=>B(e,"name",{value:r,configurable:!0}),"l");const I=100,D=2147483647,p={delta:0,frame:0,time:0};function f(e){const{interval:r=I,isActive:n=!0}=e??{},a=l(r),{renderThrottleMs:o,subscribe:x}=t.useContext(k),[i,S]=t.useState(0),[$,g]=t.useState(p),m=t.useRef(0),v=t.useRef(0),h=t.useRef({isActive:n,resetKey:i,safeInterval:a}),b=h.current,C=n&&(a!==b.safeInterval||!b.isActive||i!==b.resetKey),A=t.useCallback(()=>{S(c=>c+1)},[]);return t.useLayoutEffect(()=>{if(!n)return;g(p);let c=0;const{startTime:O,unsubscribe:F}=x(s=>{if(o>0&&s<m.current)return;const P=s-c,K=s-v.current;v.current=s,m.current=s+o,g({delta:K,frame:Math.floor(P/a),time:P})},a);return c=O,v.current=O,m.current=c+o,F},[a,n,x,o,i]),t.useLayoutEffect(()=>{h.current={isActive:n,resetKey:i,safeInterval:a}},[n,a,i]),C?{...p,reset:A}:{...$,reset:A}}u(f,"o");y(f,"N");d(f,"S");E(f,"useAnimation");function l(e){return Number.isFinite(e)?Math.min(D,Math.max(1,e)):I}u(l,"d");y(l,"C");d(l,"F");E(l,"normalizeAnimationInterval");var G=Object.defineProperty,M=u((e,r)=>G(e,"name",{value:r,configurable:!0}),"t"),H=Object.defineProperty,R=M((e,r)=>H(e,"name",{value:r,configurable:!0}),"t"),J=Object.defineProperty,Q=R((e,r)=>J(e,"name",{value:r,configurable:!0}),"t");function j({type:e="dots"}){const r=N(e),{frame:n}=f({interval:r.interval});return z.jsx(L,{children:r.frames[n%r.frames.length]})}u(j,"n");M(j,"l");R(j,"n");Q(j,"Spinner");export{j as n};
@@ -1 +1 @@
1
- var G=Object.defineProperty;var m=(e,o)=>G(e,"name",{value:o,configurable:!0});import{a5 as u,r as t,af as X,a6 as T,n as O}from"../packem_chunks/bin.js";var Y=Object.defineProperty,W=m((e,o)=>Y(e,"name",{value:o,configurable:!0}),"n"),Z=Object.defineProperty,q=W((e,o)=>Z(e,"name",{value:o,configurable:!0}),"a"),_=Object.defineProperty,ee=q((e,o)=>_(e,"name",{value:o,configurable:!0}),"t");function P({children:e}){return u.jsx(u.Fragment,{children:e})}m(P,"r");W(P,"c");q(P,"o");ee(P,"Tab");var re=Object.defineProperty,z=m((e,o)=>re(e,"name",{value:o,configurable:!0}),"A"),ne=Object.defineProperty,B=z((e,o)=>ne(e,"name",{value:o,configurable:!0}),"A"),oe=Object.defineProperty,v=B((e,o)=>oe(e,"name",{value:o,configurable:!0}),"b");const te=/^\d$/u,ce=v(e=>e!=null&&typeof e=="object"&&"props"in e&&"name"in e.props,"isTabElement"),ae=v(e=>{const o=[];for(const c of t.Children.toArray(e))ce(c)&&o.push(c);return o},"collectTabs"),V=v((e,o)=>e.some(c=>o[c]),"matchesAnyKey"),ue=v((e,o,c)=>e?o?{backgroundColor:c?.activeTab?.backgroundColor??"green",color:c?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0},"getActiveTabColors");function E({children:e,colors:o,defaultValue:c,flexDirection:g="row",isFocused:h,keyMap:l,onChange:M,showIndex:H=!0,value:j,width:y}){const s=ae(e),a=s.length,d=t.useRef(s);d.current=s;const i=g==="column"||g==="column-reverse",C=j!==void 0,[J,L]=t.useState(()=>{const r=j??c;if(r==null||a===0)return 0;const n=s.findIndex(p=>p.props.name===r);return n===-1?0:n}),x=C?Math.max(0,s.findIndex(r=>r.props.name===j)):J,Q=t.useCallback(()=>{},[]),f=C?Q:L,b=t.useRef(M);b.current=M,t.useEffect(()=>{if(C)return;const r=d.current[x];r&&b.current(r.props.name,r)},[]);const R=t.useMemo(()=>l?.previous??[i?"upArrow":"leftArrow"],[l?.previous,i]),I=t.useMemo(()=>l?.next??[i?"downArrow":"rightArrow"],[l?.next,i]),$=l?.useNumbers??!0,D=l?.useTab??!0,k=t.useRef(x);k.current=x;const F=t.useCallback(r=>{f(r);const n=d.current[r];n&&b.current(n.props.name,n)},[f]),w=t.useCallback(()=>{const r=(k.current+1)%a;f(r);const n=d.current[r];n&&b.current(n.props.name,n)},[a,f]),A=t.useCallback(()=>{const r=(k.current-1+a)%a;f(r);const n=d.current[r];n&&b.current(n.props.name,n)},[a,f]);X(t.useCallback((r,n)=>{if(V(R,n)){A();return}if(V(I,n)){w();return}if(n.tab&&D&&h==null){n.shift?A():w();return}if($&&n.meta&&te.test(r)){const p=r==="0"?9:Number.parseInt(r,10)-1;p<a&&F(p)}},[R,I,D,$,h,A,w,a,F]),{isActive:h!==!1});const K=typeof y=="number"?y:6,U=t.useMemo(()=>i?"─".repeat(K):" | ",[i,K]);return u.jsx(T,{flexDirection:g,width:y,children:s.map((r,n)=>{const{name:p}=r.props,N=ue(x===n,h!==!1,o);let S=null;return H&&(S=u.jsxs(O,{color:"grey",children:[n+1,"."," "]})),u.jsxs(T,{flexDirection:g,children:[n!==0&&u.jsx(O,{color:"dim",children:U}),u.jsxs(T,{children:[S,u.jsx(O,{backgroundColor:N.backgroundColor,color:N.color,children:r})]})]},p)})})}m(E,"g");z(E,"or");B(E,"W");v(E,"Tabs");export{E as g,P as r};
1
+ var G=Object.defineProperty;var m=(e,o)=>G(e,"name",{value:o,configurable:!0});import{a5 as u,w as t,af as X,a6 as T,n as O}from"../packem_chunks/bin.js";var Y=Object.defineProperty,W=m((e,o)=>Y(e,"name",{value:o,configurable:!0}),"n"),Z=Object.defineProperty,q=W((e,o)=>Z(e,"name",{value:o,configurable:!0}),"a"),_=Object.defineProperty,ee=q((e,o)=>_(e,"name",{value:o,configurable:!0}),"t");function P({children:e}){return u.jsx(u.Fragment,{children:e})}m(P,"r");W(P,"c");q(P,"o");ee(P,"Tab");var re=Object.defineProperty,z=m((e,o)=>re(e,"name",{value:o,configurable:!0}),"A"),ne=Object.defineProperty,B=z((e,o)=>ne(e,"name",{value:o,configurable:!0}),"A"),oe=Object.defineProperty,v=B((e,o)=>oe(e,"name",{value:o,configurable:!0}),"b");const te=/^\d$/u,ce=v(e=>e!=null&&typeof e=="object"&&"props"in e&&"name"in e.props,"isTabElement"),ae=v(e=>{const o=[];for(const c of t.Children.toArray(e))ce(c)&&o.push(c);return o},"collectTabs"),V=v((e,o)=>e.some(c=>o[c]),"matchesAnyKey"),ue=v((e,o,c)=>e?o?{backgroundColor:c?.activeTab?.backgroundColor??"green",color:c?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0},"getActiveTabColors");function E({children:e,colors:o,defaultValue:c,flexDirection:g="row",isFocused:h,keyMap:l,onChange:M,showIndex:H=!0,value:j,width:y}){const s=ae(e),a=s.length,d=t.useRef(s);d.current=s;const i=g==="column"||g==="column-reverse",C=j!==void 0,[J,L]=t.useState(()=>{const r=j??c;if(r==null||a===0)return 0;const n=s.findIndex(p=>p.props.name===r);return n===-1?0:n}),x=C?Math.max(0,s.findIndex(r=>r.props.name===j)):J,Q=t.useCallback(()=>{},[]),f=C?Q:L,b=t.useRef(M);b.current=M,t.useEffect(()=>{if(C)return;const r=d.current[x];r&&b.current(r.props.name,r)},[]);const R=t.useMemo(()=>l?.previous??[i?"upArrow":"leftArrow"],[l?.previous,i]),I=t.useMemo(()=>l?.next??[i?"downArrow":"rightArrow"],[l?.next,i]),$=l?.useNumbers??!0,D=l?.useTab??!0,k=t.useRef(x);k.current=x;const F=t.useCallback(r=>{f(r);const n=d.current[r];n&&b.current(n.props.name,n)},[f]),w=t.useCallback(()=>{const r=(k.current+1)%a;f(r);const n=d.current[r];n&&b.current(n.props.name,n)},[a,f]),A=t.useCallback(()=>{const r=(k.current-1+a)%a;f(r);const n=d.current[r];n&&b.current(n.props.name,n)},[a,f]);X(t.useCallback((r,n)=>{if(V(R,n)){A();return}if(V(I,n)){w();return}if(n.tab&&D&&h==null){n.shift?A():w();return}if($&&n.meta&&te.test(r)){const p=r==="0"?9:Number.parseInt(r,10)-1;p<a&&F(p)}},[R,I,D,$,h,A,w,a,F]),{isActive:h!==!1});const K=typeof y=="number"?y:6,U=t.useMemo(()=>i?"─".repeat(K):" | ",[i,K]);return u.jsx(T,{flexDirection:g,width:y,children:s.map((r,n)=>{const{name:p}=r.props,N=ue(x===n,h!==!1,o);let S=null;return H&&(S=u.jsxs(O,{color:"grey",children:[n+1,"."," "]})),u.jsxs(T,{flexDirection:g,children:[n!==0&&u.jsx(O,{color:"dim",children:U}),u.jsxs(T,{children:[S,u.jsx(O,{backgroundColor:N.backgroundColor,color:N.color,children:r})]})]},p)})})}m(E,"g");z(E,"or");B(E,"W");v(E,"Tabs");export{E as g,P as r};
@@ -1,4 +1,4 @@
1
- var N=Object.defineProperty;var x=(o,e)=>N(o,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{M as d,i as g,$ as k,j as J,y as R}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as O}from"../packem_chunks/config.js";const B=I(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=x(o=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,n]=M.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return M.getBuiltinModule(o)}return B(o)},"__cjs_getBuiltinModule"),{execFileSync:w}=j("node:child_process"),{randomBytes:D}=j("node:crypto"),{writeFileSync:U,renameSync:q,unlinkSync:H}=j("node:fs");var z=Object.defineProperty,f=x((o,e)=>z(o,"name",{value:e,configurable:!0}),"f");const V=["proto","mise","fnm","volta","asdf","nvm","corepack"],Z={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},X=["proto","mise","fnm","volta","asdf","nvm","corepack"],W={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},$=new Map,b=f(o=>{const e=$.get(o);if(e!==void 0||$.has(o))return e;const n=process.env.PATH;if(!n){$.set(o,void 0);return}const t=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const r of n.split(J)){const a=r.replaceAll(/^["']|["']$/g,"").trim();if(a!=="")for(const l of t){const s=`${a}${R}${o}${l}`;if(g(s))return $.set(o,s),s}}$.set(o,void 0)},"isOnPath"),_=f((o,e=["--version"])=>{try{const n=w(o,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),t=/\d+\.\d+(?:\.\d+)?/.exec(n);return t?t[0]:n.trim()||void 0}catch{return}},"queryManagerVersion"),A=f((o,e)=>{const n=d(o,"package.json");if(!g(n))return[];try{const t=O(n)[e];if(e==="volta"&&typeof t=="object"&&t!==null&&Object.keys(t).length>0)return["package.json"];if(e==="packageManager"&&typeof t=="string"&&t.length>0)return["package.json"]}catch{}return[]},"pkgFieldConfigFiles"),G=f((o,e)=>o==="volta"?A(e,"volta"):o==="corepack"?A(e,"packageManager"):W[o].filter(n=>g(d(e,n))),"configFilesFor"),P=new Map,K=f(()=>{P.clear(),$.clear()},"clearToolchainCache"),S=f((o,e)=>{if(!e?.refresh){const a=P.get(o);if(a)return a}const n=[],t=!!b("pnpm")||!!b("yarn");for(const a of X){const l=a==="nvm"?void 0:b(a),s=a==="nvm"&&!!process.env.NVM_DIR,c=G(a,o),i=!!l||s;a==="corepack"&&!i&&(!(c.length>0)||t)||!i&&c.length===0||n.push({binPath:l,configFiles:c,installed:i,name:a,version:l?_(l):void 0})}const r=Object.freeze(n);return P.set(o,r),r},"findInstalledManagers"),ye=f((o,e,n)=>{const t=n??S(o);return e?.preferredManager&&e.preferredManager!=="none"?t.find(r=>r.name===e.preferredManager)??{configFiles:[],installed:!1,name:e.preferredManager}:t.find(r=>r.installed&&r.configFiles.length>0)??t.find(r=>r.installed)??t.find(r=>r.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},"pickPrimaryManager"),L=f((o,e)=>{for(const n of e){const t=d(o,n);if(g(t))try{const r=k(t).trim();if(r!=="")return{name:n,value:r.replace(/^v/,"")}}catch{}}},"readVersionFile"),Q=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,Y=f(o=>{const e=d(o,".prototools");if(!g(e))return[];const n=k(e),t=[];let r=!1;for(const a of n.split(/\r?\n/)){const l=a.trim();if(l===""||l.startsWith("#"))continue;if(l.startsWith("[")){r=!0;continue}if(r)continue;const s=Q.exec(l);if(!s)continue;const[,c,i]=s,u=h(c);u&&t.push({source:".prototools",tool:u,version:i.trim()})}return t},"parsePrototools"),ee=/^\[tools\]\s*$/i,oe=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,ne=f(o=>{for(const e of W.mise){const n=d(o,e);if(!g(n))continue;const t=[],r=k(n);let a=!1;for(const l of r.split(/\r?\n/)){const s=l.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){a=ee.test(s);continue}if(!a)continue;const c=oe.exec(s);if(!c)continue;const[,i,u]=c,m=h(i);m&&t.push({source:".mise.toml",tool:m,version:u.trim()})}if(t.length>0)return t}return[]},"parseMiseToml"),te=f(o=>{const e=d(o,".tool-versions");if(!g(e))return[];const n=k(e),t=[];for(const r of n.split(/\r?\n/)){const a=r.trim();if(a===""||a.startsWith("#"))continue;const l=a.split(/\s+/);if(l.length<2)continue;const[s,...c]=l,i=h(s);i&&c[0]&&t.push({source:".tool-versions",tool:i,version:c[0]})}return t},"parseToolVersions"),h=f(o=>{switch(o.toLowerCase()){case"aube":return"aube";case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},"normalizeToolName"),re=f(o=>{const[e]=o.split("+",1),n=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(e??"");if(!n)return;const t=h(n[1]);if(t)return{source:"packageManager",tool:t,version:n[2]}},"parsePackageManagerField"),se=f((o,e)=>{const n=new Map,t=f(s=>{n.set(s.tool,s)},"add"),r=d(o,"package.json");let a={};try{g(r)&&(a=O(r))}catch{}if(a.engines)for(const[s,c]of Object.entries(a.engines)){const i=h(s);i&&typeof c=="string"&&t({source:"engines",tool:i,version:c})}if(a.packageManager){const s=re(a.packageManager);s&&t(s)}if(a.volta)for(const[s,c]of Object.entries(a.volta)){const i=h(s);i&&typeof c=="string"&&t({source:"volta",tool:i,version:c})}const l=L(o,[".nvmrc",".node-version"]);l&&t({source:l.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:l.value});for(const s of te(o))t(s);for(const s of ne(o))t(s);for(const s of Y(o))t(s);if(e?.tools)for(const[s,c]of Object.entries(e.tools)){const i=h(s);i&&typeof c=="string"&&t({source:"vis.config.ts",tool:i,version:c})}return[...n.values()]},"parseExpectedTools"),F={aube:{args:["--version"],binaries:["aube"]},bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},ae=f(o=>{const e=F[o];for(const n of e.binaries){const t=b(n);if(t)return _(t,e.args)}if(o==="node")return process.versions.node},"queryToolVersion"),ie=f((o,e)=>{const n=e.trim();if(n===""||n==="*"||n==="latest")return!0;if(/^\d[\d.]*$/.test(n))return o===n||o.startsWith(`${n}.`);const t=f(s=>s.split(/[.\-+]/).map(c=>Number.parseInt(c,10)||0),"parse"),r=f((s,c)=>{const i=t(s),u=t(c),m=Math.max(i.length,u.length);for(let p=0;p<m;p++){const y=i[p]??0,v=u[p]??0;if(y!==v)return y-v}return 0},"compare"),a=f(s=>{for(const c of s)if(c.startsWith(">=")){if(r(o,c.slice(2).trim())<0)return!1}else if(c.startsWith("<=")){if(r(o,c.slice(2).trim())>0)return!1}else if(c.startsWith(">")){if(r(o,c.slice(1).trim())<=0)return!1}else if(c.startsWith("<")){if(r(o,c.slice(1).trim())>=0)return!1}else if(c.startsWith("^")||c.startsWith("~")){const i=c.slice(1).trim(),[u,m]=t(i),[p,y]=t(o);if(p!==u||c.startsWith("~")&&y!==m||r(o,i)<0)return!1}return!0},"matchesAll"),l=n.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return l.length===0?!0:l.some(s=>a(s))},"satisfies"),ce=f((o,e)=>{switch(o){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return e==="pnpm"||e==="yarn"?["self-activate","volta","proto","mise","corepack"]:e==="npm"?["volta","proto","mise","asdf","corepack"]:e==="aube"?["mise"]:e==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},"preferenceFor"),le=f((o,e,n)=>{if(n?.preferredManager&&n.preferredManager!=="none"&&T(n.preferredManager,o.tool)){const r=e.find(a=>a.name===n.preferredManager);return r?{installed:r.installed,name:r.name}:{installed:!1,name:n.preferredManager,note:`${n.preferredManager} is the preferred manager but isn't on PATH`}}const t=ce(o.source,o.tool);for(const r of t){if(r==="self-activate"){if((o.tool==="pnpm"||o.tool==="yarn")&&b(o.tool))return{installed:!0,name:"self-activate",note:`${o.tool} will activate ${o.version} from the packageManager field on next invocation`};continue}if(T(r,o.tool)&&e.find(a=>a.name===r)?.installed)return{installed:!0,name:r}}for(const r of t)if(!(r==="self-activate"||!T(r,o.tool)))return{installed:!1,name:r,note:`${r} can install ${o.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},"resolveManagerFor"),T=f((o,e)=>o==="none"?!1:o==="self-activate"?e==="pnpm"||e==="yarn":Z[o].includes(e),"canHandle"),fe=f((o,e)=>{const n=S(o),t=se(o,e).map(r=>{const a=ae(r.tool),l=a!==void 0&&ie(a,r.version),s=le(r,n,e);return{actual:a,expected:r,manager:s,matches:l}});return{detected:n,tools:t}},"getToolchainStatus"),pe=f((o,e)=>{switch(o){case"asdf":return e?{args:["install",e.tool,e.version],bin:"asdf"}:void 0;case"corepack":return e?{args:["prepare",`${e.tool}@${e.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return e?.tool!=="node"?void 0:{args:["install",e.version],bin:"fnm"};case"mise":return e?{args:["install",`${e.tool}@${e.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return e?{args:["install",e.tool,e.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:e?.tool??"pnpm",hint:`${e?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return e?{args:["install",`${e.tool}@${e.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildInstallInvocation"),$e=f((o,e)=>{switch(o){case"asdf":return{args:["local",e.tool,e.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${e.tool} ${e.version}`}};case"corepack":return e.tool!=="npm"&&e.tool!=="pnpm"&&e.tool!=="yarn"?void 0:{args:["use",`${e.tool}@${e.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${e.tool}@${e.version}"`}};case"fnm":return e.tool==="node"?{args:["use",e.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${e.tool}@${e.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${e.tool} ${e.version}`}};case"none":return;case"nvm":return e.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",e.tool,e.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${e.tool} ${e.version}`}};case"self-activate":return{args:[],bin:e.tool,configChange:{file:"package.json",hint:`Set packageManager: "${e.tool}@${e.version}" — ${e.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${e.tool}@${e.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${e.tool}`}};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildUseInvocation"),ke=f(o=>{for(const e of F[o].binaries){const n=b(e);if(n)return n}},"findOnPathByAlias"),Me=f((o,e)=>{const n=F[e].binaries;if(o.installed&&o.binPath&&(o.name==="proto"||o.name==="mise"||o.name==="asdf"||o.name==="volta"||o.name==="fnm"))for(const t of n)try{const r=w(o.binPath,["which",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(r)return r}catch{}for(const t of n){const r=b(t);if(r)return r}},"resolveToolBinary"),E=f((o,e)=>{const n=`${o}.${process.pid}.${D(6).toString("hex")}.tmp`;U(n,e);try{q(n,o)}catch(t){try{H(n)}catch{}throw t}},"atomicWrite"),ue=f((o,e)=>{if("packageManager"in o)return o.packageManager=e,o;const n={};let t=!1;for(const[r,a]of Object.entries(o))!t&&(r==="dependencies"||r==="devDependencies"||r==="peerDependencies"||r==="optionalDependencies")&&(n.packageManager=e,t=!0),n[r]=a;return t||(n.packageManager=e),n},"insertPackageManagerKey"),we=f((o,e)=>{if(e.tool!=="pnpm"&&e.tool!=="yarn"&&e.tool!=="npm"&&e.tool!=="bun")return;const n=d(o,"package.json");if(!g(n))throw new Error(`Cannot pin ${e.tool}: ${n} does not exist.`);const t=k(n),r=/\n([ \t]+)/.exec(t)?.[1]??" ";let a;try{a=JSON.parse(t)}catch(i){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${i.message}`,{cause:i})}const l=`${e.tool}@${e.version}`,s=ue(a,l),c=t.endsWith(`
1
+ var N=Object.defineProperty;var x=(o,e)=>N(o,"name",{value:e,configurable:!0});import{createRequire as I}from"node:module";import{j as J,i as g,y as R,M as d,$ as k}from"./readFileSync-4c_c6Qey-6SWMDNdw.js";import{n as O}from"../packem_chunks/config.js";const B=I(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=x(o=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,n]=M.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return M.getBuiltinModule(o)}return B(o)},"__cjs_getBuiltinModule"),{execFileSync:w}=j("node:child_process"),{randomBytes:D}=j("node:crypto"),{writeFileSync:U,renameSync:q,unlinkSync:H}=j("node:fs");var z=Object.defineProperty,f=x((o,e)=>z(o,"name",{value:e,configurable:!0}),"f");const V=["proto","mise","fnm","volta","asdf","nvm","corepack"],Z={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},X=["proto","mise","fnm","volta","asdf","nvm","corepack"],W={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},$=new Map,b=f(o=>{const e=$.get(o);if(e!==void 0||$.has(o))return e;const n=process.env.PATH;if(!n){$.set(o,void 0);return}const t=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const r of n.split(J)){const a=r.replaceAll(/^["']|["']$/g,"").trim();if(a!=="")for(const l of t){const s=`${a}${R}${o}${l}`;if(g(s))return $.set(o,s),s}}$.set(o,void 0)},"isOnPath"),_=f((o,e=["--version"])=>{try{const n=w(o,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),t=/\d+\.\d+(?:\.\d+)?/.exec(n);return t?t[0]:n.trim()||void 0}catch{return}},"queryManagerVersion"),A=f((o,e)=>{const n=d(o,"package.json");if(!g(n))return[];try{const t=O(n)[e];if(e==="volta"&&typeof t=="object"&&t!==null&&Object.keys(t).length>0)return["package.json"];if(e==="packageManager"&&typeof t=="string"&&t.length>0)return["package.json"]}catch{}return[]},"pkgFieldConfigFiles"),G=f((o,e)=>o==="volta"?A(e,"volta"):o==="corepack"?A(e,"packageManager"):W[o].filter(n=>g(d(e,n))),"configFilesFor"),P=new Map,K=f(()=>{P.clear(),$.clear()},"clearToolchainCache"),S=f((o,e)=>{if(!e?.refresh){const a=P.get(o);if(a)return a}const n=[],t=!!b("pnpm")||!!b("yarn");for(const a of X){const l=a==="nvm"?void 0:b(a),s=a==="nvm"&&!!process.env.NVM_DIR,c=G(a,o),i=!!l||s;a==="corepack"&&!i&&(!(c.length>0)||t)||!i&&c.length===0||n.push({binPath:l,configFiles:c,installed:i,name:a,version:l?_(l):void 0})}const r=Object.freeze(n);return P.set(o,r),r},"findInstalledManagers"),ye=f((o,e,n)=>{const t=n??S(o);return e?.preferredManager&&e.preferredManager!=="none"?t.find(r=>r.name===e.preferredManager)??{configFiles:[],installed:!1,name:e.preferredManager}:t.find(r=>r.installed&&r.configFiles.length>0)??t.find(r=>r.installed)??t.find(r=>r.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},"pickPrimaryManager"),L=f((o,e)=>{for(const n of e){const t=d(o,n);if(g(t))try{const r=k(t).trim();if(r!=="")return{name:n,value:r.replace(/^v/,"")}}catch{}}},"readVersionFile"),Q=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,Y=f(o=>{const e=d(o,".prototools");if(!g(e))return[];const n=k(e),t=[];let r=!1;for(const a of n.split(/\r?\n/)){const l=a.trim();if(l===""||l.startsWith("#"))continue;if(l.startsWith("[")){r=!0;continue}if(r)continue;const s=Q.exec(l);if(!s)continue;const[,c,i]=s,u=h(c);u&&t.push({source:".prototools",tool:u,version:i.trim()})}return t},"parsePrototools"),ee=/^\[tools\]\s*$/i,oe=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,ne=f(o=>{for(const e of W.mise){const n=d(o,e);if(!g(n))continue;const t=[],r=k(n);let a=!1;for(const l of r.split(/\r?\n/)){const s=l.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){a=ee.test(s);continue}if(!a)continue;const c=oe.exec(s);if(!c)continue;const[,i,u]=c,m=h(i);m&&t.push({source:".mise.toml",tool:m,version:u.trim()})}if(t.length>0)return t}return[]},"parseMiseToml"),te=f(o=>{const e=d(o,".tool-versions");if(!g(e))return[];const n=k(e),t=[];for(const r of n.split(/\r?\n/)){const a=r.trim();if(a===""||a.startsWith("#"))continue;const l=a.split(/\s+/);if(l.length<2)continue;const[s,...c]=l,i=h(s);i&&c[0]&&t.push({source:".tool-versions",tool:i,version:c[0]})}return t},"parseToolVersions"),h=f(o=>{switch(o.toLowerCase()){case"aube":return"aube";case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},"normalizeToolName"),re=f(o=>{const[e]=o.split("+",1),n=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(e??"");if(!n)return;const t=h(n[1]);if(t)return{source:"packageManager",tool:t,version:n[2]}},"parsePackageManagerField"),se=f((o,e)=>{const n=new Map,t=f(s=>{n.set(s.tool,s)},"add"),r=d(o,"package.json");let a={};try{g(r)&&(a=O(r))}catch{}if(a.engines)for(const[s,c]of Object.entries(a.engines)){const i=h(s);i&&typeof c=="string"&&t({source:"engines",tool:i,version:c})}if(a.packageManager){const s=re(a.packageManager);s&&t(s)}if(a.volta)for(const[s,c]of Object.entries(a.volta)){const i=h(s);i&&typeof c=="string"&&t({source:"volta",tool:i,version:c})}const l=L(o,[".nvmrc",".node-version"]);l&&t({source:l.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:l.value});for(const s of te(o))t(s);for(const s of ne(o))t(s);for(const s of Y(o))t(s);if(e?.tools)for(const[s,c]of Object.entries(e.tools)){const i=h(s);i&&typeof c=="string"&&t({source:"vis.config.ts",tool:i,version:c})}return[...n.values()]},"parseExpectedTools"),F={aube:{args:["--version"],binaries:["aube"]},bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},ae=f(o=>{const e=F[o];for(const n of e.binaries){const t=b(n);if(t)return _(t,e.args)}if(o==="node")return process.versions.node},"queryToolVersion"),ie=f((o,e)=>{const n=e.trim();if(n===""||n==="*"||n==="latest")return!0;if(/^\d[\d.]*$/.test(n))return o===n||o.startsWith(`${n}.`);const t=f(s=>s.split(/[.\-+]/).map(c=>Number.parseInt(c,10)||0),"parse"),r=f((s,c)=>{const i=t(s),u=t(c),m=Math.max(i.length,u.length);for(let p=0;p<m;p++){const y=i[p]??0,v=u[p]??0;if(y!==v)return y-v}return 0},"compare"),a=f(s=>{for(const c of s)if(c.startsWith(">=")){if(r(o,c.slice(2).trim())<0)return!1}else if(c.startsWith("<=")){if(r(o,c.slice(2).trim())>0)return!1}else if(c.startsWith(">")){if(r(o,c.slice(1).trim())<=0)return!1}else if(c.startsWith("<")){if(r(o,c.slice(1).trim())>=0)return!1}else if(c.startsWith("^")||c.startsWith("~")){const i=c.slice(1).trim(),[u,m]=t(i),[p,y]=t(o);if(p!==u||c.startsWith("~")&&y!==m||r(o,i)<0)return!1}return!0},"matchesAll"),l=n.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return l.length===0?!0:l.some(s=>a(s))},"satisfies"),ce=f((o,e)=>{switch(o){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return e==="pnpm"||e==="yarn"?["self-activate","volta","proto","mise","corepack"]:e==="npm"?["volta","proto","mise","asdf","corepack"]:e==="aube"?["mise"]:e==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},"preferenceFor"),le=f((o,e,n)=>{if(n?.preferredManager&&n.preferredManager!=="none"&&T(n.preferredManager,o.tool)){const r=e.find(a=>a.name===n.preferredManager);return r?{installed:r.installed,name:r.name}:{installed:!1,name:n.preferredManager,note:`${n.preferredManager} is the preferred manager but isn't on PATH`}}const t=ce(o.source,o.tool);for(const r of t){if(r==="self-activate"){if((o.tool==="pnpm"||o.tool==="yarn")&&b(o.tool))return{installed:!0,name:"self-activate",note:`${o.tool} will activate ${o.version} from the packageManager field on next invocation`};continue}if(T(r,o.tool)&&e.find(a=>a.name===r)?.installed)return{installed:!0,name:r}}for(const r of t)if(!(r==="self-activate"||!T(r,o.tool)))return{installed:!1,name:r,note:`${r} can install ${o.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},"resolveManagerFor"),T=f((o,e)=>o==="none"?!1:o==="self-activate"?e==="pnpm"||e==="yarn":Z[o].includes(e),"canHandle"),fe=f((o,e)=>{const n=S(o),t=se(o,e).map(r=>{const a=ae(r.tool),l=a!==void 0&&ie(a,r.version),s=le(r,n,e);return{actual:a,expected:r,manager:s,matches:l}});return{detected:n,tools:t}},"getToolchainStatus"),pe=f((o,e)=>{switch(o){case"asdf":return e?{args:["install",e.tool,e.version],bin:"asdf"}:void 0;case"corepack":return e?{args:["prepare",`${e.tool}@${e.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return e?.tool!=="node"?void 0:{args:["install",e.version],bin:"fnm"};case"mise":return e?{args:["install",`${e.tool}@${e.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return e?{args:["install",e.tool,e.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:e?.tool??"pnpm",hint:`${e?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return e?{args:["install",`${e.tool}@${e.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildInstallInvocation"),$e=f((o,e)=>{switch(o){case"asdf":return{args:["local",e.tool,e.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${e.tool} ${e.version}`}};case"corepack":return e.tool!=="npm"&&e.tool!=="pnpm"&&e.tool!=="yarn"?void 0:{args:["use",`${e.tool}@${e.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${e.tool}@${e.version}"`}};case"fnm":return e.tool==="node"?{args:["use",e.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${e.tool}@${e.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${e.tool} ${e.version}`}};case"none":return;case"nvm":return e.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",e.tool,e.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${e.tool} ${e.version}`}};case"self-activate":return{args:[],bin:e.tool,configChange:{file:"package.json",hint:`Set packageManager: "${e.tool}@${e.version}" — ${e.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${e.tool}@${e.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${e.tool}`}};default:{const n=o;throw new Error(`Unknown manager: ${n}`)}}},"buildUseInvocation"),ke=f(o=>{for(const e of F[o].binaries){const n=b(e);if(n)return n}},"findOnPathByAlias"),Me=f((o,e)=>{const n=F[e].binaries;if(o.installed&&o.binPath&&(o.name==="proto"||o.name==="mise"||o.name==="asdf"||o.name==="volta"||o.name==="fnm"))for(const t of n)try{const r=w(o.binPath,["which",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(r)return r}catch{}for(const t of n){const r=b(t);if(r)return r}},"resolveToolBinary"),E=f((o,e)=>{const n=`${o}.${process.pid}.${D(6).toString("hex")}.tmp`;U(n,e);try{q(n,o)}catch(t){try{H(n)}catch{}throw t}},"atomicWrite"),ue=f((o,e)=>{if("packageManager"in o)return o.packageManager=e,o;const n={};let t=!1;for(const[r,a]of Object.entries(o))!t&&(r==="dependencies"||r==="devDependencies"||r==="peerDependencies"||r==="optionalDependencies")&&(n.packageManager=e,t=!0),n[r]=a;return t||(n.packageManager=e),n},"insertPackageManagerKey"),we=f((o,e)=>{if(e.tool!=="pnpm"&&e.tool!=="yarn"&&e.tool!=="npm"&&e.tool!=="bun")return;const n=d(o,"package.json");if(!g(n))throw new Error(`Cannot pin ${e.tool}: ${n} does not exist.`);const t=k(n),r=/\n([ \t]+)/.exec(t)?.[1]??" ";let a;try{a=JSON.parse(t)}catch(i){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${i.message}`,{cause:i})}const l=`${e.tool}@${e.version}`,s=ue(a,l),c=t.endsWith(`
2
2
  `)?`
3
3
  `:"";return E(n,`${JSON.stringify(s,void 0,r)}${c}`),l},"writePackageManagerField"),xe=f((o,e)=>{const n=d(o,"package.json");if(!g(n))return;const t=k(n);let r;try{r=JSON.parse(t)}catch(s){throw new Error(`${n} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${s.message}`,{cause:s})}if(r.engines?.[e.tool]===void 0||r.engines[e.tool]===e.version)return;r.engines[e.tool]=e.version;const a=/\n([ \t]+)/.exec(t)?.[1]??" ",l=t.endsWith(`
4
4
  `)?`
@@ -0,0 +1 @@
1
+ var z=Object.defineProperty;var p=(e,s)=>z(e,"name",{value:s,configurable:!0});import{createRequire as _}from"node:module";import{T as k,e as g}from"./Table-3pFgIUZ2-DABgc6rj.js";import{M as D,i as A}from"./readFileSync-4c_c6Qey-6SWMDNdw.js";import{n as O}from"../packem_chunks/config.js";import{g as P}from"./_commonjsHelpers-CLblCigl.js";import{i as y,p as i}from"../packem_chunks/bin.js";const T=_(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=p(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[s,r]=m.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return m.getBuiltinModule(e)}return T(e)},"__cjs_getBuiltinModule"),{createInterface:C}=M("node:readline");var F=["aj","aju","av","avj","ejv","jav","jv"],L=["angula","angular-node","angularjs"],N=["auto-prefixer"],S=["aaxios","aios","axio","axioos","axios-node","axioss","axis","axiso","axois","axos","axxios"],B=["abel","babbel","babe","babel-js","babel-node","babl","bable","bbael","bebel"],R=["bcrpyt","bcrypt-node","brcypt","crypt","dcrypt"],W=["bcryptjs-node","dcryptjs"],V=["bunan","bunya","bunyan-node","buynan"],E=["cai","cha","chaijs","chal","chi","chia","hai"],U=["cahlk","calk","cchalk","ch4lk","cha1k","chaalk","chaik","chak","chakl","chalk-node","chalkk","challk","chhalk","chlak","chlk","halk","hcalk"],I=["cheero","cherio"],J=["c0lor","ccolor","clor","colo","coloor","color-js","colorjs","colorr","colr","coolor","coolr"],Y=["ccolors","colors-node","colorss","colorz","colrs","coolors"],G=["c0mmander","ccommander","cmmander","cmomander","co-mmander","comamnder","comander","comm4nder","commaander","commader","commadner","commamder","command3r","commandder","commande","commandeer","commander-js","commanderr","commandr","commandre","commanedr","commaner","commannder","commender","commmander","commnader","commnder","coommander","ocmmander","ommander"],H=["cor","corss","cos","cosr","cros","crs","ors"],K=["days"],Q=["d3bug","dbeug","dbug","ddebug","debbug","debg","debgu","debu","debu9","debug-js","debug-node","debugg","debugjs","debuug","deebug","deubg","deug","ebug","edbug"],X=["dot-env","dotenv-node","dotenvjs","dotevn"],Z=["3lectron","eectron","eelctron","eelectron","el3ctron","elcetron","elctron","elecctron","elecron","elecrton","electon","electorn","electr0n","electrn","electrno","electro","electrom","electron-node","electronn","electroon","electrron","electtron","eleectron","eletcron","eletron","ellectron","lectron","leectron"],ee=["asbuild","ebuild","esbuild-node","esbuildjs","ezbuild","sbuild"],oe=["aslint","elint","eslint-js","eslint-node","eslit","ezlint","slint"],se=["eexpress","epress","epxress","experss","expess","exppress","expreess","expres","express-node","expressjs","expresss","exprress","exprses","exprss","exress","exrpess","exxpress","xepress","xpress"],re=["astify"],ae=["firebasejs"],te=["form1dable"],ne=["glb","glo","glob-js","globjs","gob","golb","lob"],ce=["go","goot","gotjs","gott","gt","gto","ogt","ot","qot"],ie=["helmetjs","helnet"],de=["homo","hon","hoo","hoon","ohno","ono"],me=["inquire","inquirer-js","nquirer"],le=["iredis"],pe=["ejst","est","jast","jes","jestjs","jestt","jet","jets","jst"],ue=["imp","jim","jip","jmp"],ve=["ji","jio","jo","joii","jol","oi","oji"],he=["jdom","jsdm","jsdo","jsdom-js","jsdon","jsom","sdom"],je=["jsonwebtoken-js","jsonwebtoken-node"],be=["ka","kao","ko","koaa","koajs","koe","oa","oka"],ke=["1odash","iodash","l0dash","ldash","ldoash","llodash","lo-dash","loadsh","loash","lobash","lod4sh","lodaash","lodah","lodahs","lodas","lodash-node","lodashh","lodassh","loddash","lodesh","lodsah","lodsh","loodash","odash","oldash"],ge=["luca","luci","lucie"],fe=["luon","luxo","luxon-js"],ye=["imcromatch","mciromatch","micormatch","micrmoatch","micro-match","microamtch","micromacth","micromathc","micromtach","mircomatch"],xe=["minimath"],we=["mcha","mmocha","moca","moch","mocha-js","moha","nocha","ocha"],qe=["m0ment","mment","mmoent","mmoment","moemnt","moent","mom3nt","momeent","momemt","momen","momen7","momennt","moment-js","momentjs","momentt","momet","mometn","momment","momnet","momnt","monent","mooment","oment","omment"],$e=["mognoose","mogoose","mongoos","mongose","monqoose","moongoose"],ze=["moran","organ"],_e=["muler","multer-js","muter"],Te=["mysql"],Me=["ext","mext","n3xt","naxt","net","netx","nex","next-js","next-node","nextjs","nxt"],Ce=["node-mailer","nodemailer-js"],De=["nodemo","nodemonjs","nodmeon"],Ae=["oar","or","ora-node","ore","ra","roa"],Oe=["arcel","parce","parceljs"],Pe=["passport-js"],Fe=["phase","phaser-node"],Le=["ino","pimo","pin","pino-node","pinojs","pio","pion"],Ne=["playright","playwright-js"],Se=["postcss-js","postcss-node","potscss"],Be=["pettier","pprettier","pretier","prettierjs","prettierr","prtetier"],Re=["prima","prism","prisma-js","prismajs","prizma"],We=["pupeteer"],Ve=["rada","rama","ramd","randa"],Ee=["eact","eract","r3act","raact","ract","raect","re4ct","reaact","reac","reac7","reacct","react-node","reactjs","reactt","reat","reatc","recat","rect","reeact","reect","rreact"],Ue=["erdis","radis","rdis","redi","redis-js","redis-node","rediss","rediz","reds","reis","rredis"],Ie=["resen","rsend"],Je=["ollup","rollup-js","rollup-node"],Ye=["ass","asss","sas","sass-node","sess","ssas","sss"],Ge=["emver","seemver","semver-node","semvre","senver","sever"],He=["sequelize-js","sequelize-node"],Ke=["harp","shap","shar","sharp-js","sharpjs"],Qe=["stipe","strip","stripe-node","tripe"],Xe=["supabase-js"],Ze=["suelte","svelt3","svelte-js","sveltejs","velte"],eo=["tailwindcss-js"],oo=["auri","taui"],so=["hree","htree","thee","there","three-js","three-node","tree"],ro=["stx","sx","ts","tsxx","ttsx","tx","txs","tzx"],ao=["ttypescript","typecript","typescipt","typescript-node","typescriptjs","typescrit","typescritp"],to=["udnerscore","undercore","underscoer","underscore-node","underscroe","undersocre","undesrcore"],no=["uid","uud","uudi","uui","uuid-js","uuid-node","uuidjs","vuid"],co=["ite","vie","vit","vita","vite-node","vitee","vlte","vte"],io=["itest","uitest","vitestjs","vitezt","vittest","vtest"],mo=["ue","uue","uve","ve","veu","vu","vu3","vua","vue-node","vuee","vuejs","vuue","vve","vvue"],lo=["web-pack","weback","webpac","webpack-node","webpackjs","webpak","weebpack","wepack","wepback"],po=["winson","winston-js","winstoon"],uo=["up","uyp","yp","yu","yupjs","yupp"],vo=["od","zd","zdo","zo","zob","zod-js","zodjs"];const ho={ajv:F,angular:L,autoprefixer:N,"aws-sdk":["awssdk","ews-sdk"],axios:S,babel:B,bcrypt:R,bcryptjs:W,"body-parser":["body-paresr","body-parse","body-parser-js","body_parser"],bunyan:V,chai:E,chalk:U,cheerio:I,color:J,colors:Y,commander:G,"cookie-parser":["cookie-parse","cookieparser"],cors:H,"cross-env":["crossenv"],"date-fns":["data-fns","date-fn"],dayjs:K,debug:Q,dotenv:X,electron:Z,esbuild:ee,eslint:oe,express:se,fastify:re,firebase:ae,formidable:te,glob:ne,got:ce,helmet:ie,hono:de,inquirer:me,ioredis:le,jest:pe,jimp:ue,joi:ve,jsdom:he,jsonwebtoken:je,koa:be,lodash:ke,lucia:ge,luxon:fe,micromatch:ye,minimatch:xe,mocha:we,moment:qe,mongoose:$e,morgan:ze,multer:_e,mysql2:Te,next:Me,"node-fetch":["node-fecth","node-fethc","node.fetch"],nodemailer:Ce,nodemon:De,ora:Ae,parcel:Oe,passport:Pe,phaser:Fe,pino:Le,playwright:Ne,postcss:Se,prettier:Be,prisma:Re,puppeteer:We,ramda:Ve,react:Ee,"react-dom":["eact-dom","eract-dom","r3act-dom","ract-dom","raect-dom","re4ct-dom","reaact-dom","reac-dom","reac7-dom","reacct-dom","react-bom","react-d0m","react-ddom","react-dm","react-dmo","react-do","react-domm","react-don","react-doom","react-odm","react-om","react.dom","reactdom","reactt-dom","reat-dom","reatc-dom","recat-dom","rect-dom","reeact-dom","rreact-dom"],redis:Ue,resend:Ie,rollup:Je,sass:Ye,semver:Ge,sequelize:He,sharp:Ke,"socket.io":["ocket.io","oscket.io","scket.io","scoket.io","soccket.io","socekt.io","socet.io","sock3t.io","socke.io","socke7.io","sockeet.io","socket.1o","socket.i","socket.iio","socket.ioo","socket.lo","socket.o","socket.oi","sockett.io","sockket.io","sockt.io","sockte.io","sokcet.io","soket.io","soocket.io","ssocket.io"],stripe:Qe,supabase:Xe,svelte:Ze,tailwindcss:eo,tauri:oo,three:so,"ts-node":["tts-node"],tsx:ro,typescript:ao,underscore:to,uuid:no,vite:co,vitest:io,vue:mo,webpack:lo,winston:po,yup:uo,zod:vo};var h,f;function jo(){return f||(f=1,h={"@tanstack/start":["start-tanstack-app","tanstack","tanstack-app","tanstack-start"]}),h}p(jo,"requireTyposquatsManual");var bo=jo();const ko=P(bo);var go=Object.defineProperty,n=p((e,s)=>go(e,"name",{value:s,configurable:!0}),"c");const fo={a:["4","e"],b:["d"],d:["b"],e:["3","a"],g:["9","q"],i:["1","l"],l:["1","i"],m:["n"],n:["m"],o:["0"],s:["5","z"],t:["7"],u:["v"],v:["u"]},yo=["app","cli","core","kit","lib","pkg","sdk"],xo=n(e=>{const s=new Set;if(e.length<3)return s;for(let o=0;o<e.length;o++){const a=e[o],t=a==="-"||a==="."||a==="_";if(t||s.add(e.slice(0,o)+e.slice(o+1)),t||s.add(e.slice(0,o)+a+e.slice(o)),o<e.length-1&&e[o]!==e[o+1]){const v=e[o+1]==="-"||e[o+1]==="."||e[o+1]==="_";if(!t&&!v){const d=[...e];[d[o],d[o+1]]=[d[o+1],d[o]],s.add(d.join(""))}}const c=e[o].toLowerCase(),b=fo[c];if(b)for(const v of b)s.add(e.slice(0,o)+v+e.slice(o+1))}const r=/[-._]/g;if(r.test(e))s.add(e.replaceAll(r,"")),s.add(e.replaceAll(r,"-")),s.add(e.replaceAll(r,".")),s.add(e.replaceAll(r,"_"));else if(e.length>5)for(let o=2;o<e.length-2;o++)s.add(`${e.slice(0,o)}-${e.slice(o)}`),s.add(`${e.slice(0,o)}.${e.slice(o)}`),s.add(`${e.slice(0,o)}_${e.slice(o)}`);if(e.startsWith("@")||(s.add(`${e}-js`),s.add(`${e}js`),s.add(`${e}-node`)),e.startsWith("@")){const o=e.indexOf("/");if(o>1&&o<e.length-1){const a=e.slice(1,o),t=e.slice(o+1);a.length>=3&&s.add(a);for(const c of["","-",".","_"])s.add(`${a}${c}${t}`),s.add(`${t}${c}${a}`);for(const c of yo)s.add(`${a}-${c}`),s.add(`${t}-${a}-${c}`),s.add(`${c}-${a}-${t}`)}}return s.delete(e),s},"generateVariants");let j,u,l;const x=n(()=>{if(!j){const e={};for(const s of[ho,ko])for(const[r,o]of Object.entries(s)){const a=e[r]??(e[r]=[]);for(const t of o)a.includes(t)||a.push(t)}j=e}return j},"loadBlocklist"),wo=n(()=>{if(!u){u=new Map;for(const[e,s]of Object.entries(x()))for(const r of s)u.set(r,e)}return u},"getReverseLookup"),qo=n(()=>{if(!l){l=new Map;for(const e of Object.keys(x()))for(const s of xo(e))l.has(s)||l.set(s,e)}return l},"getVariantLookup"),$o=n(e=>e.startsWith("@")?e.split("/")[1]??e:e,"bareName"),zo=n(e=>{const s=$o(e),r=wo().get(s);if(r)return{input:e,legitimate:r,method:"blocklist"};const o=qo().get(s);if(o)return{input:e,legitimate:o,method:"heuristic"}},"checkTyposquat"),w=n((e,s)=>{const r=s?new Set(s):void 0,o=[];for(const a of e){if(r?.has(a))continue;const t=zo(a);t&&o.push(t)}return o},"checkTyposquats"),q=n((e,s)=>{i.warn(""),i.warn(k(`Possible typosquat${e.length===1?"":"s"} ${s}:`));for(const r of e){const o=r.method==="blocklist"?"known typosquat":"similar name";i.warn(` ${g("⚠")} ${k(r.input)} — did you mean ${g(r.legitimate)}? (${o})`)}i.warn("")},"printTyposquatWarnings"),$=n(async e=>{if(!process.stdin.isTTY){i.warn("Aborting: potential typosquat detected in non-interactive mode. Use --no-typosquat-check to skip.");return}const s=C({input:process.stdin,output:process.stdout}),r=await new Promise(o=>{s.question(e,a=>{o(a.trim().toLowerCase())})});return s.close(),r},"askConfirmation"),No=n(async(e,s)=>{if(y("typosquats"))return{ok:!0,packages:e};const r=w(e,s);if(r.length===0)return{ok:!0,packages:e};q(r,"detected");const o=await $(`Use suggested package${r.length===1?"":"s"} instead? [S]uggested / [y]es, keep original / [N]o, abort (default: N) `);if(o===void 0)return{ok:!1,packages:e};if(o==="s"||o==="suggested"){const a=new Map(r.map(t=>[t.input,t.legitimate]));return{ok:!0,packages:e.map(t=>a.get(t)??t)}}return o==="y"||o==="yes"?{ok:!0,packages:e}:{ok:!1,packages:e}},"runTyposquatCheck"),_o=/^(?:npm|pnpm|yarn):(.+?)(?:@.*)?$/,To=n(e=>_o.exec(e)?.[1],"parseAliasTarget"),Mo=n(e=>{if(!A(e))return[];const s=O(e),r={...s.dependencies,...s.devDependencies,...s.optionalDependencies,...s.peerDependencies},o=new Set;for(const[a,t]of Object.entries(r)){o.add(a);const c=To(t);c&&o.add(c)}return[...o]},"readDepsFromPackageJson"),So=n(async(e,s)=>{if(y("typosquats"))return!0;const r=D(e,"package.json"),o=Mo(r);if(o.length===0)return!0;const a=w(o,s);if(a.length===0)return!0;q(a,"in package.json dependencies"),i.warn("Fix the package name in package.json before proceeding.");const t=await $("Continue anyway? [y/N] ");return t==="y"||t==="yes"},"scanDepsForTyposquats");export{No as r,So as s};
@@ -1 +1 @@
1
- var c=Object.defineProperty;var n=(e,r)=>c(e,"name",{value:r,configurable:!0});import{r as s,Z as i}from"../packem_chunks/bin.js";var f=Object.defineProperty,g=n((e,r)=>f(e,"name",{value:r,configurable:!0}),"i");const d=g((e,r)=>{const u=s.useRef(null),[a,o]=s.useState(e);return s.useLayoutEffect(()=>{if(!u.current)return;const{height:t}=i(u.current);t>0&&t!==a&&(o(t),r?.(t))}),{measuredHeight:a,ref:u}},"useMeasuredHeight");export{d as u};
1
+ var c=Object.defineProperty;var n=(e,r)=>c(e,"name",{value:r,configurable:!0});import{w as s,Z as i}from"../packem_chunks/bin.js";var f=Object.defineProperty,g=n((e,r)=>f(e,"name",{value:r,configurable:!0}),"i");const d=g((e,r)=>{const u=s.useRef(null),[a,o]=s.useState(e);return s.useLayoutEffect(()=>{if(!u.current)return;const{height:t}=i(u.current);t>0&&t!==a&&(o(t),r?.(t))}),{measuredHeight:a,ref:u}},"useMeasuredHeight");export{d as u};
@@ -1 +1 @@
1
- var u=Object.defineProperty;var g=(n,s)=>u(n,"name",{value:s,configurable:!0});import{createRequire as m}from"node:module";import{M as i,i as a,$ as f}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{o as $}from"../packem_chunks/bin.js";const j=m(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=g(n=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[s,o]=k.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return k.getBuiltinModule(n)}return j(n)},"__cjs_getBuiltinModule"),{readdirSync:v}=b("node:fs");var w=Object.defineProperty,l=g((n,s)=>w(n,"name",{value:s,configurable:!0}),"o");const _=[".husky/pre-commit",".vis-hooks/pre-commit",".git/hooks/pre-commit"],D=[".secretlintrc",".secretlintrc.json",".secretlintrc.js",".secretlintrc.mjs",".secretlintrc.cjs",".secretlintrc.yml",".secretlintrc.yaml"],S=[".syncpackrc",".syncpackrc.json",".syncpackrc.yaml",".syncpackrc.yml",".syncpackrc.cjs",".syncpackrc.js",".syncpackrc.mjs",".syncpackrc.ts","syncpack.config.cjs","syncpack.config.js","syncpack.config.mjs","syncpack.config.ts"],M=l(n=>{const s=i(n,"package.json");if(!a(s))return[];let o;try{o=JSON.parse(f(s))}catch{return[]}const e=[];if(o.scripts)for(const[t,c]of Object.entries(o.scripts))typeof c=="string"&&(/\bgitleaks\b/.test(c)&&e.push({detail:`Script "${t}" still invokes gitleaks: ${c}`,kind:"script",location:"package.json",tool:"gitleaks"}),/\bsecretlint\b/.test(c)&&e.push({detail:`Script "${t}" still invokes secretlint: ${c}`,kind:"script",location:"package.json",tool:"secretlint"}),/\bsyncpack\b/.test(c)&&e.push({detail:`Script "${t}" still invokes syncpack: ${c}`,kind:"script",location:"package.json",tool:"syncpack"}),/\bsherif\b/.test(c)&&e.push({detail:`Script "${t}" still invokes sherif: ${c}`,kind:"script",location:"package.json",tool:"sherif"}));if(o.devDependencies)for(const t of Object.keys(o.devDependencies))(t==="gitleaks"||t==="@gitleaks/cli")&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"gitleaks"}),(t==="secretlint"||t.startsWith("@secretlint/"))&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"secretlint"}),t==="syncpack"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"syncpack"}),t==="sherif"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"sherif"});return o.sherif&&e.push({detail:"`sherif` config block still present in package.json",kind:"config",location:"package.json",tool:"sherif"}),e},"scanPackageJson"),O=l(n=>{const s=[];for(const o of _){const e=i(n,o);if(!a(e))continue;const t=f(e);/\bgitleaks\b/.test(t)&&s.push({detail:"gitleaks invocation still present in hook",kind:"hook",location:o,tool:"gitleaks"}),/\bsecretlint\b/.test(t)&&s.push({detail:"secretlint invocation still present in hook",kind:"hook",location:o,tool:"secretlint"}),/\bsyncpack\b/.test(t)&&s.push({detail:"syncpack invocation still present in hook",kind:"hook",location:o,tool:"syncpack"}),/\bsherif\b/.test(t)&&s.push({detail:"sherif invocation still present in hook",kind:"hook",location:o,tool:"sherif"})}return s},"scanHooks"),C=l(n=>{const s=[];for(const o of D)a(i(n,o))&&s.push({detail:"secretlint config should be removed after migration",kind:"config",location:o,tool:"secretlint"});for(const o of S)a(i(n,o))&&s.push({detail:"syncpack config should be removed after migration",kind:"config",location:o,tool:"syncpack"});return s},"scanConfigs"),N=[".github/workflows",".gitlab-ci.yml",".circleci/config.yml",".woodpecker.yml",".drone.yml"],q=l(n=>{const s=[],o=l(e=>{const t=i(n,e);if(!a(t))return;const c=f(t);/\bsyncpack\b/.test(c)&&s.push({detail:"syncpack invocation still present in CI",kind:"ci",location:e,tool:"syncpack"}),/\bsherif\b/.test(c)&&s.push({detail:"sherif invocation still present in CI",kind:"ci",location:e,tool:"sherif"})},"scanFile");for(const e of N){const t=i(n,e);if(a(t)){if(e===".github/workflows"){try{for(const c of v(t))(c.endsWith(".yml")||c.endsWith(".yaml"))&&o(`.github/workflows/${c}`)}catch{}continue}o(e)}}return s},"scanCi"),I=l(n=>{const s=[],o=i(n,"pnpm-workspace.yaml");if(a(o)){let t;try{t=$(o)}catch{t=void 0}if(t&&typeof t=="object"){const c=t.catalog;c&&typeof c.syncpack=="string"&&s.push({detail:"`syncpack` still listed in pnpm-workspace.yaml#catalog",kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"});const r=t.catalogs;if(r&&typeof r=="object")for(const[d,p]of Object.entries(r))p&&typeof p.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in pnpm-workspace.yaml#catalogs.${d}`,kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"})}}const e=i(n,"package.json");if(a(e)){let t;try{t=JSON.parse(f(e))}catch{return s}const c=t.workspaces;if(c&&typeof c=="object"&&!Array.isArray(c)){const d=c.catalog;d&&typeof d.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#workspaces.catalog",kind:"catalog",location:"package.json",tool:"syncpack"});const p=c.catalogs;if(p&&typeof p=="object")for(const[h,y]of Object.entries(p))y&&typeof y.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in package.json#workspaces.catalogs.${h}`,kind:"catalog",location:"package.json",tool:"syncpack"})}const r=t.catalog;r&&typeof r.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#catalog",kind:"catalog",location:"package.json",tool:"syncpack"})}return s},"scanCatalogs"),J=l(n=>[...M(n),...O(n),...C(n),...q(n),...I(n)],"scanMigrationLeftovers"),B=l((n,s)=>{const o=J(n);if(o.length===0)return s.info("✓ No unmigrated gitleaks/secretlint/sherif/syncpack references found."),[];s.warn(`Found ${String(o.length)} unmigrated reference(s):`);for(const e of o)s.warn(` [${e.kind}] ${e.location} — ${e.detail}`);return o},"verifyMigration");export{J as s,B as v};
1
+ var u=Object.defineProperty;var g=(n,s)=>u(n,"name",{value:s,configurable:!0});import{createRequire as m}from"node:module";import{M as i,i as a,$ as f}from"./readFileSync-4c_c6Qey-6SWMDNdw.js";import{r as $}from"../packem_chunks/bin.js";const j=m(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=g(n=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[s,o]=k.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return k.getBuiltinModule(n)}return j(n)},"__cjs_getBuiltinModule"),{readdirSync:v}=b("node:fs");var w=Object.defineProperty,l=g((n,s)=>w(n,"name",{value:s,configurable:!0}),"o");const _=[".husky/pre-commit",".vis-hooks/pre-commit",".git/hooks/pre-commit"],D=[".secretlintrc",".secretlintrc.json",".secretlintrc.js",".secretlintrc.mjs",".secretlintrc.cjs",".secretlintrc.yml",".secretlintrc.yaml"],S=[".syncpackrc",".syncpackrc.json",".syncpackrc.yaml",".syncpackrc.yml",".syncpackrc.cjs",".syncpackrc.js",".syncpackrc.mjs",".syncpackrc.ts","syncpack.config.cjs","syncpack.config.js","syncpack.config.mjs","syncpack.config.ts"],M=l(n=>{const s=i(n,"package.json");if(!a(s))return[];let o;try{o=JSON.parse(f(s))}catch{return[]}const e=[];if(o.scripts)for(const[t,c]of Object.entries(o.scripts))typeof c=="string"&&(/\bgitleaks\b/.test(c)&&e.push({detail:`Script "${t}" still invokes gitleaks: ${c}`,kind:"script",location:"package.json",tool:"gitleaks"}),/\bsecretlint\b/.test(c)&&e.push({detail:`Script "${t}" still invokes secretlint: ${c}`,kind:"script",location:"package.json",tool:"secretlint"}),/\bsyncpack\b/.test(c)&&e.push({detail:`Script "${t}" still invokes syncpack: ${c}`,kind:"script",location:"package.json",tool:"syncpack"}),/\bsherif\b/.test(c)&&e.push({detail:`Script "${t}" still invokes sherif: ${c}`,kind:"script",location:"package.json",tool:"sherif"}));if(o.devDependencies)for(const t of Object.keys(o.devDependencies))(t==="gitleaks"||t==="@gitleaks/cli")&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"gitleaks"}),(t==="secretlint"||t.startsWith("@secretlint/"))&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"secretlint"}),t==="syncpack"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"syncpack"}),t==="sherif"&&e.push({detail:`devDependency \`${t}\` is still installed`,kind:"devDep",location:"package.json",tool:"sherif"});return o.sherif&&e.push({detail:"`sherif` config block still present in package.json",kind:"config",location:"package.json",tool:"sherif"}),e},"scanPackageJson"),O=l(n=>{const s=[];for(const o of _){const e=i(n,o);if(!a(e))continue;const t=f(e);/\bgitleaks\b/.test(t)&&s.push({detail:"gitleaks invocation still present in hook",kind:"hook",location:o,tool:"gitleaks"}),/\bsecretlint\b/.test(t)&&s.push({detail:"secretlint invocation still present in hook",kind:"hook",location:o,tool:"secretlint"}),/\bsyncpack\b/.test(t)&&s.push({detail:"syncpack invocation still present in hook",kind:"hook",location:o,tool:"syncpack"}),/\bsherif\b/.test(t)&&s.push({detail:"sherif invocation still present in hook",kind:"hook",location:o,tool:"sherif"})}return s},"scanHooks"),C=l(n=>{const s=[];for(const o of D)a(i(n,o))&&s.push({detail:"secretlint config should be removed after migration",kind:"config",location:o,tool:"secretlint"});for(const o of S)a(i(n,o))&&s.push({detail:"syncpack config should be removed after migration",kind:"config",location:o,tool:"syncpack"});return s},"scanConfigs"),N=[".github/workflows",".gitlab-ci.yml",".circleci/config.yml",".woodpecker.yml",".drone.yml"],q=l(n=>{const s=[],o=l(e=>{const t=i(n,e);if(!a(t))return;const c=f(t);/\bsyncpack\b/.test(c)&&s.push({detail:"syncpack invocation still present in CI",kind:"ci",location:e,tool:"syncpack"}),/\bsherif\b/.test(c)&&s.push({detail:"sherif invocation still present in CI",kind:"ci",location:e,tool:"sherif"})},"scanFile");for(const e of N){const t=i(n,e);if(a(t)){if(e===".github/workflows"){try{for(const c of v(t))(c.endsWith(".yml")||c.endsWith(".yaml"))&&o(`.github/workflows/${c}`)}catch{}continue}o(e)}}return s},"scanCi"),I=l(n=>{const s=[],o=i(n,"pnpm-workspace.yaml");if(a(o)){let t;try{t=$(o)}catch{t=void 0}if(t&&typeof t=="object"){const c=t.catalog;c&&typeof c.syncpack=="string"&&s.push({detail:"`syncpack` still listed in pnpm-workspace.yaml#catalog",kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"});const r=t.catalogs;if(r&&typeof r=="object")for(const[d,p]of Object.entries(r))p&&typeof p.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in pnpm-workspace.yaml#catalogs.${d}`,kind:"catalog",location:"pnpm-workspace.yaml",tool:"syncpack"})}}const e=i(n,"package.json");if(a(e)){let t;try{t=JSON.parse(f(e))}catch{return s}const c=t.workspaces;if(c&&typeof c=="object"&&!Array.isArray(c)){const d=c.catalog;d&&typeof d.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#workspaces.catalog",kind:"catalog",location:"package.json",tool:"syncpack"});const p=c.catalogs;if(p&&typeof p=="object")for(const[h,y]of Object.entries(p))y&&typeof y.syncpack=="string"&&s.push({detail:`\`syncpack\` still listed in package.json#workspaces.catalogs.${h}`,kind:"catalog",location:"package.json",tool:"syncpack"})}const r=t.catalog;r&&typeof r.syncpack=="string"&&s.push({detail:"`syncpack` still listed in package.json#catalog",kind:"catalog",location:"package.json",tool:"syncpack"})}return s},"scanCatalogs"),J=l(n=>[...M(n),...O(n),...C(n),...q(n),...I(n)],"scanMigrationLeftovers"),B=l((n,s)=>{const o=J(n);if(o.length===0)return s.info("✓ No unmigrated gitleaks/secretlint/sherif/syncpack references found."),[];s.warn(`Found ${String(o.length)} unmigrated reference(s):`);for(const e of o)s.warn(` [${e.kind}] ${e.location} — ${e.detail}`);return o},"verifyMigration");export{J as s,B as v};
@@ -1 +1 @@
1
- var me=Object.defineProperty;var b=(d,t)=>me(d,"name",{value:t,configurable:!0});import{aF as ue,a5 as e,a6 as l,n as r,K as xe,aG as fe,aH as ye,aI as we,r as j,af as Ce,aJ as _,aK as ce}from"../packem_chunks/bin.js";import{n as ke}from"./spinner-B9ZPv1iT.js";import{g as be,r as Te}from"./tabs-C-qFIoUv.js";import{u as Se}from"./use-measured-height-kIDCuc76.js";var ve=Object.defineProperty,Ee=b((d,t)=>ve(d,"name",{value:t,configurable:!0}),"a");const er=Ee(({current:d,total:t})=>{const{columns:s}=ue(),i=s||80,a=t>0?Math.min(1,d/t):0,h=`${String(Math.round(a*100)).padStart(3)}%`,f=`${String(d)}/${String(t)}`,y=Math.max(10,i-2-h.length-1),p=Math.round(y*a),g=y-p;return e.jsxs(l,{flexDirection:"column",paddingX:1,children:[e.jsxs(l,{children:[e.jsx(ke,{type:"dots"}),e.jsx(r,{children:" Checking catalog dependencies "}),e.jsx(r,{dimColor:!0,children:f})]}),e.jsxs(l,{children:[e.jsx(r,{color:"cyan",children:"━".repeat(p)}),e.jsx(r,{dimColor:!0,children:"─".repeat(g)}),e.jsxs(r,{dimColor:!0,children:[" ",h]})]})]})},"CheckProgressApp");var Re=Object.defineProperty,S=b((d,t)=>Re(d,"name",{value:t,configurable:!0}),"l");const J=["default","name","updateType","severity"],de=S(d=>{const t=d.vulnerabilities?.map(s=>s.severity)??[];return t.includes("CRITICAL")?4:t.includes("HIGH")?3:t.includes("MODERATE")?2:t.includes("LOW")?1:0},"severityRank"),ae={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},he=S((d,t)=>{if(t==="default")return d;const s=[...d];return t==="name"?s.sort((i,a)=>i.packageName.localeCompare(a.packageName)):t==="updateType"?s.sort((i,a)=>(ae[a.updateType]??0)-(ae[i.updateType]??0)||i.packageName.localeCompare(a.packageName)):s.sort((i,a)=>de(a)-de(i)||i.packageName.localeCompare(a.packageName)),s},"sortEntries"),Z=S(d=>`${d.ecosystem}|${d.file}:${String(d.line)}|${d.name}`,"ecosystemEntryKey"),W=S(d=>{const t=new Map;for(const s of d){const i=t.get(s.catalogName);i?i.push(s):t.set(s.catalogName,[s])}return t},"groupByCatalog"),G=S((d,t,s)=>{let i=d;if(t!=="all"&&(i=t==="security"?i.filter(a=>a.vulnerabilities&&a.vulnerabilities.length>0||a.socketReport&&a.socketReport.alerts.length>0):i.filter(a=>a.updateType===t)),s){const a=s.toLowerCase();i=i.filter(h=>h.packageName.toLowerCase().includes(a))}return i},"filterEntries");class rr{static{b(this,"UpdateStore")}static{S(this,"UpdateStore")}#e;#l=new Set;#t;#s;#i=null;constructor(t,s=null,i=[]){this.#t=t,this.#s=i,s&&(this.#i=new Map(s.recommendations.map(a=>[a.package,a]))),this.#e={aiResult:s,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(i.map(a=>Z(a))),checkedEntries:new Set(t.map(a=>a.packageName)),ecosystemEntries:i,entries:t,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:W(t),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=S(()=>this.#e,"getSnapshot");subscribe=S(t=>(this.#l.add(t),()=>{this.#l.delete(t)}),"subscribe");getFilteredEntries(){return he(G(this.#t,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(t){if(t===this.#e.sortMode)return;const s=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,i=he(G(this.#t,this.#e.filterType,this.#e.filterText),t),a=s?Math.max(0,i.findIndex(h=>h.packageName===s)):0;this.#r({...this.#e,selectedIndex:a,sortMode:t})}cycleSortMode(){const t=J.indexOf(this.#e.sortMode),s=J[(t+1)%J.length]??"default";this.setSortMode(s)}getRecommendation(t){return this.#i?.get(t)}getCheckedEntries(){return this.#t.filter(t=>this.#e.checkedEntries.has(t.packageName))}getCheckedEcosystemEntries(){return this.#s.filter(t=>this.#e.checkedEcosystemKeys.has(Z(t)))}toggleEcosystemCheck(t){const s=new Set(this.#e.checkedEcosystemKeys);s.has(t)?s.delete(t):s.add(t),this.#r({...this.#e,checkedEcosystemKeys:s})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#s.map(t=>Z(t)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(t){const s=this.getFilteredEntries(),i=Math.max(0,Math.min(t,s.length-1));i!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:i})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:t})}setFilterType(t){if(t!==this.#e.filterType){const s=G(this.#t,t,this.#e.filterText);this.#r({...this.#e,entries:s,filterType:t,groupedByCatalog:W(s),selectedIndex:0})}}setFilter(t){const s=G(this.#t,this.#e.filterType,t);this.#r({...this.#e,entries:s,filterText:t,groupedByCatalog:W(s),selectedIndex:0})}setFilterActive(t){if(t!==this.#e.filterActive)if(t)this.#r({...this.#e,filterActive:!0});else{const s=G(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:s,filterActive:!1,filterText:"",groupedByCatalog:W(s),selectedIndex:0})}}toggleCheck(t){const s=new Set(this.#e.checkedEntries);s.has(t)?s.delete(t):s.add(t),this.#r({...this.#e,allChecked:s.size===this.#t.length,checkedEntries:s})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(t=>t.packageName))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const t=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:t.length},phase:"applying"})}updateApplyProgress(t){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:t}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(t){this.#r({...this.#e,error:t,phase:"error"})}#r(t){this.#e=t;for(const s of this.#l)try{s()}catch{}}}var Ae=Object.defineProperty,Ie=b((d,t)=>Ae(d,"name",{value:t,configurable:!0}),"d");const Me={major:"red",minor:"yellow",patch:"green"},De={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Ne={critical:"red",high:"red",low:"gray",medium:"yellow"},Pe={critical:"red",high:"red",low:"green",medium:"yellow"},Le={defer:"gray",review:"yellow",skip:"red",update:"green"},Be=Ie(({changelogUrl:d,entry:t,focused:s,recommendation:i,scrollRef:a})=>{const h=s?"white":"gray";if(!t)return e.jsx(l,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No package selected"})});const f=Me[t.updateType]??"white",y=t.vulnerabilities&&t.vulnerabilities.length>0,p=t.socketReport?.score.overall??0,g=t.socketReport?xe(p):"gray";return e.jsxs(l,{borderColor:h,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsx(l,{flexShrink:0,paddingTop:1,paddingX:2,children:e.jsx(r,{bold:!0,color:"white",children:t.packageName})}),e.jsxs(fe,{flexGrow:1,flexShrink:1,paddingX:2,ref:a,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[e.jsx(r,{}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Current:"})}),e.jsx(r,{children:t.currentRange})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Target:"})}),e.jsx(r,{children:t.newRange}),e.jsxs(r,{bold:!0,color:f,children:[" ","(",t.updateType,")"]})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Version:"})}),e.jsx(r,{children:t.targetVersion})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Catalog:"})}),e.jsx(r,{children:t.catalogName})]}),t.acceptedRisk&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{color:"gray",children:"── "}),e.jsx(r,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),e.jsxs(l,{flexDirection:"column",paddingLeft:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Reason: "}),e.jsx(r,{children:t.acceptedRisk.reason})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Accepted: "}),e.jsx(r,{children:t.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),y&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"red",children:"SECURITY"}),e.jsx(r,{}),t.vulnerabilities.map(o=>e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{gap:1,children:[e.jsxs(r,{bold:!0,color:De[o.severity]??"gray",children:["⚠"," ",o.severity]}),e.jsx(r,{bold:!0,children:o.id})]}),e.jsx(l,{paddingLeft:2,children:e.jsx(r,{children:o.summary})}),e.jsxs(l,{gap:2,paddingLeft:2,children:[o.cvssScore!==void 0&&e.jsxs(r,{dimColor:!0,children:["CVSS:",String(o.cvssScore)]}),o.fixedVersions.length>0&&e.jsxs(r,{dimColor:!0,children:["Fixed in:",o.fixedVersions.join(", ")]})]})]},o.id))]}),t.socketReport&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Overall: "}),e.jsxs(r,{bold:!0,color:g,children:[String(Math.round(p*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Supply Chain: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.supplyChain*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Quality: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.quality*100)),"%"]})]})]}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Maintenance: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.maintenance*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Vulnerability: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.vulnerability*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"License: "}),e.jsxs(r,{children:[t.socketReport.license||"unknown"," ","(",String(Math.round(t.socketReport.score.license*100)),"%)"]})]})]}),t.socketReport.alerts.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsxs(r,{bold:!0,color:"yellow",children:["⚠"," ",String(t.socketReport.alerts.length)," ","alert",t.socketReport.alerts.length===1?"":"s",":"]}),t.socketReport.alerts.map(o=>e.jsxs(l,{gap:1,paddingLeft:2,children:[e.jsxs(r,{bold:!0,color:Ne[o.severity]??"gray",children:["[",o.severity.toUpperCase(),"]"]}),e.jsx(r,{children:o.type}),e.jsxs(r,{dimColor:!0,children:["(",o.category,")"]})]},o.key))]})]}),i&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"AI ANALYSIS"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Action: "}),e.jsx(r,{bold:!0,color:Le[i.action]??"white",children:i.action})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Risk: "}),e.jsx(r,{bold:!0,color:Pe[i.riskLevel]??"white",children:i.riskLevel})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Effort: "}),e.jsx(r,{bold:!0,children:i.effort})]})]}),i.reason&&e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{children:i.reason})}),i.breakingChanges.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Breaking changes:"}),i.breakingChanges.map((o,I)=>e.jsxs(r,{children:[" ","•"," ",o]},String(I)))]})]}),d&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"CHANGELOG"}),e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{color:"cyan",underline:!0,children:d})})]}),e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LINKS"}),e.jsx(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:e.jsxs(r,{color:"cyan",underline:!0,children:["https://npmx.dev/",t.packageName]})})]}),!i&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"GUIDANCE"}),e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.updateType==="major"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),e.jsx(r,{dimColor:!0,children:" Review the changelog before updating."}),e.jsx(r,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),t.updateType==="minor"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),e.jsx(r,{dimColor:!0,children:" Generally safe to update."})]}),t.updateType==="patch"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),e.jsx(r,{dimColor:!0,children:" Safe to update."})]}),!i&&e.jsx(r,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},"PackageDetailPanel");var $e=Object.defineProperty,ee=b((d,t)=>$e(d,"name",{value:t,configurable:!0}),"x");const Fe={major:"red",minor:"yellow",patch:"green"},Oe=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Ue=ee(({checked:d,entry:t,isSelected:s})=>{const i=Fe[t.updateType]??"white",a=t.vulnerabilities&&t.vulnerabilities.length>0,h=t.socketReport&&t.socketReport.alerts.length>0,f=!!t.acceptedRisk,y=d?"☑":"☐",p=t.socketReport?`${String(Math.round(t.socketReport.score.overall*100))}%`:"",g=t.socketReport?xe(t.socketReport.score.overall):"gray";return e.jsxs(l,{flexShrink:0,height:1,children:[e.jsx(r,{children:s?">":" "}),e.jsxs(r,{color:d?"white":"gray",children:[" ",y," "]}),a||h?e.jsx(r,{color:f?"gray":"red",children:f?"✓ ":"⚠ "}):e.jsx(r,{children:" "}),e.jsx(l,{flexGrow:1,children:e.jsxs(r,{bold:s,inverse:s,wrap:"truncate",children:[t.packageName,f?" [ack]":""]})}),p&&e.jsxs(r,{color:g,children:[" ",p]}),e.jsxs(r,{dimColor:!0,children:[" ",t.currentRange]}),e.jsxs(r,{dimColor:!0,children:[" ","→"," "]}),e.jsxs(r,{children:[t.newRange," "]}),e.jsx(r,{bold:!0,color:i,children:t.updateType})]})},"PackageRow"),Ge=ee(({count:d,name:t})=>e.jsxs(l,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{dimColor:!0,children:["▼"," "]}),e.jsx(r,{bold:!0,color:"white",children:t.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",d,")"]})]}),"CatalogHeader"),He=ee(({checkedEntries:d,entries:t,filterActive:s,filteredOutCount:i,filterText:a,filterType:h,focused:f,groupedByCatalog:y,isDryRun:p,onViewportHeightChange:g,scrollOffset:o,selectedIndex:I,totalCatalogEntries:M,totalChecked:v,totalEntries:K,viewportHeight:B})=>{const $=f?"white":"gray",{measuredHeight:m,ref:E}=Se(B,g);let F=0,T=0,D=0,R=0;for(const x of t)x.updateType==="major"?F++:x.updateType==="minor"?T++:D++,(x.vulnerabilities&&x.vulnerabilities.length>0||x.socketReport&&x.socketReport.alerts.length>0)&&R++;const C=[];F>0&&C.push(`${F} major`),T>0&&C.push(`${T} minor`),D>0&&C.push(`${D} patch`),R>0&&C.push(`${R} vulnerable`);const N=C.length>0?` (${C.join(", ")})`:"";let k=0;for(const x of t)d.has(x.packageName)&&k++;const w=[];let V=0;for(const[x,A]of y){w.push(e.jsx(Ge,{count:A.length,name:x},`hdr-${x}`));for(const U of A){const P=V;w.push(e.jsx(Ue,{checked:d.has(U.packageName),entry:U,isSelected:P===I},U.packageName)),V++}}let O=0;for(const[,x]of y)O+=2+x.length;const q=O>m&&m>0;return e.jsxs(l,{borderColor:$,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(l,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[K,v>0?`/${v}`:""," ","outdated",N,M>v?` · ${M-v} dupes`:""]}),!p&&k>0&&e.jsxs(r,{dimColor:!0,children:[" ","—",k," ","selected"]})]}),e.jsx(l,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(be,{isFocused:f,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:b(()=>{},"onChange"),showIndex:!1,value:h,children:Oe.map(({id:x,label:A})=>e.jsx(Te,{name:x,children:A},x))})}),s&&e.jsxs(l,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:a}),e.jsx(r,{inverse:!0,children:" "})]}),i>0&&e.jsx(l,{flexShrink:0,paddingX:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",i," ","package",i===1?"":"s"," ","filtered out by target constraint — press"," ",e.jsx(r,{bold:!0,color:"white",children:"f"})," ","to view"]})}),e.jsxs(l,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:E,children:[e.jsx(l,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(l,{flexDirection:"column",marginTop:-o,children:w})}),q&&e.jsx(l,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(ye,{contentHeight:O,placement:"inset",scrollOffset:o,style:"block",viewportHeight:m})})]},`list-${h}-${a}`)]})},"PackageListPanel");var Ke=Object.defineProperty,Ve=b((d,t)=>Ke(d,"name",{value:t,configurable:!0}),"X");const qe=100,Xe=40,Ye=10,We=[],H=["all","major","minor","patch","security"],tr=Ve(({autoExitSeconds:d=0,changelogUrls:t,checkedCount:s=0,filteredOutEntries:i=We,isDryRun:a,store:h,totalCatalogEntries:f=0})=>{const{exit:y}=we(),{columns:p,rows:g}=ue(),o=j.useSyncExternalStore(h.subscribe,h.getSnapshot),[I,M]=j.useState(!1),[v,K]=j.useState(!1),B=j.useRef(null),$=j.useRef(null),m=j.useRef(null),E=j.useRef(null),[F,T]=j.useState(0),[D,R]=j.useState(!1),[C,N]=j.useState(!1),k=j.useMemo(()=>h.getFilteredEntries(),[o.entries,o.filterType,o.filterText,o.sortMode]),w=k[o.selectedIndex]??null,V=w?h.getRecommendation(w.packageName):void 0,O=w&&t?t.get(w.packageName):void 0,q=j.useCallback(n=>{let c=0,u=0;for(const[,Q]of o.groupedByCatalog){c+=2;for(let ne=0;ne<Q.length;ne++){if(u===n)return c;c+=1,u++}}return c},[o.groupedByCatalog]),x=Math.max(1,g-8-(o.filterActive?1:0)),[A,U]=j.useState(x),P=A>0?A:x,L=j.useCallback(n=>{const c=q(n);T(u=>c>u+P-2?Math.max(0,c-P+2):c<u+1?Math.max(0,c-1):u)},[q,P]);if(j.useEffect(()=>{m.current?.scrollToTop()},[w?.packageName]),Ce((n,c)=>{if(n==="c"&&c.ctrl){y();return}if(!C){if(v){c.escape||n==="f"||n==="q"?K(!1):c.downArrow||n==="j"?$.current?.scrollBy(1):(c.upArrow||n==="k")&&$.current?.scrollBy(-1);return}if(D){n==="u"||c.return?(R(!1),h.startApply(),y(h.getCheckedEntries())):c.escape||n==="q"?R(!1):c.downArrow||n==="j"?E.current?.scrollBy(1):c.upArrow||n==="k"?E.current?.scrollBy(-1):c.pageDown?E.current?.scrollBy(5):c.pageUp&&E.current?.scrollBy(-5);return}if(I){c.escape||n==="?"?M(!1):n==="q"?(M(!1),N(!0)):c.downArrow||n==="j"?B.current?.scrollBy(1):(c.upArrow||n==="k")&&B.current?.scrollBy(-1);return}if(n==="?"){M(!0);return}if(n==="q"){N(!0);return}if(c.tab){h.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(o.focusedPanel==="list"&&(c.leftArrow||c.rightArrow)){const u=H.indexOf(o.filterType),Q=c.rightArrow?(u+1)%H.length:(u-1+H.length)%H.length;T(0),m.current?.scrollToTop(),h.setFilterType(H[Q]);return}if(n==="f"&&i.length>0){K(u=>!u);return}if(o.filterActive){if(c.escape){h.setFilterActive(!1);return}if(c.return){h.setFilterActive(!1);return}if(c.backspace){T(0),h.setFilter(o.filterText.slice(0,-1));return}if(n&&!c.ctrl&&!c.meta){T(0),h.setFilter(o.filterText+n);return}return}if(o.focusedPanel==="list"){if(c.downArrow||n==="j"){const u=Math.min(o.selectedIndex+1,k.length-1);h.setSelectedIndex(u),L(u);return}if(c.upArrow||n==="k"){const u=Math.max(o.selectedIndex-1,0);h.setSelectedIndex(u),L(u);return}if(c.pageDown){const u=Math.min(o.selectedIndex+10,k.length-1);h.setSelectedIndex(u),L(u);return}if(c.pageUp){const u=Math.max(o.selectedIndex-10,0);h.setSelectedIndex(u),L(u);return}if(c.home){h.setSelectedIndex(0),T(0);return}if(c.end){const u=k.length-1;h.setSelectedIndex(u),L(u);return}if(n===" "||c.return){w&&h.toggleCheck(w.packageName);return}if(n==="a"){h.toggleAll();return}if(n==="s"){h.cycleSortMode(),L(h.getSnapshot().selectedIndex);return}if(n==="/"){h.setFilterActive(!0);return}if(n==="u"&&!a&&o.checkedEntries.size>0){R(!0);return}if(c.rightArrow){h.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(c.escape||c.leftArrow){h.setFocusedPanel("list");return}if(c.downArrow||n==="j"){m.current?.scrollBy(1);return}if(c.upArrow||n==="k"){m.current?.scrollBy(-1);return}if(c.pageDown){m.current?.scrollBy(10);return}if(c.pageUp){m.current?.scrollBy(-10);return}if(c.home){m.current?.scrollToTop();return}c.end&&m.current?.scrollToBottom()}}},{isActive:!0}),p<Xe||g<Ye)return e.jsx(l,{alignItems:"center",height:g,justifyContent:"center",width:p,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",p,"x",g,")"]})});const pe=p>=qe,X=[e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]},"sp"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:"ALL"})]},"a")];!a&&o.checkedEntries.size>0&&X.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"green",children:"u"}),e.jsx(r,{dimColor:!0,children:"APPLY"})]},"u")),i.length>0&&X.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"yellow",children:"f"}),e.jsxs(r,{dimColor:!0,children:["FILTERED (",i.length,")"]})]},"fo")),X.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"lr"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"SEARCH"})]},"f"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t"));const re=e.jsx(l,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsx(l,{flexWrap:"wrap",gap:2,paddingX:1,children:X})}),te=e.jsxs(_,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:B,title:"KEYBOARD SHORTCUTS",visible:I,width:52,children:[e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(l,{children:[e.jsx(l,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"SELECTION"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Space"]}),e.jsx(r,{dimColor:!0,children:" Toggle check on package"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","a"]}),e.jsx(r,{dimColor:!0,children:" Toggle check all"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","s"]}),e.jsx(r,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","←→"]}),e.jsx(r,{dimColor:!0,children:" Switch filter tab"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]}),i.length>0&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","f"]}),e.jsx(r,{dimColor:!0,children:" View filtered-out packages"})]})]}),e.jsxs(l,{flexDirection:"column",children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),!a&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","u"]}),e.jsx(r,{dimColor:!0,children:" Apply selected updates"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),Y=h.getCheckedEntries(),z=Y.filter(n=>n.updateType==="major").length,ge=e.jsxs(l,{alignItems:"center",flexDirection:"column",children:[z>0&&e.jsx(l,{marginBottom:1,marginTop:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",z," ","major update",z===1?"":"s"," ","— review breaking changes"]})}),e.jsxs(r,{dimColor:!0,children:["Press"," ",e.jsx(r,{bold:!0,color:"white",children:"u"})," ","or"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),le=e.jsx(_,{footer:ge,scrollRef:E,title:`Apply ${Y.length} update${Y.length===1?"":"s"}?`,visible:D,width:70,children:Y.map(n=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",n.packageName]}),e.jsxs(r,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),e.jsx(r,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))}),se=i.length>0?e.jsx(_,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"f"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:$,title:`${i.length} PACKAGE${i.length===1?"":"S"} FILTERED BY TARGET`,visible:v,width:70,children:e.jsxs(l,{flexDirection:"column",children:[e.jsx(l,{marginBottom:1,children:e.jsxs(r,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",e.jsx(r,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),i.map(n=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",n.packageName]}),e.jsxs(r,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),e.jsx(r,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))]})}):null,ie=e.jsx(He,{checkedEntries:o.checkedEntries,entries:k,filterActive:o.filterActive,filteredOutCount:i.length,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",groupedByCatalog:o.groupedByCatalog,isDryRun:a,onViewportHeightChange:U,scrollOffset:F,selectedIndex:o.selectedIndex,totalCatalogEntries:f,totalChecked:s,totalEntries:k.length,viewportHeight:P}),oe=e.jsx(Be,{changelogUrl:O,entry:w,focused:o.focusedPanel==="detail",recommendation:V,scrollRef:m});if(pe){const n=Math.floor(p*.35);return e.jsxs(l,{flexDirection:"column",height:g,width:p,children:[e.jsxs(l,{flexDirection:"row",flexGrow:1,children:[e.jsx(l,{flexGrow:1,children:ie}),e.jsx(l,{width:n,children:oe})]}),re,le,se,e.jsx(ce,{autoExitSeconds:d||3,onCancel:b(()=>{N(!1)},"onCancel"),visible:C}),te]})}const je=Math.floor(g*.55);return e.jsxs(l,{flexDirection:"column",height:g,width:p,children:[e.jsx(l,{height:je,children:ie}),e.jsx(l,{flexGrow:1,children:oe}),re,le,se,e.jsx(ce,{autoExitSeconds:d||3,onCancel:b(()=>{N(!1)},"onCancel"),visible:C}),te]})},"VisUpdateApp");export{tr as C,rr as U,er as a};
1
+ var me=Object.defineProperty;var b=(d,t)=>me(d,"name",{value:t,configurable:!0});import{aF as ue,a5 as e,a6 as l,n as r,l as xe,aG as fe,aH as ye,aI as we,w as j,af as Ce,aJ as _,aK as ce}from"../packem_chunks/bin.js";import{n as ke}from"./spinner-C8xs6QZv.js";import{g as be,r as Te}from"./tabs-xZkm6Y_J.js";import{u as Se}from"./use-measured-height-Lea6TCVD.js";var ve=Object.defineProperty,Ee=b((d,t)=>ve(d,"name",{value:t,configurable:!0}),"a");const er=Ee(({current:d,total:t})=>{const{columns:s}=ue(),i=s||80,a=t>0?Math.min(1,d/t):0,h=`${String(Math.round(a*100)).padStart(3)}%`,f=`${String(d)}/${String(t)}`,y=Math.max(10,i-2-h.length-1),p=Math.round(y*a),g=y-p;return e.jsxs(l,{flexDirection:"column",paddingX:1,children:[e.jsxs(l,{children:[e.jsx(ke,{type:"dots"}),e.jsx(r,{children:" Checking catalog dependencies "}),e.jsx(r,{dimColor:!0,children:f})]}),e.jsxs(l,{children:[e.jsx(r,{color:"cyan",children:"━".repeat(p)}),e.jsx(r,{dimColor:!0,children:"─".repeat(g)}),e.jsxs(r,{dimColor:!0,children:[" ",h]})]})]})},"CheckProgressApp");var Re=Object.defineProperty,S=b((d,t)=>Re(d,"name",{value:t,configurable:!0}),"l");const J=["default","name","updateType","severity"],de=S(d=>{const t=d.vulnerabilities?.map(s=>s.severity)??[];return t.includes("CRITICAL")?4:t.includes("HIGH")?3:t.includes("MODERATE")?2:t.includes("LOW")?1:0},"severityRank"),ae={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},he=S((d,t)=>{if(t==="default")return d;const s=[...d];return t==="name"?s.sort((i,a)=>i.packageName.localeCompare(a.packageName)):t==="updateType"?s.sort((i,a)=>(ae[a.updateType]??0)-(ae[i.updateType]??0)||i.packageName.localeCompare(a.packageName)):s.sort((i,a)=>de(a)-de(i)||i.packageName.localeCompare(a.packageName)),s},"sortEntries"),Z=S(d=>`${d.ecosystem}|${d.file}:${String(d.line)}|${d.name}`,"ecosystemEntryKey"),W=S(d=>{const t=new Map;for(const s of d){const i=t.get(s.catalogName);i?i.push(s):t.set(s.catalogName,[s])}return t},"groupByCatalog"),G=S((d,t,s)=>{let i=d;if(t!=="all"&&(i=t==="security"?i.filter(a=>a.vulnerabilities&&a.vulnerabilities.length>0||a.socketReport&&a.socketReport.alerts.length>0):i.filter(a=>a.updateType===t)),s){const a=s.toLowerCase();i=i.filter(h=>h.packageName.toLowerCase().includes(a))}return i},"filterEntries");class rr{static{b(this,"UpdateStore")}static{S(this,"UpdateStore")}#e;#l=new Set;#t;#s;#i=null;constructor(t,s=null,i=[]){this.#t=t,this.#s=i,s&&(this.#i=new Map(s.recommendations.map(a=>[a.package,a]))),this.#e={aiResult:s,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(i.map(a=>Z(a))),checkedEntries:new Set(t.map(a=>a.packageName)),ecosystemEntries:i,entries:t,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:W(t),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=S(()=>this.#e,"getSnapshot");subscribe=S(t=>(this.#l.add(t),()=>{this.#l.delete(t)}),"subscribe");getFilteredEntries(){return he(G(this.#t,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(t){if(t===this.#e.sortMode)return;const s=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,i=he(G(this.#t,this.#e.filterType,this.#e.filterText),t),a=s?Math.max(0,i.findIndex(h=>h.packageName===s)):0;this.#r({...this.#e,selectedIndex:a,sortMode:t})}cycleSortMode(){const t=J.indexOf(this.#e.sortMode),s=J[(t+1)%J.length]??"default";this.setSortMode(s)}getRecommendation(t){return this.#i?.get(t)}getCheckedEntries(){return this.#t.filter(t=>this.#e.checkedEntries.has(t.packageName))}getCheckedEcosystemEntries(){return this.#s.filter(t=>this.#e.checkedEcosystemKeys.has(Z(t)))}toggleEcosystemCheck(t){const s=new Set(this.#e.checkedEcosystemKeys);s.has(t)?s.delete(t):s.add(t),this.#r({...this.#e,checkedEcosystemKeys:s})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#s.map(t=>Z(t)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(t){const s=this.getFilteredEntries(),i=Math.max(0,Math.min(t,s.length-1));i!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:i})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:t})}setFilterType(t){if(t!==this.#e.filterType){const s=G(this.#t,t,this.#e.filterText);this.#r({...this.#e,entries:s,filterType:t,groupedByCatalog:W(s),selectedIndex:0})}}setFilter(t){const s=G(this.#t,this.#e.filterType,t);this.#r({...this.#e,entries:s,filterText:t,groupedByCatalog:W(s),selectedIndex:0})}setFilterActive(t){if(t!==this.#e.filterActive)if(t)this.#r({...this.#e,filterActive:!0});else{const s=G(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:s,filterActive:!1,filterText:"",groupedByCatalog:W(s),selectedIndex:0})}}toggleCheck(t){const s=new Set(this.#e.checkedEntries);s.has(t)?s.delete(t):s.add(t),this.#r({...this.#e,allChecked:s.size===this.#t.length,checkedEntries:s})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(t=>t.packageName))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const t=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:t.length},phase:"applying"})}updateApplyProgress(t){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:t}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(t){this.#r({...this.#e,error:t,phase:"error"})}#r(t){this.#e=t;for(const s of this.#l)try{s()}catch{}}}var Ae=Object.defineProperty,Ie=b((d,t)=>Ae(d,"name",{value:t,configurable:!0}),"d");const Me={major:"red",minor:"yellow",patch:"green"},De={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Ne={critical:"red",high:"red",low:"gray",medium:"yellow"},Pe={critical:"red",high:"red",low:"green",medium:"yellow"},Le={defer:"gray",review:"yellow",skip:"red",update:"green"},Be=Ie(({changelogUrl:d,entry:t,focused:s,recommendation:i,scrollRef:a})=>{const h=s?"white":"gray";if(!t)return e.jsx(l,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No package selected"})});const f=Me[t.updateType]??"white",y=t.vulnerabilities&&t.vulnerabilities.length>0,p=t.socketReport?.score.overall??0,g=t.socketReport?xe(p):"gray";return e.jsxs(l,{borderColor:h,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsx(l,{flexShrink:0,paddingTop:1,paddingX:2,children:e.jsx(r,{bold:!0,color:"white",children:t.packageName})}),e.jsxs(fe,{flexGrow:1,flexShrink:1,paddingX:2,ref:a,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[e.jsx(r,{}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Current:"})}),e.jsx(r,{children:t.currentRange})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Target:"})}),e.jsx(r,{children:t.newRange}),e.jsxs(r,{bold:!0,color:f,children:[" ","(",t.updateType,")"]})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Version:"})}),e.jsx(r,{children:t.targetVersion})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Catalog:"})}),e.jsx(r,{children:t.catalogName})]}),t.acceptedRisk&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{color:"gray",children:"── "}),e.jsx(r,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),e.jsxs(l,{flexDirection:"column",paddingLeft:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Reason: "}),e.jsx(r,{children:t.acceptedRisk.reason})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Accepted: "}),e.jsx(r,{children:t.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),y&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"red",children:"SECURITY"}),e.jsx(r,{}),t.vulnerabilities.map(o=>e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{gap:1,children:[e.jsxs(r,{bold:!0,color:De[o.severity]??"gray",children:["⚠"," ",o.severity]}),e.jsx(r,{bold:!0,children:o.id})]}),e.jsx(l,{paddingLeft:2,children:e.jsx(r,{children:o.summary})}),e.jsxs(l,{gap:2,paddingLeft:2,children:[o.cvssScore!==void 0&&e.jsxs(r,{dimColor:!0,children:["CVSS:",String(o.cvssScore)]}),o.fixedVersions.length>0&&e.jsxs(r,{dimColor:!0,children:["Fixed in:",o.fixedVersions.join(", ")]})]})]},o.id))]}),t.socketReport&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Overall: "}),e.jsxs(r,{bold:!0,color:g,children:[String(Math.round(p*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Supply Chain: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.supplyChain*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Quality: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.quality*100)),"%"]})]})]}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Maintenance: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.maintenance*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Vulnerability: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.vulnerability*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"License: "}),e.jsxs(r,{children:[t.socketReport.license||"unknown"," ","(",String(Math.round(t.socketReport.score.license*100)),"%)"]})]})]}),t.socketReport.alerts.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsxs(r,{bold:!0,color:"yellow",children:["⚠"," ",String(t.socketReport.alerts.length)," ","alert",t.socketReport.alerts.length===1?"":"s",":"]}),t.socketReport.alerts.map(o=>e.jsxs(l,{gap:1,paddingLeft:2,children:[e.jsxs(r,{bold:!0,color:Ne[o.severity]??"gray",children:["[",o.severity.toUpperCase(),"]"]}),e.jsx(r,{children:o.type}),e.jsxs(r,{dimColor:!0,children:["(",o.category,")"]})]},o.key))]})]}),i&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"AI ANALYSIS"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Action: "}),e.jsx(r,{bold:!0,color:Le[i.action]??"white",children:i.action})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Risk: "}),e.jsx(r,{bold:!0,color:Pe[i.riskLevel]??"white",children:i.riskLevel})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Effort: "}),e.jsx(r,{bold:!0,children:i.effort})]})]}),i.reason&&e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{children:i.reason})}),i.breakingChanges.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Breaking changes:"}),i.breakingChanges.map((o,I)=>e.jsxs(r,{children:[" ","•"," ",o]},String(I)))]})]}),d&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"CHANGELOG"}),e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{color:"cyan",underline:!0,children:d})})]}),e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LINKS"}),e.jsx(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:e.jsxs(r,{color:"cyan",underline:!0,children:["https://npmx.dev/",t.packageName]})})]}),!i&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"GUIDANCE"}),e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.updateType==="major"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),e.jsx(r,{dimColor:!0,children:" Review the changelog before updating."}),e.jsx(r,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),t.updateType==="minor"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),e.jsx(r,{dimColor:!0,children:" Generally safe to update."})]}),t.updateType==="patch"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),e.jsx(r,{dimColor:!0,children:" Safe to update."})]}),!i&&e.jsx(r,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},"PackageDetailPanel");var $e=Object.defineProperty,ee=b((d,t)=>$e(d,"name",{value:t,configurable:!0}),"x");const Fe={major:"red",minor:"yellow",patch:"green"},Oe=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Ue=ee(({checked:d,entry:t,isSelected:s})=>{const i=Fe[t.updateType]??"white",a=t.vulnerabilities&&t.vulnerabilities.length>0,h=t.socketReport&&t.socketReport.alerts.length>0,f=!!t.acceptedRisk,y=d?"☑":"☐",p=t.socketReport?`${String(Math.round(t.socketReport.score.overall*100))}%`:"",g=t.socketReport?xe(t.socketReport.score.overall):"gray";return e.jsxs(l,{flexShrink:0,height:1,children:[e.jsx(r,{children:s?">":" "}),e.jsxs(r,{color:d?"white":"gray",children:[" ",y," "]}),a||h?e.jsx(r,{color:f?"gray":"red",children:f?"✓ ":"⚠ "}):e.jsx(r,{children:" "}),e.jsx(l,{flexGrow:1,children:e.jsxs(r,{bold:s,inverse:s,wrap:"truncate",children:[t.packageName,f?" [ack]":""]})}),p&&e.jsxs(r,{color:g,children:[" ",p]}),e.jsxs(r,{dimColor:!0,children:[" ",t.currentRange]}),e.jsxs(r,{dimColor:!0,children:[" ","→"," "]}),e.jsxs(r,{children:[t.newRange," "]}),e.jsx(r,{bold:!0,color:i,children:t.updateType})]})},"PackageRow"),Ge=ee(({count:d,name:t})=>e.jsxs(l,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{dimColor:!0,children:["▼"," "]}),e.jsx(r,{bold:!0,color:"white",children:t.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",d,")"]})]}),"CatalogHeader"),He=ee(({checkedEntries:d,entries:t,filterActive:s,filteredOutCount:i,filterText:a,filterType:h,focused:f,groupedByCatalog:y,isDryRun:p,onViewportHeightChange:g,scrollOffset:o,selectedIndex:I,totalCatalogEntries:M,totalChecked:v,totalEntries:K,viewportHeight:B})=>{const $=f?"white":"gray",{measuredHeight:m,ref:E}=Se(B,g);let F=0,T=0,D=0,R=0;for(const x of t)x.updateType==="major"?F++:x.updateType==="minor"?T++:D++,(x.vulnerabilities&&x.vulnerabilities.length>0||x.socketReport&&x.socketReport.alerts.length>0)&&R++;const C=[];F>0&&C.push(`${F} major`),T>0&&C.push(`${T} minor`),D>0&&C.push(`${D} patch`),R>0&&C.push(`${R} vulnerable`);const N=C.length>0?` (${C.join(", ")})`:"";let k=0;for(const x of t)d.has(x.packageName)&&k++;const w=[];let V=0;for(const[x,A]of y){w.push(e.jsx(Ge,{count:A.length,name:x},`hdr-${x}`));for(const U of A){const P=V;w.push(e.jsx(Ue,{checked:d.has(U.packageName),entry:U,isSelected:P===I},U.packageName)),V++}}let O=0;for(const[,x]of y)O+=2+x.length;const q=O>m&&m>0;return e.jsxs(l,{borderColor:$,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(l,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[K,v>0?`/${v}`:""," ","outdated",N,M>v?` · ${M-v} dupes`:""]}),!p&&k>0&&e.jsxs(r,{dimColor:!0,children:[" ","—",k," ","selected"]})]}),e.jsx(l,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(be,{isFocused:f,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:b(()=>{},"onChange"),showIndex:!1,value:h,children:Oe.map(({id:x,label:A})=>e.jsx(Te,{name:x,children:A},x))})}),s&&e.jsxs(l,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:a}),e.jsx(r,{inverse:!0,children:" "})]}),i>0&&e.jsx(l,{flexShrink:0,paddingX:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",i," ","package",i===1?"":"s"," ","filtered out by target constraint — press"," ",e.jsx(r,{bold:!0,color:"white",children:"f"})," ","to view"]})}),e.jsxs(l,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:E,children:[e.jsx(l,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(l,{flexDirection:"column",marginTop:-o,children:w})}),q&&e.jsx(l,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(ye,{contentHeight:O,placement:"inset",scrollOffset:o,style:"block",viewportHeight:m})})]},`list-${h}-${a}`)]})},"PackageListPanel");var Ke=Object.defineProperty,Ve=b((d,t)=>Ke(d,"name",{value:t,configurable:!0}),"X");const qe=100,Xe=40,Ye=10,We=[],H=["all","major","minor","patch","security"],tr=Ve(({autoExitSeconds:d=0,changelogUrls:t,checkedCount:s=0,filteredOutEntries:i=We,isDryRun:a,store:h,totalCatalogEntries:f=0})=>{const{exit:y}=we(),{columns:p,rows:g}=ue(),o=j.useSyncExternalStore(h.subscribe,h.getSnapshot),[I,M]=j.useState(!1),[v,K]=j.useState(!1),B=j.useRef(null),$=j.useRef(null),m=j.useRef(null),E=j.useRef(null),[F,T]=j.useState(0),[D,R]=j.useState(!1),[C,N]=j.useState(!1),k=j.useMemo(()=>h.getFilteredEntries(),[o.entries,o.filterType,o.filterText,o.sortMode]),w=k[o.selectedIndex]??null,V=w?h.getRecommendation(w.packageName):void 0,O=w&&t?t.get(w.packageName):void 0,q=j.useCallback(n=>{let c=0,u=0;for(const[,Q]of o.groupedByCatalog){c+=2;for(let ne=0;ne<Q.length;ne++){if(u===n)return c;c+=1,u++}}return c},[o.groupedByCatalog]),x=Math.max(1,g-8-(o.filterActive?1:0)),[A,U]=j.useState(x),P=A>0?A:x,L=j.useCallback(n=>{const c=q(n);T(u=>c>u+P-2?Math.max(0,c-P+2):c<u+1?Math.max(0,c-1):u)},[q,P]);if(j.useEffect(()=>{m.current?.scrollToTop()},[w?.packageName]),Ce((n,c)=>{if(n==="c"&&c.ctrl){y();return}if(!C){if(v){c.escape||n==="f"||n==="q"?K(!1):c.downArrow||n==="j"?$.current?.scrollBy(1):(c.upArrow||n==="k")&&$.current?.scrollBy(-1);return}if(D){n==="u"||c.return?(R(!1),h.startApply(),y(h.getCheckedEntries())):c.escape||n==="q"?R(!1):c.downArrow||n==="j"?E.current?.scrollBy(1):c.upArrow||n==="k"?E.current?.scrollBy(-1):c.pageDown?E.current?.scrollBy(5):c.pageUp&&E.current?.scrollBy(-5);return}if(I){c.escape||n==="?"?M(!1):n==="q"?(M(!1),N(!0)):c.downArrow||n==="j"?B.current?.scrollBy(1):(c.upArrow||n==="k")&&B.current?.scrollBy(-1);return}if(n==="?"){M(!0);return}if(n==="q"){N(!0);return}if(c.tab){h.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(o.focusedPanel==="list"&&(c.leftArrow||c.rightArrow)){const u=H.indexOf(o.filterType),Q=c.rightArrow?(u+1)%H.length:(u-1+H.length)%H.length;T(0),m.current?.scrollToTop(),h.setFilterType(H[Q]);return}if(n==="f"&&i.length>0){K(u=>!u);return}if(o.filterActive){if(c.escape){h.setFilterActive(!1);return}if(c.return){h.setFilterActive(!1);return}if(c.backspace){T(0),h.setFilter(o.filterText.slice(0,-1));return}if(n&&!c.ctrl&&!c.meta){T(0),h.setFilter(o.filterText+n);return}return}if(o.focusedPanel==="list"){if(c.downArrow||n==="j"){const u=Math.min(o.selectedIndex+1,k.length-1);h.setSelectedIndex(u),L(u);return}if(c.upArrow||n==="k"){const u=Math.max(o.selectedIndex-1,0);h.setSelectedIndex(u),L(u);return}if(c.pageDown){const u=Math.min(o.selectedIndex+10,k.length-1);h.setSelectedIndex(u),L(u);return}if(c.pageUp){const u=Math.max(o.selectedIndex-10,0);h.setSelectedIndex(u),L(u);return}if(c.home){h.setSelectedIndex(0),T(0);return}if(c.end){const u=k.length-1;h.setSelectedIndex(u),L(u);return}if(n===" "||c.return){w&&h.toggleCheck(w.packageName);return}if(n==="a"){h.toggleAll();return}if(n==="s"){h.cycleSortMode(),L(h.getSnapshot().selectedIndex);return}if(n==="/"){h.setFilterActive(!0);return}if(n==="u"&&!a&&o.checkedEntries.size>0){R(!0);return}if(c.rightArrow){h.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(c.escape||c.leftArrow){h.setFocusedPanel("list");return}if(c.downArrow||n==="j"){m.current?.scrollBy(1);return}if(c.upArrow||n==="k"){m.current?.scrollBy(-1);return}if(c.pageDown){m.current?.scrollBy(10);return}if(c.pageUp){m.current?.scrollBy(-10);return}if(c.home){m.current?.scrollToTop();return}c.end&&m.current?.scrollToBottom()}}},{isActive:!0}),p<Xe||g<Ye)return e.jsx(l,{alignItems:"center",height:g,justifyContent:"center",width:p,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",p,"x",g,")"]})});const pe=p>=qe,X=[e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]},"sp"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:"ALL"})]},"a")];!a&&o.checkedEntries.size>0&&X.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"green",children:"u"}),e.jsx(r,{dimColor:!0,children:"APPLY"})]},"u")),i.length>0&&X.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"yellow",children:"f"}),e.jsxs(r,{dimColor:!0,children:["FILTERED (",i.length,")"]})]},"fo")),X.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"lr"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"SEARCH"})]},"f"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t"));const re=e.jsx(l,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsx(l,{flexWrap:"wrap",gap:2,paddingX:1,children:X})}),te=e.jsxs(_,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:B,title:"KEYBOARD SHORTCUTS",visible:I,width:52,children:[e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(l,{children:[e.jsx(l,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"SELECTION"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Space"]}),e.jsx(r,{dimColor:!0,children:" Toggle check on package"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","a"]}),e.jsx(r,{dimColor:!0,children:" Toggle check all"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","s"]}),e.jsx(r,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","←→"]}),e.jsx(r,{dimColor:!0,children:" Switch filter tab"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]}),i.length>0&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","f"]}),e.jsx(r,{dimColor:!0,children:" View filtered-out packages"})]})]}),e.jsxs(l,{flexDirection:"column",children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),!a&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","u"]}),e.jsx(r,{dimColor:!0,children:" Apply selected updates"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),Y=h.getCheckedEntries(),z=Y.filter(n=>n.updateType==="major").length,ge=e.jsxs(l,{alignItems:"center",flexDirection:"column",children:[z>0&&e.jsx(l,{marginBottom:1,marginTop:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",z," ","major update",z===1?"":"s"," ","— review breaking changes"]})}),e.jsxs(r,{dimColor:!0,children:["Press"," ",e.jsx(r,{bold:!0,color:"white",children:"u"})," ","or"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),le=e.jsx(_,{footer:ge,scrollRef:E,title:`Apply ${Y.length} update${Y.length===1?"":"s"}?`,visible:D,width:70,children:Y.map(n=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",n.packageName]}),e.jsxs(r,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),e.jsx(r,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))}),se=i.length>0?e.jsx(_,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"f"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:$,title:`${i.length} PACKAGE${i.length===1?"":"S"} FILTERED BY TARGET`,visible:v,width:70,children:e.jsxs(l,{flexDirection:"column",children:[e.jsx(l,{marginBottom:1,children:e.jsxs(r,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",e.jsx(r,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),i.map(n=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",n.packageName]}),e.jsxs(r,{dimColor:!0,children:[n.currentRange," ","→"," ",n.newRange]}),e.jsx(r,{bold:!0,color:n.updateType==="major"?"red":n.updateType==="minor"?"yellow":"green",children:n.updateType})]},n.packageName))]})}):null,ie=e.jsx(He,{checkedEntries:o.checkedEntries,entries:k,filterActive:o.filterActive,filteredOutCount:i.length,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",groupedByCatalog:o.groupedByCatalog,isDryRun:a,onViewportHeightChange:U,scrollOffset:F,selectedIndex:o.selectedIndex,totalCatalogEntries:f,totalChecked:s,totalEntries:k.length,viewportHeight:P}),oe=e.jsx(Be,{changelogUrl:O,entry:w,focused:o.focusedPanel==="detail",recommendation:V,scrollRef:m});if(pe){const n=Math.floor(p*.35);return e.jsxs(l,{flexDirection:"column",height:g,width:p,children:[e.jsxs(l,{flexDirection:"row",flexGrow:1,children:[e.jsx(l,{flexGrow:1,children:ie}),e.jsx(l,{width:n,children:oe})]}),re,le,se,e.jsx(ce,{autoExitSeconds:d||3,onCancel:b(()=>{N(!1)},"onCancel"),visible:C}),te]})}const je=Math.floor(g*.55);return e.jsxs(l,{flexDirection:"column",height:g,width:p,children:[e.jsx(l,{height:je,children:ie}),e.jsx(l,{flexGrow:1,children:oe}),re,le,se,e.jsx(ce,{autoExitSeconds:d||3,onCancel:b(()=>{N(!1)},"onCancel"),visible:C}),te]})},"VisUpdateApp");export{tr as C,rr as U,er as a};