@visulima/vis 4.0.1 → 4.1.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 (93) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/LICENSE.md +403 -921
  3. package/README.md +2 -2
  4. package/dashboard/dist/index.html +12 -12
  5. package/dist/bin.js +1 -1
  6. package/dist/binx.js +1 -1
  7. package/dist/packem_chunks/bloom-status.js +1 -1
  8. package/dist/packem_chunks/bloom-sync.js +1 -1
  9. package/dist/packem_chunks/catalog.js +34 -34
  10. package/dist/packem_chunks/cli-exec.js +1 -1
  11. package/dist/packem_chunks/cli-main.js +157 -157
  12. package/dist/packem_chunks/doctor-probe.js +1 -1
  13. package/dist/packem_chunks/fix.js +1 -1
  14. package/dist/packem_chunks/git.js +4 -3
  15. package/dist/packem_chunks/handler13.js +1 -1
  16. package/dist/packem_chunks/handler14.js +1 -1
  17. package/dist/packem_chunks/handler15.js +1 -1
  18. package/dist/packem_chunks/handler2.js +1 -1
  19. package/dist/packem_chunks/handler20.js +1 -1
  20. package/dist/packem_chunks/handler23.js +1 -1
  21. package/dist/packem_chunks/handler24.js +1 -1
  22. package/dist/packem_chunks/handler26.js +1 -1
  23. package/dist/packem_chunks/handler28.js +1 -1
  24. package/dist/packem_chunks/handler3.js +1 -1
  25. package/dist/packem_chunks/handler39.js +6 -6
  26. package/dist/packem_chunks/handler40.js +1 -75
  27. package/dist/packem_chunks/handler50.js +1 -1
  28. package/dist/packem_chunks/handler53.js +1 -1
  29. package/dist/packem_chunks/handler54.js +1 -1
  30. package/dist/packem_chunks/handler56.js +6 -6
  31. package/dist/packem_chunks/handler59.js +73 -9
  32. package/dist/packem_chunks/handler6.js +1 -1
  33. package/dist/packem_chunks/handler60.js +11 -3
  34. package/dist/packem_chunks/handler61.js +3 -22
  35. package/dist/packem_chunks/handler62.js +21 -60
  36. package/dist/packem_chunks/handler63.js +61 -3
  37. package/dist/packem_chunks/handler64.js +3 -6
  38. package/dist/packem_chunks/handler65.js +6 -9
  39. package/dist/packem_chunks/handler66.js +1 -1
  40. package/dist/packem_chunks/handler67.js +1 -1
  41. package/dist/packem_chunks/handler68.js +1 -1
  42. package/dist/packem_chunks/handler69.js +1 -1
  43. package/dist/packem_chunks/handler70.js +1 -1
  44. package/dist/packem_chunks/handler72.js +1 -1
  45. package/dist/packem_chunks/handler73.js +1 -1
  46. package/dist/packem_chunks/handler74.js +1 -1
  47. package/dist/packem_chunks/handler75.js +1 -1
  48. package/dist/packem_chunks/handler76.js +1 -1
  49. package/dist/packem_chunks/handler78.js +1 -1
  50. package/dist/packem_chunks/heal.js +1 -1
  51. package/dist/packem_chunks/help-command.js +5 -5
  52. package/dist/packem_chunks/index6.js +7 -21
  53. package/dist/packem_chunks/index7.js +47 -47
  54. package/dist/packem_chunks/prompts.js +1 -1
  55. package/dist/packem_chunks/resolveFormatter.js +7 -5
  56. package/dist/packem_chunks/root-handler.js +1 -0
  57. package/dist/packem_chunks/shell-runner.js +1 -1
  58. package/dist/packem_chunks/status.js +1 -1
  59. package/dist/packem_chunks/sync.js +1 -1
  60. package/dist/packem_chunks/version-resolver.js +3 -2
  61. package/dist/packem_shared/DEFAULT_BREAKING_SECTION-DUAcKVLD.js +1 -0
  62. package/dist/packem_shared/DEFAULT_CONVENTIONAL_HEADING-D7oNGUcP.js +1 -0
  63. package/dist/packem_shared/{affected-selection-DLrq50Mz.js → affected-selection-DP4GM66N.js} +1 -1
  64. package/dist/packem_shared/{api.d-BPftyU9r.d.ts → api.d-C10vHKJZ.d.ts} +1 -1
  65. package/dist/packem_shared/{bin-As0Wq5ZN.js → bin-BO1M68aW.js} +1 -1
  66. package/dist/packem_shared/buildCompareUrl-BLaukjgu.js +1 -0
  67. package/dist/packem_shared/conventional-CGiOOEq1.js +4 -0
  68. package/dist/packem_shared/{cyclonedx-B1vzerwP.js → cyclonedx-CX2fFvDi.js} +1 -1
  69. package/dist/packem_shared/docker-Dy-X_BuM.js +59 -0
  70. package/dist/packem_shared/hasBulletMarker-BX2KwzI5.js +1 -0
  71. package/dist/packem_shared/{index-CcVv0V1y.js → index-rcfHhvVo.js} +1 -1
  72. package/dist/packem_shared/index.server-sXNQYpsl.js +2 -0
  73. package/dist/packem_shared/main-CgDAlZkm.js +1 -0
  74. package/dist/packem_shared/{package-version-BFsJ8iyZ.js → package-version-BO37_qsn.js} +1 -1
  75. package/dist/packem_shared/{project-name-filter-DdXd3P3a.js → project-name-filter-C_mppI1h.js} +1 -1
  76. package/dist/packem_shared/release-heading-DRpkhETz.js +1 -0
  77. package/dist/packem_shared/{resolve-explicit-ZZEPWdpP.js → resolve-explicit-CsTmALmE.js} +1 -1
  78. package/dist/packem_shared/run-D-uVGHQ4.js +10 -0
  79. package/dist/packem_shared/{s1ngularity-R-zLjQjp.js → s1ngularity-BRk_GMUj.js} +1 -1
  80. package/dist/packem_shared/{scan-progress-5uTRdC1G.js → scan-progress-DRIGQRMr.js} +1 -1
  81. package/dist/packem_shared/{typosquats-Cdsnf6aN.js → typosquats-CSkIFgF5.js} +1 -1
  82. package/dist/packem_shared/{vis-user-error-DJvfOpBX.js → vis-user-error-YIyfYNBK.js} +1 -1
  83. package/dist/release/core/changelog/index.d.ts +274 -31
  84. package/dist/release/core/changelog/index.js +1 -1
  85. package/dist/release/plugin-sdk.d.ts +2 -2
  86. package/dist/release/types.d.ts +44 -2
  87. package/index.js +52 -52
  88. package/package.json +11 -11
  89. package/schemas/vis-config.schema.json +19 -1
  90. package/schemas/vis-release-config.schema.json +19 -1
  91. package/dist/packem_shared/docker-Bex05Qcn.js +0 -59
  92. package/dist/packem_shared/index.server-BAjDJSEu.js +0 -2
  93. package/dist/packem_shared/main-BP-w-K-6.js +0 -1
