@visulima/vis 4.3.1 → 5.0.0

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 (79) hide show
  1. package/CHANGELOG.md +497 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/config/index.d.ts +27 -2
  5. package/dist/packem_chunks/catalog.js +2 -2
  6. package/dist/packem_chunks/cli-exec.js +1 -1
  7. package/dist/packem_chunks/cli-main.js +126 -126
  8. package/dist/packem_chunks/handler.js +1 -1
  9. package/dist/packem_chunks/handler11.js +1 -1
  10. package/dist/packem_chunks/handler12.js +1 -1
  11. package/dist/packem_chunks/handler13.js +1 -1
  12. package/dist/packem_chunks/handler14.js +1 -1
  13. package/dist/packem_chunks/handler15.js +1 -1
  14. package/dist/packem_chunks/handler16.js +1 -1
  15. package/dist/packem_chunks/handler17.js +1 -1
  16. package/dist/packem_chunks/handler18.js +1 -1
  17. package/dist/packem_chunks/handler2.js +1 -1
  18. package/dist/packem_chunks/handler20.js +1 -1
  19. package/dist/packem_chunks/handler26.js +5 -5
  20. package/dist/packem_chunks/handler27.js +1 -1
  21. package/dist/packem_chunks/handler28.js +1 -1
  22. package/dist/packem_chunks/handler29.js +1 -1
  23. package/dist/packem_chunks/handler3.js +1 -1
  24. package/dist/packem_chunks/handler5.js +1 -1
  25. package/dist/packem_chunks/handler51.js +1 -1
  26. package/dist/packem_chunks/handler59.js +1 -1
  27. package/dist/packem_chunks/handler6.js +1 -1
  28. package/dist/packem_chunks/handler61.js +1 -1
  29. package/dist/packem_chunks/handler62.js +10 -10
  30. package/dist/packem_chunks/handler64.js +6 -3
  31. package/dist/packem_chunks/handler65.js +8 -6
  32. package/dist/packem_chunks/handler66.js +1 -1
  33. package/dist/packem_chunks/handler69.js +22 -153
  34. package/dist/packem_chunks/handler7.js +1 -1
  35. package/dist/packem_chunks/handler70.js +9 -9
  36. package/dist/packem_chunks/handler71.js +153 -22
  37. package/dist/packem_chunks/handler72.js +1 -1
  38. package/dist/packem_chunks/handler73.js +1 -1
  39. package/dist/packem_chunks/handler75.js +12 -12
  40. package/dist/packem_chunks/handler77.js +1 -1
  41. package/dist/packem_chunks/handler78.js +70 -68
  42. package/dist/packem_chunks/handler9.js +1 -1
  43. package/dist/packem_chunks/heal-accept.js +1 -1
  44. package/dist/packem_chunks/help-command.js +1 -1
  45. package/dist/packem_chunks/index6.js +1 -1
  46. package/dist/packem_chunks/list.js +1 -1
  47. package/dist/packem_chunks/loader.js +1 -1
  48. package/dist/packem_chunks/sync2.js +1 -1
  49. package/dist/packem_chunks/tar.js +1 -1
  50. package/dist/packem_chunks/tripwire.js +1 -1
  51. package/dist/packem_chunks/ts-loader.js +1 -1
  52. package/dist/packem_chunks/verify-lockfile.js +1 -1
  53. package/dist/packem_shared/{affected-selection-D4giBK2X.js → affected-selection-BJXJW_3Q.js} +1 -1
  54. package/dist/packem_shared/affected-shas-B_kfSKss.js +1 -0
  55. package/dist/packem_shared/{bin-C1XKj-O-.js → bin-Dx8mjl3g.js} +1 -1
  56. package/dist/packem_shared/{ecosystem-gate-ddru_hOg.js → ecosystem-gate-CeV20GSB.js} +1 -1
  57. package/dist/packem_shared/env-consistency-Dt_uDbSP.js +1 -0
  58. package/dist/packem_shared/git-source-DExWbfN0.js +2 -0
  59. package/dist/packem_shared/{index-DQ2GJzmy.js → index-C_ScJMpb.js} +1 -1
  60. package/dist/packem_shared/{index-Chje3u9v.js → index-nEyN71oX.js} +1 -1
  61. package/dist/packem_shared/{package-version-Dxirp-UO.js → package-version-CiRZecQu.js} +1 -1
  62. package/dist/packem_shared/{packument-BQv4je9m.js → packument-Df46y5MY.js} +1 -1
  63. package/dist/packem_shared/pm-runner-3iiQayy-.js +1 -0
  64. package/dist/packem_shared/{project-name-filter-D6tXD8gd.js → project-name-filter-CH8Ih7Qr.js} +1 -1
  65. package/dist/packem_shared/{provenance-DNyVMxNv.js → provenance-DKeR0Ig1.js} +1 -1
  66. package/dist/packem_shared/{resolve-explicit-BPsdmuty.js → resolve-explicit-BmV8YBE-.js} +1 -1
  67. package/dist/packem_shared/{s1ngularity-QD2LD1sO.js → s1ngularity-DZhkIqL4.js} +1 -1
  68. package/dist/packem_shared/{signatures-t8LbOaqr.js → signatures-BxTMck2l.js} +1 -1
  69. package/dist/packem_shared/task-env-DzR4RkOj.js +2 -0
  70. package/dist/packem_shared/{vis-user-error-75VtCwMv.js → vis-user-error-Dd7hwxlW.js} +1 -1
  71. package/dist/packem_shared/{watch-loop-qRn0IHPG.js → watch-loop-BBkg02-Q.js} +2 -2
  72. package/index.js +52 -52
  73. package/package.json +10 -10
  74. package/schemas/project.schema.json +44 -1
  75. package/schemas/vis-config.schema.json +122 -7
  76. package/skills/vis/SKILL.md +24 -12
  77. package/dist/packem_shared/affected-shas-B2V84O0g.js +0 -1
  78. package/dist/packem_shared/giget-D8Kwb0kD.js +0 -2
  79. package/dist/packem_shared/pm-runner-CMSml1Bj.js +0 -1
