@visulima/vis 1.0.0-alpha.33 → 1.0.0-alpha.34

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 (77) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/config/index.d.ts +31 -6
  5. package/dist/packem_chunks/bin.js +274 -274
  6. package/dist/packem_chunks/bloom-sync.js +1 -1
  7. package/dist/packem_chunks/fix.js +1 -1
  8. package/dist/packem_chunks/handler11.js +1 -1
  9. package/dist/packem_chunks/handler13.js +1 -1
  10. package/dist/packem_chunks/handler14.js +1 -1
  11. package/dist/packem_chunks/handler16.js +1 -1
  12. package/dist/packem_chunks/handler20.js +1 -1
  13. package/dist/packem_chunks/handler21.js +1 -1
  14. package/dist/packem_chunks/handler22.js +2 -2
  15. package/dist/packem_chunks/handler23.js +1 -1
  16. package/dist/packem_chunks/handler27.js +1 -1
  17. package/dist/packem_chunks/handler29.js +1 -1
  18. package/dist/packem_chunks/handler3.js +1 -1
  19. package/dist/packem_chunks/handler30.js +1 -1
  20. package/dist/packem_chunks/handler33.js +1 -1
  21. package/dist/packem_chunks/handler34.js +4 -4
  22. package/dist/packem_chunks/handler35.js +1 -1
  23. package/dist/packem_chunks/handler36.js +3 -3
  24. package/dist/packem_chunks/handler37.js +1 -1
  25. package/dist/packem_chunks/handler38.js +4 -4
  26. package/dist/packem_chunks/handler39.js +2 -2
  27. package/dist/packem_chunks/handler4.js +1 -1
  28. package/dist/packem_chunks/handler40.js +1 -1
  29. package/dist/packem_chunks/handler41.js +7 -7
  30. package/dist/packem_chunks/handler42.js +25 -153
  31. package/dist/packem_chunks/handler43.js +153 -25
  32. package/dist/packem_chunks/handler44.js +5 -5
  33. package/dist/packem_chunks/handler45.js +1 -1
  34. package/dist/packem_chunks/handler47.js +1 -1
  35. package/dist/packem_chunks/handler48.js +1 -1
  36. package/dist/packem_chunks/handler49.js +1 -1
  37. package/dist/packem_chunks/handler5.js +1 -1
  38. package/dist/packem_chunks/handler50.js +10 -10
  39. package/dist/packem_chunks/handler51.js +29 -29
  40. package/dist/packem_chunks/handler7.js +1 -1
  41. package/dist/packem_chunks/heal.js +1 -1
  42. package/dist/packem_chunks/help-command.js +1 -1
  43. package/dist/packem_chunks/index.js +1 -1
  44. package/dist/packem_chunks/keys-refresh.js +1 -1
  45. package/dist/packem_chunks/list.js +1 -1
  46. package/dist/packem_chunks/run.js +1 -1
  47. package/dist/packem_chunks/sync.js +1 -1
  48. package/dist/packem_chunks/sync2.js +1 -1
  49. package/dist/packem_chunks/verify-lockfile.js +1 -1
  50. package/dist/packem_shared/{ai-analysis-KP8b5lc0.js → ai-analysis-3QD_RS6F.js} +1 -1
  51. package/dist/packem_shared/{ai-fix-BkPUHA0z.js → ai-fix-TsjDQz_0.js} +3 -3
  52. package/dist/packem_shared/{cyclonedx-BilSFCNY.js → cyclonedx-zf9R2jCs.js} +1 -1
  53. package/dist/packem_shared/{dependency-scan-BUbOcMwX.js → dependency-scan-B70azq4x.js} +1 -1
  54. package/dist/packem_shared/{failure-log-34Wl3npC.js → failure-log-Dxafk3t4.js} +2 -2
  55. package/dist/packem_shared/index-BpbjpCNL.js +1 -0
  56. package/dist/packem_shared/{index-ClJtJDdT.js → index-di3jpyZS.js} +1 -1
  57. package/dist/packem_shared/{lifecycle-Buigdp7P.js → lifecycle-DvVTL8nx.js} +2 -2
  58. package/dist/packem_shared/{lockfile-CrT86D6d.js → lockfile-CedmXr44.js} +1 -1
  59. package/dist/packem_shared/{min-release-age-BPVXwPUg.js → min-release-age-DKMW2N_v.js} +1 -1
  60. package/dist/packem_shared/missing-package-json-DKAwoiWK.js +1 -0
  61. package/dist/packem_shared/{native-config-sync-BRZZetn3.js → native-config-sync-DBkJ-hsF.js} +1 -1
  62. package/dist/packem_shared/{provenance-D8vU1u2L.js → provenance-Cu6VR1Hy.js} +1 -1
  63. package/dist/packem_shared/{registry-keys-E3cZn4FI.js → registry-keys-CuBAVdsk.js} +1 -1
  64. package/dist/packem_shared/{resolve-explicit-cPzwdiEE.js → resolve-explicit-Xue0oq8V.js} +1 -1
  65. package/dist/packem_shared/{s1ngularity-DBcjspCC.js → s1ngularity-adnHbyTd.js} +1 -1
  66. package/dist/packem_shared/{scan-progress-CTVVf9WW.js → scan-progress-lZdk5KJ-.js} +1 -1
  67. package/dist/packem_shared/{signatures-ChTfrQvT.js → signatures-FGbYV5QE.js} +1 -1
  68. package/dist/packem_shared/{spinner-C8xs6QZv.js → spinner-0acw5pd_.js} +1 -1
  69. package/dist/packem_shared/{tabs-xZkm6Y_J.js → tabs-zUSdR1HI.js} +1 -1
  70. package/dist/packem_shared/{use-measured-height-Lea6TCVD.js → use-measured-height-DyCBfLtu.js} +1 -1
  71. package/dist/packem_shared/{verify-cLcZwKqe.js → verify-BYzxSKWD.js} +1 -1
  72. package/dist/packem_shared/{vis-update-app-BCKzlqj8.js → vis-update-app-D0QyGneK.js} +1 -1
  73. package/dist/packem_shared/{watch-loop-BpA_pxU9.js → watch-loop-jmQQl2Qe.js} +2 -2
  74. package/index.js +52 -52
  75. package/package.json +9 -9
  76. package/schemas/vis-config.schema.json +34 -7
  77. package/dist/packem_shared/index-BnANMQ7k.js +0 -1