@@ -1,4 +1,4 @@
1
- import{createRequire as wt}from"node:module";import{a as x,$ as nt,U as yt,v as it,e as P,q as Tt}from"../packem_shared/index-DHD8wb6Z.js";import{y as m,X as E,m as b,v as vt,j as St}from"./catalog.js";import at from"./index.js";import{x as ot}from"../packem_shared/main-BP-w-K-6.js";import{y as B}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{d as $t}from"./cli-main.js";import{l as At}from"../packem_shared/spinner-BM_0Bj6x.js";import{C as ct,D as O,T as dt}from"../packem_shared/symbols-BXDZ_sKt.js";import{b as z,F as C,q as D,X as L,J as It}from"../packem_shared/index.server-BAjDJSEu.js";import{withEnhancedPath as Mt}from"@visulima/task-runner";let mt;const kt=t=>(mt??=wt(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,G=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,s]=I.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return I.getBuiltinModule(t)}return kt(t)},{readFileSync:bt,writeFileSync:xt,unlinkSync:Ct}=G("node:fs"),{randomBytes:Et}=G("node:crypto"),{availableParallelism:V}=G("node:os");class A extends Error{constructor(e,s){super(e,s),this.name=this.constructor.name}}class Rt extends A{}class T extends A{}class W extends A{}class R extends A{stderr;constructor(e,s,r){super(e,r),this.stderr=s}}class X extends A{}class $ extends A{commandTitle;constructor(e,s,r){super(s,r),this.commandTitle=e}}const lt=t=>t.includes("/"),F=(t,e)=>e?t.toLowerCase():t,jt=(t,e,s,r={})=>{const n=lt(t),i=r.caseInsensitive===!0,c=F(t,i),a=[];for(const o of e){const l=n?x(s,o):nt(o);at(c,F(l,i))&&a.push(o)}return a},_t=(t,e,s,r={})=>{if(!e||e.length===0)return[...t];const n=r.caseInsensitive===!0;return t.filter(i=>{for(const c of e){const a=lt(c)?x(s,i):nt(i),o=F(c,n);if(at(o,F(a,n)))return!1}return!0})},U=t=>typeof t=="object"&&t!==null&&typeof t.title=="string"&&typeof t.task=="function",_=t=>typeof t=="object"&&t!==null&&typeof t.command=="string"&&typeof t.task!="function",Pt=(t,e)=>{const s=x(t,e);return s===""||!s.startsWith("..")&&!it(s)},Ot=(t,e)=>{let s;for(const r of e)Pt(r,t)&&(s===void 0||r.length>s.length)&&(s=r);return s},Ft=async t=>{let e=0,s=0;const r=()=>(e+=1,`pattern-${e}`),n=()=>(s+=1,`cmd-${s}`),i=(o,l,f,d)=>{if(o.perPackage===!0){const u=t.workspacePackages??[],g=new Map;for(const h of f){const w=Ot(h,u)??t.cwd,k=g.get(w)??[];k.push(x(w,h)),g.set(w,k)}for(const h of[...g.keys()].sort()){const w=x(t.cwd,h)||".";d.push({command:o.command,cwd:h,files:g.get(h)??[],id:n(),source:"string",title:`${o.command} — ${w}`})}return}if(o.cwd!==void 0){const u=yt(t.cwd,o.cwd);d.push({command:o.command,cwd:u,files:f,id:n(),source:"string",title:`${o.command} — ${x(t.cwd,u)||"."}`});return}d.push({command:o.command,files:l,id:n(),source:"string",title:o.command})},c=async(o,l,f,d)=>{if(typeof o=="string"){d.push({command:o,files:l,id:n(),source:"string",title:o});return}if(Array.isArray(o)){for(const u of o)await c(u,l,f,d);return}if(_(o)){i(o,l,f,d);return}if(typeof o=="function"){const u=await o([...l]);if(typeof u=="string"){d.push({command:u,files:l,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const g of u)if(typeof g=="string")d.push({command:g,files:l,id:n(),source:"function",title:g});else if(_(g))i(g,l,f,d);else if(U(g))d.push({files:l,id:n(),run:g.task,source:"custom",title:g.title});else throw new T("Task function returned an array with an unsupported entry — expected strings, { command, … }, or { title, task }.");return}if(_(u)){i(u,l,f,d);return}if(U(u)){d.push({files:l,id:n(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], { command, … }, or { title, task }.")}if(U(o)){d.push({files:l,id:n(),run:o.task,source:"custom",title:o.title});return}throw new T("Unsupported task value — expected string, string[], function, { command, … }, or { title, task }.")},a=[];for(const[o,l]of Object.entries(t.config)){const f=jt(o,t.files,t.cwd,{caseInsensitive:t.caseInsensitive===!0});if(f.length===0)continue;const d=t.relative?f.map(g=>x(t.cwd,g)):f,u=[];await c(l,d,f,u),u.length!==0&&a.push({commands:u,files:d,id:r(),pattern:o,title:`${o} — ${f.length} file${f.length===1?"":"s"}`})}return a},Nt=async t=>{if(t.config!==void 0)return t.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
1
+ import{createRequire as wt}from"node:module";import{a as x,$ as nt,U as yt,v as it,e as P,q as Tt}from"../packem_shared/index-DHD8wb6Z.js";import{y as m,X as E,m as b,v as vt,j as St}from"./catalog.js";import at from"./index.js";import{x as ot}from"../packem_shared/main-CgDAlZkm.js";import{y as B}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{d as $t}from"./cli-main.js";import{l as At}from"../packem_shared/spinner-BM_0Bj6x.js";import{C as ct,D as O,T as dt}from"../packem_shared/symbols-BXDZ_sKt.js";import{b as z,F as C,q as D,X as L,J as It}from"../packem_shared/index.server-sXNQYpsl.js";import{withEnhancedPath as Mt}from"@visulima/task-runner";let mt;const kt=t=>(mt??=wt(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,G=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,s]=I.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return I.getBuiltinModule(t)}return kt(t)},{readFileSync:bt,writeFileSync:xt,unlinkSync:Ct}=G("node:fs"),{randomBytes:Et}=G("node:crypto"),{availableParallelism:V}=G("node:os");class A extends Error{constructor(e,s){super(e,s),this.name=this.constructor.name}}class Rt extends A{}class T extends A{}class W extends A{}class R extends A{stderr;constructor(e,s,r){super(e,r),this.stderr=s}}class X extends A{}class $ extends A{commandTitle;constructor(e,s,r){super(s,r),this.commandTitle=e}}const lt=t=>t.includes("/"),F=(t,e)=>e?t.toLowerCase():t,jt=(t,e,s,r={})=>{const n=lt(t),i=r.caseInsensitive===!0,c=F(t,i),a=[];for(const o of e){const l=n?x(s,o):nt(o);at(c,F(l,i))&&a.push(o)}return a},_t=(t,e,s,r={})=>{if(!e||e.length===0)return[...t];const n=r.caseInsensitive===!0;return t.filter(i=>{for(const c of e){const a=lt(c)?x(s,i):nt(i),o=F(c,n);if(at(o,F(a,n)))return!1}return!0})},U=t=>typeof t=="object"&&t!==null&&typeof t.title=="string"&&typeof t.task=="function",_=t=>typeof t=="object"&&t!==null&&typeof t.command=="string"&&typeof t.task!="function",Pt=(t,e)=>{const s=x(t,e);return s===""||!s.startsWith("..")&&!it(s)},Ot=(t,e)=>{let s;for(const r of e)Pt(r,t)&&(s===void 0||r.length>s.length)&&(s=r);return s},Ft=async t=>{let e=0,s=0;const r=()=>(e+=1,`pattern-${e}`),n=()=>(s+=1,`cmd-${s}`),i=(o,l,f,d)=>{if(o.perPackage===!0){const u=t.workspacePackages??[],g=new Map;for(const h of f){const w=Ot(h,u)??t.cwd,k=g.get(w)??[];k.push(x(w,h)),g.set(w,k)}for(const h of[...g.keys()].sort()){const w=x(t.cwd,h)||".";d.push({command:o.command,cwd:h,files:g.get(h)??[],id:n(),source:"string",title:`${o.command} — ${w}`})}return}if(o.cwd!==void 0){const u=yt(t.cwd,o.cwd);d.push({command:o.command,cwd:u,files:f,id:n(),source:"string",title:`${o.command} — ${x(t.cwd,u)||"."}`});return}d.push({command:o.command,files:l,id:n(),source:"string",title:o.command})},c=async(o,l,f,d)=>{if(typeof o=="string"){d.push({command:o,files:l,id:n(),source:"string",title:o});return}if(Array.isArray(o)){for(const u of o)await c(u,l,f,d);return}if(_(o)){i(o,l,f,d);return}if(typeof o=="function"){const u=await o([...l]);if(typeof u=="string"){d.push({command:u,files:l,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const g of u)if(typeof g=="string")d.push({command:g,files:l,id:n(),source:"function",title:g});else if(_(g))i(g,l,f,d);else if(U(g))d.push({files:l,id:n(),run:g.task,source:"custom",title:g.title});else throw new T("Task function returned an array with an unsupported entry — expected strings, { command, … }, or { title, task }.");return}if(_(u)){i(u,l,f,d);return}if(U(u)){d.push({files:l,id:n(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], { command, … }, or { title, task }.")}if(U(o)){d.push({files:l,id:n(),run:o.task,source:"custom",title:o.title});return}throw new T("Unsupported task value — expected string, string[], function, { command, … }, or { title, task }.")},a=[];for(const[o,l]of Object.entries(t.config)){const f=jt(o,t.files,t.cwd,{caseInsensitive:t.caseInsensitive===!0});if(f.length===0)continue;const d=t.relative?f.map(g=>x(t.cwd,g)):f,u=[];await c(l,d,f,u),u.length!==0&&a.push({commands:u,files:d,id:r(),pattern:o,title:`${o} — ${f.length} file${f.length===1?"":"s"}`})}return a},Nt=async t=>{if(t.config!==void 0)return t.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
2
2
 
3
3
  import { defineConfig } from "@visulima/vis/config";
4
4
 
@@ -1,4 +1,4 @@
1
- import{createRequire as rr}from"node:module";import{e as ue,m as Ss,$ as or,a as cr,z as ar}from"../packem_shared/index-DHD8wb6Z.js";import{expandAffected as lr,getChangedFiles as dr,buildEnhancedPath as ur,enforceProjectConstraints as fr,expandTokensInString as zt,parsePartition as hr,TaskScheduler as pr,createTaskGraph as mr,reverseTaskGraph as gr,resolveTurboEnvCompat as wr,CompositeLifeCycle as Yt,defaultTaskRunner as Kt,TerminalBuffer as yt,runConcurrently as tt,createLogReporter as vr,generateRunSummary as Xt,writeRunSummary as yr,readLastRunSummary as xr,getLastRunSummaryPath as jr,writeChromeTrace as kr}from"@visulima/task-runner";import{i as Ye}from"../packem_shared/index-BjdW45xX.js";import{U as Ts,W as br,T as Sr,v as Jt,X as Tr,Y as $r,d as Ir,Z as Cr,ar as Er,as as Rr,at as Pr,au as Mr,k as Fr,av as Or}from"./cli-main.js";import{u as U,y as n,X as g,m as a,E as me,R as J,w as Ar,d as Lr,b as Dr,Q as Br}from"./catalog.js";import{V as Ke}from"../packem_shared/vis-user-error-DJvfOpBX.js";import{d as _r,r as Nr}from"../packem_shared/lockfile-DVFySxTS.js";import{y as $s}from"../packem_shared/index-BisalDCf.js";import{F as Yr}from"../packem_shared/failure-log-DE_MJCzB.js";import{r as Kr}from"../packem_shared/command-runtime-CiLVo4ED.js";import{r as Xr}from"../packem_shared/toolchain-DY11tPCw.js";import{i as Jr,r as Qr,s as Zr,a as en,b as tn,c as sn,d as rn,e as nn,H as on,f as cn}from"../packem_shared/lifecycle-DW8KRF5d.js";import{s as an}from"../packem_shared/affected-selection-DLrq50Mz.js";import{c as Zt,p as ln,a as dn,b as un,r as fn,f as hn,s as pn}from"../packem_shared/project-name-filter-DdXd3P3a.js";import{p as mn,r as gn,f as wn,a as vn}from"../packem_shared/selectors-B7lSFz7l.js";import{r as at,l as jt,d as yn,s as xn,m as jn,a as kn}from"../packem_shared/target-options-d_rIrLyq.js";import{T as Is,C as Cs,D as lt,E as Es}from"../packem_shared/symbols-BXDZ_sKt.js";import{q as In,j as Cn,X as ht,F as ts}from"../packem_shared/index.server-BAjDJSEu.js";import{parseStacktrace as En,codeFrame as Rn}from"@visulima/error";import{originalPositionFor as Pn,sourceContentFor as Mn,loadSourceMap as Fn}from"@visulima/source-map";import{l as Rs}from"../packem_shared/spinner-BM_0Bj6x.js";import{R as Bn,c as st}from"../packem_shared/formatBytes-BHAzNIrn-Bkk_uRS-.js";import{c as ss,a as _n,s as rs}from"../packem_shared/watch-Dswvj6Zp.js";import gt from"./index.js";import{U as Ps}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let nr;const ir=s=>(nr??=rr(import.meta.url))(s),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=s=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[e,t]=ze.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return ze.getBuiltinModule(s)}return ir(s)},{existsSync:De,mkdirSync:Gr,writeFileSync:xt,readFileSync:We,openSync:Wr,statSync:Qt,readSync:Hr,closeSync:qr,mkdtempSync:Vr}=Pe("node:fs"),{createInterface:Ur,emitKeypressEvents:zr}=Pe("node:readline"),{isAbsolute:bn,resolve:es,dirname:Sn,relative:Tn}=Pe("node:path"),{fileURLToPath:$n}=Pe("node:url"),{createHash:On}=Pe("node:crypto"),{mkdir:An,appendFile:dt}=Pe("node:fs/promises"),{platform:Ln,homedir:kt,tmpdir:Dn}=Pe("node:os"),{spawn:Nn}=Pe("node:child_process"),Gn=27,Wn={95:"apc",80:"dcs",94:"pm",88:"sos"},Hn={159:"apc",144:"dcs",158:"pm",152:"sos"},Ms=s=>s===155||s===157||s===144||s===152||s===158||s===159,Fs=(s,e)=>{for(let t=e;t<s.length;t+=1){const r=s.codePointAt(t);if(r>=64&&r<=126)return t}return-1},rt=(s,e,t)=>{for(let r=e;r<s.length;r+=1){const c=s.codePointAt(r);if(c===156||t&&c===7)return r;if(c===27&&s.codePointAt(r+1)===92)return r+1}return-1},qn=(s,e)=>{const t=s.codePointAt(e+1);if(t===91){const r=Fs(s,e+2);return r===-1?void 0:{end:r,kind:"csi"}}if(t===93){const r=rt(s,e+2,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===80||t===88||t===94||t===95){const r=rt(s,e+2,!1),c=Wn[t];return r===-1?void 0:{end:r,kind:c}}return t===void 0?void 0:{end:e+1,kind:"escape"}},Vn=(s,e)=>{const t=s.codePointAt(e);if(t===155){const r=Fs(s,e+1);return r===-1?void 0:{end:r,kind:"csi"}}if(t===157){const r=rt(s,e+1,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===144||t===152||t===158||t===159){const r=rt(s,e+1,!1),c=Hn[t];return r===-1?void 0:{end:r,kind:c}}},Un=s=>{if(s.includes(String.fromCodePoint(27)))return!0;for(let e=0;e<s.length;e+=1)if(Ms(s.codePointAt(e)))return!0;return!1},zn=s=>{if(!Un(s))return s;let e="",t=0,r=0;const{length:c}=s;for(;r<c;){const o=s.codePointAt(r);let i;if(o===Gn)i=qn(s,r);else if(Ms(o))i=Vn(s,r);else{r+=1;continue}const d=i===void 0?c-1:i.end;e+=s.slice(t,r),t=d+1,r=d+1}return e+=s.slice(t),e},Yn=(s,e,t,r,c,o,i,d,u,p,f,h,l,b)=>{const T={d:r,h:c,m:o,mo:e,ms:d,s:i,w:t,y:s};return T.future=u,T.past=p,T.decimal=f,h!==void 0&&(T.unitMap=h),T.groupSeparator=l,T.placeholderSeparator=b,T},Kn={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Xn=Yn(s=>`year${s===1?"":"s"}`,s=>`month${s===1?"":"s"}`,s=>`week${s===1?"":"s"}`,s=>`day${s===1?"":"s"}`,s=>`hour${s===1?"":"s"}`,s=>`minute${s===1?"":"s"}`,s=>`second${s===1?"":"s"}`,s=>`millisecond${s===1?"":"s"}`,"in %s","%s ago",".",Kn,",","_"),ns=new WeakSet,Jn=s=>{if(ns.has(s))return;const e=["y","mo","w","d","h","m","s","ms"];for(const r of e)if(!Object.hasOwn(s,r))throw new TypeError(`Missing required property: ${r}`);if(s.future!==void 0&&typeof s.future!="string")throw new TypeError("Properties future and past must be of type string");if(s.past!==void 0&&typeof s.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const r of t)if(typeof s[r]!="string"&&typeof s[r]!="function")throw new TypeError(`Property ${r} must be of type string or function`);if(s.decimal&&typeof s.decimal!="string")throw new TypeError("Property decimal must be of type string");if(s.delimiter&&typeof s.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(s._digitReplacements&&!Array.isArray(s._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(s._numberFirst&&typeof s._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(s.unitMap&&typeof s.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(s.unitMap&&Object.values(s.unitMap).some(r=>typeof r!="string"))throw new TypeError("All values in unitMap must be of type string");ns.add(s)},Os=(s,e)=>{if(!Number.isFinite(s)||e<0||Number.isInteger(s))return s;const t=10**e,r=Number((s*t).toPrecision(15));return Math.trunc(r)/t},is=({unitCount:s,unitName:e},t,r)=>{let{spacer:c}=r;const{maxDecimalPoints:o}=r;let i=".";r.decimal!==void 0?i=r.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in r?d=r.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let u,p=s;o!==void 0&&(p=Os(s,o));const f=p.toString();if(!t._hideCountIf2||s!==2)if(d){u="";for(const b of f)u+=b==="."?i:d[b]}else u=f.replace(".",i);else u="";const h=t[e];let l=h;return typeof h=="function"&&(l=h(s)),t._hideCountIf2&&s===2&&(c=""),t._numberFirst?l+c+u:u+c+l},Qn=(s,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:r}=e,c=e.largest??Number.POSITIVE_INFINITY,o={};let i,d,u,p=s;for(d=0;d<t.length;d++){i=t[d];const h=r[i];u=d===t.length-1?p/h:Math.floor(p/h),o[i]=u,p-=u*h}if(e.round){let h=c;for(d=0;d<t.length;d++)if(i=t[d],u=o[i],u!==0&&(h--,h===0)){for(let l=d+1;l<t.length;l++){const b=t[l],T=o[b];o[i]=(o[i]??0)+T*r[b]/r[i],o[b]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],u=o[i],u===0)continue;const l=Math.round(u);if(o[i]=l,d===0)break;const b=t[d-1],T=r[b],N=Math.floor(l*r[i]/T);if(N)o[b]=(o[b]??0)+N,o[i]=0;else break}}const f=[];for(d=0;d<t.length&&f.length<c;d++){if(i=t[d],u=o[i],u&&!e.round&&f.length===c-1){let h,l=0;for(h=d+1,t.length;h<t.length;h++){const b=t[h];l+=o[b]*(e.unitMeasures[b]/e.unitMeasures[i])}u+=l,e.maxDecimalPoints!==void 0&&(u=Os(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:i})}return f},Zn=(s,e,t)=>{const{language:r,units:c}=e;if(s.length===0){const h=c.at(-1);return is({unitCount:0,unitName:h},r,e)}const{conjunction:o,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:r.delimiter!==void 0&&(d=r.delimiter);let u="";e.timeAdverb&&t!==0&&(u=r.future??"",t<0&&(u=r.past??""));const p=s.map(h=>is(h,r,e));let f;return!o||s.length===1?f=p.join(d):s.length===2?f=p.join(o):f=p.slice(0,-1).join(d)+(i?",":"")+o+(p.at(-1)??""),u&&(f=u.replace("%s",f)),f},ei=(s,e)=>{if(Number.isNaN(s))throw new TypeError("Expected a valid number");if(typeof s!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Xn,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Jn(t.language);const r=Math.abs(s),c=Qn(r,t);return Zn(c,t,s)},be="@voidzero-dev/vite-task-client",bt="@visulima/task-runner-client",nt=`npm:${bt}@^1`,As=ue(".vis",".vite-client-override-declined"),it="pnpm-workspace.yaml",ti=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Ls=s=>{try{return JSON.parse(We(s,"utf8"))}catch{return}},si=s=>{const e=ue(s,it);if(De(e))try{return $s(We(e,"utf8")).toJS()?.overrides}catch{return}},ri=s=>s==="pnpm"||s==="aube"?"pnpm.overrides":s==="yarn"?"resolutions":"overrides",ni=s=>{const e=ue(s,it);try{const t=$s(We(e,"utf8"));return t.setIn(["overrides",be],nt),xt(e,t.toString()),!0}catch{return!1}},os=s=>s!==void 0&&ti.some(e=>s[e]?.[be]!==void 0),ii=(s,e)=>s!==void 0&&(s.pnpm?.overrides?.[be]!==void 0||s.overrides?.[be]!==void 0||s.resolutions?.[be]!==void 0)||e?.[be]!==void 0,oi=(s,e=[])=>{const t=Ls(ue(s,"package.json")),r=De(ue(s,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ii(t,si(s)),declined:De(ue(s,As)),manager:_r(s)?.manager,present:os(t)||r||e.some(c=>os(c))}},ci=s=>{try{const e=ue(s,As);Gr(Ss(e),{recursive:!0}),xt(e,`Declined adding the ${be} → ${bt} override.
1
+ import{createRequire as rr}from"node:module";import{e as ue,m as Ss,$ as or,a as cr,z as ar}from"../packem_shared/index-DHD8wb6Z.js";import{expandAffected as lr,getChangedFiles as dr,buildEnhancedPath as ur,enforceProjectConstraints as fr,expandTokensInString as zt,parsePartition as hr,TaskScheduler as pr,createTaskGraph as mr,reverseTaskGraph as gr,resolveTurboEnvCompat as wr,CompositeLifeCycle as Yt,defaultTaskRunner as Kt,TerminalBuffer as yt,runConcurrently as tt,createLogReporter as vr,generateRunSummary as Xt,writeRunSummary as yr,readLastRunSummary as xr,getLastRunSummaryPath as jr,writeChromeTrace as kr}from"@visulima/task-runner";import{i as Ye}from"../packem_shared/index-BjdW45xX.js";import{U as Ts,W as br,T as Sr,v as Jt,X as Tr,Y as $r,d as Ir,Z as Cr,ar as Er,as as Rr,at as Pr,au as Mr,k as Fr,av as Or}from"./cli-main.js";import{u as U,y as n,X as g,m as a,E as me,R as J,w as Ar,d as Lr,b as Dr,Q as Br}from"./catalog.js";import{V as Ke}from"../packem_shared/vis-user-error-YIyfYNBK.js";import{d as _r,r as Nr}from"../packem_shared/lockfile-DVFySxTS.js";import{y as $s}from"../packem_shared/index-BisalDCf.js";import{F as Yr}from"../packem_shared/failure-log-DE_MJCzB.js";import{r as Kr}from"../packem_shared/command-runtime-CiLVo4ED.js";import{r as Xr}from"../packem_shared/toolchain-DY11tPCw.js";import{i as Jr,r as Qr,s as Zr,a as en,b as tn,c as sn,d as rn,e as nn,H as on,f as cn}from"../packem_shared/lifecycle-DW8KRF5d.js";import{s as an}from"../packem_shared/affected-selection-DP4GM66N.js";import{c as Zt,p as ln,a as dn,b as un,r as fn,f as hn,s as pn}from"../packem_shared/project-name-filter-C_mppI1h.js";import{p as mn,r as gn,f as wn,a as vn}from"../packem_shared/selectors-B7lSFz7l.js";import{r as at,l as jt,d as yn,s as xn,m as jn,a as kn}from"../packem_shared/target-options-d_rIrLyq.js";import{T as Is,C as Cs,D as lt,E as Es}from"../packem_shared/symbols-BXDZ_sKt.js";import{q as In,j as Cn,X as ht,F as ts}from"../packem_shared/index.server-sXNQYpsl.js";import{parseStacktrace as En,codeFrame as Rn}from"@visulima/error";import{originalPositionFor as Pn,sourceContentFor as Mn,loadSourceMap as Fn}from"@visulima/source-map";import{l as Rs}from"../packem_shared/spinner-BM_0Bj6x.js";import{R as Bn,c as st}from"../packem_shared/formatBytes-BHAzNIrn-Bkk_uRS-.js";import{c as ss,a as _n,s as rs}from"../packem_shared/watch-Dswvj6Zp.js";import gt from"./index.js";import{U as Ps}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let nr;const ir=s=>(nr??=rr(import.meta.url))(s),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=s=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[e,t]=ze.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return ze.getBuiltinModule(s)}return ir(s)},{existsSync:De,mkdirSync:Gr,writeFileSync:xt,readFileSync:We,openSync:Wr,statSync:Qt,readSync:Hr,closeSync:qr,mkdtempSync:Vr}=Pe("node:fs"),{createInterface:Ur,emitKeypressEvents:zr}=Pe("node:readline"),{isAbsolute:bn,resolve:es,dirname:Sn,relative:Tn}=Pe("node:path"),{fileURLToPath:$n}=Pe("node:url"),{createHash:On}=Pe("node:crypto"),{mkdir:An,appendFile:dt}=Pe("node:fs/promises"),{platform:Ln,homedir:kt,tmpdir:Dn}=Pe("node:os"),{spawn:Nn}=Pe("node:child_process"),Gn=27,Wn={95:"apc",80:"dcs",94:"pm",88:"sos"},Hn={159:"apc",144:"dcs",158:"pm",152:"sos"},Ms=s=>s===155||s===157||s===144||s===152||s===158||s===159,Fs=(s,e)=>{for(let t=e;t<s.length;t+=1){const r=s.codePointAt(t);if(r>=64&&r<=126)return t}return-1},rt=(s,e,t)=>{for(let r=e;r<s.length;r+=1){const c=s.codePointAt(r);if(c===156||t&&c===7)return r;if(c===27&&s.codePointAt(r+1)===92)return r+1}return-1},qn=(s,e)=>{const t=s.codePointAt(e+1);if(t===91){const r=Fs(s,e+2);return r===-1?void 0:{end:r,kind:"csi"}}if(t===93){const r=rt(s,e+2,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===80||t===88||t===94||t===95){const r=rt(s,e+2,!1),c=Wn[t];return r===-1?void 0:{end:r,kind:c}}return t===void 0?void 0:{end:e+1,kind:"escape"}},Vn=(s,e)=>{const t=s.codePointAt(e);if(t===155){const r=Fs(s,e+1);return r===-1?void 0:{end:r,kind:"csi"}}if(t===157){const r=rt(s,e+1,!0);return r===-1?void 0:{end:r,kind:"osc"}}if(t===144||t===152||t===158||t===159){const r=rt(s,e+1,!1),c=Hn[t];return r===-1?void 0:{end:r,kind:c}}},Un=s=>{if(s.includes(String.fromCodePoint(27)))return!0;for(let e=0;e<s.length;e+=1)if(Ms(s.codePointAt(e)))return!0;return!1},zn=s=>{if(!Un(s))return s;let e="",t=0,r=0;const{length:c}=s;for(;r<c;){const o=s.codePointAt(r);let i;if(o===Gn)i=qn(s,r);else if(Ms(o))i=Vn(s,r);else{r+=1;continue}const d=i===void 0?c-1:i.end;e+=s.slice(t,r),t=d+1,r=d+1}return e+=s.slice(t),e},Yn=(s,e,t,r,c,o,i,d,u,p,f,h,l,b)=>{const T={d:r,h:c,m:o,mo:e,ms:d,s:i,w:t,y:s};return T.future=u,T.past=p,T.decimal=f,h!==void 0&&(T.unitMap=h),T.groupSeparator=l,T.placeholderSeparator=b,T},Kn={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Xn=Yn(s=>`year${s===1?"":"s"}`,s=>`month${s===1?"":"s"}`,s=>`week${s===1?"":"s"}`,s=>`day${s===1?"":"s"}`,s=>`hour${s===1?"":"s"}`,s=>`minute${s===1?"":"s"}`,s=>`second${s===1?"":"s"}`,s=>`millisecond${s===1?"":"s"}`,"in %s","%s ago",".",Kn,",","_"),ns=new WeakSet,Jn=s=>{if(ns.has(s))return;const e=["y","mo","w","d","h","m","s","ms"];for(const r of e)if(!Object.hasOwn(s,r))throw new TypeError(`Missing required property: ${r}`);if(s.future!==void 0&&typeof s.future!="string")throw new TypeError("Properties future and past must be of type string");if(s.past!==void 0&&typeof s.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const r of t)if(typeof s[r]!="string"&&typeof s[r]!="function")throw new TypeError(`Property ${r} must be of type string or function`);if(s.decimal&&typeof s.decimal!="string")throw new TypeError("Property decimal must be of type string");if(s.delimiter&&typeof s.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(s._digitReplacements&&!Array.isArray(s._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(s._numberFirst&&typeof s._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(s.unitMap&&typeof s.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(s.unitMap&&Object.values(s.unitMap).some(r=>typeof r!="string"))throw new TypeError("All values in unitMap must be of type string");ns.add(s)},Os=(s,e)=>{if(!Number.isFinite(s)||e<0||Number.isInteger(s))return s;const t=10**e,r=Number((s*t).toPrecision(15));return Math.trunc(r)/t},is=({unitCount:s,unitName:e},t,r)=>{let{spacer:c}=r;const{maxDecimalPoints:o}=r;let i=".";r.decimal!==void 0?i=r.decimal:t.decimal!==void 0&&(i=t.decimal);let d;"digitReplacements"in r?d=r.digitReplacements:"_digitReplacements"in t&&(d=t._digitReplacements);let u,p=s;o!==void 0&&(p=Os(s,o));const f=p.toString();if(!t._hideCountIf2||s!==2)if(d){u="";for(const b of f)u+=b==="."?i:d[b]}else u=f.replace(".",i);else u="";const h=t[e];let l=h;return typeof h=="function"&&(l=h(s)),t._hideCountIf2&&s===2&&(c=""),t._numberFirst?l+c+u:u+c+l},Qn=(s,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:r}=e,c=e.largest??Number.POSITIVE_INFINITY,o={};let i,d,u,p=s;for(d=0;d<t.length;d++){i=t[d];const h=r[i];u=d===t.length-1?p/h:Math.floor(p/h),o[i]=u,p-=u*h}if(e.round){let h=c;for(d=0;d<t.length;d++)if(i=t[d],u=o[i],u!==0&&(h--,h===0)){for(let l=d+1;l<t.length;l++){const b=t[l],T=o[b];o[i]=(o[i]??0)+T*r[b]/r[i],o[b]=0}break}for(d=t.length-1;d>=0;d--){if(i=t[d],u=o[i],u===0)continue;const l=Math.round(u);if(o[i]=l,d===0)break;const b=t[d-1],T=r[b],N=Math.floor(l*r[i]/T);if(N)o[b]=(o[b]??0)+N,o[i]=0;else break}}const f=[];for(d=0;d<t.length&&f.length<c;d++){if(i=t[d],u=o[i],u&&!e.round&&f.length===c-1){let h,l=0;for(h=d+1,t.length;h<t.length;h++){const b=t[h];l+=o[b]*(e.unitMeasures[b]/e.unitMeasures[i])}u+=l,e.maxDecimalPoints!==void 0&&(u=Os(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:i})}return f},Zn=(s,e,t)=>{const{language:r,units:c}=e;if(s.length===0){const h=c.at(-1);return is({unitCount:0,unitName:h},r,e)}const{conjunction:o,serialComma:i}=e;let d=", ";e.delimiter!==void 0?d=e.delimiter:r.delimiter!==void 0&&(d=r.delimiter);let u="";e.timeAdverb&&t!==0&&(u=r.future??"",t<0&&(u=r.past??""));const p=s.map(h=>is(h,r,e));let f;return!o||s.length===1?f=p.join(d):s.length===2?f=p.join(o):f=p.slice(0,-1).join(d)+(i?",":"")+o+(p.at(-1)??""),u&&(f=u.replace("%s",f)),f},ei=(s,e)=>{if(Number.isNaN(s))throw new TypeError("Expected a valid number");if(typeof s!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Xn,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Jn(t.language);const r=Math.abs(s),c=Qn(r,t);return Zn(c,t,s)},be="@voidzero-dev/vite-task-client",bt="@visulima/task-runner-client",nt=`npm:${bt}@^1`,As=ue(".vis",".vite-client-override-declined"),it="pnpm-workspace.yaml",ti=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Ls=s=>{try{return JSON.parse(We(s,"utf8"))}catch{return}},si=s=>{const e=ue(s,it);if(De(e))try{return $s(We(e,"utf8")).toJS()?.overrides}catch{return}},ri=s=>s==="pnpm"||s==="aube"?"pnpm.overrides":s==="yarn"?"resolutions":"overrides",ni=s=>{const e=ue(s,it);try{const t=$s(We(e,"utf8"));return t.setIn(["overrides",be],nt),xt(e,t.toString()),!0}catch{return!1}},os=s=>s!==void 0&&ti.some(e=>s[e]?.[be]!==void 0),ii=(s,e)=>s!==void 0&&(s.pnpm?.overrides?.[be]!==void 0||s.overrides?.[be]!==void 0||s.resolutions?.[be]!==void 0)||e?.[be]!==void 0,oi=(s,e=[])=>{const t=Ls(ue(s,"package.json")),r=De(ue(s,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ii(t,si(s)),declined:De(ue(s,As)),manager:_r(s)?.manager,present:os(t)||r||e.some(c=>os(c))}},ci=s=>{try{const e=ue(s,As);Gr(Ss(e),{recursive:!0}),xt(e,`Declined adding the ${be} → ${bt} override.
2
2
  Delete this file to be asked again.
3
3
  `)}catch{}},ai=(s,e="npm")=>{const t=`${e} install`;if((e==="pnpm"||e==="aube")&&De(ue(s,it))&&ni(s))return{file:it,installCommand:t};const r=ue(s,"package.json"),c=Ls(r);if(!c)return;const o=ri(e);o==="pnpm.overrides"?(c.pnpm??={},c.pnpm.overrides??={},c.pnpm.overrides[be]=nt):(c[o]??={},c[o][be]=nt);try{xt(r,`${JSON.stringify(c,void 0,4)}
4
4
  `)}catch{return}return{file:"package.json",installCommand:t}},li=async(s,e)=>{const t=oi(s,e.projectManifests);if(!t.present||t.alreadyOverridden||t.declined)return!1;const r=Ur({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${be}. Its cache hints no-op under @visulima/task-runner unless aliased to ${bt} (a drop-in replacement).`);const c=await new Promise(i=>{r.question("Add the override now? [y/N] ",i)});if(!/^y(?:es)?$/i.test(c.trim()))return ci(s),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=ai(s,t.manager);return o===void 0?(e.logger.warn("Could not write the override automatically — add it manually (see @visulima/task-runner-client README)."),!1):(e.logger.info(`Added "${be}": "${nt}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{r.close()}},di=({interactive:s,taskPty:e,workspacePty:t})=>e===!0?!0:e===!1?!1:s&&t!==!1,ui=s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),fi=(s,e,t)=>{const r=new Set,c=[];if(s===void 0||s.trim()==="")return{skipTaskIds:r,unmatchedPatterns:c};const o=[...t],i=new Set(o),d=new Map;for(const u of o){const p=u.lastIndexOf(":");if(p===-1)continue;const f=u.slice(p+1),h=d.get(f);h===void 0?d.set(f,[u]):h.push(u)}for(const u of ui(s)){if(u.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${u}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(u)){r.add(u);continue}const p=mn(u);if(!p){c.push(u);continue}let f=!1;switch(p.kind){case"all":{const h=d.get(p.target)??[];for(const l of h)r.add(l),f=!0;break}case"project":{const h=p.projects?.[0];if(h!==void 0){const l=`${h}:${p.target}`;i.has(l)&&(r.add(l),f=!0)}break}case"tag":{const{tag:h}=p;if(h!==void 0){const l=d.get(p.target)??[];for(const b of l){const T=b.slice(0,b.lastIndexOf(":"));e.projects[T]?.tags?.includes(h)===!0&&(r.add(b),f=!0)}}break}}f||c.push(u)}return{skipTaskIds:r,unmatchedPatterns:c}},hi=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,pi=new Set(["0","!","#","$","*","-","?","@","_"]),mi=s=>{const e=new Map;for(const t of s.matchAll(hi)){const r=t[1],c=t[3],o=t[2],i=r??c;if(i===void 0||pi.has(i))continue;const d=o!==void 0,u=e.get(i);u===void 0?e.set(i,d):u&&!d&&e.set(i,!1)}return[...e.entries()].map(([t,r])=>({hasDefault:r,name:t}))},gi=s=>{const{command:e,processEnv:t,taskEnv:r,taskId:c}=s,o=mi(e);if(o.length===0)return;const i=[];for(const{hasDefault:d,name:u}of o){if(d)continue;const p=r[u],f=t[u];p===void 0&&f===void 0&&i.push(u)}if(i.length!==0)return{missing:i.toSorted(),taskId:c}},wi=s=>{const e=s.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${s.taskId} references unset variable${s.missing.length===1?"":"s"} ${e}. Set ${s.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},vi=64*1024,cs=256,yi=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),pt=s=>s.replaceAll(yi,"").replaceAll("\r","");class as{#e=[];#r=new Set;#s=new Map;#n=new Map;constructor(e=[]){for(const t of e)this.#n.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=()=>this.#s;subscribe=e=>(this.#r.add(e),()=>{this.#r.delete(e)});getIds(){return this.#e}getState(e){return this.#n.get(e)}getDockState(){let e=!1,t=!1;for(const r of this.#n.values())r.status==="crashed"||r.status==="failed"?e=!0:(r.status==="pending"||r.status==="starting")&&(t=!0);return e?"crash":t?"boot":"ready"}registerService(e){this.#n.has(e)||(this.#n.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#o())}markStarting(e){this.#t(e,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,r=>({...r,startedAt:r.startedAt??Date.now(),status:r.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,r=>({...r,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,r){const c=r?.message;this.#t(e,o=>({...o,errorMessage:pt(c??t),status:"failed"}))}markCrashed(e,t){const r=t.slice(-cs).map(c=>pt(c));this.#t(e,c=>({...c,errorMessage:r.length>0?r[r.length-1]:"process exited",status:"crashed",tailLines:r}))}appendLog(e,t){const r=t.split(`
@@ -1,4 +1,4 @@
1
- import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-BAjDJSEu.js";import{a as O}from"../packem_shared/index-DHD8wb6Z.js";import{readLastRunSummary as G}from"@visulima/task-runner";import{a as j,r as F,b as D,c as K}from"../packem_shared/ai-fix-CyUx_ZAB.js";import{p,f as H}from"./cli-main.js";let B;const P=e=>(B??=E(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return P(e)},{spawn:h}=I("node:child_process"),{readFile:M}=I("node:fs/promises"),V=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},J=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await M(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,s=o.pull_request?.head?.sha;return{prNumber:r,sha:s}}catch{return{prNumber:void 0,sha:void 0}}},q=async e=>{const t=V(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await J(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},z=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,s=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:s}},X=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,s=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,i=e.BUILDKITE_PIPELINE_SLUG,a=n!==void 0&&n!==""&&i!==void 0&&i!==""?`${n}/${i}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(s)?s:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:a,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Y=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await q(e):e.GITLAB_CI==="true"?z(e):e.BUILDKITE==="true"?X(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Q=(e,t,o,r)=>new Promise(s=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const i=h(e,n,{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(o)}),Z=async(e,t,o,r,s)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const i=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${s}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!i.ok){const a=await i.text().catch(()=>"");return{error:`GitHub REST returned ${String(i.status)}: ${a.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(i){return{error:i instanceof Error?i.message:String(i),ok:!1}}},W=async(e,t,o,r,s,n)=>{const i=encodeURIComponent(o),a=`${t.replace(/\/+$/,"")}/projects/${i}/merge_requests/${String(r)}/notes`;try{const d=await e(a,{body:JSON.stringify({body:s}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},tt=(e,t,o,r)=>new Promise(s=>{const i=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(t)}),et=async(e,t,o,r,s,n,i,a)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const u=await e(f,{body:JSON.stringify({body:s,context:i,style:n}),headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},method:"POST"});if(!u.ok){const l=await u.text().catch(()=>"");return{error:`Buildkite REST returned ${String(u.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(u){return{error:u instanceof Error?u.message:String(u),ok:!1}}},ot=async(e,t,o,r)=>{const s=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",i=await tt(o,e,n,s);if(i.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const a=await et(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,s,t.token);return a.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(i.exitCode)}; REST fallback also failed: ${a.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const s=await Q(o,t.prNumber,e,t.repo);if(s.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(s.exitCode)} (${s.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(s.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},it=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},nt=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:s=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await rt(t,r,n,s):r.provider==="gitlab-ci"?await it(t,r,s):r.provider==="buildkite"?await ot(t,r,o,s):{method:"skipped",posted:!1}},b=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},k=(e,t,o)=>{const r=K(e,t,o),s=O(e,r);return s===""||s.startsWith("..")?r:s},st=(e,t,o,r)=>new Promise(s=>{const n=process.argv[1];if(!n){s({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const i=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],a=h(process.execPath,i,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{a.kill("SIGTERM"),setTimeout(()=>a.kill("SIGKILL"),2e3).unref()},r);a.stdout?.setEncoding("utf8"),a.stdout?.on("data",u=>{d+=u}),a.stderr?.setEncoding("utf8"),a.stderr?.on("data",u=>{c+=u}),a.once("error",u=>{clearTimeout(f),s({exitCode:-1,stderr:u.message,stdout:d})}),a.once("close",u=>{clearTimeout(f),s({exitCode:u??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},_=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[s,n]of e.patches.entries()){const i=k(t,o,n.file),a=[`**[${String(s+1)}] \`${i}\`**`];n.reason&&a.push(`_${n.reason}_`);const d=T(`${n.oldString}
1
+ import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-sXNQYpsl.js";import{a as O}from"../packem_shared/index-DHD8wb6Z.js";import{readLastRunSummary as G}from"@visulima/task-runner";import{a as j,r as F,b as D,c as K}from"../packem_shared/ai-fix-CyUx_ZAB.js";import{p,f as H}from"./cli-main.js";let B;const P=e=>(B??=E(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return P(e)},{spawn:h}=I("node:child_process"),{readFile:M}=I("node:fs/promises"),V=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},J=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await M(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,s=o.pull_request?.head?.sha;return{prNumber:r,sha:s}}catch{return{prNumber:void 0,sha:void 0}}},q=async e=>{const t=V(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await J(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},z=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,s=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:s}},X=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,s=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,i=e.BUILDKITE_PIPELINE_SLUG,a=n!==void 0&&n!==""&&i!==void 0&&i!==""?`${n}/${i}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(s)?s:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:a,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Y=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await q(e):e.GITLAB_CI==="true"?z(e):e.BUILDKITE==="true"?X(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Q=(e,t,o,r)=>new Promise(s=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const i=h(e,n,{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(o)}),Z=async(e,t,o,r,s)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const i=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${s}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!i.ok){const a=await i.text().catch(()=>"");return{error:`GitHub REST returned ${String(i.status)}: ${a.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(i){return{error:i instanceof Error?i.message:String(i),ok:!1}}},W=async(e,t,o,r,s,n)=>{const i=encodeURIComponent(o),a=`${t.replace(/\/+$/,"")}/projects/${i}/merge_requests/${String(r)}/notes`;try{const d=await e(a,{body:JSON.stringify({body:s}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},tt=(e,t,o,r)=>new Promise(s=>{const i=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(t)}),et=async(e,t,o,r,s,n,i,a)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const u=await e(f,{body:JSON.stringify({body:s,context:i,style:n}),headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},method:"POST"});if(!u.ok){const l=await u.text().catch(()=>"");return{error:`Buildkite REST returned ${String(u.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(u){return{error:u instanceof Error?u.message:String(u),ok:!1}}},ot=async(e,t,o,r)=>{const s=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",i=await tt(o,e,n,s);if(i.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const a=await et(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,s,t.token);return a.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(i.exitCode)}; REST fallback also failed: ${a.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const s=await Q(o,t.prNumber,e,t.repo);if(s.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(s.exitCode)} (${s.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(s.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},it=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},nt=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:s=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await rt(t,r,n,s):r.provider==="gitlab-ci"?await it(t,r,s):r.provider==="buildkite"?await ot(t,r,o,s):{method:"skipped",posted:!1}},b=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},k=(e,t,o)=>{const r=K(e,t,o),s=O(e,r);return s===""||s.startsWith("..")?r:s},st=(e,t,o,r)=>new Promise(s=>{const n=process.argv[1];if(!n){s({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const i=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],a=h(process.execPath,i,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{a.kill("SIGTERM"),setTimeout(()=>a.kill("SIGKILL"),2e3).unref()},r);a.stdout?.setEncoding("utf8"),a.stdout?.on("data",u=>{d+=u}),a.stderr?.setEncoding("utf8"),a.stderr?.on("data",u=>{c+=u}),a.once("error",u=>{clearTimeout(f),s({exitCode:-1,stderr:u.message,stdout:d})}),a.once("close",u=>{clearTimeout(f),s({exitCode:u??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},_=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[s,n]of e.patches.entries()){const i=k(t,o,n.file),a=[`**[${String(s+1)}] \`${i}\`**`];n.reason&&a.push(`_${n.reason}_`);const d=T(`${n.oldString}
2
2
  ${n.newString}`);a.push(`${d}diff`);for(const c of n.oldString.split(`
3
3
  `))a.push(`- ${c}`);for(const c of n.newString.split(`
4
4
  `))a.push(`+ ${c}`);a.push(d),r.push(a.join(`
@@ -1,8 +1,8 @@
1
- import{createRequire as At}from"node:module";import{w as It,$ as Wt,e as kt,j as C,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-BAjDJSEu.js";import{u as dt,c as B,e as Mt}from"../packem_shared/vis-user-error-DJvfOpBX.js";import{N as R,a as _}from"../packem_shared/Table-DyORjLji-CC9cYgCG.js";import{b as jt}from"../packem_shared/package-version-BFsJ8iyZ.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"),Ct=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=t=>{let[,e]=Ct.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]},ut=(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(ut(t,e,n));function Rt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}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,u)=>({close:`\x1B[${String(u)}m`,open:`\x1B[${String(l)}m`}):()=>tt,n=l=>(u,p,g)=>l(ut(Number(u),Number(p),Number(g))),r=l=>u=>{const[p,g,w]=z(u);return l(p,g,w)};let s=l=>e(`38;5;${String(l)}`,m),o=l=>e(`48;5;${String(l)}`,f),i=(l,u,p)=>e(`38;2;${String(l)};${String(u)};${String(p)}`,m),a=(l,u,p)=>e(`48;2;${String(l)};${String(u)};${String(p)}`,f);t===1?(s=l=>e(H(Number(l)),m),o=l=>e(H(Number(l))+X,f),i=(l,u,p)=>e(Z(Number(l),Number(u),Number(p)),m),a=(l,u,p)=>e(Z(Number(l),Number(u),Number(p))+X,f)):t===2&&(i=n(s),a=n(o));const d={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,u,p)=>a(S(l,0,255),S(u,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,u,p)=>i(S(l,0,255),S(u,0,255),S(p,0,255))};return{baseColors:c,baseStyles:d,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
- `)&&(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 u=(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:u,props:c},g.open=u,g.close=p,g},d=c=>String(c);d.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(d,i),d},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
- `],["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,d,c)=>d?mt(d):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,d,c,h)=>{if(i)s.push(mt(i));else if(d){const l=s.join("");s=[],r.push(n.length===0?l:nt(t,n)(l)),n.push({inverse:a,styles:zt(d)})}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,de=10630,ue=[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>de?!1:k(ue,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(dt.source,"y"),U=new RegExp(Mt.source,"uy"),j=/(?:[\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,d=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(dt,""),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,d=Math.min(d,i);else if(a+q>r&&(d=Math.min(d,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&&(d=Math.min(d,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&&(d=Math.min(d,i),a+n.width.tab>n.truncation.limit)){c=!0;break}a+=n.width.tab,i+=1;continue}if(j.lastIndex=i,j.test(t)){const y=(j.lastIndex-i)*n.width.regular;if(a+y>r){const v=n.width.regular>0?Math.floor((r-a)/n.width.regular):0;if(d=Math.min(d,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=j.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(d=Math.min(d,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&&(d=Math.min(d,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&&(d=Math.min(d,i),a+w>n.truncation.limit)){c=!0;break}a+=w,i+=g>65535?2:1}let l=a,u=!1;return c&&n.truncation.limit>=n.truncation.ellipsisWidth&&(l=n.truncation.limit,u=!0),{ellipsed:u,index:c?d: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=jt().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(C(e)),this.lines.push("")}}const je=t=>t!==void 0&&t>0?t:ke().columns,Ce=(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 d=e-i;return[i,d]};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=je(T()),r=a=>Array.isArray(a)?a.map(d=>$(d)):[$(a)],s=e.map(a=>r(a)),o=Ce(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
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-YIyfYNBK.js";import{N as R,a as _}from"../packem_shared/Table-DyORjLji-CC9cYgCG.js";import{b as Ct}from"../packem_shared/package-version-BO37_qsn.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
+ `)&&(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
+ `],["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:
5
5
 
6
- ${JSON.stringify(e)}`)}}class _e extends Nt{constructor(e){super();let n=e.optionList??[];const r=Array.isArray(e.hide)?e.hide:[e.hide].filter(i=>typeof i=="string"),s=Array.isArray(e.group)?e.group:[e.group].filter(i=>typeof i=="string");r.length>0&&(n=n.filter(i=>!r.includes(i.name))),e.header&&this.header($(e.header)),s.length>0&&(n=n.filter(i=>{const a=i,d=s.includes("_none")&&!a.group,c=a.group,h=this.intersect(Array.isArray(c)?c:[c],s);return d||h?i:void 0}));const o=R({showHeader:!1,style:{border:_,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:T()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});n.forEach(i=>{const a=i;o.addRow([this.getOptionNames(a,e.reverseNameOrder??!1,e.isArgument??!1),$(a.description)])}),this.add(o.toString()),this.lines.push("")}getOptionNames(e,n,r){if(!e.name)throw new TypeError("Invalid option definition, name is required.");const s=e.type?e.type.name.toLowerCase():"string",{lazyMultiple:o}=e,i=e.multiple||o?"[]":"",a=e.typeLabel===void 0?kt(`${s}${i}`):$(e.typeLabel),d=r?C(e.name):C.yellow(`--${e.name}`),c=e.alias;if(c){const h=C(`-${c}`);return n?`${d}, ${h} ${a}`:`${h}, ${d} ${a}`}return`${d} ${a}`}intersect(e,n){return e.some(r=>n.includes(r))}}const K=t=>(Array.isArray(t)?t:[t]).length===0?"":`
6
+ ${JSON.stringify(e)}`)}}class _e extends Nt{constructor(e){super();let n=e.optionList??[];const r=Array.isArray(e.hide)?e.hide:[e.hide].filter(i=>typeof i=="string"),s=Array.isArray(e.group)?e.group:[e.group].filter(i=>typeof i=="string");r.length>0&&(n=n.filter(i=>!r.includes(i.name))),e.header&&this.header($(e.header)),s.length>0&&(n=n.filter(i=>{const a=i,u=s.includes("_none")&&!a.group,c=a.group,h=this.intersect(Array.isArray(c)?c:[c],s);return u||h?i:void 0}));const o=R({showHeader:!1,style:{border:_,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:T()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});n.forEach(i=>{const a=i;o.addRow([this.getOptionNames(a,e.reverseNameOrder??!1,e.isArgument??!1),$(a.description)])}),this.add(o.toString()),this.lines.push("")}getOptionNames(e,n,r){if(!e.name)throw new TypeError("Invalid option definition, name is required.");const s=e.type?e.type.name.toLowerCase():"string",{lazyMultiple:o}=e,i=e.multiple||o?"[]":"",a=e.typeLabel===void 0?kt(`${s}${i}`):$(e.typeLabel),u=r?j(e.name):j.yellow(`--${e.name}`),c=e.alias;if(c){const h=j(`-${c}`);return n?`${u}, ${h} ${a}`:`${h}, ${u} ${a}`}return`${u} ${a}`}intersect(e,n){return e.some(r=>n.includes(r))}}const K=t=>(Array.isArray(t)?t:[t]).length===0?"":`
7
7
  ${t.map(e=>e.optionList?new _e(e).toString():new Re(e).toString()).join(`
8
- `)}`,st=(t,e)=>{const n=`${e==="readme"?t.name.toUpperCase():t.name}${t.multiple===!0?"...":""}`;return t.required===!0?e==="readme"?n:`<${n}>`:`[${n}]`},Pe=(t,e="help")=>t.argument?t.argument.hidden?"":e==="readme"?` ${st(t.argument,e)}`:" [positional arguments]":!t.arguments||t.arguments.length===0?"":t.arguments.filter(n=>!n.hidden).map(n=>` ${st(n,e)}`).join(""),Te=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],at="__Other",lt=t=>t.charAt(0).toUpperCase()+t.slice(1),Le=(t,e,n,r)=>{t.debug("no command given, printing general help...");let s=[...new Set(n.values())].filter(a=>!a.hidden);r&&(s=s.filter(a=>a.group===r));const o=s.reduce((a,d)=>{const c=d.group??at;return a[c]??=[],a[c].push(d),a},{}),i=a=>a.map(d=>{let c="";typeof d.alias=="string"?c=d.alias:Array.isArray(d.alias)&&(c=d.alias.join(", ")),c!==""&&(c=` [${c}]`);let h=d.name;return d.commandPath&&d.commandPath.length>0&&(h=`${d.commandPath.join(" ")} ${d.name}`),[`${N(h)}${c}`,d.description??""]});(t.raw??t.log)(K([{content:`${x(e.getCliName())} ${N("<command>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},...Object.keys(o).map(a=>{const d=r?` ${lt(r)}`:"";return{content:i(o[a]),header:a===at||r?b.green(` Available${d} Commands `):` ${b.green(` ${lt(a)} `)}`}}),n.has("help")?{header:b.yellow(" Command Options "),optionList:n.get("help").options?.filter(a=>!a.hidden)}:void 0,{header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:Te.filter(a=>!a.hidden).map(a=>[a.name,a.description??""]),header:b.magenta(" Environment Variables ")},{content:`Run "${x(e.getCliName())} ${N("help <command>")}" or "${x(e.getCliName())} ${N("<command>")} ${L("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},ct=(t,e)=>{const n=[];for(const r of t.values()){if(r.hidden)continue;const s=r.commandPath??[];if(s.length!==e.length)continue;let o=!0;for(const[i,a]of e.entries())if(s[i]!==a){o=!1;break}o&&n.push(r)}return n},Fe=(t,e,n,r)=>{const s=n.join(" "),o=[{content:`${x(e.getCliName())} ${N(s)} ${N("<subcommand>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},{content:r.map(i=>{const a=[...i.commandPath??[],i.name].join(" ");return[N(a),i.description??""]}),header:b.green(" Subcommands ")},{header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:`Run "${x(e.getCliName())} ${N(`${s} <subcommand>`)} ${L("--help")}" for help with a specific subcommand.`,raw:!0}];(t.raw??t.log)(K(o))},De=(t,e,n,r,s)=>{let o=s??n.get(r);if(!o)for(const l of n.values()){const u=l.commandPath?[...l.commandPath,l.name]:[l.name];if(u.at(-1)===r||u.join(" ")===r){o=l;break}}if(!o){const l=r.split(" ").filter(Boolean),u=l.length>0?ct(n,l):[];if(u.length>0){Fe(t,e,l,u);return}t.error(`Command "${r}" not found`);return}const i=[],a=(o.commandPath?[...o.commandPath,o.name]:[o.name]).join(" ");i.push({content:`${x(e.getCliName())} ${N(a)}${Pe(o)}${o.options?" [options]":""}`,header:b.cyan(" Usage ")}),o.description&&i.push({content:o.description,header:b.green(" Description ")});const d=(o.argument?[o.argument]:o.arguments??[]).filter(l=>!l.hidden);if(d.length>0&&i.push({header:"Command Positional Arguments",isArgument:!0,optionList:d}),Array.isArray(o.options)&&o.options.length>0&&i.push({header:b.yellow(" Command Options "),optionList:o.options.filter(l=>!l.hidden)}),i.push({header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()}),Array.isArray(o.env)&&o.env.length>0){const l=o.env.filter(u=>!u.hidden);l.length>0&&i.push({content:l.map(u=>[u.name,u.description??""]),header:b.magenta(" Environment Variables ")})}if(o.alias!==void 0&&o.alias.length>0){let l=o.alias;typeof o.alias=="string"&&(l=[o.alias]),i.splice(1,0,{content:l,header:"Alias(es)"})}Array.isArray(o.examples)&&o.examples.length>0&&i.push({content:o.examples,header:"Examples"});const c=[...o.commandPath??[],o.name],h=ct(n,c);h.length>0&&i.push({content:h.map(l=>{const u=[...l.commandPath??[],l.name].join(" ");return[N(u),l.description??""]}),header:b.green(" Subcommands ")}),(t.raw??t.log)(K(i))};class He{argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(e){this.commands=e}execute(e){const{argument:n,command:r,commandName:s,logger:o,options:i,runtime:a}=e,{footer:d,header:c}=a.getCommandSection();c&&(o.raw??o.log)($(c));const h=s==="help"&&Array.isArray(n)&&n.length>0?n.join(" "):void 0;if(s==="help"&&h===void 0)Le(o,a,this.commands,typeof i?.group=="string"?i.group:void 0);else{const l=h!==void 0||r===void 0||r.name==="help"?void 0:r;De(o,a,this.commands,h??s,l)}d&&(o.raw??o.log)($(d))}}export{He as default};
8
+ `)}`,st=(t,e)=>{const n=`${e==="readme"?t.name.toUpperCase():t.name}${t.multiple===!0?"...":""}`;return t.required===!0?e==="readme"?n:`<${n}>`:`[${n}]`},Pe=(t,e="help")=>t.argument?t.argument.hidden?"":e==="readme"?` ${st(t.argument,e)}`:" [positional arguments]":!t.arguments||t.arguments.length===0?"":t.arguments.filter(n=>!n.hidden).map(n=>` ${st(n,e)}`).join(""),Te=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],at="__Other",lt=t=>t.charAt(0).toUpperCase()+t.slice(1),Le=(t,e,n,r)=>{t.debug("no command given, printing general help...");let s=[...new Set(n.values())].filter(a=>!a.hidden);r&&(s=s.filter(a=>a.group===r));const o=s.reduce((a,u)=>{const c=u.group??at;return a[c]??=[],a[c].push(u),a},{}),i=a=>a.map(u=>{let c="";typeof u.alias=="string"?c=u.alias:Array.isArray(u.alias)&&(c=u.alias.join(", ")),c!==""&&(c=` [${c}]`);let h=u.name;return u.commandPath&&u.commandPath.length>0&&(h=`${u.commandPath.join(" ")} ${u.name}`),[`${N(h)}${c}`,u.description??""]});(t.raw??t.log)(K([{content:`${x(e.getCliName())} ${N("<command>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},...Object.keys(o).map(a=>{const u=r?` ${lt(r)}`:"";return{content:i(o[a]),header:a===at||r?b.green(` Available${u} Commands `):` ${b.green(` ${lt(a)} `)}`}}),n.has("help")?{header:b.yellow(" Command Options "),optionList:n.get("help").options?.filter(a=>!a.hidden)}:void 0,{header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:Te.filter(a=>!a.hidden).map(a=>[a.name,a.description??""]),header:b.magenta(" Environment Variables ")},{content:`Run "${x(e.getCliName())} ${N("help <command>")}" or "${x(e.getCliName())} ${N("<command>")} ${L("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},ct=(t,e)=>{const n=[];for(const r of t.values()){if(r.hidden)continue;const s=r.commandPath??[];if(s.length<e.length)continue;let o=!0;for(const[i,a]of e.entries())if(s[i]!==a){o=!1;break}o&&n.push(r)}return n},Fe=(t,e,n,r)=>{const s=n.join(" "),o=[{content:`${x(e.getCliName())} ${N(s)} ${N("<subcommand>")} [positional arguments] ${L("[options]")}`,header:b.cyan(" Usage ")},{content:r.map(i=>{const a=[...i.commandPath??[],i.name].join(" ");return[N(a),i.description??""]}),header:b.green(" Subcommands ")},{header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()},{content:`Run "${x(e.getCliName())} ${N(`${s} <subcommand>`)} ${L("--help")}" for help with a specific subcommand.`,raw:!0}];(t.raw??t.log)(K(o))},De=(t,e,n,r,s)=>{let o=s??n.get(r);if(!o)for(const l of n.values()){const d=l.commandPath?[...l.commandPath,l.name]:[l.name];if(d.at(-1)===r||d.join(" ")===r){o=l;break}}if(!o){const l=r.split(" ").filter(Boolean),d=l.length>0?ct(n,l):[];if(d.length>0){Fe(t,e,l,d);return}t.error(`Command "${r}" not found`);return}const i=[],a=(o.commandPath?[...o.commandPath,o.name]:[o.name]).join(" ");i.push({content:`${x(e.getCliName())} ${N(a)}${Pe(o)}${o.options?" [options]":""}`,header:b.cyan(" Usage ")}),o.description&&i.push({content:o.description,header:b.green(" Description ")});const u=(o.argument?[o.argument]:o.arguments??[]).filter(l=>!l.hidden);if(u.length>0&&i.push({header:"Command Positional Arguments",isArgument:!0,optionList:u}),Array.isArray(o.options)&&o.options.length>0&&i.push({header:b.yellow(" Command Options "),optionList:o.options.filter(l=>!l.hidden)}),i.push({header:b.yellow(" Global Options "),optionList:e.getGlobalOptions()}),Array.isArray(o.env)&&o.env.length>0){const l=o.env.filter(d=>!d.hidden);l.length>0&&i.push({content:l.map(d=>[d.name,d.description??""]),header:b.magenta(" Environment Variables ")})}if(o.alias!==void 0&&o.alias.length>0){let l=o.alias;typeof o.alias=="string"&&(l=[o.alias]),i.splice(1,0,{content:l,header:"Alias(es)"})}Array.isArray(o.examples)&&o.examples.length>0&&i.push({content:o.examples,header:"Examples"});const c=[...o.commandPath??[],o.name],h=ct(n,c);h.length>0&&i.push({content:h.map(l=>{const d=[...l.commandPath??[],l.name].join(" ");return[N(d),l.description??""]}),header:b.green(" Subcommands ")}),(t.raw??t.log)(K(i))};class He{argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(e){this.commands=e}execute(e){const{argument:n,command:r,commandName:s,logger:o,options:i,runtime:a}=e,{footer:u,header:c}=a.getCommandSection();c&&(o.raw??o.log)($(c));const h=s==="help"&&Array.isArray(n)&&n.length>0?n.join(" "):void 0;if(s==="help"&&h===void 0)Le(o,a,this.commands,typeof i?.group=="string"?i.group:void 0);else{const l=h!==void 0||r===void 0||r.name==="help"?void 0:r;De(o,a,this.commands,h??s,l)}u&&(o.raw??o.log)($(u))}}export{He as default};
@@ -24,7 +24,7 @@
24
24
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
25
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
26
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- */let _=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class m extends Date{#n=!1;#i=!1;#e=null;constructor(n){let i=!0,l=!0,o="Z";if(typeof n=="string"){let f=n.match(_);f?(f[1]||(i=!1,n=`0000-01-01T${n}`),l=!!f[2],l&&n[10]===" "&&(n=n.replace(" ","T")),f[2]&&+f[2]>23?n="":(o=f[3]||null,n=n.toUpperCase(),!o&&l&&(n+="Z"))):n=""}super(n),isNaN(this.getTime())||(this.#n=i,this.#i=l,this.#e=o)}isDateTime(){return this.#n&&this.#i}isLocal(){return!this.#n||!this.#i||!this.#e}isDate(){return this.#n&&!this.#i}isTime(){return this.#i&&!this.#n}isValid(){return this.#n||this.#i}toISOString(){let n=super.toISOString();if(this.isDate())return n.slice(0,10);if(this.isTime())return n.slice(11,23);if(this.#e===null)return n.slice(0,-1);if(this.#e==="Z")return n;let i=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return i=this.#e[0]==="-"?i:-i,new Date(this.getTime()-i*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(n,i="Z"){let l=new m(n);return l.#e=i,l}static wrapAsLocalDateTime(n){let i=new m(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new m(n);return i.#i=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new m(n);return i.#n=!1,i.#e=null,i}}/*!
27
+ */let O=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class m extends Date{#r=!1;#t=!1;#e=null;constructor(i){let r=!0,t=!0,l="Z";if(typeof i=="string"){let n=i.match(O);n?(n[1]||(r=!1,i=`0000-01-01T${i}`),t=!!n[2],t&&i[10]===" "&&(i=i.replace(" ","T")),n[2]&&+n[2]>23?i="":(l=n[3]||null,i=i.toUpperCase(),!l&&t&&(i+="Z"))):i=""}super(i),isNaN(this.getTime())||(this.#r=r,this.#t=t,this.#e=l)}isDateTime(){return this.#r&&this.#t}isLocal(){return!this.#r||!this.#t||!this.#e}isDate(){return this.#r&&!this.#t}isTime(){return this.#t&&!this.#r}isValid(){return this.#r||this.#t}toISOString(){let i=super.toISOString();if(this.isDate())return i.slice(0,10);if(this.isTime())return i.slice(11,23);if(this.#e===null)return i.slice(0,-1);if(this.#e==="Z")return i;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(i,r="Z"){let t=new m(i);return t.#e=r,t}static wrapAsLocalDateTime(i){let r=new m(i);return r.#e=null,r}static wrapAsLocalDate(i){let r=new m(i);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(i){let r=new m(i);return r.#r=!1,r.#e=null,r}}/*!
28
28
  * Copyright (c) Squirrel Chat et al., All rights reserved.
29
29
  * SPDX-License-Identifier: BSD-3-Clause
30
30
  *
@@ -50,24 +50,10 @@
50
50
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
51
51
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52
52
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53
- */function S(e,n){let i=e.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function P(e,n,i){let l=e.split(/\r\n|\n|\r/g),o="",f=(Math.log10(n+1)|0)+1;for(let t=n-1;t<=n+1;t++){let u=l[t-1];u&&(o+=t.toString().padEnd(f," "),o+=": ",o+=u,o+=`
54
- `,t===n&&(o+=" ".repeat(f+i+2),o+=`^
55
- `))}return o}class c extends Error{line;column;codeblock;constructor(n,i){const[l,o]=S(i.toml,i.ptr),f=P(i.toml,l,o);super(`Invalid TOML document: ${n}
53
+ */function T(e,i){let r=e.slice(0,i).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function E(e,i,r){let t=e.split(/\r\n|\n|\r/g),l="",n=(Math.log10(i+1)|0)+1;for(let s=i-1;s<=i+1;s++){let a=t[s-1];a&&(l+=s.toString().padEnd(n," "),l+=": ",l+=a,l+=`
54
+ `,s===i&&(l+=" ".repeat(n+r+2),l+=`^
55
+ `))}return l}class f extends Error{line;column;codeblock;constructor(i,r){const[t,l]=T(r.toml,r.ptr),n=E(r.toml,t,l);super(`Invalid TOML document: ${i}
56
56
 
57
- ${f}`,i),this.line=l,this.column=o,this.codeblock=f}}let v=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,A=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,D=/^[+-]?0[0-9_]/;function T(e,n){let i=e[n++],l=i,o=i==="'",f=i===e[n]&&i===e[n+1];f&&(e[n+=2]===`
58
- `?n++:e[n]==="\r"&&e[n+1]===`
59
- `&&(n+=2));let t="",u=n,a=0;for(let r=n;r<e.length;r++)if(i=e[r],f&&(i===`
60
- `||i==="\r"&&e[r+1]===`
61
- `))a=a&&3;else{if(i<" "&&i!==" "||i==="")throw new c("control characters are not allowed in strings",{toml:e,ptr:r});if((!a||a===3)&&i===l&&(!f||e[r+1]===l&&e[r+2]===l))return f&&(e[r+3]===l&&r++,e[r+3]===l&&r++),[a?t:t+e.slice(u,r),r+(f?3:1)];if(!a)!o&&i==="\\"&&(t+=e.slice(u,u=r),a=1);else if(a===1)if(i==="x"||i==="u"||i==="U"){let d=0,y=i==="x"?2:i==="u"?4:8;for(let b=0;b<y;b++,r++){let s=e.charCodeAt(r+1),h=s>=48&&s<=57?s-48:s>=65&&s<=70?s-65+10:s>=97&&s<=102?s-97+10:-1;if(h<0)throw new c("invalid non-hex character in unicode escape",{toml:e,ptr:r+1});d=d<<4|h}if(d<0||d>1114111||d>=55296&&d<=57343)throw new c("invalid unicode escape",{toml:e,ptr:r});t+=String.fromCodePoint(d),u=r+1,a=0}else if(i===" "||i===" ")a=2;else{if(i==="b")t+="\b";else if(i==="t")t+=" ";else if(i==="n")t+=`
62
- `;else if(i==="f")t+="\f";else if(i==="r")t+="\r";else if(i==="e")t+="\x1B";else if(i==='"')t+='"';else if(i==="\\")t+="\\";else throw new c("unrecognized escape sequence",{toml:e,ptr:r});u=r+1,a=0}else if(i!==" "&&i!==" "){if(a===2)throw new c("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:u});a=!o&&i==="\\"?1:0,u=r}}throw new c("unfinished string",{toml:e,ptr:n})}function L(e,n,i,l){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return l?0n:0;let o=v.test(e);if(o||A.test(e)){if(D.test(e))throw new c("leading zeroes are not allowed",{toml:n,ptr:i});e=e.replace(/_/g,"");let t=+e;if(isNaN(t))throw new c("invalid number",{toml:n,ptr:i});if(o){if((o=!Number.isSafeInteger(t))&&!l)throw new c("integer value cannot be represented losslessly",{toml:n,ptr:i});(o||l===!0)&&(t=BigInt(e))}return t}const f=new m(e);if(!f.isValid())throw new c("invalid value",{toml:n,ptr:i});return f}function k(e,n=0,i=e.length){let l=e.indexOf(`
63
- `,n);return e[l-1]==="\r"&&l--,l<=i?l:-1}function g(e,n){for(let i=n;i<e.length;i++){let l=e[i];if(l===`
64
- `)return i;if(l==="\r"&&e[i+1]===`
65
- `)return i+1;if(l<" "&&l!==" "||l==="")throw new c("control characters are not allowed in comments",{toml:e,ptr:n})}return e.length}function w(e,n,i,l){let o;for(;;){for(;(o=e[n])===" "||o===" "||!i&&(o===`
66
- `||o==="\r"&&e[n+1]===`
67
- `);)n++;if(l||o!=="#")break;n=g(e,n)}return n}function I(e,n,i,l,o=!1){if(!l)return n=k(e,n),n<0?e.length:n;for(let f=n;f<e.length;f++){let t=e[f];if(t==="#"){if(f=k(e,f),f<0)break}else{if(t===i)return f+1;if(t===l||o&&(t===`
68
- `||t==="\r"&&e[f+1]===`
69
- `))return f}}throw new c("cannot find end of structure",{toml:e,ptr:n})}function N(e,n,i){let l=e.slice(n,i),o=l.indexOf("#");return o>-1&&(g(e,o),l=l.slice(0,o)),[l.trimEnd(),o]}function O(e,n,i,l,o){if(l===0)throw new c("document contains excessively nested structures. aborting.",{toml:e,ptr:n});let f=e[n];if(f==="["||f==="{"){let[a,r]=f==="["?$(e,n,l,o):Z(e,n,l,o);if(i){if(r=w(e,r),e[r]===",")r++;else if(e[r]!==i)throw new c("expected comma or end of structure",{toml:e,ptr:r})}return[a,r]}if(f==='"'||f==="'"){let[a,r]=T(e,n);if(i){if(r=w(e,r),e[r]&&e[r]!==","&&e[r]!==i&&e[r]!==`
70
- `&&e[r]!=="\r")throw new c("unexpected character encountered",{toml:e,ptr:r});e[r]===","&&r++}return[a,r]}let t=I(e,n,",",i),u=N(e,n,t-(e[t-1]===","?1:0));if(!u[0])throw new c("incomplete key-value declaration: no value specified",{toml:e,ptr:n});return i&&u[1]>-1&&(t=w(e,n+u[1]),e[t]===","&&t++),[L(u[0],e,n,o),t]}let j=/^[a-zA-Z0-9-_]+[ \t]*$/;function x(e,n,i="="){let l=n-1,o=[],f=e.indexOf(i,n);if(f<0)throw new c("incomplete key-value: cannot find end of key",{toml:e,ptr:n});do{let t=e[n=++l];if(t!==" "&&t!==" ")if(t==='"'||t==="'"){if(t===e[n+1]&&t===e[n+2])throw new c("multiline strings are not allowed in keys",{toml:e,ptr:n});let[u,a]=T(e,n);l=e.indexOf(".",a);let r=e.slice(a,l<0||l>f?f:l),d=k(r);if(d>-1)throw new c("newlines are not allowed in keys",{toml:e,ptr:n+l+d});if(r.trimStart())throw new c("found extra tokens after the string part",{toml:e,ptr:a});if(f<a&&(f=e.indexOf(i,a),f<0))throw new c("incomplete key-value: cannot find end of key",{toml:e,ptr:n});o.push(u)}else{l=e.indexOf(".",n);let u=e.slice(n,l<0||l>f?f:l);if(!j.test(u))throw new c("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:n});o.push(u.trimEnd())}}while(l+1&&l<f);return[o,w(e,f+1,!0,!0)]}function Z(e,n,i,l){let o={},f=new Set,t;for(n++;(t=e[n++])!=="}"&&t;){if(t===",")throw new c("expected value, found comma",{toml:e,ptr:n-1});if(t==="#")n=g(e,n);else if(t!==" "&&t!==" "&&t!==`
71
- `&&t!=="\r"){let u,a=o,r=!1,[d,y]=x(e,n-1);for(let h=0;h<d.length;h++){if(h&&(a=r?a[u]:a[u]={}),u=d[h],(r=Object.hasOwn(a,u))&&(typeof a[u]!="object"||f.has(a[u])))throw new c("trying to redefine an already defined value",{toml:e,ptr:n});!r&&u==="__proto__"&&Object.defineProperty(a,u,{enumerable:!0,configurable:!0,writable:!0})}if(r)throw new c("trying to redefine an already defined value",{toml:e,ptr:n});let[b,s]=O(e,y,"}",i-1,l);f.add(b),a[u]=b,n=s}}if(!t)throw new c("unfinished table encountered",{toml:e,ptr:n});return[o,n]}function $(e,n,i,l){let o=[],f;for(n++;(f=e[n++])!=="]"&&f;){if(f===",")throw new c("expected value, found comma",{toml:e,ptr:n-1});if(f==="#")n=g(e,n);else if(f!==" "&&f!==" "&&f!==`
72
- `&&f!=="\r"){let t=O(e,n-1,"]",i-1,l);o.push(t[0]),n=t[1]}}if(!f)throw new c("unfinished array encountered",{toml:e,ptr:n});return[o,n]}function E(e,n,i,l){let o=n,f=i,t,u=!1,a;for(let r=0;r<e.length;r++){if(r){if(o=u?o[t]:o[t]={},f=(a=f[t]).c,l===0&&(a.t===1||a.t===2))return null;if(a.t===2){let d=o.length-1;o=o[d],f=f[d].c}}if(t=e[r],(u=Object.hasOwn(o,t))&&f[t]?.t===0&&f[t]?.d)return null;u||(t==="__proto__"&&(Object.defineProperty(o,t,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(f,t,{enumerable:!0,configurable:!0,writable:!0})),f[t]={t:r<e.length-1&&l===2?3:l,d:!1,i:0,c:{}})}if(a=f[t],a.t!==l&&!(l===1&&a.t===3)||(l===2&&(a.d||(a.d=!0,o[t]=[]),o[t].push(o={}),a.c[a.i++]=a={t:1,d:!1,i:0,c:{}}),a.d))return null;if(a.d=!0,l===1)o=u?o[t]:o[t]={};else if(l===0&&u)return null;return[t,o,a.c]}function C(e,{maxDepth:n=1e3,integersAsBigInt:i}={}){let l={},o={},f=l,t=o;for(let u=w(e,0);u<e.length;){if(e[u]==="["){let a=e[++u]==="[",r=x(e,u+=+a,"]");if(a){if(e[r[1]-1]!=="]")throw new c("expected end of table declaration",{toml:e,ptr:r[1]-1});r[1]++}let d=E(r[0],l,o,a?2:1);if(!d)throw new c("trying to redefine an already defined table or value",{toml:e,ptr:u});t=d[2],f=d[1],u=r[1]}else{let a=x(e,u),r=E(a[0],f,t,0);if(!r)throw new c("trying to redefine an already defined table or value",{toml:e,ptr:u});let d=O(e,a[1],void 0,n,i);r[1][r[0]]=d[0],u=d[1]}if(u=w(e,u,!0),e[u]&&e[u]!==`
73
- `&&e[u]!=="\r")throw new c("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:u});u=w(e,u)}return l}export{m as TomlDate,c as TomlError,C as parse};
57
+ ${n}`,r),this.line=t,this.column=l,this.codeblock=n}}function k(e,i=0){let r=e.indexOf(`
58
+ `,i);return e.charCodeAt(r-1)===13&&r--,r}function C(e){for(;e.p<e.s.length;e.p++){let i=e.s.charCodeAt(e.p);if(i===10)break;if(i===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}if(i<32&&i!==9||i===127)throw new f("control characters are not allowed in comments",{toml:e.s,ptr:e.p})}}function w(e,i,r){let t;for(;;){for(;(t=e.s.charCodeAt(e.p))===32||t===9||!i&&(t===10||t===13&&e.s.charCodeAt(e.p+1)===10);)e.p++;if(r||t!==35)break;C(e)}}function _(e,i,r){let t=e.p;if(!r){t=k(e.s,t),e.p=t<0?e.s.length:t;return}for(;e.p<e.s.length;e.p++){let l=e.s.charCodeAt(e.p);if(l===35)C(e);else if(l===r||l===i)return}throw new f("cannot find end of structure",{toml:e.s,ptr:t})}let S=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,D=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,L=/^[+-]?0[0-9_]/;function y(e){let i=e.p,r=e.s.charCodeAt(e.p++),t=r,l=r===39,n=r===e.s.charCodeAt(e.p)&&r===e.s.charCodeAt(e.p+1);n&&((r=e.s.charCodeAt(e.p+=2))===10?e.p++:r===13&&e.s.charCodeAt(e.p+1)===10&&(e.p+=2));let s="",a=e.p,o=0;for(;e.p<e.s.length;e.p++)if(r=e.s.charCodeAt(e.p),n&&(r===10||r===13&&e.s.charCodeAt(e.p+1)===10))o=o&&3;else{if(r<32&&r!==9||r===127)throw new f("control characters are not allowed in strings",{toml:e.s,ptr:e.p});if((!o||o===3)&&r===t&&(!n||e.s.charCodeAt(e.p+1)===t&&e.s.charCodeAt(e.p+2)===t))return n&&(e.s.charCodeAt(e.p+3)===t&&e.p++,e.s.charCodeAt(e.p+3)===t&&e.p++),o||(s+=e.s.slice(a,e.p)),e.p+=n?3:1,s;if(!o)!l&&r===92&&(s+=e.s.slice(a,a=e.p),o=1);else if(o===1)if(r===120||r===117||r===85){let p=0,d=r===120?2:r===117?4:8;for(let u=0;u<d;u++,e.p++){let h=e.s.charCodeAt(e.p+1),g=h>=48&&h<=57?h-48:h>=65&&h<=70?h-65+10:h>=97&&h<=102?h-97+10:-1;if(g<0)throw new f("invalid non-hex character in unicode escape",{toml:e.s,ptr:e.p+1});p=p<<4|g}if(p<0||p>1114111||p>=55296&&p<=57343)throw new f("invalid unicode escape",{toml:e.s,ptr:e.p});s+=String.fromCodePoint(p),a=e.p+1,o=0}else if(r===32||r===9)o=2;else{if(r===98)s+="\b";else if(r===116)s+=" ";else if(r===110)s+=`
59
+ `;else if(r===102)s+="\f";else if(r===114)s+="\r";else if(r===101)s+="\x1B";else if(r===34)s+='"';else if(r===92)s+="\\";else throw new f("unrecognized escape sequence",{toml:e.s,ptr:e.p});a=e.p+1,o=0}else if(r!==32&&r!==9){if(o===2)throw new f("invalid escape: only line-ending whitespace may be escaped",{toml:e.s,ptr:a});o=!l&&r===92?1:0,a=e.p}}throw new f("unfinished string",{toml:e.s,ptr:i})}function I(e,i,r){let t=e.s.slice(i,r),l=t.indexOf("#");return l>0&&(C({s:t,p:l}),t=t.slice(0,l)),t.trimEnd()}function N(e,i,r){let t=e.p,l={toml:e.s,ptr:t};_(e,44,r);let n=I(e,t,e.p);if(!n)throw new f("incomplete declaration: value expected",l);if(n==="-inf")return-1/0;if(n==="inf"||n==="+inf")return 1/0;if(n==="nan"||n==="+nan"||n==="-nan")return NaN;if(n==="-0")return i?0n:0;let s=S.test(n);if(s||D.test(n)){if(L.test(n))throw new f("leading zeroes are not allowed",l);n=n.replace(/_/g,"");let o=+n;if(isNaN(o))throw new f("invalid number",l);if(s){if((s=!Number.isSafeInteger(o))&&!i)throw new f("integer value cannot be represented losslessly",l);(s||i===!0)&&(o=BigInt(n))}return o}const a=new m(n);if(!a.isValid())throw new f("invalid value",l);return a}function b(e,i,r){let t=e.p,l=e.s.charCodeAt(t);if(l===91||l===123){if(!e.d--)throw new f("document contains excessively nested structures. aborting.",{toml:e.s,ptr:t});let n=l===91?P(e,r):j(e,r);return e.d++,n}if(l===34||l===39)return y(e);if(l===116){if(e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)throw new f("invalid value",{toml:e.s,ptr:t});return e.p++,!0}if(l===102){if(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)throw new f("invalid value",{toml:e.s,ptr:t});return e.p++,!1}return N(e,r,i)}let c=/^[a-zA-Z0-9-_]+[ \t]*$/;function A(e,i="="){let r=e.p,t=r-1,l=[],n=e.s.indexOf(i,r);if(n<0)throw new f("incomplete key-value: cannot find end of key",{toml:e.s,ptr:r});do{let s=e.s.charCodeAt(e.p=++t);if(s!==32&&s!==9)if(s===34||s===39){if(s===e.s.charCodeAt(e.p+1)&&s===e.s.charCodeAt(e.p+2))throw new f("multiline strings are not allowed in keys",{toml:e.s,ptr:e.p});let a=y(e);t=e.s.indexOf(".",e.p);let o=e.s.slice(e.p,t<0||t>n?n:t),p=k(o);if(p>-1)throw new f("newlines are not allowed in keys",{toml:e.s,ptr:p});if(o.trimStart())throw new f("found extra tokens after the string part",{toml:e.s,ptr:e.p});if(n<e.p&&(n=e.s.indexOf(i,e.p),n<0))throw new f("incomplete key-value: cannot find end of key",{toml:e.s,ptr:r});l.push(a)}else{t=e.s.indexOf(".",e.p);let a=e.s.slice(e.p,t<0||t>n?n:t);if(!c.test(a))throw new f("only letter, numbers, dashes and underscores are allowed in keys",{toml:e.s,ptr:e.p});l.push(a.trimEnd())}}while(t+1&&t<n);return e.p=n+1,w(e,!0,!0),l}function j(e,i){let r={},t=new Set,l;for(e.p++;e.p<e.s.length;){if(w(e),(l=e.s.charCodeAt(e.p))===125)return e.p++,r;let n,s=r,a=!1,o=e.p,p=A(e);for(let u=0;u<p.length;u++){if(u&&(s=a?s[n]:s[n]={}),n=p[u],(a=Object.hasOwn(s,n))&&(typeof s[n]!="object"||t.has(s[n])))throw new f("trying to redefine an already defined value",{toml:e.s,ptr:o});!a&&n==="__proto__"&&Object.defineProperty(s,n,{enumerable:!0,configurable:!0,writable:!0})}if(a)throw new f("trying to redefine an already defined value",{toml:e.s,ptr:e.p});let d=b(e,125,i);if(t.add(s[n]=d),w(e),(l=e.s.charCodeAt(e.p++))===125)return r;if(l!==44)throw new f("expected comma or end of structure",{toml:e.s,ptr:e.p-1})}throw new f("unfinished table encountered",{toml:e.s,ptr:e.p})}function P(e,i){let r=[],t;for(e.p++;e.p<e.s.length;){if(w(e),(t=e.s.charCodeAt(e.p))===93)return e.p++,r;if(r.push(b(e,93,i)),w(e),(t=e.s.charCodeAt(e.p++))===93)return r;if(t!==44)throw new f("expected comma or end of structure",{toml:e.s,ptr:e.p-1})}throw new f("unfinished array encountered",{toml:e.s,ptr:e.p})}function v(e,i,r,t){let l=i,n=r,s,a=!1,o;for(let p=0;p<e.length;p++){if(p){if(l=a?l[s]:l[s]={},n=(o=n[s]).c,t===0&&(o.t===1||o.t===2))return null;if(o.t===2){let d=l.length-1;l=l[d],n=n[d].c}}if(s=e[p],(a=Object.hasOwn(l,s))&&n[s]?.t===0&&n[s]?.d)return null;a||(s==="__proto__"&&(Object.defineProperty(l,s,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(n,s,{enumerable:!0,configurable:!0,writable:!0})),n[s]={t:p<e.length-1&&t===2?3:t,d:!1,i:0,c:{}})}if(o=n[s],o.t!==t&&!(t===1&&o.t===3)||(t===2&&(o.d||(o.d=!0,l[s]=[]),l[s].push(l={}),o.c[o.i++]=o={t:1,d:!1,i:0,c:{}}),o.d))return null;if(o.d=!0,t===1)l=a?l[s]:l[s]={};else if(t===0&&a)return null;return[s,l,o.c]}function Z(e,{maxDepth:i=1e3,integersAsBigInt:r}={}){let t={s:e,p:0,d:i},l={},n={},s,a=l,o=n;for(w(t);t.p<e.length;){if(e.charCodeAt(t.p)===91){let p=e.charCodeAt(++t.p)===91;s=t.p+=+p;let d=A(t,"]");if(p){if(e.charCodeAt(t.p-1)!==93)throw new f("expected end of table declaration",{toml:e,ptr:t.p-1});t.p++}let u=v(d,l,n,p?2:1);if(!u)throw new f("trying to redefine an already defined table or value",{toml:e,ptr:s});o=u[2],a=u[1]}else{s=t.p;let p=A(t),d=v(p,a,o,0);if(!d)throw new f("trying to redefine an already defined table or value",{toml:e,ptr:s});d[1][d[0]]=b(t,void 0,r)}if(w(t,!0),t.p<e.length&&(s=e.charCodeAt(t.p))!==10&&s!==13)throw new f("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:t.p});w(t)}return l}export{m as TomlDate,f as TomlError,Z as parse};