@visulima/vis 3.0.3 → 3.0.4

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 (85) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE.md +1 -130
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/packem_chunks/catalog.js +1 -1
  6. package/dist/packem_chunks/cli-exec.js +1 -1
  7. package/dist/packem_chunks/cli-main.js +173 -173
  8. package/dist/packem_chunks/fix.js +1 -1
  9. package/dist/packem_chunks/handler.js +1 -1
  10. package/dist/packem_chunks/handler10.js +1 -1
  11. package/dist/packem_chunks/handler11.js +1 -1
  12. package/dist/packem_chunks/handler12.js +1 -1
  13. package/dist/packem_chunks/handler13.js +3 -3
  14. package/dist/packem_chunks/handler14.js +1 -1
  15. package/dist/packem_chunks/handler15.js +1 -1
  16. package/dist/packem_chunks/handler16.js +1 -1
  17. package/dist/packem_chunks/handler17.js +1 -1
  18. package/dist/packem_chunks/handler18.js +1 -1
  19. package/dist/packem_chunks/handler19.js +5 -5
  20. package/dist/packem_chunks/handler2.js +1 -1
  21. package/dist/packem_chunks/handler21.js +2 -2
  22. package/dist/packem_chunks/handler24.js +1 -1
  23. package/dist/packem_chunks/handler27.js +1 -1
  24. package/dist/packem_chunks/handler28.js +1 -1
  25. package/dist/packem_chunks/handler29.js +1 -1
  26. package/dist/packem_chunks/handler3.js +1 -1
  27. package/dist/packem_chunks/handler33.js +2 -2
  28. package/dist/packem_chunks/handler34.js +1 -1
  29. package/dist/packem_chunks/handler45.js +1 -1
  30. package/dist/packem_chunks/handler46.js +1 -1
  31. package/dist/packem_chunks/handler48.js +3 -3
  32. package/dist/packem_chunks/handler5.js +1 -1
  33. package/dist/packem_chunks/handler50.js +6 -6
  34. package/dist/packem_chunks/handler51.js +1 -1
  35. package/dist/packem_chunks/handler54.js +1 -1
  36. package/dist/packem_chunks/handler55.js +1 -1
  37. package/dist/packem_chunks/handler57.js +1 -1
  38. package/dist/packem_chunks/handler58.js +2 -2
  39. package/dist/packem_chunks/handler59.js +2 -2
  40. package/dist/packem_chunks/handler6.js +7 -7
  41. package/dist/packem_chunks/handler62.js +2 -2
  42. package/dist/packem_chunks/handler64.js +3 -3
  43. package/dist/packem_chunks/handler66.js +2 -2
  44. package/dist/packem_chunks/handler68.js +1 -1
  45. package/dist/packem_chunks/handler69.js +2 -2
  46. package/dist/packem_chunks/handler7.js +1 -1
  47. package/dist/packem_chunks/handler70.js +1 -1
  48. package/dist/packem_chunks/handler72.js +2 -2
  49. package/dist/packem_chunks/handler74.js +1 -1
  50. package/dist/packem_chunks/handler76.js +1 -1
  51. package/dist/packem_chunks/handler77.js +4 -4
  52. package/dist/packem_chunks/handler9.js +1 -1
  53. package/dist/packem_chunks/heal-accept.js +1 -1
  54. package/dist/packem_chunks/heal.js +1 -1
  55. package/dist/packem_chunks/help-command.js +7 -7
  56. package/dist/packem_chunks/index5.js +1 -1
  57. package/dist/packem_chunks/keys-refresh.js +1 -1
  58. package/dist/packem_chunks/list.js +1 -1
  59. package/dist/packem_chunks/loader.js +1 -1
  60. package/dist/packem_chunks/sync2.js +1 -1
  61. package/dist/packem_chunks/tripwire.js +1 -1
  62. package/dist/packem_chunks/verify-lockfile.js +1 -1
  63. package/dist/packem_shared/{affected-selection-BMoQWuHl.js → affected-selection-DZLa0Hfn.js} +1 -1
  64. package/dist/packem_shared/{ai-fix-CKN1JGRh.js → ai-fix-CyUx_ZAB.js} +1 -1
  65. package/dist/packem_shared/{bin-CN4heKmb.js → bin-BWrnjd6M.js} +1 -1
  66. package/dist/packem_shared/{failure-log-D92tM0ie.js → failure-log-DE_MJCzB.js} +1 -1
  67. package/dist/packem_shared/{formatBytes-BHAzNIrn-DFIppnY0.js → formatBytes-BHAzNIrn-Bkk_uRS-.js} +1 -1
  68. package/dist/packem_shared/{index-DXPSWMbG.js → index-CIIKPX4H.js} +1 -1
  69. package/dist/packem_shared/index-QChhI1AU.js +1 -0
  70. package/dist/packem_shared/{lifecycle-CfTZQHOG.js → lifecycle-DW8KRF5d.js} +1 -1
  71. package/dist/packem_shared/{package-version-CJxZ_B7G.js → package-version-cRcuUsLC.js} +1 -1
  72. package/dist/packem_shared/{packument-C55kVxcQ.js → packument-CHdDsn0O.js} +1 -1
  73. package/dist/packem_shared/{pm-runner-de-jCq8q.js → pm-runner-d93_73O6.js} +1 -1
  74. package/dist/packem_shared/{project-name-filter-DsrVo0MY.js → project-name-filter-D4q4JaLN.js} +1 -1
  75. package/dist/packem_shared/{provenance-CvfQEJPQ.js → provenance-w-NIPtim.js} +1 -1
  76. package/dist/packem_shared/{registry-keys-DmBrAlhg.js → registry-keys-_IKDLSbu.js} +1 -1
  77. package/dist/packem_shared/{resolve-explicit-DYaHAVDg.js → resolve-explicit-ZZEPWdpP.js} +1 -1
  78. package/dist/packem_shared/{s1ngularity-C8sva2SO.js → s1ngularity-R-zLjQjp.js} +1 -1
  79. package/dist/packem_shared/{signatures-oZ_2IneN.js → signatures-ijwqxAtF.js} +1 -1
  80. package/dist/packem_shared/{vis-update-app-zqSa2clT.js → vis-update-app-DNeU8RBQ.js} +1 -1
  81. package/dist/packem_shared/vis-user-error-DZSnp0Uj.js +30 -0
  82. package/index.js +26 -26
  83. package/package.json +11 -11
  84. package/dist/packem_shared/index-DjTWo3sH.js +0 -1
  85. package/dist/packem_shared/vis-user-error-Dkc97rGY.js +0 -30