@@ -1 +1 @@
1
- import{a as d,e as l}from"../packem_shared/pm-runner-CMSml1Bj.js";import{r as m,a as p}from"../packem_shared/command-runtime-p4IXiIf6.js";const i=async({logger:a,options:s,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),t=m({logger:a,options:s,visConfig:e},c),r=d(c,{backend:p(t),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=l(r,s.check||!1,c,a);o!==0&&(process.exitCode=o)};export{i as default};
1
+ import{a as d,e as l}from"../packem_shared/pm-runner-3iiQayy-.js";import{r as m,a as p}from"../packem_shared/command-runtime-p4IXiIf6.js";const i=async({logger:a,options:s,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),t=m({logger:a,options:s,visConfig:e},c),r=d(c,{backend:p(t),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=l(r,s.check||!1,c,a);o!==0&&(process.exitCode=o)};export{i as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as L}from"node:module";import{U as G,a as H}from"../packem_shared/index-BzhrR_iC.js";import{d as U,f as F,p as S,v as P,a as D}from"./heal.js";import{d as j,c as V}from"../packem_shared/pm-runner-CMSml1Bj.js";import{p as s}from"./cli-main.js";let N;const O=t=>(N??=L(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,o]=I.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return I.getBuiltinModule(t)}return O(t)},{readFile:x}=B("node:fs/promises"),{createInterface:K}=B("node:readline"),M=()=>!!process.stdout.isTTY&&process.env.CI!=="true",q=t=>new Promise(e=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${t} (Y/n) `,a=>{o.close();const i=a.trim().toLowerCase();e(i===""||i==="y"||i==="yes")})}),Y=(t,e)=>{const o=j(e),a=V(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[t],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:a})},$=t=>`pnpm add ${t}`,J=t=>t==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),A=async(t,e={})=>{const o=e.interactive??M(),a=e.prompt??q,i=e.runInstall??Y,c=e.importImpl??J,d=e.workspaceRoot??process.cwd();try{return await c(t)}catch(u){const{code:m}=u;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="MODULE_NOT_FOUND")throw u}if(!o)throw new Error(`${t} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
1
+ import{createRequire as L}from"node:module";import{U as G,a as H}from"../packem_shared/index-BzhrR_iC.js";import{d as U,f as F,p as S,v as P,a as D}from"./heal.js";import{d as j,c as V}from"../packem_shared/pm-runner-3iiQayy-.js";import{p as s}from"./cli-main.js";let N;const O=t=>(N??=L(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,o]=I.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return I.getBuiltinModule(t)}return O(t)},{readFile:x}=B("node:fs/promises"),{createInterface:K}=B("node:readline"),M=()=>!!process.stdout.isTTY&&process.env.CI!=="true",q=t=>new Promise(e=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${t} (Y/n) `,a=>{o.close();const i=a.trim().toLowerCase();e(i===""||i==="y"||i==="yes")})}),Y=(t,e)=>{const o=j(e),a=V(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[t],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:a})},$=t=>`pnpm add ${t}`,J=t=>t==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),A=async(t,e={})=>{const o=e.interactive??M(),a=e.prompt??q,i=e.runInstall??Y,c=e.importImpl??J,d=e.workspaceRoot??process.cwd();try{return await c(t)}catch(u){const{code:m}=u;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="MODULE_NOT_FOUND")throw u}if(!o)throw new Error(`${t} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
2
2
  ${$(t)}`);if(!await a(`${t} isn't installed. Install it now?`))throw new Error(`${t} install declined. Re-run \`vis ai heal accept\` after installing manually:
3
3
  ${$(t)}`);const n=await i(t,d);if(n.exitCode!==0)throw new Error(`Install of ${t} failed (exit ${String(n.exitCode)}). Install manually and retry:
4
4
  ${$(t)}`);return await c(t)},W=t=>{const e=t.indexOf("/");if(e<=0||e===t.length-1)throw new Error(`Expected GITHUB_REPOSITORY in "owner/repo" form, got: ${t}`);return{owner:t.slice(0,e),repo:t.slice(e+1)}},z=async(t,e)=>{if(e.githubClient)return e.githubClient;const i=(await(e.loadSdk??A)("@octokit/rest")).Octokit;if(!i)throw new TypeError("Loaded `@octokit/rest` but no `Octokit` export was found. Reinstall the package or pin to a supported major.");return new i({auth:t})},X=async(t,e,o)=>{if(o.gitlabClient)return o.gitlabClient;const c=(await(o.loadSdk??A)("@gitbeaker/rest")).Gitlab;if(!c)throw new TypeError("Loaded `@gitbeaker/rest` but no `Gitlab` export was found. Reinstall the package or pin to a supported major.");return new c({host:e,token:t})},Q=t=>t.replace(/\/api\/v\d+\/?$/,""),Z=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(_=>x(_,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitHub: GITHUB_REPOSITORY (owner/repo) is not set.");if(!o.token)throw new Error("Cannot commit on GitHub: GITHUB_TOKEN is not set. Grant the workflow `contents: write` and pass the token through.");const{owner:r,repo:n}=W(o.repo),u=await z(o.token,t),f=(await u.rest.git.getRef({owner:r,ref:`heads/${e}`,repo:n})).data.object.sha,g=(await u.rest.git.getCommit({commit_sha:f,owner:r,repo:n})).data.tree.sha,h=await Promise.all(a.map(async _=>{const T=G(c,_),w=await d(T),R=await u.rest.git.createBlob({content:Buffer.from(w,"utf8").toString("base64"),encoding:"base64",owner:r,repo:n});return{mode:"100644",path:_,sha:R.data.sha,type:"blob"}})),C=await u.rest.git.createTree({base_tree:g,owner:r,repo:n,tree:h}),b=await u.rest.git.createCommit({message:i,owner:r,parents:[f],repo:n,tree:C.data.sha});return await u.rest.git.updateRef({owner:r,ref:`heads/${e}`,repo:n,sha:b.data.sha}),{sha:b.data.sha,url:b.data.html_url}},tt=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(p=>x(p,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitLab: CI_PROJECT_ID / CI_PROJECT_PATH is not set.");if(!o.token)throw new Error("Cannot commit on GitLab: no token. CI_JOB_TOKEN cannot push commits — set GITLAB_TOKEN to a PAT/project-token with `api` scope.");if(!o.apiBaseUrl)throw new Error("Cannot commit on GitLab: CI_API_V4_URL is not set.");const r=Q(o.apiBaseUrl),n=await X(o.token,r,t),u=await Promise.all(a.map(async p=>{const g=G(c,p);return{action:"update",content:await d(g),filePath:p}})),m=await n.Commits.create(o.repo,e,i,u),f=m.id??m.sha;if(!f)throw new Error("GitLab Commits.create returned no commit ID — cannot reference the new commit.");return{sha:f,url:m.web_url??m.webUrl}},et=async t=>{if(t.files.length===0)throw new Error("Cannot commit: no files to include.");if(t.ciContext.provider==="github-actions")return await Z(t);if(t.ciContext.provider==="gitlab-ci")return await tt(t);throw new Error(`Cannot commit: unsupported CI provider \`${t.ciContext.provider}\`. Run \`vis ai heal accept\` from a recognised CI environment.`)},y="/vis heal accept",ot=async t=>{if(!t)return;let e;try{e=await x(t,"utf8")}catch{return}const o=JSON.parse(e),a=o.comment?.body??"",i=o.comment?.user?.login??"",c=o.pull_request?.head?.repo?.full_name,d=o.pull_request?.base?.repo?.full_name??o.repository?.full_name,r=c!==void 0&&d!==void 0&&c!==d;return{actor:i,body:a,headRef:o.pull_request?.head?.ref,isFork:r}},rt=t=>{const e=t.VIS_HEAL_TRIGGER_BODY,o=t.VIS_HEAL_TRIGGER_ACTOR;if(!(!e||!o))return{actor:o,body:e,headRef:t.VIS_HEAL_HEAD_REF,isFork:!1}},it=t=>{const e=t.BUILDKITE_UNBLOCKER_EMAIL??t.BUILDKITE_UNBLOCKER;if(e)return{actor:e,body:y,headRef:t.BUILDKITE_BRANCH,isFork:!1}},at=async(t,e)=>{if(t.provider==="github-actions")return await ot(e.GITHUB_EVENT_PATH);if(t.provider==="gitlab-ci")return rt(e);if(t.provider==="buildkite")return it(e)},nt=(t,e)=>{const o=e.BUILDKITE_REPO;if(!o)return;const a=/(?:^|@|\/\/)github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec(o);if(a&&e.GITHUB_TOKEN)return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"github-actions",repo:`${a[1]}/${a[2]}`,sha:t.sha,token:e.GITHUB_TOKEN};const i=/\/\/([^/]*gitlab[^/]*)\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),c=i?null:/@([^/:]*gitlab[^/:]*):([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),d=i??c;if(d&&e.GITLAB_TOKEN){const r=d[1];return{apiBaseUrl:e.CI_API_V4_URL??`https://${r}/api/v4`,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"gitlab-ci",repo:`${d[2]}/${d[3]}`,sha:t.sha,token:e.GITLAB_TOKEN}}},st=async t=>{const e=t.fetchImpl??globalThis.fetch,a=`${(t.apiBaseUrl??"https://api.github.com").replace(/\/+$/,"")}/repos/${t.repo}/pulls/${String(t.prNumber)}`;try{const i=await e(a,{headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).head?.ref:void 0}catch{return}},ct=(t,e,o,a)=>{const i=e.map(c=>`- \`${c}\``).join(`
@@ -1,4 +1,4 @@
1
- import{createRequire as At}from"node:module";import{w as It,$ as Wt,e as kt,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-sXNQYpsl.js";import{u as ut,c as B,e as Mt}from"../packem_shared/vis-user-error-75VtCwMv.js";import{N as R,a as _}from"../packem_shared/Table-BB8xHTU5-BLPS917D.js";import{b as Ct}from"../packem_shared/package-version-Dxirp-UO.js";let Ot;const xt=t=>(Ot??=At(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Et=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,n]=E.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return E.getBuiltinModule(t)}return xt(t)},{createRequire:Bt}=Et("node:module"),jt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=t=>{let[,e]=jt.exec(t)??[];const n=e?e.length:0;if(n===3){const s=e.charAt(0),o=e.charAt(1),i=e.charAt(2);e=s+s+o+o+i+i}else if(n!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},dt=(t,e,n)=>t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(n/51),H=t=>{let e,n,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=n=r=((t-232)*10+8)/255;else{t-=16;const i=t%36;e=Math.floor(t/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const s=Math.max(e,n,r)*2;if(s===0)return 30;const o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(e));return s===2?o+60:o},Z=(t,e,n)=>H(dt(t,e,n));function Rt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const S=(t,e,n)=>e>t?e:Math.min(t,n),m=39,f=49,X=10,tt={close:"",open:""},ht=t=>{const e=t>0?(l,d)=>({close:`\x1B[${String(d)}m`,open:`\x1B[${String(l)}m`}):()=>tt,n=l=>(d,p,g)=>l(dt(Number(d),Number(p),Number(g))),r=l=>d=>{const[p,g,w]=z(d);return l(p,g,w)};let s=l=>e(`38;5;${String(l)}`,m),o=l=>e(`48;5;${String(l)}`,f),i=(l,d,p)=>e(`38;2;${String(l)};${String(d)};${String(p)}`,m),a=(l,d,p)=>e(`48;2;${String(l)};${String(d)};${String(p)}`,f);t===1?(s=l=>e(H(Number(l)),m),o=l=>e(H(Number(l))+X,f),i=(l,d,p)=>e(Z(Number(l),Number(d),Number(p)),m),a=(l,d,p)=>e(Z(Number(l),Number(d),Number(p))+X,f)):t===2&&(i=n(s),a=n(o));const u={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),underlineCurly:e("4:3",24),underlineDashed:e("4:5",24),underlineDotted:e("4:4",24),underlineDouble:e("4:2",24),visible:tt},c={bgBlack:e(40,f),bgBlackBright:e(100,f),bgBlue:e(44,f),bgBlueBright:e(104,f),bgCyan:e(46,f),bgCyanBright:e(106,f),bgGray:e(100,f),bgGreen:e(42,f),bgGreenBright:e(102,f),bgGrey:e(100,f),bgMagenta:e(45,f),bgMagentaBright:e(105,f),bgRed:e(41,f),bgRedBright:e(101,f),bgWhite:e(47,f),bgWhiteBright:e(107,f),bgYellow:e(43,f),bgYellowBright:e(103,f),black:e(30,m),blackBright:e(90,m),blue:e(34,m),blueBright:e(94,m),cyan:e(36,m),cyanBright:e(96,m),gray:e(90,m),green:e(32,m),greenBright:e(92,m),grey:e(90,m),magenta:e(35,m),magentaBright:e(95,m),red:e(31,m),redBright:e(91,m),white:e(37,m),whiteBright:e(97,m),yellow:e(33,m),yellowBright:e(93,m)},h={bg:l=>o(S(l,0,255)),bgHex:r(a),bgRgb:(l,d,p)=>a(S(l,0,255),S(d,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,d,p)=>i(S(l,0,255),S(d,0,255),S(p,0,255))};return{baseColors:c,baseStyles:u,styleMethods:h}},pt=It();Wt();ht(pt);const _t=(t,e,n)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const s=e.length;let o=0,i="";for(;~r;)i+=t.slice(o,r)+n,o=r+s,r=t.indexOf(e,o);return i+t.slice(o)},Pt=(t,e,n)=>{if(t==null||t==="")return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let s=n;s;s=s.props)r=_t(r,s.close,s.open);return r.includes(`
1
+ import{createRequire as At}from"node:module";import{w as It,$ as Wt,e as kt,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-sXNQYpsl.js";import{u as ut,c as B,e as Mt}from"../packem_shared/vis-user-error-Dd7hwxlW.js";import{N as R,a as _}from"../packem_shared/Table-BB8xHTU5-BLPS917D.js";import{b as Ct}from"../packem_shared/package-version-CiRZecQu.js";let Ot;const xt=t=>(Ot??=At(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Et=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,n]=E.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return E.getBuiltinModule(t)}return xt(t)},{createRequire:Bt}=Et("node:module"),jt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=t=>{let[,e]=jt.exec(t)??[];const n=e?e.length:0;if(n===3){const s=e.charAt(0),o=e.charAt(1),i=e.charAt(2);e=s+s+o+o+i+i}else if(n!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},dt=(t,e,n)=>t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(n/51),H=t=>{let e,n,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=n=r=((t-232)*10+8)/255;else{t-=16;const i=t%36;e=Math.floor(t/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const s=Math.max(e,n,r)*2;if(s===0)return 30;const o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(e));return s===2?o+60:o},Z=(t,e,n)=>H(dt(t,e,n));function Rt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const S=(t,e,n)=>e>t?e:Math.min(t,n),m=39,f=49,X=10,tt={close:"",open:""},ht=t=>{const e=t>0?(l,d)=>({close:`\x1B[${String(d)}m`,open:`\x1B[${String(l)}m`}):()=>tt,n=l=>(d,p,g)=>l(dt(Number(d),Number(p),Number(g))),r=l=>d=>{const[p,g,w]=z(d);return l(p,g,w)};let s=l=>e(`38;5;${String(l)}`,m),o=l=>e(`48;5;${String(l)}`,f),i=(l,d,p)=>e(`38;2;${String(l)};${String(d)};${String(p)}`,m),a=(l,d,p)=>e(`48;2;${String(l)};${String(d)};${String(p)}`,f);t===1?(s=l=>e(H(Number(l)),m),o=l=>e(H(Number(l))+X,f),i=(l,d,p)=>e(Z(Number(l),Number(d),Number(p)),m),a=(l,d,p)=>e(Z(Number(l),Number(d),Number(p))+X,f)):t===2&&(i=n(s),a=n(o));const u={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),underlineCurly:e("4:3",24),underlineDashed:e("4:5",24),underlineDotted:e("4:4",24),underlineDouble:e("4:2",24),visible:tt},c={bgBlack:e(40,f),bgBlackBright:e(100,f),bgBlue:e(44,f),bgBlueBright:e(104,f),bgCyan:e(46,f),bgCyanBright:e(106,f),bgGray:e(100,f),bgGreen:e(42,f),bgGreenBright:e(102,f),bgGrey:e(100,f),bgMagenta:e(45,f),bgMagentaBright:e(105,f),bgRed:e(41,f),bgRedBright:e(101,f),bgWhite:e(47,f),bgWhiteBright:e(107,f),bgYellow:e(43,f),bgYellowBright:e(103,f),black:e(30,m),blackBright:e(90,m),blue:e(34,m),blueBright:e(94,m),cyan:e(36,m),cyanBright:e(96,m),gray:e(90,m),green:e(32,m),greenBright:e(92,m),grey:e(90,m),magenta:e(35,m),magentaBright:e(95,m),red:e(31,m),redBright:e(91,m),white:e(37,m),whiteBright:e(97,m),yellow:e(33,m),yellowBright:e(93,m)},h={bg:l=>o(S(l,0,255)),bgHex:r(a),bgRgb:(l,d,p)=>a(S(l,0,255),S(d,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,d,p)=>i(S(l,0,255),S(d,0,255),S(p,0,255))};return{baseColors:c,baseStyles:u,styleMethods:h}},pt=It();Wt();ht(pt);const _t=(t,e,n)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const s=e.length;let o=0,i="";for(;~r;)i+=t.slice(o,r)+n,o=r+s,r=t.indexOf(e,o);return i+t.slice(o)},Pt=(t,e,n)=>{if(t==null||t==="")return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let s=n;s;s=s.props)r=_t(r,s.close,s.open);return r.includes(`
2
2
  `)&&(r=r.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+r+n.closeStack},Tt=function(t){const e=t?.level??pt,{baseColors:n,baseStyles:r,styleMethods:s}=ht(e),o={};let i=null;const a=({props:c},{close:h,open:l})=>{const d=(c?.openStack??"")+l,p=h+(c?.closeStack??""),g=(w,...y)=>Pt(w,y,g.props);return Object.setPrototypeOf(g,i),g.props={close:h,closeStack:p,open:l,openStack:d,props:c},g.open=d,g.close=p,g},u=c=>String(c);u.strip=c=>c.replaceAll(Rt(),"");for(const c in n)o[c]={get(){const h=a(this,n[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in r)o[c]={get(){const h=a(this,r[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in s)o[c]={get(){return(...h)=>a(this,s[c](...h))}};return o.ansi256=o.fg,o.bgAnsi256=o.bg,i=Object.defineProperties({},o),Object.setPrototypeOf(u,i),u},Lt=t=>(e,...n)=>{if(!Array.isArray(e)||!Array.isArray(e.raw))throw new TypeError("A tagged template literal must be provided");const r=[e.raw[0]];for(let s=1;s<e.raw.length;s+=1)r.push(String(n[s-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(e.raw[s]));return t(r.join(""))},Ft=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
3
3
  `],["r","\r"],["t"," "],["v","\v"]]),mt=t=>{const e=t.startsWith("u"),n=t[1]==="{";return e&&!n&&t.length===5||t.startsWith("x")&&t.length===3?String.fromCodePoint(Number.parseInt(t.slice(1),16)):e&&n?String.fromCodePoint(Number.parseInt(t.slice(2,-1),16)):Ft.get(t)??t},Dt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,et=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Vt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,qt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Ut=/\s*,\s*/,Gt=(t,e)=>{const n=[],r=e.trim().split(Ut);let s;for(const o of r){const i=Number(o);if(!Number.isNaN(i))n.push(i);else if(s=Vt.exec(o))n.push(s[2].replaceAll(qt,(a,u,c)=>u?mt(u):c));else throw new Error(`Invalid template style argument: ${o} (in style '${t}')`)}return n},zt=t=>{et.lastIndex=0;const e=[];let n;for(;(n=et.exec(t))!==null;){const r=n[1];n[2]?e.push([r,...Gt(r,n[2])]):n[3]||n[4]?(n[3]&&e.push(["rgb",...z(n[3])]),n[4]&&e.push(["bgRgb",...z(n[4])])):e.push([r])}return e},nt=(t,e)=>{const n={};for(const s of e)for(const o of s.styles)n[o[0]]=s.inverse?void 0:o.slice(1);let r=t;for(const[s,o]of Object.entries(n))if(Array.isArray(o)){if(!(s in r))throw new Error(`Unknown style: ${s}`);r=o.length>0?r[s](...o):r[s]}return r},Ht=t=>e=>{const n=[],r=[];let s=[];if(e.replaceAll(Dt,(o,i,a,u,c,h)=>{if(i)s.push(mt(i));else if(u){const l=s.join("");s=[],r.push(n.length===0?l:nt(t,n)(l)),n.push({inverse:a,styles:zt(u)})}else if(c){if(n.length===0)throw new Error("Found extraneous } in template literal");r.push(nt(t,n)(s.join(""))),s=[],n.pop()}else s.push(h)}),r.push(s.join("")),n.length>0)throw new Error(`template literal is missing ${String(n.length)} closing bracket${n.length===1?"":"s"} (\`}\`)`);return r.join("")},Yt=new Tt,Jt=Ht(Yt),Kt=Lt(Jt);let Qt;const Zt=t=>(Qt??=Bt(import.meta.url))(t),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:A,F=t=>{if(typeof O<"u"&&O.versions&&O.versions.node){const[e,n]=O.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return O.getBuiltinModule(t)}return Zt(t)},A=O,{execFileSync:Xt}=F("node:child_process"),W=F("node:fs"),te=F("node:tty"),ee=F("node:os"),ne=[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],re=12288,oe=65510,ie=[12288,12288,65281,65376,65504,65510],se=8361,ae=65518,le=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],ce=32,ue=10630,de=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],he=4352,pe=262141,ft=[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],k=(t,e)=>{let n=0,r=Math.floor(t.length/2)-1;for(;n<=r;){const s=Math.floor((n+r)/2),o=s*2;if(e<t[o])r=s-1;else if(e>t[o+1])n=s+1;else return!0}return!1},rt=19968,[me,fe]=ge(ft);function ge(t){let e=t[0],n=t[1];for(let r=0;r<t.length;r+=2){const s=t[r],o=t[r+1];if(rt>=s&&rt<=o)return[s,o];o-s>n-e&&(e=s,n=o)}return[e,n]}const we=t=>t<161||t>1114109?!1:k(ne,t),be=t=>t<re||t>oe?!1:k(ie,t),ye=t=>t<se||t>ae?!1:k(le,t),$e=t=>t<ce||t>ue?!1:k(de,t),Ne=t=>t>=me&&t<=fe?!0:t<he||t>pe?!1:k(ft,t);function ve(t){return we(t)?"ambiguous":be(t)?"fullwidth":ye(t)?"halfwidth":$e(t)?"narrow":Ne(t)?"wide":"neutral"}function Se(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function gt(t){return Se(t),ve(t)}const ot=new Map,Ae=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Oe=t=>{const e=Ae(t.width);let n=ot.get(e);return n||(n=new Map,ot.set(e,n)),n},M=new RegExp(ut.source,"y"),U=new RegExp(Mt.source,"uy"),C=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,wt=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",xe=(t,e)=>{const n=Oe(e),r=Math.floor(t/65536),s=t%65536;let o=n.get(r);if(o||(o=new Map,n.set(r,o)),o.has(s))return o.get(s);let i;switch(wt(t)){case"control":{i=e.width.control;break}case"latin":{i=e.width.regular;break}case"wide":{i=e.width.wide;break}case"zero":{i=0;break}default:switch(gt(t)){case"ambiguous":{i=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{i=e.width.fullWidth;break}case"wide":{i=e.width.wide;break}default:i=e.width.regular}}return o.set(s,i),i},Ee=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Y=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Y(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},r=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:s}=t,o=s>1e4;let i=0,a=0,u=s,c=!1;const h=t.includes("\x1B")||t.includes("›");for(;i<s;){if(h&&(t[i]==="\x1B"||t[i]==="›")){if(t.startsWith("\x1B]8;;",i)){const y="\x1B]8;;\x07",v=y.length,D=t.indexOf("\x07",i+5);if(D!==-1){const V=t.indexOf(y,D+1);if(V!==-1){const vt=V+v,St=t.slice(D+1,V).replace(ut,""),Q=Y(St,{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,r-a),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),q=Q.width;if(Q.truncated)c=!0,u=Math.min(u,i);else if(a+q>r&&(u=Math.min(u,i),c=!0,a+q>n.truncation.limit))break;if(a+=q,i=vt,c&&a>=n.truncation.limit)break;continue}}}if(M.lastIndex=i,M.test(t)){const y=M.lastIndex-i,v=n.truncation.countAnsiEscapeCodes?y:n.width.ansi;if(a+v>r&&(u=Math.min(u,i),a+v>n.truncation.limit)){c=!0;break}a+=v,i=M.lastIndex;continue}}const p=t.codePointAt(i);if(p===8203||p===65279||p>=8288&&p<=8292){i+=1;continue}if(p===9){if(a+n.width.tab>r&&(u=Math.min(u,i),a+n.width.tab>n.truncation.limit)){c=!0;break}a+=n.width.tab,i+=1;continue}if(C.lastIndex=i,C.test(t)){const y=(C.lastIndex-i)*n.width.regular;if(a+y>r){const v=n.width.regular>0?Math.floor((r-a)/n.width.regular):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=C.lastIndex;continue}if((p<=31||p>=127&&p<=159)&&(B.lastIndex=i,B.test(t))){const y=(B.lastIndex-i)*n.width.control;if(a+y>r){const v=n.width.control>0?Math.floor((r-a)/n.width.control):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=B.lastIndex;continue}if(U.lastIndex=i,U.test(t)){if(a+n.width.emoji>r&&(u=Math.min(u,i),a+n.width.emoji>n.truncation.limit)){c=!0;break}a+=n.width.emoji,i=U.lastIndex;continue}const g=t.codePointAt(i)??0;if(Ee(g)){i+=g>65535?2:1;continue}let w;if(o)w=xe(g,n);else switch(wt(g)){case"control":{w=n.width.control;break}case"latin":{w=n.width.regular;break}case"wide":{w=n.width.wide;break}case"zero":{w=0;break}default:switch(gt(g)){case"ambiguous":{w=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{w=n.width.fullWidth;break}case"wide":{w=n.width.wide;break}default:w=n.width.regular}}if(a+w>r&&(u=Math.min(u,i),a+w>n.truncation.limit)){c=!0;break}a+=w,i+=g>65535?2:1}let l=a,d=!1;return c&&n.truncation.limit>=n.truncation.ellipsisWidth&&(l=n.truncation.limit,d=!0),{ellipsed:d,index:c?u:s,truncated:c,width:l}},Ie=(t,e={})=>Y(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,bt=80,yt=24,J=(t,e,{shell:n,env:r}={})=>Xt(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),P=(t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),$t=(t,e)=>{const{columns:n,rows:r}=P(t,e);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===bt&&r===yt))return{columns:n,rows:r}},We=()=>{if(A.platform!=="linux")return!0;try{const t=W.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const n=t.slice(e+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),s=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(s)||s<=0?!1:r===s}catch{return!1}};function ke(){const{env:t,stdout:e,stderr:n}=A;if(e?.columns&&e?.rows)return P(e.columns,e.rows);if(n?.columns&&n?.rows)return P(n.columns,n.rows);if(t.COLUMNS&&t.LINES)return P(t.COLUMNS,t.LINES);const r={columns:bt,rows:yt};return A.platform==="win32"?G()??r:A.platform==="darwin"?it()??G()??r:it()??G()??Be()??r}const it=()=>{try{const t=A.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:e,rows:n}=te.WriteStream(W.openSync("/dev/tty",t));return{columns:e,rows:n}}catch{}},G=()=>{try{const t=J("tput",["cols"],{env:{TERM:"dumb",...A.env}}),e=J("tput",["lines"],{env:{TERM:"dumb",...A.env}});if(t&&e)return $t(t,e)}catch{}},Be=()=>{try{if(!We())return;const t=J("resize",["-u"]).match(/\d+/g);if(t.length===2)return $t(t[0],t[1])}catch{}},I=new Map,Me=500,$=t=>{if(!t||t==="")return"";const e=I.get(t);if(e!==void 0)return e;let n;try{n=Kt(Object.assign([],{raw:[t]}))}catch{n=t}if(I.size>=Me){const r=I.keys().next().value;r!==void 0&&I.delete(r)}return I.set(t,n),n},T=()=>{const t=Ct().CEREBRO_TERMINAL_WIDTH;if(t===void 0)return;const e=Number.parseInt(t,10);if(!(Number.isNaN(e)||e<=0))return e};class Nt{lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(ee.EOL)}header(e){this.add(j(e)),this.lines.push("")}}const Ce=t=>t!==void 0&&t>0?t:ke().columns,je=(t,e,n,r)=>{if(t.length===0||t.some(c=>c.length!==2))return;let s=0;for(const c of t){const h=c[0];if(h===void 0)continue;const l=Ie(h);l>s&&(s=l)}if(s===0)return;const o=n+r,i=s+o,a=20+o;if(i+a>e)return;const u=e-i;return[i,u]};class Re extends Nt{constructor(e){if(super(),e.header&&this.header($(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(n=>typeof n=="string"))e.content.forEach(n=>{Array.isArray(n)?n.forEach(r=>{this.add($(r))}):this.add($(n))});else if(typeof e.content=="string")this.add($(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const n=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.addRow([$(e)]),n.toString()}if(Array.isArray(e)&&e.every(n=>typeof n=="string"||Array.isArray(n)&&n.every(r=>typeof r=="string"))){const n=Ce(T()),r=a=>Array.isArray(a)?a.map(u=>$(u)):[$(a)],s=e.map(a=>r(a)),o=je(s,n,4,1),i=R({columnWidths:o,showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:n,truncateOverflow:!1,wordWrap:!0});return s.forEach(a=>{o!==void 0&&a.length===2?i.addRow([{content:a[0],wordWrap:!1},a[1]]):i.addRow(a)}),i.toString()}if(typeof e=="object"){const n=e;if(!n.options||!n.data)throw new Error(`Must have an "options" or "data" property
4
4
  ${JSON.stringify(e)}`);const r=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.data.forEach(s=>{Array.isArray(s)?r.addRow(s.map(o=>$(o))):r.addRow([$(s)])}),r.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
@@ -1,4 +1,4 @@
1
- import{a as nt,e as st,z as O}from"../packem_shared/index-BzhrR_iC.js";import{l as At}from"./ts-loader.js";import{L as Et}from"../packem_shared/index-BisalDCf.js";import{p as bt}from"./cli-main.js";import{q as xt,L as Ct,T as S,R as L,B as W,U as E,O as N,K as Q,Z as V,W as jt,r as K,t as kt,F as D,u as Y,x as J,H as Lt,w as Wt,M as Ut,C as St,P as Tt,v as Ot,y as Pt,Y as _t,z as It,J as Rt,A as zt,V as Nt,E as vt,G as Ft,I as Mt,N as Bt}from"../packem_shared/formatBytes-BHAzNIrn-CrusHOew.js";import{a2 as I,L as qt}from"./catalog.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Yt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Jt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!N.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!N.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!N.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Jt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>Y.test(p)||J.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||zt.test(p)||Nt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>Y.test(i)||J.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Yt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,z=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=z(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
1
+ import{a as nt,e as st,z as O}from"../packem_shared/index-BzhrR_iC.js";import{l as At}from"./ts-loader.js";import{L as Et}from"../packem_shared/index-BisalDCf.js";import{p as bt}from"./cli-main.js";import{q as xt,L as Ct,T as S,R as L,B as W,U as E,O as N,K as Q,Z as V,W as jt,r as K,t as kt,F as D,u as Y,x as J,H as Lt,w as Wt,M as Ut,C as St,P as Tt,v as Ot,y as Pt,Y as _t,z as It,J as Rt,A as zt,V as Nt,E as vt,G as Ft,I as Mt,N as Bt}from"../packem_shared/formatBytes-BHAzNIrn-CrusHOew.js";import{a3 as I,L as qt}from"./catalog.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Yt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Jt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!N.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!N.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!N.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Jt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>Y.test(p)||J.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||zt.test(p)||Nt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>Y.test(i)||J.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Yt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,z=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=z(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
2
2
  `)&&!t.startsWith(`${k}\r
3
3
  `))return{body:t};const s=t.indexOf(`
4
4
  ${k}`,k.length);if(s===-1)return{body:t};let n=s+1+k.length;t[n]==="\r"&&(n+=1),t[n]===`
@@ -1,3 +1,3 @@
1
- import{createRequire as _}from"node:module";import{w as x,p as t,x as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-CMSml1Bj.js";import{a as M}from"../packem_shared/build-scripts-CEDx_nJp.js";import{e as v}from"../packem_shared/index-BzhrR_iC.js";import{y as w}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");w(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!w($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=d.includes("/")?d.split("/").pop():d;b(k,d,s)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))b(k,d,s);const g=v(s,"node_modules");w(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?x(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
1
+ import{createRequire as _}from"node:module";import{w as x,p as t,x as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-3iiQayy-.js";import{a as M}from"../packem_shared/build-scripts-CEDx_nJp.js";import{e as v}from"../packem_shared/index-BzhrR_iC.js";import{y as w}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");w(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!w($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=d.includes("/")?d.split("/").pop():d;b(k,d,s)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))b(k,d,s);const g=v(s,"node_modules");w(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?x(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
2
2
  `);return}if(t.info(`Build-script status (${p.name}):
3
3
  `),n.installed.length===0&&n.unapproved.length===0&&t.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){t.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)t.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){t.info(""),t.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)t.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);t.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){t.info(""),t.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)t.info(` ! ${e}`);t.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){t.info(""),t.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:s}of n.versionDrift)t.info(` ${e} → ${s}`);t.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(o.length>0){t.info(""),t.warn(` Bin conflicts (${String(o.length)}) — multiple packages expose the same bin name:`);for(const e of o)t.info(` ${e.bin} ← ${e.packages.map(s=>s.name).join(", ")}`);t.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(r?.hasDrift){t.info("");for(const e of R(r))t.warn(e)}};export{F as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-CMSml1Bj.js";let _;const w=e=>(_??=f(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",v=()=>!!process.stdout.isTTY&&process.env.CI!=="true",$=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,a=>{r.close();const n=a.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=p(e),r=I(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},C=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},R=e=>{let t="pnpm";try{t=p(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),E=async(e={})=>{const t=e.interactive??v(),r=e.prompt??$,a=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),i=R(l);try{return await n()}catch(d){const{code:u,message:m}=d;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!m.includes(s))throw d}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
1
+ import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-3iiQayy-.js";let _;const w=e=>(_??=f(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",v=()=>!!process.stdout.isTTY&&process.env.CI!=="true",$=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,a=>{r.close();const n=a.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=p(e),r=I(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},C=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},R=e=>{let t="pnpm";try{t=p(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),E=async(e={})=>{const t=e.interactive??v(),r=e.prompt??$,a=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),i=R(l);try{return await n()}catch(d){const{code:u,message:m}=d;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!m.includes(s))throw d}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
2
2
  ${i}`);if(!await r(`${s} isn't installed. Install it now?`))throw new Error(`${s} install declined. Re-run \`vis attest\` after installing manually:
3
3
  ${i}`);const c=await a(l);if(c.exitCode!==0)throw new Error(`Install of ${s} failed (exit ${String(c.exitCode)}). Install manually and retry:
4
4
  ${i}`);return await n()};export{R as installCommandFor,C as isSigstoreInstalled,E as loadOptionalSigstore};
@@ -1,2 +1,2 @@
1
- import{p as n}from"./cli-main.js";import{d as u}from"../packem_shared/pm-runner-CMSml1Bj.js";import{s as p}from"../packem_shared/native-config-sync-TdTWjVgI.js";import{s as g}from"../packem_shared/min-release-age-JViyQuBM.js";const y=new Set(["bun","npm","pnpm","yarn"]),S=({options:c,visConfig:a,workspaceRoot:l})=>{const i=l??process.cwd(),e=u(i);if(!y.has(e.name)){n.warn(`Package manager '${e.name}' has no native security config to sync.`);return}if(!a?.security){n.warn("vis.config has no `security` block — nothing to sync.");return}const t=a.security.policies??{},r=Object.fromEntries(Object.entries(t.installScripts?.allow??{}).filter(([,o])=>o)),f=t.firstSeen?.minutes,m=t.firstSeen?.exclude??[],s=[];if(Object.keys(r).length>0&&!c.skipAllowBuilds&&s.push(...p(e.name,i,r)),c.skipMinReleaseAge||s.push(...g(e.name,i,f,m)),s.length===0){n.success("Nothing to sync — vis.config and native PM config are aligned.");return}n.info(`Syncing vis.config security settings to ${e.name} native config…
1
+ import{p as n}from"./cli-main.js";import{d as u}from"../packem_shared/pm-runner-3iiQayy-.js";import{s as p}from"../packem_shared/native-config-sync-TdTWjVgI.js";import{s as g}from"../packem_shared/min-release-age-JViyQuBM.js";const y=new Set(["bun","npm","pnpm","yarn"]),S=({options:c,visConfig:a,workspaceRoot:l})=>{const i=l??process.cwd(),e=u(i);if(!y.has(e.name)){n.warn(`Package manager '${e.name}' has no native security config to sync.`);return}if(!a?.security){n.warn("vis.config has no `security` block — nothing to sync.");return}const t=a.security.policies??{},r=Object.fromEntries(Object.entries(t.installScripts?.allow??{}).filter(([,o])=>o)),f=t.firstSeen?.minutes,m=t.firstSeen?.exclude??[],s=[];if(Object.keys(r).length>0&&!c.skipAllowBuilds&&s.push(...p(e.name,i,r)),c.skipMinReleaseAge||s.push(...g(e.name,i,f,m)),s.length===0){n.success("Nothing to sync — vis.config and native PM config are aligned.");return}n.info(`Syncing vis.config security settings to ${e.name} native config…
2
2
  `);for(const o of s)n.success(` ${o}`)};export{S as default};
@@ -1,3 +1,3 @@
1
- import{createRequire as lr}from"node:module";import{_ as fr}from"../packem_shared/giget-D8Kwb0kD.js";let dr;const ur=t=>(dr??=lr(import.meta.url))(t),Ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=t=>{if(typeof Ft<"u"&&Ft.versions&&Ft.versions.node){const[e,i]=Ft.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return Ft.getBuiltinModule(t)}return ur(t)},d=D("node:fs"),cr=D("node:fs/promises"),As=D("node:stream"),c=D("node:path"),{posix:Rt,basename:mr,win32:pr,join:Ns}=c,Is=D("events"),{EventEmitter:vr}=Is,p=D("fs"),{EventEmitter:zi}=D("node:events"),{StringDecoder:yr}=D("node:string_decoder"),re=D("path"),{parse:br,dirname:gr}=re,vi=D("assert"),{Buffer:bt}=D("buffer"),Xi=D("zlib"),qi={...Xi,default:Xi},Er=D("zlib"),wr=D("node:assert"),{randomBytes:Bs}=D("node:crypto");var an=fr({Header:()=>ot,Pack:()=>ae,PackJob:()=>Li,PackSync:()=>je,Parser:()=>At,Pax:()=>he,ReadEntry:()=>Gs,Unpack:()=>Me,UnpackSync:()=>Pi,WriteEntry:()=>Yi,WriteEntrySync:()=>Vs,WriteEntryTar:()=>Ks,c:()=>bs,create:()=>bs,extract:()=>Ds,filesFilter:()=>Wi,list:()=>Bt,r:()=>yt,replace:()=>yt,t:()=>Bt,types:()=>Hs,x:()=>Ds}),Rr=Object.defineProperty,_r=(t,e)=>{for(var i in e)Rr(t,i,{get:e[i],enumerable:!0})},Qi=process||{stdout:null,stderr:null},Sr=t=>!!t&&typeof t=="object"&&(t instanceof wt||t instanceof As||Or(t)||kr(t)),Or=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.pipe=="function"&&t.pipe!==As.Writable.prototype.pipe,kr=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.write=="function"&&typeof t.end=="function",G=Symbol("EOF"),$=Symbol("maybeEmitEnd"),q=Symbol("emittedEnd"),oe=Symbol("emittingEnd"),Mt=Symbol("emittedError"),le=Symbol("closed"),Ji=Symbol("read"),de=Symbol("flush"),ts=Symbol("flushChunk"),B=Symbol("encoding"),_t=Symbol("decoder"),R=Symbol("flowing"),Ct=Symbol("paused"),Tt=Symbol("resume"),_=Symbol("buffer"),x=Symbol("pipes"),S=Symbol("bufferLength"),Ze=Symbol("bufferPush"),ue=Symbol("bufferShift"),L=Symbol("objectMode"),E=Symbol("destroyed"),We=Symbol("error"),Ge=Symbol("emitData"),es=Symbol("emitEnd"),$e=Symbol("emitEnd2"),z=Symbol("async"),Ye=Symbol("abort"),fe=Symbol("aborted"),Pt=Symbol("signal"),lt=Symbol("dataListeners"),A=Symbol("discarded"),zt=t=>Promise.resolve().then(t),Tr=t=>t(),Lr=t=>t==="end"||t==="finish"||t==="prefinish",xr=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Dr=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Fs=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Tt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ar=class extends Fs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=s=>this.dest.emit("error",s),t.on("error",this.proxyErrors)}},Nr=t=>!!t.objectMode,Ir=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",wt=class extends zi{[R]=!1;[Ct]=!1;[x]=[];[_]=[];[L];[B];[z];[_t];[G]=!1;[q]=!1;[oe]=!1;[le]=!1;[Mt]=null;[S]=0;[E]=!1;[Pt];[fe]=!1;[lt]=0;[A]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Nr(e)?(this[L]=!0,this[B]=null):Ir(e)?(this[B]=e.encoding,this[L]=!1):(this[L]=!1,this[B]=null),this[z]=!!e.async,this[_t]=this[B]?new yr(this[B]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[_]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[x]});let{signal:i}=e;i&&(this[Pt]=i,i.aborted?this[Ye]():i.addEventListener("abort",()=>this[Ye]()))}get bufferLength(){return this[S]}get encoding(){return this[B]}set encoding(t){throw Error("Encoding must be set at instantiation time")}setEncoding(t){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(t){throw Error("objectMode must be set at instantiation time")}get async(){return this[z]}set async(t){this[z]=this[z]||!!t}[Ye](){this[fe]=!0,this.emit("abort",this[Pt]?.reason),this.destroy(this[Pt]?.reason)}get aborted(){return this[fe]}set aborted(t){}write(t,e,i){if(this[fe])return!1;if(this[G])throw Error("write after end");if(this[E])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(i=e,e="utf8"),e||="utf8";let s=this[z]?zt:Tr;if(!this[L]&&!Buffer.isBuffer(t)){if(Dr(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(xr(t))t=Buffer.from(t);else if(typeof t!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):t.length?(typeof t=="string"&&!(e===this[B]&&!this[_t]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[B]&&(t=this[_t].write(t)),this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):(this[S]!==0&&this.emit("readable"),i&&s(i),this[R])}read(t){if(this[E])return null;if(this[A]=!1,this[S]===0||t===0||t&&t>this[S])return this[$](),null;this[L]&&(t=null),this[_].length>1&&!this[L]&&(this[_]=[this[B]?this[_].join(""):Buffer.concat(this[_],this[S])]);let e=this[Ji](t||null,this[_][0]);return this[$](),e}[Ji](t,e){if(this[L])this[ue]();else{let i=e;t===i.length||t===null?this[ue]():typeof i=="string"?(this[_][0]=i.slice(t),e=i.slice(0,t),this[S]-=t):(this[_][0]=i.subarray(t),e=i.subarray(0,t),this[S]-=t)}return this.emit("data",e),!this[_].length&&!this[G]&&this.emit("drain"),e}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e="utf8"),t!==void 0&&this.write(t,e),i&&this.once("end",i),this[G]=!0,this.writable=!1,(this[R]||!this[Ct])&&this[$](),this}[Tt](){this[E]||(!this[lt]&&!this[x].length&&(this[A]=!0),this[Ct]=!1,this[R]=!0,this.emit("resume"),this[_].length?this[de]():this[G]?this[$]():this.emit("drain"))}resume(){return this[Tt]()}pause(){this[R]=!1,this[Ct]=!0,this[A]=!1}get destroyed(){return this[E]}get flowing(){return this[R]}get paused(){return this[Ct]}[Ze](t){this[L]?this[S]+=1:this[S]+=t.length,this[_].push(t)}[ue](){return this[L]?--this[S]:this[S]-=this[_][0].length,this[_].shift()}[de](t=!1){do;while(this[ts](this[ue]())&&this[_].length);!t&&!this[_].length&&!this[G]&&this.emit("drain")}[ts](t){return this.emit("data",t),this[R]}pipe(t,e){if(this[E])return t;this[A]=!1;let i=this[q];return e||={},t===Qi.stdout||t===Qi.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[x].push(e.proxyErrors?new Ar(this,t,e):new Fs(this,t,e)),this[z]?zt(()=>this[Tt]()):this[Tt]()),t}unpipe(t){let e=this[x].find(i=>i.dest===t);e&&(this[x].length===1?(this[R]&&this[lt]===0&&(this[R]=!1),this[x]=[]):this[x].splice(this[x].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if(t==="data")this[A]=!1,this[lt]++,!this[x].length&&!this[R]&&this[Tt]();else if(t==="readable"&&this[S]!==0)super.emit("readable");else if(Lr(t)&&this[q])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Mt]){let s=e;this[z]?zt(()=>s.call(this,this[Mt])):s.call(this,this[Mt])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return t==="data"&&(this[lt]=this.listeners("data").length,this[lt]===0&&!this[A]&&!this[x].length&&(this[R]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[lt]=0,!this[A]&&!this[x].length&&(this[R]=!1)),e}get emittedEnd(){return this[q]}[$](){!this[oe]&&!this[q]&&!this[E]&&this[_].length===0&&this[G]&&(this[oe]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[le]&&this.emit("close"),this[oe]=!1)}emit(t,...e){let i=e[0];if(t!=="error"&&t!=="close"&&t!==E&&this[E])return!1;if(t==="data")return!this[L]&&!i?!1:this[z]?(zt(()=>this[Ge](i)),!0):this[Ge](i);if(t==="end")return this[es]();if(t==="close"){if(this[le]=!0,!this[q]&&!this[E])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[Mt]=i,super.emit(We,i);let r=!this[Pt]||this.listeners("error").length?super.emit("error",i):!1;return this[$](),r}else if(t==="resume"){let r=super.emit("resume");return this[$](),r}else if(t==="finish"||t==="prefinish"){let r=super.emit(t);return this.removeAllListeners(t),r}let s=super.emit(t,...e);return this[$](),s}[Ge](t){for(let i of this[x])i.dest.write(t)===!1&&this.pause();let e=!this[A]&&super.emit("data",t);return this[$](),e}[es](){return this[q]?!1:(this[q]=!0,this.readable=!1,this[z]?(zt(()=>this[$e]()),!0):this[$e]())}[$e](){if(this[_t]){let e=this[_t].end();if(e){for(let i of this[x])i.dest.write(e);this[A]||super.emit("data",e)}}for(let e of this[x])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[L]||(t.dataLength=0);let e=this.promise();return this.on("data",i=>{t.push(i),this[L]||(t.dataLength+=i.length)}),await e,t}async concat(){if(this[L])throw Error("cannot concat in objectMode");let t=await this.collect();return this[B]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(E,()=>e(Error("stream destroyed"))),this.on("error",i=>e(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[A]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[G])return e();let s,r,h=l=>{this.off("data",n),this.off("end",a),this.off(E,o),e(),r(l)},n=l=>{this.off("error",h),this.off("end",a),this.off(E,o),this.pause(),s({value:l,done:!!this[G]})},a=()=>{this.off("error",h),this.off("data",n),this.off(E,o),e(),s({done:!0,value:void 0})},o=()=>h(Error("stream destroyed"));return new Promise((l,u)=>{r=u,s=l,this.once(E,o),this.once("error",h),this.once("end",a),this.once("data",n)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[A]=!1;let t=!1,e=()=>(this.pause(),this.off(We,e),this.off(E,e),this.off("end",e),t=!0,{done:!0,value:void 0});return this.once("end",e),this.once(We,e),this.once(E,e),{next:()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}},throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[E])return t?this.emit("error",t):this.emit(E),this;this[E]=!0,this[A]=!0,this[_].length=0,this[S]=0;let e=this;return typeof e.close=="function"&&!this[le]&&e.close(),t?this.emit("error",t):this.emit(E),this}static get isStream(){return Sr}},Br=p.writev,nt=Symbol("_autoClose"),P=Symbol("_close"),Ut=Symbol("_ended"),m=Symbol("_fd"),Ve=Symbol("_finished"),X=Symbol("_flags"),Ke=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qt=Symbol("_mode"),ce=Symbol("_needDrain"),Nt=Symbol("_onerror"),It=Symbol("_onopen"),Xe=Symbol("_onread"),Lt=Symbol("_onwrite"),at=Symbol("_open"),C=Symbol("_path"),et=Symbol("_pos"),U=Symbol("_queue"),xt=Symbol("_read"),qe=Symbol("_readSize"),K=Symbol("_reading"),jt=Symbol("_remain"),Qe=Symbol("_size"),_e=Symbol("_write"),dt=Symbol("_writing"),Se=Symbol("_defaultFlag"),gt=Symbol("_errored"),Ui=class extends wt{[gt]=!1;[m];[C];[qe];[K]=!1;[Qe];[jt];[nt];constructor(t,e){if(e||={},super(e),this.readable=!0,this.writable=!1,typeof t!="string")throw TypeError("path must be a string");this[gt]=!1,this[m]=typeof e.fd=="number"?e.fd:void 0,this[C]=t,this[qe]=e.readSize||16*1024*1024,this[K]=!1,this[Qe]=typeof e.size=="number"?e.size:1/0,this[jt]=this[Qe],this[nt]=typeof e.autoClose!="boolean"||e.autoClose,typeof this[m]=="number"?this[xt]():this[at]()}get fd(){return this[m]}get path(){return this[C]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[at](){p.open(this[C],"r",(t,e)=>this[It](t,e))}[It](t,e){t?this[Nt](t):(this[m]=e,this.emit("open",e),this[xt]())}[bi](){return Buffer.allocUnsafe(Math.min(this[qe],this[jt]))}[xt](){if(!this[K]){this[K]=!0;let t=this[bi]();if(t.length===0)return process.nextTick(()=>this[Xe](null,0,t));p.read(this[m],t,0,t.length,null,(e,i,s)=>this[Xe](e,i,s))}}[Xe](t,e,i){this[K]=!1,t?this[Nt](t):this[yi](e,i)&&this[xt]()}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}[Nt](t){this[K]=!0,this[P](),this.emit("error",t)}[yi](t,e){let i=!1;return this[jt]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(t===0||this[jt]<=0)&&(i=!1,this[P](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return typeof this[m]=="number"&&this[xt](),!1;case"error":return this[gt]?!1:(this[gt]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}},Fr=class extends Ui{[at](){let t=!0;try{this[It](null,p.openSync(this[C],"r")),t=!1}finally{t&&this[P]()}}[xt](){let t=!0;try{if(!this[K]){this[K]=!0;do{let e=this[bi](),i=e.length===0?0:p.readSync(this[m],e,0,e.length,null);if(!this[yi](i,e))break}while(!0);this[K]=!1}t=!1}finally{t&&this[P]()}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}},Ce=class extends Is{readable=!1;writable=!0;[gt]=!1;[dt]=!1;[Ut]=!1;[U]=[];[ce]=!1;[C];[qt];[nt];[m];[Se];[X];[Ve]=!1;[et];constructor(t,e){e||={},super(e),this[C]=t,this[m]=typeof e.fd=="number"?e.fd:void 0,this[qt]=e.mode===void 0?438:e.mode,this[et]=typeof e.start=="number"?e.start:void 0,this[nt]=typeof e.autoClose!="boolean"||e.autoClose;let i=this[et]===void 0?"w":"r+";this[Se]=e.flags===void 0,this[X]=e.flags===void 0?i:e.flags,this[m]===void 0&&this[at]()}emit(t,...e){if(t==="error"){if(this[gt])return!1;this[gt]=!0}return super.emit(t,...e)}get fd(){return this[m]}get path(){return this[C]}[Nt](t){this[P](),this[dt]=!0,this.emit("error",t)}[at](){p.open(this[C],this[X],this[qt],(t,e)=>this[It](t,e))}[It](t,e){this[Se]&&this[X]==="r+"&&t&&t.code==="ENOENT"?(this[X]="w",this[at]()):t?this[Nt](t):(this[m]=e,this.emit("open",e),this[dt]||this[Ke]())}end(t,e){return t&&this.write(t,e),this[Ut]=!0,!this[dt]&&!this[U].length&&typeof this[m]=="number"&&this[Lt](null,0),this}write(t,e){return typeof t=="string"&&(t=Buffer.from(t,e)),this[Ut]?(this.emit("error",Error("write() after end()")),!1):this[m]===void 0||this[dt]||this[U].length?(this[U].push(t),this[ce]=!0,!1):(this[dt]=!0,this[_e](t),!0)}[_e](t){p.write(this[m],t,0,t.length,this[et],(e,i)=>this[Lt](e,i))}[Lt](t,e){t?this[Nt](t):(this[et]!==void 0&&typeof e=="number"&&(this[et]+=e),this[U].length?this[Ke]():(this[dt]=!1,this[Ut]&&!this[Ve]?(this[Ve]=!0,this[P](),this.emit("finish")):this[ce]&&(this[ce]=!1,this.emit("drain"))))}[Ke](){if(this[U].length===0)this[Ut]&&this[Lt](null,0);else if(this[U].length===1)this[_e](this[U].pop());else{let t=this[U];this[U]=[],Br(this[m],t,this[et],(e,i)=>this[Lt](e,i))}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}},Ms=class extends Ce{[at](){let t;if(this[Se]&&this[X]==="r+")try{t=p.openSync(this[C],this[X],this[qt])}catch(e){if(e?.code==="ENOENT")return this[X]="w",this[at]();throw e}else t=p.openSync(this[C],this[X],this[qt]);this[It](null,t)}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}[_e](t){let e=!0;try{this[Lt](null,p.writeSync(this[m],t,0,t.length,this[et])),e=!1}finally{if(e)try{this[P]()}catch{}}}},Mr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Cr=t=>!!t.sync&&!!t.file,Pr=t=>!t.sync&&!!t.file,zr=t=>!!t.sync&&!t.file,Ur=t=>!t.sync&&!t.file,jr=t=>!!t.file,Hr=t=>Mr.get(t)||t,ji=(t={})=>{if(!t)return{};let e={};for(let[i,s]of Object.entries(t)){let r=Hr(i);e[r]=s}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e},ne=(t,e,i,s,r)=>Object.assign((h=[],n,a)=>{Array.isArray(h)&&(n=h,h={}),typeof n=="function"&&(a=n,n=void 0),n=n?Array.from(n):[];let o=ji(h);if(r?.(o,n),Cr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return t(o,n)}else if(Pr(o)){let l=e(o,n);return a?l.then(()=>a(),a):l}else if(zr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(o,n)}else if(Ur(o)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(o,n)}throw Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r}),Zr=Er.constants||{ZLIB_VERNUM:4736},W=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Zr)),Wr=bt.concat,is=Object.getOwnPropertyDescriptor(bt,"concat"),Gr=t=>t,Je=is?.writable===!0||is?.set!==void 0?t=>{bt.concat=t?Gr:Wr}:t=>{},Et=Symbol("_superWrite"),me=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},ti=Symbol("flushFlag"),Hi=class extends wt{#t=!1;#i=!1;#s;#h;#r;#e;#n;get sawError(){return this.#t}get handle(){return this.#e}get flushFlag(){return this.#s}constructor(t,e){if(!t||typeof t!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(t),this.#s=t.flush??0,this.#h=t.finishFlush??0,this.#r=t.fullFlushFlag??0,typeof qi[e]!="function")throw TypeError("Compression method not supported: "+e);try{this.#e=new qi[e](t)}catch(i){throw new me(i,this.constructor)}this.#n=i=>{this.#t||(this.#t=!0,this.close(),this.emit("error",i))},this.#e?.on("error",i=>this.#n(new me(i))),this.once("end",()=>this.close)}close(){this.#e&&(this.#e.close(),this.#e=void 0,this.emit("close"))}reset(){if(!this.#t)return vi(this.#e,"zlib binding closed"),this.#e.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#r),this.write(Object.assign(bt.alloc(0),{[ti]:t})))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[Et](t){return super.write(t)}write(t,e,i){if(typeof e=="function"&&(i=e,e="utf8"),typeof t=="string"&&(t=bt.from(t,e)),this.#t)return;vi(this.#e,"zlib binding closed");let s=this.#e._handle,r=s.close;s.close=()=>{};let h=this.#e.close;this.#e.close=()=>{},Je(!0);let n;try{let o=typeof t[ti]=="number"?t[ti]:this.#s;n=this.#e._processChunk(t,o),Je(!1)}catch(o){Je(!1),this.#n(new me(o,this.write))}finally{this.#e&&(this.#e._handle=s,s.close=r,this.#e.close=h,this.#e.removeAllListeners("error"))}this.#e&&this.#e.on("error",o=>this.#n(new me(o,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let o=n[0];a=this[Et](bt.from(o));for(let l=1;l<n.length;l++)a=this[Et](n[l])}else a=this[Et](bt.from(n));return i&&i(),a}},Cs=class extends Hi{#t;#i;constructor(t,e){t||={},t.flush=t.flush||W.Z_NO_FLUSH,t.finishFlush=t.finishFlush||W.Z_FINISH,t.fullFlushFlag=W.Z_FULL_FLUSH,super(t,e),this.#t=t.level,this.#i=t.strategy}params(t,e){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#t!==t||this.#i!==e){this.flush(W.Z_SYNC_FLUSH),vi(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(s,r)=>{typeof s=="function"&&(r=s,s=this.flushFlag),this.flush(s),r?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#i=e)}}}},$r=class extends Cs{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[Et](t){return this.#t?(this.#t=!1,t[9]=255,super[Et](t)):super[Et](t)}},Yr=class extends Cs{constructor(t){super(t,"Unzip")}},Ps=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||W.BROTLI_OPERATION_FINISH,t.fullFlushFlag=W.BROTLI_OPERATION_FLUSH,super(t,e)}},Vr=class extends Ps{constructor(t){super(t,"BrotliCompress")}},Kr=class extends Ps{constructor(t){super(t,"BrotliDecompress")}},zs=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.ZSTD_e_continue,t.finishFlush=t.finishFlush||W.ZSTD_e_end,t.fullFlushFlag=W.ZSTD_e_flush,super(t,e)}},Xr=class extends zs{constructor(t){super(t,"ZstdCompress")}},qr=class extends zs{constructor(t){super(t,"ZstdDecompress")}},Qr=(t,e)=>{if(Number.isSafeInteger(t))t<0?th(t,e):Jr(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Jr=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},th=(t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=t&255;t=Math.floor(t/256),i?e[s-1]=Us(r):r===0?e[s-1]=0:(i=!0,e[s-1]=js(r))}},eh=t=>{let e=t[0],i=e===128?sh(t.subarray(1,t.length)):e===255?ih(t):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},ih=t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var h=Number(t[r]),n;s?n=Us(h):h===0?n=h:(s=!0,n=js(h)),n!==0&&(i-=n*256**(e-r-1))}return i},sh=t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);r!==0&&(i+=r*256**(e-s-1))}return i},Us=t=>(255^t)&255,js=t=>(255^t)+1&255,Hs={};_r(Hs,{code:()=>Zi,isCode:()=>Oe,isName:()=>rh,name:()=>Pe,normalFsTypes:()=>Zs});var Oe=t=>Pe.has(t),rh=t=>Zi.has(t),Zs=new Set(["0","","1","2","3","4","5","6","7","D"]),Pe=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Zi=new Map(Array.from(Pe).map(t=>[t[1],t[0]])),hh=t=>t===void 0||t<0?void 0:t,ot=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#i(t)}decode(t,e,i,s){if(e||=0,!t||!(t.length>=e+512))throw Error("need 512 bytes for header");let r=ut(t,e+156,1),h=Zs.has(r),n=h?i:void 0,a=h?s:void 0;if(this.path=n?.path??ut(t,e,100),this.mode=n?.mode??a?.mode??it(t,e+100,8),this.uid=n?.uid??a?.uid??it(t,e+108,8),this.gid=n?.gid??a?.gid??it(t,e+116,8),this.size=hh(n?.size??a?.size??it(t,e+124,12)),this.mtime=n?.mtime??a?.mtime??ei(t,e+136,12),this.cksum=it(t,e+148,12),a&&this.#i(a,!0),n&&this.#i(n),Oe(r)&&(this.#t=r||"0"),this.#t==="0"&&this.path.slice(-1)==="/"&&(this.#t="5"),this.#t==="5"&&(this.size=0),this.linkpath=ut(t,e+157,100),t.subarray(e+257,e+265).toString()==="ustar\x0000")if(this.uname=n?.uname??a?.uname??ut(t,e+265,32),this.gname=n?.gname??a?.gname??ut(t,e+297,32),this.devmaj=n?.devmaj??a?.devmaj??it(t,e+329,8)??0,this.devmin=n?.devmin??a?.devmin??it(t,e+337,8)??0,t[e+475]!==0){let l=ut(t,e+345,155);this.path=l+"/"+this.path}else{let l=ut(t,e+345,130);l&&(this.path=l+"/"+this.path),this.atime=i?.atime??s?.atime??ei(t,e+476,12),this.ctime=i?.ctime??s?.ctime??ei(t,e+488,12)}let o=256;for(let l=e;l<e+148;l++)o+=t[l];for(let l=e+156;l<e+512;l++)o+=t[l];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=!0)}#i(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,s])=>!(s==null||i==="size"&&Number(s)<0||i==="path"&&e||i==="linkpath"&&e||i==="global"))))}encode(t,e=0){if(t||=this.block=Buffer.alloc(512),this.#t==="Unsupported"&&(this.#t="0"),!(t.length>=e+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=nh(this.path||"",i),r=s[0],h=s[1];this.needPax=!!s[2],this.needPax=ft(t,e,100,r)||this.needPax,this.needPax=st(t,e+100,8,this.mode)||this.needPax,this.needPax=st(t,e+108,8,this.uid)||this.needPax,this.needPax=st(t,e+116,8,this.gid)||this.needPax,this.needPax=st(t,e+124,12,this.size)||this.needPax,this.needPax=ii(t,e+136,12,this.mtime)||this.needPax,t[e+156]=Number(this.#t.codePointAt(0)),this.needPax=ft(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=ft(t,e+265,32,this.uname)||this.needPax,this.needPax=ft(t,e+297,32,this.gname)||this.needPax,this.needPax=st(t,e+329,8,this.devmaj)||this.needPax,this.needPax=st(t,e+337,8,this.devmin)||this.needPax,this.needPax=ft(t,e+345,i,h)||this.needPax,t[e+475]===0?(this.needPax=ft(t,e+345,130,h)||this.needPax,this.needPax=ii(t,e+476,12,this.atime)||this.needPax,this.needPax=ii(t,e+488,12,this.ctime)||this.needPax):this.needPax=ft(t,e+345,155,h)||this.needPax;let n=256;for(let a=e;a<e+148;a++)n+=t[a];for(let a=e+156;a<e+512;a++)n+=t[a];return this.cksum=n,st(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#t==="Unsupported"?this.#t:Pe.get(this.#t)}get typeKey(){return this.#t}set type(t){let e=String(Zi.get(t));if(Oe(e)||e==="Unsupported")this.#t=e;else if(Oe(t))this.#t=t;else throw TypeError("invalid entry type: "+t)}},nh=(t,e)=>{let i=t,s="",r,h=Rt.parse(t).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=Rt.dirname(i),i=Rt.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=e?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=e?r=[i.slice(0,99),s,!0]:(i=Rt.join(Rt.basename(s),i),s=Rt.dirname(s));while(s!==h&&r===void 0);r||=[t.slice(0,99),"",!0]}return r},ut=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),ei=(t,e,i)=>ah(it(t,e,i)),ah=t=>t===void 0?void 0:new Date(t*1e3),it=(t,e,i)=>Number(t[e])&128?eh(t.subarray(e,e+i)):lh(t,e,i),oh=t=>isNaN(t)?void 0:t,lh=(t,e,i)=>oh(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),dh={12:8589934591,8:2097151},st=(t,e,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,t.subarray(e,e+i)),!0):(uh(t,e,i,s),!1),uh=(t,e,i,s)=>t.write(fh(s,i),e,i,"ascii"),fh=(t,e)=>ch(Math.floor(t).toString(8),e),ch=(t,e)=>(t.length===e-1?t:Array(e-t.length-1).join("0")+t+" ")+"\0",ii=(t,e,i,s)=>s!==void 0&&st(t,e,i,s.getTime()/1e3),mh=Array(156).join("\0"),ft=(t,e,i,s)=>s===void 0?!1:(t.write(s+mh,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),he=class Ws{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new ot({path:("PaxHeader/"+mr(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(e,512,i,"utf8");for(let h=i+512;h<r.length;h++)r[h]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let i=this[e],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+s+`
1
+ import{createRequire as lr}from"node:module";import{_ as fr}from"../packem_shared/git-source-DExWbfN0.js";let dr;const ur=t=>(dr??=lr(import.meta.url))(t),Ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=t=>{if(typeof Ft<"u"&&Ft.versions&&Ft.versions.node){const[e,i]=Ft.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return Ft.getBuiltinModule(t)}return ur(t)},d=D("node:fs"),cr=D("node:fs/promises"),As=D("node:stream"),c=D("node:path"),{posix:Rt,basename:mr,win32:pr,join:Ns}=c,Is=D("events"),{EventEmitter:vr}=Is,p=D("fs"),{EventEmitter:zi}=D("node:events"),{StringDecoder:yr}=D("node:string_decoder"),re=D("path"),{parse:br,dirname:gr}=re,vi=D("assert"),{Buffer:bt}=D("buffer"),Xi=D("zlib"),qi={...Xi,default:Xi},Er=D("zlib"),wr=D("node:assert"),{randomBytes:Bs}=D("node:crypto");var an=fr({Header:()=>ot,Pack:()=>ae,PackJob:()=>Li,PackSync:()=>je,Parser:()=>At,Pax:()=>he,ReadEntry:()=>Gs,Unpack:()=>Me,UnpackSync:()=>Pi,WriteEntry:()=>Yi,WriteEntrySync:()=>Vs,WriteEntryTar:()=>Ks,c:()=>bs,create:()=>bs,extract:()=>Ds,filesFilter:()=>Wi,list:()=>Bt,r:()=>yt,replace:()=>yt,t:()=>Bt,types:()=>Hs,x:()=>Ds}),Rr=Object.defineProperty,_r=(t,e)=>{for(var i in e)Rr(t,i,{get:e[i],enumerable:!0})},Qi=process||{stdout:null,stderr:null},Sr=t=>!!t&&typeof t=="object"&&(t instanceof wt||t instanceof As||Or(t)||kr(t)),Or=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.pipe=="function"&&t.pipe!==As.Writable.prototype.pipe,kr=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.write=="function"&&typeof t.end=="function",G=Symbol("EOF"),$=Symbol("maybeEmitEnd"),q=Symbol("emittedEnd"),oe=Symbol("emittingEnd"),Mt=Symbol("emittedError"),le=Symbol("closed"),Ji=Symbol("read"),de=Symbol("flush"),ts=Symbol("flushChunk"),B=Symbol("encoding"),_t=Symbol("decoder"),R=Symbol("flowing"),Ct=Symbol("paused"),Tt=Symbol("resume"),_=Symbol("buffer"),x=Symbol("pipes"),S=Symbol("bufferLength"),Ze=Symbol("bufferPush"),ue=Symbol("bufferShift"),L=Symbol("objectMode"),E=Symbol("destroyed"),We=Symbol("error"),Ge=Symbol("emitData"),es=Symbol("emitEnd"),$e=Symbol("emitEnd2"),z=Symbol("async"),Ye=Symbol("abort"),fe=Symbol("aborted"),Pt=Symbol("signal"),lt=Symbol("dataListeners"),A=Symbol("discarded"),zt=t=>Promise.resolve().then(t),Tr=t=>t(),Lr=t=>t==="end"||t==="finish"||t==="prefinish",xr=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Dr=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Fs=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Tt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ar=class extends Fs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=s=>this.dest.emit("error",s),t.on("error",this.proxyErrors)}},Nr=t=>!!t.objectMode,Ir=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",wt=class extends zi{[R]=!1;[Ct]=!1;[x]=[];[_]=[];[L];[B];[z];[_t];[G]=!1;[q]=!1;[oe]=!1;[le]=!1;[Mt]=null;[S]=0;[E]=!1;[Pt];[fe]=!1;[lt]=0;[A]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Nr(e)?(this[L]=!0,this[B]=null):Ir(e)?(this[B]=e.encoding,this[L]=!1):(this[L]=!1,this[B]=null),this[z]=!!e.async,this[_t]=this[B]?new yr(this[B]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[_]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[x]});let{signal:i}=e;i&&(this[Pt]=i,i.aborted?this[Ye]():i.addEventListener("abort",()=>this[Ye]()))}get bufferLength(){return this[S]}get encoding(){return this[B]}set encoding(t){throw Error("Encoding must be set at instantiation time")}setEncoding(t){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(t){throw Error("objectMode must be set at instantiation time")}get async(){return this[z]}set async(t){this[z]=this[z]||!!t}[Ye](){this[fe]=!0,this.emit("abort",this[Pt]?.reason),this.destroy(this[Pt]?.reason)}get aborted(){return this[fe]}set aborted(t){}write(t,e,i){if(this[fe])return!1;if(this[G])throw Error("write after end");if(this[E])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(i=e,e="utf8"),e||="utf8";let s=this[z]?zt:Tr;if(!this[L]&&!Buffer.isBuffer(t)){if(Dr(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(xr(t))t=Buffer.from(t);else if(typeof t!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):t.length?(typeof t=="string"&&!(e===this[B]&&!this[_t]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[B]&&(t=this[_t].write(t)),this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):(this[S]!==0&&this.emit("readable"),i&&s(i),this[R])}read(t){if(this[E])return null;if(this[A]=!1,this[S]===0||t===0||t&&t>this[S])return this[$](),null;this[L]&&(t=null),this[_].length>1&&!this[L]&&(this[_]=[this[B]?this[_].join(""):Buffer.concat(this[_],this[S])]);let e=this[Ji](t||null,this[_][0]);return this[$](),e}[Ji](t,e){if(this[L])this[ue]();else{let i=e;t===i.length||t===null?this[ue]():typeof i=="string"?(this[_][0]=i.slice(t),e=i.slice(0,t),this[S]-=t):(this[_][0]=i.subarray(t),e=i.subarray(0,t),this[S]-=t)}return this.emit("data",e),!this[_].length&&!this[G]&&this.emit("drain"),e}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e="utf8"),t!==void 0&&this.write(t,e),i&&this.once("end",i),this[G]=!0,this.writable=!1,(this[R]||!this[Ct])&&this[$](),this}[Tt](){this[E]||(!this[lt]&&!this[x].length&&(this[A]=!0),this[Ct]=!1,this[R]=!0,this.emit("resume"),this[_].length?this[de]():this[G]?this[$]():this.emit("drain"))}resume(){return this[Tt]()}pause(){this[R]=!1,this[Ct]=!0,this[A]=!1}get destroyed(){return this[E]}get flowing(){return this[R]}get paused(){return this[Ct]}[Ze](t){this[L]?this[S]+=1:this[S]+=t.length,this[_].push(t)}[ue](){return this[L]?--this[S]:this[S]-=this[_][0].length,this[_].shift()}[de](t=!1){do;while(this[ts](this[ue]())&&this[_].length);!t&&!this[_].length&&!this[G]&&this.emit("drain")}[ts](t){return this.emit("data",t),this[R]}pipe(t,e){if(this[E])return t;this[A]=!1;let i=this[q];return e||={},t===Qi.stdout||t===Qi.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[x].push(e.proxyErrors?new Ar(this,t,e):new Fs(this,t,e)),this[z]?zt(()=>this[Tt]()):this[Tt]()),t}unpipe(t){let e=this[x].find(i=>i.dest===t);e&&(this[x].length===1?(this[R]&&this[lt]===0&&(this[R]=!1),this[x]=[]):this[x].splice(this[x].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if(t==="data")this[A]=!1,this[lt]++,!this[x].length&&!this[R]&&this[Tt]();else if(t==="readable"&&this[S]!==0)super.emit("readable");else if(Lr(t)&&this[q])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Mt]){let s=e;this[z]?zt(()=>s.call(this,this[Mt])):s.call(this,this[Mt])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return t==="data"&&(this[lt]=this.listeners("data").length,this[lt]===0&&!this[A]&&!this[x].length&&(this[R]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[lt]=0,!this[A]&&!this[x].length&&(this[R]=!1)),e}get emittedEnd(){return this[q]}[$](){!this[oe]&&!this[q]&&!this[E]&&this[_].length===0&&this[G]&&(this[oe]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[le]&&this.emit("close"),this[oe]=!1)}emit(t,...e){let i=e[0];if(t!=="error"&&t!=="close"&&t!==E&&this[E])return!1;if(t==="data")return!this[L]&&!i?!1:this[z]?(zt(()=>this[Ge](i)),!0):this[Ge](i);if(t==="end")return this[es]();if(t==="close"){if(this[le]=!0,!this[q]&&!this[E])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[Mt]=i,super.emit(We,i);let r=!this[Pt]||this.listeners("error").length?super.emit("error",i):!1;return this[$](),r}else if(t==="resume"){let r=super.emit("resume");return this[$](),r}else if(t==="finish"||t==="prefinish"){let r=super.emit(t);return this.removeAllListeners(t),r}let s=super.emit(t,...e);return this[$](),s}[Ge](t){for(let i of this[x])i.dest.write(t)===!1&&this.pause();let e=!this[A]&&super.emit("data",t);return this[$](),e}[es](){return this[q]?!1:(this[q]=!0,this.readable=!1,this[z]?(zt(()=>this[$e]()),!0):this[$e]())}[$e](){if(this[_t]){let e=this[_t].end();if(e){for(let i of this[x])i.dest.write(e);this[A]||super.emit("data",e)}}for(let e of this[x])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[L]||(t.dataLength=0);let e=this.promise();return this.on("data",i=>{t.push(i),this[L]||(t.dataLength+=i.length)}),await e,t}async concat(){if(this[L])throw Error("cannot concat in objectMode");let t=await this.collect();return this[B]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(E,()=>e(Error("stream destroyed"))),this.on("error",i=>e(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[A]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[G])return e();let s,r,h=l=>{this.off("data",n),this.off("end",a),this.off(E,o),e(),r(l)},n=l=>{this.off("error",h),this.off("end",a),this.off(E,o),this.pause(),s({value:l,done:!!this[G]})},a=()=>{this.off("error",h),this.off("data",n),this.off(E,o),e(),s({done:!0,value:void 0})},o=()=>h(Error("stream destroyed"));return new Promise((l,u)=>{r=u,s=l,this.once(E,o),this.once("error",h),this.once("end",a),this.once("data",n)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[A]=!1;let t=!1,e=()=>(this.pause(),this.off(We,e),this.off(E,e),this.off("end",e),t=!0,{done:!0,value:void 0});return this.once("end",e),this.once(We,e),this.once(E,e),{next:()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}},throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[E])return t?this.emit("error",t):this.emit(E),this;this[E]=!0,this[A]=!0,this[_].length=0,this[S]=0;let e=this;return typeof e.close=="function"&&!this[le]&&e.close(),t?this.emit("error",t):this.emit(E),this}static get isStream(){return Sr}},Br=p.writev,nt=Symbol("_autoClose"),P=Symbol("_close"),Ut=Symbol("_ended"),m=Symbol("_fd"),Ve=Symbol("_finished"),X=Symbol("_flags"),Ke=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qt=Symbol("_mode"),ce=Symbol("_needDrain"),Nt=Symbol("_onerror"),It=Symbol("_onopen"),Xe=Symbol("_onread"),Lt=Symbol("_onwrite"),at=Symbol("_open"),C=Symbol("_path"),et=Symbol("_pos"),U=Symbol("_queue"),xt=Symbol("_read"),qe=Symbol("_readSize"),K=Symbol("_reading"),jt=Symbol("_remain"),Qe=Symbol("_size"),_e=Symbol("_write"),dt=Symbol("_writing"),Se=Symbol("_defaultFlag"),gt=Symbol("_errored"),Ui=class extends wt{[gt]=!1;[m];[C];[qe];[K]=!1;[Qe];[jt];[nt];constructor(t,e){if(e||={},super(e),this.readable=!0,this.writable=!1,typeof t!="string")throw TypeError("path must be a string");this[gt]=!1,this[m]=typeof e.fd=="number"?e.fd:void 0,this[C]=t,this[qe]=e.readSize||16*1024*1024,this[K]=!1,this[Qe]=typeof e.size=="number"?e.size:1/0,this[jt]=this[Qe],this[nt]=typeof e.autoClose!="boolean"||e.autoClose,typeof this[m]=="number"?this[xt]():this[at]()}get fd(){return this[m]}get path(){return this[C]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[at](){p.open(this[C],"r",(t,e)=>this[It](t,e))}[It](t,e){t?this[Nt](t):(this[m]=e,this.emit("open",e),this[xt]())}[bi](){return Buffer.allocUnsafe(Math.min(this[qe],this[jt]))}[xt](){if(!this[K]){this[K]=!0;let t=this[bi]();if(t.length===0)return process.nextTick(()=>this[Xe](null,0,t));p.read(this[m],t,0,t.length,null,(e,i,s)=>this[Xe](e,i,s))}}[Xe](t,e,i){this[K]=!1,t?this[Nt](t):this[yi](e,i)&&this[xt]()}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}[Nt](t){this[K]=!0,this[P](),this.emit("error",t)}[yi](t,e){let i=!1;return this[jt]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(t===0||this[jt]<=0)&&(i=!1,this[P](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return typeof this[m]=="number"&&this[xt](),!1;case"error":return this[gt]?!1:(this[gt]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}},Fr=class extends Ui{[at](){let t=!0;try{this[It](null,p.openSync(this[C],"r")),t=!1}finally{t&&this[P]()}}[xt](){let t=!0;try{if(!this[K]){this[K]=!0;do{let e=this[bi](),i=e.length===0?0:p.readSync(this[m],e,0,e.length,null);if(!this[yi](i,e))break}while(!0);this[K]=!1}t=!1}finally{t&&this[P]()}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}},Ce=class extends Is{readable=!1;writable=!0;[gt]=!1;[dt]=!1;[Ut]=!1;[U]=[];[ce]=!1;[C];[qt];[nt];[m];[Se];[X];[Ve]=!1;[et];constructor(t,e){e||={},super(e),this[C]=t,this[m]=typeof e.fd=="number"?e.fd:void 0,this[qt]=e.mode===void 0?438:e.mode,this[et]=typeof e.start=="number"?e.start:void 0,this[nt]=typeof e.autoClose!="boolean"||e.autoClose;let i=this[et]===void 0?"w":"r+";this[Se]=e.flags===void 0,this[X]=e.flags===void 0?i:e.flags,this[m]===void 0&&this[at]()}emit(t,...e){if(t==="error"){if(this[gt])return!1;this[gt]=!0}return super.emit(t,...e)}get fd(){return this[m]}get path(){return this[C]}[Nt](t){this[P](),this[dt]=!0,this.emit("error",t)}[at](){p.open(this[C],this[X],this[qt],(t,e)=>this[It](t,e))}[It](t,e){this[Se]&&this[X]==="r+"&&t&&t.code==="ENOENT"?(this[X]="w",this[at]()):t?this[Nt](t):(this[m]=e,this.emit("open",e),this[dt]||this[Ke]())}end(t,e){return t&&this.write(t,e),this[Ut]=!0,!this[dt]&&!this[U].length&&typeof this[m]=="number"&&this[Lt](null,0),this}write(t,e){return typeof t=="string"&&(t=Buffer.from(t,e)),this[Ut]?(this.emit("error",Error("write() after end()")),!1):this[m]===void 0||this[dt]||this[U].length?(this[U].push(t),this[ce]=!0,!1):(this[dt]=!0,this[_e](t),!0)}[_e](t){p.write(this[m],t,0,t.length,this[et],(e,i)=>this[Lt](e,i))}[Lt](t,e){t?this[Nt](t):(this[et]!==void 0&&typeof e=="number"&&(this[et]+=e),this[U].length?this[Ke]():(this[dt]=!1,this[Ut]&&!this[Ve]?(this[Ve]=!0,this[P](),this.emit("finish")):this[ce]&&(this[ce]=!1,this.emit("drain"))))}[Ke](){if(this[U].length===0)this[Ut]&&this[Lt](null,0);else if(this[U].length===1)this[_e](this[U].pop());else{let t=this[U];this[U]=[],Br(this[m],t,this[et],(e,i)=>this[Lt](e,i))}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}},Ms=class extends Ce{[at](){let t;if(this[Se]&&this[X]==="r+")try{t=p.openSync(this[C],this[X],this[qt])}catch(e){if(e?.code==="ENOENT")return this[X]="w",this[at]();throw e}else t=p.openSync(this[C],this[X],this[qt]);this[It](null,t)}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}[_e](t){let e=!0;try{this[Lt](null,p.writeSync(this[m],t,0,t.length,this[et])),e=!1}finally{if(e)try{this[P]()}catch{}}}},Mr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Cr=t=>!!t.sync&&!!t.file,Pr=t=>!t.sync&&!!t.file,zr=t=>!!t.sync&&!t.file,Ur=t=>!t.sync&&!t.file,jr=t=>!!t.file,Hr=t=>Mr.get(t)||t,ji=(t={})=>{if(!t)return{};let e={};for(let[i,s]of Object.entries(t)){let r=Hr(i);e[r]=s}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e},ne=(t,e,i,s,r)=>Object.assign((h=[],n,a)=>{Array.isArray(h)&&(n=h,h={}),typeof n=="function"&&(a=n,n=void 0),n=n?Array.from(n):[];let o=ji(h);if(r?.(o,n),Cr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return t(o,n)}else if(Pr(o)){let l=e(o,n);return a?l.then(()=>a(),a):l}else if(zr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(o,n)}else if(Ur(o)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(o,n)}throw Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r}),Zr=Er.constants||{ZLIB_VERNUM:4736},W=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Zr)),Wr=bt.concat,is=Object.getOwnPropertyDescriptor(bt,"concat"),Gr=t=>t,Je=is?.writable===!0||is?.set!==void 0?t=>{bt.concat=t?Gr:Wr}:t=>{},Et=Symbol("_superWrite"),me=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},ti=Symbol("flushFlag"),Hi=class extends wt{#t=!1;#i=!1;#s;#h;#r;#e;#n;get sawError(){return this.#t}get handle(){return this.#e}get flushFlag(){return this.#s}constructor(t,e){if(!t||typeof t!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(t),this.#s=t.flush??0,this.#h=t.finishFlush??0,this.#r=t.fullFlushFlag??0,typeof qi[e]!="function")throw TypeError("Compression method not supported: "+e);try{this.#e=new qi[e](t)}catch(i){throw new me(i,this.constructor)}this.#n=i=>{this.#t||(this.#t=!0,this.close(),this.emit("error",i))},this.#e?.on("error",i=>this.#n(new me(i))),this.once("end",()=>this.close)}close(){this.#e&&(this.#e.close(),this.#e=void 0,this.emit("close"))}reset(){if(!this.#t)return vi(this.#e,"zlib binding closed"),this.#e.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#r),this.write(Object.assign(bt.alloc(0),{[ti]:t})))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[Et](t){return super.write(t)}write(t,e,i){if(typeof e=="function"&&(i=e,e="utf8"),typeof t=="string"&&(t=bt.from(t,e)),this.#t)return;vi(this.#e,"zlib binding closed");let s=this.#e._handle,r=s.close;s.close=()=>{};let h=this.#e.close;this.#e.close=()=>{},Je(!0);let n;try{let o=typeof t[ti]=="number"?t[ti]:this.#s;n=this.#e._processChunk(t,o),Je(!1)}catch(o){Je(!1),this.#n(new me(o,this.write))}finally{this.#e&&(this.#e._handle=s,s.close=r,this.#e.close=h,this.#e.removeAllListeners("error"))}this.#e&&this.#e.on("error",o=>this.#n(new me(o,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let o=n[0];a=this[Et](bt.from(o));for(let l=1;l<n.length;l++)a=this[Et](n[l])}else a=this[Et](bt.from(n));return i&&i(),a}},Cs=class extends Hi{#t;#i;constructor(t,e){t||={},t.flush=t.flush||W.Z_NO_FLUSH,t.finishFlush=t.finishFlush||W.Z_FINISH,t.fullFlushFlag=W.Z_FULL_FLUSH,super(t,e),this.#t=t.level,this.#i=t.strategy}params(t,e){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#t!==t||this.#i!==e){this.flush(W.Z_SYNC_FLUSH),vi(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(s,r)=>{typeof s=="function"&&(r=s,s=this.flushFlag),this.flush(s),r?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#i=e)}}}},$r=class extends Cs{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[Et](t){return this.#t?(this.#t=!1,t[9]=255,super[Et](t)):super[Et](t)}},Yr=class extends Cs{constructor(t){super(t,"Unzip")}},Ps=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||W.BROTLI_OPERATION_FINISH,t.fullFlushFlag=W.BROTLI_OPERATION_FLUSH,super(t,e)}},Vr=class extends Ps{constructor(t){super(t,"BrotliCompress")}},Kr=class extends Ps{constructor(t){super(t,"BrotliDecompress")}},zs=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.ZSTD_e_continue,t.finishFlush=t.finishFlush||W.ZSTD_e_end,t.fullFlushFlag=W.ZSTD_e_flush,super(t,e)}},Xr=class extends zs{constructor(t){super(t,"ZstdCompress")}},qr=class extends zs{constructor(t){super(t,"ZstdDecompress")}},Qr=(t,e)=>{if(Number.isSafeInteger(t))t<0?th(t,e):Jr(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Jr=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},th=(t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=t&255;t=Math.floor(t/256),i?e[s-1]=Us(r):r===0?e[s-1]=0:(i=!0,e[s-1]=js(r))}},eh=t=>{let e=t[0],i=e===128?sh(t.subarray(1,t.length)):e===255?ih(t):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},ih=t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var h=Number(t[r]),n;s?n=Us(h):h===0?n=h:(s=!0,n=js(h)),n!==0&&(i-=n*256**(e-r-1))}return i},sh=t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);r!==0&&(i+=r*256**(e-s-1))}return i},Us=t=>(255^t)&255,js=t=>(255^t)+1&255,Hs={};_r(Hs,{code:()=>Zi,isCode:()=>Oe,isName:()=>rh,name:()=>Pe,normalFsTypes:()=>Zs});var Oe=t=>Pe.has(t),rh=t=>Zi.has(t),Zs=new Set(["0","","1","2","3","4","5","6","7","D"]),Pe=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Zi=new Map(Array.from(Pe).map(t=>[t[1],t[0]])),hh=t=>t===void 0||t<0?void 0:t,ot=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#i(t)}decode(t,e,i,s){if(e||=0,!t||!(t.length>=e+512))throw Error("need 512 bytes for header");let r=ut(t,e+156,1),h=Zs.has(r),n=h?i:void 0,a=h?s:void 0;if(this.path=n?.path??ut(t,e,100),this.mode=n?.mode??a?.mode??it(t,e+100,8),this.uid=n?.uid??a?.uid??it(t,e+108,8),this.gid=n?.gid??a?.gid??it(t,e+116,8),this.size=hh(n?.size??a?.size??it(t,e+124,12)),this.mtime=n?.mtime??a?.mtime??ei(t,e+136,12),this.cksum=it(t,e+148,12),a&&this.#i(a,!0),n&&this.#i(n),Oe(r)&&(this.#t=r||"0"),this.#t==="0"&&this.path.slice(-1)==="/"&&(this.#t="5"),this.#t==="5"&&(this.size=0),this.linkpath=ut(t,e+157,100),t.subarray(e+257,e+265).toString()==="ustar\x0000")if(this.uname=n?.uname??a?.uname??ut(t,e+265,32),this.gname=n?.gname??a?.gname??ut(t,e+297,32),this.devmaj=n?.devmaj??a?.devmaj??it(t,e+329,8)??0,this.devmin=n?.devmin??a?.devmin??it(t,e+337,8)??0,t[e+475]!==0){let l=ut(t,e+345,155);this.path=l+"/"+this.path}else{let l=ut(t,e+345,130);l&&(this.path=l+"/"+this.path),this.atime=i?.atime??s?.atime??ei(t,e+476,12),this.ctime=i?.ctime??s?.ctime??ei(t,e+488,12)}let o=256;for(let l=e;l<e+148;l++)o+=t[l];for(let l=e+156;l<e+512;l++)o+=t[l];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=!0)}#i(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,s])=>!(s==null||i==="size"&&Number(s)<0||i==="path"&&e||i==="linkpath"&&e||i==="global"))))}encode(t,e=0){if(t||=this.block=Buffer.alloc(512),this.#t==="Unsupported"&&(this.#t="0"),!(t.length>=e+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=nh(this.path||"",i),r=s[0],h=s[1];this.needPax=!!s[2],this.needPax=ft(t,e,100,r)||this.needPax,this.needPax=st(t,e+100,8,this.mode)||this.needPax,this.needPax=st(t,e+108,8,this.uid)||this.needPax,this.needPax=st(t,e+116,8,this.gid)||this.needPax,this.needPax=st(t,e+124,12,this.size)||this.needPax,this.needPax=ii(t,e+136,12,this.mtime)||this.needPax,t[e+156]=Number(this.#t.codePointAt(0)),this.needPax=ft(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=ft(t,e+265,32,this.uname)||this.needPax,this.needPax=ft(t,e+297,32,this.gname)||this.needPax,this.needPax=st(t,e+329,8,this.devmaj)||this.needPax,this.needPax=st(t,e+337,8,this.devmin)||this.needPax,this.needPax=ft(t,e+345,i,h)||this.needPax,t[e+475]===0?(this.needPax=ft(t,e+345,130,h)||this.needPax,this.needPax=ii(t,e+476,12,this.atime)||this.needPax,this.needPax=ii(t,e+488,12,this.ctime)||this.needPax):this.needPax=ft(t,e+345,155,h)||this.needPax;let n=256;for(let a=e;a<e+148;a++)n+=t[a];for(let a=e+156;a<e+512;a++)n+=t[a];return this.cksum=n,st(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#t==="Unsupported"?this.#t:Pe.get(this.#t)}get typeKey(){return this.#t}set type(t){let e=String(Zi.get(t));if(Oe(e)||e==="Unsupported")this.#t=e;else if(Oe(t))this.#t=t;else throw TypeError("invalid entry type: "+t)}},nh=(t,e)=>{let i=t,s="",r,h=Rt.parse(t).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=Rt.dirname(i),i=Rt.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=e?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=e?r=[i.slice(0,99),s,!0]:(i=Rt.join(Rt.basename(s),i),s=Rt.dirname(s));while(s!==h&&r===void 0);r||=[t.slice(0,99),"",!0]}return r},ut=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),ei=(t,e,i)=>ah(it(t,e,i)),ah=t=>t===void 0?void 0:new Date(t*1e3),it=(t,e,i)=>Number(t[e])&128?eh(t.subarray(e,e+i)):lh(t,e,i),oh=t=>isNaN(t)?void 0:t,lh=(t,e,i)=>oh(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),dh={12:8589934591,8:2097151},st=(t,e,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,t.subarray(e,e+i)),!0):(uh(t,e,i,s),!1),uh=(t,e,i,s)=>t.write(fh(s,i),e,i,"ascii"),fh=(t,e)=>ch(Math.floor(t).toString(8),e),ch=(t,e)=>(t.length===e-1?t:Array(e-t.length-1).join("0")+t+" ")+"\0",ii=(t,e,i,s)=>s!==void 0&&st(t,e,i,s.getTime()/1e3),mh=Array(156).join("\0"),ft=(t,e,i,s)=>s===void 0?!1:(t.write(s+mh,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),he=class Ws{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new ot({path:("PaxHeader/"+mr(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(e,512,i,"utf8");for(let h=i+512;h<r.length;h++)r[h]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let i=this[e],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+s+`
2
2
  `,h=Buffer.byteLength(r),n=Math.floor(Math.log(h)/Math.log(10))+1;return h+n>=10**n&&(n+=1),n+h+r}static parse(e,i,s=!1){return new Ws(ph(vh(e),i),s)}},ph=(t,e)=>e?Object.assign({},e,t):t,vh=t=>t.replace(/\n$/,"").split(`