@@ -1 +1 @@
1
- var m=Object.defineProperty;var d=(s,o)=>m(s,"name",{value:o,configurable:!0});import{createRequire as p}from"node:module";import{M as a,l as k}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{cleanWorkspace as b}from"#native";import{p as c}from"./bin.js";import{f as $}from"../packem_shared/utils-DrNg0XTR.js";const g=p(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=d(s=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[o,n]=f.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return f.getBuiltinModule(s)}return g(s)},"__cjs_getBuiltinModule"),{readdirSync:v,lstatSync:y,unlinkSync:_}=h("node:fs");var R=Object.defineProperty,u=d((s,o)=>R(s,"name",{value:o,configurable:!0}),"f");const j=u(s=>{const o=[],n=[s];for(;n.length>0;){const t=n.pop();let i;try{i=v(t)}catch{continue}for(const r of i){const e=a(t,r);try{const l=y(e);if(l.isSymbolicLink()||!l.isDirectory())continue}catch{continue}r==="node_modules"?o.push(e):r!==".git"&&r!==".hg"&&n.push(e)}}return o},"findNodeModulesDirectories"),M=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],x=u((s,o,n)=>{let t=0,i=!1;for(const r of M){const e=a(s,r);if(k(e)){if(o){n.info(` ${e}`),t++;continue}try{_(e),c.success(`Removed ${e}`),t++}catch(l){c.error(`${e}: ${$(l)}`),i=!0}}}return{hadError:i,removed:t}},"removeLockfiles"),C=u(async({logger:s,options:o,workspaceRoot:n})=>{const t=n??process.cwd(),i=o.lockfile||!1;if(o.dryRun){const e=j(t);if(e.length>0){c.info("Would remove:");for(const l of e)s.info(` ${l}`)}else c.info("No node_modules directories found.");i&&x(t,!0,s);return}const r=b(t,i);for(const e of r.removed)c.success(`Removed ${e}`);for(const e of r.lockfilesRemoved)c.success(`Removed ${e}`);for(const e of r.errors)c.error(e);r.removed.length===0&&r.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${r.removed.length} node_modules director${r.removed.length===1?"y":"ies"}`),r.errors.length>0&&(process.exitCode=1)},"execute");export{C as default};
1
+ var k=Object.defineProperty;var m=(o,r)=>k(o,"name",{value:r,configurable:!0});import{createRequire as v}from"node:module";import{p as n,m as P}from"./bin.js";import{M as p,l as S}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{cleanWorkspace as M}from"#native";import{l as D}from"../packem_shared/missing-package-json-DKAwoiWK.js";import{f as y}from"../packem_shared/utils-DrNg0XTR.js";const h=v(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=m(o=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(o)}return h(o)},"__cjs_getBuiltinModule"),{readdirSync:$,lstatSync:b,unlinkSync:R,rmSync:j}=_("node:fs");var w=Object.defineProperty,d=m((o,r)=>w(o,"name",{value:r,configurable:!0}),"f");const x=/node_modules/,E=/\.git/,N=d(o=>{const r=[],t=[o];for(;t.length>0;){const s=t.pop();let c;try{c=$(s)}catch{continue}for(const i of c){const e=p(s,i);try{const f=b(e);if(f.isSymbolicLink()||!f.isDirectory())continue}catch{continue}i==="node_modules"?r.push(e):i!==".git"&&i!==".hg"&&t.push(e)}}return r},"findNodeModulesDirectories"),q=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],C=d((o,r,t)=>{let s=0,c=!1;for(const i of q){const e=p(o,i);if(S(e)){if(r){t.info(` ${e}`),s++;continue}try{R(e),n.success(`Removed ${e}`),s++}catch(f){n.error(`${e}: ${y(f)}`),c=!0}}}return{hadError:c,removed:s}},"removeLockfiles"),L=d(o=>{for(const r of P(o,{includeDirs:!1,includeSymlinks:!1,skip:[x,E]}))if(r.name==="package.json")return!0;return!1},"containsPackageJson"),g=d((o,r,t)=>{let s=0,c=!1;for(const{packageDir:i}of D(o)){const e=p(o,i);if(!L(e)){if(r){t.info(` ${e}`),s++;continue}try{j(e,{force:!0,recursive:!0}),n.success(`Removed empty package ${e}`),s++}catch(f){n.error(`${e}: ${y(f)}`),c=!0}}}return{hadError:c,removed:s}},"removeEmptyPackages"),F=d(async({logger:o,options:r,workspaceRoot:t})=>{const s=t??process.cwd(),c=r.lockfile||!1,i=r.emptyPackages||!1;if(r.dryRun){const l=N(s);if(l.length>0){n.info("Would remove:");for(const a of l)o.info(` ${a}`)}else n.info("No node_modules directories found.");c&&C(s,!0,o),i&&(n.info("Would remove empty packages:"),g(s,!0,o));return}const e=M(s,c);for(const l of e.removed)n.success(`Removed ${l}`);for(const l of e.lockfilesRemoved)n.success(`Removed ${l}`);for(const l of e.errors)n.error(l);e.removed.length===0&&e.lockfilesRemoved.length===0?n.info("No node_modules directories found."):n.info(`Cleaned ${e.removed.length} node_modules director${e.removed.length===1?"y":"ies"}`);let f=!1;if(i){const{hadError:l,removed:a}=g(s,!1,o);f=l,a>0&&n.info(`Cleaned ${a} empty package director${a===1?"y":"ies"}`)}(e.errors.length>0||f)&&(process.exitCode=1)},"execute");export{F as default};
@@ -1,4 +1,4 @@
1
- var U=Object.defineProperty;var I=(t,e)=>U(t,"name",{value:e,configurable:!0});import{createRequire as A}from"node:module";import{j as O,E as v,T as G,I as j,e as F}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{z as D}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{readLastRunSummary as K}from"@visulima/task-runner";import{r as H,a as M,b as V,c as z}from"../packem_shared/ai-fix-BkPUHA0z.js";import{F as q,p as u}from"./bin.js";const L=A(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=I(t=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,o]=b.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return b.getBuiltinModule(t)}return L(t)},"__cjs_getBuiltinModule"),{spawn:k}=T("node:child_process"),{readFile:J}=T("node:fs/promises");var Q=Object.defineProperty,g=I((t,e)=>Q(t,"name",{value:e,configurable:!0}),"i");const W=g(t=>{if(!t)return;const e=/^refs\/pull\/(\d+)\//.exec(t);return e?Number.parseInt(e[1],10):void 0},"parsePrNumberFromGithubRef"),Y=g(async t=>{if(!t)return{prNumber:void 0,sha:void 0};try{const e=await J(t,"utf8"),o=JSON.parse(e),r=o.pull_request?.number??o.issue?.number??o.number,i=o.pull_request?.head?.sha;return{prNumber:r,sha:i}}catch{return{prNumber:void 0,sha:void 0}}},"readPrNumberFromGithubEvent"),Z=g(async t=>{const e=W(t.GITHUB_REF),{prNumber:o,sha:r}=e===void 0?await Y(t.GITHUB_EVENT_PATH):{prNumber:e,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:e??o,provider:"github-actions",repo:t.GITHUB_REPOSITORY,sha:r??t.GITHUB_SHA,token:t.GITHUB_TOKEN}},"detectGithubActions"),X=g(t=>{const e=t.CI_MERGE_REQUEST_IID,o=e!==void 0&&e!==""?Number.parseInt(e,10):void 0,r=t.CI_API_V4_URL,i=t.GITLAB_TOKEN??t.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:t.CI_PROJECT_ID??t.CI_PROJECT_PATH,sha:t.CI_COMMIT_SHA,token:i}},"detectGitlabCi"),ee=g(t=>{const e=t.BUILDKITE_PULL_REQUEST,o=e!==void 0&&e!==""&&e!=="false"?Number.parseInt(e,10):void 0,r=t.BUILDKITE_BUILD_NUMBER,i=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=t.BUILDKITE_ORGANIZATION_SLUG,a=t.BUILDKITE_PIPELINE_SLUG,s=n!==void 0&&n!==""&&a!==void 0&&a!==""?`${n}/${a}`:void 0;return{apiBaseUrl:(t.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:t.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(i)?i:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:s,sha:t.BUILDKITE_COMMIT,token:t.BUILDKITE_API_TOKEN}},"detectBuildkite"),te=g(async(t=process.env)=>t.GITHUB_ACTIONS==="true"?await Z(t):t.GITLAB_CI==="true"?X(t):t.BUILDKITE==="true"?ee(t):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},"detectCiContext");var oe=Object.defineProperty,h=I((t,e)=>oe(t,"name",{value:e,configurable:!0}),"p");const re=h((t,e,o,r)=>new Promise(i=>{const n=["pr","comment",String(e),"--body-file","-"];r&&n.push("--repo",r);const a=k(t,n,{stdio:["pipe","ignore","pipe"]});let s="";a.stderr?.setEncoding("utf8"),a.stderr?.on("data",d=>{s+=d}),a.once("error",()=>{i({exitCode:127,stderr:s})}),a.once("close",d=>{i({exitCode:d??-1,stderr:s})}),a.stdin?.on("error",()=>{}),a.stdin?.end(o)}),"runGhComment"),ie=h(async(t,e,o,r,i)=>{const n=`https://api.github.com/repos/${e}/issues/${String(o)}/comments`;try{const a=await t(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!a.ok){const s=await a.text().catch(()=>"");return{error:`GitHub REST returned ${String(a.status)}: ${s.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(a){return{error:a instanceof Error?a.message:String(a),ok:!1}}},"postViaGithubRest"),ne=h(async(t,e,o,r,i,n)=>{const a=encodeURIComponent(o),s=`${e.replace(/\/+$/,"")}/projects/${a}/merge_requests/${String(r)}/notes`;try{const d=await t(s,{body:JSON.stringify({body:i}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const p=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${p.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},"postViaGitlabRest"),ae=h((t,e,o,r)=>new Promise(i=>{const n=k(t,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";n.stderr?.setEncoding("utf8"),n.stderr?.on("data",s=>{a+=s}),n.once("error",()=>{i({exitCode:127,stderr:a})}),n.once("close",s=>{i({exitCode:s??-1,stderr:a})}),n.stdin?.on("error",()=>{}),n.stdin?.end(e)}),"runBuildkiteAnnotate"),se=h(async(t,e,o,r,i,n,a,s)=>{const[d,p]=o.split("/",2);if(!d||!p)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const m=`${e}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(p)}/builds/${String(r)}/annotations`;try{const c=await t(m,{body:JSON.stringify({body:i,context:a,style:n}),headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},method:"POST"});if(!c.ok){const l=await c.text().catch(()=>"");return{error:`Buildkite REST returned ${String(c.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(c){return{error:c instanceof Error?c.message:String(c),ok:!1}}},"postViaBuildkiteRest"),de=h(async(t,e,o,r)=>{const i=e.buildId?`vis-ai-heal-${e.buildId}`:"vis-ai-heal",n="info",a=await ae(o,t,n,i);if(a.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!e.apiBaseUrl||!e.repo||e.buildNumber===void 0||!e.token){const d=[];return e.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),e.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),e.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(a.exitCode)} (${a.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const s=await se(r,e.apiBaseUrl,e.repo,e.buildNumber,t,n,i,e.token);return s.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(a.exitCode)}; REST fallback also failed: ${s.error??"unknown"}`,method:"rest",posted:!1}},"postBuildkiteAnnotation"),pe=h(async(t,e,o,r)=>{if(e.prNumber===void 0)return{method:"skipped",posted:!1};const i=await re(o,e.prNumber,t,e.repo);if(i.exitCode===0)return{method:"gh-cli",posted:!0};if(!e.repo||!e.token)return{error:`gh exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await ie(r,e.repo,e.prNumber,t,e.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(i.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},"postGithubComment"),ce=h(async(t,e,o)=>{if(e.prNumber===void 0)return{method:"skipped",posted:!1};if(!e.apiBaseUrl||!e.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!e.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await ne(o,e.apiBaseUrl,e.repo,e.prNumber,t,e.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},"postGitlabComment"),ue=h(async t=>{const{body:e,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:i=globalThis.fetch,ghBin:n="gh"}=t;return r.provider==="github-actions"?await pe(e,r,n,i):r.provider==="gitlab-ci"?await ce(e,r,i):r.provider==="buildkite"?await de(e,r,o,i):{method:"skipped",posted:!1}},"postPrComment");var le=Object.defineProperty,f=I((t,e)=>le(t,"name",{value:e,configurable:!0}),"l");const C=f(t=>{let e=0,o=0;for(const r of t)r.status==="applied"?e+=1:o+=1;return{applied:e,failed:o}},"summarizeApply"),_=f((t,e,o)=>{const r=H(t,e,o),i=D(t,r);return i===""||i.startsWith("..")?r:i},"formatDisplayPath"),fe=f((t,e,o,r)=>new Promise(i=>{const n=process.argv[1];if(!n){i({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const a=[n,"run",o,"--projects",e,"--no-cache","--summarize","--fail-fast"],s=k(process.execPath,a,{cwd:t,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",p="";const m=setTimeout(()=>{s.kill("SIGTERM"),setTimeout(()=>s.kill("SIGKILL"),2e3).unref()},r);s.stdout?.setEncoding("utf8"),s.stdout?.on("data",c=>{d+=c}),s.stderr?.setEncoding("utf8"),s.stderr?.on("data",c=>{p+=c}),s.once("error",c=>{clearTimeout(m),i({exitCode:-1,stderr:c.message,stdout:d})}),s.once("close",c=>{clearTimeout(m),i({exitCode:c??-1,stderr:p,stdout:d})})}),"validateFixByRerun"),me=6e4,y=f(t=>{let e=0;const o=t.match(/`{3,}/g);if(o)for(const r of o)e=Math.max(e,r.length);return"`".repeat(Math.max(3,e+1))},"pickFence"),$=f((t,e,o)=>{if(t.patches.length===0)return"_No patches proposed._";const r=[];for(const[i,n]of t.patches.entries()){const a=_(e,o,n.file),s=[`**[${String(i+1)}] \`${a}\`**`];n.reason&&s.push(`_${n.reason}_`);const d=y(`${n.oldString}
1
+ var U=Object.defineProperty;var I=(t,e)=>U(t,"name",{value:e,configurable:!0});import{createRequire as A}from"node:module";import{j as O,E as v,T as G,I as j,e as F}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{z as D}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{readLastRunSummary as K}from"@visulima/task-runner";import{r as H,a as M,b as V,c as z}from"../packem_shared/ai-fix-TsjDQz_0.js";import{H as q,p as u}from"./bin.js";const L=A(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=I(t=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,o]=b.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return b.getBuiltinModule(t)}return L(t)},"__cjs_getBuiltinModule"),{spawn:k}=T("node:child_process"),{readFile:J}=T("node:fs/promises");var Q=Object.defineProperty,g=I((t,e)=>Q(t,"name",{value:e,configurable:!0}),"i");const W=g(t=>{if(!t)return;const e=/^refs\/pull\/(\d+)\//.exec(t);return e?Number.parseInt(e[1],10):void 0},"parsePrNumberFromGithubRef"),Y=g(async t=>{if(!t)return{prNumber:void 0,sha:void 0};try{const e=await J(t,"utf8"),o=JSON.parse(e),r=o.pull_request?.number??o.issue?.number??o.number,i=o.pull_request?.head?.sha;return{prNumber:r,sha:i}}catch{return{prNumber:void 0,sha:void 0}}},"readPrNumberFromGithubEvent"),Z=g(async t=>{const e=W(t.GITHUB_REF),{prNumber:o,sha:r}=e===void 0?await Y(t.GITHUB_EVENT_PATH):{prNumber:e,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:e??o,provider:"github-actions",repo:t.GITHUB_REPOSITORY,sha:r??t.GITHUB_SHA,token:t.GITHUB_TOKEN}},"detectGithubActions"),X=g(t=>{const e=t.CI_MERGE_REQUEST_IID,o=e!==void 0&&e!==""?Number.parseInt(e,10):void 0,r=t.CI_API_V4_URL,i=t.GITLAB_TOKEN??t.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:t.CI_PROJECT_ID??t.CI_PROJECT_PATH,sha:t.CI_COMMIT_SHA,token:i}},"detectGitlabCi"),ee=g(t=>{const e=t.BUILDKITE_PULL_REQUEST,o=e!==void 0&&e!==""&&e!=="false"?Number.parseInt(e,10):void 0,r=t.BUILDKITE_BUILD_NUMBER,i=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=t.BUILDKITE_ORGANIZATION_SLUG,a=t.BUILDKITE_PIPELINE_SLUG,s=n!==void 0&&n!==""&&a!==void 0&&a!==""?`${n}/${a}`:void 0;return{apiBaseUrl:(t.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:t.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(i)?i:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:s,sha:t.BUILDKITE_COMMIT,token:t.BUILDKITE_API_TOKEN}},"detectBuildkite"),te=g(async(t=process.env)=>t.GITHUB_ACTIONS==="true"?await Z(t):t.GITLAB_CI==="true"?X(t):t.BUILDKITE==="true"?ee(t):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},"detectCiContext");var oe=Object.defineProperty,h=I((t,e)=>oe(t,"name",{value:e,configurable:!0}),"p");const re=h((t,e,o,r)=>new Promise(i=>{const n=["pr","comment",String(e),"--body-file","-"];r&&n.push("--repo",r);const a=k(t,n,{stdio:["pipe","ignore","pipe"]});let s="";a.stderr?.setEncoding("utf8"),a.stderr?.on("data",d=>{s+=d}),a.once("error",()=>{i({exitCode:127,stderr:s})}),a.once("close",d=>{i({exitCode:d??-1,stderr:s})}),a.stdin?.on("error",()=>{}),a.stdin?.end(o)}),"runGhComment"),ie=h(async(t,e,o,r,i)=>{const n=`https://api.github.com/repos/${e}/issues/${String(o)}/comments`;try{const a=await t(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!a.ok){const s=await a.text().catch(()=>"");return{error:`GitHub REST returned ${String(a.status)}: ${s.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(a){return{error:a instanceof Error?a.message:String(a),ok:!1}}},"postViaGithubRest"),ne=h(async(t,e,o,r,i,n)=>{const a=encodeURIComponent(o),s=`${e.replace(/\/+$/,"")}/projects/${a}/merge_requests/${String(r)}/notes`;try{const d=await t(s,{body:JSON.stringify({body:i}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const p=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${p.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},"postViaGitlabRest"),ae=h((t,e,o,r)=>new Promise(i=>{const n=k(t,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";n.stderr?.setEncoding("utf8"),n.stderr?.on("data",s=>{a+=s}),n.once("error",()=>{i({exitCode:127,stderr:a})}),n.once("close",s=>{i({exitCode:s??-1,stderr:a})}),n.stdin?.on("error",()=>{}),n.stdin?.end(e)}),"runBuildkiteAnnotate"),se=h(async(t,e,o,r,i,n,a,s)=>{const[d,p]=o.split("/",2);if(!d||!p)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const m=`${e}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(p)}/builds/${String(r)}/annotations`;try{const c=await t(m,{body:JSON.stringify({body:i,context:a,style:n}),headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},method:"POST"});if(!c.ok){const l=await c.text().catch(()=>"");return{error:`Buildkite REST returned ${String(c.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(c){return{error:c instanceof Error?c.message:String(c),ok:!1}}},"postViaBuildkiteRest"),de=h(async(t,e,o,r)=>{const i=e.buildId?`vis-ai-heal-${e.buildId}`:"vis-ai-heal",n="info",a=await ae(o,t,n,i);if(a.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!e.apiBaseUrl||!e.repo||e.buildNumber===void 0||!e.token){const d=[];return e.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),e.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),e.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(a.exitCode)} (${a.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const s=await se(r,e.apiBaseUrl,e.repo,e.buildNumber,t,n,i,e.token);return s.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(a.exitCode)}; REST fallback also failed: ${s.error??"unknown"}`,method:"rest",posted:!1}},"postBuildkiteAnnotation"),pe=h(async(t,e,o,r)=>{if(e.prNumber===void 0)return{method:"skipped",posted:!1};const i=await re(o,e.prNumber,t,e.repo);if(i.exitCode===0)return{method:"gh-cli",posted:!0};if(!e.repo||!e.token)return{error:`gh exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await ie(r,e.repo,e.prNumber,t,e.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(i.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},"postGithubComment"),ce=h(async(t,e,o)=>{if(e.prNumber===void 0)return{method:"skipped",posted:!1};if(!e.apiBaseUrl||!e.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!e.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await ne(o,e.apiBaseUrl,e.repo,e.prNumber,t,e.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},"postGitlabComment"),ue=h(async t=>{const{body:e,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:i=globalThis.fetch,ghBin:n="gh"}=t;return r.provider==="github-actions"?await pe(e,r,n,i):r.provider==="gitlab-ci"?await ce(e,r,i):r.provider==="buildkite"?await de(e,r,o,i):{method:"skipped",posted:!1}},"postPrComment");var le=Object.defineProperty,f=I((t,e)=>le(t,"name",{value:e,configurable:!0}),"l");const C=f(t=>{let e=0,o=0;for(const r of t)r.status==="applied"?e+=1:o+=1;return{applied:e,failed:o}},"summarizeApply"),_=f((t,e,o)=>{const r=H(t,e,o),i=D(t,r);return i===""||i.startsWith("..")?r:i},"formatDisplayPath"),fe=f((t,e,o,r)=>new Promise(i=>{const n=process.argv[1];if(!n){i({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const a=[n,"run",o,"--projects",e,"--no-cache","--summarize","--fail-fast"],s=k(process.execPath,a,{cwd:t,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",p="";const m=setTimeout(()=>{s.kill("SIGTERM"),setTimeout(()=>s.kill("SIGKILL"),2e3).unref()},r);s.stdout?.setEncoding("utf8"),s.stdout?.on("data",c=>{d+=c}),s.stderr?.setEncoding("utf8"),s.stderr?.on("data",c=>{p+=c}),s.once("error",c=>{clearTimeout(m),i({exitCode:-1,stderr:c.message,stdout:d})}),s.once("close",c=>{clearTimeout(m),i({exitCode:c??-1,stderr:p,stdout:d})})}),"validateFixByRerun"),me=6e4,y=f(t=>{let e=0;const o=t.match(/`{3,}/g);if(o)for(const r of o)e=Math.max(e,r.length);return"`".repeat(Math.max(3,e+1))},"pickFence"),$=f((t,e,o)=>{if(t.patches.length===0)return"_No patches proposed._";const r=[];for(const[i,n]of t.patches.entries()){const a=_(e,o,n.file),s=[`**[${String(i+1)}] \`${a}\`**`];n.reason&&s.push(`_${n.reason}_`);const d=y(`${n.oldString}
2
2
  ${n.newString}`);s.push(`${d}diff`);for(const p of n.oldString.split(`
3
3
  `))s.push(`- ${p}`);for(const p of n.newString.split(`
4
4
  `))s.push(`+ ${p}`);s.push(d),r.push(s.join(`
@@ -1,4 +1,4 @@
1
- var Ke=Object.defineProperty;var m=(e,t)=>Ke(e,"name",{value:t,configurable:!0});import{createRequire as Ze}from"node:module";import{B as et,M as U,r as V,j as tt,I as N,N as w,q as W,e as z}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{h as it,E as R,c as L,b as ne}from"../packem_shared/index-ClJtJDdT.js";const Qe=Ze(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xe=m(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,n]=M.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return M.getBuiltinModule(e)}return Qe(e)},"__cjs_getBuiltinModule"),{createRequire:nt}=Xe("node:module");var rt=Object.defineProperty,ot=m((e,t)=>rt(e,"name",{value:t,configurable:!0}),"f$2"),at=Object.defineProperty,st=ot((e,t)=>at(e,"name",{value:t,configurable:!0}),"s"),lt=Object.defineProperty,ct=st((e,t)=>lt(e,"name",{value:t,configurable:!0}),"a");const ut=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,re=ct(e=>{let[,t]=ut.exec(e)??[];const n=t?t.length:0;if(n===3){const r=t.charAt(0),o=t.charAt(1),a=t.charAt(2);t=r+r+o+o+a+a}else if(n!==6)return[0,0,0];const i=Number.parseInt(t,16);return[i>>16&255,i>>8&255,i&255]},"convertHexToRgb");var dt=Object.defineProperty,ht=m((e,t)=>dt(e,"name",{value:t,configurable:!0}),"o$1"),ft=Object.defineProperty,pt=ht((e,t)=>ft(e,"name",{value:t,configurable:!0}),"s"),gt=Object.defineProperty,fe=pt((e,t)=>gt(e,"name",{value:t,configurable:!0}),"e");const Me=fe((e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/51)+6*Math.round(t/51)+Math.round(n/51),"rgbToAnsi256"),oe=fe(e=>{let t,n,i;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)t=n=i=((e-232)*10+8)/255;else{e-=16;const a=e%36;t=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}const r=Math.max(t,n,i)*2;if(r===0)return 30;const o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(t));return r===2?o+60:o},"ansi256To16"),we=fe((e,t,n)=>oe(Me(e,t,n)),"rgbToAnsi16");var mt=Object.defineProperty,Re=m((e,t)=>mt(e,"name",{value:t,configurable:!0}),"m"),bt=Object.defineProperty,P=Re((e,t)=>bt(e,"name",{value:t,configurable:!0}),"u"),wt=Object.defineProperty,yt=P((e,t)=>wt(e,"name",{value:t,configurable:!0}),"e");function J({onlyFirst:e=!1}={}){const t="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(t,e?void 0:"g")}m(J,"$$3");Re(J,"j");P(J,"t$1");yt(J,"ansiRegex");var $t=Object.defineProperty,vt=P((e,t)=>$t(e,"name",{value:t,configurable:!0}),"n$1");const A=vt((e,t,n)=>t>e?t:Math.min(e,n),"clamp");var Nt=Object.defineProperty,y=P((e,t)=>Nt(e,"name",{value:t,configurable:!0}),"b");const p=39,g=49,ye=10,ae=et(),ke={close:"",open:""},l=ae>0?(e,t)=>({close:`\x1B[${String(t)}m`,open:`\x1B[${String(e)}m`}):()=>ke,$e=y(e=>(t,n,i)=>e(Me(Number(t),Number(n),Number(i))),"createRgbFunction"),ve=y(e=>t=>{const[n,i,r]=re(t);return e(n,i,r)},"createHexFunction");let se=y(e=>l(`38;5;${String(e)}`,p),"createAnsi256"),le=y(e=>l(`48;5;${String(e)}`,g),"createBgAnsi256"),D=y((e,t,n)=>l(`38;2;${String(e)};${String(t)};${String(n)}`,p),"createRgb"),Y=y((e,t,n)=>l(`48;2;${String(e)};${String(t)};${String(n)}`,g),"createBgRgb");ae===1?(se=y(e=>l(oe(Number(e)),p),"createAnsi256"),le=y(e=>l(oe(Number(e))+ye,g),"createBgAnsi256"),D=y((e,t,n)=>l(we(Number(e),Number(t),Number(n)),p),"createRgb"),Y=y((e,t,n)=>l(we(Number(e),Number(t),Number(n))+ye,g),"createBgRgb")):ae===2&&(D=$e(se),Y=$e(le));const Ne={bold:l(1,22),dim:l(2,22),hidden:l(8,28),inverse:l(7,27),italic:l(3,23),overline:l(53,55),reset:l(0,0),strike:l(9,29),strikethrough:l(9,29),underline:l(4,24),visible:ke},Oe={bgBlack:l(40,g),bgBlackBright:l(100,g),bgBlue:l(44,g),bgBlueBright:l(104,g),bgCyan:l(46,g),bgCyanBright:l(106,g),bgGray:l(100,g),bgGreen:l(42,g),bgGreenBright:l(102,g),bgGrey:l(100,g),bgMagenta:l(45,g),bgMagentaBright:l(105,g),bgRed:l(41,g),bgRedBright:l(101,g),bgWhite:l(47,g),bgWhiteBright:l(107,g),bgYellow:l(43,g),bgYellowBright:l(103,g),black:l(30,p),blackBright:l(90,p),blue:l(34,p),blueBright:l(94,p),cyan:l(36,p),cyanBright:l(96,p),gray:l(90,p),green:l(32,p),greenBright:l(92,p),grey:l(90,p),magenta:l(35,p),magentaBright:l(95,p),red:l(31,p),redBright:l(91,p),white:l(37,p),whiteBright:l(97,p),yellow:l(33,p),yellowBright:l(93,p)},Ae={bg:y(e=>le(A(e,0,255)),"bg"),bgHex:ve(Y),bgRgb:y((e,t,n)=>Y(A(e,0,255),A(t,0,255),A(n,0,255)),"bgRgb"),fg:y(e=>se(A(e,0,255)),"fg"),hex:ve(D),rgb:y((e,t,n)=>D(A(e,0,255),A(t,0,255),A(n,0,255)),"rgb")};var Ot=Object.defineProperty,At=P((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"s");const St=At((e,t,n)=>{if(t==="")return e;let i=e.indexOf(t);if(i<0)return e;const r=t.length;let o=0,a="";for(;~i;)a+=e.slice(o,i)+n,o=i+r,i=e.indexOf(t,o);return a+e.slice(o)},"stringReplaceAll");var jt=Object.defineProperty,T=P((e,t)=>jt(e,"name",{value:t,configurable:!0}),"a");const S={};let ce=null;const xt=T((e,t,n)=>{if(!e)return"";let i;if(e.raw===void 0?i=String(e):i=String.raw(e,...t),i.includes("\x1B"))for(let r=n;r;r=r.props)i=St(i,r.close,r.open);return i.includes(`
1
+ var Ke=Object.defineProperty;var m=(e,t)=>Ke(e,"name",{value:t,configurable:!0});import{createRequire as Ze}from"node:module";import{B as et,M as U,r as V,j as tt,I as N,N as w,q as W,e as z}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{h as it,E as R,c as L,b as ne}from"../packem_shared/index-di3jpyZS.js";const Qe=Ze(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xe=m(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,n]=M.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return M.getBuiltinModule(e)}return Qe(e)},"__cjs_getBuiltinModule"),{createRequire:nt}=Xe("node:module");var rt=Object.defineProperty,ot=m((e,t)=>rt(e,"name",{value:t,configurable:!0}),"f$2"),at=Object.defineProperty,st=ot((e,t)=>at(e,"name",{value:t,configurable:!0}),"s"),lt=Object.defineProperty,ct=st((e,t)=>lt(e,"name",{value:t,configurable:!0}),"a");const ut=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,re=ct(e=>{let[,t]=ut.exec(e)??[];const n=t?t.length:0;if(n===3){const r=t.charAt(0),o=t.charAt(1),a=t.charAt(2);t=r+r+o+o+a+a}else if(n!==6)return[0,0,0];const i=Number.parseInt(t,16);return[i>>16&255,i>>8&255,i&255]},"convertHexToRgb");var dt=Object.defineProperty,ht=m((e,t)=>dt(e,"name",{value:t,configurable:!0}),"o$1"),ft=Object.defineProperty,pt=ht((e,t)=>ft(e,"name",{value:t,configurable:!0}),"s"),gt=Object.defineProperty,fe=pt((e,t)=>gt(e,"name",{value:t,configurable:!0}),"e");const Me=fe((e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/51)+6*Math.round(t/51)+Math.round(n/51),"rgbToAnsi256"),oe=fe(e=>{let t,n,i;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)t=n=i=((e-232)*10+8)/255;else{e-=16;const a=e%36;t=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}const r=Math.max(t,n,i)*2;if(r===0)return 30;const o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(t));return r===2?o+60:o},"ansi256To16"),we=fe((e,t,n)=>oe(Me(e,t,n)),"rgbToAnsi16");var mt=Object.defineProperty,Re=m((e,t)=>mt(e,"name",{value:t,configurable:!0}),"m"),bt=Object.defineProperty,P=Re((e,t)=>bt(e,"name",{value:t,configurable:!0}),"u"),wt=Object.defineProperty,yt=P((e,t)=>wt(e,"name",{value:t,configurable:!0}),"e");function J({onlyFirst:e=!1}={}){const t="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(t,e?void 0:"g")}m(J,"$$3");Re(J,"j");P(J,"t$1");yt(J,"ansiRegex");var $t=Object.defineProperty,vt=P((e,t)=>$t(e,"name",{value:t,configurable:!0}),"n$1");const A=vt((e,t,n)=>t>e?t:Math.min(e,n),"clamp");var Nt=Object.defineProperty,y=P((e,t)=>Nt(e,"name",{value:t,configurable:!0}),"b");const p=39,g=49,ye=10,ae=et(),ke={close:"",open:""},l=ae>0?(e,t)=>({close:`\x1B[${String(t)}m`,open:`\x1B[${String(e)}m`}):()=>ke,$e=y(e=>(t,n,i)=>e(Me(Number(t),Number(n),Number(i))),"createRgbFunction"),ve=y(e=>t=>{const[n,i,r]=re(t);return e(n,i,r)},"createHexFunction");let se=y(e=>l(`38;5;${String(e)}`,p),"createAnsi256"),le=y(e=>l(`48;5;${String(e)}`,g),"createBgAnsi256"),D=y((e,t,n)=>l(`38;2;${String(e)};${String(t)};${String(n)}`,p),"createRgb"),Y=y((e,t,n)=>l(`48;2;${String(e)};${String(t)};${String(n)}`,g),"createBgRgb");ae===1?(se=y(e=>l(oe(Number(e)),p),"createAnsi256"),le=y(e=>l(oe(Number(e))+ye,g),"createBgAnsi256"),D=y((e,t,n)=>l(we(Number(e),Number(t),Number(n)),p),"createRgb"),Y=y((e,t,n)=>l(we(Number(e),Number(t),Number(n))+ye,g),"createBgRgb")):ae===2&&(D=$e(se),Y=$e(le));const Ne={bold:l(1,22),dim:l(2,22),hidden:l(8,28),inverse:l(7,27),italic:l(3,23),overline:l(53,55),reset:l(0,0),strike:l(9,29),strikethrough:l(9,29),underline:l(4,24),visible:ke},Oe={bgBlack:l(40,g),bgBlackBright:l(100,g),bgBlue:l(44,g),bgBlueBright:l(104,g),bgCyan:l(46,g),bgCyanBright:l(106,g),bgGray:l(100,g),bgGreen:l(42,g),bgGreenBright:l(102,g),bgGrey:l(100,g),bgMagenta:l(45,g),bgMagentaBright:l(105,g),bgRed:l(41,g),bgRedBright:l(101,g),bgWhite:l(47,g),bgWhiteBright:l(107,g),bgYellow:l(43,g),bgYellowBright:l(103,g),black:l(30,p),blackBright:l(90,p),blue:l(34,p),blueBright:l(94,p),cyan:l(36,p),cyanBright:l(96,p),gray:l(90,p),green:l(32,p),greenBright:l(92,p),grey:l(90,p),magenta:l(35,p),magentaBright:l(95,p),red:l(31,p),redBright:l(91,p),white:l(37,p),whiteBright:l(97,p),yellow:l(33,p),yellowBright:l(93,p)},Ae={bg:y(e=>le(A(e,0,255)),"bg"),bgHex:ve(Y),bgRgb:y((e,t,n)=>Y(A(e,0,255),A(t,0,255),A(n,0,255)),"bgRgb"),fg:y(e=>se(A(e,0,255)),"fg"),hex:ve(D),rgb:y((e,t,n)=>D(A(e,0,255),A(t,0,255),A(n,0,255)),"rgb")};var Ot=Object.defineProperty,At=P((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"s");const St=At((e,t,n)=>{if(t==="")return e;let i=e.indexOf(t);if(i<0)return e;const r=t.length;let o=0,a="";for(;~i;)a+=e.slice(o,i)+n,o=i+r,i=e.indexOf(t,o);return a+e.slice(o)},"stringReplaceAll");var jt=Object.defineProperty,T=P((e,t)=>jt(e,"name",{value:t,configurable:!0}),"a");const S={};let ce=null;const xt=T((e,t,n)=>{if(!e)return"";let i;if(e.raw===void 0?i=String(e):i=String.raw(e,...t),i.includes("\x1B"))for(let r=n;r;r=r.props)i=St(i,r.close,r.open);return i.includes(`
2
2
  `)&&(i=i.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+i+n.closeStack},"wrapText"),ue=T(({props:e},{close:t,open:n})=>{const i=(e?.openStack??"")+n,r=t+(e?.closeStack??""),o=T((a,...s)=>xt(a,s,o.props),"style");return Object.setPrototypeOf(o,ce),o.props={close:t,closeStack:r,open:n,openStack:i,props:e},o.open=i,o.close=r,o},"createStyle"),Et=T(function(){const e=T(t=>String(t),"self");e.strip=t=>t.replaceAll(J(),"");for(const t in Oe)S[t]={get(){const n=ue(this,Oe[t]);return Object.defineProperty(this,t,{value:n}),n}};for(const t in Ne)S[t]={get(){const n=ue(this,Ne[t]);return Object.defineProperty(this,t,{value:n}),n}};return ce=Object.defineProperties({},S),Object.setPrototypeOf(e,ce),e},"Colorize");for(const e in Ae)S[e]={get(){return(...t)=>ue(this,Ae[e](...t))}};S.ansi256=S.fg;S.bgAnsi256=S.bg;var It=Object.defineProperty,Bt=m((e,t)=>It(e,"name",{value:t,configurable:!0}),"g"),Wt=Object.defineProperty,K=Bt((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"i"),Pt=Object.defineProperty,Mt=K((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"n");const Ce=Mt(e=>(t,...n)=>{if(!Array.isArray(t)||!Array.isArray(t.raw))throw new TypeError("A tagged template literal must be provided");const i=[t.raw[0]];for(let r=1;r<t.raw.length;r+=1)i.push(String(n[r-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(t.raw[r]));return e(i.join(""))},"makeColorizeTemplate");var Rt=Object.defineProperty,kt=K((e,t)=>Rt(e,"name",{value:t,configurable:!0}),"e$1");const Ct=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
3
3
  `],["r","\r"],["t"," "],["v","\v"]]),Te=kt(e=>{const t=e.startsWith("u"),n=e[1]==="{";return t&&!n&&e.length===5||e.startsWith("x")&&e.length===3?String.fromCodePoint(Number.parseInt(e.slice(1),16)):t&&n?String.fromCodePoint(Number.parseInt(e.slice(2,-1),16)):Ct.get(e)??e},"unescape");var Tt=Object.defineProperty,Z=K((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"u");const _t=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,Se=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Lt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Ft=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Ut=/\s*,\s*/,Vt=Z((e,t)=>{const n=[],i=t.trim().split(Ut);let r;for(const o of i){const a=Number(o);if(!Number.isNaN(a))n.push(a);else if(r=Lt.exec(o))n.push(r[2].replaceAll(Ft,(s,c,u)=>c?Te(c):u));else throw new Error(`Invalid template style argument: ${o} (in style '${e}')`)}return n},"parseArguments"),qt=Z(e=>{Se.lastIndex=0;const t=[];let n;for(;(n=Se.exec(e))!==null;){const i=n[1];n[2]?t.push([i,...Vt(i,n[2])]):n[3]||n[4]?(n[3]&&t.push(["rgb",...re(n[3])]),n[4]&&t.push(["bgRgb",...re(n[4])])):t.push([i])}return t},"parseStyle"),je=Z((e,t)=>{const n={};for(const r of t)for(const o of r.styles)n[o[0]]=r.inverse?void 0:o.slice(1);let i=e;for(const[r,o]of Object.entries(n))if(Array.isArray(o)){if(!(r in i))throw new Error(`Unknown style: ${r}`);i=o.length>0?i[r](...o):i[r]}return i},"buildStyle"),_e=Z(e=>t=>{const n=[],i=[];let r=[];if(t.replaceAll(_t,(o,a,s,c,u,d)=>{if(a)r.push(Te(a));else if(c){const f=r.join("");r=[],i.push(n.length===0?f:je(e,n)(f)),n.push({inverse:s,styles:qt(c)})}else if(u){if(n.length===0)throw new Error("Found extraneous } in template literal");i.push(je(e,n)(r.join(""))),r=[],n.pop()}else r.push(d)}),i.push(r.join("")),n.length>0)throw new Error(`template literal is missing ${String(n.length)} closing bracket${n.length===1?"":"s"} (\`}\`)`);return i.join("")},"makeTemplate");var Gt=Object.defineProperty,Ht=K((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"e");const zt=new Et;Ht(e=>Ce(_e(e)),"makeTaggedTemplate");const Dt=_e(zt),Yt=Ce(Dt);var Jt=Object.defineProperty,h=m((e,t)=>Jt(e,"name",{value:t,configurable:!0}),"a");const Kt=nt(import.meta.url),B=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Q=h(e=>{if(typeof B<"u"&&B.versions&&B.versions.node){const[t,n]=B.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return B.getBuiltinModule(e)}return Kt(e)},"R"),x=B,{execFileSync:Zt}=Q("node:child_process"),C=Q("node:fs"),Qt=Q("node:tty"),Xt=Q("node:os"),en=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],tn=12288,nn=65510,rn=[12288,12288,65281,65376,65504,65510],on=8361,an=65518,sn=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],ln=32,cn=10630,un=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],dn=4352,hn=262141,Le=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],_=h((e,t)=>{let n=0,i=Math.floor(e.length/2)-1;for(;n<=i;){const r=Math.floor((n+i)/2),o=r*2;if(t<e[o])i=r-1;else if(t>e[o+1])n=r+1;else return!0}return!1},"$"),xe=19968,[fn,pn]=Fe(Le);function Fe(e){let t=e[0],n=e[1];for(let i=0;i<e.length;i+=2){const r=e[i],o=e[i+1];if(xe>=r&&xe<=o)return[r,o];o-r>n-t&&(t=r,n=o)}return[t,n]}m(Fe,"Wt");h(Fe,"N1");const gn=h(e=>e<161||e>1114109?!1:_(en,e),"I1"),mn=h(e=>e<tn||e>nn?!1:_(rn,e),"W1"),bn=h(e=>e<on||e>an?!1:_(sn,e),"$1"),wn=h(e=>e<ln||e>cn?!1:_(un,e),"O1"),yn=h(e=>e>=fn&&e<=pn?!0:e<dn||e>hn?!1:_(Le,e),"x1");function Ue(e){return gn(e)?"ambiguous":mn(e)?"fullwidth":bn(e)?"halfwidth":wn(e)?"narrow":yn(e)?"wide":"neutral"}m(Ue,"Mt");h(Ue,"E1");function Ve(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}m(Ve,"St");h(Ve,"v1");function pe(e){return Ve(e),Ue(e)}m(pe,"q");h(pe,"Y");const Ee=new Map,F=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,q=h(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","A"),$n=h((e,t)=>{const n=Math.floor(e/65536),i=e%65536;let r=Ee.get(n);if(r||(r=new Map,Ee.set(n,r)),r.has(i))return r.get(i);let o;if(q(e)==="latin")o=t.width.regular;else if(q(e)==="control")o=t.width.control;else if(q(e)==="wide")o=t.width.wide;else switch(pe(e)){case"ambiguous":{o=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{o=t.width.fullWidth;break}case"wide":{o=t.width.wide;break}default:o=t.width.regular}return r.set(i,o),o},"A1"),vn=h(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"M1"),de=h((e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?de(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},i=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:r}=e,o=r>1e4;let a=0,s=0,c=r,u=!1;const d=e.includes("\x1B")||e.includes("›");for(;a<r;){if(d&&(e[a]==="\x1B"||e[a]==="›")){if(e.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",j=v.length,X=e.indexOf("\x07",a+5);if(X!==-1){const ee=e.indexOf(v,X+1);if(ee!==-1){const Ye=ee+j,Je=e.slice(X+1,ee).replace(R,""),be=de(Je,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,i-s),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),te=be.width;if(be.truncated)u=!0,c=Math.min(c,a);else if(s+te>i&&(c=Math.min(c,a),u=!0,s+te>n.truncation.limit))break;if(s+=te,a=Ye,u&&s>=n.truncation.limit)break;continue}}}if(R.lastIndex=a,R.test(e)){const v=R.lastIndex-a,j=n.truncation.countAnsiEscapeCodes?v:n.width.ansi;if(s+j>i&&(c=Math.min(c,a),s+j>n.truncation.limit)){u=!0;break}s+=j,a=R.lastIndex;continue}}const O=e.codePointAt(a);if(O===8203||O===65279||O>=8288&&O<=8292){a+=1;continue}if(O===9){if(s+n.width.tab>i&&(c=Math.min(c,a),s+n.width.tab>n.truncation.limit)){u=!0;break}s+=n.width.tab,a+=1;continue}if(F.lastIndex=a,F.test(e)){const v=(F.lastIndex-a)*n.width.regular;if(s+v>i){const j=Math.floor((i-s)/n.width.regular);if(c=Math.min(c,a+j),s+v>n.truncation.limit){u=!0;break}}s+=v,a=F.lastIndex;continue}if((O<=31||O>=127&&O<=159)&&(L.lastIndex=a,L.test(e))){const v=(L.lastIndex-a)*n.width.control;if(s+v>i&&(c=Math.min(c,a+Math.floor((i-s)/n.width.control)),s+v>n.truncation.limit)){u=!0;break}s+=v,a=L.lastIndex;continue}if(ne.lastIndex=a,ne.test(e)){if(s+n.width.emoji>i&&(c=Math.min(c,a),s+n.width.emoji>n.truncation.limit)){u=!0;break}s+=n.width.emoji,a=ne.lastIndex;continue}const I=e.codePointAt(a)??0;if(vn(I)){a+=I>65535?2:1;continue}let $;if(o)$=$n(I,n);else switch(q(I)){case"control":{$=n.width.control;break}case"latin":{$=n.width.regular;break}case"wide":{$=n.width.wide;break}case"zero":{$=0;break}default:switch(pe(I)){case"ambiguous":{$=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{$=n.width.fullWidth;break}case"wide":{$=n.width.wide;break}default:$=n.width.regular}}if(s+$>i&&(c=Math.min(c,a),s+$>n.truncation.limit)){u=!0;break}s+=$,a+=I>65535?2:1}let f=s,me=!1;return u&&n.truncation.limit>=n.truncation.ellipsisWidth&&(f=n.truncation.limit,me=!0),{ellipsed:me,index:u?c:r,truncated:u,width:f}},"C"),Nn=h((e,t={})=>de(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"_1"),qe=80,Ge=24,he=h((e,t,{shell:n,env:i}={})=>Zt(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:i}).trim(),"B"),G=h((e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),"M"),He=h((e,t)=>{const{columns:n,rows:i}=G(e,t);if(!(Number.isNaN(n)||Number.isNaN(i))&&!(n===qe&&i===Ge))return{columns:n,rows:i}},"K"),On=h(()=>{if(x.platform!=="linux")return!0;try{const e=C.readFileSync("/proc/self/stat","utf8"),t=e.lastIndexOf(") ");if(t===-1)return!1;const n=e.slice(t+2).trim().split(/\s+/),i=Number.parseInt(n[2],10),r=Number.parseInt(n[5],10);return Number.isNaN(i)||Number.isNaN(r)||r<=0?!1:i===r}catch{return!1}},"R1");function ze(){const{env:e,stdout:t,stderr:n}=x;if(t?.columns&&t?.rows)return G(t.columns,t.rows);if(n?.columns&&n?.rows)return G(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return G(e.COLUMNS,e.LINES);const i={columns:qe,rows:Ge};return x.platform==="win32"?ie()??i:x.platform==="darwin"?Ie()??ie()??i:Ie()??ie()??An()??i}m(ze,"Tt");h(ze,"S1");const Ie=h(()=>{try{const e=x.platform==="darwin"?C.constants.O_EVTONLY|C.constants.O_NONBLOCK:C.constants.O_NONBLOCK,{columns:t,rows:n}=Qt.WriteStream(C.openSync("/dev/tty",e));return{columns:t,rows:n}}catch{}},"H"),ie=h(()=>{try{const e=he("tput",["cols"],{env:{TERM:"dumb",...x.env}}),t=he("tput",["lines"],{env:{TERM:"dumb",...x.env}});if(e&&t)return He(e,t)}catch{}},"T"),An=h(()=>{try{if(!On())return;const e=he("resize",["-u"]).match(/\d+/g);if(e.length===2)return He(e[0],e[1])}catch{}},"k1"),k=new Map,Sn=500,b=h(e=>{if(!e||e==="")return"";const t=k.get(e);if(t!==void 0)return t;const n=Yt(Object.assign([],{raw:[e]}));if(k.size>=Sn){const i=k.keys().next().value;i!==void 0&&k.delete(i)}return k.set(e,n),n},"u"),H=h(()=>{const e=it().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const t=Number.parseInt(e,10);if(!(Number.isNaN(t)||t<=0))return t},"_");let De=class{static{m(this,"G")}static{h(this,"U")}lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(Xt.EOL)}header(e){this.add(tt(e)),this.lines.push("")}};const jn=h(e=>e!==void 0&&e>0?e:ze().columns,"L1"),xn=h((e,t,n,i)=>{if(e.length===0||e.some(u=>u.length!==2))return;let r=0;for(const u of e){const d=u[0];if(d===void 0)continue;const f=Nn(d);f>r&&(r=f)}if(r===0)return;const o=n+i,a=r+o,s=20+o;if(a+s>t)return;const c=t-a;return[a,c]},"T1");class En extends De{static{m(this,"Ft")}static{h(this,"C1")}constructor(t){if(super(),t.header&&this.header(b(t.header)),t.content){if(t.raw)if(Array.isArray(t.content)&&t.content.every(n=>typeof n=="string"))t.content.forEach(n=>{Array.isArray(n)?n.forEach(i=>{this.add(b(i))}):this.add(b(n))});else if(typeof t.content=="string")this.add(b(t.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(t.content));this.add("")}}getContentLines(t){if(typeof t=="string"){const n=U({showHeader:!1,style:{border:V,paddingLeft:4,paddingRight:1},terminalWidth:H(),truncateOverflow:!1,wordWrap:!0});return n.addRow([b(t)]),n.toString()}if(Array.isArray(t)&&t.every(n=>typeof n=="string"||Array.isArray(n)&&n.every(i=>typeof i=="string"))){const n=jn(H()),i=h(s=>Array.isArray(s)?s.map(c=>b(c)):[b(s)],"t"),r=t.map(s=>i(s)),o=xn(r,n,4,1),a=U({columnWidths:o,showHeader:!1,style:{border:V,paddingLeft:4,paddingRight:1},terminalWidth:n,truncateOverflow:!1,wordWrap:!0});return r.forEach(s=>{o!==void 0&&s.length===2?a.addRow([{content:s[0],wordWrap:!1},s[1]]):a.addRow(s)}),a.toString()}if(typeof t=="object"){const n=t;if(!n.options||!n.data)throw new Error(`Must have an "options" or "data" property
4
4
  ${JSON.stringify(t)}`);const i=U({showHeader:!1,style:{border:V,paddingLeft:4,paddingRight:1},terminalWidth:H(),truncateOverflow:!1,wordWrap:!0});return n.data.forEach(r=>{Array.isArray(r)?i.addRow(r.map(o=>b(o))):i.addRow([b(r)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
@@ -1,4 +1,4 @@
1
- var We=Object.defineProperty;var k=(e,t)=>We(e,"name",{value:t,configurable:!0});import{createRequire as Ue}from"node:module";import{bc as _,bd as U,be as T,bf as A,bg as G,bh as te,bi as Pe,bj as ne,bk as Te,bl as se,bm as re,bn as ie,bo as ze,bp as Me,bq as Ie,br as Re,bs as Fe,bt as Ne,bu as Be,bv as qe,bw as De,bx as Ve,by as Ge,bz as Qe,bA as Je,bB as Ke,bC as He,bD as Ye,bE as oe,bF as S,bG as Xe,bH as Ze,r as et,an as tt,p as nt,b0 as st}from"./bin.js";import{z as ue,M as pe,B as N}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";const Se=Ue(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=k(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,n]=M.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return M.getBuiltinModule(e)}return Se(e)},"__cjs_getBuiltinModule"),{createRequire:rt}=_e("node:module");var it=Object.defineProperty,ot=k((e,t)=>it(e,"name",{value:t,configurable:!0}),"e$2");const at=ot((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"a");var lt=Object.defineProperty,y=k((e,t)=>lt(e,"name",{value:t,configurable:!0}),"g");const ct=rt(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=y(e=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,n]=I.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return I.getBuiltinModule(e)}return ct(e)},"V"),{stripVTControlCharacters:ut}=ft("node:util"),Q=new _(1e3),pt=/[.*+?^${}()|[\]\\]/g,ht=y(e=>{const t=e.join("");if(Q.has(t)){const r=Q.get(t);return r.lastIndex=0,r}const n=e.map(r=>r.replaceAll(pt,String.raw`\$&`)).join("|"),s=new RegExp(n,"g");return Q.set(t,s),s},"Le"),mt=y(e=>{const t=[];let n=0,s;for(U.lastIndex=0;(s=U.exec(e))!==null;)s.index>n&&t.push(e.slice(n,s.index)),t.push(s[0]),n=U.lastIndex;return n<e.length&&t.push(e.slice(n)),t.filter(Boolean)},"Ce"),dt=/[ČŠŽĐ]/i,he=new Uint8Array(128),me=new Uint8Array(128),de=new Uint8Array(128);for(let e=0;e<128;e++)he[e]=e>=65&&e<=90?1:0,me[e]=e>=97&&e<=122?1:0,de[e]=e>=48&&e<=57?1:0;const J=y(e=>he[e],"j"),ae=y(e=>me[e],"O"),K=y(e=>de[e],"w"),W=y((e,t,n,s,r)=>{if(e.length===0)return[];let i=!1;const l=Object.values(t);for(const f of l)if(f(e[0])){i=!0;break}if(!i&&!n)return[e];const a=[...e],h=[];let o=a[0],p="other";const m=Object.entries(t);for(const f of m){const[u,g]=f;if(g(a[0])){p=u;break}}let c=n&&s?a[0]===a[0].toLocaleUpperCase(s):!1;for(let f=1;f<a.length;f++){const u=a[f];let g="other";for(const $ of m){const[v,j]=$;if(j(u)){g=v;break}}const b=n&&s?u===u.toLocaleUpperCase(s):!1;let d=!1;r?d=r(p,g,c,b,u,f,a):(p!==g&&p!=="other"&&g!=="other"&&(d=!0),n&&g!=="other"&&!c&&b&&(d=!0)),d?(h.push(o),o=u):o+=u,p=g,n&&(c=b)}return o&&o.length>0&&h.push(o),h.length>0?h:[e]},"k"),gt=y((e,t,n,s)=>{if(n.size===0)return t;for(const r of n)if(e.startsWith(r,t))return s.push(r),t+r.length;return t},"Ue"),ge=y((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let n=0;const s=[],r=e.length;for(let i=1;i<r;i++){const l=gt(e,n,t,s);if(l!==n){n=l,i=n-1;continue}const a=e.codePointAt(i-1),h=e.codePointAt(i),o=a&&a<128&&J(a),p=h&&h<128&&J(h),m=a&&a<128&&ae(a),c=a&&a<128&&K(a),f=h&&h<128&&K(h);if(m&&p){s.push(e.slice(n,i)),n=i;continue}if(c&&!f||!c&&f){s.push(e.slice(n,i)),n=i;continue}if(f&&!c){let u=!1,g=!1;if(i+1<r){const b=e.codePointAt(i+1);u=b&&b<128&&J(b),g=b&&b<128&&K(b)}if(!g&&u){s.push(e.slice(n,i),e.slice(i,i+1)),n=i+1;continue}}if(i+1<r){const u=e.codePointAt(i+1),g=u&&u<128&&ae(u);if(o&&p&&g){const b=e.slice(n,i+1);t.has(b)||(s.push(e.slice(n,i)),n=i)}}}return n<r&&s.push(e.slice(n)),s.filter(i=>i!=="")},"D"),be=y((e,t,n)=>{if(e.length===0)return[];const s=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!s&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t),u=f,g=f?0:-1;for(let b=1;b<p;b++){const d=o[b],$=d===d.toLocaleUpperCase(t);if($===f)c+=d;else if($)c&&c.length>0&&(m.push(c),c=d),u=!0,g=b;else{if(u&&b-g>1){const v=o[b-1],j=c.slice(0,-1);j&&j.length>0&&m.push(j),c=v+d}else c+=d;u=!1,g=-1}f=$}return c&&c.length>0&&m.push(c),m}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!T.test(e)&&!A.test(e))return[e];const o=[...e],p=o.length,m=[];let c=o[0];const f=o[0];let u;T.test(f)?u=1:A.test(f)?u=2:u=0;let g=f===f.toLocaleUpperCase(t);for(let d=1;d<p;d++){const $=o[d];let v;T.test($)?v=1:A.test($)?v=2:v=0;const j=$===$.toLocaleUpperCase(t);u!==v&&(u===1||u===2)&&(v===1||v===2)||v===u&&!g&&j?(m.push(c),c=$):c+=$,u=v,g=j}c&&c.length>0&&m.push(c);const b=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&A.test(m[d])&&T.test(m[d+1][0])?(b.push(m[d]+m[d+1]),d+=1):b.push(m[d]);return b}if(t.startsWith("el")){if(!G.test(e)&&!A.test(e))return[e];const o=[];te.lastIndex=0;let p;for(;(p=te.exec(e))!==null;)o.push(p[0]);o.length===0&&o.push(e);const m=[];if(o.length===1){const c=o[0];if(!c||!G.test(c[0])||c.length===1)return[c??e]}for(const c of o){if(!c)continue;if(!G.test(c[0])||c.length===1){m.push(c);continue}const f=c.length;let u=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let b=1;b<f;b++){const d=c[b],$=d===d.toLocaleUpperCase(t);!g&&$?(m.push(u),u=d):u+=d,g=$}u&&m.push(u)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const o=t.startsWith("ja"),p=o?{hiragana:y(c=>Te.test(c),"hiragana"),kanji:y(c=>ne.test(c),"kanji"),katakana:y(c=>Pe.test(c),"katakana"),latin:y(c=>A.test(c),"latin")}:{hangul:y(c=>se.test(c),"hangul"),latin:y(c=>A.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(o){const c=W(e,p,!1,t,(u,g)=>u==="hiragana"&&g==="katakana"||u==="katakana"&&g==="hiragana"||u==="hiragana"&&g==="latin"||u==="katakana"&&g==="latin"||u==="kanji"&&g==="latin"||u==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const u of c){const g=u;g.length===1&&m.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[e]}return W(e,p,!1,t,(c,f)=>c==="hangul"&&f==="latin"||c==="latin"&&f==="hangul")}if(t.startsWith("sl")){const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t);for(let u=1;u<p;u++){const g=o[u],b=g===g.toLocaleUpperCase(t),d=dt.test(g),$=u<p-1&&o[u+1]===o[u+1].toLocaleUpperCase(t);!f&&b||d&&$?(m.push(c),c=g,d&&$&&(m.push(c),c="")):c+=g,f=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return W(e,{han:y(o=>ne.test(o),"han"),latin:y(o=>A.test(o),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const o=y(p=>re.test(p)||ie.test(p),"s");return W(e,{latin:y(p=>A.test(p),"latin"),rtl:y(p=>o(p),"rtl")},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const o=y(p=>ze.test(p)||Me.test(p)||Ie.test(p)||Re.test(p)||Fe.test(p)||Ne.test(p)||Be.test(p)||qe.test(p)||De.test(p)||Ve.test(p)||Ge.test(p)||Qe.test(p)||Je.test(p)||Ke.test(p)||He.test(p)||Ye.test(p),"s");return W(e,{indic:y(p=>o(p),"indic"),latin:y(p=>A.test(p),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return W(e,{cyrillic:y(o=>T.test(o),"cyrillic"),latin:y(o=>A.test(o),"latin")},!0,t);if(["ar","fa","he"].includes(t))return W(e,{latin:y(o=>A.test(o),"latin"),rtl:y(o=>re.test(o)||ie.test(o),"rtl")},!1,t);if(t.startsWith("ko"))return W(e,{hangul:y(o=>se.test(o),"hangul"),latin:y(o=>A.test(o),"latin")},!1,t);if(t.startsWith("uz")){if(!T.test(e)&&!A.test(e))return[e];const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t);for(let u=1;u<p;u++){const g=o[u],b=g===g.toLocaleUpperCase(t);if(oe.test(g)||oe.test(o[u-1])){c+=g;continue}!f&&b?(m.push(c),c=g):c+=g,f=b}return c&&c.length>0&&m.push(c),m}const r=[...e],i=r.length,l=[];let a=r[0],h=r[0]===r[0].toLocaleUpperCase(t);for(const o of n)if(e.startsWith(o)){l.push(o),a=r[o.length],h=a===a.toLocaleUpperCase(t);break}for(let o=1;o<i;o++){const p=r[o],m=p===p.toLocaleUpperCase(t);let c=0;for(const f of n)if(e.startsWith(f,o)){l.push(a,f),c=f.length,a="";const u=f.at(-1);u&&(h=u===u.toLocaleUpperCase(t));break}if(c>0){o+=c-1;continue}!h&&m?(l.push(a),a=p):a+=p,h=m}return a&&l.push(a),l},"q"),bt=y((e,t,n)=>{const s=[],r=S.test(e)?e.split(S).filter(Boolean):[e];for(const i of r){const l=i;if(S.test(l))s.push(l);else{U.lastIndex=0;const a=U.test(l)?mt(l).filter(Boolean):[l];for(const h of a)if(U.lastIndex=0,U.test(h))s.push(h);else if(t){const o=t.toLowerCase().split("-")[0];s.push(...be(h,o,n))}else s.push(...ge(h,n))}}return s},"Ie"),q=y((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:n=!1,handleEmoji:s=!1,knownAcronyms:r=[],locale:i,normalize:l=!1,separators:a,stripAnsi:h=!1,stripEmoji:o=!1}=t,p=new Set([...r].toSorted((d,$)=>$.length-d.length));let m=e;h&&(m=ut(m)),o&&(m=Xe(m));let c;Array.isArray(a)?c=ht(a):a instanceof RegExp?c=a:c=Ze;const f=[];let u=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;u.length>0;){const d=g.exec(u);if(!d){u===".."?f.push(".."):u==="."?f.push("."):u.length>0&&f.push(u);break}const $=d.index,v=d[0],j=v.length,F=u.slice(0,$),Oe=u.slice($+j);if(v.startsWith("../"))f.push(".."),u=u.slice($+3);else if(v.startsWith("./"))f.push("."),u=u.slice($+2);else if($===0&&v==="..")f.push(".."),u=u.slice(2);else if($===0&&v===".")f.push("."),u=u.slice(1);else{F.length>0&&f.push(F);let L=0;for(;(L=v.indexOf("../",L))!==-1;)f.push(".."),L+=3;for(L=0;(L=v.indexOf("./",L))!==-1;)(L===0||v[L-1]!==".")&&f.push("."),L+=2;let O=Oe;for(;O.startsWith("../");)f.push(".."),O=O.slice(3);for(;O.startsWith("./");)f.push("."),O=O.slice(2);if(O===".."){f.push("..");break}else if(O==="."){f.push(".");break}else u=O}g.lastIndex=0}if(f.length===0){const d=m.split(c).filter(Boolean);f.push(...d)}let b=[];for(const d of f)n||s?b.push(...bt(d,i,p)):i?b.push(...be(d,i,p)):b.push(...ge(d,p));return l&&(b=b.map(d=>p.has(d)?d:i&&d===d.toLocaleUpperCase(i)?d[0]+d.slice(1).toLocaleLowerCase(i):d.toUpperCase()===d&&!p.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),b},"be");var yt=Object.defineProperty,$t=k((e,t)=>yt(e,"name",{value:t,configurable:!0}),"l$4");const X=$t((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"a");var vt=Object.defineProperty,wt=k((e,t)=>vt(e,"name",{value:t,configurable:!0}),"r$2");const D=wt((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"r");var jt=Object.defineProperty,kt=k((e,t)=>jt(e,"name",{value:t,configurable:!0}),"p$4");const V=kt((e,t)=>{const{length:n}=e;if(n===0)return"";if(n===1)return e[0];const s=[];let r="",i="";for(let l=0;l<n;l++){const a=e[l];if(S.test(a)){r?(s.push(r+i+a),r="",i=""):(s.length>0&&s.push(t),r=a);continue}r?(i&&(i+=t),i+=a):(s.length>0&&s.push(t),s.push(a))}return s.join("")},"p");var At=Object.defineProperty,Ct=k((e,t)=>At(e,"name",{value:t,configurable:!0}),"e$1");const xt=/(?<![a-zß])SS(?![a-z])/g,Z=Ct(e=>e.replaceAll(xt,"ß"),"l");var Et=Object.defineProperty,Lt=k((e,t)=>Et(e,"name",{value:t,configurable:!0}),"p$2");const Ot=new _(1e3),Wt=Lt((e,t)=>{if(typeof e!="string"||!e)return"";const n=t?.cache??!1,s=t?.cacheStore??Ot;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);let i=!0;const l=V(q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(a=>{if(t?.handleAnsi&&S.test(a))return a;const h=t?.locale?.startsWith("de")?Z(a):a,o=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return i?(i=!1,at(o,t)):X(o,t)}),"");return n&&r&&s.set(r,l),l},"R");var Ut=Object.defineProperty,St=k((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"l$2");const _t=new _(1e3),ee=St((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,s=t?.cacheStore??_t;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(a=>{if(t?.handleAnsi&&S.test(a))return a;if(t?.toUpperCase)return t.locale?a.toLocaleUpperCase(t.locale):a.toUpperCase();const h=t?.locale?.startsWith("de")?Z(a):a;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=V(i,t?.joiner??"-");return n&&r&&s.set(r,l),l},"L");var Pt=Object.defineProperty,Tt=k((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"r$1");const zt=new _(1e3),Mt=Tt((e,t)=>ee(e,{cacheStore:zt,...t,joiner:"_",toUpperCase:!0}),"m");var It=Object.defineProperty,Rt=k((e,t)=>It(e,"name",{value:t,configurable:!0}),"l$1");const Ft=new _(1e3),Nt=Rt((e,t)=>{if(typeof e!="string"||!e)return"";const n=t?.cache??!1,s=t?.cacheStore??Ft;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=V(q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&S.test(l))return l;const a=t?.locale?.startsWith("de")?Z(l):l;return X(t?.locale?a.toLocaleLowerCase(t.locale):a.toLowerCase(),{locale:t?.locale})}),"");return n&&r&&s.set(r,i),i},"L");var Bt=Object.defineProperty,qt=k((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"r");const Dt=new _(1e3),Vt=qt((e,t)=>ee(e,{cacheStore:Dt,...t,joiner:"_"}),"n");var Gt=Object.defineProperty,Qt=k((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"a$1");const Jt=new _(1e3),Kt=Qt((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,s=t?.cacheStore??Jt;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=V(q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>X(l,{locale:t?.locale})),"-");return n&&r&&s.set(r,i),i},"y");var Ht=Object.defineProperty,C=k((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"e");const x=C(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),H={camel_case:C(e=>Wt(x(e)),"camel_case"),kebab_case:C(e=>ee(x(e)),"kebab_case"),lower_case:C(e=>x(e).toLowerCase(),"lower_case"),pascal_case:C(e=>Nt(x(e)),"pascal_case"),path_join:C((e,...t)=>{const n=[x(e),...t.map(s=>x(s))];return pe(...n)},"path_join"),path_relative:C((e,t)=>ue(x(t),x(e)),"path_relative"),snake_case:C(e=>Vt(x(e)),"snake_case"),upper_case:C(e=>x(e).toUpperCase(),"upper_case"),upper_kebab_case:C(e=>Kt(x(e)),"upper_kebab_case"),upper_snake_case:C(e=>Mt(x(e)),"upper_snake_case")};C(e=>Object.hasOwn(H,e),"isKnownFilter");const ye=C((e,t,n=[])=>{const s=H[e];if(!s)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return s(t,...n)},"applyFilter");var Yt=Object.defineProperty,$e=k((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"d$1");const ve=$e(e=>{const t=[];let n=0,s=0,r,i=-1;for(const l of e){if(i+=1,r){l===r&&(r=void 0);continue}if(l==='"'||l==="'"){r=l;continue}l==="("?n+=1:l===")"?n-=1:l===","&&n===0&&(t.push(e.slice(s,i)),s=i+1)}return t.push(e.slice(s)),t},"splitCommaOutsideQuotes"),Xt=$e(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var Zt=Object.defineProperty,P=k((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"s$1");const en=/\[([^\]]+)\]/g,tn=P(e=>{const t=e.trim(),n=t.indexOf("(");if(n===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const s=t.slice(0,n).trim(),r=t.slice(n+1,-1).trim();return r===""?{args:[],name:s}:{args:ve(r).map(i=>{const l=i.trim();return Xt(l)??l}),name:s}},"parseFilterCall"),nn=P(e=>{const t=e.split("|").map(s=>s.trim()),n=t[0]??"";if(!n)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(s=>tn(s)),name:n}},"parsePipe"),sn=P(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),rn=P((e,t)=>{const n=e.replaceAll(en,(s,r)=>{const{filters:i,name:l}=nn(r);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let a=t[l];for(const h of i)a=ye(h.name,a,h.args);return sn(a)});return we(n)},"interpolateFilename"),we=P(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),on=P(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),an=P(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var ln=Object.defineProperty,cn=k((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i");const fn=cn((e,t)=>{if(!e.startsWith(`---
1
+ var We=Object.defineProperty;var k=(e,t)=>We(e,"name",{value:t,configurable:!0});import{createRequire as Ue}from"node:module";import{bc as _,bd as U,be as T,bf as A,bg as G,bh as te,bi as Pe,bj as ne,bk as Te,bl as se,bm as re,bn as ie,bo as ze,bp as Me,bq as Ie,br as Re,bs as Fe,bt as Ne,bu as Be,bv as qe,bw as De,bx as Ve,by as Ge,bz as Qe,bA as Je,bB as Ke,bC as He,bD as Ye,bE as oe,bF as S,bG as Xe,bH as Ze,t as et,m as tt,p as nt,b0 as st}from"./bin.js";import{z as ue,M as pe,B as N}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";const Se=Ue(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=k(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,n]=M.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return M.getBuiltinModule(e)}return Se(e)},"__cjs_getBuiltinModule"),{createRequire:rt}=_e("node:module");var it=Object.defineProperty,ot=k((e,t)=>it(e,"name",{value:t,configurable:!0}),"e$2");const at=ot((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"a");var lt=Object.defineProperty,y=k((e,t)=>lt(e,"name",{value:t,configurable:!0}),"g");const ct=rt(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=y(e=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,n]=I.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return I.getBuiltinModule(e)}return ct(e)},"V"),{stripVTControlCharacters:ut}=ft("node:util"),Q=new _(1e3),pt=/[.*+?^${}()|[\]\\]/g,ht=y(e=>{const t=e.join("");if(Q.has(t)){const r=Q.get(t);return r.lastIndex=0,r}const n=e.map(r=>r.replaceAll(pt,String.raw`\$&`)).join("|"),s=new RegExp(n,"g");return Q.set(t,s),s},"Le"),mt=y(e=>{const t=[];let n=0,s;for(U.lastIndex=0;(s=U.exec(e))!==null;)s.index>n&&t.push(e.slice(n,s.index)),t.push(s[0]),n=U.lastIndex;return n<e.length&&t.push(e.slice(n)),t.filter(Boolean)},"Ce"),dt=/[ČŠŽĐ]/i,he=new Uint8Array(128),me=new Uint8Array(128),de=new Uint8Array(128);for(let e=0;e<128;e++)he[e]=e>=65&&e<=90?1:0,me[e]=e>=97&&e<=122?1:0,de[e]=e>=48&&e<=57?1:0;const J=y(e=>he[e],"j"),ae=y(e=>me[e],"O"),K=y(e=>de[e],"w"),W=y((e,t,n,s,r)=>{if(e.length===0)return[];let i=!1;const l=Object.values(t);for(const f of l)if(f(e[0])){i=!0;break}if(!i&&!n)return[e];const a=[...e],h=[];let o=a[0],p="other";const m=Object.entries(t);for(const f of m){const[u,g]=f;if(g(a[0])){p=u;break}}let c=n&&s?a[0]===a[0].toLocaleUpperCase(s):!1;for(let f=1;f<a.length;f++){const u=a[f];let g="other";for(const $ of m){const[v,j]=$;if(j(u)){g=v;break}}const b=n&&s?u===u.toLocaleUpperCase(s):!1;let d=!1;r?d=r(p,g,c,b,u,f,a):(p!==g&&p!=="other"&&g!=="other"&&(d=!0),n&&g!=="other"&&!c&&b&&(d=!0)),d?(h.push(o),o=u):o+=u,p=g,n&&(c=b)}return o&&o.length>0&&h.push(o),h.length>0?h:[e]},"k"),gt=y((e,t,n,s)=>{if(n.size===0)return t;for(const r of n)if(e.startsWith(r,t))return s.push(r),t+r.length;return t},"Ue"),ge=y((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let n=0;const s=[],r=e.length;for(let i=1;i<r;i++){const l=gt(e,n,t,s);if(l!==n){n=l,i=n-1;continue}const a=e.codePointAt(i-1),h=e.codePointAt(i),o=a&&a<128&&J(a),p=h&&h<128&&J(h),m=a&&a<128&&ae(a),c=a&&a<128&&K(a),f=h&&h<128&&K(h);if(m&&p){s.push(e.slice(n,i)),n=i;continue}if(c&&!f||!c&&f){s.push(e.slice(n,i)),n=i;continue}if(f&&!c){let u=!1,g=!1;if(i+1<r){const b=e.codePointAt(i+1);u=b&&b<128&&J(b),g=b&&b<128&&K(b)}if(!g&&u){s.push(e.slice(n,i),e.slice(i,i+1)),n=i+1;continue}}if(i+1<r){const u=e.codePointAt(i+1),g=u&&u<128&&ae(u);if(o&&p&&g){const b=e.slice(n,i+1);t.has(b)||(s.push(e.slice(n,i)),n=i)}}}return n<r&&s.push(e.slice(n)),s.filter(i=>i!=="")},"D"),be=y((e,t,n)=>{if(e.length===0)return[];const s=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!s&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t),u=f,g=f?0:-1;for(let b=1;b<p;b++){const d=o[b],$=d===d.toLocaleUpperCase(t);if($===f)c+=d;else if($)c&&c.length>0&&(m.push(c),c=d),u=!0,g=b;else{if(u&&b-g>1){const v=o[b-1],j=c.slice(0,-1);j&&j.length>0&&m.push(j),c=v+d}else c+=d;u=!1,g=-1}f=$}return c&&c.length>0&&m.push(c),m}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!T.test(e)&&!A.test(e))return[e];const o=[...e],p=o.length,m=[];let c=o[0];const f=o[0];let u;T.test(f)?u=1:A.test(f)?u=2:u=0;let g=f===f.toLocaleUpperCase(t);for(let d=1;d<p;d++){const $=o[d];let v;T.test($)?v=1:A.test($)?v=2:v=0;const j=$===$.toLocaleUpperCase(t);u!==v&&(u===1||u===2)&&(v===1||v===2)||v===u&&!g&&j?(m.push(c),c=$):c+=$,u=v,g=j}c&&c.length>0&&m.push(c);const b=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&A.test(m[d])&&T.test(m[d+1][0])?(b.push(m[d]+m[d+1]),d+=1):b.push(m[d]);return b}if(t.startsWith("el")){if(!G.test(e)&&!A.test(e))return[e];const o=[];te.lastIndex=0;let p;for(;(p=te.exec(e))!==null;)o.push(p[0]);o.length===0&&o.push(e);const m=[];if(o.length===1){const c=o[0];if(!c||!G.test(c[0])||c.length===1)return[c??e]}for(const c of o){if(!c)continue;if(!G.test(c[0])||c.length===1){m.push(c);continue}const f=c.length;let u=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let b=1;b<f;b++){const d=c[b],$=d===d.toLocaleUpperCase(t);!g&&$?(m.push(u),u=d):u+=d,g=$}u&&m.push(u)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const o=t.startsWith("ja"),p=o?{hiragana:y(c=>Te.test(c),"hiragana"),kanji:y(c=>ne.test(c),"kanji"),katakana:y(c=>Pe.test(c),"katakana"),latin:y(c=>A.test(c),"latin")}:{hangul:y(c=>se.test(c),"hangul"),latin:y(c=>A.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(o){const c=W(e,p,!1,t,(u,g)=>u==="hiragana"&&g==="katakana"||u==="katakana"&&g==="hiragana"||u==="hiragana"&&g==="latin"||u==="katakana"&&g==="latin"||u==="kanji"&&g==="latin"||u==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const u of c){const g=u;g.length===1&&m.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[e]}return W(e,p,!1,t,(c,f)=>c==="hangul"&&f==="latin"||c==="latin"&&f==="hangul")}if(t.startsWith("sl")){const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t);for(let u=1;u<p;u++){const g=o[u],b=g===g.toLocaleUpperCase(t),d=dt.test(g),$=u<p-1&&o[u+1]===o[u+1].toLocaleUpperCase(t);!f&&b||d&&$?(m.push(c),c=g,d&&$&&(m.push(c),c="")):c+=g,f=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return W(e,{han:y(o=>ne.test(o),"han"),latin:y(o=>A.test(o),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const o=y(p=>re.test(p)||ie.test(p),"s");return W(e,{latin:y(p=>A.test(p),"latin"),rtl:y(p=>o(p),"rtl")},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const o=y(p=>ze.test(p)||Me.test(p)||Ie.test(p)||Re.test(p)||Fe.test(p)||Ne.test(p)||Be.test(p)||qe.test(p)||De.test(p)||Ve.test(p)||Ge.test(p)||Qe.test(p)||Je.test(p)||Ke.test(p)||He.test(p)||Ye.test(p),"s");return W(e,{indic:y(p=>o(p),"indic"),latin:y(p=>A.test(p),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return W(e,{cyrillic:y(o=>T.test(o),"cyrillic"),latin:y(o=>A.test(o),"latin")},!0,t);if(["ar","fa","he"].includes(t))return W(e,{latin:y(o=>A.test(o),"latin"),rtl:y(o=>re.test(o)||ie.test(o),"rtl")},!1,t);if(t.startsWith("ko"))return W(e,{hangul:y(o=>se.test(o),"hangul"),latin:y(o=>A.test(o),"latin")},!1,t);if(t.startsWith("uz")){if(!T.test(e)&&!A.test(e))return[e];const o=[...e],p=o.length,m=[];let c=o[0],f=o[0]===o[0].toLocaleUpperCase(t);for(let u=1;u<p;u++){const g=o[u],b=g===g.toLocaleUpperCase(t);if(oe.test(g)||oe.test(o[u-1])){c+=g;continue}!f&&b?(m.push(c),c=g):c+=g,f=b}return c&&c.length>0&&m.push(c),m}const r=[...e],i=r.length,l=[];let a=r[0],h=r[0]===r[0].toLocaleUpperCase(t);for(const o of n)if(e.startsWith(o)){l.push(o),a=r[o.length],h=a===a.toLocaleUpperCase(t);break}for(let o=1;o<i;o++){const p=r[o],m=p===p.toLocaleUpperCase(t);let c=0;for(const f of n)if(e.startsWith(f,o)){l.push(a,f),c=f.length,a="";const u=f.at(-1);u&&(h=u===u.toLocaleUpperCase(t));break}if(c>0){o+=c-1;continue}!h&&m?(l.push(a),a=p):a+=p,h=m}return a&&l.push(a),l},"q"),bt=y((e,t,n)=>{const s=[],r=S.test(e)?e.split(S).filter(Boolean):[e];for(const i of r){const l=i;if(S.test(l))s.push(l);else{U.lastIndex=0;const a=U.test(l)?mt(l).filter(Boolean):[l];for(const h of a)if(U.lastIndex=0,U.test(h))s.push(h);else if(t){const o=t.toLowerCase().split("-")[0];s.push(...be(h,o,n))}else s.push(...ge(h,n))}}return s},"Ie"),q=y((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:n=!1,handleEmoji:s=!1,knownAcronyms:r=[],locale:i,normalize:l=!1,separators:a,stripAnsi:h=!1,stripEmoji:o=!1}=t,p=new Set([...r].toSorted((d,$)=>$.length-d.length));let m=e;h&&(m=ut(m)),o&&(m=Xe(m));let c;Array.isArray(a)?c=ht(a):a instanceof RegExp?c=a:c=Ze;const f=[];let u=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;u.length>0;){const d=g.exec(u);if(!d){u===".."?f.push(".."):u==="."?f.push("."):u.length>0&&f.push(u);break}const $=d.index,v=d[0],j=v.length,F=u.slice(0,$),Oe=u.slice($+j);if(v.startsWith("../"))f.push(".."),u=u.slice($+3);else if(v.startsWith("./"))f.push("."),u=u.slice($+2);else if($===0&&v==="..")f.push(".."),u=u.slice(2);else if($===0&&v===".")f.push("."),u=u.slice(1);else{F.length>0&&f.push(F);let L=0;for(;(L=v.indexOf("../",L))!==-1;)f.push(".."),L+=3;for(L=0;(L=v.indexOf("./",L))!==-1;)(L===0||v[L-1]!==".")&&f.push("."),L+=2;let O=Oe;for(;O.startsWith("../");)f.push(".."),O=O.slice(3);for(;O.startsWith("./");)f.push("."),O=O.slice(2);if(O===".."){f.push("..");break}else if(O==="."){f.push(".");break}else u=O}g.lastIndex=0}if(f.length===0){const d=m.split(c).filter(Boolean);f.push(...d)}let b=[];for(const d of f)n||s?b.push(...bt(d,i,p)):i?b.push(...be(d,i,p)):b.push(...ge(d,p));return l&&(b=b.map(d=>p.has(d)?d:i&&d===d.toLocaleUpperCase(i)?d[0]+d.slice(1).toLocaleLowerCase(i):d.toUpperCase()===d&&!p.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),b},"be");var yt=Object.defineProperty,$t=k((e,t)=>yt(e,"name",{value:t,configurable:!0}),"l$4");const X=$t((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"a");var vt=Object.defineProperty,wt=k((e,t)=>vt(e,"name",{value:t,configurable:!0}),"r$2");const D=wt((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"r");var jt=Object.defineProperty,kt=k((e,t)=>jt(e,"name",{value:t,configurable:!0}),"p$4");const V=kt((e,t)=>{const{length:n}=e;if(n===0)return"";if(n===1)return e[0];const s=[];let r="",i="";for(let l=0;l<n;l++){const a=e[l];if(S.test(a)){r?(s.push(r+i+a),r="",i=""):(s.length>0&&s.push(t),r=a);continue}r?(i&&(i+=t),i+=a):(s.length>0&&s.push(t),s.push(a))}return s.join("")},"p");var At=Object.defineProperty,Ct=k((e,t)=>At(e,"name",{value:t,configurable:!0}),"e$1");const xt=/(?<![a-zß])SS(?![a-z])/g,Z=Ct(e=>e.replaceAll(xt,"ß"),"l");var Et=Object.defineProperty,Lt=k((e,t)=>Et(e,"name",{value:t,configurable:!0}),"p$2");const Ot=new _(1e3),Wt=Lt((e,t)=>{if(typeof e!="string"||!e)return"";const n=t?.cache??!1,s=t?.cacheStore??Ot;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);let i=!0;const l=V(q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(a=>{if(t?.handleAnsi&&S.test(a))return a;const h=t?.locale?.startsWith("de")?Z(a):a,o=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return i?(i=!1,at(o,t)):X(o,t)}),"");return n&&r&&s.set(r,l),l},"R");var Ut=Object.defineProperty,St=k((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"l$2");const _t=new _(1e3),ee=St((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,s=t?.cacheStore??_t;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(a=>{if(t?.handleAnsi&&S.test(a))return a;if(t?.toUpperCase)return t.locale?a.toLocaleUpperCase(t.locale):a.toUpperCase();const h=t?.locale?.startsWith("de")?Z(a):a;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=V(i,t?.joiner??"-");return n&&r&&s.set(r,l),l},"L");var Pt=Object.defineProperty,Tt=k((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"r$1");const zt=new _(1e3),Mt=Tt((e,t)=>ee(e,{cacheStore:zt,...t,joiner:"_",toUpperCase:!0}),"m");var It=Object.defineProperty,Rt=k((e,t)=>It(e,"name",{value:t,configurable:!0}),"l$1");const Ft=new _(1e3),Nt=Rt((e,t)=>{if(typeof e!="string"||!e)return"";const n=t?.cache??!1,s=t?.cacheStore??Ft;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=V(q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&S.test(l))return l;const a=t?.locale?.startsWith("de")?Z(l):l;return X(t?.locale?a.toLocaleLowerCase(t.locale):a.toLowerCase(),{locale:t?.locale})}),"");return n&&r&&s.set(r,i),i},"L");var Bt=Object.defineProperty,qt=k((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"r");const Dt=new _(1e3),Vt=qt((e,t)=>ee(e,{cacheStore:Dt,...t,joiner:"_"}),"n");var Gt=Object.defineProperty,Qt=k((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"a$1");const Jt=new _(1e3),Kt=Qt((e,t)=>{if(typeof e!="string")return"";const n=t?.cache??!1,s=t?.cacheStore??Jt;let r;if(n&&(r=D(e,t)),n&&r&&s.has(r))return s.get(r);const i=V(q(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>X(l,{locale:t?.locale})),"-");return n&&r&&s.set(r,i),i},"y");var Ht=Object.defineProperty,C=k((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"e");const x=C(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),H={camel_case:C(e=>Wt(x(e)),"camel_case"),kebab_case:C(e=>ee(x(e)),"kebab_case"),lower_case:C(e=>x(e).toLowerCase(),"lower_case"),pascal_case:C(e=>Nt(x(e)),"pascal_case"),path_join:C((e,...t)=>{const n=[x(e),...t.map(s=>x(s))];return pe(...n)},"path_join"),path_relative:C((e,t)=>ue(x(t),x(e)),"path_relative"),snake_case:C(e=>Vt(x(e)),"snake_case"),upper_case:C(e=>x(e).toUpperCase(),"upper_case"),upper_kebab_case:C(e=>Kt(x(e)),"upper_kebab_case"),upper_snake_case:C(e=>Mt(x(e)),"upper_snake_case")};C(e=>Object.hasOwn(H,e),"isKnownFilter");const ye=C((e,t,n=[])=>{const s=H[e];if(!s)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return s(t,...n)},"applyFilter");var Yt=Object.defineProperty,$e=k((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"d$1");const ve=$e(e=>{const t=[];let n=0,s=0,r,i=-1;for(const l of e){if(i+=1,r){l===r&&(r=void 0);continue}if(l==='"'||l==="'"){r=l;continue}l==="("?n+=1:l===")"?n-=1:l===","&&n===0&&(t.push(e.slice(s,i)),s=i+1)}return t.push(e.slice(s)),t},"splitCommaOutsideQuotes"),Xt=$e(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var Zt=Object.defineProperty,P=k((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"s$1");const en=/\[([^\]]+)\]/g,tn=P(e=>{const t=e.trim(),n=t.indexOf("(");if(n===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const s=t.slice(0,n).trim(),r=t.slice(n+1,-1).trim();return r===""?{args:[],name:s}:{args:ve(r).map(i=>{const l=i.trim();return Xt(l)??l}),name:s}},"parseFilterCall"),nn=P(e=>{const t=e.split("|").map(s=>s.trim()),n=t[0]??"";if(!n)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(s=>tn(s)),name:n}},"parsePipe"),sn=P(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),rn=P((e,t)=>{const n=e.replaceAll(en,(s,r)=>{const{filters:i,name:l}=nn(r);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let a=t[l];for(const h of i)a=ye(h.name,a,h.args);return sn(a)});return we(n)},"interpolateFilename"),we=P(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),on=P(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),an=P(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var ln=Object.defineProperty,cn=k((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i");const fn=cn((e,t)=>{if(!e.startsWith(`---
2
2
  `)&&!e.startsWith(`---\r
3
3
  `))return{body:e};const n=e.indexOf(`
4
4
  ---`,3);if(n===-1)return{body:e};let s=n+1+3;e[s]==="\r"&&(s+=1),e[s]===`
@@ -1,4 +1,4 @@
1
- var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import{p as s}from"./bin.js";import{c as o,f as c}from"../packem_shared/registry-keys-E3cZn4FI.js";var n=Object.defineProperty,f=a((r,e)=>n(r,"name",{value:e,configurable:!0}),"n");const g=f(async({options:r})=>{if(r.clear){const t=o();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
1
+ var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import{p as s}from"./bin.js";import{c as o,f as c}from"../packem_shared/registry-keys-CuBAVdsk.js";var n=Object.defineProperty,f=a((r,e)=>n(r,"name",{value:e,configurable:!0}),"n");const g=f(async({options:r})=>{if(r.clear){const t=o();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
2
2
  `);return}s.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await c({forceRefresh:!0});if(e===void 0){if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
3
3
  `),process.exitCode=1;return}s.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
4
4
  `);return}if(e.fromCache&&e.stale===!0){s.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}s.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)},"execute");export{g as default};
@@ -1,3 +1,3 @@
1
- var x=Object.defineProperty;var w=(t,s)=>x(t,"name",{value:s,configurable:!0});import{createRequire as B}from"node:module";import{ah as P,p as o,ai as R}from"./bin.js";import{A as V}from"../packem_shared/pm-runner-DmKT2FqF.js";import{x as C}from"../packem_shared/build-scripts-DE6U8jVq.js";import{M as y,l as k}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{s as q}from"./config.js";const D=B(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=w(t=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[s,f]=v.versions.node.split(".").map(Number);if(s>22||s===22&&f>=3||s===20&&f>=16)return v.getBuiltinModule(t)}return D(t)},"__cjs_getBuiltinModule"),{readdirSync:j,statSync:O}=M("node:fs");var A=Object.defineProperty,_=w((t,s)=>A(t,"name",{value:s,configurable:!0}),"p$1");const N=_((t,s={})=>{const f=y(t,"node_modules");if(!k(f))return[];const l=new Map,p=new Set,b=_((n,i,a)=>{const e=`${i}@${a}`;if(p.has(e))return;p.add(e);const r=a.startsWith(t)?a.slice(t.length+1):a;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===i)||u.push({name:i,relativePath:r})},"recordBin"),m=_((n,i="")=>{let a;try{a=j(n)}catch{return}for(const e of a){const r=y(n,e);if(e.startsWith("@")){m(r,`${e}/`);continue}if(e===".pnpm"&&i===""){let c;try{c=j(r)}catch{continue}for(const d of c){const h=y(r,d,"node_modules");k(h)&&m(h)}continue}if(e.startsWith("."))continue;const u=i+e,$=y(r,"package.json");try{if(!O(r).isDirectory()||!k($))continue;const c=q($),d=typeof c.name=="string"?c.name:u;if(typeof c.bin=="string"){const S=d.includes("/")?d.split("/").pop():d;b(S,d,r)}else if(c.bin&&typeof c.bin=="object")for(const S of Object.keys(c.bin))b(S,d,r);const h=y(r,"node_modules");k(h)&&m(h)}catch{}}},"scanDir");m(f);const g=[];for(const[n,i]of l)i.length<2||s[n]===!0||i.every(a=>s[`${a.name}#${n}`]===!0)||g.push({bin:n,packages:i});return g.sort((n,i)=>n.bin.localeCompare(i.bin))},"collectBinShadows");var T=Object.defineProperty,W=w((t,s)=>T(t,"name",{value:s,configurable:!0}),"p");const U=new Set(["bun","npm","pnpm","yarn"]),K=W(({options:t,visConfig:s,workspaceRoot:f})=>{const l=f??process.cwd(),p=V(l),b=s?.security?.policies?.installScripts?.allow??{},m=s?.security?.allowBins??{},g=s?.security?.pinVersions===!0,n=C(l,b,{pinVersions:g}),i=N(l,m),a=s&&U.has(p.name)?P(s,p.name,l):void 0;if(t.json){process.stdout.write(`${JSON.stringify({binConflicts:i,drift:a,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:g,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
1
+ var x=Object.defineProperty;var k=(t,s)=>x(t,"name",{value:s,configurable:!0});import{createRequire as B}from"node:module";import{aj as P,p as o,ak as R}from"./bin.js";import{A as V}from"../packem_shared/pm-runner-DmKT2FqF.js";import{x as C}from"../packem_shared/build-scripts-DE6U8jVq.js";import{M as y,l as w}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{s as q}from"./config.js";const D=B(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=k(t=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[s,f]=v.versions.node.split(".").map(Number);if(s>22||s===22&&f>=3||s===20&&f>=16)return v.getBuiltinModule(t)}return D(t)},"__cjs_getBuiltinModule"),{readdirSync:_,statSync:O}=M("node:fs");var A=Object.defineProperty,S=k((t,s)=>A(t,"name",{value:s,configurable:!0}),"p$1");const N=S((t,s={})=>{const f=y(t,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=S((n,i,a)=>{const e=`${i}@${a}`;if(p.has(e))return;p.add(e);const r=a.startsWith(t)?a.slice(t.length+1):a;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===i)||u.push({name:i,relativePath:r})},"recordBin"),m=S((n,i="")=>{let a;try{a=_(n)}catch{return}for(const e of a){const r=y(n,e);if(e.startsWith("@")){m(r,`${e}/`);continue}if(e===".pnpm"&&i===""){let c;try{c=_(r)}catch{continue}for(const d of c){const h=y(r,d,"node_modules");w(h)&&m(h)}continue}if(e.startsWith("."))continue;const u=i+e,$=y(r,"package.json");try{if(!O(r).isDirectory()||!w($))continue;const c=q($),d=typeof c.name=="string"?c.name:u;if(typeof c.bin=="string"){const j=d.includes("/")?d.split("/").pop():d;b(j,d,r)}else if(c.bin&&typeof c.bin=="object")for(const j of Object.keys(c.bin))b(j,d,r);const h=y(r,"node_modules");w(h)&&m(h)}catch{}}},"scanDir");m(f);const g=[];for(const[n,i]of l)i.length<2||s[n]===!0||i.every(a=>s[`${a.name}#${n}`]===!0)||g.push({bin:n,packages:i});return g.sort((n,i)=>n.bin.localeCompare(i.bin))},"collectBinShadows");var T=Object.defineProperty,W=k((t,s)=>T(t,"name",{value:s,configurable:!0}),"p");const U=new Set(["bun","npm","pnpm","yarn"]),K=W(({options:t,visConfig:s,workspaceRoot:f})=>{const l=f??process.cwd(),p=V(l),b=s?.security?.policies?.installScripts?.allow??{},m=s?.security?.allowBins??{},g=s?.security?.pinVersions===!0,n=C(l,b,{pinVersions:g}),i=N(l,m),a=s&&U.has(p.name)?P(s,p.name,l):void 0;if(t.json){process.stdout.write(`${JSON.stringify({binConflicts:i,drift:a,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:g,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
2
2
  `);return}if(o.info(`Build-script status (${p.name}):
3
3
  `),n.installed.length===0&&n.unapproved.length===0&&o.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){o.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)o.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){o.info(""),o.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)o.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);o.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){o.info(""),o.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)o.info(` ! ${e}`);o.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){o.info(""),o.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:r}of n.versionDrift)o.info(` ${e} → ${r}`);o.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(i.length>0){o.info(""),o.warn(` Bin conflicts (${String(i.length)}) — multiple packages expose the same bin name:`);for(const e of i)o.info(` ${e.bin} ← ${e.packages.map(r=>r.name).join(", ")}`);o.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(a?.hasDrift){o.info("");for(const e of R(a))o.warn(e)}},"execute");export{K as default};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var a=(t,o)=>l(t,"name",{value:o,configurable:!0});import{p as c,I as p,L as u}from"./bin.js";var w=Object.defineProperty,f=a((t,o)=>w(t,"name",{value:o,configurable:!0}),"c");const m=f(({options:t,visConfig:o,workspaceRoot:s})=>{const i=s??process.cwd(),n=o?.security?.policies?.installScripts?.allow??{},r=Object.entries(n).filter(([,e])=>e).map(([e])=>e);r.length===0&&!t.rootOnly&&(c.warn("No approved packages in security.policies.installScripts.allow — nothing to run."),!t.withRoot)||(t.rootOnly||p(i,r),(t.withRoot||t.rootOnly)&&u(i))},"execute");export{m as default};
1
+ var l=Object.defineProperty;var a=(t,o)=>l(t,"name",{value:o,configurable:!0});import{p as c,L as p,M as u}from"./bin.js";var w=Object.defineProperty,f=a((t,o)=>w(t,"name",{value:o,configurable:!0}),"c");const m=f(({options:t,visConfig:o,workspaceRoot:s})=>{const i=s??process.cwd(),n=o?.security?.policies?.installScripts?.allow??{},r=Object.entries(n).filter(([,e])=>e).map(([e])=>e);r.length===0&&!t.rootOnly&&(c.warn("No approved packages in security.policies.installScripts.allow — nothing to run."),!t.withRoot)||(t.rootOnly||p(i,r),(t.withRoot||t.rootOnly)&&u(i))},"execute");export{m as default};
@@ -1,2 +1,2 @@
1
- var w=Object.defineProperty;var y=(e,o)=>w(e,"name",{value:o,configurable:!0});import{E as $}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{p as l}from"./bin.js";import{s as D}from"../packem_shared/scan-progress-CTVVf9WW.js";import{s as b,D as S}from"../packem_shared/advisories-CGKZo9Rx.js";var E=Object.defineProperty,c=y((e,o)=>E(e,"name",{value:o,configurable:!0}),"c");const P=c(e=>e?.security?.audit?.advisories??{},"readAdvisoriesConfig"),k=c(e=>e?e.split(",").map(o=>o.trim()).filter(o=>o.length>0):["npm"],"parseEcosystems"),x=c(async({logger:e,options:o,visConfig:g,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const u=o.format==="json",m=P(g),f=o.source??m.source??S,p=k(o.ecosystem),v=p.map(s=>({id:s,label:`Sync ${s} advisories`})),n=D(v,{live:!u}),i=[];try{for(const s of p){n.start(s);const r=Date.now();try{const t=await b({allowedHosts:m.allowedHosts,dbPath:o.db,ecosystem:s,force:!!o.force,source:f,workspaceRoot:d});i.push({ecosystem:s,result:t}),t.upToDate?n.finish(s,"ok",`up to date · ${h(Date.now()-r)}`):n.finish(s,"ok",`${t.advisoriesIngested.toLocaleString()} advisories · ${h(t.durationMs)}`)}catch(t){const a=t instanceof Error?t.message:String(t);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}if(u){const s={ecosystems:i.map(r=>({advisoriesIngested:r.result?.advisoriesIngested??0,dbPath:r.result?.dbPath??null,durationMs:r.result?.durationMs??0,ecosystem:r.ecosystem,error:r.error??null,upToDate:r.result?.upToDate??!1})),source:f};process.stdout.write(`${JSON.stringify(s,void 0,2)}
1
+ var w=Object.defineProperty;var y=(e,o)=>w(e,"name",{value:o,configurable:!0});import{E as $}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{p as l}from"./bin.js";import{s as D}from"../packem_shared/scan-progress-lZdk5KJ-.js";import{s as b,D as S}from"../packem_shared/advisories-CGKZo9Rx.js";var E=Object.defineProperty,c=y((e,o)=>E(e,"name",{value:o,configurable:!0}),"c");const P=c(e=>e?.security?.audit?.advisories??{},"readAdvisoriesConfig"),k=c(e=>e?e.split(",").map(o=>o.trim()).filter(o=>o.length>0):["npm"],"parseEcosystems"),x=c(async({logger:e,options:o,visConfig:g,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const u=o.format==="json",m=P(g),f=o.source??m.source??S,p=k(o.ecosystem),v=p.map(s=>({id:s,label:`Sync ${s} advisories`})),n=D(v,{live:!u}),i=[];try{for(const s of p){n.start(s);const r=Date.now();try{const t=await b({allowedHosts:m.allowedHosts,dbPath:o.db,ecosystem:s,force:!!o.force,source:f,workspaceRoot:d});i.push({ecosystem:s,result:t}),t.upToDate?n.finish(s,"ok",`up to date · ${h(Date.now()-r)}`):n.finish(s,"ok",`${t.advisoriesIngested.toLocaleString()} advisories · ${h(t.durationMs)}`)}catch(t){const a=t instanceof Error?t.message:String(t);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}if(u){const s={ecosystems:i.map(r=>({advisoriesIngested:r.result?.advisoriesIngested??0,dbPath:r.result?.dbPath??null,durationMs:r.result?.durationMs??0,ecosystem:r.ecosystem,error:r.error??null,upToDate:r.result?.upToDate??!1})),source:f};process.stdout.write(`${JSON.stringify(s,void 0,2)}
2
2
  `)}else{const s=i.filter(a=>a.error),r=i.filter(a=>a.result),t=r[0];t?.result?.dbPath&&l.info($(`DB: ${t.result.dbPath}`)),s.length===0?l.success(`Synced ${r.length} ecosystem${r.length===1?"":"s"}.`):l.error(`${s.length} ecosystem${s.length===1?"":"s"} failed to sync.`)}i.some(s=>s.error)&&(process.exitCode=1)},"execute"),h=c(e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,"formatDuration"),O=x;export{O as advisoriesSyncExecute};
@@ -1,2 +1,2 @@
1
- var m=Object.defineProperty;var f=(e,n)=>m(e,"name",{value:n,configurable:!0});import{p as i}from"./bin.js";import{A as g}from"../packem_shared/pm-runner-DmKT2FqF.js";import{N as y}from"../packem_shared/native-config-sync-BRZZetn3.js";import{E as v}from"../packem_shared/min-release-age-BPVXwPUg.js";var h=Object.defineProperty,w=f((e,n)=>h(e,"name",{value:n,configurable:!0}),"l");const b=new Set(["bun","npm","pnpm","yarn"]),x=w(({options:e,visConfig:n,workspaceRoot:u})=>{const o=u??process.cwd(),t=g(o);if(!b.has(t.name)){i.warn(`Package manager '${t.name}' has no native security config to sync.`);return}if(!n?.security){i.warn("vis.config has no `security` block — nothing to sync.");return}const r=n.security.policies??{},a=Object.fromEntries(Object.entries(r.installScripts?.allow??{}).filter(([,c])=>c)),p=r.firstSeen?.minutes,l=r.firstSeen?.exclude??[],s=[];if(Object.keys(a).length>0&&!e.skipAllowBuilds&&s.push(...y(t.name,o,a)),e.skipMinReleaseAge||s.push(...v(t.name,o,p,l)),s.length===0){i.success("Nothing to sync — vis.config and native PM config are aligned.");return}i.info(`Syncing vis.config security settings to ${t.name} native config…
1
+ var m=Object.defineProperty;var f=(e,n)=>m(e,"name",{value:n,configurable:!0});import{p as i}from"./bin.js";import{A as g}from"../packem_shared/pm-runner-DmKT2FqF.js";import{N as y}from"../packem_shared/native-config-sync-DBkJ-hsF.js";import{E as v}from"../packem_shared/min-release-age-DKMW2N_v.js";var h=Object.defineProperty,w=f((e,n)=>h(e,"name",{value:n,configurable:!0}),"l");const b=new Set(["bun","npm","pnpm","yarn"]),x=w(({options:e,visConfig:n,workspaceRoot:u})=>{const o=u??process.cwd(),t=g(o);if(!b.has(t.name)){i.warn(`Package manager '${t.name}' has no native security config to sync.`);return}if(!n?.security){i.warn("vis.config has no `security` block — nothing to sync.");return}const r=n.security.policies??{},a=Object.fromEntries(Object.entries(r.installScripts?.allow??{}).filter(([,c])=>c)),p=r.firstSeen?.minutes,l=r.firstSeen?.exclude??[],s=[];if(Object.keys(a).length>0&&!e.skipAllowBuilds&&s.push(...y(t.name,o,a)),e.skipMinReleaseAge||s.push(...v(t.name,o,p,l)),s.length===0){i.success("Nothing to sync — vis.config and native PM config are aligned.");return}i.info(`Syncing vis.config security settings to ${t.name} native config…
2
2
  `);for(const c of s)i.success(` ${c}`)},"execute");export{x as default};
@@ -1,2 +1,2 @@
1
- var $=Object.defineProperty;var k=(e,o)=>$(e,"name",{value:o,configurable:!0});import{p}from"./bin.js";import{A as S}from"../packem_shared/pm-runner-DmKT2FqF.js";import{r as v,l as x,L as C}from"../packem_shared/dependency-scan-BUbOcMwX.js";import{B as M,M as h,l as L}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{S as E}from"../packem_shared/lockfile-CrT86D6d.js";import{e as P}from"../packem_shared/index-BnANMQ7k.js";var D=Object.defineProperty,m=k((e,o)=>D(e,"name",{value:o,configurable:!0}),"r");const V=m(e=>{const o=e.trim();return o===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(o)||/^(?:github|gitlab|bitbucket|gist):/i.test(o)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(o)&&!o.includes("@")?!0:/^https?:\/\//i.test(o)},"isExoticSpecifier"),N=m((e,o)=>{for(const s of o)if(s===e||s.endsWith("*")&&e.startsWith(s.slice(0,-1)))return!0;return!1},"matchesAllow"),O=m((e,o,s={})=>{const t=v(e,o);if(!t)return[];let i;try{i=M(h(e,t.file))}catch{return[]}const n=E(i,t.type);if(n.length===0)return[];const c=s.allow??[],l=[],f=new Set;for(const r of n){const a=`${r.name}@${r.version}`;for(const g of[r.dependencies,r.optionalDependencies])if(g){for(const[u,w]of Object.entries(g))if(!N(u,c))for(const y of w){if(!V(y))continue;const b=`${a}->${u}@${y}`;f.has(b)||(f.add(b),l.push({declaredBy:a,packageName:u,source:y}))}}}return l.sort((r,a)=>r.packageName.localeCompare(a.packageName)||r.declaredBy.localeCompare(a.declaredBy))},"scanExoticSubdeps");var R=Object.defineProperty,d=k((e,o)=>R(e,"name",{value:o,configurable:!0}),"n");const j=new Set(["firstSeen","publisherChange"]),B=d(e=>e.severity==="block"&&e.acceptedRisk===void 0,"isGatingDecision"),A=d(e=>{const o=e.security?.policies?.firstSeen?.minutes,s=typeof o=="number"&&o>0,t=e.security?.policies?.publisherChange?.mode==="no-downgrade",i=e.security?.blockExoticSubdeps===!0;return s||t||i},"anyPolicyConfigured"),F=d(async e=>{const{offline:o=!1,packageManager:s,visConfig:t,workspaceRoot:i}=e,n=Date.now();if(!A(t))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const c=v(i,s);if(!c||!L(h(i,c.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=x(i,s,{includeDev:!0}),f=l.length,r=await P({offline:o,packageManager:s,packages:l,workspaceRoot:i},"install",{enabledPolicies:new Set(j),visConfig:t}),a=t.security?.blockExoticSubdeps===!0?O(i,s,{allow:t.security.exoticSubdepsAllow}):[],g=r.some(u=>B(u))||a.length>0;return{decisions:r,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:g?"fail":"pass"}},"verifyLockfile"),W=d(e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,"formatElapsed"),G=d(e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const o=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${W(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${o}`];const s=[`✗ Lockfile failed supply-chain policy check ${o}`];for(const t of e.decisions)t.severity==="block"&&t.acceptedRisk===void 0&&s.push(` [${t.policy}] ${t.reason}`);for(const t of e.exoticViolations)s.push(` [blockExoticSubdeps] ${t.packageName} pulled from exotic source by ${t.declaredBy}: ${t.source}`);return s},"formatLockfileVerification");var I=Object.defineProperty,J=k((e,o)=>I(e,"name",{value:o,configurable:!0}),"a");const U=J(async({options:e,visConfig:o,workspaceRoot:s})=>{const t=s??process.cwd(),i=S(t);if(!C[i.name]){p.warn(`Package manager '${i.name}' has no lockfile vis can verify.`);return}const n=await F({offline:!!e.offline,packageManager:i.name,visConfig:o??{},workspaceRoot:t});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
1
+ var $=Object.defineProperty;var k=(e,o)=>$(e,"name",{value:o,configurable:!0});import{p}from"./bin.js";import{A as S}from"../packem_shared/pm-runner-DmKT2FqF.js";import{r as v,l as x,L as C}from"../packem_shared/dependency-scan-B70azq4x.js";import{B as M,M as h,l as L}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{S as E}from"../packem_shared/lockfile-CedmXr44.js";import{e as P}from"../packem_shared/index-BpbjpCNL.js";var D=Object.defineProperty,m=k((e,o)=>D(e,"name",{value:o,configurable:!0}),"r");const V=m(e=>{const o=e.trim();return o===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(o)||/^(?:github|gitlab|bitbucket|gist):/i.test(o)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(o)&&!o.includes("@")?!0:/^https?:\/\//i.test(o)},"isExoticSpecifier"),N=m((e,o)=>{for(const s of o)if(s===e||s.endsWith("*")&&e.startsWith(s.slice(0,-1)))return!0;return!1},"matchesAllow"),O=m((e,o,s={})=>{const t=v(e,o);if(!t)return[];let i;try{i=M(h(e,t.file))}catch{return[]}const n=E(i,t.type);if(n.length===0)return[];const c=s.allow??[],l=[],f=new Set;for(const r of n){const a=`${r.name}@${r.version}`;for(const g of[r.dependencies,r.optionalDependencies])if(g){for(const[u,w]of Object.entries(g))if(!N(u,c))for(const y of w){if(!V(y))continue;const b=`${a}->${u}@${y}`;f.has(b)||(f.add(b),l.push({declaredBy:a,packageName:u,source:y}))}}}return l.sort((r,a)=>r.packageName.localeCompare(a.packageName)||r.declaredBy.localeCompare(a.declaredBy))},"scanExoticSubdeps");var R=Object.defineProperty,d=k((e,o)=>R(e,"name",{value:o,configurable:!0}),"n");const j=new Set(["firstSeen","publisherChange"]),B=d(e=>e.severity==="block"&&e.acceptedRisk===void 0,"isGatingDecision"),A=d(e=>{const o=e.security?.policies?.firstSeen?.minutes,s=typeof o=="number"&&o>0,t=e.security?.policies?.publisherChange?.mode==="no-downgrade",i=e.security?.blockExoticSubdeps===!0;return s||t||i},"anyPolicyConfigured"),F=d(async e=>{const{offline:o=!1,packageManager:s,visConfig:t,workspaceRoot:i}=e,n=Date.now();if(!A(t))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const c=v(i,s);if(!c||!L(h(i,c.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=x(i,s,{includeDev:!0}),f=l.length,r=await P({offline:o,packageManager:s,packages:l,workspaceRoot:i},"install",{enabledPolicies:new Set(j),visConfig:t}),a=t.security?.blockExoticSubdeps===!0?O(i,s,{allow:t.security.exoticSubdepsAllow}):[],g=r.some(u=>B(u))||a.length>0;return{decisions:r,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:g?"fail":"pass"}},"verifyLockfile"),W=d(e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,"formatElapsed"),G=d(e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const o=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${W(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${o}`];const s=[`✗ Lockfile failed supply-chain policy check ${o}`];for(const t of e.decisions)t.severity==="block"&&t.acceptedRisk===void 0&&s.push(` [${t.policy}] ${t.reason}`);for(const t of e.exoticViolations)s.push(` [blockExoticSubdeps] ${t.packageName} pulled from exotic source by ${t.declaredBy}: ${t.source}`);return s},"formatLockfileVerification");var I=Object.defineProperty,J=k((e,o)=>I(e,"name",{value:o,configurable:!0}),"a");const U=J(async({options:e,visConfig:o,workspaceRoot:s})=>{const t=s??process.cwd(),i=S(t);if(!C[i.name]){p.warn(`Package manager '${i.name}' has no lockfile vis can verify.`);return}const n=await F({offline:!!e.offline,packageManager:i.name,visConfig:o??{},workspaceRoot:t});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
2
2
  `),n.status==="fail"&&(process.exitCode=1);return}const[c,...l]=G(n);if(n.status==="skipped"){p.info(c);return}if(n.status==="pass"){p.success(c);return}p.error(c);for(const f of l)p.error(f);process.exitCode=1},"execute");export{U as default};
@@ -1,4 +1,4 @@
1
- var F=Object.defineProperty;var k=(e,r)=>F(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{d as U,R as v,a6 as W,n as b,y as K,aj as G,ak as Y,al as X,am as Q}from"../packem_chunks/bin.js";const D=B(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return D(e)},"__cjs_getBuiltinModule"),{spawn:J,execFileSync:E}=$("node:child_process"),{existsSync:j}=$("node:fs"),{platform:z,homedir:M}=$("node:os"),{join:g}=$("node:path"),Z=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,ee=5e3,re=1e4,te=3e5,ae=4096,T=z()==="win32",x=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ne=Object.defineProperty,ie=k((e,r)=>ne(e,"name",{value:r,configurable:!0}),"O"),oe=Object.defineProperty,m=ie((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a"),se=Object.defineProperty,ce=m((e,r)=>se(e,"name",{value:r,configurable:!0}),"a$6");const le={alternateCommands:[],buildArgs:ce((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var ue=Object.defineProperty,de=m((e,r)=>ue(e,"name",{value:r,configurable:!0}),"t$8");const me={alternateCommands:[],buildArgs:de((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var pe=Object.defineProperty,ge=m((e,r)=>pe(e,"name",{value:r,configurable:!0}),"a$4");const fe={alternateCommands:["openai-codex"],buildArgs:ge((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var he=Object.defineProperty,ve=m((e,r)=>he(e,"name",{value:r,configurable:!0}),"l");const ye={alternateCommands:[],buildArgs:ve((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var be=Object.defineProperty,ke=m((e,r)=>be(e,"name",{value:r,configurable:!0}),"n$2");const we={alternateCommands:[],buildArgs:ke((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var Ae=Object.defineProperty,$e=m((e,r)=>Ae(e,"name",{value:r,configurable:!0}),"t$5");const Se={alternateCommands:["cursor"],buildArgs:$e((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Pe=Object.defineProperty,Te=m((e,r)=>Pe(e,"name",{value:r,configurable:!0}),"i");const Ce={alternateCommands:[],buildArgs:Te((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var je=Object.defineProperty,Oe=m((e,r)=>je(e,"name",{value:r,configurable:!0}),"o$1");const Re={alternateCommands:["gemini-cli"],buildArgs:Oe((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Ee=Object.defineProperty,Me=m((e,r)=>Ee(e,"name",{value:r,configurable:!0}),"o");const xe={alternateCommands:[],buildArgs:Me((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var Ie=Object.defineProperty,_e=m((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"r");const Ne={alternateCommands:[],buildArgs:_e((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Le=Object.defineProperty,qe=m((e,r)=>Le(e,"name",{value:r,configurable:!0}),"n");const Ve={alternateCommands:["qwen-code"],buildArgs:qe((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var He=Object.defineProperty,f=m((e,r)=>He(e,"name",{value:r,configurable:!0}),"s");const I={amp:le,claude:me,codex:fe,copilot:ye,crush:we,cursor:Se,droid:Ce,gemini:Re,kimi:xe,opencode:Ne,qwen:Ve},O=f(e=>e==="~"||e.startsWith("~/")||T&&e.startsWith("~\\")?g(M(),e.slice(2)):e,"resolveHome"),Fe=f(e=>{try{const r=E(T?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}).trim().split(`
1
+ var F=Object.defineProperty;var k=(e,r)=>F(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{d as U,R as v,a8 as W,n as b,y as K,al as G,am as Y,an as X,ao as Q}from"../packem_chunks/bin.js";const D=B(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return D(e)},"__cjs_getBuiltinModule"),{spawn:J,execFileSync:E}=$("node:child_process"),{existsSync:j}=$("node:fs"),{platform:z,homedir:M}=$("node:os"),{join:g}=$("node:path"),Z=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,ee=5e3,re=1e4,te=3e5,ae=4096,T=z()==="win32",x=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ne=Object.defineProperty,ie=k((e,r)=>ne(e,"name",{value:r,configurable:!0}),"O"),oe=Object.defineProperty,m=ie((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a"),se=Object.defineProperty,ce=m((e,r)=>se(e,"name",{value:r,configurable:!0}),"a$6");const le={alternateCommands:[],buildArgs:ce((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var ue=Object.defineProperty,de=m((e,r)=>ue(e,"name",{value:r,configurable:!0}),"t$8");const me={alternateCommands:[],buildArgs:de((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var pe=Object.defineProperty,ge=m((e,r)=>pe(e,"name",{value:r,configurable:!0}),"a$4");const fe={alternateCommands:["openai-codex"],buildArgs:ge((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var he=Object.defineProperty,ve=m((e,r)=>he(e,"name",{value:r,configurable:!0}),"l");const ye={alternateCommands:[],buildArgs:ve((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var be=Object.defineProperty,ke=m((e,r)=>be(e,"name",{value:r,configurable:!0}),"n$2");const we={alternateCommands:[],buildArgs:ke((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var Ae=Object.defineProperty,$e=m((e,r)=>Ae(e,"name",{value:r,configurable:!0}),"t$5");const Se={alternateCommands:["cursor"],buildArgs:$e((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Pe=Object.defineProperty,Te=m((e,r)=>Pe(e,"name",{value:r,configurable:!0}),"i");const Ce={alternateCommands:[],buildArgs:Te((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var je=Object.defineProperty,Oe=m((e,r)=>je(e,"name",{value:r,configurable:!0}),"o$1");const Re={alternateCommands:["gemini-cli"],buildArgs:Oe((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Ee=Object.defineProperty,Me=m((e,r)=>Ee(e,"name",{value:r,configurable:!0}),"o");const xe={alternateCommands:[],buildArgs:Me((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var Ie=Object.defineProperty,_e=m((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"r");const Ne={alternateCommands:[],buildArgs:_e((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Le=Object.defineProperty,qe=m((e,r)=>Le(e,"name",{value:r,configurable:!0}),"n");const Ve={alternateCommands:["qwen-code"],buildArgs:qe((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var He=Object.defineProperty,f=m((e,r)=>He(e,"name",{value:r,configurable:!0}),"s");const I={amp:le,claude:me,codex:fe,copilot:ye,crush:we,cursor:Se,droid:Ce,gemini:Re,kimi:xe,opencode:Ne,qwen:Ve},O=f(e=>e==="~"||e.startsWith("~/")||T&&e.startsWith("~\\")?g(M(),e.slice(2)):e,"resolveHome"),Fe=f(e=>{try{const r=E(T?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}).trim().split(`
2
2
  `)[0]?.trim();return r&&r.length>0?r:void 0}catch{return}},"whichCommand"),Be=f(e=>{const r=M();if(T){const a=process.env.APPDATA??"",t=process.env.LOCALAPPDATA??"",n=process.env.ProgramFiles??"";return[g(a,"npm",`${e}.cmd`),g(a,"npm",e),g(t,"Programs",e,`${e}.exe`),g(n,e,`${e}.exe`),g(r,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,g(r,".npm-global","bin",e),g(r,".local","bin",e),g(r,".cargo","bin",e)]},"getKnownPaths"),S=f(e=>{try{const r=E(e,["--version"],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:re}),a=Z.exec(r);return a?a[1]:void 0}catch{return}},"detectVersion"),_=f(e=>{const r=I[e],a={available:!1,name:e},t=process.env[r.envVariable];if(t&&j(O(t))){const i=O(t);return{...a,available:!0,detectionMethod:"envvar",path:i,version:S(i)}}const n=[r.command,...r.alternateCommands];for(const i of n){const o=Fe(i);if(o)return{...a,available:!0,detectionMethod:"which",path:o,version:S(o)}}for(const i of n)for(const o of Be(i))if(j(o))return{...a,available:!0,detectionMethod:"known-path",path:o,version:S(o)};return a},"detectProvider"),De=f(()=>x.map(e=>_(e)),"detectAllProviders"),Je=f(()=>De().filter(e=>e.available),"detectAvailableProviders"),ze=f((e,r,a={})=>{const t=I[e],n=a.model??t.defaultModel,i=a.maxTokens!==void 0&&Number.isFinite(a.maxTokens)?a.maxTokens:ae;return t.buildArgs(r,n,i)},"buildCliArgs"),Ue=f(async(e,r,a={})=>{if(!e.available||!e.path)throw new Error(`AI provider "${e.name}" is not available.`);const t=ze(e.name,r,a),n=a.timeoutMs!==void 0&&Number.isFinite(a.timeoutMs)?a.timeoutMs:te;return new Promise((i,o)=>{const p={env:{...process.env,FORCE_COLOR:"0",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]},s=J(e.path,t,p);s.stdin.end();let c="",d="",u=!1,y;const C=setTimeout(()=>{u=!0,s.kill("SIGTERM"),y=setTimeout(()=>s.kill("SIGKILL"),5e3),o(new Error(`${e.name} CLI timed out after ${String(n)}ms`))},n);s.stdout.on("data",h=>{c+=h.toString("utf8")}),s.stderr.on("data",h=>{d+=h.toString("utf8")}),s.on("close",h=>{clearTimeout(C),clearTimeout(y),!u&&(h===0?i({provider:e.name,stderr:d,stdout:c}):o(new Error(`${e.name} CLI exited with code ${String(h)}: ${d||c}`)))}),s.on("error",h=>{clearTimeout(C),clearTimeout(y),u||o(new Error(`Failed to spawn ${e.name} CLI: ${h.message}`))})})},"runProvider");var We=Object.defineProperty,N=k((e,r)=>We(e,"name",{value:r,configurable:!0}),"i");const Ke=12e4,Ge=2,Ye=1e3,Xe=N(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),L=N(async(e,r,a=Ge)=>{let t;for(let n=0;n<=a;n+=1)try{return(await Ue(e,r,{timeoutMs:Ke})).stdout}catch(i){if(t=i instanceof Error?i:new Error(String(i)),t.message.includes("timed out"))throw t;if(n<a){const o=Ye*2**n;await Xe(o)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var Qe=Object.defineProperty,l=k((e,r)=>Qe(e,"name",{value:r,configurable:!0}),"c");const Ze={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},er=l(e=>{if(e?.provider){if(!x.includes(e.provider))return;const t=_(e.provider);return t.available?t:void 0}const r=Je();if(r.length===0)return;const a={...Ze,...e?.priority};return r.toSorted((t,n)=>(a[n.name]??0)-(a[t.name]??0))[0]},"resolveProvider"),rr=new Set(["defer","review","skip","update"]),tr=new Set(["critical","high","low","medium"]),ar=new Set(["high","low","medium"]),nr=50,P=30,ir=l(e=>e.map(r=>{const a=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(n=>`${n.severity} ${n.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const n=Math.round(r.socketReport.score.overall*100),i=[`score:${String(n)}%`];if(r.socketReport.alerts.length>0){const o={};for(const s of r.socketReport.alerts)o[s.severity]=(o[s.severity]??0)+1;const p=Object.entries(o).map(([s,c])=>`${String(c)} ${s}`).join(", ");i.push(`alerts: ${p}`)}i.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${a}${t}`}).join(`
3
3
  `),"buildPackageList"),A=`Respond ONLY with valid JSON in this exact structure:
4
4
  {
@@ -1,4 +1,4 @@
1
- var F=Object.defineProperty;var f=(e,t)=>F(e,"name",{value:t,configurable:!0});import{createRequire as O}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-34Wl3npC.js";import{E as j,F as D,a9 as y,aa as _,ab as N,ac as R,ad as A,ae as E}from"../packem_chunks/bin.js";import{a as $,C as b,M as H,z as W}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{w as q,b as L,r as Y}from"./ai-analysis-KP8b5lc0.js";const C=O(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=f(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,a]=l.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return l.getBuiltinModule(e)}return C(e)},"__cjs_getBuiltinModule"),{readFile:B,writeFile:M}=I("node:fs/promises");var z=Object.defineProperty,m=f((e,t)=>z(e,"name",{value:t,configurable:!0}),"u");const J=32*1024,K=m((e,t)=>{if(e.length<=t)return e;const a=e.slice(-t),o=e.length-a.length;return`[…${String(o)} bytes truncated from head…]
1
+ var F=Object.defineProperty;var f=(e,t)=>F(e,"name",{value:t,configurable:!0});import{createRequire as O}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-Dxafk3t4.js";import{F as j,H as D,ab as y,ac as _,ad as N,ae as R,af as A,ag as B}from"../packem_chunks/bin.js";import{a as $,C as b,M as H,z as W}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{w as q,b as L,r as Y}from"./ai-analysis-3QD_RS6F.js";const C=O(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=f(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,a]=l.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return l.getBuiltinModule(e)}return C(e)},"__cjs_getBuiltinModule"),{readFile:E,writeFile:M}=I("node:fs/promises");var z=Object.defineProperty,m=f((e,t)=>z(e,"name",{value:t,configurable:!0}),"u");const J=32*1024,K=m((e,t)=>{if(e.length<=t)return e;const a=e.slice(-t),o=e.length-a.length;return`[…${String(o)} bytes truncated from head…]
2
2
  ${a}`},"truncateHead"),U=m(async(e,t)=>t===void 0?T(e,{dataDirectory:j(e)}):D(e,t),"loadSummary"),ge=m(async(e,t,a={})=>{const o=a.terminalOutputLimit??J,[r,n]=await Promise.all([k(e,t),U(e,a.runId)]),i=n?y(n,t):void 0;if(!r&&!i)return;let s,c;if(n&&i){const d=await _(e,n.id),g=d?y(d,t):void 0;s=N(i.hashDetails,g?.hashDetails),c=d?.id}const h=r?.terminalOutput??"";return{command:r?.command??void 0,cwd:r?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:r?.exitCode??i?.exitCode,hash:i?.hash??r?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:n?.id??r?.runId,status:r?.status??(i?G(i):void 0),target:i?.target.target,taskId:t,terminalOutput:K(h,o),terminalOutputCaptured:!!r,timestamp:r?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),G=m(e=>{if(e.exitCode!==void 0&&e.exitCode!==0)return"failure";switch(e.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return e.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var V=Object.defineProperty,u=f((e,t)=>V(e,"name",{value:t,configurable:!0}),"a");const Q=3600*1e3,S=80,X=new Set(["high","low","medium"]),Z=u(()=>`You are an expert software engineer helping fix a failing build/test/lint task.
3
3
 
4
4
  You will be given:
@@ -39,5 +39,5 @@ ${a.join(`
39
39
  ${te(e)}`,"buildFixPrompt"),ie=u((e,t)=>{const a=Array.isArray(e.patches)?e.patches:[],o=[];for(const n of a)typeof n.file!="string"||n.file.length===0||typeof n.oldString!="string"||n.oldString.length===0||typeof n.newString=="string"&&o.push({file:n.file,newString:n.newString,oldString:n.oldString,reason:typeof n.reason=="string"&&n.reason.length>0?n.reason:void 0});const r=typeof e.cannotFix=="string"&&e.cannotFix.length>0?e.cannotFix:void 0;return{cannotFix:r,confidence:X.has(e.confidence)?e.confidence:"low",explanation:typeof e.explanation=="string"?e.explanation:"",patches:r?[]:o,provider:t}},"normalizeFixProposal"),ne=u((e,t)=>{const a=q(e);return!a||typeof a!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:t}:ie(a,t)},"parseFixResponse"),re=u((e,t)=>R({cwd:t.cwd??null,flow:"ai-fix",hash:t.hash??null,provider:e,taskId:t.taskId,terminalOutput:t.terminalOutput,terminalOutputCaptured:t.terminalOutputCaptured}),"buildFixCacheKey"),ve=u(async(e,t,a={})=>{const o=L(a.config);if(!o){t.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
40
40
  `);return}const r=a.cache!==!1,n=re(o.name,e);if(r){const i=A(n);if(i)return t.info(`Using cached fix proposal from ${i.provider}.
41
41
  `),i}t.info(`Generating fix proposal with ${o.name}...
42
- `);try{const i=await Y(o,ae(e)),s=ne(i,o.name);return r&&s.patches.length>0&&!s.cannotFix&&E(n,s,Q),s}catch(i){const s=i instanceof Error?i.message:String(i);t.warn(`AI fix proposal failed (${s}).
43
- `);return}},"runFixAnalysis"),se=u((e,t,a)=>$(a)?b(a):b(H(t??e,a)),"resolvePatchPath"),oe=u((e,t)=>{const a=W(e,t);return a===""?!0:!a.startsWith("..")&&!$(a)},"isInsideWorkspace"),ce=u((e,t,a)=>{const o=e.indexOf(t),r=Math.max(0,o-S),n=Math.min(e.length,o+t.length+S),i=e.slice(r,n);return{previewAfter:`${e.slice(r,o)}${a}${e.slice(o+t.length,n)}`,previewBefore:i}},"buildPreview"),xe=u(async(e,t,a,o={})=>{const r=o.dryRun===!0,n=new Map,i=[];for(const s of a.patches){const c=se(e,t,s.file);if(!oe(e,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let h=n.get(c);if(h===void 0){try{h=await B(c,"utf8")}catch(p){const w=p.code;i.push({absolutePath:c,error:w==="ENOENT"?void 0:p.message,patch:s,status:w==="ENOENT"?"missing-file":"error"});continue}n.set(c,h)}const d=h.indexOf(s.oldString);if(d===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(h.indexOf(s.oldString,d+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:P}=ce(h,s.oldString,s.newString),x=`${h.slice(0,d)}${s.newString}${h.slice(d+s.oldString.length)}`;if(!r)try{await M(c,x,"utf8")}catch(p){n.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}n.set(c,x),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:P,status:"applied"})}return i},"applyFixProposal");export{ge as a,ve as b,xe as c,se as r};
42
+ `);try{const i=await Y(o,ae(e)),s=ne(i,o.name);return r&&s.patches.length>0&&!s.cannotFix&&B(n,s,Q),s}catch(i){const s=i instanceof Error?i.message:String(i);t.warn(`AI fix proposal failed (${s}).
43
+ `);return}},"runFixAnalysis"),se=u((e,t,a)=>$(a)?b(a):b(H(t??e,a)),"resolvePatchPath"),oe=u((e,t)=>{const a=W(e,t);return a===""?!0:!a.startsWith("..")&&!$(a)},"isInsideWorkspace"),ce=u((e,t,a)=>{const o=e.indexOf(t),r=Math.max(0,o-S),n=Math.min(e.length,o+t.length+S),i=e.slice(r,n);return{previewAfter:`${e.slice(r,o)}${a}${e.slice(o+t.length,n)}`,previewBefore:i}},"buildPreview"),xe=u(async(e,t,a,o={})=>{const r=o.dryRun===!0,n=new Map,i=[];for(const s of a.patches){const c=se(e,t,s.file);if(!oe(e,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let h=n.get(c);if(h===void 0){try{h=await E(c,"utf8")}catch(p){const w=p.code;i.push({absolutePath:c,error:w==="ENOENT"?void 0:p.message,patch:s,status:w==="ENOENT"?"missing-file":"error"});continue}n.set(c,h)}const d=h.indexOf(s.oldString);if(d===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(h.indexOf(s.oldString,d+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:P}=ce(h,s.oldString,s.newString),x=`${h.slice(0,d)}${s.newString}${h.slice(d+s.oldString.length)}`;if(!r)try{await M(c,x,"utf8")}catch(p){n.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}n.set(c,x),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:P,status:"applied"})}return i},"applyFixProposal");export{ge as a,ve as b,xe as c,se as r};
@@ -1,4 +1,4 @@
1
- var de=Object.defineProperty;var w=(e,n)=>de(e,"name",{value:n,configurable:!0});import{createRequire as he}from"node:module";import{s as ie}from"../packem_chunks/config.js";import{M as B,B as _e}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{r as be}from"./docker-EJiTY0Sz.js";import{e as $e}from"./license-zZU7aavK.js";import{S as Oe}from"./lockfile-CrT86D6d.js";import{x as ke}from"./pm-runner-DmKT2FqF.js";const ge=he(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ae=w(e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[n,t]=W.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return W.getBuiltinModule(e)}return ge(e)},"__cjs_getBuiltinModule"),{randomUUID:ye}=ae("node:crypto"),{readdirSync:ve}=ae("node:fs");var je=Object.defineProperty,pe=w((e,n)=>je(e,"name",{value:n,configurable:!0}),"r$1");const z=pe(e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),"encodeSegment"),M=pe((e,n)=>{const t=e.toLowerCase();if(t.startsWith("@")){const o=t.indexOf("/");if(o>0){const r=t.slice(0,o),p=t.slice(o+1);return`pkg:npm/${z(r)}/${z(p)}@${z(n)}`}}return`pkg:npm/${z(t)}@${z(n)}`},"toNpmPurl");var Se=Object.defineProperty,j=w((e,n)=>Se(e,"name",{value:n,configurable:!0}),"a");const m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},Te=[m.STRING,m.NUMBER,m.BOOLEAN],Ae='<?xml version="1.0" encoding="UTF-8"?>',se=["_selfCloseTag","_attrs"],xe=j((e="",n=0)=>e.repeat(n),"getIndentStr"),Q=j(e=>Array.isArray(e)&&m.ARRAY||typeof e===m.OBJECT&&e!==null&&e._name&&m.JSTOXML_OBJECT||e instanceof Date&&m.DATE||e===null&&m.NULL||typeof e,"getType"),le=j(e=>e.startsWith("<![CDATA["),"isCDATA"),ue=j((e="",n={},t)=>{let o=e;if(typeof e===m.STRING){if(le(e))return e;const r=new RegExp(`(${Object.keys(n).join("|")})(?!(\\w|#)*;)`,"g");o=String(e).replace(r,(p,g)=>n[g]||"")}return typeof t=="function"?t(o):o},"mapStr"),Ce=j((e={},n,t,o)=>(Array.isArray(e)?e:Object.entries(e).map(([r,p])=>({[r]:p}))).reduce((r,p)=>{const g=Object.keys(p)[0],y=p[g];if(typeof t===m.FUNCTION&&t(g,y))return r;const b=n?ue(y,n):y,$=!o&&b===!0?"":`="${b}"`;return r.push(`${g}${$}`),r},[]),"getAttributeKeyVals"),Ne=j((e={},n,t,o)=>{const r=Ce(e,n,t,o);return r.length===0?"":` ${r.join(" ")}`},"formatAttributes"),Re=j((e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),"objToArray"),we=j(e=>Te.includes(Q(e)),"isPrimitive"),Pe=j(e=>!e.match("<"),"isSimpleXML"),De=j(({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?Ae:e:"","getHeaderString"),re={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;"},X=j((e={},n={})=>{const{depth:t=0,indent:o,_isFirstItem:r,_isOutputStart:p=!0,header:g,attributeReplacements:y={},attributeFilter:b,attributeExplicitTrue:$=!1,contentReplacements:q={},contentMap:L,selfCloseTags:I=!0}=n,H=typeof y=="boolean"&&!y?{}:{...re,...y},Y=typeof q=="boolean"&&!q?{}:{...re,...q},P=typeof o=="string",T=xe(o,t),G=Q(e),U=De({header:g,indent:o,depth:t,isOutputStart:p}),D=p&&!U&&r&&t===0,E=P&&!D?`
1
+ var de=Object.defineProperty;var w=(e,n)=>de(e,"name",{value:n,configurable:!0});import{createRequire as he}from"node:module";import{s as ie}from"../packem_chunks/config.js";import{M as B,B as _e}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{r as be}from"./docker-EJiTY0Sz.js";import{e as $e}from"./license-zZU7aavK.js";import{S as Oe}from"./lockfile-CedmXr44.js";import{x as ke}from"./pm-runner-DmKT2FqF.js";const ge=he(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ae=w(e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[n,t]=W.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return W.getBuiltinModule(e)}return ge(e)},"__cjs_getBuiltinModule"),{randomUUID:ye}=ae("node:crypto"),{readdirSync:ve}=ae("node:fs");var je=Object.defineProperty,pe=w((e,n)=>je(e,"name",{value:n,configurable:!0}),"r$1");const z=pe(e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),"encodeSegment"),M=pe((e,n)=>{const t=e.toLowerCase();if(t.startsWith("@")){const o=t.indexOf("/");if(o>0){const r=t.slice(0,o),p=t.slice(o+1);return`pkg:npm/${z(r)}/${z(p)}@${z(n)}`}}return`pkg:npm/${z(t)}@${z(n)}`},"toNpmPurl");var Se=Object.defineProperty,j=w((e,n)=>Se(e,"name",{value:n,configurable:!0}),"a");const m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},Te=[m.STRING,m.NUMBER,m.BOOLEAN],Ae='<?xml version="1.0" encoding="UTF-8"?>',se=["_selfCloseTag","_attrs"],xe=j((e="",n=0)=>e.repeat(n),"getIndentStr"),Q=j(e=>Array.isArray(e)&&m.ARRAY||typeof e===m.OBJECT&&e!==null&&e._name&&m.JSTOXML_OBJECT||e instanceof Date&&m.DATE||e===null&&m.NULL||typeof e,"getType"),le=j(e=>e.startsWith("<![CDATA["),"isCDATA"),ue=j((e="",n={},t)=>{let o=e;if(typeof e===m.STRING){if(le(e))return e;const r=new RegExp(`(${Object.keys(n).join("|")})(?!(\\w|#)*;)`,"g");o=String(e).replace(r,(p,g)=>n[g]||"")}return typeof t=="function"?t(o):o},"mapStr"),Ce=j((e={},n,t,o)=>(Array.isArray(e)?e:Object.entries(e).map(([r,p])=>({[r]:p}))).reduce((r,p)=>{const g=Object.keys(p)[0],y=p[g];if(typeof t===m.FUNCTION&&t(g,y))return r;const b=n?ue(y,n):y,$=!o&&b===!0?"":`="${b}"`;return r.push(`${g}${$}`),r},[]),"getAttributeKeyVals"),Ne=j((e={},n,t,o)=>{const r=Ce(e,n,t,o);return r.length===0?"":` ${r.join(" ")}`},"formatAttributes"),Re=j((e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),"objToArray"),we=j(e=>Te.includes(Q(e)),"isPrimitive"),Pe=j(e=>!e.match("<"),"isSimpleXML"),De=j(({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?Ae:e:"","getHeaderString"),re={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;"},X=j((e={},n={})=>{const{depth:t=0,indent:o,_isFirstItem:r,_isOutputStart:p=!0,header:g,attributeReplacements:y={},attributeFilter:b,attributeExplicitTrue:$=!1,contentReplacements:q={},contentMap:L,selfCloseTags:I=!0}=n,H=typeof y=="boolean"&&!y?{}:{...re,...y},Y=typeof q=="boolean"&&!q?{}:{...re,...q},P=typeof o=="string",T=xe(o,t),G=Q(e),U=De({header:g,indent:o,depth:t,isOutputStart:p}),D=p&&!U&&r&&t===0,E=P&&!D?`
2
2
  `:"";let v="";switch(G){case m.JSTOXML_OBJECT:{const{_name:f,_content:l}=e;if(l===null&&typeof L!="function"){v=`${E}${T}${f}`;break}if(Array.isArray(l)&&l.every(we))return l.map(S=>X({_name:f,_content:S},{...n,depth:t,_isOutputStart:!1})).join("");if(se.includes(f))break;const _=X(l,{...n,depth:t+1,_isOutputStart:D}),N=Q(_),O=Pe(_),k=le(_),R=`${E}${T}`;if(f==="_comment"){v+=`${R}<!-- ${l} -->`;break}const K=N==="undefined"||_==="",c=I,s=e._selfCloseTag,i=typeof s===m.BOOLEAN?K&&s:K&&c,a=i?"/":"",u=Ne(e._attrs,H,b,$),d=`<${f}${u}${a}>`,A=P&&!O&&!k?`
3
3
  ${T}`:"",x=i?"":`${_}${A}</${f}>`;v+=`${R}${d}${x}`;break}case m.OBJECT:{const f=Object.keys(e);v=f.map((l,_)=>{const N={...n,_isFirstItem:_===0,_isLastItem:_+1===f.length,_isOutputStart:D},O={_name:l};if(Q(e[l])===m.OBJECT&&(se.forEach(k=>{const R=e[l][k];typeof R<"u"&&(O[k]=R,delete e[l][k])}),typeof e[l]._content<"u"&&Object.keys(e[l]).length>1)){const k=Object.assign({},e[l]);delete k._content,O._content=[...Re(k),e[l]._content]}return typeof O._content>"u"&&(O._content=e[l]),X(O,N)},n).join("");break}case m.FUNCTION:{const f=e(n);v=X(f,n);break}case m.ARRAY:{v=e.map((f,l)=>{const _={...n,_isFirstItem:l===0,_isLastItem:l+1===e.length,_isOutputStart:D};return X(f,_)}).join("");break}default:{v=ue(e,Y,L);break}}return`${U}${v}`},"toXML");var Ee=Object.defineProperty,F=w((e,n)=>Ee(e,"name",{value:n,configurable:!0}),"r");const te=F(e=>{try{return ie(e)}catch{return}},"readJsonSafe"),Me=F(e=>{if(e.length===0||e.includes("..")||e.startsWith(".")||e.includes("\0")||e.includes("\\"))return!1;if(e.startsWith("@")){const n=e.indexOf("/");return n>1&&!e.includes("/",n+1)}return!e.includes("/")},"isSafePackageName"),Be=F(e=>e.length>0&&!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&!e.includes("\0"),"isSafeVersion"),Le=F((e,n,t)=>{const o=`${n.replaceAll("/","+")}@${t}`,r=B(e,"node_modules",".pnpm"),p=te(B(r,o,"node_modules",n,"package.json"));if(p)return p;let g;try{g=ve(r)}catch{return}const y=`${o}_`;for(const b of g){if(!b.startsWith(y))continue;const $=te(B(r,b,"node_modules",n,"package.json"));if($)return $}},"readPnpmVirtualStore"),Ie=F((e,n,t)=>{const o=te(B(e,"node_modules",n,"package.json"));return o?.version===t?o:void 0},"readHoistedCopy"),Ue=F((e,n,t)=>{if(!(!Me(n)||!Be(t)))return Le(e,n,t)??Ie(e,n,t)},"readInstalledPackageMetadata");var Je=Object.defineProperty,me=w((e,n)=>Je(e,"name",{value:n,configurable:!0}),"t");const Xe={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"},Fe={sha256:64,sha384:96,sha512:128},qe=me(e=>{const n={name:e.name,version:e.version},{integrity:t}=e;return t&&t.hex.length===Fe[t.algorithm]&&(n.hash={alg:Xe[t.algorithm],content:t.hex}),e.dependencies&&(n.dependencies=e.dependencies),e.peerDependencies&&(n.peerDependencies=e.peerDependencies),e.optionalDependencies&&(n.optionalDependencies=e.optionalDependencies),n},"toResolvedPackage"),He=[{file:"pnpm-lock.yaml",type:"pnpm"},{file:"npm-shrinkwrap.json",type:"npm"},{file:"package-lock.json",type:"npm"},{file:"yarn.lock",type:"yarn"},{file:"bun.lock",type:"bun"}],Ve=me(e=>{for(const{file:n,type:t}of He){let o;try{o=_e(B(e,n))}catch{continue}const r=new Map;for(const p of Oe(o,t))r.set(`${p.name}@${p.version}`,qe(p));return{packages:r,type:t}}},"readLockfilePackages");var We=Object.defineProperty,fe=w((e,n)=>We(e,"name",{value:n,configurable:!0}),"s");const ze=fe(e=>{const n=e.indexOf(":");return n<=0?e:e.slice(0,n)==="npm"?e.slice(n+1):e},"stripProtocolPrefix"),ee=fe((e,n,t)=>{const o=t.get(e);if(!o||o.size===0)return;if(o.has(n))return n;const r=ze(n);if(r!==n&&o.has(r))return r;const p=[...o];return ke.maxSatisfying(p,r,{includePrerelease:!0})||p[0]},"resolveSpecifier");var Ye=Object.defineProperty,h=w((e,n)=>Ye(e,"name",{value:n,configurable:!0}),"p");const Ge="1.7",Ke="CycloneDX",Qe="http://cyclonedx.org/schema/bom-1.7.schema.json",Ze="@visulima/vis",ce=h(e=>{try{return ie(e)}catch{return}},"readPackageJson"),en=h(e=>{if(e){if(typeof e=="string")return e;if(typeof e=="object"&&e.name)return e.email?`${e.name} <${e.email}>`:e.name}},"toAuthorString"),nn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toRepositoryUrl"),tn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toBugsUrl"),on=h(e=>{const n=[];e.homepage&&n.push({type:"website",url:e.homepage});const t=nn(e.repository);t&&n.push({type:"vcs",url:t});const o=tn(e.bugs);return o&&n.push({type:"issue-tracker",url:o}),n.length>0?n:void 0},"buildExternalReferences"),sn=h(e=>e==="application"||e==="service"||e==="tool"?"application":"library","toCycloneDxComponentType"),ne=h((e,n)=>{if(!n)return;n.description&&(e.description=n.description);const t=en(n.author);t&&(e.author=t);const o=$e(n);o&&(e.licenses=o);const r=on(n);r&&(e.externalReferences=r)},"decoratePackageComponent"),yn=h(e=>{const{focus:n,generatorVersion:t,includeDev:o=!1,now:r=new Date,projectGraph:p,serialNumber:g,workspace:y,workspaceRoot:b}=e,$=n&&n.length>0?[...be(n,p)].sort():Object.keys(y.projects).sort(),q=new Set($),L=new Map;for(const c of $){const s=y.projects[c];s&&L.set(c,ce(B(b,s.root,"package.json")))}const I=[],H=new Map;for(const c of $){const s=y.projects[c];if(!s)continue;const i=L.get(c),a=i?.version??"0.0.0",u=M(c,a);H.set(c,u);const d={"bom-ref":u,name:c,purl:u,type:sn(s.projectType),version:a};ne(d,i),I.push(d)}const Y=Ve(b),P=new Map,T=new Map;if(Y)for(const c of Y.packages.values()){P.set(`${c.name}@${c.version}`,c);let s=T.get(c.name);s||(s=new Set,T.set(c.name,s)),s.add(c.version)}const G=[],U=[],D=new Map;for(const c of $){const s=L.get(c);if(!s)continue;const i=[s.dependencies,s.peerDependencies];o&&i.push(s.devDependencies);const a=new Set,u=h((d,A)=>{if(A)for(const[x,S]of Object.entries(A)){if(q.has(x)){const J=H.get(x);J&&a.add(J);continue}const C=ee(x,S,T);C&&(a.add(M(x,C)),d.push(`${x}@${C}`))}},"seedRef");for(const d of i)u(G,d);u(U,s.optionalDependencies),D.set(c,a)}const E=new Map,v=new Map,f=h((c,s)=>{const i=[...c];for(;i.length>0;){const a=i.pop(),u=E.get(a);if(u==="required"||u==="optional"&&s==="optional")continue;E.set(a,s);const d=P.get(a);if(!d)continue;const A=v.get(a)??new Set,x=[d.dependencies,d.peerDependencies];for(const S of x)if(S)for(const[C,J]of Object.entries(S))for(const V of J){const Z=ee(C,V,T);Z&&(A.add(M(C,Z)),i.push(`${C}@${Z}`))}if(d.optionalDependencies)for(const[S,C]of Object.entries(d.optionalDependencies))for(const J of C){const V=ee(S,J,T);V&&(A.add(M(S,V)),U.push(`${S}@${V}`))}A.size>0&&v.set(a,A)}},"walk");f(G,"required"),f(U,"optional");const l=[],_=[...E.keys()].sort();for(const c of _){const s=P.get(c);if(!s)continue;const i=M(s.name,s.version),a={"bom-ref":i,name:s.name,purl:i,scope:E.get(c)??"required",type:"library",version:s.version};s.hash&&(a.hashes=[s.hash]),ne(a,Ue(b,s.name,s.version)),l.push(a)}const N=[];for(const[c,s]of D){const i=H.get(c);if(!i)continue;const a=[...s].sort();N.push(a.length>0?{dependsOn:a,ref:i}:{ref:i})}for(const c of _){const s=P.get(c);if(!s)continue;const i=M(s.name,s.version),a=v.get(c),u=a?[...a].sort():[];N.push(u.length>0?{dependsOn:u,ref:i}:{ref:i})}N.sort((c,s)=>c.ref.localeCompare(s.ref));const O=ce(B(b,"package.json")),k=(()=>{if(n?.length===1){const u=I.find(d=>d.name===n[0]);if(u)return{"bom-ref":u["bom-ref"],name:u.name,purl:u.purl,type:u.type,version:u.version}}const c=O?.name??"workspace",s=O?.version??"0.0.0",i=M(c,s),a={"bom-ref":i,name:c,purl:i,type:"application",version:s};return ne(a,O),a})(),R=k["bom-ref"],K=R?I.filter(c=>c["bom-ref"]!==R):I;return{$schema:Qe,bomFormat:Ke,components:[...K,...l],dependencies:N,metadata:{component:k,lifecycles:[{phase:"build"}],timestamp:r.toISOString(),tools:{components:[{name:Ze,type:"application",...t?{version:t}:{}}]}},serialNumber:g??`urn:uuid:${ye()}`,specVersion:Ge,version:1}},"buildCycloneDxBom"),_n=h(e=>{const n={version:e.version??1,xmlns:"http://cyclonedx.org/schema/bom/1.7"};e.serialNumber&&(n.serialNumber=e.serialNumber);const t=[];return e.metadata&&t.push(rn(e.metadata)),e.components&&e.components.length>0&&t.push({_content:e.components.map(o=>oe(o)),_name:"components"}),e.dependencies&&e.dependencies.length>0&&t.push({_content:e.dependencies.map(o=>an(o)),_name:"dependencies"}),`${X({_attrs:n,_content:t,_name:"bom"},{header:!0,indent:" ",selfCloseTags:!0})}
4
4
  `},"serializeBomToXml"),rn=h(e=>{const n=[];return e.timestamp&&n.push({timestamp:e.timestamp}),e.lifecycles&&e.lifecycles.length>0&&n.push({_content:e.lifecycles.map(t=>{const o=[];return t.phase&&o.push({phase:t.phase}),t.name&&o.push({name:t.name}),t.description&&o.push({description:t.description}),{_content:o,_name:"lifecycle"}}),_name:"lifecycles"}),e.tools?.components&&n.push({_content:[{_content:e.tools.components.map(t=>oe(t)),_name:"components"}],_name:"tools"}),e.component&&n.push(oe(e.component)),{_content:n,_name:"metadata"}},"metadataToXmlElement"),oe=h(e=>{const n={type:e.type};e["bom-ref"]&&(n["bom-ref"]=e["bom-ref"]);const t=[];e.group&&t.push({group:e.group}),t.push({name:e.name}),e.version&&t.push({version:e.version}),e.description&&t.push({description:e.description}),e.author&&t.push({author:e.author}),e.hashes&&e.hashes.length>0&&t.push({_content:e.hashes.map(r=>({_attrs:{alg:r.alg},_content:r.content,_name:"hash"})),_name:"hashes"});const o=cn(e.licenses);return o&&t.push(o),e.purl&&t.push({purl:e.purl}),e.scope&&t.push({scope:e.scope}),e.externalReferences&&e.externalReferences.length>0&&t.push({_content:e.externalReferences.map(r=>({_attrs:{type:r.type},_content:[{url:r.url}],_name:"reference"})),_name:"externalReferences"}),{_attrs:n,_content:t,_name:"component"}},"componentToXmlElement"),cn=h(e=>{if(!e||e.length===0)return;const n=[];for(const t of e){if("expression"in t){n.push({expression:t.expression});continue}const o=[];"id"in t.license&&t.license.id?o.push({id:t.license.id}):"name"in t.license&&t.license.name&&o.push({name:t.license.name}),n.push({_content:o,_name:"license"})}return{_content:n,_name:"licenses"}},"licensesToXmlElement"),an=h(e=>e.dependsOn&&e.dependsOn.length>0?{_attrs:{ref:e.ref},_content:e.dependsOn.map(n=>({_attrs:{ref:n},_name:"dependency"})),_name:"dependency"}:{_attrs:{ref:e.ref},_name:"dependency"},"dependencyToXmlElement");export{yn as b,_n as s,M as t};
@@ -1 +1 @@
1
- var D=Object.defineProperty;var y=(o,t)=>D(o,"name",{value:t,configurable:!0});import{l as w,M as u,B as d}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{S as h}from"./lockfile-CrT86D6d.js";import{V as S,t as b}from"../packem_chunks/bin.js";var j=Object.defineProperty,l=y((o,t)=>j(o,"name",{value:t,configurable:!0}),"f");const L={bun:{file:"bun.lock",type:"bun"},npm:{aliases:["npm-shrinkwrap.json"],file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},O=l(o=>{const t=L[o];return t?[...t.aliases??[],t.file].map(e=>({file:e,type:t.type})):[]},"lockfileCandidates"),m=l((o,t)=>{const e=O(t);if(e.length!==0)return e.find(r=>w(u(o,r.file)))??e[e.length-1]},"resolveLockfile"),g=l(o=>{try{return JSON.parse(d(o))}catch{return}},"readPackageJsonShape"),v=l(o=>{const t=[],e=g(u(o,"package.json"));e&&t.push(e);const r=S(o);let c;if(r?c=r:e?.workspaces&&(Array.isArray(e.workspaces)?c=e.workspaces:e.workspaces.packages&&(c=e.workspaces.packages)),!c)return t;const a=b(o,c);for(const s of a){const n=g(u(o,s,"package.json"));n&&t.push(n)}return t},"collectWorkspacePackageJsons"),P=l((o,t)=>{const e=new Set,r=[],c=new Map;for(const s of t){const n=c.get(s.name);n?n.push(s):c.set(s.name,[s])}const a=l(s=>{if(s)for(const n of Object.keys(s))e.has(n)||(e.add(n),r.push(n))},"enqueueRoots");for(const s of v(o))a(s.dependencies),a(s.peerDependencies),a(s.optionalDependencies);for(;r.length>0;){const s=r.shift(),n=c.get(s);if(n){for(const i of n)for(const p of[i.dependencies,i.peerDependencies,i.optionalDependencies])if(p)for(const f of Object.keys(p))e.has(f)||(e.add(f),r.push(f))}}return e},"computeProdReachable"),C=l((o,t,e={})=>{const r=m(o,t);if(!r)return[];let c;try{c=d(u(o,r.file))}catch{return[]}const a=h(c,r.type);if(a.length===0)return[];const s=e.includeDev??!0?void 0:P(o,a),n=new Set,i=[];for(const p of a){if(s&&!s.has(p.name))continue;const f=`${p.name}@${p.version}`;n.has(f)||(n.add(f),i.push({isDev:!1,name:p.name,version:p.version}))}return i},"lockedPackages"),E=l((o,t)=>{const e=m(o,t);if(!e)return[];let r;try{r=d(u(o,e.file))}catch{return[]}const c=h(r,e.type);if(c.length===0)return[];const a=new Map;for(const n of c)a.has(n.name)||a.set(n.name,new Set),a.get(n.name).add(n.version);const s=[];for(const[n,i]of a)i.size<=1||s.push({name:n,versions:[...i]});return s.sort((n,i)=>n.name.localeCompare(i.name))},"findDuplicateDependencies"),G=l((o,t)=>{const e=m(o,t);if(!e)return;let r;try{r=d(u(o,e.file))}catch{return}const c=h(r,e.type);if(c.length===0)return;const a=[],s=new Set;for(const n of v(o))for(const i of[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies])if(i)for(const[p,f]of Object.entries(i)){const k=`${p}@${f}`;s.has(k)||(s.add(k),a.push({name:p,version:f}))}return{entries:c,roots:a}},"loadLockfileGraph");export{L,G as a,E as f,C as l,m as r};
1
+ var D=Object.defineProperty;var y=(o,t)=>D(o,"name",{value:t,configurable:!0});import{l as w,M as u,B as d}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{S as h}from"./lockfile-CedmXr44.js";import{V as S,u as b}from"../packem_chunks/bin.js";var j=Object.defineProperty,l=y((o,t)=>j(o,"name",{value:t,configurable:!0}),"f");const L={bun:{file:"bun.lock",type:"bun"},npm:{aliases:["npm-shrinkwrap.json"],file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},O=l(o=>{const t=L[o];return t?[...t.aliases??[],t.file].map(e=>({file:e,type:t.type})):[]},"lockfileCandidates"),m=l((o,t)=>{const e=O(t);if(e.length!==0)return e.find(r=>w(u(o,r.file)))??e[e.length-1]},"resolveLockfile"),g=l(o=>{try{return JSON.parse(d(o))}catch{return}},"readPackageJsonShape"),v=l(o=>{const t=[],e=g(u(o,"package.json"));e&&t.push(e);const r=S(o);let c;if(r?c=r:e?.workspaces&&(Array.isArray(e.workspaces)?c=e.workspaces:e.workspaces.packages&&(c=e.workspaces.packages)),!c)return t;const a=b(o,c);for(const s of a){const n=g(u(o,s,"package.json"));n&&t.push(n)}return t},"collectWorkspacePackageJsons"),P=l((o,t)=>{const e=new Set,r=[],c=new Map;for(const s of t){const n=c.get(s.name);n?n.push(s):c.set(s.name,[s])}const a=l(s=>{if(s)for(const n of Object.keys(s))e.has(n)||(e.add(n),r.push(n))},"enqueueRoots");for(const s of v(o))a(s.dependencies),a(s.peerDependencies),a(s.optionalDependencies);for(;r.length>0;){const s=r.shift(),n=c.get(s);if(n){for(const i of n)for(const p of[i.dependencies,i.peerDependencies,i.optionalDependencies])if(p)for(const f of Object.keys(p))e.has(f)||(e.add(f),r.push(f))}}return e},"computeProdReachable"),C=l((o,t,e={})=>{const r=m(o,t);if(!r)return[];let c;try{c=d(u(o,r.file))}catch{return[]}const a=h(c,r.type);if(a.length===0)return[];const s=e.includeDev??!0?void 0:P(o,a),n=new Set,i=[];for(const p of a){if(s&&!s.has(p.name))continue;const f=`${p.name}@${p.version}`;n.has(f)||(n.add(f),i.push({isDev:!1,name:p.name,version:p.version}))}return i},"lockedPackages"),E=l((o,t)=>{const e=m(o,t);if(!e)return[];let r;try{r=d(u(o,e.file))}catch{return[]}const c=h(r,e.type);if(c.length===0)return[];const a=new Map;for(const n of c)a.has(n.name)||a.set(n.name,new Set),a.get(n.name).add(n.version);const s=[];for(const[n,i]of a)i.size<=1||s.push({name:n,versions:[...i]});return s.sort((n,i)=>n.name.localeCompare(i.name))},"findDuplicateDependencies"),G=l((o,t)=>{const e=m(o,t);if(!e)return;let r;try{r=d(u(o,e.file))}catch{return}const c=h(r,e.type);if(c.length===0)return;const a=[],s=new Set;for(const n of v(o))for(const i of[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies])if(i)for(const[p,f]of Object.entries(i)){const k=`${p}@${f}`;s.has(k)||(s.add(k),a.push({name:p,version:f}))}return{entries:c,roots:a}},"loadLockfileGraph");export{L,G as a,E as f,C as l,m as r};
@@ -1,2 +1,2 @@
1
- var m=Object.defineProperty;var a=(t,e)=>m(t,"name",{value:e,configurable:!0});import{createRequire as p}from"node:module";import{M as v}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{o as j}from"../packem_chunks/bin.js";const h=p(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=a(t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,r]=s.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return s.getBuiltinModule(t)}return h(t)},"__cjs_getBuiltinModule"),{mkdirSync:y,writeFileSync:F,readdirSync:L}=u("node:fs"),{readFile:_}=u("node:fs/promises");var S=Object.defineProperty,i=a((t,e)=>S(t,"name",{value:e,configurable:!0}),"i");const c=i(t=>j(t),"getFailureLogDirectory"),l=i((t,e)=>v(c(t),`${encodeURIComponent(e)}.json`),"getFailureLogPath");class R{static{a(this,"FailureLogLifeCycle")}static{i(this,"FailureLogLifeCycle")}#e;#t;constructor(e,r){this.#e=e,this.#t=r}printTaskTerminalOutput(e,r,o){if(r!=="failure")return;const n=c(this.#e);try{y(n,{recursive:!0})}catch{return}const d=e.overrides.command,f=e.projectRoot,g={command:d,cwd:f,exitCode:void 0,hash:e.hash,runId:this.#t,status:r,taskId:e.id,terminalOutput:o,timestamp:new Date().toISOString()};try{F(l(this.#e,e.id),`${JSON.stringify(g,void 0,2)}
2
- `,"utf8")}catch{}}}const T=i(async(t,e)=>{const r=l(t,e);try{const o=await _(r,"utf8");return JSON.parse(o)}catch{return}},"loadFailureLog"),w=i(t=>{const e=c(t);let r;try{r=L(e)}catch{return[]}const o=[];for(const n of r)if(n.endsWith(".json"))try{o.push(decodeURIComponent(n.slice(0,-5)))}catch{}return o},"listFailureLogs");export{R as F,T as a,w as l};
1
+ var m=Object.defineProperty;var a=(t,e)=>m(t,"name",{value:e,configurable:!0});import{createRequire as p}from"node:module";import{M as v}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{q as j}from"../packem_chunks/bin.js";const h=p(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=a(t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,r]=s.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return s.getBuiltinModule(t)}return h(t)},"__cjs_getBuiltinModule"),{mkdirSync:y,writeFileSync:F,readdirSync:L}=u("node:fs"),{readFile:_}=u("node:fs/promises");var S=Object.defineProperty,i=a((t,e)=>S(t,"name",{value:e,configurable:!0}),"i");const c=i(t=>j(t),"getFailureLogDirectory"),l=i((t,e)=>v(c(t),`${encodeURIComponent(e)}.json`),"getFailureLogPath");class R{static{a(this,"FailureLogLifeCycle")}static{i(this,"FailureLogLifeCycle")}#e;#t;constructor(e,r){this.#e=e,this.#t=r}printTaskTerminalOutput(e,r,o){if(r!=="failure")return;const n=c(this.#e);try{y(n,{recursive:!0})}catch{return}const d=e.overrides.command,f=e.projectRoot,g={command:d,cwd:f,exitCode:void 0,hash:e.hash,runId:this.#t,status:r,taskId:e.id,terminalOutput:o,timestamp:new Date().toISOString()};try{F(l(this.#e,e.id),`${JSON.stringify(g,void 0,2)}
2
+ `,"utf8")}catch{}}}const T=i(async(t,e)=>{const r=l(t,e);try{const o=await _(r,"utf8");return JSON.parse(o)}catch{return}},"loadFailureLog"),q=i(t=>{const e=c(t);let r;try{r=L(e)}catch{return[]}const o=[];for(const n of r)if(n.endsWith(".json"))try{o.push(decodeURIComponent(n.slice(0,-5)))}catch{}return o},"listFailureLogs");export{R as F,T as a,q as l};
@@ -0,0 +1 @@
1
+ var D=Object.defineProperty;var v=(t,e)=>D(t,"name",{value:e,configurable:!0});import{m as w,D as C,g as S,f as A}from"./provenance-Cu6VR1Hy.js";import{a1 as m}from"../packem_chunks/bin.js";import{x as W}from"./build-scripts-DE6U8jVq.js";import{n as b}from"./license-zZU7aavK.js";import{a as j,C as F,B as U}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{S as E}from"./lockfile-CedmXr44.js";import{L as N}from"./dependency-scan-B70azq4x.js";var I=Object.defineProperty,L=v((t,e)=>I(t,"name",{value:e,configurable:!0}),"i");const g={CRITICAL:0,HIGH:1,LOW:3,MODERATE:2,UNKNOWN:4},we=L((t,e)=>{const i=g[(t.vulnerability.severity??"UNKNOWN").toUpperCase()]??4,n=g[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??4;return i-n||t.packageName.localeCompare(e.packageName)||t.packageVersion.localeCompare(e.packageVersion)},"compareFindingsForDisplay"),M=L((t,e)=>{const i=g[e.toUpperCase()]??2;return(g[t.toUpperCase()]??4)<=i},"severityPassesFilter"),P=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"];var V=Object.defineProperty,R=v((t,e)=>V(t,"name",{value:e,configurable:!0}),"r");const $=6e4,_=R((t,e,i)=>{for(const n of i)if(n===t||n===`${t}@${e}`||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},"isExcluded"),T=R(async(t,e)=>{const i=e.security?.policies?.firstSeen;if(i?.minutes===void 0||i.minutes<=0)return[];const{minutes:n}=i,a=i.exclude??[],o=e.security?.acceptedRisks,c=n*$,s=Date.now();return(await w(t.packages,C,async r=>{if(_(r.name,r.version,a))return;const l=await S(r.name,{workspaceRoot:t.workspaceRoot});if(l===void 0)return;const p=l.time?.[r.version];if(p===void 0)return;const u=Date.parse(p);if(Number.isNaN(u))return;const f=s-u;if(f>=c)return;const k=Math.max(0,Math.floor(f/$));return{acceptedRisk:m(r.name,r.version,o,"firstSeen"),data:{ageMinutes:k,minimumMinutes:n,publishedAt:p},packageName:r.name,policy:"firstSeen",reason:`${r.name}@${r.version} was published ${String(k)} min ago — below the ${String(n)} min firstSeen cooldown.`,severity:"block",version:r.version}})).filter(r=>r!==void 0)},"evaluateFirstSeenPolicy");var K=Object.defineProperty,H=v((t,e)=>K(t,"name",{value:e,configurable:!0}),"n");const q=H((t,e)=>{const i=e.security?.policies?.installScripts;if(!i)return[];const n=i.allow??{},a=i.strict===!0;if(!a&&Object.keys(n).length===0)return[];const o=W(t.workspaceRoot,n,{pinVersions:e.security?.pinVersions===!0});if(o.unapproved.length===0)return[];const c=e.security?.acceptedRisks,s=a?"block":"warn";return o.unapproved.map(r=>({acceptedRisk:m(r.name,r.version??"*",c,"installScripts"),data:{hooks:r.hooks},packageName:r.name,policy:"installScripts",reason:`${r.name}${r.version?`@${r.version}`:""} declares unapproved build script(s): ${r.hooks.join(", ")}`,severity:s,version:r.version??"*"}))},"evaluateInstallScriptsPolicy");var z=Object.defineProperty,y=v((t,e)=>z(t,"name",{value:e,configurable:!0}),"a");const Y=new Set(["AND","OR"]),B=y(t=>{const e=t.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0),i=[];let n=!1;for(const a of e){const o=a.toUpperCase();if(n){n=!1;continue}if(o==="WITH"){n=!0;continue}if(Y.has(o))continue;const c=a.endsWith("+"),s=c?a.slice(0,-1):a,r=b(s)??s;i.push(r),c&&i.push(`${r}-or-later`)}return i},"extractSpdxLeaves"),G=y(t=>{if(typeof t.license=="string"){const e=t.license.trim();return e.length>0?e:void 0}if(t.license&&typeof t.license=="object"&&typeof t.license.type=="string"){const e=t.license.type.trim();if(e.length>0)return e}if(Array.isArray(t.licenses)&&t.licenses.length>0){const e=t.licenses.map(i=>i&&typeof i.type=="string"?i.type.trim():"").filter(i=>i.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},"declaredLicense"),J=y((t,e)=>{if(e.length===0)return;const i=new Set(e.map(n=>b(n)??n).map(n=>n.toLowerCase()));for(const n of t)if(i.has(n.toLowerCase()))return n},"findDeniedLeaf"),Q=y((t,e)=>{if(e.length===0)return;const i=new Set(e.map(n=>b(n)??n).map(n=>n.toLowerCase()));for(const n of t)if(!i.has(n.toLowerCase()))return n},"findUnallowedLeaf"),X=y((t,e)=>{const i=e.security?.policies?.license;if(!i)return[];const n=i.allow??[],a=i.deny??[];if(n.length===0&&a.length===0)return[];const o=e.security?.acceptedRisks,c=[];for(const s of t.packages){const r=t.manifestData?.get(`${s.name}@${s.version}`),l=r?G(r):void 0;if(!l){n.length>0&&c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{declaredLicense:null},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} declares no license; allow-list mode requires one of: ${n.join(", ")}`,severity:"block",version:s.version});continue}const p=B(l),u=J(p,a);if(u){c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:s.version});continue}const f=Q(p,n);f&&c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{allowList:n,declaredLicense:l,unallowedLicense:f},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} uses license '${f}' which is not on the allow-list (declared: ${l})`,severity:"block",version:s.version})}return c},"evaluateLicensePolicy");var Z=Object.defineProperty,O=v((t,e)=>Z(t,"name",{value:e,configurable:!0}),"c$1");const ee=6e4,te=O((t,e,i)=>{for(const n of i)if(n===t||n===`${t}@${e}`||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},"isExcluded"),ie=O(async(t,e)=>{const i=e.security?.policies?.publisherChange;if(i?.mode!=="no-downgrade")return[];const n=i.exclude??[],a=typeof i.ignoreAfter=="number"?i.ignoreAfter*ee:void 0,o=e.security?.acceptedRisks,c=Date.now();return(await w(t.packages,C,async s=>{if(te(s.name,s.version,n))return;const r=await S(s.name,{workspaceRoot:t.workspaceRoot});if(r===void 0)return;if(a!==void 0){const p=r.time?.[s.version],u=p===void 0?Number.NaN:Date.parse(p);if(!Number.isNaN(u)&&c-u>a)return}if(r.versions[s.version]?.dist?.attestations?.provenance!==void 0)return;const l=A(r,s.version);if(l!==void 0)return{acceptedRisk:m(s.name,s.version,o,"publisherChange"),data:{priorVersionWithProvenance:l},packageName:s.name,policy:"publisherChange",reason:`${s.name}@${s.version} dropped the provenance attestation that ${s.name}@${l} carried — publisher trust downgrade.`,severity:"block",version:s.version}})).filter(s=>s!==void 0)},"evaluatePublisherChangePolicy");var ne=Object.defineProperty,h=v((t,e)=>ne(t,"name",{value:e,configurable:!0}),"l$1");const se=h(t=>{for(const e of Object.values(N))for(const i of[e.file,...e.aliases??[]])if(t===i||t.endsWith(`/${i}`)||t.endsWith(`.${i}`))return e.type},"detectLockfileType"),re=h((t,e,i)=>{const n=j(e)?e:F(t,e);let a;try{a=U(n)}catch{return}const o=se(n)??N[i]?.type;if(!o)return;const c=E(a,o);if(c.length===0)return;const s=new Set;for(const r of c)s.add(`${r.name}@${r.version}`);return s},"loadBaselineKeys"),oe=h((t,e)=>{for(const i of e)if(i===t||i.endsWith("*")&&t.startsWith(i.slice(0,-1)))return!0;return!1},"matchesAllowList"),ae=h((t,e)=>{const i=e.security?.policies?.unexpectedDeps;if(!i)return[];const n=i.allow??[],a=i.baselineLockfile;if(n.length===0&&!a)return[];const o=a?re(t.workspaceRoot,a,t.packageManager):void 0,c=e.security?.acceptedRisks,s=[];for(const r of t.packages){const l=n.length===0||oe(r.name,n),p=o?o.has(`${r.name}@${r.version}`):!0;if(l&&p)continue;const u=[],f={};l||(u.push(`not on allow-list (${n.length} entr${n.length===1?"y":"ies"})`),f.allowList=n),!p&&o&&(u.push(`not present in baseline lockfile (${a})`),f.baselineLockfile=a),s.push({acceptedRisk:m(r.name,r.version,c,"unexpectedDeps"),data:f,packageName:r.name,policy:"unexpectedDeps",reason:`${r.name}@${r.version} is unexpected: ${u.join("; ")}`,severity:"block",version:r.version})}return s},"evaluateUnexpectedDepsPolicy");var ce=Object.defineProperty,le=v((t,e)=>ce(t,"name",{value:e,configurable:!0}),"c");const ue=le((t,e)=>{if(!t.osvFindings||t.osvFindings.size===0)return[];const i=e.security?.policies?.vulnerability?.failOn,n=e.security?.acceptedRisks,a=[];for(const o of t.packages){const c=t.osvFindings.get(o.name);if(!(!c||c.length===0))for(const s of c){const r=i?M(s.severity,i)?"block":"warn":"info";a.push({acceptedRisk:m(o.name,o.version,n,"vulnerability"),data:{advisoryId:s.id,aliases:s.aliases??[],cvssScore:s.cvssScore,fixedVersions:s.fixedVersions,severity:s.severity,summary:s.summary},packageName:o.name,policy:"vulnerability",reason:`${s.severity} ${s.id} affects ${o.name}@${o.version}: ${s.summary}`,severity:r,version:o.version})}}return a},"evaluateVulnerabilityPolicy");var pe=Object.defineProperty,d=v((t,e)=>pe(t,"name",{value:e,configurable:!0}),"t");const x=[{evaluate:ue,isConfigured:d(t=>t.security?.policies?.vulnerability!==void 0,"isConfigured"),name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:X,isConfigured:d(t=>{const e=t.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},"isConfigured"),name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:q,isConfigured:d(t=>{const e=t.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},"isConfigured"),name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:ae,isConfigured:d(t=>{const e=t.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},"isConfigured"),name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:T,isConfigured:d(t=>{const e=t.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},"isConfigured"),name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:ie,isConfigured:d(t=>t.security?.policies?.publisherChange?.mode==="no-downgrade","isConfigured"),name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],fe=d((t,e,i)=>x.filter(n=>n.surfaces.includes(t)?i!==void 0?i.has(n.name):n.isConfigured(e):!1),"selectModules"),Ce=d(async(t,e,i)=>{const n=fe(e,i.visConfig,i.enabledPolicies),a=[];for(const o of n){if(t.offline&&!o.offlineSupported){a.push({packageName:"*",policy:o.name,reason:`policy.${o.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await o.evaluate(t,i.visConfig);a.push(...c)}catch(c){const s=c instanceof Error?c.message:String(c);a.push({packageName:"*",policy:o.name,reason:`policy.${o.name} failed: ${s}`,severity:"info",version:"*"})}}return a},"evaluatePolicies"),de=(()=>{const t=new Map;for(const e of P)t.set(e.toLowerCase(),e);return t})(),Se=d(()=>x.map(t=>t.name),"getRegisteredPolicyNames"),Ne=d((t,e)=>{if(t===void 0)return;const i=t.trim().toLowerCase();if(i===""||i==="none")return new Set;if(i==="all")return new Set(P);const n=new Set;for(const a of t.split(",").map(o=>o.trim()).filter(o=>o.length>0)){const o=a.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(s,r)=>r.toUpperCase()),c=de.get(o.toLowerCase());c===void 0?e?.(a):n.add(c)}return n},"parsePoliciesFlag");export{we as c,Ce as e,Se as g,Ne as p,M as s};
@@ -27,4 +27,4 @@ ${en(i,e,n+1,o)}`),`
27
27
  ${s}`},"getCause"),ar=L((t,e)=>(t.length>0?`
28
28
  `:"")+t.map(n=>Ve(n,e)).join(`
29
29
  `),"getStacktrace"),tn=L((t,e,n)=>{const o={cwd:nr(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:L(a=>a,"fileLine"),gutter:L(a=>a,"gutter"),hint:L(a=>a,"hint"),marker:L(a=>a,"marker"),message:L(a=>a,"message"),method:L(a=>a,"method"),title:L(a=>a,"title"),...e.color}},s=Jt(t,{filter:e.filterStacktrace,frameLimit:o.framesMaxLimit}),i=s.shift();return[e.hideMessage?void 0:Yt(t,o,n),Zt(t,o,n),i?Ve(i,o,n):void 0,i&&!o.hideErrorCodeView?Qt(i,o,n):void 0,t instanceof AggregateError?Xt(t,o,n):void 0,t.cause===void 0?void 0:en(t,o,n),s.length>0?ar(s,o):void 0].filter(Boolean).join(`
30
- `).replaceAll("\\","/")},"internalRenderError"),lr=L((t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return tn(t,e,0)},"renderError");var cr=Object.defineProperty,mt=_((t,e)=>cr(t,"name",{value:e,configurable:!0}),"i$1");const kr=mt((t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:mt((e,n)=>{const{logger:o,runtime:s}=n,{detailed:i=!1,exitOnError:a=!0,formatter:l,logErrors:h=!0,renderOptions:r={}}=t;if(h)if(l)o.error(l(e));else if(i){const c=s.getCwd(),m=lr(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});o.error(m)}else o.error(e);a&&z(1)},"onError"),version:"1.0.0"}),"E");var ur="1.0.0-alpha.32";const Or={version:ur};var pr=Object.defineProperty,hr=_((t,e)=>pr(t,"name",{value:e,configurable:!0}),"e");const Cr={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:hr(()=>import("../packem_chunks/handler9.js"),"loader"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{Er as $,vr as E,Nr as I,Ar as a,G as b,yr as c,k as d,q as h,Cr as i,Or as m,kr as p};
30
+ `).replaceAll("\\","/")},"internalRenderError"),lr=L((t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return tn(t,e,0)},"renderError");var cr=Object.defineProperty,mt=_((t,e)=>cr(t,"name",{value:e,configurable:!0}),"i$1");const kr=mt((t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:mt((e,n)=>{const{logger:o,runtime:s}=n,{detailed:i=!1,exitOnError:a=!0,formatter:l,logErrors:h=!0,renderOptions:r={}}=t;if(h)if(l)o.error(l(e));else if(i){const c=s.getCwd(),m=lr(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});o.error(m)}else o.error(e);a&&z(1)},"onError"),version:"1.0.0"}),"E");var ur="1.0.0-alpha.33";const Or={version:ur};var pr=Object.defineProperty,hr=_((t,e)=>pr(t,"name",{value:e,configurable:!0}),"e");const Cr={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:hr(()=>import("../packem_chunks/handler9.js"),"loader"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{Er as $,vr as E,Nr as I,Ar as a,G as b,yr as c,k as d,q as h,Cr as i,Or as m,kr as p};