@@ -1 +1 @@
1
- import{m as k,D as S,f as L}from"./provenance-CvfQEJPQ.js";import{g as $}from"./packument-C55kVxcQ.js";import{f}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{a as E}from"./build-scripts-pdVmqXRm.js";import{n as h}from"./license-DvlYdo6T.js";import{v as A,U as P,z as x}from"./index-DHD8wb6Z.js";import{S as O}from"./lockfile-DhHAaHN5.js";import{L as b}from"./dependency-scan-DBH2Qo4I.js";const C=2,m=4,y={CRITICAL:0,HIGH:1,LOW:3,MODERATE:C,UNKNOWN:m},ae=(s,e)=>{const n=y[(s.vulnerability.severity??"UNKNOWN").toUpperCase()]??m,t=y[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??m;return n-t||s.packageName.localeCompare(e.packageName)||s.packageVersion.localeCompare(e.packageVersion)},M=(s,e)=>{const n=y[e.toUpperCase()]??C;return(y[s.toUpperCase()]??m)<=n},R=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"],w=6e4,D=(s,e,n)=>{for(const t of n)if(t===s||t===`${s}@${e}`||t.endsWith("*")&&s.startsWith(t.slice(0,-1)))return!0;return!1},W=async(s,e)=>{const n=e.security?.policies?.firstSeen;if(n?.minutes===void 0||n.minutes<=0)return[];const{minutes:t}=n,r=n.exclude??[],a=e.security?.acceptedRisks,c=t*w,o=Date.now();return(await k(s.packages,S,async l=>{if(D(l.name,l.version,r))return;const p=await $(l.name,{workspaceRoot:s.workspaceRoot});if(p===void 0)return;const u=p.time?.[l.version];if(u===void 0)return;const d=Date.parse(u);if(Number.isNaN(d))return;const v=o-d;if(v>=c)return;const g=Math.max(0,Math.floor(v/w));return{acceptedRisk:f(l.name,l.version,a,"firstSeen"),data:{ageMinutes:g,minimumMinutes:t,publishedAt:u},packageName:l.name,policy:"firstSeen",reason:`${l.name}@${l.version} was published ${String(g)} min ago — below the ${String(t)} min firstSeen cooldown.`,severity:"block",version:l.version}})).filter(l=>l!==void 0)},U=(s,e)=>{const n=e.security?.policies?.installScripts;if(!n)return[];const t=n.allow??{},r=n.strict===!0;if(!r&&Object.keys(t).length===0)return[];const a=E(s.workspaceRoot,t,{pinVersions:e.security?.pinVersions===!0});if(a.unapproved.length===0)return[];const c=e.security?.acceptedRisks,o=r?"block":"warn";return a.unapproved.map(i=>({acceptedRisk:f(i.name,i.version??"*",c,"installScripts"),data:{hooks:i.hooks},packageName:i.name,policy:"installScripts",reason:`${i.name}${i.version?`@${i.version}`:""} declares unapproved build script(s): ${i.hooks.join(", ")}`,severity:o,version:i.version??"*"}))},_=new Set(["AND","OR"]),I=s=>{const e=s.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(r=>r.trim()).filter(r=>r.length>0),n=[];let t=!1;for(const r of e){const a=r.toUpperCase();if(t){t=!1;continue}if(a==="WITH"){t=!0;continue}if(_.has(a))continue;const c=r.endsWith("+"),o=c?r.slice(0,-1):r,i=h(o)??o;n.push(i),c&&n.push(`${i}-or-later`)}return n},T=s=>{if(typeof s.license=="string"){const e=s.license.trim();return e.length>0?e:void 0}if(s.license&&typeof s.license=="object"&&typeof s.license.type=="string"){const e=s.license.type.trim();if(e.length>0)return e}if(Array.isArray(s.licenses)&&s.licenses.length>0){const e=s.licenses.map(n=>n&&typeof n.type=="string"?n.type.trim():"").filter(n=>n.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},V=(s,e)=>{if(e.length===0)return;const n=new Set(e.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of s)if(n.has(t.toLowerCase()))return t},F=(s,e)=>{if(e.length===0)return;const n=new Set(e.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of s)if(!n.has(t.toLowerCase()))return t},j=(s,e)=>{const n=e.security?.policies?.license;if(!n)return[];const t=n.allow??[],r=n.deny??[];if(t.length===0&&r.length===0)return[];const a=e.security?.acceptedRisks,c=[];for(const o of s.packages){const i=s.manifestData?.get(`${o.name}@${o.version}`),l=i?T(i):void 0;if(!l){t.length>0&&c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{declaredLicense:null},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} declares no license; allow-list mode requires one of: ${t.join(", ")}`,severity:"block",version:o.version});continue}const p=I(l),u=V(p,r);if(u){c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:o.version});continue}const d=F(p,t);d&&c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{allowList:t,declaredLicense:l,unallowedLicense:d},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses license '${d}' which is not on the allow-list (declared: ${l})`,severity:"block",version:o.version})}return c},K=6e4,z=(s,e,n)=>{for(const t of n)if(t===s||t===`${s}@${e}`||t.endsWith("*")&&s.startsWith(t.slice(0,-1)))return!0;return!1},B=async(s,e)=>{const n=e.security?.policies?.publisherChange;if(n?.mode!=="no-downgrade")return[];const t=n.exclude??[],r=typeof n.ignoreAfter=="number"?n.ignoreAfter*K:void 0,a=e.security?.acceptedRisks,c=Date.now();return(await k(s.packages,S,async i=>{if(z(i.name,i.version,t))return;const l=await $(i.name,{workspaceRoot:s.workspaceRoot});if(l===void 0)return;if(r!==void 0){const d=l.time?.[i.version],v=d===void 0?Number.NaN:Date.parse(d);if(!Number.isNaN(v)&&c-v>r)return}if(l.versions[i.version]?.dist?.attestations?.provenance!==void 0)return;const u=L(l,i.version);if(u!==void 0)return{acceptedRisk:f(i.name,i.version,a,"publisherChange"),data:{priorVersionWithProvenance:u},packageName:i.name,policy:"publisherChange",reason:`${i.name}@${i.version} dropped the provenance attestation that ${i.name}@${u} carried — publisher trust downgrade.`,severity:"block",version:i.version}})).filter(i=>i!==void 0)},Y=s=>{for(const e of Object.values(b))for(const n of[e.file,...e.aliases??[]])if(s===n||s.endsWith(`/${n}`)||s.endsWith(`.${n}`))return e.type},H=(s,e,n)=>{const t=A(e)?e:P(s,e);let r;try{r=x(t)}catch{return}const a=Y(t)??b[n]?.type;if(!a)return;const c=O(r,a);if(c.length===0)return;const o=new Set;for(const i of c)o.add(`${i.name}@${i.version}`);return o},q=(s,e)=>{for(const n of e)if(n===s||n.endsWith("*")&&s.startsWith(n.slice(0,-1)))return!0;return!1},G=(s,e)=>{const n=e.security?.policies?.unexpectedDeps;if(!n)return[];const t=n.allow??[],r=n.baselineLockfile;if(t.length===0&&!r)return[];const a=r?H(s.workspaceRoot,r,s.packageManager):void 0,c=e.security?.acceptedRisks,o=[];for(const i of s.packages){const l=t.length===0||q(i.name,t),p=a?a.has(`${i.name}@${i.version}`):!0;if(l&&p)continue;const u=[],d={};l||(u.push(`not on allow-list (${t.length} entr${t.length===1?"y":"ies"})`),d.allowList=t),!p&&a&&(u.push(`not present in baseline lockfile (${r})`),d.baselineLockfile=r),o.push({acceptedRisk:f(i.name,i.version,c,"unexpectedDeps"),data:d,packageName:i.name,policy:"unexpectedDeps",reason:`${i.name}@${i.version} is unexpected: ${u.join("; ")}`,severity:"block",version:i.version})}return o},X=(s,e)=>{if(!s.osvFindings||s.osvFindings.size===0)return[];const t=e.security?.policies?.vulnerability?.failOn,r=e.security?.acceptedRisks,a=[];for(const c of s.packages){const o=s.osvFindings.get(c.name);if(!(!o||o.length===0))for(const i of o){const l=t?M(i.severity,t)?"block":"warn":"info";a.push({acceptedRisk:f(c.name,c.version,r,"vulnerability"),data:{advisoryId:i.id,aliases:i.aliases??[],cvssScore:i.cvssScore,fixedVersions:i.fixedVersions,severity:i.severity,summary:i.summary},packageName:c.name,policy:"vulnerability",reason:`${i.severity} ${i.id} affects ${c.name}@${c.version}: ${i.summary}`,severity:l,version:c.version})}}return a},N=[{evaluate:X,isConfigured:s=>s.security?.policies?.vulnerability!==void 0,name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:j,isConfigured:s=>{const e=s.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:U,isConfigured:s=>{const e=s.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:G,isConfigured:s=>{const e=s.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:W,isConfigured:s=>{const e=s.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:B,isConfigured:s=>s.security?.policies?.publisherChange?.mode==="no-downgrade",name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],J=(s,e,n)=>N.filter(t=>t.surfaces.includes(s)?n!==void 0?n.has(t.name):t.isConfigured(e):!1),ce=async(s,e,n)=>{const t=J(e,n.visConfig,n.enabledPolicies),r=[];for(const a of t){if(s.offline&&!a.offlineSupported){r.push({packageName:"*",policy:a.name,reason:`policy.${a.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await a.evaluate(s,n.visConfig);r.push(...c)}catch(c){const o=c instanceof Error?c.message:String(c);r.push({packageName:"*",policy:a.name,reason:`policy.${a.name} failed: ${o}`,severity:"info",version:"*"})}}return r},Q=(()=>{const s=new Map;for(const e of R)s.set(e.toLowerCase(),e);return s})(),le=()=>N.map(s=>s.name),ue=(s,e)=>{if(s===void 0)return;const n=s.trim().toLowerCase();if(n===""||n==="none")return new Set;if(n==="all")return new Set(R);const t=new Set;for(const r of s.split(",").map(a=>a.trim()).filter(a=>a.length>0)){const a=r.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(o,i)=>i.toUpperCase()),c=Q.get(a.toLowerCase());c===void 0?e?.(r):t.add(c)}return t};export{ae as c,ce as e,le as g,ue as p,M as s};
1
+ import{m as k,D as S,f as L}from"./provenance-w-NIPtim.js";import{g as $}from"./packument-CHdDsn0O.js";import{f}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{a as E}from"./build-scripts-pdVmqXRm.js";import{n as h}from"./license-DvlYdo6T.js";import{v as A,U as P,z as x}from"./index-DHD8wb6Z.js";import{S as O}from"./lockfile-DhHAaHN5.js";import{L as b}from"./dependency-scan-DBH2Qo4I.js";const C=2,m=4,y={CRITICAL:0,HIGH:1,LOW:3,MODERATE:C,UNKNOWN:m},ae=(s,e)=>{const n=y[(s.vulnerability.severity??"UNKNOWN").toUpperCase()]??m,t=y[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??m;return n-t||s.packageName.localeCompare(e.packageName)||s.packageVersion.localeCompare(e.packageVersion)},M=(s,e)=>{const n=y[e.toUpperCase()]??C;return(y[s.toUpperCase()]??m)<=n},R=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"],w=6e4,D=(s,e,n)=>{for(const t of n)if(t===s||t===`${s}@${e}`||t.endsWith("*")&&s.startsWith(t.slice(0,-1)))return!0;return!1},W=async(s,e)=>{const n=e.security?.policies?.firstSeen;if(n?.minutes===void 0||n.minutes<=0)return[];const{minutes:t}=n,r=n.exclude??[],a=e.security?.acceptedRisks,c=t*w,o=Date.now();return(await k(s.packages,S,async l=>{if(D(l.name,l.version,r))return;const p=await $(l.name,{workspaceRoot:s.workspaceRoot});if(p===void 0)return;const u=p.time?.[l.version];if(u===void 0)return;const d=Date.parse(u);if(Number.isNaN(d))return;const v=o-d;if(v>=c)return;const g=Math.max(0,Math.floor(v/w));return{acceptedRisk:f(l.name,l.version,a,"firstSeen"),data:{ageMinutes:g,minimumMinutes:t,publishedAt:u},packageName:l.name,policy:"firstSeen",reason:`${l.name}@${l.version} was published ${String(g)} min ago — below the ${String(t)} min firstSeen cooldown.`,severity:"block",version:l.version}})).filter(l=>l!==void 0)},U=(s,e)=>{const n=e.security?.policies?.installScripts;if(!n)return[];const t=n.allow??{},r=n.strict===!0;if(!r&&Object.keys(t).length===0)return[];const a=E(s.workspaceRoot,t,{pinVersions:e.security?.pinVersions===!0});if(a.unapproved.length===0)return[];const c=e.security?.acceptedRisks,o=r?"block":"warn";return a.unapproved.map(i=>({acceptedRisk:f(i.name,i.version??"*",c,"installScripts"),data:{hooks:i.hooks},packageName:i.name,policy:"installScripts",reason:`${i.name}${i.version?`@${i.version}`:""} declares unapproved build script(s): ${i.hooks.join(", ")}`,severity:o,version:i.version??"*"}))},_=new Set(["AND","OR"]),I=s=>{const e=s.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(r=>r.trim()).filter(r=>r.length>0),n=[];let t=!1;for(const r of e){const a=r.toUpperCase();if(t){t=!1;continue}if(a==="WITH"){t=!0;continue}if(_.has(a))continue;const c=r.endsWith("+"),o=c?r.slice(0,-1):r,i=h(o)??o;n.push(i),c&&n.push(`${i}-or-later`)}return n},T=s=>{if(typeof s.license=="string"){const e=s.license.trim();return e.length>0?e:void 0}if(s.license&&typeof s.license=="object"&&typeof s.license.type=="string"){const e=s.license.type.trim();if(e.length>0)return e}if(Array.isArray(s.licenses)&&s.licenses.length>0){const e=s.licenses.map(n=>n&&typeof n.type=="string"?n.type.trim():"").filter(n=>n.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},V=(s,e)=>{if(e.length===0)return;const n=new Set(e.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of s)if(n.has(t.toLowerCase()))return t},F=(s,e)=>{if(e.length===0)return;const n=new Set(e.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of s)if(!n.has(t.toLowerCase()))return t},j=(s,e)=>{const n=e.security?.policies?.license;if(!n)return[];const t=n.allow??[],r=n.deny??[];if(t.length===0&&r.length===0)return[];const a=e.security?.acceptedRisks,c=[];for(const o of s.packages){const i=s.manifestData?.get(`${o.name}@${o.version}`),l=i?T(i):void 0;if(!l){t.length>0&&c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{declaredLicense:null},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} declares no license; allow-list mode requires one of: ${t.join(", ")}`,severity:"block",version:o.version});continue}const p=I(l),u=V(p,r);if(u){c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:o.version});continue}const d=F(p,t);d&&c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{allowList:t,declaredLicense:l,unallowedLicense:d},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses license '${d}' which is not on the allow-list (declared: ${l})`,severity:"block",version:o.version})}return c},K=6e4,z=(s,e,n)=>{for(const t of n)if(t===s||t===`${s}@${e}`||t.endsWith("*")&&s.startsWith(t.slice(0,-1)))return!0;return!1},B=async(s,e)=>{const n=e.security?.policies?.publisherChange;if(n?.mode!=="no-downgrade")return[];const t=n.exclude??[],r=typeof n.ignoreAfter=="number"?n.ignoreAfter*K:void 0,a=e.security?.acceptedRisks,c=Date.now();return(await k(s.packages,S,async i=>{if(z(i.name,i.version,t))return;const l=await $(i.name,{workspaceRoot:s.workspaceRoot});if(l===void 0)return;if(r!==void 0){const d=l.time?.[i.version],v=d===void 0?Number.NaN:Date.parse(d);if(!Number.isNaN(v)&&c-v>r)return}if(l.versions[i.version]?.dist?.attestations?.provenance!==void 0)return;const u=L(l,i.version);if(u!==void 0)return{acceptedRisk:f(i.name,i.version,a,"publisherChange"),data:{priorVersionWithProvenance:u},packageName:i.name,policy:"publisherChange",reason:`${i.name}@${i.version} dropped the provenance attestation that ${i.name}@${u} carried — publisher trust downgrade.`,severity:"block",version:i.version}})).filter(i=>i!==void 0)},Y=s=>{for(const e of Object.values(b))for(const n of[e.file,...e.aliases??[]])if(s===n||s.endsWith(`/${n}`)||s.endsWith(`.${n}`))return e.type},H=(s,e,n)=>{const t=A(e)?e:P(s,e);let r;try{r=x(t)}catch{return}const a=Y(t)??b[n]?.type;if(!a)return;const c=O(r,a);if(c.length===0)return;const o=new Set;for(const i of c)o.add(`${i.name}@${i.version}`);return o},q=(s,e)=>{for(const n of e)if(n===s||n.endsWith("*")&&s.startsWith(n.slice(0,-1)))return!0;return!1},G=(s,e)=>{const n=e.security?.policies?.unexpectedDeps;if(!n)return[];const t=n.allow??[],r=n.baselineLockfile;if(t.length===0&&!r)return[];const a=r?H(s.workspaceRoot,r,s.packageManager):void 0,c=e.security?.acceptedRisks,o=[];for(const i of s.packages){const l=t.length===0||q(i.name,t),p=a?a.has(`${i.name}@${i.version}`):!0;if(l&&p)continue;const u=[],d={};l||(u.push(`not on allow-list (${t.length} entr${t.length===1?"y":"ies"})`),d.allowList=t),!p&&a&&(u.push(`not present in baseline lockfile (${r})`),d.baselineLockfile=r),o.push({acceptedRisk:f(i.name,i.version,c,"unexpectedDeps"),data:d,packageName:i.name,policy:"unexpectedDeps",reason:`${i.name}@${i.version} is unexpected: ${u.join("; ")}`,severity:"block",version:i.version})}return o},X=(s,e)=>{if(!s.osvFindings||s.osvFindings.size===0)return[];const t=e.security?.policies?.vulnerability?.failOn,r=e.security?.acceptedRisks,a=[];for(const c of s.packages){const o=s.osvFindings.get(c.name);if(!(!o||o.length===0))for(const i of o){const l=t?M(i.severity,t)?"block":"warn":"info";a.push({acceptedRisk:f(c.name,c.version,r,"vulnerability"),data:{advisoryId:i.id,aliases:i.aliases??[],cvssScore:i.cvssScore,fixedVersions:i.fixedVersions,severity:i.severity,summary:i.summary},packageName:c.name,policy:"vulnerability",reason:`${i.severity} ${i.id} affects ${c.name}@${c.version}: ${i.summary}`,severity:l,version:c.version})}}return a},N=[{evaluate:X,isConfigured:s=>s.security?.policies?.vulnerability!==void 0,name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:j,isConfigured:s=>{const e=s.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:U,isConfigured:s=>{const e=s.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:G,isConfigured:s=>{const e=s.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:W,isConfigured:s=>{const e=s.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:B,isConfigured:s=>s.security?.policies?.publisherChange?.mode==="no-downgrade",name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],J=(s,e,n)=>N.filter(t=>t.surfaces.includes(s)?n!==void 0?n.has(t.name):t.isConfigured(e):!1),ce=async(s,e,n)=>{const t=J(e,n.visConfig,n.enabledPolicies),r=[];for(const a of t){if(s.offline&&!a.offlineSupported){r.push({packageName:"*",policy:a.name,reason:`policy.${a.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await a.evaluate(s,n.visConfig);r.push(...c)}catch(c){const o=c instanceof Error?c.message:String(c);r.push({packageName:"*",policy:a.name,reason:`policy.${a.name} failed: ${o}`,severity:"info",version:"*"})}}return r},Q=(()=>{const s=new Map;for(const e of R)s.set(e.toLowerCase(),e);return s})(),le=()=>N.map(s=>s.name),ue=(s,e)=>{if(s===void 0)return;const n=s.trim().toLowerCase();if(n===""||n==="none")return new Set;if(n==="all")return new Set(R);const t=new Set;for(const r of s.split(",").map(a=>a.trim()).filter(a=>a.length>0)){const a=r.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(o,i)=>i.toUpperCase()),c=Q.get(a.toLowerCase());c===void 0?e?.(r):t.add(c)}return t};export{ae as c,ce as e,le as g,ue as p,M as s};
@@ -0,0 +1 @@
1
+ import{b as e}from"./vis-user-error-DZSnp0Uj.js";const o={filter:{alias:"F",description:"Filter packages by name pattern",multiple:!0,type:String},parallel:{defaultValue:!1,description:"Run concurrently without topological ordering",type:Boolean},recursive:{alias:"r",defaultValue:!1,description:"Run in every workspace package",type:Boolean},reverse:{defaultValue:!1,description:"Reverse topological execution order",type:Boolean},"shell-mode":{alias:"c",defaultValue:!1,description:"Execute within shell environment",type:Boolean},"workspace-root":{alias:"w",defaultValue:!1,description:"Run on workspace root only",type:Boolean}},l=e({argument:{description:"Command to execute followed by arguments",name:"command",type:String},description:"Execute a local node_modules/.bin command (no remote fallback)",examples:[["vis exec eslint .","Run local eslint"],["vis exec tsc --noEmit","Run local TypeScript check"],["vis exec -r -- eslint .","Run in all workspace packages"],["vis exec -c 'echo $PATH'","Shell mode"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler.js"),name:"exec",options:o});export{l as e};
@@ -1,2 +1,2 @@
1
- import{createRequire as K}from"node:module";import{n as E,o as z,C as S,f as X,e as h}from"./index-DHD8wb6Z.js";import{p as rt}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{N as it}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{r as D}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{withEnhancedPath as lt}from"@visulima/task-runner";let V;const U=t=>(V??=K(import.meta.url))(t),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=t=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[e,o]=f.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return f.getBuiltinModule(t)}return U(t)},{Socket:Y}=l("node:net"),{randomBytes:J}=l("node:crypto"),{readdir:Q,rm:b,unlink:$,open:Z,readFile:tt,stat:et,writeFile:ot,rename:st}=l("node:fs/promises"),{createRequire:M}=l("node:module"),{spawn:nt}=l("node:child_process"),{openSync:ct,closeSync:at}=l("node:fs");let ht;const dt=t=>(ht??=M(import.meta.url))(t),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,o]=u.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return u.getBuiltinModule(t)}return dt(t)},{lstat:A,mkdir:ut}=ft("node:fs/promises"),pt=async t=>{E(t);try{const e=await A(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await ut(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const o=await A(t);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(o))}'`,{cause:e})}};let wt;const yt=t=>(wt??=M(import.meta.url))(t),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=t=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,o]=p.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return p.getBuiltinModule(t)}return yt(t)},{access:mt}=kt("node:fs/promises");async function _t(t,e=z){E(t),t=S(t);try{return await mt(t,e),!0}catch{return!1}}let gt;const vt=t=>(gt??=M(import.meta.url))(t),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=t=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,o]=w.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return w.getBuiltinModule(t)}return vt(t)},{readFile:bt}=x("node:fs/promises"),{unzip:Tt,brotliDecompress:Et}=x("node:zlib"),St={brotli:Et,gzip:Tt,none:(t,e)=>{e(null,t)}},Mt=async(t,e)=>{E(t),t=S(t);const{buffer:o,compression:s,encoding:r,flag:i}=e??{};let n;try{n=await bt(t,i?{flag:i}:{})}catch(c){throw X(c,t)}return await new Promise((c,g)=>{St[s??"none"](n,(k,m)=>{k?g(k):c(o?m:m.toString(r??"utf8"))})})};async function C(t,e,o){const s=await Mt(t,{buffer:!0,encoding:void 0});let r=new TextDecoder().decode(s);const{beforeParse:i,color:n}={};return typeof i=="function"&&(r=i(r)),it(r,e,S(t),{color:n})}const Ht=3e4,N=100;class Rt extends Error{constructor(e,o){super(e),this.elapsedMs=o,this.name="ServiceReadinessError"}elapsedMs}const Pt=async t=>{const e=t.host??"127.0.0.1",{port:o}=t,s=t.timeoutMs??Ht,r=Date.now();for(;Date.now()-r<s;){if(await $t(e,o))return;await Dt(N)}throw new Rt(`Timed out waiting for ${e}:${String(o)} to accept TCP connections (${String(s)}ms)`,Date.now()-r)},$t=(t,e)=>new Promise(o=>{const s=new Y,r=i=>{s.removeAllListeners(),s.destroy(),o(i)};s.once("connect",()=>{r(!0)}),s.once("error",()=>{r(!1)}),s.setTimeout(N,()=>{r(!1)});try{s.connect(e,t)}catch{r(!1)}}),Dt=t=>new Promise(e=>{setTimeout(e,t)}),At=async(t,e)=>{const o=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});o&&await Pt({host:o.tcp.host,port:o.tcp.port,timeoutMs:e?.timeoutMs??o.tcp.timeoutMs})},H=384,L=5e3,Lt=50,Ot=3e4,d=async t=>{const e=h(rt(t),"services");try{await pt(e)}catch(o){throw o.code==="ENOTDIR"?new Error(`Service registry path ${e} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:o}):o}return e},R=t=>t.replaceAll("/","_").replaceAll(":","__"),P=(t,e)=>h(t,`${R(e)}.json`),It=(t,e)=>h(t,`${R(e)}.lock`),_=async(t,e)=>{const o=await d(t),s=P(o,e);if(await _t(s))try{return await C(s)}catch{return}},xt=async t=>{const e=await d(t);let o;try{o=await Q(e)}catch{return[]}const s=[];for(const r of o)if(r.endsWith(".json"))try{const i=await C(h(e,r));s.push(i)}catch{}return s},Ct=async(t,e)=>{const o=await d(t),s=P(o,e.id),r=h(o,`.${J(8).toString("hex")}.tmp`);await ot(r,`${JSON.stringify(e,void 0,2)}
1
+ import{createRequire as K}from"node:module";import{n as E,o as z,C as S,f as X,e as h}from"./index-DHD8wb6Z.js";import{p as rt}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{N as it}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{r as D}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{withEnhancedPath as lt}from"@visulima/task-runner";let V;const U=t=>(V??=K(import.meta.url))(t),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=t=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[e,o]=f.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return f.getBuiltinModule(t)}return U(t)},{Socket:Y}=l("node:net"),{randomBytes:J}=l("node:crypto"),{readdir:Q,rm:b,unlink:$,open:Z,readFile:tt,stat:et,writeFile:ot,rename:st}=l("node:fs/promises"),{createRequire:M}=l("node:module"),{spawn:nt}=l("node:child_process"),{openSync:ct,closeSync:at}=l("node:fs");let ht;const dt=t=>(ht??=M(import.meta.url))(t),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,o]=u.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return u.getBuiltinModule(t)}return dt(t)},{lstat:A,mkdir:ut}=ft("node:fs/promises"),pt=async t=>{E(t);try{const e=await A(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await ut(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const o=await A(t);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(o))}'`,{cause:e})}};let wt;const yt=t=>(wt??=M(import.meta.url))(t),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=t=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,o]=p.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return p.getBuiltinModule(t)}return yt(t)},{access:mt}=kt("node:fs/promises");async function _t(t,e=z){E(t),t=S(t);try{return await mt(t,e),!0}catch{return!1}}let gt;const vt=t=>(gt??=M(import.meta.url))(t),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=t=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,o]=w.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return w.getBuiltinModule(t)}return vt(t)},{readFile:bt}=x("node:fs/promises"),{unzip:Tt,brotliDecompress:Et}=x("node:zlib"),St={brotli:Et,gzip:Tt,none:(t,e)=>{e(null,t)}},Mt=async(t,e)=>{E(t),t=S(t);const{buffer:o,compression:s,encoding:r,flag:i}=e??{};let n;try{n=await bt(t,i?{flag:i}:{})}catch(c){throw X(c,t)}return await new Promise((c,g)=>{St[s??"none"](n,(k,m)=>{k?g(k):c(o?m:m.toString(r??"utf8"))})})};async function C(t,e,o){const s=await Mt(t,{buffer:!0,encoding:void 0});let r=new TextDecoder().decode(s);const{beforeParse:i,color:n}={};return typeof i=="function"&&(r=i(r)),it(r,e,S(t),{color:n})}const Ht=3e4,N=100;class Rt extends Error{constructor(e,o){super(e),this.elapsedMs=o,this.name="ServiceReadinessError"}elapsedMs}const Pt=async t=>{const e=t.host??"127.0.0.1",{port:o}=t,s=t.timeoutMs??Ht,r=Date.now();for(;Date.now()-r<s;){if(await $t(e,o))return;await Dt(N)}throw new Rt(`Timed out waiting for ${e}:${String(o)} to accept TCP connections (${String(s)}ms)`,Date.now()-r)},$t=(t,e)=>new Promise(o=>{const s=new Y,r=i=>{s.removeAllListeners(),s.destroy(),o(i)};s.once("connect",()=>{r(!0)}),s.once("error",()=>{r(!1)}),s.setTimeout(N,()=>{r(!1)});try{s.connect(e,t)}catch{r(!1)}}),Dt=t=>new Promise(e=>{setTimeout(e,t)}),At=async(t,e)=>{const o=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});o&&await Pt({host:o.tcp.host,port:o.tcp.port,timeoutMs:e?.timeoutMs??o.tcp.timeoutMs})},H=384,L=5e3,Lt=50,Ot=3e4,d=async t=>{const e=h(rt(t),"services");try{await pt(e)}catch(o){throw o.code==="ENOTDIR"?new Error(`Service registry path ${e} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:o}):o}return e},R=t=>t.replaceAll("/","_").replaceAll(":","__"),P=(t,e)=>h(t,`${R(e)}.json`),It=(t,e)=>h(t,`${R(e)}.lock`),_=async(t,e)=>{const o=await d(t),s=P(o,e);if(await _t(s))try{return await C(s)}catch{return}},xt=async t=>{const e=await d(t);let o;try{o=await Q(e)}catch{return[]}const s=[];for(const r of o)if(r.endsWith(".json"))try{const i=await C(h(e,r));s.push(i)}catch{}return s},Ct=async(t,e)=>{const o=await d(t),s=P(o,e.id),r=h(o,`.${J(8).toString("hex")}.tmp`);await ot(r,`${JSON.stringify(e,void 0,2)}
2
2
  `,{mode:H});try{await Wt(r,s)}catch(i){throw await b(r,{force:!0}).catch(()=>{}),i}},Nt=new Set(["EACCES","EBUSY","EPERM"]),Ft=8,jt=20,Wt=async(t,e)=>{let o=0;for(;;)try{await st(t,e);return}catch(s){const{code:r}=s;if(!(r!==void 0&&Nt.has(r))||o>=Ft)throw s;const n=jt*2**o;await new Promise(c=>{setTimeout(c,n)}),o+=1}},y=async(t,e,o)=>{const s=await d(t),r=o??await _(t,e);await b(P(s,e),{force:!0}),r&&await b(r.logFile,{force:!0}).catch(()=>{})},a=t=>{try{return process.kill(t,0),!0}catch{return!1}},se=async t=>{const e=await xt(t),o=[],s=[];for(const r of e){if(a(r.pid)){s.push(r);continue}const i=await _(t,r.id);if(i&&i.pid!==r.pid){s.push(i);continue}await y(t,r.id,r).catch(()=>{}),o.push(r.id)}return{pruned:o,surviving:s}},Bt=t=>new Promise(e=>{setTimeout(e,t)}),Gt=async t=>{try{const e=await Z(t,"wx",H);try{await e.writeFile(String(process.pid))}finally{await e.close().catch(()=>{})}return!0}catch(e){if(e.code==="EEXIST")return!1;throw e}},qt=async t=>{let e;try{const o=await tt(t,"utf8"),s=Number.parseInt(o.trim(),10);e=Number.isFinite(s)?s:void 0}catch{return!0}if(e!==void 0&&!a(e))return!0;try{const o=await et(t);return Date.now()-o.mtimeMs>Ot}catch{return!0}},F=async(t,e,o)=>{const s=await d(t),r=It(s,e),i=Date.now();for(;!await Gt(r);){if(await qt(r)){await $(r).catch(()=>{});continue}if(Date.now()-i>=L)throw new Error(`Could not acquire service lock for ${e} within ${String(L)}ms — another \`vis service\` invocation appears to be holding it.`);await Bt(Lt)}try{return await o()}finally{await $(r).catch(()=>{})}};function T(t,e={},o){for(const s in t){const r=t[s],i=o?`${o}:${s}`:s;typeof r=="object"&&r!==null?T(r,e,i):typeof r=="function"&&(e[i]=r)}return e}const j=(()=>{if(console.createTask)return console.createTask;const t={run:e=>e()};return()=>t})();function W(t,e,o,s){for(let r=o;r<t.length;r+=1)try{const i=s?s.run(()=>t[r](...e)):t[r](...e);if(i&&typeof i.then=="function")return Promise.resolve(i).then(()=>W(t,e,r+1,s))}catch(i){return Promise.reject(i)}}function Kt(t,e,o){if(t.length>0)return W(t,e,0,j(o))}function Vt(t,e,o){if(t.length>0){const s=j(o);return Promise.all(t.map(r=>s.run(()=>r(...e))))}}function v(t,e){for(const o of[...t])o(e)}var Ut=class{_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(t,e,o={}){if(!t||typeof e!="function")return()=>{};const s=t;let r;for(;this._deprecatedHooks[t];)r=this._deprecatedHooks[t],t=r.to;if(r&&!o.allowDeprecated){let i=r.message;i||(i=`${s} hook has been deprecated`+(r.to?`, please use ${r.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(i)||(console.warn(i),this._deprecatedMessages.add(i))}if(!e.name)try{Object.defineProperty(e,"name",{get:()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb",configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)}}hookOnce(t,e){let o,s=(...r)=>(typeof o=="function"&&o(),o=void 0,s=void 0,e(...r));return o=this.hook(t,s),o}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,e){this._deprecatedHooks[t]=typeof e=="string"?{to:e}:e;const o=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of o)this.hook(t,s)}deprecateHooks(t){for(const e in t)this.deprecateHook(e,t[e])}addHooks(t){const e=T(t),o=Object.keys(e).map(s=>this.hook(s,e[s]));return()=>{for(const s of o)s();o.length=0}}removeHooks(t){const e=T(t);for(const o in e)this.removeHook(o,e[o])}removeAllHooks(){this._hooks={}}callHook(t,...e){return this.callHookWith(Kt,t,e)}callHookParallel(t,...e){return this.callHookWith(Vt,t,e)}callHookWith(t,e,o){const s=this._before||this._after?{name:e,args:o,context:{}}:void 0;this._before&&v(this._before,s);const r=t(this._hooks[e]?[...this._hooks[e]]:[],o,e);return r instanceof Promise?r.finally(()=>{this._after&&s&&v(this._after,s)}):(this._after&&s&&v(this._after,s),r)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const e=this._before.indexOf(t);e!==-1&&this._before.splice(e,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const e=this._after.indexOf(t);e!==-1&&this._after.splice(e,1)}}}};function zt(){return new Ut}const re=()=>zt(),ie=async(t,e)=>{if(!(!e||e.length===0))for(const o of e){if(o.hooks)for(const[s,r]of Object.entries(o.hooks)){const i=Array.isArray(r)?r:[r];for(const n of i)t.hook(s,n)}o.setup&&await o.setup(t)}};class ne{#o;#e;#s=new Map;constructor(e,o){this.#o=e,this.#e=o}startTasks(e){for(const o of e)this.#s.set(o.id,o),this.#t("task:before",o)}endTasks(e){for(const o of e)this.#s.delete(o.task.id),this.#t("task:after",o.task,o),o.status==="failure"?this.#t("task:failure",o.task,o):Xt(o.status)&&this.#t("task:cacheHit",o.task,o)}printCacheMiss(e,o){this.#t("task:cacheMiss",e,o)}onTaskStdout(e,o){this.#t("task:stdout",e,o)}onTaskStderr(e,o){this.#t("task:stderr",e,o)}#t(e,...o){Promise.resolve(this.#o.callHook(e,...o)).catch(s=>{if(this.#e)try{this.#e(e,s)}catch{}})}}const Xt=t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache",O=process.platform==="win32",Yt=async t=>{const{command:e,cwd:o,env:s,logFile:r}=t,i=ct(r,"a",H);let n;const c=O?"cmd":"/bin/sh",g=O?["/d","/s","/c",e]:["-c",e];try{n=nt(c,g,{cwd:o,detached:!0,env:lt({...process.env,...s},o),stdio:["ignore",i,i],windowsHide:!0})}finally{at(i)}if(n.pid===void 0&&await new Promise((k,m)=>{n.once("spawn",()=>{k()}),n.once("error",q=>{m(q)})}),n.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${e}`);return n.unref(),{pid:n.pid}},B=5e3,ce=async t=>F(t.workspaceRoot,t.id,async()=>{const e=await _(t.workspaceRoot,t.id);if(e&&a(e.pid))throw new Error(`Service ${t.id} is already running (pid ${String(e.pid)})`);e&&await y(t.workspaceRoot,t.id,e);const o=await d(t.workspaceRoot),s=R(t.id),r=h(o,`${s}.log`),{pid:i}=await Yt({command:t.command,cwd:t.cwd,env:t.env,logFile:r}),n={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:r,pid:i,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await Ct(t.workspaceRoot,n),t.skipReadiness!==!0)try{await At(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(c){throw await G(i,t.config.killGracePeriodMs??B).catch(()=>{}),await y(t.workspaceRoot,t.id,n).catch(()=>{}),c}return{entry:n}}),ae=async t=>F(t.workspaceRoot,t.id,async()=>{const e=await _(t.workspaceRoot,t.id);if(!e)return{stopped:!1};if(!a(e.pid))return await y(t.workspaceRoot,t.id,e),{stopped:!1};const o=t.graceMs??e.config.killGracePeriodMs??B;return await G(e.pid,o),await y(t.workspaceRoot,t.id,e),{stopped:!0}}),G=async(t,e)=>{I(t,"SIGTERM");const o=Date.now();for(;Date.now()-o<e;){if(!a(t))return;await new Promise(s=>{setTimeout(s,100)})}a(t)&&I(t,"SIGKILL")},I=(t,e)=>{try{process.platform==="win32"?process.kill(t,e):process.kill(-t,e)}catch(o){if(o.code==="ESRCH")return;throw o}};export{ne as H,Rt as S,ce as a,At as b,xt as c,re as d,ie as e,y as f,_t as g,a as i,se as p,_ as r,ae as s};
@@ -1,4 +1,4 @@
1
1
  import{createRequire as ct}from"node:module";import{k as be,m as te,l as De,a as mt,h as gt,z as Lt,g as St}from"./index-DHD8wb6Z.js";import{a as ie,g as vt}from"./_commonjsHelpers-DTfxOvZk.js";import{r as Ct,a as Pt}from"./clean-DRiLimTx.js";import{p as bt}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";let ht;const ut=h=>(ht??=ct(import.meta.url))(h),G=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=h=>{if(typeof G<"u"&&G.versions&&G.versions.node){const[e,t]=G.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return G.getBuiltinModule(h)}return ut(h)},{dirname:pt}=R("node:path"),Pe=R("node:url"),{fileURLToPath:ft}=Pe,ye=R("node:module"),{createRequire:dt}=ye,yt=R("util"),E=h=>"Deno"in h,Di=()=>{if(E(globalThis)){const h=globalThis.Deno,e=h.execPath();let t=e;try{const{importMeta:i}=globalThis;i?.url&&(t=i.url)}catch{}return[e,t,...h.args]}return process.argv},Ai=()=>E(globalThis)?globalThis.Deno.cwd():process.cwd(),wi=()=>{if(E(globalThis)){const h=globalThis.Deno;return new Proxy(h.env.toObject(),{get:(e,t)=>typeof t=="string"?h.env.get(t):e[t],has:(e,t)=>typeof t=="string"?h.env.has(t):t in e,set:(e,t,i)=>typeof t=="string"?(i===void 0||h.env.set(t,i),!0):!1})}return process.env},xi=()=>E(globalThis)?[]:process.execArgv,Ei=()=>E(globalThis)?globalThis.Deno.execPath():process.execPath,Oi=()=>{if(E(globalThis)){const h=globalThis.Deno.build?.os??"unknown";return h==="windows"?"win32":h}return process.platform},Ni=()=>{if(E(globalThis)){const h=globalThis.Deno.build?.arch??"unknown";return h==="x86_64"?"x64":h==="aarch64"?"arm64":h}return process.arch},Fi=(h=0)=>{if(E(globalThis))throw globalThis.Deno.exit(h),new Error("Deno exit failed");process.exit(h)},Gi=(h,e)=>{if(E(globalThis))return()=>{};const t=process;return t.on(h,e),()=>{t.removeListener(h,e)}};var U,ne;function Ae(){return ne||(ne=1,U=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","ALGLIB-Documentation","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Advanced-Cryptics-Dictionary","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BOLA-1.1","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-Tso","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Mark-Modifications","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","Buddy","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CAPEC-tou","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","ESA-PL-permissive-2.4","ESA-PL-strong-copyleft-2.4","ESA-PL-weak-copyleft-2.4","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-SMC","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HPND-sell-variant-critical-systems","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ISO-permission","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-STK","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MMPL-1.0.1","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-TNT","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSC-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OSSP","OpenMDW-1.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","ParaType-Free-Font-1.3","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGMLUG-PM","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TekHVC","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","UnRAR","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","Vixie-Cron","W3C","W3C-19980720","W3C-20150513","WTFNMFPL","WTFPL","Watcom-1.0","Widget-Workshop","WordNet","Wsuipa","X11","X11-distribute-modifications-variant","X11-no-permit-persons","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","hyphen-bulgarian","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]),U}var M,se;function Dt(){return se||(se=1,M=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]),M}var k,oe;function At(){return oe||(oe=1,k=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]),k}var _,le;function wt(){if(le)return _;le=1;var h=[].concat(Ae()).concat(Dt()),e=At();return _=function(t){var i=0;function s(){return i<t.length}function n(L){if(L instanceof RegExp){var c=t.slice(i),g=c.match(L);if(g)return i+=g[0].length,g[0]}else if(t.indexOf(L,i)===i)return i+=L.length,L}function l(){n(/[ ]*/)}function a(){for(var L,c=["WITH","AND","OR","(",")",":","+"],g=0;g<c.length&&(L=n(c[g]),!L);g++);if(L==="+"&&i>1&&t[i-2]===" ")throw new Error("Space before `+`");return L&&{type:"OPERATOR",string:L}}function o(){return n(/[A-Za-z0-9-.]+/)}function u(){var L=o();if(!L)throw new Error("Expected idstring at offset "+i);return L}function f(){if(n("DocumentRef-")){var L=u();return{type:"DOCUMENTREF",string:L}}}function S(){if(n("LicenseRef-")){var L=u();return{type:"LICENSEREF",string:L}}}function b(){var L=i,c=o();if(h.indexOf(c)!==-1)return{type:"LICENSE",string:c};if(e.indexOf(c)!==-1)return{type:"EXCEPTION",string:c};i=L}function v(){return a()||f()||S()||b()}for(var C=[];s()&&(l(),!!s());){var m=v();if(!m)throw new Error("Unexpected `"+t[i]+"` at offset "+i);C.push(m)}return C},_}var W,ae;function xt(){return ae||(ae=1,W=function(h){var e=0;function t(){return e<h.length}function i(){return t()?h[e]:null}function s(){if(!t())throw new Error;e++}function n(m){var L=i();if(L&&L.type==="OPERATOR"&&m===L.string)return s(),L.string}function l(){if(n("WITH")){var m=i();if(m&&m.type==="EXCEPTION")return s(),m.string;throw new Error("Expected exception after `WITH`")}}function a(){var m=e,L="",c=i();if(c.type==="DOCUMENTREF"&&(s(),L+="DocumentRef-"+c.string+":",!n(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(c=i(),c.type==="LICENSEREF")return s(),L+="LicenseRef-"+c.string,{license:L};e=m}function o(){var m=i();if(m&&m.type==="LICENSE"){s();var L={license:m.string};n("+")&&(L.plus=!0);var c=l();return c&&(L.exception=c),L}}function u(){var m=n("(");if(m){var L=v();if(!n(")"))throw new Error("Expected `)`");return L}}function f(){return u()||a()||o()}function S(m,L){return function c(){var g=L();if(g){if(!n(m))return g;var y=c();if(!y)throw new Error("Expected expression");return{left:g,conjunction:m.toLowerCase(),right:y}}}}var b=S("AND",f),v=S("OR",b),C=v();if(!C||t())throw new Error("Syntax error");return C}),W}var H,ce;function we(){if(ce)return H;ce=1;var h=wt(),e=xt();return H=function(t){return e(h(t))},H}var j,he;function Et(){if(he)return j;he=1;var h=we(),e=Ae();function t(c){try{return h(c),!0}catch{return!1}}function i(c,g){var y=g[0].length-c[0].length;return y!==0?y:c[0].toUpperCase().localeCompare(g[0].toUpperCase())}var s=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(i),n=0,l=1,a=[function(c){return c.toUpperCase()},function(c){return c.trim()},function(c){return c.replace(/\./g,"")},function(c){return c.replace(/\s+/g,"")},function(c){return c.replace(/\s+/g,"-")},function(c){return c.replace("v","-")},function(c){return c.replace(/,?\s*(\d)/,"-$1")},function(c){return c.replace(/,?\s*(\d)/,"-$1.0")},function(c){return c.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(c){return c.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(c){return c[0].toUpperCase()+c.slice(1)},function(c){return c.replace("/","-")},function(c){return c.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(c){return c.indexOf("3.0")!==-1?c+"-or-later":c+"-only"},function(c){return c+"only"},function(c){return c.replace(/(\d)$/,"-$1.0")},function(c){return c.replace(/(-| )?(\d)$/,"-$2-Clause")},function(c){return c.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(c){return c.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(c){return c.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(c){return c.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(c){return c.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(c){return c.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(c){return"CC-"+c},function(c){return"CC-"+c+"-4.0"},function(c){return c.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(c){return"CC-"+c.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],o=e.map(function(c){var g=/^(.*)-\d+\.\d+$/.exec(c);return g?[g[0],g[1]]:[c,null]}).reduce(function(c,g){var y=g[1];return c[y]=c[y]||[],c[y].push(g[0]),c},{}),u=Object.keys(o).map(function(g){return[g,o[g]]}).filter(function(g){return g[1].length===1&&g[0]!==null&&g[0]!=="APL"}).map(function(g){return[g[0],g[1][0]]});o=void 0;var f=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(u).sort(i),S=0,b=1,v=function(c){for(var g=0;g<a.length;g++){var y=a[g](c).trim();if(y!==c&&t(y))return y}return null},C=function(c){for(var g=c.toUpperCase(),y=0;y<f.length;y++){var r=f[y];if(g.indexOf(r[S])>-1)return r[b]}return null},m=function(c,g){for(var y=0;y<s.length;y++){var r=s[y],p=r[n];if(c.indexOf(p)>-1){var d=c.replace(p,r[l]),P=g(d);if(P!==null)return P}}return null};j=function(c,g){g=g||{};var y=g.upgrade===void 0?!0:!!g.upgrade;function r(D){return y?L(D):D}var p=typeof c=="string"&&c.trim().length!==0;if(!p)throw Error("Invalid argument. Expected non-empty string.");if(c=c.trim(),t(c))return r(c);var d=c.replace(/\+$/,"").trim();if(t(d))return r(d);var P=v(c);return P!==null||(P=m(c,function(D){return t(D)?D:v(D)}),P!==null)||(P=C(c),P!==null)||(P=m(c,C),P!==null)?r(P):null};function L(c){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(c)!==-1?c+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(c)!==-1?c.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(c)!==-1?c+"-or-later":c}return j}var z,ue;function Ot(){if(ue)return z;ue=1;var h=we(),e=Et(),t='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',i=/^SEE LICEN[CS]E IN (.+)$/;function s(l,a){return a.slice(0,l.length)===l}function n(l){if(l.hasOwnProperty("license")){var a=l.license;return s("LicenseRef",a)||s("DocumentRef",a)}else return n(l.left)||n(l.right)}return z=function(l){var a;try{a=h(l)}catch{var o;if(l==="UNLICENSED"||l==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(o=i.exec(l))return{validForOldPackages:!0,validForNewPackages:!0,inFile:o[1]};var u={validForOldPackages:!1,validForNewPackages:!1,warnings:[t]};if(l.trim().length!==0){var f=e(l);f&&u.warnings.push('license is similar to the valid expression "'+f+'"')}return u}return n(a)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[t]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}},z}var xe={hasSubscribers:!1},A=xe,F=xe;import("node:diagnostics_channel").then(h=>{A=h.channel("lru-cache:metrics"),F=h.tracingChannel("lru-cache")}).catch(()=>{});var Nt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Y=()=>A.hasSubscribers||F.hasSubscribers,Ee=new Set,pe=process||{},Ft=(h,e,t,i)=>{typeof pe.emitWarning=="function"?pe.emitWarning(h,e,t,i):console.error(`[${t}] ${e}: ${h}`)},Gt=h=>!Ee.has(h),N=h=>!!h&&h===Math.floor(h)&&h>0&&isFinite(h),Oe=h=>N(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?B:null:null,B=class extends Array{constructor(h){super(h),this.fill(0)}},$t=class T{heap;length;static#n=!1;static create(e){let t=Oe(e);if(!t)return[];T.#n=!0;let i=new T(e,t);return T.#n=!1,i}constructor(e,t){if(!T.#n)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Tt=class Ne{#n;#c;#t;#O;#L;#B;#R;#S;get perf(){return this.#S}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#o;#v;#s;#r;#e;#u;#f;#h;#l;#C;#a;#P;#y;#d;#m;#b;#I;#p;#N;static unsafeExposeInternals(e){return{starts:e.#y,ttls:e.#d,autopurgeTimers:e.#m,sizes:e.#P,keyMap:e.#s,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#f,get head(){return e.#h},get tail(){return e.#l},free:e.#C,isBackgroundFetch:t=>e.#i(t),backgroundFetch:(t,i,s,n)=>e.#k(t,i,s,n),moveToTail:t=>e.#T(t),indexes:t=>e.#D(t),rindexes:t=>e.#A(t),isStale:t=>e.#g(t)}}get max(){return this.#n}get maxSize(){return this.#c}get calculatedSize(){return this.#v}get size(){return this.#o}get fetchMethod(){return this.#B}get memoMethod(){return this.#R}get dispose(){return this.#t}get onInsert(){return this.#O}get disposeAfter(){return this.#L}constructor(e){let{max:t=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:l,updateAgeOnHas:a,allowStale:o,dispose:u,onInsert:f,disposeAfter:S,noDisposeOnSet:b,noUpdateTTL:v,maxSize:C=0,maxEntrySize:m=0,sizeCalculation:L,fetchMethod:c,memoMethod:g,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:r,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:d,ignoreFetchAbort:P,backgroundFetchSize:D=1,perf:w}=e;if(this.backgroundFetchSize=D,w!==void 0&&typeof w?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#S=w??Nt,t!==0&&!N(t))throw new TypeError("max option must be a nonnegative integer");let x=t?Oe(t):Array;if(!x)throw new Error("invalid max value: "+t);if(this.#n=t,this.#c=C,this.maxEntrySize=m||this.#c,this.sizeCalculation=L,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#R=g,c!==void 0&&typeof c!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#B=c,this.#I=!!c,this.#s=new Map,this.#r=Array.from({length:t}).fill(void 0),this.#e=Array.from({length:t}).fill(void 0),this.#u=new x(t),this.#f=new x(t),this.#h=0,this.#l=0,this.#C=$t.create(t),this.#o=0,this.#v=0,typeof u=="function"&&(this.#t=u),typeof f=="function"&&(this.#O=f),typeof S=="function"?(this.#L=S,this.#a=[]):(this.#L=void 0,this.#a=void 0),this.#b=!!this.#t,this.#N=!!this.#O,this.#p=!!this.#L,this.noDisposeOnSet=!!b,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!p,this.allowStaleOnFetchAbort=!!d,this.ignoreFetchAbort=!!P,this.maxEntrySize!==0){if(this.#c!==0&&!N(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!N(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!o,this.noDeleteOnStaleGet=!!r,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!a,this.ttlResolution=N(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!N(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#_()}if(this.#n===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#n&&!this.#c){let I="LRU_CACHE_UNBOUNDED";Gt(I)&&(Ee.add(I),Ft("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",I,Ne))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#_(){let e=new B(this.#n),t=new B(this.#n);this.#d=e,this.#y=t;let i=this.ttlAutopurge?Array.from({length:this.#n}):void 0;this.#m=i,this.#W=(o,u,f=this.#S.now())=>{t[o]=u!==0?f:0,e[o]=u,s(o,u)},this.#F=o=>{t[o]=e[o]!==0?this.#S.now():0,s(o,e[o])};let s=this.ttlAutopurge?(o,u)=>{if(i?.[o]&&(clearTimeout(i[o]),i[o]=void 0),u&&u!==0&&i){let f=setTimeout(()=>{this.#g(o)?(this.#w(this.#r[o],"expire"),i[o]=void 0):s(o,a(o))},u+1);f.unref&&f.unref(),i[o]=f}}:()=>{};this.#x=(o,u)=>{if(e[u]){let f=e[u],S=t[u];if(!f||!S)return;o.ttl=f,o.start=S,o.now=n||l();let b=o.now-S;o.remainingTTL=f-b}};let n=0,l=()=>{let o=this.#S.now();if(this.ttlResolution>0){n=o;let u=setTimeout(()=>n=0,this.ttlResolution);u.unref&&u.unref()}return o};this.getRemainingTTL=o=>{let u=this.#s.get(o);return u===void 0?0:a(u)};let a=o=>{let u=e[o],f=t[o];if(!u||!f)return 1/0;let S=(n||l())-f;return u-S};this.#g=o=>{let u=t[o],f=e[o];return!!f&&!!u&&(n||l())-u>f}}#F=()=>{};#x=()=>{};#W=()=>{};#g=()=>!1;#V(){let e=new B(this.#n);this.#v=0,this.#P=e,this.#G=t=>{this.#v-=e[t],e[t]=0},this.#H=(t,i,s,n)=>{if(!N(s)){if(this.#i(i))return this.backgroundFetchSize;if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,t),!N(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return s},this.#U=(t,i,s)=>{if(e[t]=i,this.#c){let n=this.#c-e[t];for(;this.#v>n;)this.#M(!0)}this.#v+=e[t],s&&(s.entrySize=i,s.totalCalculatedSize=this.#v)}}#G=e=>{};#U=(e,t,i)=>{};#H=(e,t,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#l;this.#j(t)&&((e||!this.#g(t))&&(yield t),t!==this.#h);)t=this.#f[t]}*#A({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#h;this.#j(t)&&((e||!this.#g(t))&&(yield t),t!==this.#l);)t=this.#u[t]}#j(e){return e!==void 0&&this.#s.get(this.#r[e])===e}*entries(){for(let e of this.#D())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#i(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#A())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#i(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#D()){let t=this.#r[e];t!==void 0&&!this.#i(this.#e[e])&&(yield t)}}*rkeys(){for(let e of this.#A()){let t=this.#r[e];t!==void 0&&!this.#i(this.#e[e])&&(yield t)}}*values(){for(let e of this.#D())this.#e[e]!==void 0&&!this.#i(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#A())this.#e[e]!==void 0&&!this.#i(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#D()){let s=this.#e[i],n=this.#i(s)?s.__staleWhileFetching:s;if(n!==void 0&&e(n,this.#r[i],this))return this.#$(this.#r[i],t)}}forEach(e,t=this){for(let i of this.#D()){let s=this.#e[i],n=this.#i(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#r[i],this)}}rforEach(e,t=this){for(let i of this.#A()){let s=this.#e[i],n=this.#i(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,this.#r[i],this)}}purgeStale(){let e=!1;for(let t of this.#A({allowStale:!0}))this.#g(t)&&(this.#w(this.#r[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let i=this.#e[t],s=this.#i(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#d&&this.#y){let l=this.#d[t],a=this.#y[t];if(l&&a){let o=l-(this.#S.now()-a);n.ttl=o,n.start=Date.now()}}return this.#P&&(n.size=this.#P[t]),n}dump(){let e=[];for(let t of this.#D({allowStale:!0})){let i=this.#r[t],s=this.#e[t],n=this.#i(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let l={value:n};if(this.#d&&this.#y){l.ttl=this.#d[t];let a=this.#S.now()-this.#y[t];l.start=Math.floor(Date.now()-a)}this.#P&&(l.size=this.#P[t]),e.unshift([i,l])}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let s=Date.now()-i.start;i.start=this.#S.now()-s}this.#E(t,i.value,i)}}set(e,t,i={}){let{status:s=A.hasSubscribers?{}:void 0}=i;i.status=s,s&&(s.op="set",s.key=e,t!==void 0&&(s.value=t),s.cache=this);let n=this.#E(e,t,i);return s&&A.hasSubscribers&&A.publish(s),n}#E(e,t,i,s){let{ttl:n=this.ttl,start:l,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:u}=i,f=this.#i(t);if(t===void 0)return u&&(u.set="deleted"),this.delete(e),this;let{noUpdateTTL:S=this.noUpdateTTL}=i;u&&!f&&(u.value=t);let b=this.#H(e,t,i.size||0,o,u);if(this.maxEntrySize&&b>this.maxEntrySize)return this.#w(e,"set"),u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this;let v=this.#o===0?void 0:this.#s.get(e);if(v===void 0)v=this.#o===0?this.#l:this.#C.length!==0?this.#C.pop():this.#o===this.#n?this.#M(!1):this.#o,this.#r[v]=e,this.#e[v]=t,this.#s.set(e,v),this.#u[this.#l]=v,this.#f[v]=this.#l,this.#l=v,this.#o++,this.#U(v,b,u),u&&(u.set="add"),S=!1,this.#N&&!f&&this.#O?.(t,e,"add");else{this.#T(v);let C=this.#e[v];if(t!==C){if(!a)if(this.#i(C)){C!==s&&C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=C;m!==void 0&&m!==t&&(this.#b&&this.#t?.(m,e,"set"),this.#p&&this.#a?.push([m,e,"set"]))}else this.#b&&this.#t?.(C,e,"set"),this.#p&&this.#a?.push([C,e,"set"]);if(this.#G(v),this.#U(v,b,u),this.#e[v]=t,!f){let m=C&&this.#i(C)?C.__staleWhileFetching:C,L=m===void 0?"add":t!==m?"replace":"update";u&&(u.set=L,m!==void 0&&(u.oldValue=m)),this.#N&&this.onInsert?.(t,e,L)}}else f||(u&&(u.set="update"),this.#N&&this.onInsert?.(t,e,"update"))}if(n!==0&&!this.#d&&this.#_(),this.#d&&(S||this.#W(v,n,l),u&&this.#x(u,v)),!a&&this.#p&&this.#a){let C=this.#a,m;for(;m=C?.shift();)this.#L?.(...m)}return this}pop(){try{for(;this.#o;){let e=this.#e[this.#h];if(this.#M(!0),this.#i(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#p&&this.#a){let e=this.#a,t;for(;t=e?.shift();)this.#L?.(...t)}}}#M(e){let t=this.#h,i=this.#r[t],s=this.#e[t],n=this.#i(s);n&&s.__abortController.abort(new Error("evicted"));let l=n?s.__staleWhileFetching:s;return(this.#b||this.#p)&&l!==void 0&&(this.#b&&this.#t?.(l,i,"evict"),this.#p&&this.#a?.push([l,i,"evict"])),this.#G(t),this.#m?.[t]&&(clearTimeout(this.#m[t]),this.#m[t]=void 0),e&&(this.#r[t]=void 0,this.#e[t]=void 0,this.#C.push(t)),this.#o===1?(this.#h=this.#l=0,this.#C.length=0):this.#h=this.#u[t],this.#s.delete(i),this.#o--,t}has(e,t={}){let{status:i=A.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="has",i.key=e,i.cache=this);let s=this.#K(e,t);return A.hasSubscribers&&A.publish(i),s}#K(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=t,n=this.#s.get(e);if(n!==void 0){let l=this.#e[n];if(this.#i(l)&&l.__staleWhileFetching===void 0)return!1;if(this.#g(n))s&&(s.has="stale",this.#x(s,n));else return i&&this.#F(n),s&&(s.has="hit",this.#x(s,n)),!0}else s&&(s.has="miss");return!1}peek(e,t={}){let{status:i=Y()?{}:void 0}=t;i&&(i.op="peek",i.key=e,i.cache=this),t.status=i;let s=this.#X(e,t);return A.hasSubscribers&&A.publish(i),s}#X(e,t){let{status:i,allowStale:s=this.allowStale}=t,n=this.#s.get(e);if(n===void 0||!s&&this.#g(n)){i&&(i.peek=n===void 0?"miss":"stale");return}let l=this.#e[n],a=this.#i(l)?l.__staleWhileFetching:l;return i&&(a!==void 0?(i.peek="hit",i.value=a):i.peek="miss"),a}#k(e,t,i,s){let n=t===void 0?void 0:this.#e[t];if(this.#i(n))return n;let l=new AbortController,{signal:a}=i;a?.addEventListener("abort",()=>l.abort(a.reason),{signal:l.signal});let o={signal:l.signal,options:i,context:s},u=(m,L=!1)=>{let{aborted:c}=l.signal,g=i.ignoreFetchAbort&&m!==void 0,y=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&m!==void 0);if(i.status&&(c&&!L?(i.status.fetchAborted=!0,i.status.fetchError=l.signal.reason,g&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),c&&!g&&!L)return S(l.signal.reason,y);let r=v,p=this.#e[t];return(p===v||p===void 0&&g&&L)&&(m===void 0?r.__staleWhileFetching!==void 0?this.#e[t]=r.__staleWhileFetching:this.#w(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#E(e,m,o.options,r))),m},f=m=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=m),S(m,!1)),S=(m,L)=>{let{aborted:c}=l.signal,g=c&&i.allowStaleOnFetchAbort,y=g||i.allowStaleOnFetchRejection,r=y||i.noDeleteOnFetchRejection,p=v;if(this.#e[t]===v&&(!r||!L&&p.__staleWhileFetching===void 0?this.#w(e,"fetch"):g||(this.#e[t]=p.__staleWhileFetching)),y)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw m},b=(m,L)=>{let c=this.#B?.(e,n,o);l.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(m(void 0),i.allowStaleOnFetchAbort&&(m=g=>u(g,!0)))}),c&&c instanceof Promise?c.then(g=>m(g===void 0?void 0:g),L):c!==void 0&&m(c)};i.status&&(i.status.fetchDispatched=!0);let v=new Promise(b).then(u,f),C=Object.assign(v,{__abortController:l,__staleWhileFetching:n,__returned:void 0});return t===void 0?(this.#E(e,C,{...o.options,status:void 0}),t=this.#s.get(e)):this.#e[t]=C,C}#i(e){if(!this.#I)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController}fetch(e,t={}){let i=F.hasSubscribers,{status:s=Y()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let n=this.#z(e,t);return s&&i&&(s.trace=!0,F.tracePromise(()=>n,s).catch(()=>{})),n}async#z(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:v=this.ignoreFetchAbort,allowStaleOnFetchAbort:C=this.allowStaleOnFetchAbort,context:m,forceRefresh:L=!1,status:c,signal:g}=t;if(c&&(c.op="fetch",c.key=e,L&&(c.forceRefresh=!0),c.cache=this),!this.#I)return c&&(c.fetch="get"),this.#$(e,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:c});let y={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:l,noDisposeOnSet:a,size:o,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:C,ignoreFetchAbort:v,status:c,signal:g},r=this.#s.get(e);if(r===void 0){c&&(c.fetch="miss");let p=this.#k(e,r,y,m);return p.__returned=p}else{let p=this.#e[r];if(this.#i(p)){let w=i&&p.__staleWhileFetching!==void 0;return c&&(c.fetch="inflight",w&&(c.returnedStale=!0)),w?p.__staleWhileFetching:p.__returned=p}let d=this.#g(r);if(!L&&!d)return c&&(c.fetch="hit"),this.#T(r),s&&this.#F(r),c&&this.#x(c,r),p;let P=this.#k(e,r,y,m),D=P.__staleWhileFetching!==void 0&&i;return c&&(c.fetch=d?"stale":"refresh",D&&d&&(c.returnedStale=!0)),D?P.__staleWhileFetching:P.__returned=P}}forceFetch(e,t={}){let i=F.hasSubscribers,{status:s=Y()?{}:void 0}=t;t.status=s,s&&t.context&&(s.context=t.context);let n=this.#J(e,t);return s&&i&&(s.trace=!0,F.tracePromise(()=>n,s).catch(()=>{})),n}async#J(e,t={}){let i=await this.#z(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let{status:i=A.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="memo",i.key=e,t.context&&(i.context=t.context),i.cache=this);let s=this.#Z(e,t);return i&&(i.value=s),A.hasSubscribers&&A.publish(i),s}#Z(e,t={}){let i=this.#R;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,status:n,forceRefresh:l,...a}=t;n&&l&&(n.forceRefresh=!0);let o=this.#$(e,a),u=l||o===void 0;if(n&&(n.memo=u?"miss":"hit",u||(n.value=o)),!u)return o;let f=i(e,o,{options:a,context:s});return n&&(n.value=f),this.#E(e,f,a),f}get(e,t={}){let{status:i=A.hasSubscribers?{}:void 0}=t;t.status=i,i&&(i.op="get",i.key=e,i.cache=this);let s=this.#$(e,t);return i&&(s!==void 0&&(i.value=s),A.hasSubscribers&&A.publish(i)),s}#$(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:l}=t,a=this.#s.get(e);if(a===void 0){l&&(l.get="miss");return}let o=this.#e[a],u=this.#i(o);return l&&this.#x(l,a),this.#g(a)?u?(l&&(l.get="stale-fetching"),i&&o.__staleWhileFetching!==void 0?(l&&(l.returnedStale=!0),o.__staleWhileFetching):void 0):(n||this.#w(e,"expire"),l&&(l.get="stale"),i?(l&&(l.returnedStale=!0),o):void 0):(l&&(l.get=u?"fetching":"hit"),this.#T(a),s&&this.#F(a),u?o.__staleWhileFetching:o)}#Y(e,t){this.#f[t]=e,this.#u[e]=t}#T(e){e!==this.#l&&(e===this.#h?this.#h=this.#u[e]:this.#Y(this.#f[e],this.#u[e]),this.#Y(this.#l,e),this.#l=e)}delete(e){return this.#w(e,"delete")}#w(e,t){A.hasSubscribers&&A.publish({op:"delete",delete:t,key:e,cache:this});let i=!1;if(this.#o!==0){let s=this.#s.get(e);if(s!==void 0)if(this.#m?.[s]&&(clearTimeout(this.#m[s]),this.#m[s]=void 0),i=!0,this.#o===1)this.#q(t);else{this.#G(s);let n=this.#e[s];if(this.#i(n)?n.__abortController.abort(new Error("deleted")):(this.#b||this.#p)&&(this.#b&&this.#t?.(n,e,t),this.#p&&this.#a?.push([n,e,t])),this.#s.delete(e),this.#r[s]=void 0,this.#e[s]=void 0,s===this.#l)this.#l=this.#f[s];else if(s===this.#h)this.#h=this.#u[s];else{let l=this.#f[s];this.#u[l]=this.#u[s];let a=this.#u[s];this.#f[a]=this.#f[s]}this.#o--,this.#C.push(s)}}if(this.#p&&this.#a?.length){let s=this.#a,n;for(;n=s?.shift();)this.#L?.(...n)}return i}clear(){return this.#q("delete")}#q(e){for(let t of this.#A({allowStale:!0})){let i=this.#e[t];if(this.#i(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#r[t];this.#b&&this.#t?.(i,s,e),this.#p&&this.#a?.push([i,s,e])}}if(this.#s.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#d&&this.#y){this.#d.fill(0),this.#y.fill(0);for(let t of this.#m??[])t!==void 0&&clearTimeout(t);this.#m?.fill(void 0)}if(this.#P&&this.#P.fill(0),this.#h=0,this.#l=0,this.#C.length=0,this.#v=0,this.#o=0,this.#p&&this.#a){let t=this.#a,i;for(;i=t?.shift();)this.#L?.(...i)}}};const Bt=Object.defineProperty({__proto__:null,LRUCache:Tt},Symbol.toStringTag,{value:"Module"}),Rt=ie(Bt);var q,fe;function It(){if(fe)return q;fe=1;const h=(...n)=>n.every(l=>l)?n.join(""):"",e=n=>n?encodeURIComponent(n):"",t=n=>n.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),i={sshtemplate:({domain:n,user:l,project:a,committish:o})=>`git@${n}:${l}/${a}.git${h("#",o)}`,sshurltemplate:({domain:n,user:l,project:a,committish:o})=>`git+ssh://git@${n}/${l}/${a}.git${h("#",o)}`,edittemplate:({domain:n,user:l,project:a,committish:o,editpath:u,path:f})=>`https://${n}/${l}/${a}${h("/",u,"/",e(o||"HEAD"),"/",f)}`,browsetemplate:({domain:n,user:l,project:a,committish:o,treepath:u})=>`https://${n}/${l}/${a}${h("/",u,"/",e(o))}`,browsetreetemplate:({domain:n,user:l,project:a,committish:o,treepath:u,path:f,fragment:S,hashformat:b})=>`https://${n}/${l}/${a}/${u}/${e(o||"HEAD")}/${f}${h("#",b(S||""))}`,browseblobtemplate:({domain:n,user:l,project:a,committish:o,blobpath:u,path:f,fragment:S,hashformat:b})=>`https://${n}/${l}/${a}/${u}/${e(o||"HEAD")}/${f}${h("#",b(S||""))}`,docstemplate:({domain:n,user:l,project:a,treepath:o,committish:u})=>`https://${n}/${l}/${a}${h("/",o,"/",e(u))}#readme`,httpstemplate:({auth:n,domain:l,user:a,project:o,committish:u})=>`git+https://${h(n,"@")}${l}/${a}/${o}.git${h("#",u)}`,filetemplate:({domain:n,user:l,project:a,committish:o,path:u})=>`https://${n}/${l}/${a}/raw/${e(o||"HEAD")}/${u}`,shortcuttemplate:({type:n,user:l,project:a,committish:o})=>`${n}:${l}/${a}${h("#",o)}`,pathtemplate:({user:n,project:l,committish:a})=>`${n}/${l}${h("#",a)}`,bugstemplate:({domain:n,user:l,project:a})=>`https://${n}/${l}/${a}/issues`,hashformat:t},s={};s.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:l,project:a,committish:o,path:u})=>`https://${h(n,"@")}raw.githubusercontent.com/${l}/${a}/${e(o||"HEAD")}/${u}`,gittemplate:({auth:n,domain:l,user:a,project:o,committish:u})=>`git://${h(n,"@")}${l}/${a}/${o}.git${h("#",u)}`,tarballtemplate:({domain:n,user:l,project:a,committish:o})=>`https://codeload.${n}/${l}/${a}/tar.gz/${e(o||"HEAD")}`,extract:n=>{let[,l,a,o,u]=n.pathname.split("/",5);if(!(o&&o!=="tree")&&(o||(u=n.hash.slice(1)),a&&a.endsWith(".git")&&(a=a.slice(0,-4)),!(!l||!a)))return{user:l,project:a,committish:u}}},s.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:l,project:a,committish:o,treepath:u,path:f,editpath:S})=>`https://${n}/${l}/${a}${h("/",u,"/",e(o||"HEAD"),"/",f,S)}`,tarballtemplate:({domain:n,user:l,project:a,committish:o})=>`https://${n}/${l}/${a}/get/${e(o||"HEAD")}.tar.gz`,extract:n=>{let[,l,a,o]=n.pathname.split("/",4);if(!["get"].includes(o)&&(a&&a.endsWith(".git")&&(a=a.slice(0,-4)),!(!l||!a)))return{user:l,project:a,committish:n.hash.slice(1)}}},s.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",tarballtemplate:({domain:n,user:l,project:a,committish:o})=>`https://${n}/api/v4/projects/${e(l+"/"+a)}/repository/archive.tar.gz?sha=${e(o||"HEAD")}`,extract:n=>{const l=n.pathname.slice(1);if(l.includes("/-/")||l.includes("/archive.tar.gz"))return;const a=l.split("/");let o=a.pop();o.endsWith(".git")&&(o=o.slice(0,-4));const u=a.join("/");if(!(!u||!o))return{user:u,project:o,committish:n.hash.slice(1)}}},s.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:n,project:l,committish:a})=>`git@${n}:${l}.git${h("#",a)}`,sshurltemplate:({domain:n,project:l,committish:a})=>`git+ssh://git@${n}/${l}.git${h("#",a)}`,edittemplate:({domain:n,user:l,project:a,committish:o,editpath:u})=>`https://${n}/${l}/${a}${h("/",e(o))}/${u}`,browsetemplate:({domain:n,project:l,committish:a})=>`https://${n}/${l}${h("/",e(a))}`,browsetreetemplate:({domain:n,project:l,committish:a,path:o,hashformat:u})=>`https://${n}/${l}${h("/",e(a))}${h("#",u(o))}`,browseblobtemplate:({domain:n,project:l,committish:a,path:o,hashformat:u})=>`https://${n}/${l}${h("/",e(a))}${h("#",u(o))}`,docstemplate:({domain:n,project:l,committish:a})=>`https://${n}/${l}${h("/",e(a))}`,httpstemplate:({domain:n,project:l,committish:a})=>`git+https://${n}/${l}.git${h("#",a)}`,filetemplate:({user:n,project:l,committish:a,path:o})=>`https://gist.githubusercontent.com/${n}/${l}/raw${h("/",e(a))}/${o}`,shortcuttemplate:({type:n,project:l,committish:a})=>`${n}:${l}${h("#",a)}`,pathtemplate:({project:n,committish:l})=>`${n}${h("#",l)}`,bugstemplate:({domain:n,project:l})=>`https://${n}/${l}`,gittemplate:({domain:n,project:l,committish:a})=>`git://${n}/${l}.git${h("#",a)}`,tarballtemplate:({project:n,committish:l})=>`https://codeload.github.com/gist/${n}/tar.gz/${e(l||"HEAD")}`,extract:n=>{let[,l,a,o]=n.pathname.split("/",4);if(o!=="raw"){if(!a){if(!l)return;a=l,l=null}return a.endsWith(".git")&&(a=a.slice(0,-4)),{user:l,project:a,committish:n.hash.slice(1)}}},hashformat:function(n){return n&&"file-"+t(n)}},s.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:n,user:l,project:a,committish:o,path:u})=>`https://${n}/${l}/${a}/blob/${e(o)||"HEAD"}/${u}`,httpstemplate:({domain:n,user:l,project:a,committish:o})=>`https://${n}/${l}/${a}${h("#",o)}`,tarballtemplate:({domain:n,user:l,project:a,committish:o})=>`https://${n}/${l}/${a}/archive/${e(o)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:n=>{let[,l,a,o]=n.pathname.split("/",4);if(!["archive"].includes(o)&&(a&&a.endsWith(".git")&&(a=a.slice(0,-4)),!(!l||!a)))return{user:l,project:a,committish:n.hash.slice(1)}}};for(const[n,l]of Object.entries(s))s[n]=Object.assign({},i,l);return q=s,q}var V,de;function Fe(){if(de)return V;de=1;const h=(s,n,l)=>{const a=s.indexOf(l);return s.lastIndexOf(n,a>-1?a:1/0)},e=s=>{try{return new URL(s)}catch{}},t=(s,n)=>{const l=s.indexOf(":"),a=s.slice(0,l+1);if(Object.prototype.hasOwnProperty.call(n,a)||s.substr(l,3)==="://")return s;const o=s.indexOf("@");return o>-1?o>l?`git+ssh://${s}`:s:`${s.slice(0,l+1)}//${s.slice(l+1)}`},i=s=>{const n=h(s,"@","#"),l=h(s,":","#");return l>n&&(s=s.slice(0,l)+"/"+s.slice(l+1)),h(s,":","#")===-1&&s.indexOf("//")===-1&&(s=`git+ssh://${s}`),s};return V=(s,n)=>{const l=n?t(s,n):s;return e(l)||e(i(l))},V}var K,me;function Ut(){if(me)return K;me=1;const h=Fe(),e=t=>{const i=t.indexOf("#"),s=t.indexOf("/"),n=t.indexOf("/",s+1),l=t.indexOf(":"),a=/\s/.exec(t),o=t.indexOf("@"),u=!a||i>-1&&a.index>i,f=o===-1||i>-1&&o>i,S=l===-1||i>-1&&l>i,b=n===-1||i>-1&&n>i,v=s>0,C=i>-1?t[i-1]!=="/":!t.endsWith("/"),m=!t.startsWith(".");return u&&v&&C&&m&&f&&S&&b};return K=(t,i,{gitHosts:s,protocols:n})=>{if(!t)return;const l=e(t)?`github:${t}`:t,a=h(l,n);if(!a)return;const o=s.byShortcut[a.protocol],u=s.byDomain[a.hostname.startsWith("www.")?a.hostname.slice(4):a.hostname],f=o||u;if(!f)return;const S=s[o||u];let b=null;n[a.protocol]?.auth&&(a.username||a.password)&&(b=`${a.username}${a.password?":"+a.password:""}`);let v=null,C=null,m=null,L=null;try{if(o){let c=a.pathname.startsWith("/")?a.pathname.slice(1):a.pathname;const g=c.indexOf("@");g>-1&&(c=c.slice(g+1));const y=c.lastIndexOf("/");y>-1?(C=decodeURIComponent(c.slice(0,y)),C||(C=null),m=decodeURIComponent(c.slice(y+1))):m=decodeURIComponent(c),m.endsWith(".git")&&(m=m.slice(0,-4)),a.hash&&(v=decodeURIComponent(a.hash.slice(1))),L="shortcut"}else{if(!S.protocols.includes(a.protocol))return;const c=S.extract(a);if(!c)return;C=c.user&&decodeURIComponent(c.user),m=decodeURIComponent(c.project),v=decodeURIComponent(c.committish),L=n[a.protocol]?.name||a.protocol.slice(0,-1)}}catch(c){if(c instanceof URIError)return;throw c}return[f,C,b,m,v,L,i]},K}var X,ge;function Mt(){if(ge)return X;ge=1;const{LRUCache:h}=Rt,e=It(),t=Ut(),i=Fe(),s=new h({max:1e3});function n(a){try{const{protocol:o,hostname:u,pathname:f}=new URL(a);if(!u)return null;const S=/(?:git\+)http:$/.test(o)?"http:":"https:",b=f.replace(/\.git$/,"");return`${S}//${u}${b}`}catch{return null}}class l{constructor(o,u,f,S,b,v,C={}){Object.assign(this,l.#n[o],{type:o,user:u,auth:f,project:S,committish:b,default:v,opts:C})}static#n={byShortcut:{},byDomain:{}};static#c={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(o,u){l.#n[o]=u,l.#n.byDomain[u.domain]=o,l.#n.byShortcut[`${o}:`]=o,l.#c[`${o}:`]={name:o}}static fromUrl(o,u){if(typeof o!="string")return;const f=o+JSON.stringify(u||{});if(!s.has(f)){const S=t(o,u,{gitHosts:l.#n,protocols:l.#c});s.set(f,S?new l(...S):void 0)}return s.get(f)}static fromManifest(o,u={}){if(!o||typeof o!="object")return;const f=o.repository,S=f&&(typeof f=="string"?f:typeof f=="object"&&typeof f.url=="string"?f.url:null);if(!S)throw new Error("no repository");const b=S&&l.fromUrl(S.replace(/^git\+/,""),u)||null;if(b)return b;const v=n(S);return l.fromUrl(v,u)||v}static parseUrl(o){return i(o)}#t(o,u){if(typeof o!="function")return null;const f={...this,...this.opts,...u};f.path||(f.path=""),f.path.startsWith("/")&&(f.path=f.path.slice(1)),f.noCommittish&&(f.committish=null);const S=o(f);return f.noGitPlus&&S.startsWith("git+")?S.slice(4):S}hash(){return this.committish?`#${this.committish}`:""}ssh(o){return this.#t(this.sshtemplate,o)}sshurl(o){return this.#t(this.sshurltemplate,o)}browse(o,...u){return typeof o!="string"?this.#t(this.browsetemplate,o):typeof u[0]!="string"?this.#t(this.browsetreetemplate,{...u[0],path:o}):this.#t(this.browsetreetemplate,{...u[1],fragment:u[0],path:o})}browseFile(o,...u){return typeof u[0]!="string"?this.#t(this.browseblobtemplate,{...u[0],path:o}):this.#t(this.browseblobtemplate,{...u[1],fragment:u[0],path:o})}docs(o){return this.#t(this.docstemplate,o)}bugs(o){return this.#t(this.bugstemplate,o)}https(o){return this.#t(this.httpstemplate,o)}git(o){return this.#t(this.gittemplate,o)}shortcut(o){return this.#t(this.shortcuttemplate,o)}path(o){return this.#t(this.pathtemplate,o)}tarball(o){return this.#t(this.tarballtemplate,{...o,noCommittish:!1})}file(o,u){return this.#t(this.filetemplate,{...u,path:o})}edit(o,u){return this.#t(this.edittemplate,{...u,path:o})}getDefaultRepresentation(){return this.default}toString(o){return this.default&&typeof this[this.default]=="function"?this[this.default](o):this.sshurl(o)}}for(const[a,o]of Object.entries(e))l.addHost(a,o);return X=l,X}var J,Le;function kt(){if(Le)return J;Le=1,J=h;function h(e){if(!e||e==="ERROR: No README data found!")return;e=e.trim().split(`
2
2
  `);let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const i=e.length;let s=t+1;for(;s<i&&e[s].trim();)s++;return e.slice(t,s).join(" ").trim()}return J}var Ge={dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},$e={web:"url",name:"url"},Te={server:"start",tests:"test"};const _t={topLevel:Ge,bugs:$e,script:Te},Wt=Object.defineProperty({__proto__:null,bugs:$e,default:_t,script:Te,topLevel:Ge},Symbol.toStringTag,{value:"Module"}),Ht=ie(Wt);var Z,Se;function jt(){if(Se)return Z;Se=1;var{URL:h}=Pe,e=Ct(),t=Pt(),i=Ot(),s=Mt(),{isBuiltin:n}=ye,l=["dependencies","devDependencies","optionalDependencies"],a=kt(),o=Ht,u=r=>r.includes("@")&&r.indexOf("@")<r.lastIndexOf(".");Z={warn:function(){},fixRepositoryField:function(r){if(r.repositories&&(this.warn("repositories"),r.repository=r.repositories[0]),!r.repository)return this.warn("missingRepository");typeof r.repository=="string"&&(r.repository={type:"git",url:r.repository});var p=r.repository.url||"";if(p){var d=s.fromUrl(p);d&&(p=r.repository.url=d.getDefaultRepresentation()==="shortcut"?d.https():d.toString())}p.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",p)},fixTypos:function(r){Object.keys(o.topLevel).forEach(function(p){Object.prototype.hasOwnProperty.call(r,p)&&this.warn("typo",p,o.topLevel[p])},this)},fixScriptsField:function(r){if(r.scripts){if(typeof r.scripts!="object"){this.warn("nonObjectScripts"),delete r.scripts;return}Object.keys(r.scripts).forEach(function(p){typeof r.scripts[p]!="string"?(this.warn("nonStringScript"),delete r.scripts[p]):o.script[p]&&!r.scripts[o.script[p]]&&this.warn("typo",p,o.script[p],"scripts")},this)}},fixFilesField:function(r){var p=r.files;p&&!Array.isArray(p)?(this.warn("nonArrayFiles"),delete r.files):r.files&&(r.files=r.files.filter(function(d){return!d||typeof d!="string"?(this.warn("invalidFilename",d),!1):!0},this))},fixBinField:function(r){if(r.bin&&typeof r.bin=="string"){var p={},d;(d=r.name.match(/^@[^/]+[/](.*)$/))?p[d[1]]=r.bin:p[r.name]=r.bin,r.bin=p}},fixManField:function(r){r.man&&typeof r.man=="string"&&(r.man=[r.man])},fixBundleDependenciesField:function(r){var p="bundledDependencies",d="bundleDependencies";r[p]&&!r[d]&&(r[d]=r[p],delete r[p]),r[d]&&!Array.isArray(r[d])?(this.warn("nonArrayBundleDependencies"),delete r[d]):r[d]&&(r[d]=r[d].filter(function(P){return!P||typeof P!="string"?(this.warn("nonStringBundleDependency",P),!1):(r.dependencies||(r.dependencies={}),Object.prototype.hasOwnProperty.call(r.dependencies,P)||(this.warn("nonDependencyBundleDependency",P),r.dependencies[P]="*"),!0)},this))},fixDependencies:function(r){g(r,this.warn),L(r,this.warn),this.fixBundleDependenciesField(r),["dependencies","devDependencies"].forEach(function(p){if(p in r){if(!r[p]||typeof r[p]!="object"){this.warn("nonObjectDependencies",p),delete r[p];return}Object.keys(r[p]).forEach(function(d){var P=r[p][d];typeof P!="string"&&(this.warn("nonStringDependency",d,JSON.stringify(P)),delete r[p][d]);var D=s.fromUrl(r[p][d]);D&&(r[p][d]=D.toString())},this)}},this)},fixModulesField:function(r){r.modules&&(this.warn("deprecatedModules"),delete r.modules)},fixKeywordsField:function(r){typeof r.keywords=="string"&&(r.keywords=r.keywords.split(/,\s+/)),r.keywords&&!Array.isArray(r.keywords)?(delete r.keywords,this.warn("nonArrayKeywords")):r.keywords&&(r.keywords=r.keywords.filter(function(p){return typeof p!="string"||!p?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(r,p){var d=!p;if(!r.version)return r.version="",!0;if(!e(r.version,d))throw new Error('Invalid version: "'+r.version+'"');return r.version=t(r.version,d),!0},fixPeople:function(r){v(r,C),v(r,m)},fixNameField:function(r,p){typeof p=="boolean"?p={strict:p}:typeof p>"u"&&(p={});var d=p.strict;if(!r.name&&!d){r.name="";return}if(typeof r.name!="string")throw new Error("name field must be a string.");d||(r.name=r.name.trim()),b(r.name,d,p.allowLegacyCase),n(r.name)&&this.warn("conflictingName",r.name)},fixDescriptionField:function(r){r.description&&typeof r.description!="string"&&(this.warn("nonStringDescription"),delete r.description),r.readme&&!r.description&&(r.description=a(r.readme)),r.description===void 0&&delete r.description,r.description||this.warn("missingDescription")},fixReadmeField:function(r){r.readme||(this.warn("missingReadme"),r.readme="ERROR: No README data found!")},fixBugsField:function(r){if(!r.bugs&&r.repository&&r.repository.url){var p=s.fromUrl(r.repository.url);p&&p.bugs()&&(r.bugs={url:p.bugs()})}else if(r.bugs){if(typeof r.bugs=="string")u(r.bugs)?r.bugs={email:r.bugs}:h.canParse(r.bugs)?r.bugs={url:r.bugs}:this.warn("nonEmailUrlBugsString");else{y(r.bugs,this.warn);var d=r.bugs;r.bugs={},d.url&&(h.canParse(d.url)?r.bugs.url=d.url:this.warn("nonUrlBugsUrlField")),d.email&&(typeof d.email=="string"&&u(d.email)?r.bugs.email=d.email:this.warn("nonEmailBugsEmailField"))}!r.bugs.email&&!r.bugs.url&&(delete r.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(r){if(!r.homepage&&r.repository&&r.repository.url){var p=s.fromUrl(r.repository.url);p&&p.docs()&&(r.homepage=p.docs())}if(r.homepage){if(typeof r.homepage!="string")return this.warn("nonUrlHomepage"),delete r.homepage;h.canParse(r.homepage)||(r.homepage="http://"+r.homepage)}},fixLicenseField:function(r){const p=r.license||r.licence;if(!p)return this.warn("missingLicense");if(typeof p!="string"||p.length<1||p.trim()==="")return this.warn("invalidLicense");if(!i(p).validForNewPackages)return this.warn("invalidLicense")}};function f(r){if(r.charAt(0)!=="@")return!1;var p=r.slice(1).split("/");return p.length!==2?!1:p[0]&&p[1]&&p[0]===encodeURIComponent(p[0])&&p[1]===encodeURIComponent(p[1])}function S(r){return!r.match(/[/@\s+%:]/)&&r===encodeURIComponent(r)}function b(r,p,d){if(r.charAt(0)==="."||!(f(r)||S(r))||p&&!d&&r!==r.toLowerCase()||r.toLowerCase()==="node_modules"||r.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(r))}function v(r,p){return r.author&&(r.author=p(r.author)),["maintainers","contributors"].forEach(function(d){Array.isArray(r[d])&&(r[d]=r[d].map(p))}),r}function C(r){if(typeof r=="string")return r;var p=r.name||"",d=r.url||r.web,P=d?" ("+d+")":"",D=r.email||r.mail,w=D?" <"+D+">":"";return p+w+P}function m(r){if(typeof r!="string")return r;var p=r.match(/^([^(<]+)/),d=r.match(/\(([^()]+)\)/),P=r.match(/<([^<>]+)>/),D={};return p&&p[0].trim()&&(D.name=p[0].trim()),P&&(D.email=P[1]),d&&(D.url=d[1]),D}function L(r){var p=r.optionalDependencies;if(p){var d=r.dependencies||{};Object.keys(p).forEach(function(P){d[P]=p[P]}),r.dependencies=d}}function c(r,p,d){if(!r)return{};if(typeof r=="string"&&(r=r.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(r))return r;d("deprecatedArrayDependencies",p);var P={};return r.filter(function(D){return typeof D=="string"}).forEach(function(D){D=D.trim().split(/(:?[@\s><=])/);var w=D.shift(),x=D.join("");x=x.trim(),x=x.replace(/^@/,""),P[w]=x}),P}function g(r,p){l.forEach(function(d){r[d]&&(r[d]=c(r[d],d,p))})}function y(r,p){r&&Object.keys(r).forEach(function(d){o.bugs[d]&&(p("typo",d,o.bugs[d],"bugs"),r[o.bugs[d]]=r[d],delete r[d])})}return Z}var Be="'repositories' (plural) Not supported. Please pick one as the 'repository' field",Re="No repository field.",Ie="Probably broken git url: %s",Ue="scripts must be an object",Me="script values must be string commands",ke="Invalid 'files' member",_e="Invalid filename in 'files' list: %s",We="Invalid 'bundleDependencies' list. Must be array of package names",He="Invalid bundleDependencies member: %s",je="Non-dependency in bundleDependencies: %s",ze="%s field must be an object",Ye="Invalid dependency: %s %s",qe="specifying %s as array is deprecated",Ve="modules field is deprecated",Ke="keywords should be an array of strings",Xe="keywords should be an array of strings",Je="%s is also the name of a node core module.",Ze="'description' field should be a string",Qe="No description",et="No README data",tt="No license field.",it="Bug string field must be url, email, or {email,url}",rt="bugs.url field must be a string url. Deleted.",nt="bugs.email field must be a string email. Deleted.",st="Normalized value of bugs field is an empty object. Deleted.",ot="homepage field must be a string url. Deleted.",lt="license should be a valid SPDX license expression",at="%s should probably be %s.";const zt={repositories:Be,missingRepository:Re,brokenGitUrl:Ie,nonObjectScripts:Ue,nonStringScript:Me,nonArrayFiles:ke,invalidFilename:_e,nonArrayBundleDependencies:We,nonStringBundleDependency:He,nonDependencyBundleDependency:je,nonObjectDependencies:ze,nonStringDependency:Ye,deprecatedArrayDependencies:qe,deprecatedModules:Ve,nonArrayKeywords:Ke,nonStringKeyword:Xe,conflictingName:Je,nonStringDescription:Ze,missingDescription:Qe,missingReadme:et,missingLicense:tt,nonEmailUrlBugsString:it,nonUrlBugsUrlField:rt,nonEmailBugsEmailField:nt,emptyNormalizedBugs:st,nonUrlHomepage:ot,invalidLicense:lt,typo:at},Yt=Object.defineProperty({__proto__:null,brokenGitUrl:Ie,conflictingName:Je,default:zt,deprecatedArrayDependencies:qe,deprecatedModules:Ve,emptyNormalizedBugs:st,invalidFilename:_e,invalidLicense:lt,missingDescription:Qe,missingLicense:tt,missingReadme:et,missingRepository:Re,nonArrayBundleDependencies:We,nonArrayFiles:ke,nonArrayKeywords:Ke,nonDependencyBundleDependency:je,nonEmailBugsEmailField:nt,nonEmailUrlBugsString:it,nonObjectDependencies:ze,nonObjectScripts:Ue,nonStringBundleDependency:He,nonStringDependency:Ye,nonStringDescription:Ze,nonStringKeyword:Xe,nonStringScript:Me,nonUrlBugsUrlField:rt,nonUrlHomepage:ot,repositories:Be,typo:at},Symbol.toStringTag,{value:"Module"}),qt=ie(Yt);var Q,ve;function Vt(){if(ve)return Q;ve=1;var h=yt,e=qt;Q=function(){var i=Array.prototype.slice.call(arguments,0),s=i.shift();if(s==="typo")return t.apply(null,i);var n=e[s]?e[s]:s+": '%s'";return i.unshift(n),h.format.apply(null,i)};function t(i,s,n){return n&&(i=n+"['"+i+"']",s=n+"['"+s+"']"),h.format(e.typo,i,s)}return Q}var ee,Ce;function Kt(){if(Ce)return ee;Ce=1,ee=n;var h=jt();n.fixer=h;var e=Vt(),t=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],i=["dependencies","people","typos"],s=t.map(function(a){return l(a)+"Field"});s=s.concat(i);function n(a,o,u){o===!0&&(o=null,u=!0),u||(u=!1),(!o||a.private)&&(o=function(){}),a.scripts&&a.scripts.install==="node-gyp rebuild"&&!a.scripts.preinstall&&(a.gypfile=!0),h.warn=function(){o(e.apply(null,arguments))},s.forEach(function(f){h["fix"+l(f)](a,u)}),a._id=a.name+"@"+a.version}function l(a){return a.charAt(0).toUpperCase()+a.slice(1)}return ee}var Xt=Kt();const Jt=vt(Xt),Zt=(h,e,t)=>{const i=te(h),s=te(e),n=s===i?".":mt(i,s);return t.some(l=>{const a=l.startsWith("./")?l.slice(2):l,o=n.startsWith("./")?n.slice(2):n;if(a==="."&&o===".")return!0;if(a.endsWith("/**")){const u=a.slice(0,-3);return o===u||o.startsWith(`${u}/`)}if(a.endsWith("/*")){const u=a.slice(0,-2);return u===""?o!=="."&&!o.includes("/"):o.startsWith(`${u}/`)||o===u}return o===a||o.startsWith(`${a}/`)})},Qt=h=>{const e=be("pnpm-workspace.yaml",{cwd:te(h),type:"file"});if(!e)return;const t=De(e),i=Array.isArray(t.packages)?t.packages:[];if(!Zt(e,h,i))return;const s={};return t.catalog&&typeof t.catalog=="object"&&(s.catalog=t.catalog),t.catalogs&&typeof t.catalogs=="object"&&(s.catalogs=t.catalogs),Object.keys(s).length>0?s:void 0},ei=(h,e,t)=>{if(e==="catalog:")return t.catalog?.[h];if(e.startsWith("catalog:")){const i=e.slice(8);return t.catalogs?.[i]?.[h]}},ti=(h,e)=>{for(const[t,i]of Object.entries(h)){if(typeof i!="string")continue;const s=ei(t,i,e);s&&(h[t]=s)}},ii=(h,e)=>{const t=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const i of t){if(!h[i]||typeof h[i]!="object")continue;const s=h[i];ti(s,e)}};let ri;const ni=h=>(ri??=dt(import.meta.url))(h),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=h=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[e,t]=$.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return $.getBuiltinModule(h)}return ni(h)},{existsSync:$i}=re("node:fs"),{createInterface:Ti}=re("node:readline"),{styleText:Bi}=re("node:util"),si=new Set(["__proto__","prototype","constructor"]);Math.max(...[...si].map(h=>h.length));typeof process.stdout<"u"&&!process.versions.deno&&globalThis.window;const oi=/, ([^,]*)$/,li=new Map,ai=(h,e={})=>{const t=e.strict&&e.ignoreWarnings?e.ignoreWarnings.map(String).toSorted((i,s)=>i.localeCompare(s)).join(","):"";return`${h}|s${String(e.strict?1:0)}|c${String(e.resolveCatalogs?1:0)}|j${String(e.json5===!1?0:1)}|y${String(e.yaml===!1?0:1)}|w${t}`};class ci extends Error{constructor(e){super(`The following warnings were encountered while normalizing package data:
3
3
  - ${e.join(`
4
- - `)}`),this.name="PackageJsonValidationError"}}const hi=(h,e,t=[])=>{const i=[];if(Jt(h,s=>{i.push(s)},e),e&&i.length>0){const s=i.filter(n=>!t.some(l=>l instanceof RegExp?l.test(n):l===n));if(s.length>0)throw new ci(s)}return h},ui=h=>De(h),pi=h=>{const e=Lt(h);return St.parse(e)},fi=(h,e)=>e?.yaml!==!1&&(h.endsWith(".yaml")||h.endsWith(".yml"))?ui(h):e?.json5!==!1&&h.endsWith(".json5")?pi(h):bt(h),di=(h,e={})=>{const t={type:"file"};h&&(t.cwd=h);const i=["package.json"];e.yaml!==!1&&i.push("package.yaml","package.yml"),e.json5!==!1&&i.push("package.json5");const s=be(i,t);if(!s)throw new gt(`No such file or directory, for ${i.join(", ").replace(oi," or $1")} found.`);const n=e.cache&&typeof e.cache!="boolean"?e.cache:li,l=ai(s,e);if(e.cache&&n.has(l))return n.get(l);const a=fi(s,e);if(e.resolveCatalogs){const u=Qt(s);u&&ii(a,u)}hi(a,e.strict??!1,e.ignoreWarnings);const o={packageJson:a,path:s};return e.cache&&n.set(l,o),o};var mi="3.0.2";const gi={version:mi},Li=gi.version,Si="@visulima/vis";let O;const Ri=()=>{if(O!==void 0)return O;const h=process.env.VIS_VERSION;if(h)return O=h,O;try{const{packageJson:e}=di(pt(ft(import.meta.url)),{json5:!1,yaml:!1});if(e.name===Si&&typeof e.version=="string")return O=e.version,O}catch{}return O=Li,O};export{Ei as a,wi as b,Fi as c,Ai as d,Gi as e,Ri as g,Ni as h,Di as i,xi as l,Oi as u};
4
+ - `)}`),this.name="PackageJsonValidationError"}}const hi=(h,e,t=[])=>{const i=[];if(Jt(h,s=>{i.push(s)},e),e&&i.length>0){const s=i.filter(n=>!t.some(l=>l instanceof RegExp?l.test(n):l===n));if(s.length>0)throw new ci(s)}return h},ui=h=>De(h),pi=h=>{const e=Lt(h);return St.parse(e)},fi=(h,e)=>e?.yaml!==!1&&(h.endsWith(".yaml")||h.endsWith(".yml"))?ui(h):e?.json5!==!1&&h.endsWith(".json5")?pi(h):bt(h),di=(h,e={})=>{const t={type:"file"};h&&(t.cwd=h);const i=["package.json"];e.yaml!==!1&&i.push("package.yaml","package.yml"),e.json5!==!1&&i.push("package.json5");const s=be(i,t);if(!s)throw new gt(`No such file or directory, for ${i.join(", ").replace(oi," or $1")} found.`);const n=e.cache&&typeof e.cache!="boolean"?e.cache:li,l=ai(s,e);if(e.cache&&n.has(l))return n.get(l);const a=fi(s,e);if(e.resolveCatalogs){const u=Qt(s);u&&ii(a,u)}hi(a,e.strict??!1,e.ignoreWarnings);const o={packageJson:a,path:s};return e.cache&&n.set(l,o),o};var mi="3.0.3";const gi={version:mi},Li=gi.version,Si="@visulima/vis";let O;const Ri=()=>{if(O!==void 0)return O;const h=process.env.VIS_VERSION;if(h)return O=h,O;try{const{packageJson:e}=di(pt(ft(import.meta.url)),{json5:!1,yaml:!1});if(e.name===Si&&typeof e.version=="string")return O=e.version,O}catch{}return O=Li,O};export{Ei as a,wi as b,Fi as c,Ai as d,Gi as e,Ri as g,Ni as h,Di as i,xi as l,Oi as u};
@@ -1 +1 @@
1
- import{createRequire as b}from"node:module";import{e as p}from"./index-DHD8wb6Z.js";import{s as j}from"./index-B4AjSxHU.js";import{g as S}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{y as U}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as E}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as R}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let _;const T=t=>(_??=b(import.meta.url))(t),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=t=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[e,s]=d.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return d.getBuiltinModule(t)}return T(t)},{rmSync:u,writeFileSync:C}=k("node:fs"),g=3,F=1800*1e3,A=15e3,v=()=>p(S(),"packuments"),y=t=>p(v(),`${encodeURIComponent(t)}.json`),M=t=>{const e=y(t);if(U(e))try{const s=E(e);if(s.cacheVersion!==g){u(e,{force:!0});return}if(Date.now()-s.createdAt>s.ttlMs){u(e,{force:!0});return}return s.packument}catch{u(e,{force:!0});return}},w=(t,e,s)=>{R(v());const o={cacheVersion:g,createdAt:Date.now(),packument:e,ttlMs:s};C(y(t),JSON.stringify(o),"utf8")},P=t=>{const e={},s=t.versions??{};for(const[a,r]of Object.entries(s)){const i=r.dist,n={version:a};if(r._npmUser!==void 0&&(n._npmUser=r._npmUser),r.maintainers!==void 0&&(n.maintainers=r.maintainers),r.bin!==void 0&&(n.bin=r.bin),i!==void 0){const c={};i.signatures!==void 0&&(c.signatures=i.signatures),i.attestations!==void 0&&(c.attestations=i.attestations),typeof i.integrity=="string"&&(c.integrity=i.integrity),typeof i.tarball=="string"&&(c.tarball=i.tarball),typeof i.unpackedSize=="number"&&Number.isFinite(i.unpackedSize)&&i.unpackedSize>=0&&(c.unpackedSize=i.unpackedSize),typeof i.fileCount=="number"&&Number.isInteger(i.fileCount)&&i.fileCount>=0&&(c.fileCount=i.fileCount),n.dist=c}r.repository!==void 0&&(n.repository=r.repository),r.license!==void 0&&(n.license=r.license),typeof r.readme=="string"&&(n.readme=r.readme),typeof r.readmeFilename=="string"&&(n.readmeFilename=r.readmeFilename),typeof r.private=="boolean"&&(n.private=r.private),typeof r.deprecated=="string"&&(n.deprecated=r.deprecated),r.scripts!==void 0&&typeof r.scripts=="object"&&(n.scripts=r.scripts),e[a]=n}const o={name:typeof t.name=="string"?t.name:"",versions:e};return t["dist-tags"]!==void 0&&(o["dist-tags"]=t["dist-tags"]),t.time!==void 0&&(o.time=t.time),typeof t.readme=="string"&&(o.readme=t.readme),o},D=t=>{const e={Accept:"application/json"};return t!==void 0&&t!==""&&(e.Authorization=`Bearer ${t}`),e},N=async(t,e)=>{if(e.registryUrl!==void 0)return{authToken:e.authToken,url:e.registryUrl};if(e.workspaceRoot!==void 0){const{getRegistryForPackage:s,loadNpmrc:o}=await import("../packem_chunks/catalog.js").then(n=>n.ab),a=o(e.workspaceRoot),{token:r,url:i}=s(t,a);return{authToken:e.authToken??r,url:i}}return{authToken:e.authToken,url:"https://registry.npmjs.org"}},x=async(t,e={})=>{const s=e.cacheTtlMs??F,o=M(t);if(o!==void 0)return o;if(e.offline)return;const a=await N(t,e),i=`${a.url.endsWith("/")?a.url.slice(0,-1):a.url}/${t.replace("/","%2f")}`,n=new AbortController,c=setTimeout(()=>{n.abort()},A),l=()=>{n.abort()};e.signal?.addEventListener("abort",l,{once:!0});try{const f=await fetch(i,{headers:D(a.authToken),signal:n.signal});if(f.status===404)return;if(!f.ok)throw new Error(`Registry returned ${String(f.status)} for ${t}`);const h=await f.json(),m=P(h);return w(t,m,s),m}finally{clearTimeout(c),e.signal?.removeEventListener("abort",l)}},B=(t,e)=>{const s=Object.keys(t.versions);if(s.length===0)return;if(e===void 0||e===""||e==="latest")return t["dist-tags"]?.latest??s.at(-1);const o=t["dist-tags"]?.[e];return o!==void 0?o:Object.hasOwn(t.versions,e)?e:j.maxSatisfying(s,e)??void 0};export{x as g,B as r};
1
+ import{createRequire as b}from"node:module";import{e as p}from"./index-DHD8wb6Z.js";import{s as j}from"./index-B4AjSxHU.js";import{g as S}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{y as U}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as E}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as R}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let _;const T=t=>(_??=b(import.meta.url))(t),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=t=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[e,s]=d.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return d.getBuiltinModule(t)}return T(t)},{rmSync:u,writeFileSync:C}=k("node:fs"),g=3,F=1800*1e3,A=15e3,v=()=>p(S(),"packuments"),y=t=>p(v(),`${encodeURIComponent(t)}.json`),M=t=>{const e=y(t);if(U(e))try{const s=E(e);if(s.cacheVersion!==g){u(e,{force:!0});return}if(Date.now()-s.createdAt>s.ttlMs){u(e,{force:!0});return}return s.packument}catch{u(e,{force:!0});return}},w=(t,e,s)=>{R(v());const o={cacheVersion:g,createdAt:Date.now(),packument:e,ttlMs:s};C(y(t),JSON.stringify(o),"utf8")},P=t=>{const e={},s=t.versions??{};for(const[a,r]of Object.entries(s)){const i=r.dist,n={version:a};if(r._npmUser!==void 0&&(n._npmUser=r._npmUser),r.maintainers!==void 0&&(n.maintainers=r.maintainers),r.bin!==void 0&&(n.bin=r.bin),i!==void 0){const c={};i.signatures!==void 0&&(c.signatures=i.signatures),i.attestations!==void 0&&(c.attestations=i.attestations),typeof i.integrity=="string"&&(c.integrity=i.integrity),typeof i.tarball=="string"&&(c.tarball=i.tarball),typeof i.unpackedSize=="number"&&Number.isFinite(i.unpackedSize)&&i.unpackedSize>=0&&(c.unpackedSize=i.unpackedSize),typeof i.fileCount=="number"&&Number.isInteger(i.fileCount)&&i.fileCount>=0&&(c.fileCount=i.fileCount),n.dist=c}r.repository!==void 0&&(n.repository=r.repository),r.license!==void 0&&(n.license=r.license),typeof r.readme=="string"&&(n.readme=r.readme),typeof r.readmeFilename=="string"&&(n.readmeFilename=r.readmeFilename),typeof r.private=="boolean"&&(n.private=r.private),typeof r.deprecated=="string"&&(n.deprecated=r.deprecated),r.scripts!==void 0&&typeof r.scripts=="object"&&(n.scripts=r.scripts),e[a]=n}const o={name:typeof t.name=="string"?t.name:"",versions:e};return t["dist-tags"]!==void 0&&(o["dist-tags"]=t["dist-tags"]),t.time!==void 0&&(o.time=t.time),typeof t.readme=="string"&&(o.readme=t.readme),o},D=t=>{const e={Accept:"application/json"};return t!==void 0&&t!==""&&(e.Authorization=`Bearer ${t}`),e},N=async(t,e)=>{if(e.registryUrl!==void 0)return{authToken:e.authToken,url:e.registryUrl};if(e.workspaceRoot!==void 0){const{getRegistryForPackage:s,loadNpmrc:o}=await import("../packem_chunks/catalog.js").then(n=>n.ab),a=o(e.workspaceRoot),{token:r,url:i}=s(t,a);return{authToken:e.authToken??r,url:i}}return{authToken:e.authToken,url:"https://registry.npmjs.org"}},x=async(t,e={})=>{const s=e.cacheTtlMs??F,o=M(t);if(o!==void 0)return o;if(e.offline)return;const a=await N(t,e),i=`${a.url.endsWith("/")?a.url.slice(0,-1):a.url}/${t.replace("/","%2f")}`,n=new AbortController,c=setTimeout(()=>{n.abort()},A),l=()=>{n.abort()};e.signal?.addEventListener("abort",l,{once:!0});try{const f=await fetch(i,{headers:D(a.authToken),signal:n.signal});if(f.status===404)return;if(!f.ok)throw new Error(`Registry returned ${String(f.status)} for ${t}`);const h=await f.json(),m=P(h);return w(t,m,s),m}finally{clearTimeout(c),e.signal?.removeEventListener("abort",l)}},B=(t,e)=>{const s=Object.keys(t.versions);if(s.length===0)return;if(e===void 0||e===""||e==="latest")return t["dist-tags"]?.latest??s.at(-1);const o=t["dist-tags"]?.[e];return o!==void 0?o:Object.hasOwn(t.versions,e)?e:j.maxSatisfying(s,e)??void 0};export{x as g,B as r};
@@ -1 +1 @@
1
- import{createRequire as U}from"node:module";import{e as y,m as O,c as S,z as J}from"./index-DHD8wb6Z.js";import{withEnhancedPath as Y,collectNodeModulesBinDirs as z}from"@visulima/task-runner";import{s as j}from"./index-B4AjSxHU.js";import{resolveDlx as G,detectPackageManager as H,whichBin as V,resolveAdd as X,resolveRemove as K,resolveDedupe as Q,resolveWhy as Z,resolveLink as ee,resolveUnlink as ne,resolvePmCommand as re,execPmCommandInteractive as se,resolveInstall as ae,resolveExec as ie}from"#native";import{y as R}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";let T;const x=e=>(T??=U(import.meta.url))(e),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=e=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[n,r]=k.versions.node.split(".").map(Number);if(n>22||n===22&&r>=3||n===20&&r>=16)return k.getBuiltinModule(e)}return x(e)},{spawn:F,spawnSync:E}=q("node:child_process"),p=(e,n,r,s)=>{for(const a of n)e.push("--filter",a);r&&e.push("--recursive"),s&&e.push("--workspace-root")},te=e=>{const n=[],r=[];return p(n,e.filter,e.recursive,e.workspaceRoot),e.silent&&n.push("--silent"),e.frozenLockfile&&n.push("--frozen-lockfile"),n.push("install"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.force&&n.push("--force"),e.ignoreScripts&&n.push("--ignore-scripts"),e.lockfileOnly&&n.push("--lockfile-only"),e.noOptional&&n.push("--no-optional"),e.offline&&n.push("--offline"),{args:n,bin:"aube",warnings:r}},oe=e=>{const n=[],r=[];return p(n,e.filter,!1,!1),n.push("add"),e.saveDev&&n.push("--save-dev"),e.exact&&n.push("--save-exact"),e.global&&n.push("--global"),e.optional&&n.push("--save-optional"),e.peer&&n.push("--save-peer"),e.workspace&&r.push("aube has no flag for the `workspace:` protocol; it auto-detects local workspace members during add. Ignoring --workspace."),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:r}},ue=e=>{const n=[];return p(n,e.filter,e.recursive,!1),n.push("remove"),e.saveDev&&n.push("--save-dev"),e.global&&n.push("--global"),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:[]}},ce=e=>{const n=["dedupe"];return e&&n.push("--check"),{args:n,bin:"aube",warnings:[]}},le=e=>{const n=[],r=[];p(n,e.filter,e.recursive,!1),n.push("why"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.json&&n.push("--json"),e.long&&n.push("--long"),e.parseable&&n.push("--parseable"),e.depth!==void 0&&r.push("aube why does not accept --depth; ignoring."),e.noOptional&&r.push("aube why does not accept --no-optional; ignoring."),e.global&&r.push("aube why does not accept --global; ignoring.");const[s,...a]=e.packages;return s===void 0?r.push("aube why requires a package name; none provided."):(a.length>0&&r.push("aube why takes a single package; using the first."),n.push(s)),{args:n,bin:"aube",warnings:r}},fe=e=>{const n=[];e.silent&&n.push("--silent"),n.push("dlx");for(const r of e.additionalPackages)n.push("--package",r);return e.shellMode&&n.push("--shell-mode"),n.push(e.package),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},de=e=>{const n=[];return p(n,e.filter,e.recursive,e.workspaceRoot),n.push("exec"),e.parallel&&n.push("--parallel"),e.reverse&&n.push("--reverse"),e.shellMode&&n.push("--shell-mode"),n.push(e.command),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},he=e=>{const n=["link"];return e!==null&&n.push(e),{args:n,bin:"aube",warnings:[]}},pe=(e,n)=>{const r=[],s=[];return n&&r.push("--recursive"),r.push("unlink"),e.length>1&&s.push("aube unlink takes a single package; using the first."),e.length>0&&r.push(e[0]),{args:r,bin:"aube",warnings:s}},ge=e=>{const n=["view","--",e.package],r=[],[s,...a]=e.fields;return s!==void 0?(a.length>0&&r.push("aube view only supports a single field; using the first."),e.json&&r.push("aube view does not support --json with a field selector; printing the field without --json."),n.push(s)):e.json&&n.push("--json"),{args:n,bin:"aube",warnings:r}},Ye=e=>{const n=[],r=[];return p(n,e.filters,e.recursive,e.workspaceRoot),n.push("update"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.global&&n.push("--global"),e.interactive&&n.push("--interactive"),e.latest&&n.push("--latest"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"aube",warnings:r}},be=new Set(["fund","ping","search","token"]),ke=(e,n)=>be.has(e)?{args:[e,...n],bin:"npm",warnings:[`'${e}' is not natively supported by aube. Delegating to npm.`]}:{args:[e,...n],bin:"aube",warnings:[]},w=256*1024,we=e=>{const n=e?{...process.env,...e}:{...process.env};return process.stderr.isTTY&&n.FORCE_COLOR===void 0&&n.NO_COLOR===void 0&&(n.FORCE_COLOR="1"),n},I=e=>e!==""&&!/[\s"&()<>^|%!]/u.test(e)?e:`"${e.replaceAll(/(\\*)"/gu,String.raw`$1$1\"`).replace(/(\\+)$/u,"$1$1").replaceAll(/[&()<>^|%!]/gu,String.raw`^$&`)}"`,ve=async(e,n,r)=>new Promise((s,a)=>{const i=process.platform==="win32",t=F(i?I(e):e,i?n.map(o=>I(o)):[...n],{cwd:r.cwd,env:we(r.env),shell:i,stdio:["inherit","pipe","pipe"],windowsHide:!0});let c=[],f=0;const d=o=>{if(c.push(o),f+=o.length,!(f<=w)){for(;c.length>1&&f-c[0].length>w;)f-=c.shift().length;if(c.length===1&&f>w){const h=c[0];c[0]=h.subarray(h.length-w),f=w}}},b=()=>Buffer.concat(c).toString("utf8");t.stdout?.on("data",o=>{process.stdout.write(o),d(o)}),t.stderr?.on("data",o=>{process.stderr.write(o),d(o)}),t.on("error",a),t.on("close",o=>{const h=b();c=[],s({code:o??1,output:h})})}),v=e=>{const n=j.coerce(e);return n?j.gte(n,"11.0.0"):!1},l=e=>e.name==="yarn"&&!e.version.startsWith("1."),$=e=>e.name==="yarn"&&e.version.startsWith("1."),ye=e=>e[0]==="rm"?["remove",...e.slice(1)]:e,me=(e,n,r)=>{switch(n){case"audit":return l(e)?{args:["npm","audit",...r],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"config":{if(l(e)){const[s,...a]=r;return s==="delete"?{args:["config","unset",...a],bin:"yarn",kind:"rewrite",warning:"yarn berry uses `config unset`, not `config delete`."}:{kind:"passthrough"}}return e.name==="bun"?{kind:"skip",warning:"bun has no `config` CLI. Edit bunfig.toml or .npmrc directly."}:e.name==="deno"?{kind:"skip",warning:"deno has no registry-config CLI. Edit deno.json directly."}:{kind:"passthrough"}}case"dist-tag":return $(e)?{args:["tag",...r],bin:"yarn",kind:"rewrite",warning:"yarn 1 has no `dist-tag`; using `yarn tag`."}:l(e)?{args:["npm","tag",...ye(r)],bin:"yarn",kind:"rewrite"}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`dist-tag\`. Use \`npm dist-tag\` instead.`}:{kind:"passthrough"};case"login":case"logout":return l(e)?{args:["npm",n,...r],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:[n,...r],bin:"npm",kind:"rewrite",warning:`bun has no \`${n}\`; falling back to \`npm ${n}\` (writes ~/.npmrc, which bun reads).`}:e.name==="deno"?{kind:"skip",warning:`deno has no \`${n}\`. JSR uses browser OAuth via \`deno publish\`.`}:{kind:"passthrough"};case"owner":return e.name==="pnpm"&&v(e.version)?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `owner`; falling back to `npm owner`."}:l(e)?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"yarn berry has no `owner` (not in `yarn npm`); falling back to `npm owner`."}:e.name==="bun"?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"bun has no `owner`; falling back to `npm owner`."}:e.name==="deno"?{kind:"skip",warning:"deno has no `owner`. JSR uses scope-member roles via the web UI."}:{kind:"passthrough"};case"ping":return e.name==="pnpm"&&v(e.version)?{args:["ping",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `ping`; falling back to `npm ping`."}:{kind:"passthrough"};case"plugin":return l(e)?{kind:"passthrough"}:{kind:"skip",warning:`${e.name} does not support yarn-style plugins. Skipping (no-op).`};case"prune":return $(e)?{kind:"skip",warning:"yarn 1 has no `prune`. Use `yarn install --production` for a prod-only tree."}:l(e)?{kind:"skip",warning:"yarn berry has no `prune`. Use `yarn workspaces focus --production` instead."}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`prune\`. Pruning happens automatically on install.`}:{kind:"passthrough"};case"publish":return l(e)?{args:["npm","publish",...r],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"rebuild":return $(e)?{kind:"skip",warning:"yarn 1 has no `rebuild`. Re-install instead."}:e.name==="bun"?{kind:"skip",warning:"bun has no `rebuild`. Use `bun install --force` instead."}:e.name==="deno"?{kind:"skip",warning:"deno has no `rebuild`."}:{kind:"passthrough"};case"search":return e.name==="pnpm"&&v(e.version)?{args:["search",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `search`; falling back to `npm search`."}:{kind:"passthrough"};case"token":return e.name==="pnpm"&&v(e.version)?{args:["token",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `token`; falling back to `npm token`."}:{kind:"passthrough"};case"whoami":return e.name==="pnpm"&&v(e.version)?{args:["whoami",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `whoami`; falling back to `npm whoami`."}:l(e)?{args:["npm","whoami",...r],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:["pm","whoami",...r],bin:"bun",kind:"rewrite"}:e.name==="deno"?{kind:"skip",warning:"deno has no `whoami`. JSR uses browser auth."}:{kind:"passthrough"};default:return{kind:"passthrough"}}},A=e=>V(e)!==null,je=e=>{const n=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"],["bun.lock","bun"],["bun.lockb","bun"],["deno.lock","deno"]];let r=e;for(;;){for(const[a,i]of n)if(R(y(r,a)))return i;const s=O(r);if(s===r||S(r).root===r)return;r=s}},ze=(e,n)=>{if(n.name!=="aube")return;const r=je(e);if(r!==void 0)return`Resolved installer is aube but the workspace has a ${r} lockfile. Aube reads and writes ${r}'s lockfile format in place, but its byte output may differ subtly — expect a one-time churn diff on the first install, and ongoing drift if your team mixes tools on the same lockfile. To pin the choice across the team, set \`install.backend\` in vis.config; to bypass aube for this run, pass --no-aube.`},C=e=>{if(R(e))try{return JSON.parse(J(e,{buffer:!1}))}catch{return}},Re=e=>{let n=e;for(;;){const r=y(n,"package.json"),s=C(r);if(s&&typeof s.packageManager=="string"&&s.packageManager.length>0)return s.packageManager;const a=O(n);if(a===n||S(n).root===n)return;n=a}},M=new Set(["npm","pnpm","yarn"]),P=(e,n,r)=>r===!1||!M.has(n)||!A("corepack")?!1:r===!0?!0:Re(e)!==void 0,Ge=(e,n)=>{const r=n.backend,s=process.env.VIS_INSTALLER,a=r??s??n.configBackend,i=n.configCorepack??"auto";if(a&&a!=="auto"){if(a==="aube"&&!A("aube"))throw new Error('install.backend is set to "aube" but the `aube` binary is not on PATH. Install it via `npm i -g @endevco/aube`, `mise use -g aube`, or `brew install endevco/tap/aube`.');return{name:a,useCorepack:P(e,a,i),version:"latest"}}if(A("aube"))return{name:"aube",useCorepack:!1,version:"latest"};const t=$e(e);return{...t,useCorepack:P(e,t.name,i)}},$e=e=>{if(!R(e))throw new Error(`Could not detect package manager in ${e}. Directory does not exist.`);const n=H(e);return{name:n.name,version:n.version||"latest"}},L=(e,n)=>n.useCorepack!==!0||!M.has(n.name)||e.bin==="corepack"||e.bin!==n.name?e:{...e,args:[n.name,...e.args],bin:"corepack"},Ae=(e,n,r)=>{if(r===void 0)return se(e.bin,e.args,n);const s=E(e.bin,e.args,{cwd:n,env:{...process.env,...r},stdio:"inherit"});if(s.error)throw s.error;return s.status??1},u=(e,n,r,s,a={})=>{const i=L(n,e);for(const t of i.warnings)s.warn(`warning: ${t}`);return a.dry?(s.log(`[dry-run] ${i.bin} ${i.args.join(" ")}`),0):Ae(i,r,a.env)},g=(e,n,r,s,a={})=>u(e,n(),r,s,a),Oe=(e,n)=>n==="aube"||n==="deno"?e:{...e,args:[...e.args,"--prefer-offline"]},Se=(e,n,r)=>n!=="yarn"||r.startsWith("1.")||!e.args.includes("--immutable")||e.args.includes("--immutable-cache")?e:{...e,args:[...e.args,"--immutable-cache"]},W=(e,n,r)=>{let s=e.name==="aube"?te(n):ae(e.name,e.version,{...n,silent:n.silent||r.silent===!0});return r.preferOffline&&(s=Oe(s,e.name)),r.ciMode&&(s=Se(s,e.name,e.version)),s},He=(e,n,r,s,a={})=>{const i=W(e,n,a);return D(e,i,r,s,{dry:a.dry,env:a.env})},Ve=async(e,n,r,s,a={})=>{const i=L(W(e,n,a),e);for(const t of i.warnings)s.warn(`warning: ${t}`);return a.dry?(s.log(`[dry-run] ${i.bin} ${i.args.join(" ")}`),{code:0,output:""}):ve(i.bin,i.args,{cwd:r,env:a.env?{...process.env,...a.env}:process.env})},N=(e,n)=>{const r=n==="deno"?"--quiet":"--silent";return{...e,args:[...e.args,r]}},Ce=(e,n)=>n==="yarn"||n==="aube"?null:{...e,args:[...e.args,"--dry-run"]},D=(e,n,r,s,a)=>{if(a.dry!==!0)return u(e,n,r,s,a);const i=Ce(n,e.name);return i===null?u(e,n,r,s,a):u(e,i,r,s,{env:a.env})},De=(e,n)=>n==="aube"?{...e,args:[...e.args,"--ignore-scripts"]}:n==="deno"?e:{...e,args:[...e.args,"--ignore-scripts"]},_e=(e,n,r,s,a={})=>{let i=e.name==="aube"?oe(n):X(e.name,e.version,n);a.ignoreScripts&&(i=De(i,e.name)),a.silent&&(i=N(i,e.name));const t=D(e,i,r,s,{dry:a.dry,env:a.env});return t===0&&a.autoInstallPeers&&Me(e,n,r,s,a),t},Ie=e=>{if(e.startsWith("@")){const r=e.indexOf("/");if(r===-1)return e;const s=e.indexOf("@",r);return s===-1?e:e.slice(0,s)}const n=e.indexOf("@");return n===-1?e:e.slice(0,n)},Pe=(e,n)=>{let r=e;for(;;){const s=y(r,"node_modules",n,"package.json"),a=C(s);if(a)return a;const i=O(r);if(i===r||S(r).root===r)return;r=i}},Ee=e=>{const n=C(y(e,"package.json")),r=new Set;if(!n)return r;for(const s of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const a=n[s];if(a)for(const i of Object.keys(a))r.add(i)}return r},Me=(e,n,r,s,a)=>{if(e.name==="deno")return;const i=Ee(r),t=new Map;for(const d of n.packages){const b=Ie(d),o=Pe(r,b);if(!o?.peerDependencies)continue;const h=o.peerDependenciesMeta??{};for(const[m,B]of Object.entries(o.peerDependencies))h[m]?.optional||i.has(m)||t.has(m)||t.set(m,B)}if(t.size===0)return;const c=[...t.entries()].map(([d,b])=>`${d}@${b}`);s.log(`auto-installing peer dependencies: ${c.join(", ")}`);const f={exact:!1,filter:n.filter,global:!1,optional:!1,packages:c,peer:!1,saveDev:n.saveDev,workspace:!1,workspaceRoot:n.workspaceRoot};_e(e,f,r,s,{ignoreScripts:a.ignoreScripts})},Xe=(e,n,r,s,a={})=>{let i=e.name==="aube"?ue(n):K(e.name,e.version,n);return a.silent&&(i=N(i,e.name)),D(e,i,r,s,{dry:a.dry,env:a.env})},Ke=(e,n,r,s,a={})=>e.name==="aube"?u(e,ce(n),r,s,a):g(e,()=>Q(e.name,e.version,n),r,s,a),Qe=(e,n,r,s,a={})=>e.name==="aube"?u(e,le(n),r,s,a):g(e,()=>Z(e.name,e.version,n),r,s,a),Le=(e,n)=>{if(e.name==="aube")return ge(n);const r=[],s=[],a=e.name;switch(e.name){case"bun":{const i=j.coerce(e.version);i&&j.lt(i,"1.3.0")&&s.push(`bun ${e.version} does not support \`bun pm view\` (added in bun 1.3). Upgrade bun, or run \`npm view ${n.package}\` instead.`),r.push("pm","view","--",n.package,...n.fields),n.json&&r.push("--json");break}case"deno":{const i=n.package.startsWith("npm:")||n.package.startsWith("jsr:")||n.package.startsWith("https://")||n.package.startsWith("http://")||n.package.startsWith("file:")?n.package:`npm:${n.package}`;r.push("info","--",i),n.json&&r.push("--json"),n.fields.length>0&&s.push("deno info does not accept field selectors; ignoring.");break}case"npm":case"pnpm":{r.push("view","--",n.package,...n.fields),n.json&&r.push("--json");break}case"yarn":{if(e.version.startsWith("1.")){r.push("info","--",n.package);const[i,...t]=n.fields;i!==void 0&&(t.length>0&&s.push("yarn v1 only supports querying one field at a time; using the first."),r.push(i)),n.json&&r.push("--json")}else r.push("npm","info","--",n.package),n.fields.length>0&&s.push("yarn berry does not support field arguments to 'npm info'; ignoring."),n.json&&r.push("--json");break}default:{const i=e.name;throw new Error(`Unsupported package manager: ${i}`)}}return{args:r,bin:a,warnings:s}},Ze=(e,n,r,s,a={})=>u(e,Le(e,n),r,s,a),en=(e,n,r,s,a={})=>e.name==="aube"?u(e,he(n),r,s,a):g(e,()=>ee(e.name,e.version,n),r,s,a),nn=(e,n,r,s,a,i={})=>e.name==="aube"?u(e,pe(n,r),s,a,i):g(e,()=>ne(e.name,e.version,n,r),s,a,i),We=(e,n,r)=>{if(e.args.includes("--offline")||e.args.includes("--cached-only"))return e;const s=(a,i)=>{const t=[...e.args];return t.splice(i,0,a),{...e,args:t}};switch(n){case"aube":case"pnpm":return s("--offline",1);case"bun":return{...e,warnings:[...e.warnings,"bun x does not support --offline. Pre-install the package via `vis install` so bun x resolves from the local cache."]};case"deno":return s("--cached-only",1);case"npm":return s("--offline",1);case"yarn":return r.startsWith("1.")?s("--offline",0):{...e,warnings:[...e.warnings,"yarn berry has no --offline flag for dlx. Configure `enableNetwork: false` in .yarnrc.yml or set `enableMirror: true` for offline-first behavior."]};default:{const a=n;return{...e,warnings:[...e.warnings,`applyDlxOffline: unsupported pm ${String(a)}`]}}}},rn=(e,n,r,s,a={})=>{let i=e.name==="aube"?fe(n):G(e.name,e.version,n);return a.offline&&(i=We(i,e.name,e.version)),u(e,i,r,s,{dry:a.dry,env:a.env})},_=process.platform==="win32",Ne=_?[".exe",".cmd",".bat",".ps1",""]:[""],Be=(e,n)=>{if(!(e.includes("/")||e.includes("\\")))for(const r of z(n))for(const s of Ne){const a=y(r,`${e}${s}`);if(R(a))return _?a.replaceAll("/","\\"):a}},sn=(e,n,r)=>{const s=Be(e,r);if(s===void 0||_&&!s.toLowerCase().endsWith(".exe"))return null;const a=E(s,n,{cwd:r,env:Y({...process.env},r),stdio:"inherit"});if(a.error)throw a.error;return a.status??1},an=(e,n,r,s,a={})=>e.name==="aube"?u(e,de(n),r,s,a):g(e,()=>ie(e.name,e.version,n),r,s,a),tn=(e,n,r,s,a,i={})=>{if(e.name==="aube")return u(e,ke(n,r),s,a,i);const t=me(e,n,r);return t.kind==="skip"?(a.warn(`warning: ${t.warning}`),0):t.kind==="rewrite"?u(e,{args:t.args,bin:t.bin,warnings:t.warning?[t.warning]:[]},s,a,i):g(e,()=>re(e.name,e.version,n,r),s,a,i)};export{Ge as a,an as b,_e as c,$e as d,Ke as e,Ze as f,ze as g,Ve as h,en as i,tn as j,Xe as k,nn as l,Qe as m,He as n,rn as o,Ye as p,sn as r,ve as s};
1
+ import{createRequire as U}from"node:module";import{e as y,m as O,c as S,z as J}from"./index-DHD8wb6Z.js";import{withEnhancedPath as Y,collectNodeModulesBinDirs as z}from"@visulima/task-runner";import{s as j}from"./index-B4AjSxHU.js";import{detectPackageManager as G,resolveAdd as H,resolveRemove as V,whichBin as X,resolveUnlink as K,resolveInstall as Q,execPmCommandInteractive as Z,resolveDlx as ee,resolveExec as ne,resolveDedupe as re,resolveWhy as se,resolveLink as ae,resolvePmCommand as ie}from"#native";import{y as R}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";let T;const x=e=>(T??=U(import.meta.url))(e),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=e=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[n,r]=k.versions.node.split(".").map(Number);if(n>22||n===22&&r>=3||n===20&&r>=16)return k.getBuiltinModule(e)}return x(e)},{spawn:F,spawnSync:E}=q("node:child_process"),p=(e,n,r,s)=>{for(const a of n)e.push("--filter",a);r&&e.push("--recursive"),s&&e.push("--workspace-root")},te=e=>{const n=[],r=[];return p(n,e.filter,e.recursive,e.workspaceRoot),e.silent&&n.push("--silent"),e.frozenLockfile&&n.push("--frozen-lockfile"),n.push("install"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.force&&n.push("--force"),e.ignoreScripts&&n.push("--ignore-scripts"),e.lockfileOnly&&n.push("--lockfile-only"),e.noOptional&&n.push("--no-optional"),e.offline&&n.push("--offline"),{args:n,bin:"aube",warnings:r}},oe=e=>{const n=[],r=[];return p(n,e.filter,!1,!1),n.push("add"),e.saveDev&&n.push("--save-dev"),e.exact&&n.push("--save-exact"),e.global&&n.push("--global"),e.optional&&n.push("--save-optional"),e.peer&&n.push("--save-peer"),e.workspace&&r.push("aube has no flag for the `workspace:` protocol; it auto-detects local workspace members during add. Ignoring --workspace."),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:r}},ue=e=>{const n=[];return p(n,e.filter,e.recursive,!1),n.push("remove"),e.saveDev&&n.push("--save-dev"),e.global&&n.push("--global"),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:[]}},ce=e=>{const n=["dedupe"];return e&&n.push("--check"),{args:n,bin:"aube",warnings:[]}},le=e=>{const n=[],r=[];p(n,e.filter,e.recursive,!1),n.push("why"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.json&&n.push("--json"),e.long&&n.push("--long"),e.parseable&&n.push("--parseable"),e.depth!==void 0&&r.push("aube why does not accept --depth; ignoring."),e.noOptional&&r.push("aube why does not accept --no-optional; ignoring."),e.global&&r.push("aube why does not accept --global; ignoring.");const[s,...a]=e.packages;return s===void 0?r.push("aube why requires a package name; none provided."):(a.length>0&&r.push("aube why takes a single package; using the first."),n.push(s)),{args:n,bin:"aube",warnings:r}},fe=e=>{const n=[];e.silent&&n.push("--silent"),n.push("dlx");for(const r of e.additionalPackages)n.push("--package",r);return e.shellMode&&n.push("--shell-mode"),n.push(e.package),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},de=e=>{const n=[];return p(n,e.filter,e.recursive,e.workspaceRoot),n.push("exec"),e.parallel&&n.push("--parallel"),e.reverse&&n.push("--reverse"),e.shellMode&&n.push("--shell-mode"),n.push(e.command),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},he=e=>{const n=["link"];return e!==null&&n.push(e),{args:n,bin:"aube",warnings:[]}},pe=(e,n)=>{const r=[],s=[];return n&&r.push("--recursive"),r.push("unlink"),e.length>1&&s.push("aube unlink takes a single package; using the first."),e.length>0&&r.push(e[0]),{args:r,bin:"aube",warnings:s}},ge=e=>{const n=["view","--",e.package],r=[],[s,...a]=e.fields;return s!==void 0?(a.length>0&&r.push("aube view only supports a single field; using the first."),e.json&&r.push("aube view does not support --json with a field selector; printing the field without --json."),n.push(s)):e.json&&n.push("--json"),{args:n,bin:"aube",warnings:r}},Ye=e=>{const n=[],r=[];return p(n,e.filters,e.recursive,e.workspaceRoot),n.push("update"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.global&&n.push("--global"),e.interactive&&n.push("--interactive"),e.latest&&n.push("--latest"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"aube",warnings:r}},be=new Set(["fund","ping","search","token"]),ke=(e,n)=>be.has(e)?{args:[e,...n],bin:"npm",warnings:[`'${e}' is not natively supported by aube. Delegating to npm.`]}:{args:[e,...n],bin:"aube",warnings:[]},w=256*1024,we=e=>{const n=e?{...process.env,...e}:{...process.env};return process.stderr.isTTY&&n.FORCE_COLOR===void 0&&n.NO_COLOR===void 0&&(n.FORCE_COLOR="1"),n},I=e=>e!==""&&!/[\s"&()<>^|%!]/u.test(e)?e:`"${e.replaceAll(/(\\*)"/gu,String.raw`$1$1\"`).replace(/(\\+)$/u,"$1$1").replaceAll(/[&()<>^|%!]/gu,String.raw`^$&`)}"`,ve=async(e,n,r)=>new Promise((s,a)=>{const i=process.platform==="win32",t=F(i?I(e):e,i?n.map(o=>I(o)):[...n],{cwd:r.cwd,env:we(r.env),shell:i,stdio:["inherit","pipe","pipe"],windowsHide:!0});let c=[],f=0;const d=o=>{if(c.push(o),f+=o.length,!(f<=w)){for(;c.length>1&&f-c[0].length>w;)f-=c.shift().length;if(c.length===1&&f>w){const h=c[0];c[0]=h.subarray(h.length-w),f=w}}},b=()=>Buffer.concat(c).toString("utf8");t.stdout?.on("data",o=>{process.stdout.write(o),d(o)}),t.stderr?.on("data",o=>{process.stderr.write(o),d(o)}),t.on("error",a),t.on("close",o=>{const h=b();c=[],s({code:o??1,output:h})})}),v=e=>{const n=j.coerce(e);return n?j.gte(n,"11.0.0"):!1},l=e=>e.name==="yarn"&&!e.version.startsWith("1."),$=e=>e.name==="yarn"&&e.version.startsWith("1."),ye=e=>e[0]==="rm"?["remove",...e.slice(1)]:e,me=(e,n,r)=>{switch(n){case"audit":return l(e)?{args:["npm","audit",...r],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"config":{if(l(e)){const[s,...a]=r;return s==="delete"?{args:["config","unset",...a],bin:"yarn",kind:"rewrite",warning:"yarn berry uses `config unset`, not `config delete`."}:{kind:"passthrough"}}return e.name==="bun"?{kind:"skip",warning:"bun has no `config` CLI. Edit bunfig.toml or .npmrc directly."}:e.name==="deno"?{kind:"skip",warning:"deno has no registry-config CLI. Edit deno.json directly."}:{kind:"passthrough"}}case"dist-tag":return $(e)?{args:["tag",...r],bin:"yarn",kind:"rewrite",warning:"yarn 1 has no `dist-tag`; using `yarn tag`."}:l(e)?{args:["npm","tag",...ye(r)],bin:"yarn",kind:"rewrite"}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`dist-tag\`. Use \`npm dist-tag\` instead.`}:{kind:"passthrough"};case"login":case"logout":return l(e)?{args:["npm",n,...r],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:[n,...r],bin:"npm",kind:"rewrite",warning:`bun has no \`${n}\`; falling back to \`npm ${n}\` (writes ~/.npmrc, which bun reads).`}:e.name==="deno"?{kind:"skip",warning:`deno has no \`${n}\`. JSR uses browser OAuth via \`deno publish\`.`}:{kind:"passthrough"};case"owner":return e.name==="pnpm"&&v(e.version)?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `owner`; falling back to `npm owner`."}:l(e)?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"yarn berry has no `owner` (not in `yarn npm`); falling back to `npm owner`."}:e.name==="bun"?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"bun has no `owner`; falling back to `npm owner`."}:e.name==="deno"?{kind:"skip",warning:"deno has no `owner`. JSR uses scope-member roles via the web UI."}:{kind:"passthrough"};case"ping":return e.name==="pnpm"&&v(e.version)?{args:["ping",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `ping`; falling back to `npm ping`."}:{kind:"passthrough"};case"plugin":return l(e)?{kind:"passthrough"}:{kind:"skip",warning:`${e.name} does not support yarn-style plugins. Skipping (no-op).`};case"prune":return $(e)?{kind:"skip",warning:"yarn 1 has no `prune`. Use `yarn install --production` for a prod-only tree."}:l(e)?{kind:"skip",warning:"yarn berry has no `prune`. Use `yarn workspaces focus --production` instead."}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`prune\`. Pruning happens automatically on install.`}:{kind:"passthrough"};case"publish":return l(e)?{args:["npm","publish",...r],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"rebuild":return $(e)?{kind:"skip",warning:"yarn 1 has no `rebuild`. Re-install instead."}:e.name==="bun"?{kind:"skip",warning:"bun has no `rebuild`. Use `bun install --force` instead."}:e.name==="deno"?{kind:"skip",warning:"deno has no `rebuild`."}:{kind:"passthrough"};case"search":return e.name==="pnpm"&&v(e.version)?{args:["search",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `search`; falling back to `npm search`."}:{kind:"passthrough"};case"token":return e.name==="pnpm"&&v(e.version)?{args:["token",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `token`; falling back to `npm token`."}:{kind:"passthrough"};case"whoami":return e.name==="pnpm"&&v(e.version)?{args:["whoami",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `whoami`; falling back to `npm whoami`."}:l(e)?{args:["npm","whoami",...r],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:["pm","whoami",...r],bin:"bun",kind:"rewrite"}:e.name==="deno"?{kind:"skip",warning:"deno has no `whoami`. JSR uses browser auth."}:{kind:"passthrough"};default:return{kind:"passthrough"}}},A=e=>X(e)!==null,je=e=>{const n=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"],["bun.lock","bun"],["bun.lockb","bun"],["deno.lock","deno"]];let r=e;for(;;){for(const[a,i]of n)if(R(y(r,a)))return i;const s=O(r);if(s===r||S(r).root===r)return;r=s}},ze=(e,n)=>{if(n.name!=="aube")return;const r=je(e);if(r!==void 0)return`Resolved installer is aube but the workspace has a ${r} lockfile. Aube reads and writes ${r}'s lockfile format in place, but its byte output may differ subtly — expect a one-time churn diff on the first install, and ongoing drift if your team mixes tools on the same lockfile. To pin the choice across the team, set \`install.backend\` in vis.config; to bypass aube for this run, pass --no-aube.`},C=e=>{if(R(e))try{return JSON.parse(J(e,{buffer:!1}))}catch{return}},Re=e=>{let n=e;for(;;){const r=y(n,"package.json"),s=C(r);if(s&&typeof s.packageManager=="string"&&s.packageManager.length>0)return s.packageManager;const a=O(n);if(a===n||S(n).root===n)return;n=a}},M=new Set(["npm","pnpm","yarn"]),P=(e,n,r)=>r===!1||!M.has(n)||!A("corepack")?!1:r===!0?!0:Re(e)!==void 0,Ge=(e,n)=>{const r=n.backend,s=process.env.VIS_INSTALLER,a=r??s??n.configBackend,i=n.configCorepack??"auto";if(a&&a!=="auto"){if(a==="aube"&&!A("aube"))throw new Error('install.backend is set to "aube" but the `aube` binary is not on PATH. Install it via `npm i -g @endevco/aube`, `mise use -g aube`, or `brew install endevco/tap/aube`.');return{name:a,useCorepack:P(e,a,i),version:"latest"}}if(A("aube"))return{name:"aube",useCorepack:!1,version:"latest"};const t=$e(e);return{...t,useCorepack:P(e,t.name,i)}},$e=e=>{if(!R(e))throw new Error(`Could not detect package manager in ${e}. Directory does not exist.`);const n=G(e);return{name:n.name,version:n.version||"latest"}},L=(e,n)=>n.useCorepack!==!0||!M.has(n.name)||e.bin==="corepack"||e.bin!==n.name?e:{...e,args:[n.name,...e.args],bin:"corepack"},Ae=(e,n,r)=>{if(r===void 0)return Z(e.bin,e.args,n);const s=E(e.bin,e.args,{cwd:n,env:{...process.env,...r},stdio:"inherit"});if(s.error)throw s.error;return s.status??1},u=(e,n,r,s,a={})=>{const i=L(n,e);for(const t of i.warnings)s.warn(`warning: ${t}`);return a.dry?(s.log(`[dry-run] ${i.bin} ${i.args.join(" ")}`),0):Ae(i,r,a.env)},g=(e,n,r,s,a={})=>u(e,n(),r,s,a),Oe=(e,n)=>n==="aube"||n==="deno"?e:{...e,args:[...e.args,"--prefer-offline"]},Se=(e,n,r)=>n!=="yarn"||r.startsWith("1.")||!e.args.includes("--immutable")||e.args.includes("--immutable-cache")?e:{...e,args:[...e.args,"--immutable-cache"]},W=(e,n,r)=>{let s=e.name==="aube"?te(n):Q(e.name,e.version,{...n,silent:n.silent||r.silent===!0});return r.preferOffline&&(s=Oe(s,e.name)),r.ciMode&&(s=Se(s,e.name,e.version)),s},He=(e,n,r,s,a={})=>{const i=W(e,n,a);return D(e,i,r,s,{dry:a.dry,env:a.env})},Ve=async(e,n,r,s,a={})=>{const i=L(W(e,n,a),e);for(const t of i.warnings)s.warn(`warning: ${t}`);return a.dry?(s.log(`[dry-run] ${i.bin} ${i.args.join(" ")}`),{code:0,output:""}):ve(i.bin,i.args,{cwd:r,env:a.env?{...process.env,...a.env}:process.env})},N=(e,n)=>{const r=n==="deno"?"--quiet":"--silent";return{...e,args:[...e.args,r]}},Ce=(e,n)=>n==="yarn"||n==="aube"?null:{...e,args:[...e.args,"--dry-run"]},D=(e,n,r,s,a)=>{if(a.dry!==!0)return u(e,n,r,s,a);const i=Ce(n,e.name);return i===null?u(e,n,r,s,a):u(e,i,r,s,{env:a.env})},De=(e,n)=>n==="aube"?{...e,args:[...e.args,"--ignore-scripts"]}:n==="deno"?e:{...e,args:[...e.args,"--ignore-scripts"]},_e=(e,n,r,s,a={})=>{let i=e.name==="aube"?oe(n):H(e.name,e.version,n);a.ignoreScripts&&(i=De(i,e.name)),a.silent&&(i=N(i,e.name));const t=D(e,i,r,s,{dry:a.dry,env:a.env});return t===0&&a.autoInstallPeers&&Me(e,n,r,s,a),t},Ie=e=>{if(e.startsWith("@")){const r=e.indexOf("/");if(r===-1)return e;const s=e.indexOf("@",r);return s===-1?e:e.slice(0,s)}const n=e.indexOf("@");return n===-1?e:e.slice(0,n)},Pe=(e,n)=>{let r=e;for(;;){const s=y(r,"node_modules",n,"package.json"),a=C(s);if(a)return a;const i=O(r);if(i===r||S(r).root===r)return;r=i}},Ee=e=>{const n=C(y(e,"package.json")),r=new Set;if(!n)return r;for(const s of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const a=n[s];if(a)for(const i of Object.keys(a))r.add(i)}return r},Me=(e,n,r,s,a)=>{if(e.name==="deno")return;const i=Ee(r),t=new Map;for(const d of n.packages){const b=Ie(d),o=Pe(r,b);if(!o?.peerDependencies)continue;const h=o.peerDependenciesMeta??{};for(const[m,B]of Object.entries(o.peerDependencies))h[m]?.optional||i.has(m)||t.has(m)||t.set(m,B)}if(t.size===0)return;const c=[...t.entries()].map(([d,b])=>`${d}@${b}`);s.log(`auto-installing peer dependencies: ${c.join(", ")}`);const f={exact:!1,filter:n.filter,global:!1,optional:!1,packages:c,peer:!1,saveDev:n.saveDev,workspace:!1,workspaceRoot:n.workspaceRoot};_e(e,f,r,s,{ignoreScripts:a.ignoreScripts})},Xe=(e,n,r,s,a={})=>{let i=e.name==="aube"?ue(n):V(e.name,e.version,n);return a.silent&&(i=N(i,e.name)),D(e,i,r,s,{dry:a.dry,env:a.env})},Ke=(e,n,r,s,a={})=>e.name==="aube"?u(e,ce(n),r,s,a):g(e,()=>re(e.name,e.version,n),r,s,a),Qe=(e,n,r,s,a={})=>e.name==="aube"?u(e,le(n),r,s,a):g(e,()=>se(e.name,e.version,n),r,s,a),Le=(e,n)=>{if(e.name==="aube")return ge(n);const r=[],s=[],a=e.name;switch(e.name){case"bun":{const i=j.coerce(e.version);i&&j.lt(i,"1.3.0")&&s.push(`bun ${e.version} does not support \`bun pm view\` (added in bun 1.3). Upgrade bun, or run \`npm view ${n.package}\` instead.`),r.push("pm","view","--",n.package,...n.fields),n.json&&r.push("--json");break}case"deno":{const i=n.package.startsWith("npm:")||n.package.startsWith("jsr:")||n.package.startsWith("https://")||n.package.startsWith("http://")||n.package.startsWith("file:")?n.package:`npm:${n.package}`;r.push("info","--",i),n.json&&r.push("--json"),n.fields.length>0&&s.push("deno info does not accept field selectors; ignoring.");break}case"npm":case"pnpm":{r.push("view","--",n.package,...n.fields),n.json&&r.push("--json");break}case"yarn":{if(e.version.startsWith("1.")){r.push("info","--",n.package);const[i,...t]=n.fields;i!==void 0&&(t.length>0&&s.push("yarn v1 only supports querying one field at a time; using the first."),r.push(i)),n.json&&r.push("--json")}else r.push("npm","info","--",n.package),n.fields.length>0&&s.push("yarn berry does not support field arguments to 'npm info'; ignoring."),n.json&&r.push("--json");break}default:{const i=e.name;throw new Error(`Unsupported package manager: ${i}`)}}return{args:r,bin:a,warnings:s}},Ze=(e,n,r,s,a={})=>u(e,Le(e,n),r,s,a),en=(e,n,r,s,a={})=>e.name==="aube"?u(e,he(n),r,s,a):g(e,()=>ae(e.name,e.version,n),r,s,a),nn=(e,n,r,s,a,i={})=>e.name==="aube"?u(e,pe(n,r),s,a,i):g(e,()=>K(e.name,e.version,n,r),s,a,i),We=(e,n,r)=>{if(e.args.includes("--offline")||e.args.includes("--cached-only"))return e;const s=(a,i)=>{const t=[...e.args];return t.splice(i,0,a),{...e,args:t}};switch(n){case"aube":case"pnpm":return s("--offline",1);case"bun":return{...e,warnings:[...e.warnings,"bun x does not support --offline. Pre-install the package via `vis install` so bun x resolves from the local cache."]};case"deno":return s("--cached-only",1);case"npm":return s("--offline",1);case"yarn":return r.startsWith("1.")?s("--offline",0):{...e,warnings:[...e.warnings,"yarn berry has no --offline flag for dlx. Configure `enableNetwork: false` in .yarnrc.yml or set `enableMirror: true` for offline-first behavior."]};default:{const a=n;return{...e,warnings:[...e.warnings,`applyDlxOffline: unsupported pm ${String(a)}`]}}}},rn=(e,n,r,s,a={})=>{let i=e.name==="aube"?fe(n):ee(e.name,e.version,n);return a.offline&&(i=We(i,e.name,e.version)),u(e,i,r,s,{dry:a.dry,env:a.env})},_=process.platform==="win32",Ne=_?[".exe",".cmd",".bat",".ps1",""]:[""],Be=(e,n)=>{if(!(e.includes("/")||e.includes("\\")))for(const r of z(n))for(const s of Ne){const a=y(r,`${e}${s}`);if(R(a))return _?a.replaceAll("/","\\"):a}},sn=(e,n,r)=>{const s=Be(e,r);if(s===void 0||_&&!s.toLowerCase().endsWith(".exe"))return null;const a=E(s,n,{cwd:r,env:Y({...process.env},r),stdio:"inherit"});if(a.error)throw a.error;return a.status??1},an=(e,n,r,s,a={})=>e.name==="aube"?u(e,de(n),r,s,a):g(e,()=>ne(e.name,e.version,n),r,s,a),tn=(e,n,r,s,a,i={})=>{if(e.name==="aube")return u(e,ke(n,r),s,a,i);const t=me(e,n,r);return t.kind==="skip"?(a.warn(`warning: ${t.warning}`),0):t.kind==="rewrite"?u(e,{args:t.args,bin:t.bin,warnings:t.warning?[t.warning]:[]},s,a,i):g(e,()=>ie(e.name,e.version,n,r),s,a,i)};export{Ge as a,an as b,_e as c,$e as d,Ke as e,Ze as f,ze as g,Ve as h,en as i,tn as j,Xe as k,nn as l,Qe as m,He as n,rn as o,Ye as p,sn as r,ve as s};
@@ -1,4 +1,4 @@
1
- import{createRequire as p}from"node:module";import{V as l}from"./vis-user-error-Dkc97rGY.js";let g;const m=e=>(g??=p(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[s,n]=c.versions.node.split(".").map(Number);if(s>22||s===22&&n>=3||s===20&&n>=16)return c.getBuiltinModule(e)}return m(e)},{createInterface:j}=h("node:readline"),y=e=>{const s=new Set;for(const n of Object.values(e.projects))for(const t of Object.keys(n.targets??{}))s.add(t);return[...s].sort()},b=e=>{const s=new Map;for(const n of e.values())for(const[t,o]of Object.entries(n))for(const r of o.aliases??[])s.has(r)||s.set(r,t);return s},$=(e,s)=>s.get(e)??e,w=(e,s)=>{if(e.length===0)return s.length;if(s.length===0)return e.length;const n=[];for(let t=0;t<=s.length;t++)n[t]=[t];for(let t=0;t<=e.length;t++)n[0][t]=t;for(let t=1;t<=s.length;t++)for(let o=1;o<=e.length;o++){const r=s[t-1]===e[o-1]?0:1;n[t][o]=Math.min(n[t-1][o]+1,n[t][o-1]+1,n[t-1][o-1]+r)}return n[s.length][e.length]},v=(e,s,n=3)=>f(e,s,1,n)[0],f=(e,s,n=3,t=3)=>{const o=[];for(const r of s){const i=w(e.toLowerCase(),r.toLowerCase());i<=t&&o.push({distance:i,name:r})}return o.sort((r,i)=>r.distance-i.distance||r.name.localeCompare(i.name)),o.slice(0,n).map(r=>r.name)},M=e=>e.length===0?" (no targets found)":e.map(s=>` - ${s}`).join(`
1
+ import{createRequire as p}from"node:module";import{V as l}from"./vis-user-error-DZSnp0Uj.js";let g;const m=e=>(g??=p(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[s,n]=c.versions.node.split(".").map(Number);if(s>22||s===22&&n>=3||s===20&&n>=16)return c.getBuiltinModule(e)}return m(e)},{createInterface:j}=h("node:readline"),y=e=>{const s=new Set;for(const n of Object.values(e.projects))for(const t of Object.keys(n.targets??{}))s.add(t);return[...s].sort()},b=e=>{const s=new Map;for(const n of e.values())for(const[t,o]of Object.entries(n))for(const r of o.aliases??[])s.has(r)||s.set(r,t);return s},$=(e,s)=>s.get(e)??e,w=(e,s)=>{if(e.length===0)return s.length;if(s.length===0)return e.length;const n=[];for(let t=0;t<=s.length;t++)n[t]=[t];for(let t=0;t<=e.length;t++)n[0][t]=t;for(let t=1;t<=s.length;t++)for(let o=1;o<=e.length;o++){const r=s[t-1]===e[o-1]?0:1;n[t][o]=Math.min(n[t-1][o]+1,n[t][o-1]+1,n[t-1][o-1]+r)}return n[s.length][e.length]},v=(e,s,n=3)=>f(e,s,1,n)[0],f=(e,s,n=3,t=3)=>{const o=[];for(const r of s){const i=w(e.toLowerCase(),r.toLowerCase());i<=t&&o.push({distance:i,name:r})}return o.sort((r,i)=>r.distance-i.distance||r.name.localeCompare(i.name)),o.slice(0,n).map(r=>r.name)},M=e=>e.length===0?" (no targets found)":e.map(s=>` - ${s}`).join(`
2
2
  `),S=async e=>{if(e.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const s=j({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
3
3
  `);for(const[r,i]of e.entries())process.stdout.write(` ${String(r+1).padStart(2," ")}. ${i}
4
4
  `);process.stdout.write(`
@@ -1 +1 @@
1
- import{s as i}from"./index-B4AjSxHU.js";import{g as u}from"./packument-C55kVxcQ.js";import{c as d}from"../packem_chunks/cli-main.js";const v=8,h=async(r,e,o)=>{if(r.length===0)return[];const t=Math.max(1,Math.min(e,r.length)),s=Array.from({length:r.length});let n=0;const c=async()=>{for(;n<r.length;){const a=n;n+=1;const l=r[a];s[a]=await o(l,a)}};return await Promise.all(Array.from({length:t},()=>c())),s},f=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,p=(r,e)=>i.valid(e)?Object.keys(r.versions).filter(t=>i.valid(t)!==null&&i.lt(t,e)).filter(t=>i.satisfies(t,"*",{includePrerelease:!1})).filter(t=>f(r,t)).sort((t,s)=>i.lt(t,s)?1:-1)[0]:void 0,m=async(r,e={})=>{if(d("provenance"))return[];const o=new Set(e.allowlist),t=e.concurrency??v;return(await h(r,t,async({name:n,version:c})=>{if(o.has(n))return;const a=await u(n,{workspaceRoot:e.workspaceRoot});if(a===void 0||f(a,c))return;const l=p(a,c);if(l!==void 0)return{packageName:n,priorVersionWithProvenance:l,version:c}})).filter(n=>n!==void 0)};export{v as D,p as f,h as m,m as r};
1
+ import{s as i}from"./index-B4AjSxHU.js";import{g as u}from"./packument-CHdDsn0O.js";import{c as d}from"../packem_chunks/cli-main.js";const v=8,h=async(r,e,o)=>{if(r.length===0)return[];const t=Math.max(1,Math.min(e,r.length)),s=Array.from({length:r.length});let n=0;const c=async()=>{for(;n<r.length;){const a=n;n+=1;const l=r[a];s[a]=await o(l,a)}};return await Promise.all(Array.from({length:t},()=>c())),s},f=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,p=(r,e)=>i.valid(e)?Object.keys(r.versions).filter(t=>i.valid(t)!==null&&i.lt(t,e)).filter(t=>i.satisfies(t,"*",{includePrerelease:!1})).filter(t=>f(r,t)).sort((t,s)=>i.lt(t,s)?1:-1)[0]:void 0,m=async(r,e={})=>{if(d("provenance"))return[];const o=new Set(e.allowlist),t=e.concurrency??v;return(await h(r,t,async({name:n,version:c})=>{if(o.has(n))return;const a=await u(n,{workspaceRoot:e.workspaceRoot});if(a===void 0||f(a,c))return;const l=p(a,c);if(l!==void 0)return{packageName:n,priorVersionWithProvenance:l,version:c}})).filter(n=>n!==void 0)};export{v as D,p as f,h as m,m as r};
@@ -1 +1 @@
1
- import{createRequire as _}from"node:module";import{e as l}from"./index-DHD8wb6Z.js";import{g as T}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{y as d}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as b}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as j}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let p;const g=e=>(p??=_(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return g(e)},{rmSync:f,writeFileSync:k}=v("node:fs"),C=1440*60*1e3,A=15e3,E="https://registry.npmjs.org/-/npm/v1/keys",m=()=>l(T(),"registry-keys"),c=()=>l(m(),"npmjs.json"),L=()=>{const e=c();if(d(e))try{const t=b(e),r=Date.now()-t.createdAt>t.ttlMs;return{entry:t,expired:r}}catch{f(e,{force:!0});return}},M=(e,t)=>{j(m());const r={createdAt:Date.now(),keys:e,ttlMs:t};k(c(),JSON.stringify(r),"utf8")},F=async(e={})=>{const t=e.ttlMs??C,r=e.keysUrl??process.env.VIS_NPM_KEYS_URL??E,s=L();if(s!==void 0&&!s.expired&&e.forceRefresh!==!0)return{fromCache:!0,keys:s.entry.keys};const n=new AbortController,h=setTimeout(()=>{n.abort()},A),i=()=>{n.abort()};e.signal?.addEventListener("abort",i,{once:!0});try{const a=await fetch(r,{headers:{Accept:"application/json"},signal:n.signal});if(!a.ok)return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0;const u=await a.json(),y=Array.isArray(u.keys)?u.keys:[];return M(y,t),{fromCache:!1,keys:y}}catch{return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0}finally{clearTimeout(h),e.signal?.removeEventListener("abort",i)}},P=()=>{const e=c();return d(e)?(f(e,{force:!0}),!0):!1};export{P as c,F as f};
1
+ import{createRequire as _}from"node:module";import{e as l}from"./index-DHD8wb6Z.js";import{g as T}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{y as d}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as b}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as j}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let p;const g=e=>(p??=_(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return g(e)},{rmSync:f,writeFileSync:k}=v("node:fs"),C=1440*60*1e3,A=15e3,E="https://registry.npmjs.org/-/npm/v1/keys",m=()=>l(T(),"registry-keys"),c=()=>l(m(),"npmjs.json"),L=()=>{const e=c();if(d(e))try{const t=b(e),r=Date.now()-t.createdAt>t.ttlMs;return{entry:t,expired:r}}catch{f(e,{force:!0});return}},M=(e,t)=>{j(m());const r={createdAt:Date.now(),keys:e,ttlMs:t};k(c(),JSON.stringify(r),"utf8")},F=async(e={})=>{const t=e.ttlMs??C,r=e.keysUrl??process.env.VIS_NPM_KEYS_URL??E,s=L();if(s!==void 0&&!s.expired&&e.forceRefresh!==!0)return{fromCache:!0,keys:s.entry.keys};const n=new AbortController,h=setTimeout(()=>{n.abort()},A),i=()=>{n.abort()};e.signal?.addEventListener("abort",i,{once:!0});try{const a=await fetch(r,{headers:{Accept:"application/json"},signal:n.signal});if(!a.ok)return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0;const u=await a.json(),y=Array.isArray(u.keys)?u.keys:[];return M(y,t),{fromCache:!1,keys:y}}catch{return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0}finally{clearTimeout(h),e.signal?.removeEventListener("abort",i)}},P=()=>{const e=c();return d(e)?(f(e,{force:!0}),!0):!1};export{P as c,F as f};
@@ -1,4 +1,4 @@
1
- import{i as R}from"./index-BjdW45xX.js";import{k as A}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{d as M,p as k}from"./prompt-DMzaQEVa.js";import{h as S,M as T,r as E,a as P,b as C,c as x,d as O,e as V,f as F}from"./s1ngularity-C8sva2SO.js";import{D as h,m as g,r as L}from"./provenance-CvfQEJPQ.js";import{g as y}from"./packument-C55kVxcQ.js";import{c as N,p as w}from"../packem_chunks/cli-main.js";import{r as _}from"./signatures-oZ_2IneN.js";import{s as I}from"./index-B4AjSxHU.js";import{p as U}from"./utils-DQFHJn72.js";const j=15,B=e=>{const a=(e.TERM??"").toLowerCase();return a!=="dumb"&&a!=="unknown"&&a!==""},W=async(e,a,t,r)=>new Promise(d=>{if(r?.aborted){d(!1);return}const o=B(t)&&a.isTTY!==!1;let s=e;const c=()=>{o?a.write(`\rContinuing in ${String(s)}s... press Ctrl-C to abort. `):s===e&&a.write(`Warnings present; proceeding in ${String(e)}s.
1
+ import{i as R}from"./index-BjdW45xX.js";import{k as A}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{d as M,p as k}from"./prompt-DMzaQEVa.js";import{h as S,M as T,r as E,a as P,b as C,c as x,d as O,e as V,f as F}from"./s1ngularity-R-zLjQjp.js";import{D as h,m as g,r as L}from"./provenance-w-NIPtim.js";import{g as y}from"./packument-CHdDsn0O.js";import{c as N,p as w}from"../packem_chunks/cli-main.js";import{r as _}from"./signatures-ijwqxAtF.js";import{s as I}from"./index-B4AjSxHU.js";import{p as U}from"./utils-DQFHJn72.js";const j=15,B=e=>{const a=(e.TERM??"").toLowerCase();return a!=="dumb"&&a!=="unknown"&&a!==""},W=async(e,a,t,r)=>new Promise(d=>{if(r?.aborted){d(!1);return}const o=B(t)&&a.isTTY!==!1;let s=e;const c=()=>{o?a.write(`\rContinuing in ${String(s)}s... press Ctrl-C to abort. `):s===e&&a.write(`Warnings present; proceeding in ${String(e)}s.
2
2
  `)};c();const u=setInterval(()=>{if(s-=1,s<=0){clearInterval(u),r?.removeEventListener("abort",i),o&&a.write(`\rContinuing now.
3
3
  `),d(!0);return}c()},1e3),i=()=>{clearInterval(u),o&&a.write(`\rAborted.
4
4
  `),d(!1)};r?.addEventListener("abort",i,{once:!0})}),Y=async(e,a={})=>{if(e.length===0)return{proceed:!0};const t=a.env??process.env,r=a.isTty??!!process.stdin.isTTY,d=a.isCi??R,o=a.strict??!1,s=a.readline??M,c=a.output??{isTTY:!!process.stdout.isTTY,write:p=>process.stdout.write(p)},u=A(t.VIS_DISABLE_AUTO_CONTINUE),i=Number.parseInt(t.VIS_AUTO_CONTINUE_SECONDS??"",10),l=a.countdownSeconds??(Number.isFinite(i)&&i>0?i:j);return e.some(p=>p.severity==="error")?o?{proceed:!1,reason:"errors-present"}:d?{proceed:!1,reason:"errors-present"}:r?await k("Proceed despite errors? [y/N] ",s)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:{proceed:!1,reason:"non-tty"}:o?{proceed:!1,reason:"ci-strict"}:r?u?await k("Proceed despite warnings? [y/N] ",s)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:await W(l,c,t,a.signal)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:{proceed:!0}},Ne=async(e,a={})=>{if(e.isEmpty())return!0;const t=e.all(),r=a.output??{isTTY:!!process.stdout.isTTY,write:o=>process.stdout.write(o)};for(const o of S(t))r.write(`${o}
@@ -1 +1 @@
1
- import{createRequire as X}from"node:module";import{X as j,b as T}from"./index.server-BAjDJSEu.js";import{e as A}from"./index-DHD8wb6Z.js";import{g as L}from"./formatBytes-BHAzNIrn-DFIppnY0.js";import{D as m,m as y}from"./provenance-CvfQEJPQ.js";import{g as E}from"./packument-C55kVxcQ.js";import{c as w}from"../packem_chunks/cli-main.js";import{y as U}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as O}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as C}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{s as p}from"./index-B4AjSxHU.js";let Y;const Q=r=>(Y??=X(import.meta.url))(r),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,t]=b.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return b.getBuiltinModule(r)}return Q(r)},{rmSync:D,writeFileSync:P}=$("node:fs"),{createHash:Z}=$("node:crypto"),{Resolver:ee}=$("node:dns/promises");class rr{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 tr=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(j(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${j("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${T("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(T(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${T("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${T("→")} ${s.suggestedAction}`)}return e},nr=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")}),re=1440*60*1e3,te=15e3,ne="https://api.github.com/repos",W=()=>A(L(),"archived-repo"),q=(r,e)=>A(W(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),se=(r,e)=>{const t=q(r,e);if(U(t))try{const n=O(t);if(Date.now()-n.createdAt>n.ttlMs){D(t,{force:!0});return}return n}catch{D(t,{force:!0});return}},B=(r,e,t,n)=>{C(W());const s={createdAt:Date.now(),ttlMs:n,...t};P(q(r,e),JSON.stringify(s),"utf8")},oe=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]}},ie=async(r,e,t,n)=>{const s=`${ne}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,l=new AbortController,o=setTimeout(()=>{l.abort()},te),i=()=>{l.abort()};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 c=await fetch(s,{headers:a,signal:l.signal});if(c.status===404)return{kind:"missing"};if(!c.ok)return{kind:"transient-error"};const d=await c.json(),u=d.archived===!0,f=typeof d.archived_at=="string"?d.archived_at:void 0;return{archived:u,archivedAt:f,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},ae=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),sr=async(r,e={})=>{if(w("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??re,s=e.githubToken??process.env.GITHUB_TOKEN,l=e.concurrency??m,o=new Map,i=async(c,d)=>{const u=`${c}/${d}`;let f=o.get(u);return f===void 0&&(f=(async()=>{const h=se(c,d);if(h!==void 0)return h.missing===!0?{archived:!1,kind:"missing"}:{archived:h.archived,archivedAt:h.archivedAt,kind:"ok"};const v=await ie(c,d,s,e.signal);return v.kind==="missing"?B(c,d,{archived:!1,missing:!0},n):v.kind==="ok"&&B(c,d,{archived:v.archived===!0,archivedAt:v.archivedAt},n),v})(),o.set(u,f)),f};return(await y(r,l,async({name:c,version:d})=>{if(t.has(c))return;const u=await E(c,{workspaceRoot:e.workspaceRoot});if(u===void 0)return;const f=u.versions[d]??u.versions[ae(Object.keys(u.versions),u["dist-tags"]?.latest)??""];if(f===void 0)return;const h=oe(f.repository?.url);if(h===void 0)return;const v=await i(h.owner,h.repo);if(v.kind!=="transient-error"){if(v.kind==="missing")return{kind:"missing-repo",owner:h.owner,packageName:c,repo:h.repo};if(v.archived===!0)return{...v.archivedAt===void 0?{}:{archivedAt:v.archivedAt},kind:"archived",owner:h.owner,packageName:c,repo:h.repo}}})).filter(c=>c!==void 0)},ce={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},de=1440*60*1e3,F=(r,e)=>(r-e)/de,_=r=>{if(r!==void 0)return r.email??r.name},ue=(r,e,t,n,s)=>{const l=r.time?.[t];if(l===void 0)return;const o=new Date(l).getTime();if(!Number.isFinite(o))return;const i=F(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}},le=(r,e,t,n,s)=>{const l=r.versions[t],o=_(l?._npmUser);if(o===void 0)return;const a=Object.keys(r.versions).filter(h=>p.valid(h)!==null).filter(h=>p.lt(h,t));if(a.length===0||a.some(h=>_(r.versions[h]?._npmUser)===o))return;const d=r.time?.[a[0]??""];if(d===void 0)return;const u=new Date(d).getTime();if(!Number.isFinite(u))return;const f=F(n,u);if(!(f<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${f.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},fe=(r,e,t,n,s)=>{const l=r.versions[t],o=_(l?._npmUser);if(o===void 0)return;const i=[];for(const[d,u]of Object.entries(r.versions)){if(d===t||_(u._npmUser)!==o)continue;const f=r.time?.[d];if(f===void 0)continue;const h=new Date(f).getTime();Number.isFinite(h)&&i.push(h)}if(i.length===0)return;const a=Math.max(...i),c=F(n,a);if(c>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(c>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},or=async(r,e={})=>{if(w("author"))return[];const t=new Set(e.allowlist),n={...ce,...e.thresholds},s=e.now??(()=>Date.now()),l=e.concurrency??m;return(await y(r,l,async({name:i,version:a})=>{if(t.has(i))return[];const c=await E(i,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(c===void 0)return[];const d=s(),u=[],f=ue(c,i,a,d,n);f!==void 0&&u.push(f);const h=le(c,i,a,d,n);h!==void 0&&u.push(h);const v=fe(c,i,a,d,n);return v!==void 0&&u.push(v),u})).flat()},he=1440*60*1e3,ve=15e3,ge=20,pe=1e4,me="https://api.npmjs.org/downloads/point/last-month",G=()=>A(L(),"downloads"),J=r=>A(G(),`${encodeURIComponent(r)}.json`),ye=r=>{const e=J(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t.downloads}catch{D(e,{force:!0});return}},we=(r,e,t)=>{C(G());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};P(J(r),JSON.stringify(n),"utf8")},ke=async(r,e)=>{const t=`${me}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},ve),l=()=>{n.abort()};e?.addEventListener("abort",l,{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",l)}},ir=async(r,e={})=>{if(w("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??ge,s=e.warnThreshold??pe,l=e.cacheTtlMs??he,o=e.concurrency??m;return(await y(r,o,async a=>{if(t.has(a))return;let d=ye(a);if(d===void 0){const u=await ke(a,e.signal);if(u.kind==="no-data"||u.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:a,severity:"warning"};d=u.downloads??0,we(a,d,l)}if(d<n)return{downloadsLastMonth:d,kind:"below-error",packageName:a,severity:"error"};if(d<s)return{downloadsLastMonth:d,kind:"below-warning",packageName:a,severity:"warning"}})).filter(a=>a!==void 0)},De=1440*60*1e3,Ae=4e3,Ee=["1.1.1.1","8.8.8.8"],K=()=>A(L(),"expired-domains"),z=r=>{const e=Z("sha256").update(r).digest("hex").slice(0,12);return A(K(),`${e}.json`)},be=r=>{const e=z(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t}catch{D(e,{force:!0});return}},Re=(r,e,t)=>{C(K());const n={createdAt:Date.now(),outcome:e,ttlMs:t};P(z(r),JSON.stringify(n),"utf8")},Te=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},_e=(r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},Me=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)}},Se=r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},$e=async(r,e,t)=>{try{const n=await Me(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Se(n)?{kind:"expired"}:{kind:"transient-error"}}},Pe=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),ar=async(r,e={})=>{if(w("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(f=>f.toLowerCase())),s=e.cacheTtlMs??De,l=e.perDomainTimeoutMs??Ae,o=e.dnsServers??Ee,i=e.concurrency??m,a=e.createResolver===void 0?new ee:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const c=new Map,d=async f=>{let h=c.get(f);return h===void 0&&(h=(async()=>{const v=be(f);if(v!==void 0)return{kind:v.outcome==="ok"?"ok":"expired"};const g=await $e(a,f,l);return g.kind!=="transient-error"&&Re(f,g.kind,s),g})(),c.set(f,h)),h};return(await y(r,i,async({name:f,version:h})=>{if(t.has(f))return[];const v=await E(f,{workspaceRoot:e.workspaceRoot});if(v===void 0)return[];const g=v.versions[h]??v.versions[Pe(Object.keys(v.versions),v["dist-tags"]?.latest)??""];if(g===void 0)return[];const M=_e(g.maintainers,g._npmUser),N=new Set,S=[];for(const R of M){const k=Te(R.email);if(k===void 0||n.has(k))continue;const I=`${k}:${R.email??""}`;if(N.has(I))continue;N.add(I);const x=await d(k);x.kind==="expired"?S.push({domain:k,kind:"expired",maintainer:R.email??"",packageName:f,severity:"error"}):x.kind==="transient-error"&&S.push({domain:k,kind:"unresolved",maintainer:R.email??"",packageName:f,severity:"warning"})}return S})).flat()},Le=["readme","license","repo"],Ue=["ERROR: No README data found!","# Security holding package"],Oe=r=>{const e=r.trim();return e===""?!0:Ue.some(t=>e.startsWith(t))},Ce=(r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},Fe=(r,e)=>{const t=Ce(r,e);if(t===void 0)return"missing-readme";if(Oe(t))return"placeholder-readme"},Ne=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"},Ie=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"},xe=r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},cr=async(r,e={})=>{if(w("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??Le),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i]??a.versions[xe(a)??""];if(c===void 0||c.private===!0)return;const d=[];if(n.has("readme")){const u=Fe(a,c);u!==void 0&&d.push(u)}if(n.has("license")){const u=Ne(c);u!==void 0&&d.push(u)}if(n.has("repo")){const u=Ie(c);u!==void 0&&d.push(u)}if(d.length!==0)return{issues:d,packageName:o,version:i}})).filter(o=>o!==void 0)},H=(r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},je=(r,e)=>p.valid(e)?Object.keys(r.versions).filter(n=>p.valid(n)!==null&&p.lt(n,e)).sort((n,s)=>p.lt(n,s)?1:-1)[0]:void 0,dr=async(r,e={})=>{if(w("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i];if(c===void 0)return;const d=je(a,i);if(d===void 0)return;const u=a.versions[d];if(u===void 0)return;const f=H(c.bin,o),h=H(u.bin,o),v=Object.entries(f).filter(([g])=>!(g in h)).filter(([g])=>!n.has(g)).map(([g,M])=>({command:M,name:g}));if(v.length!==0)return{fromVersion:d,newBins:v,packageName:o,toVersion:i}})).filter(o=>o!==void 0)},Be=["preinstall","install","postinstall"],V=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,He=(r,e)=>{if(p.valid(e)!==null)return Object.keys(r.versions).filter(t=>p.valid(t)!==null&&p.prerelease(t)===null&&p.lt(t,e)).sort((t,n)=>p.lt(t,n)?1:-1)[0]},Ve=(r,e)=>{const t=r??{},n=e??{},s=[];for(const l of Be){const o=t[l];if(o===void 0||o==="")continue;const i=n[l];i===void 0||i===""?s.push({command:o,hook:l,kind:"introduced"}):i!==o&&s.push({command:o,hook:l,kind:"changed"})}return s},ur=async(r,e={})=>{if(w("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??m;return(await y(r,n,async({name:l,version:o})=>{if(t.has(l))return;const i=await E(l,{workspaceRoot:e.workspaceRoot});if(i?.versions[o]===void 0)return;const a=He(i,o);if(a===void 0||!V(i,a)||V(i,o))return;const c=Ve(i.versions[o]?.scripts,i.versions[a]?.scripts);if(c.length!==0)return{hookChanges:c,packageName:l,priorVersion:a,trustSignal:"provenance-dropped",version:o}})).filter(l=>l!==void 0)};export{rr as M,ur as a,dr as b,cr as c,ir as d,ar as e,sr as f,nr as g,tr as h,or as r};
1
+ import{createRequire as X}from"node:module";import{X as j,b as T}from"./index.server-BAjDJSEu.js";import{e as A}from"./index-DHD8wb6Z.js";import{g as L}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{D as m,m as y}from"./provenance-w-NIPtim.js";import{g as E}from"./packument-CHdDsn0O.js";import{c as w}from"../packem_chunks/cli-main.js";import{y as U}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as O}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as C}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{s as p}from"./index-B4AjSxHU.js";let Y;const Q=r=>(Y??=X(import.meta.url))(r),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=r=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,t]=b.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return b.getBuiltinModule(r)}return Q(r)},{rmSync:D,writeFileSync:P}=$("node:fs"),{createHash:Z}=$("node:crypto"),{Resolver:ee}=$("node:dns/promises");class rr{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 tr=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(j(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${j("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${T("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(T(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${T("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${T("→")} ${s.suggestedAction}`)}return e},nr=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")}),re=1440*60*1e3,te=15e3,ne="https://api.github.com/repos",W=()=>A(L(),"archived-repo"),q=(r,e)=>A(W(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),se=(r,e)=>{const t=q(r,e);if(U(t))try{const n=O(t);if(Date.now()-n.createdAt>n.ttlMs){D(t,{force:!0});return}return n}catch{D(t,{force:!0});return}},B=(r,e,t,n)=>{C(W());const s={createdAt:Date.now(),ttlMs:n,...t};P(q(r,e),JSON.stringify(s),"utf8")},oe=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]}},ie=async(r,e,t,n)=>{const s=`${ne}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,l=new AbortController,o=setTimeout(()=>{l.abort()},te),i=()=>{l.abort()};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 c=await fetch(s,{headers:a,signal:l.signal});if(c.status===404)return{kind:"missing"};if(!c.ok)return{kind:"transient-error"};const d=await c.json(),u=d.archived===!0,f=typeof d.archived_at=="string"?d.archived_at:void 0;return{archived:u,archivedAt:f,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},ae=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),sr=async(r,e={})=>{if(w("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??re,s=e.githubToken??process.env.GITHUB_TOKEN,l=e.concurrency??m,o=new Map,i=async(c,d)=>{const u=`${c}/${d}`;let f=o.get(u);return f===void 0&&(f=(async()=>{const h=se(c,d);if(h!==void 0)return h.missing===!0?{archived:!1,kind:"missing"}:{archived:h.archived,archivedAt:h.archivedAt,kind:"ok"};const v=await ie(c,d,s,e.signal);return v.kind==="missing"?B(c,d,{archived:!1,missing:!0},n):v.kind==="ok"&&B(c,d,{archived:v.archived===!0,archivedAt:v.archivedAt},n),v})(),o.set(u,f)),f};return(await y(r,l,async({name:c,version:d})=>{if(t.has(c))return;const u=await E(c,{workspaceRoot:e.workspaceRoot});if(u===void 0)return;const f=u.versions[d]??u.versions[ae(Object.keys(u.versions),u["dist-tags"]?.latest)??""];if(f===void 0)return;const h=oe(f.repository?.url);if(h===void 0)return;const v=await i(h.owner,h.repo);if(v.kind!=="transient-error"){if(v.kind==="missing")return{kind:"missing-repo",owner:h.owner,packageName:c,repo:h.repo};if(v.archived===!0)return{...v.archivedAt===void 0?{}:{archivedAt:v.archivedAt},kind:"archived",owner:h.owner,packageName:c,repo:h.repo}}})).filter(c=>c!==void 0)},ce={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},de=1440*60*1e3,F=(r,e)=>(r-e)/de,_=r=>{if(r!==void 0)return r.email??r.name},ue=(r,e,t,n,s)=>{const l=r.time?.[t];if(l===void 0)return;const o=new Date(l).getTime();if(!Number.isFinite(o))return;const i=F(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}},le=(r,e,t,n,s)=>{const l=r.versions[t],o=_(l?._npmUser);if(o===void 0)return;const a=Object.keys(r.versions).filter(h=>p.valid(h)!==null).filter(h=>p.lt(h,t));if(a.length===0||a.some(h=>_(r.versions[h]?._npmUser)===o))return;const d=r.time?.[a[0]??""];if(d===void 0)return;const u=new Date(d).getTime();if(!Number.isFinite(u))return;const f=F(n,u);if(!(f<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${f.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},fe=(r,e,t,n,s)=>{const l=r.versions[t],o=_(l?._npmUser);if(o===void 0)return;const i=[];for(const[d,u]of Object.entries(r.versions)){if(d===t||_(u._npmUser)!==o)continue;const f=r.time?.[d];if(f===void 0)continue;const h=new Date(f).getTime();Number.isFinite(h)&&i.push(h)}if(i.length===0)return;const a=Math.max(...i),c=F(n,a);if(c>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(c>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${c.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},or=async(r,e={})=>{if(w("author"))return[];const t=new Set(e.allowlist),n={...ce,...e.thresholds},s=e.now??(()=>Date.now()),l=e.concurrency??m;return(await y(r,l,async({name:i,version:a})=>{if(t.has(i))return[];const c=await E(i,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(c===void 0)return[];const d=s(),u=[],f=ue(c,i,a,d,n);f!==void 0&&u.push(f);const h=le(c,i,a,d,n);h!==void 0&&u.push(h);const v=fe(c,i,a,d,n);return v!==void 0&&u.push(v),u})).flat()},he=1440*60*1e3,ve=15e3,ge=20,pe=1e4,me="https://api.npmjs.org/downloads/point/last-month",G=()=>A(L(),"downloads"),J=r=>A(G(),`${encodeURIComponent(r)}.json`),ye=r=>{const e=J(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t.downloads}catch{D(e,{force:!0});return}},we=(r,e,t)=>{C(G());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};P(J(r),JSON.stringify(n),"utf8")},ke=async(r,e)=>{const t=`${me}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},ve),l=()=>{n.abort()};e?.addEventListener("abort",l,{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",l)}},ir=async(r,e={})=>{if(w("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??ge,s=e.warnThreshold??pe,l=e.cacheTtlMs??he,o=e.concurrency??m;return(await y(r,o,async a=>{if(t.has(a))return;let d=ye(a);if(d===void 0){const u=await ke(a,e.signal);if(u.kind==="no-data"||u.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:a,severity:"warning"};d=u.downloads??0,we(a,d,l)}if(d<n)return{downloadsLastMonth:d,kind:"below-error",packageName:a,severity:"error"};if(d<s)return{downloadsLastMonth:d,kind:"below-warning",packageName:a,severity:"warning"}})).filter(a=>a!==void 0)},De=1440*60*1e3,Ae=4e3,Ee=["1.1.1.1","8.8.8.8"],K=()=>A(L(),"expired-domains"),z=r=>{const e=Z("sha256").update(r).digest("hex").slice(0,12);return A(K(),`${e}.json`)},be=r=>{const e=z(r);if(U(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){D(e,{force:!0});return}return t}catch{D(e,{force:!0});return}},Re=(r,e,t)=>{C(K());const n={createdAt:Date.now(),outcome:e,ttlMs:t};P(z(r),JSON.stringify(n),"utf8")},Te=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},_e=(r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},Me=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)}},Se=r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},$e=async(r,e,t)=>{try{const n=await Me(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Se(n)?{kind:"expired"}:{kind:"transient-error"}}},Pe=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),ar=async(r,e={})=>{if(w("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(f=>f.toLowerCase())),s=e.cacheTtlMs??De,l=e.perDomainTimeoutMs??Ae,o=e.dnsServers??Ee,i=e.concurrency??m,a=e.createResolver===void 0?new ee:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const c=new Map,d=async f=>{let h=c.get(f);return h===void 0&&(h=(async()=>{const v=be(f);if(v!==void 0)return{kind:v.outcome==="ok"?"ok":"expired"};const g=await $e(a,f,l);return g.kind!=="transient-error"&&Re(f,g.kind,s),g})(),c.set(f,h)),h};return(await y(r,i,async({name:f,version:h})=>{if(t.has(f))return[];const v=await E(f,{workspaceRoot:e.workspaceRoot});if(v===void 0)return[];const g=v.versions[h]??v.versions[Pe(Object.keys(v.versions),v["dist-tags"]?.latest)??""];if(g===void 0)return[];const M=_e(g.maintainers,g._npmUser),N=new Set,S=[];for(const R of M){const k=Te(R.email);if(k===void 0||n.has(k))continue;const I=`${k}:${R.email??""}`;if(N.has(I))continue;N.add(I);const x=await d(k);x.kind==="expired"?S.push({domain:k,kind:"expired",maintainer:R.email??"",packageName:f,severity:"error"}):x.kind==="transient-error"&&S.push({domain:k,kind:"unresolved",maintainer:R.email??"",packageName:f,severity:"warning"})}return S})).flat()},Le=["readme","license","repo"],Ue=["ERROR: No README data found!","# Security holding package"],Oe=r=>{const e=r.trim();return e===""?!0:Ue.some(t=>e.startsWith(t))},Ce=(r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},Fe=(r,e)=>{const t=Ce(r,e);if(t===void 0)return"missing-readme";if(Oe(t))return"placeholder-readme"},Ne=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"},Ie=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"},xe=r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},cr=async(r,e={})=>{if(w("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??Le),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i]??a.versions[xe(a)??""];if(c===void 0||c.private===!0)return;const d=[];if(n.has("readme")){const u=Fe(a,c);u!==void 0&&d.push(u)}if(n.has("license")){const u=Ne(c);u!==void 0&&d.push(u)}if(n.has("repo")){const u=Ie(c);u!==void 0&&d.push(u)}if(d.length!==0)return{issues:d,packageName:o,version:i}})).filter(o=>o!==void 0)},H=(r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},je=(r,e)=>p.valid(e)?Object.keys(r.versions).filter(n=>p.valid(n)!==null&&p.lt(n,e)).sort((n,s)=>p.lt(n,s)?1:-1)[0]:void 0,dr=async(r,e={})=>{if(w("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??m;return(await y(r,s,async({name:o,version:i})=>{if(t.has(o))return;const a=await E(o,{workspaceRoot:e.workspaceRoot});if(a===void 0)return;const c=a.versions[i];if(c===void 0)return;const d=je(a,i);if(d===void 0)return;const u=a.versions[d];if(u===void 0)return;const f=H(c.bin,o),h=H(u.bin,o),v=Object.entries(f).filter(([g])=>!(g in h)).filter(([g])=>!n.has(g)).map(([g,M])=>({command:M,name:g}));if(v.length!==0)return{fromVersion:d,newBins:v,packageName:o,toVersion:i}})).filter(o=>o!==void 0)},Be=["preinstall","install","postinstall"],V=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,He=(r,e)=>{if(p.valid(e)!==null)return Object.keys(r.versions).filter(t=>p.valid(t)!==null&&p.prerelease(t)===null&&p.lt(t,e)).sort((t,n)=>p.lt(t,n)?1:-1)[0]},Ve=(r,e)=>{const t=r??{},n=e??{},s=[];for(const l of Be){const o=t[l];if(o===void 0||o==="")continue;const i=n[l];i===void 0||i===""?s.push({command:o,hook:l,kind:"introduced"}):i!==o&&s.push({command:o,hook:l,kind:"changed"})}return s},ur=async(r,e={})=>{if(w("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??m;return(await y(r,n,async({name:l,version:o})=>{if(t.has(l))return;const i=await E(l,{workspaceRoot:e.workspaceRoot});if(i?.versions[o]===void 0)return;const a=He(i,o);if(a===void 0||!V(i,a)||V(i,o))return;const c=Ve(i.versions[o]?.scripts,i.versions[a]?.scripts);if(c.length!==0)return{hookChanges:c,packageName:l,priorVersion:a,trustSignal:"provenance-dropped",version:o}})).filter(l=>l!==void 0)};export{rr as M,ur as a,dr as b,cr as c,ir as d,ar as e,sr as f,nr as g,tr as h,or as r};