3
3
  `).reduce(yh,Object.create(null)),yh=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;e=e.slice((i+" ").length);let s=e.split("="),r=s.shift();if(!r)return t;let h=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=s.join("=").replace(/\0.*/,"");switch(h){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":t[h]=n;break;case"ctime":case"atime":case"mtime":t[h]=new Date(Number(n)*1e3);break;case"size":let a=+n;a>=0&&(t[h]=a);break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":t[h]=+n;break}return t},f=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?t=>String(t).replaceAll(/\\/g,"/"):t=>String(t),Gs=class extends wt{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw Error("no path provided for tar.ReadEntry");this.path=f(t.path),this.mode=t.mode,this.mode&&(this.mode&=4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?f(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#t(e),i&&this.#t(i,!0)}write(t){let e=t.length;if(e>this.blockRemain)throw Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,s-e),this.ignore?!0:i>=e?super.write(t):super.write(t.subarray(0,i))}#t(t,e=!1){t.path&&=f(t.path),t.linkpath&&=f(t.linkpath),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,s])=>!(s==null||i==="path"&&e))))}},ze=(t,e,i,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=i instanceof Error&&i.code||e,s.tarCode=e,!t.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),t.emit("warn",e,i,s)):i instanceof Error?t.emit("error",Object.assign(i,s)):t.emit("error",Object.assign(Error(`${e}: ${i}`),s))},bh=1024*1024,gi=Buffer.from([31,139]),Ei=Buffer.from([40,181,47,253]),gh=Math.max(gi.length,Ei.length),N=Symbol("state"),ct=Symbol("writeEntry"),Y=Symbol("readEntry"),si=Symbol("nextEntry"),ss=Symbol("processEntry"),j=Symbol("extendedHeader"),Ht=Symbol("globalExtendedHeader"),Q=Symbol("meta"),rs=Symbol("emitMeta"),v=Symbol("buffer"),V=Symbol("queue"),J=Symbol("ended"),ri=Symbol("emittedEnd"),mt=Symbol("emit"),g=Symbol("unzip"),pe=Symbol("consumeChunk"),ve=Symbol("consumeChunkSub"),hi=Symbol("consumeBody"),hs=Symbol("consumeMeta"),ns=Symbol("consumeHeader"),Zt=Symbol("consuming"),ni=Symbol("bufferConcat"),ye=Symbol("maybeEnd"),St=Symbol("writing"),H=Symbol("aborted"),be=Symbol("onDone"),pt=Symbol("sawValidEntry"),ge=Symbol("sawNullBlock"),Ee=Symbol("sawEOF"),as=Symbol("closeStream"),Eh=1e3,Wt=Symbol("compressedBytesRead"),ai=Symbol("decompressedBytesRead"),os=Symbol("checkDecompressionRatio"),wh=()=>!0,At=class extends vr{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=!0;readable=!1;[V]=[];[v];[Y];[ct];[N]="begin";[Q]="";[j];[Ht];[J]=!1;[g];[H]=!1;[pt];[ge]=!1;[Ee]=!1;[St]=!1;[Zt]=!1;[ri]=!1;[Wt]=0;[ai]=0;constructor(t={}){super(),this.file=t.file||"",this.on(be,()=>{(this[N]==="begin"||this[pt]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(be,t.ondone):this.on(be,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxDecompressionRatio=typeof t.maxDecompressionRatio=="number"?t.maxDecompressionRatio:Eh,this.maxMetaEntrySize=t.maxMetaEntrySize||bh,this.filter=typeof t.filter=="function"?t.filter:wh;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:e?void 0:!1;let i=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:i?!0:void 0,this.on("end",()=>this[as]()),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){ze(this,t,e,i)}[ns](t,e){this[pt]===void 0&&(this[pt]=!1);let i;try{i=new ot(t,e,this[j],this[Ht])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[ge]?(this[Ee]=!0,this[N]==="begin"&&(this[N]="header"),this[mt]("eof")):(this[ge]=!0,this[mt]("nullBlock"));else if(this[ge]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let s=i.type;if(/^(Symbolic)?Link$/.test(s)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let r=this[ct]=new Gs(i,this[j],this[Ht]);this[pt]||(r.remain?r.on("end",()=>{r.invalid||(this[pt]=!0)}):this[pt]=!0),r.meta?r.size>this.maxMetaEntrySize?(r.ignore=!0,this[mt]("ignoredEntry",r),this[N]="ignore",r.resume()):r.size>0&&(this[Q]="",r.on("data",h=>this[Q]+=h),this[N]="meta"):(this[j]=void 0,r.ignore=r.ignore||!this.filter(r.path,r),r.ignore?(this[mt]("ignoredEntry",r),this[N]=r.remain?"ignore":"header",r.resume()):(r.remain?this[N]="body":(this[N]="header",r.end()),this[Y]?this[V].push(r):(this[V].push(r),this[si]())))}}}[as](){queueMicrotask(()=>this.emit("close"))}[ss](t){let e=!0;if(!t)this[Y]=void 0,e=!1;else if(Array.isArray(t)){let[i,...s]=t;this.emit(i,...s)}else this[Y]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",()=>this[si]()),e=!1);return e}[si](){do;while(this[ss](this[V].shift()));if(this[V].length===0){let t=this[Y];!t||t.flowing||t.size===t.remain?this[St]||this.emit("drain"):t.once("drain",()=>this.emit("drain"))}}[hi](t,e){let i=this[ct];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=t.length&&e===0?t:t.subarray(e,e+s);return i.write(r),i.blockRemain||(this[N]="header",this[ct]=void 0,i.end()),r.length}[hs](t,e){let i=this[ct],s=this[hi](t,e);return!this[ct]&&i&&this[rs](i),s}[mt](t,e,i){this[V].length===0&&!this[Y]?this.emit(t,e,i):this[V].push([t,e,i])}[rs](t){switch(this[mt]("meta",this[Q]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[j]=he.parse(this[Q],this[j],!1);break;case"GlobalExtendedHeader":this[Ht]=he.parse(this[Q],this[Ht],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let e=this[j]??Object.create(null);this[j]=e,e.path=this[Q].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let e=this[j]||Object.create(null);this[j]=e,e.linkpath=this[Q].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+t.type)}}abort(t){if(!this[H]){if(this[g]){let e=this[g];e.write=()=>!0,e.end=()=>e,e.emit=()=>!1,e.destroy?.()}this[H]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}}[os](t){this[ai]+=t.length;let e=this[ai]/this[Wt];return e>this.maxDecompressionRatio?(this.abort(Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${this.maxDecompressionRatio}`)),!1):!0}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this[H])return i?.(),!1;if((this[g]===void 0||this.brotli===void 0&&this[g]===!1)&&t){if(this[v]&&(t=Buffer.concat([this[v],t]),this[v]=void 0),t.length<gh)return this[v]=t,i?.(),!0;for(let n=0;this[g]===void 0&&n<gi.length;n++)t[n]!==gi[n]&&(this[g]=!1);let r=!1;if(this[g]===!1&&this.zstd!==!1){r=!0;for(let n=0;n<Ei.length;n++)if(t[n]!==Ei[n]){r=!1;break}}let h=this.brotli===void 0&&!r;if(this[g]===!1&&h)if(t.length<512)if(this[J])this.brotli=!0;else return this[v]=t,i?.(),!0;else try{new ot(t.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[g]===void 0||this[g]===!1&&(this.brotli||r)){let n=this[J];this[J]=!1,this[g]=this[g]===void 0?new Yr({}):r?new qr({}):new Kr({}),this[g].on("data",o=>{this[os](o)&&this[pe](o)}),this[g].on("error",o=>{this[H]||this.abort(o)}),this[g].on("end",()=>{this[J]=!0,this[pe]()}),this[St]=!0,this[Wt]+=t.length;let a=!!this[g][n?"end":"write"](t);return this[St]=!1,i?.(),a}}this[St]=!0,this[g]?(this[Wt]+=t.length,this[g].write(t)):this[pe](t),this[St]=!1;let s=this[V].length>0?!1:!this[Y]||this[Y].flowing;return!s&&this[V].length===0&&this[Y]?.once("drain",()=>this.emit("drain")),i?.(),s}[ni](t){t&&!this[H]&&(this[v]=this[v]?Buffer.concat([this[v],t]):t)}[ye](){if(this[J]&&!this[ri]&&!this[H]&&!this[Zt]){this[ri]=!0;let t=this[ct];if(t?.blockRemain){let e=this[v]?this[v].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[v]&&t.write(this[v]),t.end()}this[mt](be)}}[pe](t){if(this[Zt]&&t)this[ni](t);else if(!t&&!this[v])this[ye]();else if(t){if(this[Zt]=!0,this[v]){this[ni](t);let e=this[v];this[v]=void 0,this[ve](e)}else this[ve](t);for(;this[v]&&this[v]?.length>=512&&!this[H]&&!this[Ee];){let e=this[v];this[v]=void 0,this[ve](e)}this[Zt]=!1}(!this[v]||this[J])&&this[ye]()}[ve](t){let e=0,i=t.length;for(;e+512<=i&&!this[H]&&!this[Ee];)switch(this[N]){case"begin":case"header":this[ns](t,e),e+=512;break;case"ignore":case"body":e+=this[hi](t,e);break;case"meta":e+=this[hs](t,e);break;default:throw Error("invalid state: "+this[N])}e<i&&(this[v]=this[v]?Buffer.concat([t.subarray(e),this[v]]):t.subarray(e))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,e)),i&&this.once("finish",i),this[H]||(this[g]?(t&&(this[Wt]+=t.length,this[g].write(t)),this[g].end()):(this[J]=!0,(this.brotli===void 0||this.zstd===void 0)&&(t||=Buffer.alloc(0)),t&&this.write(t),this[ye]())),this}},Qt=t=>{let e=t.length-1,i=-1;for(;e>-1&&t.charAt(e)==="/";)i=e,e--;return i===-1?t:t.slice(0,i)},Rh=t=>{let e=t.onReadEntry;t.onReadEntry=e?i=>{e(i),i.resume()}:i=>i.resume()},Wi=(t,e)=>{let i=new Map(e.map(h=>[Qt(h),!0])),s=t.filter,r=(h,n="",a=0)=>{if(a>=100)return i.set(h,!1),!1;let o=n||br(h).root||".",l;if(h===o)l=!1;else{let u=i.get(h);l=u===void 0?r(gr(h),o,a+1):u}return i.set(h,l),l};t.filter=s?(h,n)=>s(h,n)&&r(Qt(h)):h=>r(Qt(h))},Bt=ne(t=>{let e=new At(t),i=t.file,s;try{s=d.openSync(i,"r");let r=d.fstatSync(s),h=t.maxReadSize||16*1024*1024;if(r.size<h){let n=Buffer.allocUnsafe(r.size),a=d.readSync(s,n,0,r.size,0);e.end(a===n.byteLength?n:n.subarray(0,a))}else{let n=0,a=Buffer.allocUnsafe(h);for(;n<r.size;){let o=d.readSync(s,a,0,h,n);if(o===0)break;n+=o,e.write(a.subarray(0,o))}e.end()}}finally{if(typeof s=="number")try{d.closeSync(s)}catch{}}},(t,e)=>{let i=new At(t),s=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((h,n)=>{i.on("error",n),i.on("end",h),d.stat(r,(a,o)=>{if(a)n(a);else{let l=new Ui(r,{readSize:s,size:o.size});l.on("error",n),l.pipe(i)}})})},t=>new At(t),t=>new At(t),(t,e)=>{e?.length&&Wi(t,e),t.noResume||Rh(t)}),$s=(t,e,i)=>(t&=4095,i&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t),{isAbsolute:_h,parse:ls}=pr,Gi=t=>{let e="",i=ls(t);for(;_h(t)||i.root;){let s=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(s.length),e+=s,i=ls(t)}return[e,t]},Ue=["|","<",">","?",":"],$i=Ue.map(t=>String.fromCodePoint(61440+Number(t.codePointAt(0)))),Sh=new Map(Ue.map((t,e)=>[t,$i[e]])),Oh=new Map($i.map((t,e)=>[t,Ue[e]])),ds=t=>Ue.reduce((e,i)=>e.split(i).join(Sh.get(i)),t),kh=t=>$i.reduce((e,i)=>e.split(i).join(Oh.get(i)),t),Ys=(t,e)=>e?(t=f(t).replace(/^\.(\/|$)/,""),Qt(e)+"/"+t):f(t),Th=16*1024*1024,us=Symbol("process"),fs=Symbol("file"),cs=Symbol("directory"),wi=Symbol("symlink"),ms=Symbol("hardlink"),Gt=Symbol("header"),ke=Symbol("read"),Ri=Symbol("lstat"),Te=Symbol("onlstat"),_i=Symbol("onread"),Si=Symbol("onreadlink"),Oi=Symbol("openfile"),ki=Symbol("onopenfile"),rt=Symbol("close"),Be=Symbol("mode"),Ti=Symbol("awaitDrain"),oi=Symbol("ondrain"),Z=Symbol("prefix"),Yi=class extends wt{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#t=!1;constructor(t,e={}){let i=ji(e);super(),this.path=f(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||Th,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=f(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?f(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[h,n]=Gi(this.path);h&&typeof n=="string"&&(this.path=n,s=h)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=kh(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=f(i.absolute||re.resolve(this.cwd,t)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let r=this.statCache.get(this.absolute);r?this[Te](r):this[Ri]()}warn(t,e,i={}){return ze(this,t,e,i)}emit(t,...e){return t==="error"&&(this.#t=!0),super.emit(t,...e)}[Ri](){p.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[Te](e)})}[Te](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=Lh(t),this.emit("stat",t),this[us]()}[us](){switch(this.type){case"File":return this[fs]();case"Directory":return this[cs]();case"SymbolicLink":return this[wi]();default:return this.end()}}[Be](t){return $s(t,this.type==="Directory",this.portable)}[Z](t){return Ys(t,this.prefix)}[Gt](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ot({path:this[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](this.linkpath):this.linkpath,mode:this[Be](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new he({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw Error("failed to encode header");super.write(t)}[cs](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Gt](),this.end()}[wi](){p.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[Si](e)})}[Si](t){this.linkpath=f(t),this[Gt](),this.end()}[ms](t){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=f(re.relative(this.cwd,t)),this.stat.size=0,this[Gt](),this.end()}[fs](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(e?.indexOf(this.cwd)===0)return this[ms](e);this.linkCache.set(t,this.absolute)}if(this[Gt](),this.stat.size===0)return this.end();this[Oi]()}[Oi](){p.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[ki](e)})}[ki](t){if(this.fd=t,this.#t)return this[rt]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[ke]()}[ke](){let{fd:t,buf:e,offset:i,length:s,pos:r}=this;if(t===void 0||e===void 0)throw Error("cannot read file without first opening");p.read(t,e,i,s,r,(h,n)=>{if(h)return this[rt](()=>this.emit("error",h));this[_i](n)})}[rt](t=()=>{}){this.fd!==void 0&&p.close(this.fd,t)}[_i](t){if(t<=0&&this.remain>0){let i=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[rt](()=>this.emit("error",i))}if(t>this.remain){let i=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[rt](()=>this.emit("error",i))}if(!this.buf)throw Error("should have created buffer prior to reading");if(t===this.remain)for(let i=t;i<this.length&&t<this.blockRemain;i++)this.buf[i+this.offset]=0,t++,this.remain++;let e=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(e)?this[oi]():this[Ti](()=>this[oi]())}[Ti](t){this.once("drain",t)}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this.blockRemain<t.length){let s=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",s)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,i)}[oi](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[rt](t=>t?this.emit("error",t):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[ke]()}},Vs=class extends Yi{sync=!0;[Ri](){this[Te](p.lstatSync(this.absolute))}[wi](){this[Si](p.readlinkSync(this.absolute))}[Oi](){this[ki](p.openSync(this.absolute,"r"))}[ke](){let t=!0;try{let{fd:e,buf:i,offset:s,length:r,pos:h}=this;if(e===void 0||i===void 0)throw Error("fd and buf must be set in READ method");let n=p.readSync(e,i,s,r,h);this[_i](n),t=!1}finally{if(t)try{this[rt](()=>{})}catch{}}}[Ti](t){t()}[rt](t=()=>{}){this.fd!==void 0&&p.closeSync(this.fd),t()}},Ks=class extends wt{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return ze(this,t,e,i)}constructor(t,e={}){let i=ji(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;let{type:s}=t;if(s==="Unsupported")throw Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=f(t.path),this.mode=t.mode===void 0?void 0:this[Be](t.mode),this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=t.linkpath===void 0?void 0:f(t.linkpath),typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[n,a]=Gi(this.path);n&&typeof a=="string"&&(this.path=a,r=n)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new ot({path:this[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new he({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let h=this.header?.block;if(!h)throw Error("failed to encode header");super.write(h),t.pipe(this)}[Z](t){return Ys(t,this.prefix)}[Be](t){return $s(t,this.type==="Directory",this.portable)}write(t,e,i){typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8"));let s=t.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}},Lh=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported",xh=class Dt{tail;head;length=0;static create(e=[]){return new Dt(e)}constructor(e=[]){for(let i of e)this.push(i)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw Error("removing node which does not belong to this list");let i=e.next,s=e.prev;return i&&(i.prev=s),s&&(s.next=i),e===this.head&&(this.head=i),e===this.tail&&(this.tail=s),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,i}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let i=this.head;e.list=this,e.next=i,i&&(i.prev=e),this.head=e,this.tail||=e,this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let i=this.tail;e.list=this,e.prev=i,i&&(i.next=e),this.tail=e,this.head||=e,this.length++}push(...e){for(let i=0,s=e.length;i<s;i++)Ah(this,e[i]);return this.length}unshift(...e){for(var i=0,s=e.length;i<s;i++)Nh(this,e[i]);return this.length}pop(){if(!this.tail)return;let e=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,e}shift(){if(!this.head)return;let e=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,e}forEach(e,i){i||=this;for(let s=this.head,r=0;s;r++)e.call(i,s.value,r,this),s=s.next}forEachReverse(e,i){i||=this;for(let s=this.tail,r=this.length-1;s;r--)e.call(i,s.value,r,this),s=s.prev}get(e){let i=0,s=this.head;for(;s&&i<e;i++)s=s.next;if(i===e&&s)return s.value}getReverse(e){let i=0,s=this.tail;for(;s&&i<e;i++)s=s.prev;if(i===e&&s)return s.value}map(e,i){i||=this;let s=new Dt;for(let r=this.head;r;)s.push(e.call(i,r.value,this)),r=r.next;return s}mapReverse(e,i){i||=this;var s=new Dt;for(let r=this.tail;r;)s.push(e.call(i,r.value,this)),r=r.prev;return s}reduce(e,i){let s,r=this.head;if(arguments.length>1)s=i;else if(this.head)r=this.head.next,s=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var h=0;r;h++)s=e(s,r.value,h),r=r.next;return s}reduceReverse(e,i){let s,r=this.tail;if(arguments.length>1)s=i;else if(this.tail)r=this.tail.prev,s=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let h=this.length-1;r;h--)s=e(s,r.value,h),r=r.prev;return s}toArray(){let e=Array(this.length);for(let i=0,s=this.head;s;i++)e[i]=s.value,s=s.next;return e}toArrayReverse(){let e=Array(this.length);for(let i=0,s=this.tail;s;i++)e[i]=s.value,s=s.prev;return e}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new Dt;if(i<e||i<0)return s;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,h=0;for(h=0;r&&h<e;h++)r=r.next;for(;r&&h<i;h++,r=r.next)s.push(r.value);return s}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new Dt;if(i<e||i<0)return s;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.length,h=this.tail;for(;h&&r>i;r--)h=h.prev;for(;h&&r>e;r--,h=h.prev)s.push(h.value);return s}splice(e,i=0,...s){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let r=this.head;for(let n=0;r&&n<e;n++)r=r.next;let h=[];for(let n=0;r&&n<i;n++)h.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let n of s)r=Dh(this,r,n);return h}reverse(){let e=this.head,i=this.tail;for(let s=e;s;s=s.prev){let r=s.prev;s.prev=s.next,s.next=r}return this.head=i,this.tail=e,this}};function Dh(t,e,i){let s=new Vi(i,e,e?e.next:t.head,t);return s.next===void 0&&(t.tail=s),s.prev===void 0&&(t.head=s),t.length++,s}function Ah(t,e){t.tail=new Vi(e,t.tail,void 0,t),t.head||=t.tail,t.length++}function Nh(t,e){t.head=new Vi(e,void 0,t.head,t),t.tail||=t.head,t.length++}var Vi=class{list;next;prev;value;constructor(t,e,i,s){this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},Li=class{path;absolute;entry;stat;readdir;pending=!1;pendingLink=!1;ignore=!1;piped=!1;constructor(t,e){this.path=t||"./",this.absolute=e}},ps=Buffer.alloc(1024),Le=Symbol("onStat"),$t=Symbol("ended"),F=Symbol("queue"),Yt=Symbol("pendingLinks"),tt=Symbol("current"),vt=Symbol("process"),Vt=Symbol("processing"),we=Symbol("processJob"),M=Symbol("jobs"),li=Symbol("jobDone"),xe=Symbol("addFSEntry"),vs=Symbol("addTarEntry"),xi=Symbol("stat"),Di=Symbol("readdir"),De=Symbol("onreaddir"),Ae=Symbol("pipe"),ys=Symbol("entry"),di=Symbol("entryOpt"),Ne=Symbol("writeEntryClass"),Xs=Symbol("write"),ui=Symbol("ondrain"),ae=class extends wt{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Ne];onWriteEntry;[F];[Yt]=new Map;[M]=0;[Vt]=!1;[$t]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=f(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[Ne]=Yi,typeof t.onwarn=="function"&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli||t.zstd){if(+!!t.gzip+ +!!t.brotli+ +!!t.zstd>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&(typeof t.gzip!="object"&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new $r(t.gzip)),t.brotli&&(typeof t.brotli!="object"&&(t.brotli={}),this.zip=new Vr(t.brotli)),t.zstd&&(typeof t.zstd!="object"&&(t.zstd={}),this.zip=new Xr(t.zstd)),!this.zip)throw Error("impossible");let e=this.zip;e.on("data",i=>super.write(i)),e.on("end",()=>super.end()),e.on("drain",()=>this[ui]()),this.on("resume",()=>e.resume())}else this.on("drain",this[ui]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter=typeof t.filter=="function"?t.filter:()=>!0,this[F]=new xh,this[M]=0,this.jobs=Number(t.jobs)||4,this[Vt]=!1,this[$t]=!1}[Xs](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&this.add(t),this[$t]=!0,this[vt](),i&&i(),this}write(t){if(this[$t])throw Error("write after end");return typeof t=="string"?this[xe](t):this[vs](t),this.flowing}[vs](t){let e=f(re.resolve(this.cwd,t.path));if(!this.filter(t.path,t))t.resume();else{let i=new Li(t.path,e);i.entry=new Ks(t,this[di](i)),i.entry.on("end",()=>this[li](i)),this[M]+=1,this[F].push(i)}this[vt]()}[xe](t){let e=f(re.resolve(this.cwd,t));this[F].push(new Li(t,e)),this[vt]()}[xi](t){t.pending=!0,this[M]+=1,p[this.follow?"stat":"lstat"](t.absolute,(e,i)=>{t.pending=!1,--this[M],e?this.emit("error",e):this[Le](t,i)})}[Le](t,e){if(this.statCache.set(t.absolute,e),t.stat=e,!this.filter(t.path,e))t.ignore=!0;else if(e.isFile()&&e.nlink>1&&!this.linkCache.get(`${e.dev}:${e.ino}`)&&!this.sync)if(t===this[tt])this[we](t);else{let i=`${e.dev}:${e.ino}`,s=this[Yt].get(i);s?s.push(t):this[Yt].set(i,[t]),t.pendingLink=!0,t.pending=!0}this[vt]()}[Di](t){t.pending=!0,this[M]+=1,p.readdir(t.absolute,(e,i)=>{if(t.pending=!1,--this[M],e)return this.emit("error",e);this[De](t,i)})}[De](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[vt]()}[vt](){if(!this[Vt]){this[Vt]=!0;for(let t=this[F].head;t&&this[M]<this.jobs;t=t.next)if(this[we](t.value),t.value.ignore){let e=t.next;this[F].removeNode(t),t.next=e}this[Vt]=!1,this[$t]&&this[F].length===0&&this[M]===0&&(this.zip?this.zip.end(ps):(super.write(ps),super.end()))}}get[tt](){return this[F]&&this[F].head&&this[F].head.value}[li](t){this[F].shift(),--this[M];let{stat:e}=t;if(e&&e.isFile()&&e.nlink>1){let i=`${e.dev}:${e.ino}`,s=this[Yt].get(i);if(s){this[Yt].delete(i);for(let r of s)r.pending=!1,this[we](r)}}this[vt]()}[we](t){if(t.pending&&t.pendingLink&&t===this[tt]&&(t.pending=!1,t.pendingLink=!1),!t.pending){if(t.entry){t===this[tt]&&!t.piped&&this[Ae](t);return}if(!t.stat){let e=this.statCache.get(t.absolute);e?this[Le](t,e):this[xi](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let e=this.readdirCache.get(t.absolute);if(e?this[De](t,e):this[Di](t),!t.readdir)return}if(t.entry=this[ys](t),!t.entry){t.ignore=!0;return}t===this[tt]&&!t.piped&&this[Ae](t)}}}[di](t){return{onwarn:(e,i,s)=>this.warn(e,i,s),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[ys](t){this[M]+=1;try{return new this[Ne](t.path,this[di](t)).on("end",()=>this[li](t)).on("error",e=>this.emit("error",e))}catch(e){this.emit("error",e)}}[ui](){this[tt]&&this[tt].entry&&this[tt].entry.resume()}[Ae](t){t.piped=!0,t.readdir&&t.readdir.forEach(s=>{let r=t.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[xe](h+s)});let e=t.entry,i=this.zip;if(!e)throw Error("cannot pipe without source");i?e.on("data",s=>{i.write(s)||e.pause()}):e.on("data",s=>{super.write(s)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){ze(this,t,e,i)}},je=class extends ae{sync=!0;constructor(t){super(t),this[Ne]=Vs}pause(){}resume(){}[xi](t){let e=this.follow?"statSync":"lstatSync";this[Le](t,p[e](t.absolute))}[Di](t){this[De](t,p.readdirSync(t.absolute))}[Ae](t){let e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach(s=>{let r=t.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[xe](h+s)}),!e)throw Error("Cannot pipe without source");i?e.on("data",s=>{i.write(s)}):e.on("data",s=>{super[Xs](s)})}},Ih=(t,e)=>{let i=new je(t),s=new Ms(t.file,{mode:t.mode||438});i.pipe(s),qs(i,e)},Bh=(t,e)=>{let i=new ae(t),s=new Ce(t.file,{mode:t.mode||438});i.pipe(s);let r=new Promise((h,n)=>{s.on("error",n),s.on("close",h),i.on("error",n)});return Qs(i,e).catch(h=>i.emit("error",h)),r},qs=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?Bt({file:c.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>t.add(s)}):t.add(i)}),t.end()},Qs=async(t,e)=>{for(let i of e)i.charAt(0)==="@"?await Bt({file:c.resolve(String(t.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>{t.add(s)}}):t.add(i);t.end()},bs=ne(Ih,Bh,(t,e)=>{let i=new je(t);return qs(i,e),i},(t,e)=>{let i=new ae(t);return Qs(i,e).catch(s=>i.emit("error",s)),i},(t,e)=>{if(!e?.length)throw TypeError("no paths specified to add to archive")}),Js=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:tr,O_NOFOLLOW:gs,O_TRUNC:er,O_WRONLY:ir}=p.constants,sr=Number(process.env.__FAKE_FS_O_FILENAME__)||p.constants.UV_FS_O_FILEMAP||0,Fh=Js&&!!sr,Mh=512*1024,Ch=sr|er|tr|ir,Es=!Js&&typeof gs=="number"?gs|er|tr|ir:null,rr=Es===null?Fh?t=>t<Mh?Ch:"w":()=>"w":()=>Es,Ai=(t,e,i)=>{try{return d.lchownSync(t,e,i)}catch(s){if(s?.code!=="ENOENT")throw s}},Fe=(t,e,i,s)=>{d.lchown(t,e,i,r=>{s(r&&r?.code!=="ENOENT"?r:null)})},Ph=(t,e,i,s,r)=>{e.isDirectory()?hr(c.resolve(t,e.name),i,s,h=>{if(h)return r(h);Fe(c.resolve(t,e.name),i,s,r)}):Fe(c.resolve(t,e.name),i,s,r)},hr=(t,e,i,s)=>{d.readdir(t,{withFileTypes:!0},(r,h)=>{if(r){if(r.code==="ENOENT")return s();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return s(r)}if(r||!h.length)return Fe(t,e,i,s);let n=h.length,a=null,o=l=>{if(!a){if(l)return s(a=l);if(--n===0)return Fe(t,e,i,s)}};for(let l of h)Ph(t,l,e,i,o)})},zh=(t,e,i,s)=>{e.isDirectory()&&nr(c.resolve(t,e.name),i,s),Ai(c.resolve(t,e.name),i,s)},nr=(t,e,i)=>{let s;try{s=d.readdirSync(t,{withFileTypes:!0})}catch(r){let h=r;if(h?.code==="ENOENT")return;if(h?.code==="ENOTDIR"||h?.code==="ENOTSUP")return Ai(t,e,i);throw h}for(let r of s)zh(t,r,e,i);return Ai(t,e,i)},ar=class extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}},He=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}},Uh=(t,e)=>{d.stat(t,(i,s)=>{(i||!s.isDirectory())&&(i=new ar(t,i?.code||"ENOTDIR")),e(i)})},jh=(t,e,i)=>{t=f(t);let s=e.umask??18,r=e.mode|448,h=(r&s)!==0,n=e.uid,a=e.gid,o=typeof n=="number"&&typeof a=="number"&&(n!==e.processUid||a!==e.processGid),l=e.preserve,u=e.unlink,y=f(e.cwd),b=(k,w)=>{k?i(k):w&&o?hr(w,n,a,T=>b(T)):h?d.chmod(t,r,i):i()};if(t===y)return Uh(t,b);if(l)return cr.mkdir(t,{mode:r,recursive:!0}).then(k=>b(null,k??void 0),b);Ni(y,f(c.relative(y,t)).split("/"),r,u,y,void 0,b)},Ni=(t,e,i,s,r,h,n)=>{if(e.length===0)return n(null,h);let a=e.shift(),o=f(c.resolve(t+"/"+a));d.mkdir(o,i,or(o,e,i,s,r,h,n))},or=(t,e,i,s,r,h,n)=>a=>{a?d.lstat(t,(o,l)=>{if(o)o.path=o.path&&f(o.path),n(o);else if(l.isDirectory())Ni(t,e,i,s,r,h,n);else if(s)d.unlink(t,u=>{if(u)return n(u);d.mkdir(t,i,or(t,e,i,s,r,h,n))});else{if(l.isSymbolicLink())return n(new He(t,t+"/"+e.join("/")));n(a)}}):(h||=t,Ni(t,e,i,s,r,h,n))},Hh=t=>{let e=!1,i;try{e=d.statSync(t).isDirectory()}catch(s){i=s?.code}finally{if(!e)throw new ar(t,i??"ENOTDIR")}},Zh=(t,e)=>{t=f(t);let i=e.umask??18,s=e.mode|448,r=(s&i)!==0,h=e.uid,n=e.gid,a=typeof h=="number"&&typeof n=="number"&&(h!==e.processUid||n!==e.processGid),o=e.preserve,l=e.unlink,u=f(e.cwd),y=w=>{w&&a&&nr(w,h,n),r&&d.chmodSync(t,s)};if(t===u)return Hh(u),y();if(o)return y(d.mkdirSync(t,{mode:s,recursive:!0})??void 0);let b=f(c.relative(u,t)).split("/"),k;for(let w=b.shift(),T=u;w&&(T+="/"+w);w=b.shift()){T=f(c.resolve(T));try{d.mkdirSync(T,s),k||=T}catch{let Ki=d.lstatSync(T);if(Ki.isDirectory())continue;if(l){d.unlinkSync(T),d.mkdirSync(T,s),k||=T;continue}else if(Ki.isSymbolicLink())return new He(T,T+"/"+b.join("/"))}}return y(k)},fi=Object.create(null),ws=1e4,Ot=new Set,Wh=t=>{Ot.has(t)?Ot.delete(t):fi[t]=t.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Ot.add(t);let e=fi[t],i=Ot.size-ws;if(i>ws/10){for(let s of Ot)if(Ot.delete(s),delete fi[s],--i<=0)break}return e},Gh=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",$h=t=>t.split("/").slice(0,-1).reduce((e,i)=>{let s=e.at(-1);return s!==void 0&&(i=Ns(s,i)),e.push(i||"/"),e},[]),Yh=class{#t=new Map;#i=new Map;#s=new Set;reserve(t,e){t=Gh?["win32 parallelization disabled"]:t.map(s=>Qt(Ns(Wh(s))));let i=new Set(t.map(s=>$h(s)).reduce((s,r)=>s.concat(r)));this.#i.set(e,{dirs:i,paths:t});for(let s of t){let r=this.#t.get(s);r?r.push(e):this.#t.set(s,[e])}for(let s of i){let r=this.#t.get(s);if(!r)this.#t.set(s,[new Set([e])]);else{let h=r.at(-1);h instanceof Set?h.add(e):r.push(new Set([e]))}}return this.#r(e)}#h(t){let e=this.#i.get(t);if(!e)throw Error("function does not have any path reservations");return{paths:e.paths.map(i=>this.#t.get(i)),dirs:[...e.dirs].map(i=>this.#t.get(i))}}check(t){let{paths:e,dirs:i}=this.#h(t);return e.every(s=>s&&s[0]===t)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(t))}#r(t){return this.#s.has(t)||!this.check(t)?!1:(this.#s.add(t),t(()=>this.#e(t)),!0)}#e(t){if(!this.#s.has(t))return!1;let e=this.#i.get(t);if(!e)throw Error("invalid reservation");let{paths:i,dirs:s}=e,r=new Set;for(let h of i){let n=this.#t.get(h);if(!n||n?.[0]!==t)continue;let a=n[1];if(!a){this.#t.delete(h);continue}if(n.shift(),typeof a=="function")r.add(a);else for(let o of a)r.add(o)}for(let h of s){let n=this.#t.get(h),a=n?.[0];if(!(!n||!(a instanceof Set)))if(a.size===1&&n.length===1){this.#t.delete(h);continue}else if(a.size===1){n.shift();let o=n[0];typeof o=="function"&&r.add(o)}else a.delete(t)}return this.#s.delete(t),r.forEach(h=>this.#r(h)),!0}},Vh=()=>process.umask(),Rs=Symbol("onEntry"),Ii=Symbol("checkFs"),_s=Symbol("checkFs2"),Bi=Symbol("isReusable"),I=Symbol("makeFs"),Fi=Symbol("file"),Mi=Symbol("directory"),Ie=Symbol("link"),Ss=Symbol("symlink"),Os=Symbol("hardlink"),Xt=Symbol("ensureNoSymlink"),ks=Symbol("unsupported"),Ts=Symbol("checkPath"),ci=Symbol("stripAbsolutePath"),ht=Symbol("mkdir"),O=Symbol("onError"),Re=Symbol("pending"),Ls=Symbol("pend"),kt=Symbol("unpend"),mi=Symbol("ended"),pi=Symbol("maybeClose"),Ci=Symbol("skip"),Jt=Symbol("doChown"),te=Symbol("uid"),ee=Symbol("gid"),ie=Symbol("checkedCwd"),se=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Kh=1024,Xh=(t,e)=>{if(!se)return d.unlink(t,e);let i=t+".DELETE."+Bs(16).toString("hex");d.rename(t,i,s=>{if(s)return e(s);d.unlink(i,e)})},qh=t=>{if(!se)return d.unlinkSync(t);let e=t+".DELETE."+Bs(16).toString("hex");d.renameSync(t,e),d.unlinkSync(e)},xs=(t,e,i)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:i,Me=class extends At{[mi]=!1;[ie]=!1;[Re]=0;reservations=new Yh;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[mi]=!0,this[pi]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?process.getuid?.()===0:!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:Kh,this.forceChown=t.forceChown===!0,this.win32=!!t.win32||se,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=f(c.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:Vh():0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",e=>this[Rs](e))}warn(t,e,i={}){return(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT")&&(i.recoverable=!1),super.warn(t,e,i)}[pi](){this[mi]&&this[Re]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ci](t,e){let i=t[e],{type:s}=t;if(!i||this.preservePaths)return!0;let[r,h]=Gi(i),n=h.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||se&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(e==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${e} contains '..'`,{entry:t,[e]:i}),!1;let a=c.posix.dirname(t.path),o=c.posix.normalize(c.posix.join(a,n.join("/")));if(o.startsWith("../")||o==="..")return this.warn("TAR_ENTRY_ERROR",`${e} escapes extraction directory`,{entry:t,[e]:i}),!1}return r&&(t[e]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute ${e}`,{entry:t,[e]:i})),!0}[Ts](t){let e=f(t.path),i=e.split("/");if(this.strip){if(i.length<this.strip)return!1;if(t.type==="Link"){let s=f(String(t.linkpath)).split("/");if(s.length>=this.strip)t.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[ci](t,"path")||!this[ci](t,"linkpath"))return!1;if(t.absolute=c.isAbsolute(t.path)?f(c.resolve(t.path)):f(c.resolve(this.cwd,t.path)),!this.preservePaths&&typeof t.absolute=="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:f(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=c.win32.parse(String(t.absolute));t.absolute=s+ds(String(t.absolute).slice(s.length));let{root:r}=c.win32.parse(t.path);t.path=r+ds(t.path.slice(r.length))}return!0}[Rs](t){if(!this[Ts](t))return t.resume();switch(wr.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ii](t);default:return this[ks](t)}}[O](t,e){t.name==="CwdError"?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[kt](),e.resume())}[ht](t,e,i){jh(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e},i)}[Jt](t){return this.forceChown||this.preserveOwner&&(typeof t.uid=="number"&&t.uid!==this.processUid||typeof t.gid=="number"&&t.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[te](t){return xs(this.uid,t.uid,this.processUid)}[ee](t){return xs(this.gid,t.gid,this.processGid)}[Fi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,s=new Ce(String(t.absolute),{flags:rr(t.size),mode:i,autoClose:!1});s.on("error",a=>{s.fd&&d.close(s.fd,()=>{}),s.write=()=>!0,this[O](a,t),e()});let r=1,h=a=>{if(a){s.fd&&d.close(s.fd,()=>{}),this[O](a,t),e();return}--r===0&&s.fd!==void 0&&d.close(s.fd,o=>{o?this[O](o,t):this[kt](),e()})};s.on("finish",()=>{let a=String(t.absolute),o=s.fd;if(typeof o=="number"&&t.mtime&&!this.noMtime){r++;let l=t.atime||new Date,u=t.mtime;d.futimes(o,l,u,y=>y?d.utimes(a,l,u,b=>h(b&&y)):h())}if(typeof o=="number"&&this[Jt](t)){r++;let l=this[te](t),u=this[ee](t);typeof l=="number"&&typeof u=="number"&&d.fchown(o,l,u,y=>y?d.chown(a,l,u,b=>h(b&&y)):h())}h()});let n=this.transform&&this.transform(t)||t;n!==t&&(n.on("error",a=>{this[O](a,t),e()}),t.pipe(n)),n.pipe(s)}[Mi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode;this[ht](String(t.absolute),i,s=>{if(s){this[O](s,t),e();return}let r=1,h=()=>{--r===0&&(e(),this[kt](),t.resume())};t.mtime&&!this.noMtime&&(r++,d.utimes(String(t.absolute),t.atime||new Date,t.mtime,h)),this[Jt](t)&&(r++,d.chown(String(t.absolute),Number(this[te](t)),Number(this[ee](t)),h)),h()})}[ks](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[Ss](t,e){let i=f(c.relative(this.cwd,c.resolve(c.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[Xt](t,this.cwd,i,()=>this[Ie](t,String(t.linkpath),"symlink",e),s=>{this[O](s,t),e()})}[Os](t,e){let i=f(c.resolve(this.cwd,String(t.linkpath))),s=f(String(t.linkpath)).split("/");this[Xt](t,this.cwd,s,()=>this[Ie](t,i,"link",e),r=>{this[O](r,t),e()})}[Xt](t,e,i,s,r){let h=i.shift();if(this.preservePaths||h===void 0)return s();let n=c.resolve(e,h);d.lstat(n,(a,o)=>{if(a)return s();if(o?.isSymbolicLink())return r(new He(n,c.resolve(n,i.join("/"))));this[Xt](t,n,i,s,r)})}[Ls](){this[Re]++}[kt](){this[Re]--,this[pi]()}[Ci](t){this[kt](),t.resume()}[Bi](t,e){return t.type==="File"&&!this.unlink&&e.isFile()&&e.nlink<=1&&!se}[Ii](t){this[Ls]();let e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,i=>this[_s](t,i))}[_s](t,e){let i=n=>{e(n)},s=()=>{this[ht](this.cwd,this.dmode,n=>{if(n){this[O](n,t),i();return}this[ie]=!0,r()})},r=()=>{if(t.absolute!==this.cwd){let n=f(c.dirname(String(t.absolute)));if(n!==this.cwd)return this[ht](n,this.dmode,a=>{if(a){this[O](a,t),i();return}h()})}h()},h=()=>{d.lstat(String(t.absolute),(n,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(t.mtime??a.mtime))){this[Ci](t),i();return}if(n||this[Bi](t,a))return this[I](null,t,i);if(a.isDirectory()){if(t.type==="Directory"){let o=this.chmod&&t.mode&&(a.mode&4095)!==t.mode,l=u=>this[I](u??null,t,i);return o?d.chmod(String(t.absolute),Number(t.mode),l):l()}if(t.absolute!==this.cwd)return d.rmdir(String(t.absolute),o=>this[I](o??null,t,i))}if(t.absolute===this.cwd)return this[I](null,t,i);Xh(String(t.absolute),o=>this[I](o??null,t,i))})};this[ie]?r():s()}[I](t,e,i){if(t){this[O](t,e),i();return}switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Fi](e,i);case"Link":return this[Os](e,i);case"SymbolicLink":return this[Ss](e,i);case"Directory":case"GNUDumpDir":return this[Mi](e,i)}}[Ie](t,e,i,s){d[i](e,String(t.absolute),r=>{r?this[O](r,t):(this[kt](),t.resume()),s()})}},Kt=t=>{try{return[null,t()]}catch(e){return[e,null]}},Pi=class extends Me{sync=!0;[I](t,e){return super[I](t,e,()=>{})}[Ii](t){if(!this[ie]){let r=this[ht](this.cwd,this.dmode);if(r)return this[O](r,t);this[ie]=!0}if(t.absolute!==this.cwd){let r=f(c.dirname(String(t.absolute)));if(r!==this.cwd){let h=this[ht](r,this.dmode);if(h)return this[O](h,t)}}let[e,i]=Kt(()=>d.lstatSync(String(t.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Ci](t);if(e||this[Bi](t,i))return this[I](null,t);if(i.isDirectory()){if(t.type==="Directory"){let[h]=this.chmod&&t.mode&&(i.mode&4095)!==t.mode?Kt(()=>{d.chmodSync(String(t.absolute),Number(t.mode))}):[];return this[I](h,t)}let[r]=Kt(()=>d.rmdirSync(String(t.absolute)));this[I](r,t)}let[s]=t.absolute===this.cwd?[]:Kt(()=>qh(String(t.absolute)));this[I](s,t)}[Fi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,s=n=>{let a;try{d.closeSync(r)}catch(o){a=o}(n||a)&&this[O](n||a,t),e()},r;try{r=d.openSync(String(t.absolute),rr(t.size),i)}catch(n){return s(n)}let h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",n=>this[O](n,t)),t.pipe(h)),h.on("data",n=>{try{d.writeSync(r,n,0,n.length)}catch(a){s(a)}}),h.on("end",()=>{let n=null;if(t.mtime&&!this.noMtime){let a=t.atime||new Date,o=t.mtime;try{d.futimesSync(r,a,o)}catch(l){try{d.utimesSync(String(t.absolute),a,o)}catch{n=l}}}if(this[Jt](t)){let a=this[te](t),o=this[ee](t);try{d.fchownSync(r,Number(a),Number(o))}catch(l){try{d.chownSync(String(t.absolute),Number(a),Number(o))}catch{n||=l}}}s(n)})}[Mi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode,s=this[ht](String(t.absolute),i);if(s){this[O](s,t),e();return}if(t.mtime&&!this.noMtime)try{d.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[Jt](t))try{d.chownSync(String(t.absolute),Number(this[te](t)),Number(this[ee](t)))}catch{}e(),t.resume()}[ht](t,e){try{return Zh(f(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:e})}catch(i){return i}}[Xt](t,e,i,s,r){if(this.preservePaths||i.length===0)return s();let h=e;for(let n of i){h=c.resolve(h,n);let[a,o]=Kt(()=>d.lstatSync(h));if(a)return s();if(o.isSymbolicLink())return r(new He(h,c.resolve(e,i.join("/"))))}s()}[Ie](t,e,i,s){let r=`${i}Sync`;try{d[r](e,String(t.absolute)),s(),t.resume()}catch(h){return this[O](h,t)}}},Ds=ne(t=>{let e=new Pi(t),i=t.file,s=d.statSync(i);new Fr(i,{readSize:t.maxReadSize||16*1024*1024,size:s.size}).pipe(e)},(t,e)=>{let i=new Me(t),s=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((h,n)=>{i.on("error",n),i.on("close",h),d.stat(r,(a,o)=>{if(a)n(a);else{let l=new Ui(r,{readSize:s,size:o.size});l.on("error",n),l.pipe(i)}})})},t=>new Pi(t),t=>new Me(t),(t,e)=>{e?.length&&Wi(t,e)}),Qh=(t,e)=>{let i=new je(t),s=!0,r,h;try{try{r=d.openSync(t.file,"r+")}catch(o){if(o?.code==="ENOENT")r=d.openSync(t.file,"w+");else throw o}let n=d.fstatSync(r),a=Buffer.alloc(512);t:for(h=0;h<n.size;h+=512){for(let u=0,y=0;u<512;u+=y){if(y=d.readSync(r,a,u,a.length-u,h+u),h===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!y)break t}let o=new ot(a);if(!o.cksumValid)break;let l=512*Math.ceil((o.size||0)/512);if(h+l+512>n.size)break;h+=l,t.mtimeCache&&o.mtime&&t.mtimeCache.set(String(o.path),o.mtime)}s=!1,Jh(t,i,h,r,e)}finally{if(s)try{d.closeSync(r)}catch{}}},Jh=(t,e,i,s,r)=>{let h=new Ms(t.file,{fd:s,start:i});e.pipe(h),en(e,r)},tn=(t,e)=>{e=Array.from(e);let i=new ae(t),s=(r,h,n)=>{let a=(b,k)=>{b?d.close(r,w=>n(b)):n(null,k)},o=0;if(h===0)return a(null,0);let l=0,u=Buffer.alloc(512),y=(b,k)=>{if(b||k===void 0)return a(b);if(l+=k,l<512&&k)return d.read(r,u,l,u.length-l,o+l,y);if(o===0&&u[0]===31&&u[1]===139)return a(Error("cannot append to compressed archives"));if(l<512)return a(null,o);let w=new ot(u);if(!w.cksumValid)return a(null,o);let T=512*Math.ceil((w.size??0)/512);if(o+T+512>h||(o+=T+512,o>=h))return a(null,o);t.mtimeCache&&w.mtime&&t.mtimeCache.set(String(w.path),w.mtime),l=0,d.read(r,u,0,512,o,y)};d.read(r,u,0,512,o,y)};return new Promise((r,h)=>{i.on("error",h);let n="r+",a=(o,l)=>{if(o&&o.code==="ENOENT"&&n==="r+")return n="w+",d.open(t.file,n,a);if(o||!l)return h(o);d.fstat(l,(u,y)=>{if(u)return d.close(l,()=>h(u));s(l,y.size,(b,k)=>{if(b)return h(b);let w=new Ce(t.file,{fd:l,start:k});i.pipe(w),w.on("error",h),w.on("close",r),sn(i,e)})})};d.open(t.file,n,a)})},en=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?Bt({file:c.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>t.add(s)}):t.add(i)}),t.end()},sn=async(t,e)=>{for(let i of e)i.charAt(0)==="@"?await Bt({file:c.resolve(String(t.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>t.add(s)}):t.add(i);t.end()},yt=ne(Qh,tn,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(t,e)=>{if(!jr(t))throw TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!e?.length)throw TypeError("no paths specified to add/replace")});ne(yt.syncFile,yt.asyncFile,yt.syncNoFile,yt.asyncNoFile,(t,e=[])=>{yt.validate?.(t,e),rn(t)});var rn=t=>{let e=t.filter;t.mtimeCache||=new Map,t.filter=e?(i,s)=>e(i,s)&&!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))};export{an as index_min_exports};
@@ -1,2 +1,2 @@
1
- import{createRequire as g}from"node:module";import{e as p}from"../packem_shared/index-BzhrR_iC.js";import{p as e}from"./cli-main.js";import{d as _}from"../packem_shared/pm-runner-CMSml1Bj.js";import{y as u}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as m}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";import{U as $}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";let y;const w=r=>(y??=g(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[n,s]=c.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return c.getBuiltinModule(r)}return w(r)},{spawnSync:h}=v("node:child_process"),t="@lavamoat/preinstall-always-fail",d=r=>{const n=p(r,"package.json");if(!u(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},k=r=>{const n=p(r,"package.json");if(!u(n))return!1;try{const s=m(n);let i=!1;const l=a=>!a||!(t in a)?a:(i=!0,Object.fromEntries(Object.entries(a).filter(([o])=>o!==t)));return s.devDependencies=l(s.devDependencies),s.dependencies=l(s.dependencies),i&&$(n,`${JSON.stringify(s,null,2)}
1
+ import{createRequire as g}from"node:module";import{e as p}from"../packem_shared/index-BzhrR_iC.js";import{p as e}from"./cli-main.js";import{d as _}from"../packem_shared/pm-runner-3iiQayy-.js";import{y as u}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as m}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";import{U as $}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";let y;const w=r=>(y??=g(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[n,s]=c.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return c.getBuiltinModule(r)}return w(r)},{spawnSync:h}=v("node:child_process"),t="@lavamoat/preinstall-always-fail",d=r=>{const n=p(r,"package.json");if(!u(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},k=r=>{const n=p(r,"package.json");if(!u(n))return!1;try{const s=m(n);let i=!1;const l=a=>!a||!(t in a)?a:(i=!0,Object.fromEntries(Object.entries(a).filter(([o])=>o!==t)));return s.devDependencies=l(s.devDependencies),s.dependencies=l(s.dependencies),i&&$(n,`${JSON.stringify(s,null,2)}
2
2
  `),i}catch{return!1}},I=({options:r,workspaceRoot:n})=>{const s=n??process.cwd();if(r.status){switch(d(s)){case"installed":{e.success(`Preinstall tripwire is installed (${t}).`),e.info("Removing 'ignore-scripts=true' will cause future installs to fail loudly.");break}case"missing":{e.warn("Preinstall tripwire is not installed."),e.info(`Run 'vis security tripwire' to add ${t} as a devDependency.`);break}default:e.error("No package.json found at the workspace root."),process.exitCode=1}return}if(r.remove){k(s)?e.success(`Removed ${t} from package.json. Run your PM's install to clean node_modules.`):e.info(`${t} was not present in package.json.`);return}if(d(s)==="installed"){e.info(`${t} is already installed.`);return}const i=_(s),a={bun:["add","-d",t],npm:["install","--save-dev",t],pnpm:["add","-D","-w",t],yarn:["add","-D",t]}[i.name];if(!a){e.error(`Cannot install tripwire — unsupported package manager '${i.name}'.`),process.exitCode=1;return}e.info(`Installing ${t} via ${i.name}…`);const o=h(i.name,a,{cwd:s,stdio:"inherit"});if(o.error){e.error(`Failed to install tripwire: ${o.error.message}`),process.exitCode=1;return}if(o.signal!==null){e.error(`${i.name} was terminated by signal ${o.signal}`),process.exitCode=1;return}if(o.status!==0){e.error(`${i.name} exited with code ${String(o.status)}`),process.exitCode=o.status??1;return}e.success(`Installed ${t} as a devDependency.`),e.notice(""),e.notice("How the tripwire works:"),e.notice(` ${t} declares a preinstall script that always fails.`),e.notice(" When 'ignore-scripts=true' is set (.npmrc / bunfig.toml / .yarnrc.yml),"),e.notice(" the script is skipped and installs succeed normally. If someone deletes"),e.notice(" that setting, the next install fails — loudly — instead of silently"),e.notice(" running every dependency's lifecycle scripts.")};export{I as default};