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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/config/index.d.ts +31 -6
  5. package/dist/packem_chunks/bin.js +274 -274
  6. package/dist/packem_chunks/bloom-sync.js +1 -1
  7. package/dist/packem_chunks/fix.js +1 -1
  8. package/dist/packem_chunks/handler11.js +1 -1
  9. package/dist/packem_chunks/handler13.js +1 -1
  10. package/dist/packem_chunks/handler14.js +1 -1
  11. package/dist/packem_chunks/handler16.js +1 -1
  12. package/dist/packem_chunks/handler20.js +1 -1
  13. package/dist/packem_chunks/handler21.js +1 -1
  14. package/dist/packem_chunks/handler22.js +2 -2
  15. package/dist/packem_chunks/handler23.js +1 -1
  16. package/dist/packem_chunks/handler27.js +1 -1
  17. package/dist/packem_chunks/handler29.js +1 -1
  18. package/dist/packem_chunks/handler3.js +1 -1
  19. package/dist/packem_chunks/handler30.js +1 -1
  20. package/dist/packem_chunks/handler33.js +1 -1
  21. package/dist/packem_chunks/handler34.js +4 -4
  22. package/dist/packem_chunks/handler35.js +1 -1
  23. package/dist/packem_chunks/handler36.js +3 -3
  24. package/dist/packem_chunks/handler37.js +1 -1
  25. package/dist/packem_chunks/handler38.js +4 -4
  26. package/dist/packem_chunks/handler39.js +2 -2
  27. package/dist/packem_chunks/handler4.js +1 -1
  28. package/dist/packem_chunks/handler40.js +1 -1
  29. package/dist/packem_chunks/handler41.js +7 -7
  30. package/dist/packem_chunks/handler42.js +25 -153
  31. package/dist/packem_chunks/handler43.js +153 -25
  32. package/dist/packem_chunks/handler44.js +5 -5
  33. package/dist/packem_chunks/handler45.js +1 -1
  34. package/dist/packem_chunks/handler47.js +1 -1
  35. package/dist/packem_chunks/handler48.js +1 -1
  36. package/dist/packem_chunks/handler49.js +1 -1
  37. package/dist/packem_chunks/handler5.js +1 -1
  38. package/dist/packem_chunks/handler50.js +10 -10
  39. package/dist/packem_chunks/handler51.js +64 -64
  40. package/dist/packem_chunks/handler7.js +1 -1
  41. package/dist/packem_chunks/heal.js +1 -1
  42. package/dist/packem_chunks/help-command.js +1 -1
  43. package/dist/packem_chunks/index.js +1 -1
  44. package/dist/packem_chunks/keys-refresh.js +1 -1
  45. package/dist/packem_chunks/list.js +1 -1
  46. package/dist/packem_chunks/run.js +1 -1
  47. package/dist/packem_chunks/sync.js +1 -1
  48. package/dist/packem_chunks/sync2.js +1 -1
  49. package/dist/packem_chunks/verify-lockfile.js +1 -1
  50. package/dist/packem_shared/{ai-analysis-KP8b5lc0.js → ai-analysis-3QD_RS6F.js} +1 -1
  51. package/dist/packem_shared/{ai-fix-BkPUHA0z.js → ai-fix-TsjDQz_0.js} +3 -3
  52. package/dist/packem_shared/{cyclonedx-BilSFCNY.js → cyclonedx-zf9R2jCs.js} +1 -1
  53. package/dist/packem_shared/{dependency-scan-BUbOcMwX.js → dependency-scan-B70azq4x.js} +1 -1
  54. package/dist/packem_shared/{failure-log-34Wl3npC.js → failure-log-Dxafk3t4.js} +2 -2
  55. package/dist/packem_shared/index-BpbjpCNL.js +1 -0
  56. package/dist/packem_shared/{index-ClJtJDdT.js → index-Dc3ht2bL.js} +1 -1
  57. package/dist/packem_shared/{lifecycle-Buigdp7P.js → lifecycle-DvVTL8nx.js} +2 -2
  58. package/dist/packem_shared/{lockfile-CrT86D6d.js → lockfile-CedmXr44.js} +1 -1
  59. package/dist/packem_shared/{min-release-age-BPVXwPUg.js → min-release-age-DKMW2N_v.js} +1 -1
  60. package/dist/packem_shared/missing-package-json-DKAwoiWK.js +1 -0
  61. package/dist/packem_shared/{native-config-sync-BRZZetn3.js → native-config-sync-DBkJ-hsF.js} +1 -1
  62. package/dist/packem_shared/{provenance-D8vU1u2L.js → provenance-Cu6VR1Hy.js} +1 -1
  63. package/dist/packem_shared/{registry-keys-E3cZn4FI.js → registry-keys-CuBAVdsk.js} +1 -1
  64. package/dist/packem_shared/{resolve-explicit-cPzwdiEE.js → resolve-explicit-Xue0oq8V.js} +1 -1
  65. package/dist/packem_shared/{s1ngularity-DBcjspCC.js → s1ngularity-adnHbyTd.js} +1 -1
  66. package/dist/packem_shared/{scan-progress-CTVVf9WW.js → scan-progress-lZdk5KJ-.js} +1 -1
  67. package/dist/packem_shared/{signatures-ChTfrQvT.js → signatures-FGbYV5QE.js} +1 -1
  68. package/dist/packem_shared/{spinner-C8xs6QZv.js → spinner-0acw5pd_.js} +1 -1
  69. package/dist/packem_shared/{tabs-xZkm6Y_J.js → tabs-zUSdR1HI.js} +1 -1
  70. package/dist/packem_shared/{use-measured-height-Lea6TCVD.js → use-measured-height-DyCBfLtu.js} +1 -1
  71. package/dist/packem_shared/{verify-cLcZwKqe.js → verify-BYzxSKWD.js} +1 -1
  72. package/dist/packem_shared/{vis-update-app-BCKzlqj8.js → vis-update-app-D0QyGneK.js} +1 -1
  73. package/dist/packem_shared/{watch-loop-BpA_pxU9.js → watch-loop-jmQQl2Qe.js} +2 -2
  74. package/index.js +52 -52
  75. package/package.json +10 -10
  76. package/schemas/vis-config.schema.json +34 -7
  77. package/dist/packem_shared/index-BnANMQ7k.js +0 -1
@@ -1,66 +1,66 @@
1
- var ai=Object.defineProperty;var v=(t,e)=>ai(t,"name",{value:e,configurable:!0});import{createRequire as ci}from"node:module";import{M as he,K as di,Q as ui,B as fi}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{bR as Gs,w as K,a5 as a,a6 as $,n as d,bS as hi,d as $e,R as te,aG as qs,aI as pi,aF as gi,af as os,aJ as mi,aK as vi,k as wi,O as Bt,P as or,bT as yi,bU as $i,E as Ot,bV as xi,M as ki,C as bi,S as ji,bW as Si,bX as Ti,s as pt,bY as Ci,aM as Ii,bZ as Ri,b_ as Ei,b$ as Oi,c0 as Mi,W as Pi,c1 as Fi}from"./bin.js";import{buildEnhancedPath as Ai,runConcurrently as Mt,TerminalBuffer as ar,readLastRunSummary as Li,getLastRunSummaryPath as Di,enforceProjectConstraints as Bi,expandTokensInString as as,parsePartition as Ni,TaskScheduler as _i,createTaskGraph as Gi,reverseTaskGraph as qi,generateRunSummary as cs,writeChromeTrace as Ui,resolveTurboEnvCompat as Wi,CompositeLifeCycle as ls,defaultTaskRunner as ds,createLogReporter as Hi,writeRunSummary as zi}from"@visulima/task-runner";import{d as Vi,r as Ki}from"../packem_shared/lockfile-Cu2BH6bl.js";import{F as to}from"../packem_shared/failure-log-34Wl3npC.js";import{r as ro}from"../packem_shared/toolchain-DoG6b_G_.js";import{i as so,a as no,b as io,s as oo,d as ao,c as co,r as lo,H as uo,f as fo,e as ho}from"../packem_shared/lifecycle-Buigdp7P.js";import{p as po,r as go,f as mo}from"../packem_shared/selectors-DkgYFzdq.js";import{T as Ws,C as lr,D as Nt,E as Hs}from"../packem_shared/symbols-CQmER5MT.js";import{q as xo,j as ko,T as Vt,E as hs}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{n as zs}from"../packem_shared/spinner-C8xs6QZv.js";import{c as ps,a as Co,s as gs}from"../packem_shared/watch-DEL0yol9.js";import{E as Vs}from"./config.js";const li=ci(import.meta.url),ht=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=v(t=>{if(typeof ht<"u"&&ht.versions&&ht.versions.node){const[e,r]=ht.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ht.getBuiltinModule(t)}return li(t)},"__cjs_getBuiltinModule"),{readFileSync:at,existsSync:Ze,writeFileSync:cr,mkdirSync:Yi,openSync:Ji,statSync:us,readSync:Xi,closeSync:Qi,mkdtempSync:Zi}=_e("node:fs"),{createInterface:Us,emitKeypressEvents:eo}=_e("node:readline"),{isAbsolute:vo,resolve:fs,dirname:wo,relative:yo}=_e("node:path"),{fileURLToPath:$o}=_e("node:url"),{createRequire:bo}=_e("node:module"),{createHash:jo}=_e("node:crypto"),{appendFile:dr}=_e("node:fs/promises"),{platform:So,homedir:ur,tmpdir:To}=_e("node:os"),{spawn:Io}=_e("node:child_process");var Ro=Object.defineProperty,Eo=v((t,e)=>Ro(t,"name",{value:e,configurable:!0}),"u$5"),Oo=Object.defineProperty,Mo=Eo((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"v"),Po=Object.defineProperty,Fo=Mo((t,e)=>Po(t,"name",{value:e,configurable:!0}),"D");const Ao=Fo((t,e,r,s,i,o,n,c,u,h,f,p,l,g)=>{const y={d:s,h:i,m:o,mo:e,ms:c,s:n,w:r,y:t};return u!==void 0&&(y.future=u),h!==void 0&&(y.past=h),f!==void 0&&(y.decimal=f),p!==void 0&&(y.unitMap=p),l!==void 0&&(y.groupSeparator=l),g!==void 0&&(y.placeholderSeparator=g),y},"createDurationLanguage"),Lo={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"},Do=Ao(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",Lo,",","_");var Bo=Object.defineProperty,No=v((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"o$4"),_o=Object.defineProperty,Go=No((t,e)=>_o(t,"name",{value:e,configurable:!0}),"o"),qo=Object.defineProperty,Uo=Go((t,e)=>qo(t,"name",{value:e,configurable:!0}),"o");const Wo=Uo(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(t,s))throw new TypeError(`Missing required property: ${s}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const s of r)if(typeof t[s]!="string"&&typeof t[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var Ho=Object.defineProperty,zo=v((t,e)=>Ho(t,"name",{value:e,configurable:!0}),"b$5"),Vo=Object.defineProperty,Ko=zo((t,e)=>Vo(t,"name",{value:e,configurable:!0}),"b"),Yo=Object.defineProperty,$t=Ko((t,e)=>Yo(t,"name",{value:e,configurable:!0}),"g");const Ks=$t((t,e)=>{e=e||-1;const r=new RegExp(String.raw`^-?\d+(?:\.\d{0,${String(e)}})?`).exec(t.toString());return r===null?t:Number.parseFloat(r[0])},"toFixed"),ms=$t(({unitCount:t,unitName:e},r,s)=>{let{spacer:i}=s;const{maxDecimalPoints:o}=s;let n=".";s.decimal!==void 0?n=s.decimal:r.decimal!==void 0&&(n=r.decimal);let c;"digitReplacements"in s?c=s.digitReplacements:"_digitReplacements"in r&&(c=r._digitReplacements);let u,h=t;o!==void 0&&(h=Ks(t,o));const f=h.toString();if(!r._hideCountIf2||t!==2)if(c){u="";for(const g of f)u+=g==="."?n:c[g]}else u=f.replace(".",n);else u="";const p=r[e];let l=p;return typeof p=="function"&&(l=p(t)),r._hideCountIf2&&t===2&&(i=""),r._numberFirst?l+i+u:u+i+l},"renderPiece"),Jo=$t((t,e)=>{const{units:r}=e;if(r.length===0)return[];const{unitMeasures:s}=e,i=e.largest??Number.POSITIVE_INFINITY,o={};let n,c,u,h=t;for(c=0;c<r.length;c++){n=r[c];const p=s[n];u=c===r.length-1?h/p:Math.floor(h/p),o[n]=u,h-=u*p}if(e.round){let p=i;for(c=0;c<r.length;c++)if(n=r[c],u=o[n],u!==0&&(p--,p===0)){for(let l=c+1;l<r.length;l++){const g=r[l],y=o[g];o[n]=(o[n]??0)+y*s[g]/s[n],o[g]=0}break}for(c=r.length-1;c>=0;c--){if(n=r[c],u=o[n],u===0)continue;const l=Math.round(u);if(o[n]=l,c===0)break;const g=r[c-1],y=s[g],I=Math.floor(l*s[n]/y);if(I)o[g]=(o[g]??0)+I,o[n]=0;else break}}const f=[];for(c=0;c<r.length&&f.length<i;c++){if(n=r[c],u=o[n],u&&!e.round&&f.length===i-1){let p,l=0;for(p=c+1,r.length;p<r.length;p++){const g=r[p];l+=o[g]*(e.unitMeasures[g]/e.unitMeasures[n])}u+=l,e.maxDecimalPoints!==void 0&&(u=Ks(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:n})}return f},"getPieces"),Xo=$t((t,e,r)=>{const{language:s,units:i}=e;if(t.length===0){const p=i.at(-1);return ms({unitCount:0,unitName:p},s,e)}const{conjunction:o,serialComma:n}=e;let c=", ";e.delimiter!==void 0?c=e.delimiter:s.delimiter!==void 0&&(c=s.delimiter);let u="";e.timeAdverb&&r!==0&&(u=s.future??"",r<0&&(u=s.past??""));const h=t.map(p=>ms(p,s,e));let f;return!o||t.length===1?f=h.join(c):t.length===2?f=h.join(o):f=h.slice(0,-1).join(c)+(n?",":"")+o+(h.at(-1)??""),u&&(f=u.replace("%s",f)),f},"formatPieces"),Ys=$t((t,e)=>{if(Number.isNaN(t))throw new TypeError("Expected a valid number");if(typeof t!="number")throw new TypeError("Expected a number for milliseconds input");const r={conjunction:"",language:Do,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};Wo(r.language);const s=Math.abs(t),i=Jo(s,r);return Xo(i,r,t)},"duration");var Qo=Object.defineProperty,Js=v((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"a$4"),Zo=Object.defineProperty,fr=Js((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"u"),ea=Object.defineProperty,ta=fr((t,e)=>ea(t,"name",{value:e,configurable:!0}),"e");function _t({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")}v(_t,"u$4");Js(_t,"a");fr(_t,"t");ta(_t,"ansiRegex");var ra=Object.defineProperty,sa=fr((t,e)=>ra(t,"name",{value:e,configurable:!0}),"r");const na=_t(),ia=/\]0;[\s\S]*?/g,oa=sa(t=>t.replace(ia,"").replace(na,""),"strip");var aa=Object.defineProperty,De=v((t,e)=>aa(t,"name",{value:e,configurable:!0}),"t$2");const Me="@voidzero-dev/vite-task-client",hr="@visulima/task-runner-client",Pt=`npm:${hr}@^1`,Xs=he(".vis",".vite-client-override-declined"),Ft="pnpm-workspace.yaml",ca=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Qs=De(t=>{try{return JSON.parse(at(t,"utf8"))}catch{return}},"readPackageJson"),la=De(t=>{const e=he(t,Ft);if(Ze(e))try{return Gs(at(e,"utf8")).toJS()?.overrides}catch{return}},"readPnpmWorkspaceOverrides"),da=De(t=>t==="pnpm"||t==="aube"?"pnpm.overrides":t==="yarn"?"resolutions":"overrides","overrideFieldFor"),ua=De(t=>{const e=he(t,Ft);try{const r=Gs(at(e,"utf8"));return r.setIn(["overrides",Me],Pt),cr(e,r.toString()),!0}catch{return!1}},"writeToPnpmWorkspaceYaml"),vs=De(t=>t!==void 0&&ca.some(e=>t[e]?.[Me]!==void 0),"isDependency"),fa=De((t,e)=>t!==void 0&&(t.pnpm?.overrides?.[Me]!==void 0||t.overrides?.[Me]!==void 0||t.resolutions?.[Me]!==void 0)||e?.[Me]!==void 0,"isAlreadyOverridden"),ha=De((t,e=[])=>{const r=Qs(he(t,"package.json")),s=Ze(he(t,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:fa(r,la(t)),declined:Ze(he(t,Xs)),manager:Vi(t)?.manager,present:vs(r)||s||e.some(i=>vs(i))}},"detectViteClientOverride"),pa=De(t=>{try{const e=he(t,Xs);Yi(di(e),{recursive:!0}),cr(e,`Declined adding the ${Me} → ${hr} override.
1
+ var ci=Object.defineProperty;var v=(t,e)=>ci(t,"name",{value:e,configurable:!0});import{createRequire as li}from"node:module";import{M as fe,K as ui,Q as fi,B as hi}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{bR as qs,x as K,a7 as a,a8 as $,n as d,bS as pi,d as ye,R as ee,aH as Us,aJ as gi,aG as mi,ah as as,aK as vi,aL as wi,k as yi,Q as Bt,U as or,bT as $i,bU as xi,F as Mt,bV as ki,O as bi,C as ji,S as Si,bW as Ti,bX as Ci,s as pt,bY as Ii,aN as Ri,bZ as Ei,b_ as Mi,b$ as Oi,c0 as Pi,$ as Fi,c1 as Ai}from"./bin.js";import{buildEnhancedPath as Li,runConcurrently as Ot,TerminalBuffer as ar,readLastRunSummary as Di,getLastRunSummaryPath as Bi,enforceProjectConstraints as Ni,expandTokensInString as cs,parsePartition as _i,TaskScheduler as Gi,createTaskGraph as qi,reverseTaskGraph as Ui,generateRunSummary as ls,writeChromeTrace as Wi,resolveTurboEnvCompat as Hi,CompositeLifeCycle as ds,defaultTaskRunner as us,createLogReporter as zi,writeRunSummary as Vi}from"@visulima/task-runner";import{d as Ki,r as Yi}from"../packem_shared/lockfile-Cu2BH6bl.js";import{F as ro}from"../packem_shared/failure-log-Dxafk3t4.js";import{r as so}from"../packem_shared/toolchain-DoG6b_G_.js";import{i as no,a as io,b as oo,s as ao,d as co,c as lo,r as uo,H as fo,f as ho,e as po}from"../packem_shared/lifecycle-DvVTL8nx.js";import{p as go,r as mo,f as vo}from"../packem_shared/selectors-DkgYFzdq.js";import{T as Hs,C as lr,D as Nt,E as zs}from"../packem_shared/symbols-CQmER5MT.js";import{q as ko,j as bo,T as Vt,E as ps}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{n as Vs}from"../packem_shared/spinner-0acw5pd_.js";import{c as gs,a as Io,s as ms}from"../packem_shared/watch-DEL0yol9.js";import{E as Ks}from"./config.js";const di=li(import.meta.url),ht=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=v(t=>{if(typeof ht<"u"&&ht.versions&&ht.versions.node){const[e,r]=ht.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ht.getBuiltinModule(t)}return di(t)},"__cjs_getBuiltinModule"),{readFileSync:at,existsSync:Ze,writeFileSync:cr,mkdirSync:Ji,openSync:Qi,statSync:fs,readSync:Xi,closeSync:Zi,mkdtempSync:eo}=qe("node:fs"),{createInterface:Ws,emitKeypressEvents:to}=qe("node:readline"),{isAbsolute:wo,resolve:hs,dirname:yo,relative:$o}=qe("node:path"),{fileURLToPath:xo}=qe("node:url"),{createRequire:jo}=qe("node:module"),{createHash:So}=qe("node:crypto"),{appendFile:dr}=qe("node:fs/promises"),{platform:To,homedir:ur,tmpdir:Co}=qe("node:os"),{spawn:Ro}=qe("node:child_process");var Eo=Object.defineProperty,Mo=v((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"u$5"),Oo=Object.defineProperty,Po=Mo((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"v"),Fo=Object.defineProperty,Ao=Po((t,e)=>Fo(t,"name",{value:e,configurable:!0}),"D");const Lo=Ao((t,e,r,s,i,o,n,c,u,h,f,p,l,g)=>{const y={d:s,h:i,m:o,mo:e,ms:c,s:n,w:r,y:t};return u!==void 0&&(y.future=u),h!==void 0&&(y.past=h),f!==void 0&&(y.decimal=f),p!==void 0&&(y.unitMap=p),l!==void 0&&(y.groupSeparator=l),g!==void 0&&(y.placeholderSeparator=g),y},"createDurationLanguage"),Do={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"},Bo=Lo(t=>`year${t===1?"":"s"}`,t=>`month${t===1?"":"s"}`,t=>`week${t===1?"":"s"}`,t=>`day${t===1?"":"s"}`,t=>`hour${t===1?"":"s"}`,t=>`minute${t===1?"":"s"}`,t=>`second${t===1?"":"s"}`,t=>`millisecond${t===1?"":"s"}`,"in %s","%s ago",".",Do,",","_");var No=Object.defineProperty,_o=v((t,e)=>No(t,"name",{value:e,configurable:!0}),"o$4"),Go=Object.defineProperty,qo=_o((t,e)=>Go(t,"name",{value:e,configurable:!0}),"o"),Uo=Object.defineProperty,Wo=qo((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"o");const Ho=Wo(t=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(t,s))throw new TypeError(`Missing required property: ${s}`);if(typeof t.future!="string"||typeof t.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const s of r)if(typeof t[s]!="string"&&typeof t[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(t.decimal&&typeof t.decimal!="string")throw new TypeError("Property decimal must be of type string");if(t.delimiter&&typeof t.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(t._digitReplacements&&!Array.isArray(t._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(t._numberFirst&&typeof t._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(t.unitMap&&typeof t.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(t.unitMap&&Object.values(t.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var zo=Object.defineProperty,Vo=v((t,e)=>zo(t,"name",{value:e,configurable:!0}),"b$5"),Ko=Object.defineProperty,Yo=Vo((t,e)=>Ko(t,"name",{value:e,configurable:!0}),"b"),Jo=Object.defineProperty,$t=Yo((t,e)=>Jo(t,"name",{value:e,configurable:!0}),"g");const Ys=$t((t,e)=>{e=e||-1;const r=new RegExp(String.raw`^-?\d+(?:\.\d{0,${String(e)}})?`).exec(t.toString());return r===null?t:Number.parseFloat(r[0])},"toFixed"),vs=$t(({unitCount:t,unitName:e},r,s)=>{let{spacer:i}=s;const{maxDecimalPoints:o}=s;let n=".";s.decimal!==void 0?n=s.decimal:r.decimal!==void 0&&(n=r.decimal);let c;"digitReplacements"in s?c=s.digitReplacements:"_digitReplacements"in r&&(c=r._digitReplacements);let u,h=t;o!==void 0&&(h=Ys(t,o));const f=h.toString();if(!r._hideCountIf2||t!==2)if(c){u="";for(const g of f)u+=g==="."?n:c[g]}else u=f.replace(".",n);else u="";const p=r[e];let l=p;return typeof p=="function"&&(l=p(t)),r._hideCountIf2&&t===2&&(i=""),r._numberFirst?l+i+u:u+i+l},"renderPiece"),Qo=$t((t,e)=>{const{units:r}=e;if(r.length===0)return[];const{unitMeasures:s}=e,i=e.largest??Number.POSITIVE_INFINITY,o={};let n,c,u,h=t;for(c=0;c<r.length;c++){n=r[c];const p=s[n];u=c===r.length-1?h/p:Math.floor(h/p),o[n]=u,h-=u*p}if(e.round){let p=i;for(c=0;c<r.length;c++)if(n=r[c],u=o[n],u!==0&&(p--,p===0)){for(let l=c+1;l<r.length;l++){const g=r[l],y=o[g];o[n]=(o[n]??0)+y*s[g]/s[n],o[g]=0}break}for(c=r.length-1;c>=0;c--){if(n=r[c],u=o[n],u===0)continue;const l=Math.round(u);if(o[n]=l,c===0)break;const g=r[c-1],y=s[g],R=Math.floor(l*s[n]/y);if(R)o[g]=(o[g]??0)+R,o[n]=0;else break}}const f=[];for(c=0;c<r.length&&f.length<i;c++){if(n=r[c],u=o[n],u&&!e.round&&f.length===i-1){let p,l=0;for(p=c+1,r.length;p<r.length;p++){const g=r[p];l+=o[g]*(e.unitMeasures[g]/e.unitMeasures[n])}u+=l,e.maxDecimalPoints!==void 0&&(u=Ys(u,e.maxDecimalPoints))}u&&f.push({unitCount:u,unitName:n})}return f},"getPieces"),Xo=$t((t,e,r)=>{const{language:s,units:i}=e;if(t.length===0){const p=i.at(-1);return vs({unitCount:0,unitName:p},s,e)}const{conjunction:o,serialComma:n}=e;let c=", ";e.delimiter!==void 0?c=e.delimiter:s.delimiter!==void 0&&(c=s.delimiter);let u="";e.timeAdverb&&r!==0&&(u=s.future??"",r<0&&(u=s.past??""));const h=t.map(p=>vs(p,s,e));let f;return!o||t.length===1?f=h.join(c):t.length===2?f=h.join(o):f=h.slice(0,-1).join(c)+(n?",":"")+o+(h.at(-1)??""),u&&(f=u.replace("%s",f)),f},"formatPieces"),Js=$t((t,e)=>{if(Number.isNaN(t))throw new TypeError("Expected a valid number");if(typeof t!="number")throw new TypeError("Expected a number for milliseconds input");const r={conjunction:"",language:Bo,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};Ho(r.language);const s=Math.abs(t),i=Qo(s,r);return Xo(i,r,t)},"duration");var Zo=Object.defineProperty,Qs=v((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"a$4"),ea=Object.defineProperty,fr=Qs((t,e)=>ea(t,"name",{value:e,configurable:!0}),"u"),ta=Object.defineProperty,ra=fr((t,e)=>ta(t,"name",{value:e,configurable:!0}),"e");function _t({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")}v(_t,"u$4");Qs(_t,"a");fr(_t,"t");ra(_t,"ansiRegex");var sa=Object.defineProperty,na=fr((t,e)=>sa(t,"name",{value:e,configurable:!0}),"r");const ia=_t(),oa=/\]0;[\s\S]*?/g,aa=na(t=>t.replace(oa,"").replace(ia,""),"strip");var ca=Object.defineProperty,Le=v((t,e)=>ca(t,"name",{value:e,configurable:!0}),"t$2");const Oe="@voidzero-dev/vite-task-client",hr="@visulima/task-runner-client",Pt=`npm:${hr}@^1`,Xs=fe(".vis",".vite-client-override-declined"),Ft="pnpm-workspace.yaml",la=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Zs=Le(t=>{try{return JSON.parse(at(t,"utf8"))}catch{return}},"readPackageJson"),da=Le(t=>{const e=fe(t,Ft);if(Ze(e))try{return qs(at(e,"utf8")).toJS()?.overrides}catch{return}},"readPnpmWorkspaceOverrides"),ua=Le(t=>t==="pnpm"||t==="aube"?"pnpm.overrides":t==="yarn"?"resolutions":"overrides","overrideFieldFor"),fa=Le(t=>{const e=fe(t,Ft);try{const r=qs(at(e,"utf8"));return r.setIn(["overrides",Oe],Pt),cr(e,r.toString()),!0}catch{return!1}},"writeToPnpmWorkspaceYaml"),ws=Le(t=>t!==void 0&&la.some(e=>t[e]?.[Oe]!==void 0),"isDependency"),ha=Le((t,e)=>t!==void 0&&(t.pnpm?.overrides?.[Oe]!==void 0||t.overrides?.[Oe]!==void 0||t.resolutions?.[Oe]!==void 0)||e?.[Oe]!==void 0,"isAlreadyOverridden"),pa=Le((t,e=[])=>{const r=Zs(fe(t,"package.json")),s=Ze(fe(t,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:ha(r,da(t)),declined:Ze(fe(t,Xs)),manager:Ki(t)?.manager,present:ws(r)||s||e.some(i=>ws(i))}},"detectViteClientOverride"),ga=Le(t=>{try{const e=fe(t,Xs);Ji(ui(e),{recursive:!0}),cr(e,`Declined adding the ${Oe} → ${hr} override.
2
2
  Delete this file to be asked again.
3
- `)}catch{}},"recordDecline"),ga=De((t,e="npm")=>{const r=`${e} install`;if((e==="pnpm"||e==="aube")&&Ze(he(t,Ft))&&ua(t))return{file:Ft,installCommand:r};const s=he(t,"package.json"),i=Qs(s);if(!i)return;const o=da(e);o==="pnpm.overrides"?(i.pnpm??={},i.pnpm.overrides??={},i.pnpm.overrides[Me]=Pt):(i[o]??={},i[o][Me]=Pt);try{cr(s,`${JSON.stringify(i,void 0,4)}
4
- `)}catch{return}return{file:"package.json",installCommand:r}},"applyViteClientOverride"),ma=De(async(t,e)=>{const r=ha(t,e.projectManifests);if(!r.present||r.alreadyOverridden||r.declined||!e.interactive)return!1;const s=Us({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${Me}. Its cache hints no-op under @visulima/task-runner unless aliased to ${hr} (a drop-in replacement).`);const i=await new Promise(n=>{s.question("Add the override now? [y/N] ",n)});if(!/^y(?:es)?$/i.test(i.trim()))return pa(t),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=ga(t,r.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 "${Me}": "${Pt}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{s.close()}},"maybePromptViteClientOverride");var va=Object.defineProperty,wa=v((t,e)=>va(t,"name",{value:e,configurable:!0}),"t$1");const ya=wa(({interactive:t,taskPty:e,workspacePty:r})=>e===!0?!0:e===!1?!1:t&&r!==!1,"decidePty");var $a=Object.defineProperty,Zs=v((t,e)=>$a(t,"name",{value:e,configurable:!0}),"f$8");const xa=Zs(t=>t.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),ka=Zs((t,e,r)=>{const s=new Set,i=[];if(t===void 0||t.trim()==="")return{skipTaskIds:s,unmatchedPatterns:i};const o=[...r],n=new Set(o),c=new Map;for(const u of o){const h=u.lastIndexOf(":");if(h===-1)continue;const f=u.slice(h+1),p=c.get(f);p===void 0?c.set(f,[u]):p.push(u)}for(const u of xa(t)){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(n.has(u)){s.add(u);continue}const h=po(u);if(!h){i.push(u);continue}let f=!1;switch(h.kind){case"all":{const p=c.get(h.target)??[];for(const l of p)s.add(l),f=!0;break}case"project":{const p=h.projects?.[0];if(p!==void 0){const l=`${p}:${h.target}`;n.has(l)&&(s.add(l),f=!0)}break}case"tag":{const{tag:p}=h;if(p!==void 0){const l=c.get(h.target)??[];for(const g of l){const y=g.slice(0,g.lastIndexOf(":"));e.projects[y]?.tags?.includes(p)===!0&&(s.add(g),f=!0)}}break}}f||i.push(u)}return{skipTaskIds:s,unmatchedPatterns:i}},"resolveSkipCachePatterns");var ba=Object.defineProperty,pr=v((t,e)=>ba(t,"name",{value:e,configurable:!0}),"a$3");const ja=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Sa=new Set(["0","!","#","$","*","-","?","@","_"]),Ta=pr(t=>{const e=new Map;for(const r of t.matchAll(ja)){const s=r[1],i=r[3],o=r[2],n=s??i;if(n===void 0||Sa.has(n))continue;const c=o!==void 0,u=e.get(n);u===void 0?e.set(n,c):u&&!c&&e.set(n,!1)}return[...e.entries()].map(([r,s])=>({hasDefault:s,name:r}))},"extractEnvReferences"),Ca=pr(t=>{const{command:e,processEnv:r,taskEnv:s,taskId:i}=t,o=Ta(e);if(o.length===0)return;const n=[];for(const{hasDefault:c,name:u}of o){if(c)continue;const h=s[u],f=r[u];h===void 0&&f===void 0&&n.push(u)}if(n.length!==0)return{missing:n.toSorted(),taskId:i}},"checkStrictEnv"),Ia=pr(t=>{const e=t.missing.map(r=>`$${r}`).join(", ");return`Strict env: ${t.taskId} references unset variable${t.missing.length===1?"":"s"} ${e}. Set ${t.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var Ra=Object.defineProperty,ze=v((t,e)=>Ra(t,"name",{value:e,configurable:!0}),"i$5");const ws=ze(t=>{const e=new Set;for(const r of Object.values(t.projects))for(const s of Object.keys(r.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Ea=ze(t=>{const e=new Map;for(const r of t.values())for(const[s,i]of Object.entries(r))for(const o of i.aliases??[])e.has(o)||e.set(o,s);return e},"buildAliasMap"),Oa=ze((t,e)=>e.get(t)??t,"resolveTargetAlias"),Ma=ze((t,e)=>{if(t.length===0)return e.length;if(e.length===0)return t.length;const r=[];for(let s=0;s<=e.length;s++)r[s]=[s];for(let s=0;s<=t.length;s++)r[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=t.length;i++){const o=e[s-1]===t[i-1]?0:1;r[s][i]=Math.min(r[s-1][i]+1,r[s][i-1]+1,r[s-1][i-1]+o)}return r[e.length][t.length]},"levenshtein"),Pa=ze((t,e,r=3)=>en(t,e,1,r)[0],"suggestTarget"),en=ze((t,e,r=3,s=3)=>{const i=[];for(const o of e){const n=Ma(t.toLowerCase(),o.toLowerCase());n<=s&&i.push({distance:n,name:o})}return i.sort((o,n)=>o.distance-n.distance||o.name.localeCompare(n.name)),i.slice(0,r).map(o=>o.name)},"suggestTargets"),Fa=ze(t=>t.length===0?" (no targets found)":t.map(e=>` - ${e}`).join(`
5
- `),"formatTargetList"),Aa=ze(async t=>{if(t.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=Us({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
3
+ `)}catch{}},"recordDecline"),ma=Le((t,e="npm")=>{const r=`${e} install`;if((e==="pnpm"||e==="aube")&&Ze(fe(t,Ft))&&fa(t))return{file:Ft,installCommand:r};const s=fe(t,"package.json"),i=Zs(s);if(!i)return;const o=ua(e);o==="pnpm.overrides"?(i.pnpm??={},i.pnpm.overrides??={},i.pnpm.overrides[Oe]=Pt):(i[o]??={},i[o][Oe]=Pt);try{cr(s,`${JSON.stringify(i,void 0,4)}
4
+ `)}catch{return}return{file:"package.json",installCommand:r}},"applyViteClientOverride"),va=Le(async(t,e)=>{const r=pa(t,e.projectManifests);if(!r.present||r.alreadyOverridden||r.declined||!e.interactive)return!1;const s=Ws({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${Oe}. Its cache hints no-op under @visulima/task-runner unless aliased to ${hr} (a drop-in replacement).`);const i=await new Promise(n=>{s.question("Add the override now? [y/N] ",n)});if(!/^y(?:es)?$/i.test(i.trim()))return ga(t),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=ma(t,r.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 "${Oe}": "${Pt}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{s.close()}},"maybePromptViteClientOverride");var wa=Object.defineProperty,ya=v((t,e)=>wa(t,"name",{value:e,configurable:!0}),"t$1");const $a=ya(({interactive:t,taskPty:e,workspacePty:r})=>e===!0?!0:e===!1?!1:t&&r!==!1,"decidePty");var xa=Object.defineProperty,en=v((t,e)=>xa(t,"name",{value:e,configurable:!0}),"f$8");const ka=en(t=>t.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),ba=en((t,e,r)=>{const s=new Set,i=[];if(t===void 0||t.trim()==="")return{skipTaskIds:s,unmatchedPatterns:i};const o=[...r],n=new Set(o),c=new Map;for(const u of o){const h=u.lastIndexOf(":");if(h===-1)continue;const f=u.slice(h+1),p=c.get(f);p===void 0?c.set(f,[u]):p.push(u)}for(const u of ka(t)){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(n.has(u)){s.add(u);continue}const h=go(u);if(!h){i.push(u);continue}let f=!1;switch(h.kind){case"all":{const p=c.get(h.target)??[];for(const l of p)s.add(l),f=!0;break}case"project":{const p=h.projects?.[0];if(p!==void 0){const l=`${p}:${h.target}`;n.has(l)&&(s.add(l),f=!0)}break}case"tag":{const{tag:p}=h;if(p!==void 0){const l=c.get(h.target)??[];for(const g of l){const y=g.slice(0,g.lastIndexOf(":"));e.projects[y]?.tags?.includes(p)===!0&&(s.add(g),f=!0)}}break}}f||i.push(u)}return{skipTaskIds:s,unmatchedPatterns:i}},"resolveSkipCachePatterns");var ja=Object.defineProperty,pr=v((t,e)=>ja(t,"name",{value:e,configurable:!0}),"a$3");const Sa=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Ta=new Set(["0","!","#","$","*","-","?","@","_"]),Ca=pr(t=>{const e=new Map;for(const r of t.matchAll(Sa)){const s=r[1],i=r[3],o=r[2],n=s??i;if(n===void 0||Ta.has(n))continue;const c=o!==void 0,u=e.get(n);u===void 0?e.set(n,c):u&&!c&&e.set(n,!1)}return[...e.entries()].map(([r,s])=>({hasDefault:s,name:r}))},"extractEnvReferences"),Ia=pr(t=>{const{command:e,processEnv:r,taskEnv:s,taskId:i}=t,o=Ca(e);if(o.length===0)return;const n=[];for(const{hasDefault:c,name:u}of o){if(c)continue;const h=s[u],f=r[u];h===void 0&&f===void 0&&n.push(u)}if(n.length!==0)return{missing:n.toSorted(),taskId:i}},"checkStrictEnv"),Ra=pr(t=>{const e=t.missing.map(r=>`$${r}`).join(", ");return`Strict env: ${t.taskId} references unset variable${t.missing.length===1?"":"s"} ${e}. Set ${t.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var Ea=Object.defineProperty,Ve=v((t,e)=>Ea(t,"name",{value:e,configurable:!0}),"i$5");const ys=Ve(t=>{const e=new Set;for(const r of Object.values(t.projects))for(const s of Object.keys(r.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Ma=Ve(t=>{const e=new Map;for(const r of t.values())for(const[s,i]of Object.entries(r))for(const o of i.aliases??[])e.has(o)||e.set(o,s);return e},"buildAliasMap"),Oa=Ve((t,e)=>e.get(t)??t,"resolveTargetAlias"),Pa=Ve((t,e)=>{if(t.length===0)return e.length;if(e.length===0)return t.length;const r=[];for(let s=0;s<=e.length;s++)r[s]=[s];for(let s=0;s<=t.length;s++)r[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=t.length;i++){const o=e[s-1]===t[i-1]?0:1;r[s][i]=Math.min(r[s-1][i]+1,r[s][i-1]+1,r[s-1][i-1]+o)}return r[e.length][t.length]},"levenshtein"),Fa=Ve((t,e,r=3)=>tn(t,e,1,r)[0],"suggestTarget"),tn=Ve((t,e,r=3,s=3)=>{const i=[];for(const o of e){const n=Pa(t.toLowerCase(),o.toLowerCase());n<=s&&i.push({distance:n,name:o})}return i.sort((o,n)=>o.distance-n.distance||o.name.localeCompare(n.name)),i.slice(0,r).map(o=>o.name)},"suggestTargets"),Aa=Ve(t=>t.length===0?" (no targets found)":t.map(e=>` - ${e}`).join(`
5
+ `),"formatTargetList"),La=Ve(async t=>{if(t.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=Ws({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
6
6
  `);for(const[i,o]of t.entries())process.stdout.write(` ${String(i+1).padStart(2," ")}. ${o}
7
7
  `);process.stdout.write(`
8
- `);const r=(await new Promise(i=>{e.question("Select a target (number or name, blank to cancel): ",i)})).trim();if(r.length===0)return;const s=Number.parseInt(r,10);return Number.isFinite(s)&&s>=1&&s<=t.length?t[s-1]:t.includes(r)?r:Pa(r,t)}finally{e.close()}},"promptTargetInteractively");var La=Object.defineProperty,Rt=v((t,e)=>La(t,"name",{value:e,configurable:!0}),"n$1");const Da=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),Kt=Rt(t=>t.replaceAll(Da,"").replaceAll("\r",""),"sanitizeLogLine");class ys{static{v(this,"ServiceDockStore")}static{Rt(this,"ServiceDockStore")}#e=[];#s=new Set;#r=new Map;#n=new Map;constructor(e=[]){for(const r of e)this.#n.set(r,{id:r,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=Rt(()=>this.#r,"getSnapshot");subscribe=Rt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#n.get(e)}getDockState(){let e=!1,r=!1;for(const s of this.#n.values())s.status==="crashed"||s.status==="failed"?e=!0:(s.status==="pending"||s.status==="starting")&&(r=!0);return e?"crash":r?"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,r=>({...r,errorMessage:void 0,startedAt:r.startedAt??Date.now(),status:"starting"}))}markStarted(e,r){this.#t(e,s=>({...s,startedAt:s.startedAt??Date.now(),status:s.status==="ready"?"ready":"starting"}))}markReady(e,r){this.#t(e,s=>({...s,errorMessage:void 0,port:r.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,r,s){const i=s?.message;this.#t(e,o=>({...o,errorMessage:Kt(i??r),status:"failed"}))}markCrashed(e,r){const s=r.slice(-256).map(i=>Kt(i));this.#t(e,i=>({...i,errorMessage:s.length>0?s[s.length-1]:"process exited",status:"crashed",tailLines:s}))}appendLog(e,r){const s=r.split(`
9
- `).map(i=>Kt(i)).filter(i=>i.length>0);s.length!==0&&this.#t(e,i=>{const o=[...i.tailLines,...s];for(;o.length>256;)o.shift();let n=0;for(let c=o.length-1;c>=0;c--)if(n+=o[c].length+1,n>65536){o.splice(0,c+1);break}return{...i,lastLine:s[s.length-1],tailLines:o}})}abortBoot(e){let r=!1;const s=new Map(this.#n);for(const[i,o]of s)(o.status==="pending"||o.status==="starting")&&(s.set(i,{...o,errorMessage:e,status:"failed"}),r=!0);r&&(this.#n=s,this.#i(),this.#o())}#t(e,r){const s=this.#n.get(e);s&&(this.#n.set(e,r(s)),this.#i(),this.#o())}#i(){this.#r=new Map(this.#n)}#o(){for(const e of this.#s)try{e()}catch{}}}var Ba=Object.defineProperty,Na=v((t,e)=>Ba(t,"name",{value:e,configurable:!0}),"v$5"),_a=Object.defineProperty,Ga=Na((t,e)=>_a(t,"name",{value:e,configurable:!0}),"R"),qa=Object.defineProperty,tn=Ga((t,e)=>qa(t,"name",{value:e,configurable:!0}),"u");const Ua=tn((t,e)=>{if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(const[r,s]of t.entries())if(!Object.is(s,e[r]))return!1;return!0},"areDepsEqual"),$s=tn(({children:t,deps:e,onRender:r,style:s,width:i})=>{const o=K.useRef(null),n=K.useRef(!1),c=K.useRef(e),u=K.useRef(t),h=K.useRef(r);h.current=r;let f=!1;e!==void 0?Ua(c.current,e)||(f=!0,c.current=e):t!==u.current&&(f=!0,u.current=t),f&&(n.current=!1,o.current&&(o.current.cachedRender=void 0)),K.useLayoutEffect(()=>{const l=o.current;l&&(l.internal_onRendered=()=>{n.current=!0,h.current?.(l)})}),K.useEffect(()=>()=>{const l=o.current;l&&(l.cachedRender=void 0,l.internal_onRendered=void 0)},[]);const p=K.useMemo(()=>({...s,width:i}),[s,i]);return a.jsx("ink-static-render",{ref:o,style:p,children:n.current?null:t()})},"StaticRender");var Wa=Object.defineProperty,gr=v((t,e)=>Wa(t,"name",{value:e,configurable:!0}),"i$4");const Ha=gr(t=>Array.isArray(t)?`[${t.join(",")}]`:typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"formatValue"),za=gr((t,e,r)=>e==="_"?`${t}${Array.isArray(r)?r.join(" "):String(r)}`:`${t}--${e}=${Ha(r)}`,"formatFlags"),mr=gr((t,e,r)=>{const s=new Set(new Set(r.map(l=>l.target.target))),i=new Set(new Set(r.map(l=>l.target.project))),o=e.filter(l=>s.has(l)),n=t.filter(l=>i.has(l)),c=r.length-n.length*o.length,u=o.length===1?"target":"targets",h=o.join(", "),f=n.length===1?`project ${n[0]}`:`${n.length} projects`;let p=`${u} ${h} for ${f}`;return c>0&&(p+=` and ${c} ${c===1?"task":"tasks"} ${c===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var Va=Object.defineProperty,Ka=v((t,e)=>Va(t,"name",{value:e,configurable:!0}),"c$4");const Ya={error:"red",info:"white",success:"green"},er=Ka(({children:t,title:e,variant:r})=>{const s=Ya[r];return a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(d,{bold:!0,color:s,children:"•"}),a.jsx(d,{children:e})]}),t]})},"Header");var Ja=Object.defineProperty,Xa=v((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"T$7");const rn=Xa(({cached:t,failed:e,failedIds:r,projectNames:s,retriedIds:i,skippedIds:o,succeeded:n,targets:c,tasks:u,took:h})=>{const f=mr(s,c,u),p=i??[];if(e===0&&(!o||o.length===0)){const l=t>0?` (${t} read from cache)`:"";return a.jsx($s,{children:v(()=>a.jsx(er,{title:`Successfully ran ${f}`,variant:"success",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[a.jsxs(d,{children:[a.jsx(d,{color:"green",children:Ws})," ",n+t," tasks completed",l?a.jsx(d,{dimColor:!0,children:l}):null,a.jsx(d,{dimColor:!0,children:` · Took ${h}`})]}),p.length>0&&a.jsxs($,{flexDirection:"column",marginTop:1,children:[a.jsxs(d,{children:[a.jsx(d,{color:"yellow",children:"↻"})," ",a.jsx(d,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(g=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"yellow",children:"↻"})," ",g]},g))]})]})}),"children")})}return a.jsx($s,{children:v(()=>a.jsx(er,{title:`Ran ${f}`,variant:"error",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(l=>a.jsxs(d,{dimColor:!0,children:[" - ",l]},l)),a.jsx(d,{})]}),e>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{children:[a.jsx(d,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),r.map(l=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"red",children:lr})," ",l]},l)),a.jsx(d,{})]}),p.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{children:[a.jsx(d,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(l=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"yellow",children:"↻"})," ",l]},l)),a.jsx(d,{})]}),a.jsx(d,{dimColor:!0,children:` Took ${h}`})]})}),"children")})},"CommandSummary");var Qa=Object.defineProperty,Yt=v((t,e)=>Qa(t,"name",{value:e,configurable:!0}),"o$2");class At{static{v(this,"TaskStore")}static{Yt(this,"TaskStore")}#e;#s=new Set;#r=new Map;constructor(e){this.#e={autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,filterActive:!1,filterText:"",focusedPanel:"tasks",interactiveMode:!1,outputs:new Map,pinnedTaskIds:[null,null],rerunRequested:!1,retriedIds:[],retryTaskId:null,rows:e.map(r=>({persistent:!!r.overrides.visOptions?.persistent,status:"pending",taskId:r.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=Yt(()=>this.#e,"getSnapshot");subscribe=Yt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");startTasks(e){const r=[...this.#e.rows];for(const s of e){const i=r.findIndex(o=>o.taskId===s.id);i!==-1&&(r[i]={...r[i],elapsed:0,status:"running"},this.#r.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:r})}endTasks(e){const r=[...this.#e.rows];let{cached:s,completed:i,failed:o,succeeded:n}=this.#e;const c=new Map(this.#e.outputs),u=[...this.#e.retriedIds];for(const f of e){const p=r.findIndex(l=>l.taskId===f.task.id);switch(p!==-1&&(r[p]={...r[p],duration:f.startTime&&f.endTime?f.endTime-f.startTime:void 0,retryAttempts:f.retryAttempts,status:f.status}),f.retryAttempts&&f.retryAttempts>0&&u.push(f.task.id),i++,f.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{n++;break}}f.terminalOutput&&!c.has(f.task.id)&&c.set(f.task.id,f.terminalOutput),this.#r.delete(f.task.id)}let{selectedIndex:h}=this.#e;if(o>this.#e.failed){const f=r.findIndex(p=>p.status==="failure");f!==-1&&(h=f)}this.#t({...this.#e,cached:s,completed:i,failed:o,outputs:c,retriedIds:u,rows:r,selectedIndex:h,succeeded:n})}static#n=256*1024;addOutput(e,r){if(!r.trim())return;let s=(this.#e.outputs.get(e)??"")+r;s.length>At.#n&&(s=s.slice(-At.#n)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,r){this.#e.outputs.set(e,r),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}unmarkDone(){this.#t({...this.#e,autoExitCountdown:null,done:!1,endTime:null})}tick(){if(this.#r.size===0)return;let e=!1;const r=[...this.#e.rows];for(let s=0;s<r.length;s++){const i=r[s];if(i.status==="running"){const o=this.#r.get(i.taskId);if(o){const n=process.hrtime(o),c=n[0]*1e3+n[1]/1e6;r[s]={...i,elapsed:c},e=!0}}}e&&this.#t({...this.#e,rows:r})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,r){const s=[...this.#e.pinnedTaskIds];s[e]=r,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const r=[...this.#e.rows],s=r.findIndex(c=>c.taskId===e);let{completed:i,failed:o,succeeded:n}=this.#e;if(s!==-1){const c=r[s].status;c==="failure"?(o=Math.max(0,o-1),i=Math.max(0,i-1)):c==="success"&&(n=Math.max(0,n-1),i=Math.max(0,i-1)),r[s]={...r[s],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:i,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(c=>c!==e),retryTaskId:e,rows:r,succeeded:n})}acknowledgeRetry(){const e=this.#e.retryTaskId;return e&&this.#t({...this.#e,retryTaskId:null}),e}setInteractiveMode(e){e!==this.#e.interactiveMode&&this.#t({...this.#e,interactiveMode:e})}setViewMode(e){e!==this.#e.viewMode&&this.#t({...this.#e,viewMode:e})}setStatusFilter(e){this.#t({...this.#e,selectedIndex:0,statusFilter:e})}requestRerun(){this.#r.clear(),this.#t({...this.#e,autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,interactiveMode:!1,outputs:new Map,rerunRequested:!0,retriedIds:[],rows:this.#e.rows.map(e=>({persistent:e.persistent,status:"pending",taskId:e.taskId})),startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const r of this.#s)try{r()}catch{}}}var Za=Object.defineProperty,ec=v((t,e)=>Za(t,"name",{value:e,configurable:!0}),"A$3"),tc=Object.defineProperty,vr=ec((t,e)=>tc(t,"name",{value:e,configurable:!0}),"$"),rc=Object.defineProperty,sc=vr((t,e)=>rc(t,"name",{value:e,configurable:!0}),"r$1");const nc=sc(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
10
- `),"normalizeLF"),ic=globalThis.process??Object.create(null),xs={versions:{}},ks=new Proxy(ic,{get(t,e){if(e in t)return t[e];if(e in xs)return xs[e]}});var oc=Object.defineProperty,ac=vr((t,e)=>oc(t,"name",{value:e,configurable:!0}),"b");const cc=ac((t,e,r,s)=>{const i={column:0,line:-1,...t.start},o={...i,...t.end},n=i.line,c=i.column,u=o.line,h=o.column;let f=Math.max(n-(r+1),0),p=Math.min(e.length,u+s);n===-1&&(f=0),u===-1&&(p=e.length);const l=u-n,g={};if(l)for(let y=0;y<=l;y++){const I=y+n;if(!c)g[I]=!0;else if(y===0){const D=e[I-1]?.length;g[I]=[c,(D??0)-c+1]}else if(y===l)g[I]=[0,h];else{const D=e[I-y]?.length;g[I]=[0,D]}}else c===h?g[n]=c?[c,0]:!0:g[n]=[c,(h??0)-(c??0)];return{end:p,markerLines:g,start:f}},"getMarkerLines");var lc=Object.defineProperty,Ct=vr((t,e)=>lc(t,"name",{value:e,configurable:!0}),"t");const dc=ks.platform==="win32"&&!ks.env?.WT_SESSION?">":"❯",uc=Ct((t,e,r)=>{const s={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...r,color:{gutter:Ct(y=>y,"gutter"),marker:Ct(y=>y,"marker"),message:Ct(y=>y,"message"),...r?.color}},i=typeof e.start.column=="number";let o=nc(t).split(`
11
- `);typeof s.tabWidth=="number"&&(o=o.map(y=>y.replaceAll(" "," ".repeat(s.tabWidth))));const{end:n,markerLines:c,start:u}=cc(e,o,s.linesAbove,s.linesBelow),h=String(n).length,{gutter:f,marker:p,message:l}=s.color;let g=o.slice(u,n).map((y,I)=>{const D=u+1+I,x=c[D],k=String(D).padStart(h),E=!c[D+1],S=` ${k}${s.showGutter?" |":""}`;if(x){let C="";if(Array.isArray(x)){const w=y.replaceAll(/[^\t]/g," ").slice(0,Math.max(x[0]-1,0)),j=x[1]||1;C=[`
12
- `,s.prefix+f(S.replaceAll(/\d/g," "))," ",w,p("^").repeat(j)].join(""),E&&s.message&&(C+=` ${l(s.message)}`)}return[s.prefix+p(dc),f(S),y.length>0?` ${y}`:"",C].join("")}return`${s.prefix} ${f(S)}${y.length>0?` ${y}`:""}`}).join(`
8
+ `);const r=(await new Promise(i=>{e.question("Select a target (number or name, blank to cancel): ",i)})).trim();if(r.length===0)return;const s=Number.parseInt(r,10);return Number.isFinite(s)&&s>=1&&s<=t.length?t[s-1]:t.includes(r)?r:Fa(r,t)}finally{e.close()}},"promptTargetInteractively");var Da=Object.defineProperty,Rt=v((t,e)=>Da(t,"name",{value:e,configurable:!0}),"n$1");const Ba=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),Kt=Rt(t=>t.replaceAll(Ba,"").replaceAll("\r",""),"sanitizeLogLine");class $s{static{v(this,"ServiceDockStore")}static{Rt(this,"ServiceDockStore")}#e=[];#s=new Set;#r=new Map;#n=new Map;constructor(e=[]){for(const r of e)this.#n.set(r,{id:r,status:"pending",tailLines:[]});this.#e=[...e],this.#i()}getSnapshot=Rt(()=>this.#r,"getSnapshot");subscribe=Rt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#n.get(e)}getDockState(){let e=!1,r=!1;for(const s of this.#n.values())s.status==="crashed"||s.status==="failed"?e=!0:(s.status==="pending"||s.status==="starting")&&(r=!0);return e?"crash":r?"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,r=>({...r,errorMessage:void 0,startedAt:r.startedAt??Date.now(),status:"starting"}))}markStarted(e,r){this.#t(e,s=>({...s,startedAt:s.startedAt??Date.now(),status:s.status==="ready"?"ready":"starting"}))}markReady(e,r){this.#t(e,s=>({...s,errorMessage:void 0,port:r.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,r,s){const i=s?.message;this.#t(e,o=>({...o,errorMessage:Kt(i??r),status:"failed"}))}markCrashed(e,r){const s=r.slice(-256).map(i=>Kt(i));this.#t(e,i=>({...i,errorMessage:s.length>0?s[s.length-1]:"process exited",status:"crashed",tailLines:s}))}appendLog(e,r){const s=r.split(`
9
+ `).map(i=>Kt(i)).filter(i=>i.length>0);s.length!==0&&this.#t(e,i=>{const o=[...i.tailLines,...s];for(;o.length>256;)o.shift();let n=0;for(let c=o.length-1;c>=0;c--)if(n+=o[c].length+1,n>65536){o.splice(0,c+1);break}return{...i,lastLine:s[s.length-1],tailLines:o}})}abortBoot(e){let r=!1;const s=new Map(this.#n);for(const[i,o]of s)(o.status==="pending"||o.status==="starting")&&(s.set(i,{...o,errorMessage:e,status:"failed"}),r=!0);r&&(this.#n=s,this.#i(),this.#o())}#t(e,r){const s=this.#n.get(e);s&&(this.#n.set(e,r(s)),this.#i(),this.#o())}#i(){this.#r=new Map(this.#n)}#o(){for(const e of this.#s)try{e()}catch{}}}var Na=Object.defineProperty,_a=v((t,e)=>Na(t,"name",{value:e,configurable:!0}),"v$5"),Ga=Object.defineProperty,qa=_a((t,e)=>Ga(t,"name",{value:e,configurable:!0}),"R"),Ua=Object.defineProperty,rn=qa((t,e)=>Ua(t,"name",{value:e,configurable:!0}),"u");const Wa=rn((t,e)=>{if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(const[r,s]of t.entries())if(!Object.is(s,e[r]))return!1;return!0},"areDepsEqual"),xs=rn(({children:t,deps:e,onRender:r,style:s,width:i})=>{const o=K.useRef(null),n=K.useRef(!1),c=K.useRef(e),u=K.useRef(t),h=K.useRef(r);h.current=r;let f=!1;e!==void 0?Wa(c.current,e)||(f=!0,c.current=e):t!==u.current&&(f=!0,u.current=t),f&&(n.current=!1,o.current&&(o.current.cachedRender=void 0)),K.useLayoutEffect(()=>{const l=o.current;l&&(l.internal_onRendered=()=>{n.current=!0,h.current?.(l)})}),K.useEffect(()=>()=>{const l=o.current;l&&(l.cachedRender=void 0,l.internal_onRendered=void 0)},[]);const p=K.useMemo(()=>({...s,width:i}),[s,i]);return a.jsx("ink-static-render",{ref:o,style:p,children:n.current?null:t()})},"StaticRender");var Ha=Object.defineProperty,gr=v((t,e)=>Ha(t,"name",{value:e,configurable:!0}),"i$4");const za=gr(t=>Array.isArray(t)?`[${t.join(",")}]`:typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"formatValue"),Va=gr((t,e,r)=>e==="_"?`${t}${Array.isArray(r)?r.join(" "):String(r)}`:`${t}--${e}=${za(r)}`,"formatFlags"),mr=gr((t,e,r)=>{const s=new Set(new Set(r.map(l=>l.target.target))),i=new Set(new Set(r.map(l=>l.target.project))),o=e.filter(l=>s.has(l)),n=t.filter(l=>i.has(l)),c=r.length-n.length*o.length,u=o.length===1?"target":"targets",h=o.join(", "),f=n.length===1?`project ${n[0]}`:`${n.length} projects`;let p=`${u} ${h} for ${f}`;return c>0&&(p+=` and ${c} ${c===1?"task":"tasks"} ${c===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var Ka=Object.defineProperty,Ya=v((t,e)=>Ka(t,"name",{value:e,configurable:!0}),"c$4");const Ja={error:"red",info:"white",success:"green"},er=Ya(({children:t,title:e,variant:r})=>{const s=Ja[r];return a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(d,{bold:!0,color:s,children:"•"}),a.jsx(d,{children:e})]}),t]})},"Header");var Qa=Object.defineProperty,Xa=v((t,e)=>Qa(t,"name",{value:e,configurable:!0}),"T$7");const sn=Xa(({cached:t,failed:e,failedIds:r,projectNames:s,retriedIds:i,skippedIds:o,succeeded:n,targets:c,tasks:u,took:h})=>{const f=mr(s,c,u),p=i??[];if(e===0&&(!o||o.length===0)){const l=t>0?` (${t} read from cache)`:"";return a.jsx(xs,{children:v(()=>a.jsx(er,{title:`Successfully ran ${f}`,variant:"success",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[a.jsxs(d,{children:[a.jsx(d,{color:"green",children:Hs})," ",n+t," tasks completed",l?a.jsx(d,{dimColor:!0,children:l}):null,a.jsx(d,{dimColor:!0,children:` · Took ${h}`})]}),p.length>0&&a.jsxs($,{flexDirection:"column",marginTop:1,children:[a.jsxs(d,{children:[a.jsx(d,{color:"yellow",children:"↻"})," ",a.jsx(d,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(g=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"yellow",children:"↻"})," ",g]},g))]})]})}),"children")})}return a.jsx(xs,{children:v(()=>a.jsx(er,{title:`Ran ${f}`,variant:"error",children:a.jsxs($,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(l=>a.jsxs(d,{dimColor:!0,children:[" - ",l]},l)),a.jsx(d,{})]}),e>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{children:[a.jsx(d,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),r.map(l=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"red",children:lr})," ",l]},l)),a.jsx(d,{})]}),p.length>0&&a.jsxs($,{flexDirection:"column",children:[a.jsxs(d,{children:[a.jsx(d,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(l=>a.jsxs(d,{children:[" ",a.jsx(d,{color:"yellow",children:"↻"})," ",l]},l)),a.jsx(d,{})]}),a.jsx(d,{dimColor:!0,children:` Took ${h}`})]})}),"children")})},"CommandSummary");var Za=Object.defineProperty,Yt=v((t,e)=>Za(t,"name",{value:e,configurable:!0}),"o$2");class At{static{v(this,"TaskStore")}static{Yt(this,"TaskStore")}#e;#s=new Set;#r=new Map;constructor(e){this.#e={autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,filterActive:!1,filterText:"",focusedPanel:"tasks",interactiveMode:!1,outputs:new Map,pinnedTaskIds:[null,null],rerunRequested:!1,retriedIds:[],retryTaskId:null,rows:e.map(r=>({persistent:!!r.overrides.visOptions?.persistent,status:"pending",taskId:r.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=Yt(()=>this.#e,"getSnapshot");subscribe=Yt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");startTasks(e){const r=[...this.#e.rows];for(const s of e){const i=r.findIndex(o=>o.taskId===s.id);i!==-1&&(r[i]={...r[i],elapsed:0,status:"running"},this.#r.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:r})}endTasks(e){const r=[...this.#e.rows];let{cached:s,completed:i,failed:o,succeeded:n}=this.#e;const c=new Map(this.#e.outputs),u=[...this.#e.retriedIds];for(const f of e){const p=r.findIndex(l=>l.taskId===f.task.id);switch(p!==-1&&(r[p]={...r[p],duration:f.startTime&&f.endTime?f.endTime-f.startTime:void 0,retryAttempts:f.retryAttempts,status:f.status}),f.retryAttempts&&f.retryAttempts>0&&u.push(f.task.id),i++,f.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{n++;break}}f.terminalOutput&&!c.has(f.task.id)&&c.set(f.task.id,f.terminalOutput),this.#r.delete(f.task.id)}let{selectedIndex:h}=this.#e;if(o>this.#e.failed){const f=r.findIndex(p=>p.status==="failure");f!==-1&&(h=f)}this.#t({...this.#e,cached:s,completed:i,failed:o,outputs:c,retriedIds:u,rows:r,selectedIndex:h,succeeded:n})}static#n=256*1024;addOutput(e,r){if(!r.trim())return;let s=(this.#e.outputs.get(e)??"")+r;s.length>At.#n&&(s=s.slice(-At.#n)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,r){this.#e.outputs.set(e,r),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}unmarkDone(){this.#t({...this.#e,autoExitCountdown:null,done:!1,endTime:null})}tick(){if(this.#r.size===0)return;let e=!1;const r=[...this.#e.rows];for(let s=0;s<r.length;s++){const i=r[s];if(i.status==="running"){const o=this.#r.get(i.taskId);if(o){const n=process.hrtime(o),c=n[0]*1e3+n[1]/1e6;r[s]={...i,elapsed:c},e=!0}}}e&&this.#t({...this.#e,rows:r})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,r){const s=[...this.#e.pinnedTaskIds];s[e]=r,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const r=[...this.#e.rows],s=r.findIndex(c=>c.taskId===e);let{completed:i,failed:o,succeeded:n}=this.#e;if(s!==-1){const c=r[s].status;c==="failure"?(o=Math.max(0,o-1),i=Math.max(0,i-1)):c==="success"&&(n=Math.max(0,n-1),i=Math.max(0,i-1)),r[s]={...r[s],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:i,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(c=>c!==e),retryTaskId:e,rows:r,succeeded:n})}acknowledgeRetry(){const e=this.#e.retryTaskId;return e&&this.#t({...this.#e,retryTaskId:null}),e}setInteractiveMode(e){e!==this.#e.interactiveMode&&this.#t({...this.#e,interactiveMode:e})}setViewMode(e){e!==this.#e.viewMode&&this.#t({...this.#e,viewMode:e})}setStatusFilter(e){this.#t({...this.#e,selectedIndex:0,statusFilter:e})}requestRerun(){this.#r.clear(),this.#t({...this.#e,autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,interactiveMode:!1,outputs:new Map,rerunRequested:!0,retriedIds:[],rows:this.#e.rows.map(e=>({persistent:e.persistent,status:"pending",taskId:e.taskId})),startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const r of this.#s)try{r()}catch{}}}var ec=Object.defineProperty,tc=v((t,e)=>ec(t,"name",{value:e,configurable:!0}),"A$3"),rc=Object.defineProperty,vr=tc((t,e)=>rc(t,"name",{value:e,configurable:!0}),"$"),sc=Object.defineProperty,nc=vr((t,e)=>sc(t,"name",{value:e,configurable:!0}),"r$1");const ic=nc(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
10
+ `),"normalizeLF"),oc=globalThis.process??Object.create(null),ks={versions:{}},bs=new Proxy(oc,{get(t,e){if(e in t)return t[e];if(e in ks)return ks[e]}});var ac=Object.defineProperty,cc=vr((t,e)=>ac(t,"name",{value:e,configurable:!0}),"b");const lc=cc((t,e,r,s)=>{const i={column:0,line:-1,...t.start},o={...i,...t.end},n=i.line,c=i.column,u=o.line,h=o.column;let f=Math.max(n-(r+1),0),p=Math.min(e.length,u+s);n===-1&&(f=0),u===-1&&(p=e.length);const l=u-n,g={};if(l)for(let y=0;y<=l;y++){const R=y+n;if(!c)g[R]=!0;else if(y===0){const B=e[R-1]?.length;g[R]=[c,(B??0)-c+1]}else if(y===l)g[R]=[0,h];else{const B=e[R-y]?.length;g[R]=[0,B]}}else c===h?g[n]=c?[c,0]:!0:g[n]=[c,(h??0)-(c??0)];return{end:p,markerLines:g,start:f}},"getMarkerLines");var dc=Object.defineProperty,Ct=vr((t,e)=>dc(t,"name",{value:e,configurable:!0}),"t");const uc=bs.platform==="win32"&&!bs.env?.WT_SESSION?">":"❯",fc=Ct((t,e,r)=>{const s={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...r,color:{gutter:Ct(y=>y,"gutter"),marker:Ct(y=>y,"marker"),message:Ct(y=>y,"message"),...r?.color}},i=typeof e.start.column=="number";let o=ic(t).split(`
11
+ `);typeof s.tabWidth=="number"&&(o=o.map(y=>y.replaceAll(" "," ".repeat(s.tabWidth))));const{end:n,markerLines:c,start:u}=lc(e,o,s.linesAbove,s.linesBelow),h=String(n).length,{gutter:f,marker:p,message:l}=s.color;let g=o.slice(u,n).map((y,R)=>{const B=u+1+R,x=c[B],k=String(B).padStart(h),M=!c[B+1],S=` ${k}${s.showGutter?" |":""}`;if(x){let C="";if(Array.isArray(x)){const w=y.replaceAll(/[^\t]/g," ").slice(0,Math.max(x[0]-1,0)),j=x[1]||1;C=[`
12
+ `,s.prefix+f(S.replaceAll(/\d/g," "))," ",w,p("^").repeat(j)].join(""),M&&s.message&&(C+=` ${l(s.message)}`)}return[s.prefix+p(uc),f(S),y.length>0?` ${y}`:"",C].join("")}return`${s.prefix} ${f(S)}${y.length>0?` ${y}`:""}`}).join(`
13
13
  `);return s.message&&!i&&(g=`${s.prefix+" ".repeat(h+1)+s.message}
14
- ${g}`),g},"codeFrame");var fc=Object.defineProperty,pe=v((t,e)=>fc(t,"name",{value:e,configurable:!0}),"C$3"),ct=44,sn=59,bs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nn=new Uint8Array(64),on=new Uint8Array(128);for(let t=0;t<bs.length;t++){const e=bs.charCodeAt(t);nn[t]=e,on[e]=t}function ne(t,e){let r=0,s=0,i=0;do{const n=t.next();i=on[n],r|=(i&31)<<s,s+=5}while(i&32);const o=r&1;return r>>>=1,o&&(r=-2147483648|-r),e+r}v(ne,"h$4");pe(ne,"decodeInteger");function ee(t,e,r){let s=e-r;s=s<0?-s<<1|1:s<<1;do{let i=s&31;s>>>=5,s>0&&(i|=32),t.write(nn[i])}while(s>0);return e}v(ee,"i$3");pe(ee,"encodeInteger");function Ne(t,e){return t.pos>=e?!1:t.peek()!==ct}v(Ne,"S$3");pe(Ne,"hasMoreVlq");var js=1024*16,Ss=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}},wr=class{static{v(this,"T")}static{pe(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(js)}write(e){const{buffer:r}=this;r[this.pos++]=e,this.pos===js&&(this.out+=Ss.decode(r),this.pos=0)}flush(){const{buffer:e,out:r,pos:s}=this;return s>0?r+Ss.decode(e.subarray(0,s)):r}},yr=class{static{v(this,"w")}static{pe(this,"StringReader")}constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:r,pos:s}=this,i=r.indexOf(e,s);return i===-1?r.length:i}},an=[];function hc(t){const{length:e}=t,r=new yr(t),s=[],i=[];let o=0;for(;r.pos<e;r.pos++){o=ne(r,o);const n=ne(r,0);if(!Ne(r,e)){const f=i.pop();f[2]=o,f[3]=n;continue}const c=ne(r,0),u=ne(r,0)&1?[o,n,0,0,c,ne(r,0)]:[o,n,0,0,c];let h=an;if(Ne(r,e)){h=[];do{const f=ne(r,0);h.push(f)}while(Ne(r,e))}u.vars=h,s.push(u),i.push(u)}return s}v(hc,"z$1");pe(hc,"decodeOriginalScopes");function pc(t){const e=new wr;for(let r=0;r<t.length;)r=$r(t,r,e,[0]);return e.flush()}v(pc,"F$3");pe(pc,"encodeOriginalScopes");function $r(t,e,r,s){const i=t[e],{0:o,1:n,2:c,3:u,4:h,vars:f}=i;e>0&&r.write(ct),s[0]=ee(r,o,s[0]),ee(r,n,0),ee(r,h,0);const p=i.length===6?1:0;ee(r,p,0),i.length===6&&ee(r,i[5],0);for(const l of f)ee(r,l,0);for(e++;e<t.length;){const l=t[e],{0:g,1:y}=l;if(g>c||g===c&&y>=u)break;e=$r(t,e,r,s)}return r.write(ct),s[0]=ee(r,c,s[0]),ee(r,u,0),e}v($r,"P$4");pe($r,"_encodeOriginalScopes");function gc(t){const{length:e}=t,r=new yr(t),s=[],i=[];let o=0,n=0,c=0,u=0,h=0,f=0,p=0,l=0;do{const g=r.indexOf(";");let y=0;for(;r.pos<g;r.pos++){if(y=ne(r,y),!Ne(r,g)){const w=i.pop();w[2]=o,w[3]=y;continue}const I=ne(r,0),D=I&1,x=I&2,k=I&4;let E=null,S=an,C;if(D){const w=ne(r,n);c=ne(r,n===w?c:0),n=w,C=[o,y,0,0,w,c]}else C=[o,y,0,0];if(C.isScope=!!k,x){const w=u,j=h;u=ne(r,u);const F=w===u;h=ne(r,F?h:0),f=ne(r,F&&j===h?f:0),E=[u,h,f]}if(C.callsite=E,Ne(r,g)){S=[];do{p=o,l=y;const w=ne(r,0);let j;if(w<-1){j=[[ne(r,0)]];for(let F=-1;F>w;F--){const P=p;p=ne(r,p),l=ne(r,p===P?l:0);const q=ne(r,0);j.push([q,p,l])}}else j=[[w]];S.push(j)}while(Ne(r,g))}C.bindings=S,s.push(C),i.push(C)}o++,r.pos=g+1}while(r.pos<e);return s}v(gc,"H$1");pe(gc,"decodeGeneratedRanges");function mc(t){if(t.length===0)return"";const e=new wr;for(let r=0;r<t.length;)r=xr(t,r,e,[0,0,0,0,0,0,0]);return e.flush()}v(mc,"J");pe(mc,"encodeGeneratedRanges");function xr(t,e,r,s){const i=t[e],{0:o,1:n,2:c,3:u,isScope:h,callsite:f,bindings:p}=i;s[0]<o?(tr(r,s[0],o),s[0]=o,s[1]=0):e>0&&r.write(ct),s[1]=ee(r,i[1],s[1]);const l=(i.length===6?1:0)|(f?2:0)|(h?4:0);if(ee(r,l,0),i.length===6){const{4:g,5:y}=i;g!==s[2]&&(s[3]=0),s[2]=ee(r,g,s[2]),s[3]=ee(r,y,s[3])}if(f){const{0:g,1:y,2:I}=i.callsite;g!==s[4]?(s[5]=0,s[6]=0):y!==s[5]&&(s[6]=0),s[4]=ee(r,g,s[4]),s[5]=ee(r,y,s[5]),s[6]=ee(r,I,s[6])}if(p)for(const g of p){g.length>1&&ee(r,-g.length,0);const y=g[0][0];ee(r,y,0);let I=o,D=n;for(let x=1;x<g.length;x++){const k=g[x];I=ee(r,k[1],I),D=ee(r,k[2],D),ee(r,k[0],0)}}for(e++;e<t.length;){const g=t[e],{0:y,1:I}=g;if(y>c||y===c&&I>=u)break;e=xr(t,e,r,s)}return s[0]<c?(tr(r,s[0],c),s[0]=c,s[1]=0):r.write(ct),s[1]=ee(r,u,s[1]),e}v(xr,"V$1");pe(xr,"_encodeGeneratedRanges");function tr(t,e,r){do t.write(sn);while(++e<r)}v(tr,"U$4");pe(tr,"catchupLine");function cn(t){const{length:e}=t,r=new yr(t),s=[];let i=0,o=0,n=0,c=0,u=0;do{const h=r.indexOf(";"),f=[];let p=!0,l=0;for(i=0;r.pos<h;){let g;i=ne(r,i),i<l&&(p=!1),l=i,Ne(r,h)?(o=ne(r,o),n=ne(r,n),c=ne(r,c),Ne(r,h)?(u=ne(r,u),g=[i,o,n,c,u]):g=[i,o,n,c]):g=[i],f.push(g),r.pos++}p||ln(f),s.push(f),r.pos=h+1}while(r.pos<=e);return s}v(cn,"K");pe(cn,"decode");function ln(t){t.sort(dn)}v(ln,"Q$1");pe(ln,"sort");function dn(t,e){return t[0]-e[0]}v(dn,"X$3");pe(dn,"sortComparator");function un(t){const e=new wr;let r=0,s=0,i=0,o=0;for(let n=0;n<t.length;n++){const c=t[n];if(n>0&&e.write(sn),c.length===0)continue;let u=0;for(let h=0;h<c.length;h++){const f=c[h];h>0&&e.write(ct),u=ee(e,f[0],u),f.length!==1&&(r=ee(e,f[1],r),s=ee(e,f[2],s),i=ee(e,f[3],i),f.length!==4&&(o=ee(e,f[4],o)))}}return e.flush()}v(un,"Z$1");pe(un,"encode");var vc=Object.defineProperty,Se=v((t,e)=>vc(t,"name",{value:e,configurable:!0}),"c$3");const wc=/^[\w+.-]+:\/\//,yc=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,$c=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function fn(t){return wc.test(t)}v(fn,"R$3");Se(fn,"isAbsoluteUrl");function hn(t){return t.startsWith("//")}v(hn,"q$1");Se(hn,"isSchemeRelativeUrl");function kr(t){return t.startsWith("/")}v(kr,"m$1");Se(kr,"isAbsolutePath");function pn(t){return t.startsWith("file:")}v(pn,"v$3");Se(pn,"isFileUrl");function rr(t){return/^[.?#]/.test(t)}v(rr,"u$1");Se(rr,"isRelative");function mt(t){const e=yc.exec(t);return br(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}v(mt,"f$5");Se(mt,"parseAbsoluteUrl");function gn(t){const e=$c.exec(t),r=e[2];return br("file:","",e[1]||"","",kr(r)?r:"/"+r,e[3]||"",e[4]||"")}v(gn,"w$4");Se(gn,"parseFileUrl");function br(t,e,r,s,i,o,n){return{scheme:t,user:e,host:r,port:s,path:i,query:o,hash:n,type:7}}v(br,"y$5");Se(br,"makeUrl");function sr(t){if(hn(t)){const r=mt("http:"+t);return r.scheme="",r.type=6,r}if(kr(t)){const r=mt("http://foo.com"+t);return r.scheme="",r.host="",r.type=5,r}if(pn(t))return gn(t);if(fn(t))return mt(t);const e=mt("http://foo.com/"+t);return e.scheme="",e.host="",e.type=t?t.startsWith("?")?3:t.startsWith("#")?2:4:1,e}v(sr,"p$4");Se(sr,"parseUrl");function mn(t){if(t.endsWith("/.."))return t;const e=t.lastIndexOf("/");return t.slice(0,e+1)}v(mn,"P$3");Se(mn,"stripPathFilename");function vn(t,e){jr(e,e.type),t.path==="/"?t.path=e.path:t.path=mn(e.path)+t.path}v(vn,"A$2");Se(vn,"mergePaths");function jr(t,e){const r=e<=4,s=t.path.split("/");let i=1,o=0,n=!1;for(let u=1;u<s.length;u++){const h=s[u];if(!h){n=!0;continue}if(n=!1,h!=="."){if(h===".."){o?(n=!0,o--,i--):r&&(s[i++]=h);continue}s[i++]=h,o++}}let c="";for(let u=1;u<i;u++)c+="/"+s[u];(!c||n&&!c.endsWith("/.."))&&(c+="/"),t.path=c}v(jr,"d$3");Se(jr,"normalizePath");function wn(t,e){if(!t&&!e)return"";const r=sr(t);let s=r.type;if(e&&s!==7){const o=sr(e),n=o.type;switch(s){case 1:r.hash=o.hash;case 2:r.query=o.query;case 3:case 4:vn(r,o);case 5:r.user=o.user,r.host=o.host,r.port=o.port;case 6:r.scheme=o.scheme}n>s&&(s=n)}jr(r,s);const i=r.query+r.hash;switch(s){case 2:case 3:return i;case 4:{const o=r.path.slice(1);return o?rr(e||t)&&!rr(o)?"./"+o+i:o+i:i||"."}case 5:return r.path+i;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+i}}v(wn,"F$2");Se(wn,"resolve");var xc=Object.defineProperty,W=v((t,e)=>xc(t,"name",{value:e,configurable:!0}),"i$2");function yn(t){if(!t)return"";const e=t.lastIndexOf("/");return t.slice(0,e+1)}v(yn,"ae");W(yn,"stripFilename");function $n(t,e){const r=yn(t),s=e?e+"/":"";return i=>wn(s+(i||""),r)}v($n,"ge");W($n,"resolver");var Fe=0,Sr=1,Tr=2,Cr=3,xn=4,kn=1,bn=2;function jn(t,e){const r=nr(t,0);if(r===t.length)return t;e||(t=t.slice());for(let s=r;s<t.length;s=nr(t,s+1))t[s]=Tn(t[s],e);return t}v(jn,"he");W(jn,"maybeSort");function nr(t,e){for(let r=e;r<t.length;r++)if(!Sn(t[r]))return r;return t.length}v(nr,"X$2");W(nr,"nextUnsortedSegmentLine");function Sn(t){for(let e=1;e<t.length;e++)if(t[e][Fe]<t[e-1][Fe])return!1;return!0}v(Sn,"_e$1");W(Sn,"isSorted");function Tn(t,e){return e||(t=t.slice()),t.sort(Ir)}v(Tn,"ve");W(Tn,"sortSegments");function Ir(t,e){return t[Fe]-e[Fe]}v(Ir,"$$4");W(Ir,"sortComparator");function Cn(t,e){const r=e.map(()=>[]);for(let s=0;s<t.length;s++){const i=t[s];for(let o=0;o<i.length;o++){const n=i[o];if(n.length===1)continue;const c=n[Sr],u=n[Tr],h=n[Cr],f=r[c];(f[u]||(f[u]=[])).push([h,s,n[Fe]])}}for(let s=0;s<r.length;s++){const i=r[s];for(let o=0;o<i.length;o++){const n=i[o];n&&n.sort(Ir)}}return r}v(Cn,"Se");W(Cn,"buildBySources");var Qe=!1;function In(t,e,r,s){for(;r<=s;){const i=r+(s-r>>1),o=t[i][Fe]-e;if(o===0)return Qe=!0,i;o<0?r=i+1:s=i-1}return Qe=!1,r-1}v(In,"Ee");W(In,"binarySearch");function Rr(t,e,r){for(let s=r+1;s<t.length&&t[s][Fe]===e;r=s++);return r}v(Rr,"H");W(Rr,"upperBound");function Er(t,e,r){for(let s=r-1;s>=0&&t[s][Fe]===e;r=s--);return r}v(Er,"Y");W(Er,"lowerBound");function Or(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}v(Or,"k$4");W(Or,"memoizedState");function Rn(t,e,r,s){const{lastKey:i,lastNeedle:o,lastIndex:n}=r;let c=0,u=t.length-1;if(s===i){if(e===o)return Qe=n!==-1&&t[n][Fe]===e,n;e>=o?c=n===-1?0:n:u=n}return r.lastKey=s,r.lastNeedle=e,r.lastIndex=In(t,e,c,u)}v(Rn,"Me$1");W(Rn,"memoizedBinarySearch");function Gt(t){return typeof t=="string"?JSON.parse(t):t}v(Gt,"j$3");W(Gt,"parse");var kc=W(function(t,e){const r=Gt(t);if(!("sections"in r))return new Pr(r,e);const s=[],i=[],o=[],n=[],c=[];Mr(r,e,s,i,o,n,c,0,0,1/0,1/0);const u={version:3,file:r.file,names:n,sources:i,sourcesContent:o,mappings:s,ignoreList:c};return Dn(u)},"FlattenMap");function Mr(t,e,r,s,i,o,n,c,u,h,f){const{sections:p}=t;for(let l=0;l<p.length;l++){const{map:g,offset:y}=p[l];let I=h,D=f;if(l+1<p.length){const x=p[l+1].offset;I=Math.min(h,c+x.line),I===h?D=Math.min(f,u+x.column):I<h&&(D=u+x.column)}En(g,e,r,s,i,o,n,c+y.line,u+y.column,I,D)}}v(Mr,"ee");W(Mr,"recurse");function En(t,e,r,s,i,o,n,c,u,h,f){const p=Gt(t);if("sections"in p)return Mr(...arguments);const l=new Pr(p,e),g=s.length,y=o.length,I=tt(l),{resolvedSources:D,sourcesContent:x,ignoreList:k}=l;if(Et(s,D),Et(o,l.names),x)Et(i,x);else for(let E=0;E<D.length;E++)i.push(null);if(k)for(let E=0;E<k.length;E++)n.push(k[E]+g);for(let E=0;E<I.length;E++){const S=c+E;if(S>h)return;const C=On(r,S),w=E===0?u:0,j=I[E];for(let F=0;F<j.length;F++){const P=j[F],q=w+P[Fe];if(S===h&&q>=f)return;if(P.length===1){C.push([q]);continue}const ae=g+P[Sr],Q=P[Tr],V=P[Cr];C.push(P.length===4?[q,ae,Q,V]:[q,ae,Q,V,y+P[xn]])}}}v(En,"me");W(En,"addSection");function Et(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}v(Et,"G$1");W(Et,"append");function On(t,e){for(let r=t.length;r<=e;r++)t[r]=[];return t[e]}v(On,"xe$1");W(On,"getLine");var Mn="`line` must be greater than 0 (lines start at line 1)",Pn="`column` must be greater than or equal to 0 (columns start at column 0)",Lt=-1,qt=1,Pr=class{static{v(this,"R")}static{W(this,"TraceMap")}constructor(e,r){const s=typeof e=="string";if(!s&&e._decodedMemo)return e;const i=Gt(e),{version:o,file:n,names:c,sourceRoot:u,sources:h,sourcesContent:f}=i;this.version=o,this.file=n,this.names=c||[],this.sourceRoot=u,this.sources=h,this.sourcesContent=f,this.ignoreList=i.ignoreList||i.x_google_ignoreList||void 0;const p=$n(r,u);this.resolvedSources=h.map(p);const{mappings:l}=i;if(typeof l=="string")this._encoded=l,this._decoded=void 0;else if(Array.isArray(l))this._encoded=void 0,this._decoded=jn(l,s);else throw i.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(i)}`);this._decodedMemo=Or(),this._bySources=void 0,this._bySourceMemos=void 0}};function Fn(t){var e,r;return(r=(e=t)._encoded)!=null?r:e._encoded=un(t._decoded)}v(Fn,"oe");W(Fn,"encodedMappings");function tt(t){var e;return(e=t)._decoded||(e._decoded=cn(t._encoded))}v(tt,"O$2");W(tt,"decodedMappings");function bc(t,e,r){const s=tt(t);if(e>=s.length)return null;const i=s[e],o=xt(i,t._decodedMemo,e,r,qt);return o===-1?null:i[o]}v(bc,"Oe$1");W(bc,"traceSegment");function An(t,e){let{line:r,column:s,bias:i}=e;if(r--,r<0)throw new Error(Mn);if(s<0)throw new Error(Pn);const o=tt(t);if(r>=o.length)return vt(null,null,null,null);const n=o[r],c=xt(n,t._decodedMemo,r,s,i||qt);if(c===-1)return vt(null,null,null,null);const u=n[c];if(u.length===1)return vt(null,null,null,null);const{names:h,resolvedSources:f}=t;return vt(f[u[Sr]],u[Tr]+1,u[Cr],u.length===5?h[u[xn]]:null)}v(An,"Le$1");W(An,"originalPositionFor");function jc(t,e){const{source:r,line:s,column:i,bias:o}=e;return Ar(t,r,s,i,o||qt,!1)}v(jc,"ye");W(jc,"generatedPositionFor");function Sc(t,e){const{source:r,line:s,column:i,bias:o}=e;return Ar(t,r,s,i,o||Lt,!0)}v(Sc,"Ce$1");W(Sc,"allGeneratedPositionsFor");function Tc(t,e){const r=tt(t),{names:s,resolvedSources:i}=t;for(let o=0;o<r.length;o++){const n=r[o];for(let c=0;c<n.length;c++){const u=n[c],h=o+1,f=u[0];let p=null,l=null,g=null,y=null;u.length!==1&&(p=i[u[1]],l=u[2]+1,g=u[3]),u.length===5&&(y=s[u[4]]),e({generatedLine:h,generatedColumn:f,source:p,originalLine:l,originalColumn:g,name:y})}}}v(Tc,"Ie");W(Tc,"eachMapping");function Fr(t,e){const{sources:r,resolvedSources:s}=t;let i=r.indexOf(e);return i===-1&&(i=s.indexOf(e)),i}v(Fr,"re");W(Fr,"sourceIndex");function Ln(t,e){const{sourcesContent:r}=t;if(r==null)return null;const s=Fr(t,e);return s===-1?null:r[s]}v(Ln,"Ne$1");W(Ln,"sourceContentFor");function Cc(t,e){const{ignoreList:r}=t;if(r==null)return!1;const s=Fr(t,e);return s===-1?!1:r.includes(s)}v(Cc,"be");W(Cc,"isIgnored");function Dn(t,e){const r=new Pr(Ut(t,[]),e);return r._decoded=t.mappings,r}v(Dn,"se");W(Dn,"presortedDecodedMap");function Ic(t){return Ut(t,tt(t))}v(Ic,"Re");W(Ic,"decodedMap");function Rc(t){return Ut(t,Fn(t))}v(Rc,"we$1");W(Rc,"encodedMap");function Ut(t,e){return{version:t.version,file:t.file,names:t.names,sourceRoot:t.sourceRoot,sources:t.sources,sourcesContent:t.sourcesContent,mappings:e,ignoreList:t.ignoreList||t.x_google_ignoreList}}v(Ut,"B$2");W(Ut,"clone");function vt(t,e,r,s){return{source:t,line:e,column:r,name:s}}v(vt,"b$2");W(vt,"OMapping");function it(t,e){return{line:t,column:e}}v(it,"y$4");W(it,"GMapping");function xt(t,e,r,s,i){let o=Rn(t,s,e,r);return Qe?o=(i===Lt?Rr:Er)(t,s,o):i===Lt&&o++,o===-1||o===t.length?-1:o}v(xt,"w$3");W(xt,"traceSegmentInternal");function Bn(t,e,r,s,i){let o=xt(t,e,r,s,qt);if(!Qe&&i===Lt&&o++,o===-1||o===t.length)return[];const n=Qe?s:t[o][Fe];Qe||(o=Er(t,n,o));const c=Rr(t,n,o),u=[];for(;o<=c;o++){const h=t[o];u.push(it(h[kn]+1,h[bn]))}return u}v(Bn,"Ue");W(Bn,"sliceGeneratedPositions");function Ar(t,e,r,s,i,o){var n,c;if(r--,r<0)throw new Error(Mn);if(s<0)throw new Error(Pn);const{sources:u,resolvedSources:h}=t;let f=u.indexOf(e);if(f===-1&&(f=h.indexOf(e)),f===-1)return o?[]:it(null,null);const p=(n=t)._bySourceMemos||(n._bySourceMemos=u.map(Or)),l=((c=t)._bySources||(c._bySources=Cn(tt(t),p)))[f][r];if(l==null)return o?[]:it(null,null);const g=p[f];if(o)return Bn(l,g,r,s,i);const y=xt(l,g,r,s,i);if(y===-1)return it(null,null);const I=l[y];return it(I[kn]+1,I[bn])}v(Ar,"ie");W(Ar,"generatedPosition");var Ec=Object.defineProperty,Oc=v((t,e)=>Ec(t,"name",{value:e,configurable:!0}),"u"),Mc=Object.defineProperty,Nn=Oc((t,e)=>Mc(t,"name",{value:e,configurable:!0}),"c");const Pc=bo(import.meta.url),gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lr=Nn(t=>{if(typeof gt<"u"&&gt.versions&&gt.versions.node){const[e,r]=gt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return gt.getBuiltinModule(t)}return Pc(t)},"__cjs_getBuiltinModule"),{readFileSync:Ts}=Lr("node:fs"),{resolve:Fc,toNamespacedPath:Jt,dirname:Ac}=Lr("node:path"),{pathToFileURL:Lc}=Lr("node:url");var Dc=Object.defineProperty,kt=Nn((t,e)=>Dc(t,"name",{value:e,configurable:!0}),"s");const Bc=/^data:application\/json[^,]+base64,/,Nc=/^[a-z][a-z0-9+.-]*:\/\//i,_c=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,Gc=/\r?\n/,_n=kt(t=>Bc.test(t),"isInlineMap"),Xt=kt((t,e)=>{const r=t instanceof Error?t.message:String(t),s=`${e}:
15
- ${r}`;throw new Error(s)},"enhanceError"),qc=kt((t,e)=>{const r=t.split(Gc);let s;for(let o=r.length-1;o>=0&&!s;o--)s=_c.exec(r[o])??void 0;if(!s)return;const i=s[1]??s[2];if(i){if(_n(i))return i;if(!/^data:/i.test(i)&&!(Nc.test(i)&&!i.startsWith("file:")))return Fc(e,i)}},"resolveSourceMapUrl"),Uc=kt(t=>{const e=t.slice(t.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),Wc=kt(t=>{let e;try{e=Ts(t,{encoding:"utf8"})}catch(o){Xt(o,`Error reading sourcemap for file "${Jt(t)}"`)}const r=qc(e,Ac(t));if(!r)return;let s;const i=_n(r);if(i)s=Uc(r);else try{s=Ts(r,{encoding:"utf8"})}catch(o){Xt(o,`Error reading sourcemap for file "${Jt(t)}"`)}try{const o=i?r:Lc(r).href;return new kc(s,o)}catch(o){Xt(o,`Error parsing sourcemap for file "${Jt(t)}"`)}},"loadSourceMap");var Hc=Object.defineProperty,Pe=v((t,e)=>Hc(t,"name",{value:e,configurable:!0}),"l$3");const zc=Pe(t=>oa(t),"stripAnsi"),Vc=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,Kc=/^\s*at\s+/,Yc=Pe(t=>{const e=t.split(`
16
- `);let r;for(let s=0;s<e.length;s++){const i=Vc.exec(e[s].trim());if(!i)continue;const o=[];for(let n=s+1;n<e.length&&n<=s+200;n++){const c=e[n];if(Kc.test(c))o.push(c.trim());else if(o.length>0||c.trim()!=="")break}if(o.length>0){const n=i.groups?.name??"Error",c=i.groups?.message??"";r={message:c,name:n,stack:`${n}: ${c}
14
+ ${g}`),g},"codeFrame");var hc=Object.defineProperty,he=v((t,e)=>hc(t,"name",{value:e,configurable:!0}),"C$3"),ct=44,nn=59,js="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",on=new Uint8Array(64),an=new Uint8Array(128);for(let t=0;t<js.length;t++){const e=js.charCodeAt(t);on[t]=e,an[e]=t}function se(t,e){let r=0,s=0,i=0;do{const n=t.next();i=an[n],r|=(i&31)<<s,s+=5}while(i&32);const o=r&1;return r>>>=1,o&&(r=-2147483648|-r),e+r}v(se,"h$4");he(se,"decodeInteger");function Z(t,e,r){let s=e-r;s=s<0?-s<<1|1:s<<1;do{let i=s&31;s>>>=5,s>0&&(i|=32),t.write(on[i])}while(s>0);return e}v(Z,"i$3");he(Z,"encodeInteger");function Ge(t,e){return t.pos>=e?!1:t.peek()!==ct}v(Ge,"S$3");he(Ge,"hasMoreVlq");var Ss=1024*16,Ts=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}},wr=class{static{v(this,"T")}static{he(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ss)}write(e){const{buffer:r}=this;r[this.pos++]=e,this.pos===Ss&&(this.out+=Ts.decode(r),this.pos=0)}flush(){const{buffer:e,out:r,pos:s}=this;return s>0?r+Ts.decode(e.subarray(0,s)):r}},yr=class{static{v(this,"w")}static{he(this,"StringReader")}constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:r,pos:s}=this,i=r.indexOf(e,s);return i===-1?r.length:i}},cn=[];function pc(t){const{length:e}=t,r=new yr(t),s=[],i=[];let o=0;for(;r.pos<e;r.pos++){o=se(r,o);const n=se(r,0);if(!Ge(r,e)){const f=i.pop();f[2]=o,f[3]=n;continue}const c=se(r,0),u=se(r,0)&1?[o,n,0,0,c,se(r,0)]:[o,n,0,0,c];let h=cn;if(Ge(r,e)){h=[];do{const f=se(r,0);h.push(f)}while(Ge(r,e))}u.vars=h,s.push(u),i.push(u)}return s}v(pc,"z$1");he(pc,"decodeOriginalScopes");function gc(t){const e=new wr;for(let r=0;r<t.length;)r=$r(t,r,e,[0]);return e.flush()}v(gc,"F$3");he(gc,"encodeOriginalScopes");function $r(t,e,r,s){const i=t[e],{0:o,1:n,2:c,3:u,4:h,vars:f}=i;e>0&&r.write(ct),s[0]=Z(r,o,s[0]),Z(r,n,0),Z(r,h,0);const p=i.length===6?1:0;Z(r,p,0),i.length===6&&Z(r,i[5],0);for(const l of f)Z(r,l,0);for(e++;e<t.length;){const l=t[e],{0:g,1:y}=l;if(g>c||g===c&&y>=u)break;e=$r(t,e,r,s)}return r.write(ct),s[0]=Z(r,c,s[0]),Z(r,u,0),e}v($r,"P$4");he($r,"_encodeOriginalScopes");function mc(t){const{length:e}=t,r=new yr(t),s=[],i=[];let o=0,n=0,c=0,u=0,h=0,f=0,p=0,l=0;do{const g=r.indexOf(";");let y=0;for(;r.pos<g;r.pos++){if(y=se(r,y),!Ge(r,g)){const w=i.pop();w[2]=o,w[3]=y;continue}const R=se(r,0),B=R&1,x=R&2,k=R&4;let M=null,S=cn,C;if(B){const w=se(r,n);c=se(r,n===w?c:0),n=w,C=[o,y,0,0,w,c]}else C=[o,y,0,0];if(C.isScope=!!k,x){const w=u,j=h;u=se(r,u);const A=w===u;h=se(r,A?h:0),f=se(r,A&&j===h?f:0),M=[u,h,f]}if(C.callsite=M,Ge(r,g)){S=[];do{p=o,l=y;const w=se(r,0);let j;if(w<-1){j=[[se(r,0)]];for(let A=-1;A>w;A--){const P=p;p=se(r,p),l=se(r,p===P?l:0);const q=se(r,0);j.push([q,p,l])}}else j=[[w]];S.push(j)}while(Ge(r,g))}C.bindings=S,s.push(C),i.push(C)}o++,r.pos=g+1}while(r.pos<e);return s}v(mc,"H$1");he(mc,"decodeGeneratedRanges");function vc(t){if(t.length===0)return"";const e=new wr;for(let r=0;r<t.length;)r=xr(t,r,e,[0,0,0,0,0,0,0]);return e.flush()}v(vc,"J");he(vc,"encodeGeneratedRanges");function xr(t,e,r,s){const i=t[e],{0:o,1:n,2:c,3:u,isScope:h,callsite:f,bindings:p}=i;s[0]<o?(tr(r,s[0],o),s[0]=o,s[1]=0):e>0&&r.write(ct),s[1]=Z(r,i[1],s[1]);const l=(i.length===6?1:0)|(f?2:0)|(h?4:0);if(Z(r,l,0),i.length===6){const{4:g,5:y}=i;g!==s[2]&&(s[3]=0),s[2]=Z(r,g,s[2]),s[3]=Z(r,y,s[3])}if(f){const{0:g,1:y,2:R}=i.callsite;g!==s[4]?(s[5]=0,s[6]=0):y!==s[5]&&(s[6]=0),s[4]=Z(r,g,s[4]),s[5]=Z(r,y,s[5]),s[6]=Z(r,R,s[6])}if(p)for(const g of p){g.length>1&&Z(r,-g.length,0);const y=g[0][0];Z(r,y,0);let R=o,B=n;for(let x=1;x<g.length;x++){const k=g[x];R=Z(r,k[1],R),B=Z(r,k[2],B),Z(r,k[0],0)}}for(e++;e<t.length;){const g=t[e],{0:y,1:R}=g;if(y>c||y===c&&R>=u)break;e=xr(t,e,r,s)}return s[0]<c?(tr(r,s[0],c),s[0]=c,s[1]=0):r.write(ct),s[1]=Z(r,u,s[1]),e}v(xr,"V$1");he(xr,"_encodeGeneratedRanges");function tr(t,e,r){do t.write(nn);while(++e<r)}v(tr,"U$4");he(tr,"catchupLine");function ln(t){const{length:e}=t,r=new yr(t),s=[];let i=0,o=0,n=0,c=0,u=0;do{const h=r.indexOf(";"),f=[];let p=!0,l=0;for(i=0;r.pos<h;){let g;i=se(r,i),i<l&&(p=!1),l=i,Ge(r,h)?(o=se(r,o),n=se(r,n),c=se(r,c),Ge(r,h)?(u=se(r,u),g=[i,o,n,c,u]):g=[i,o,n,c]):g=[i],f.push(g),r.pos++}p||dn(f),s.push(f),r.pos=h+1}while(r.pos<=e);return s}v(ln,"K");he(ln,"decode");function dn(t){t.sort(un)}v(dn,"Q$1");he(dn,"sort");function un(t,e){return t[0]-e[0]}v(un,"X$3");he(un,"sortComparator");function fn(t){const e=new wr;let r=0,s=0,i=0,o=0;for(let n=0;n<t.length;n++){const c=t[n];if(n>0&&e.write(nn),c.length===0)continue;let u=0;for(let h=0;h<c.length;h++){const f=c[h];h>0&&e.write(ct),u=Z(e,f[0],u),f.length!==1&&(r=Z(e,f[1],r),s=Z(e,f[2],s),i=Z(e,f[3],i),f.length!==4&&(o=Z(e,f[4],o)))}}return e.flush()}v(fn,"Z$1");he(fn,"encode");var wc=Object.defineProperty,be=v((t,e)=>wc(t,"name",{value:e,configurable:!0}),"c$3");const yc=/^[\w+.-]+:\/\//,$c=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,xc=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function hn(t){return yc.test(t)}v(hn,"R$3");be(hn,"isAbsoluteUrl");function pn(t){return t.startsWith("//")}v(pn,"q$1");be(pn,"isSchemeRelativeUrl");function kr(t){return t.startsWith("/")}v(kr,"m$1");be(kr,"isAbsolutePath");function gn(t){return t.startsWith("file:")}v(gn,"v$3");be(gn,"isFileUrl");function rr(t){return/^[.?#]/.test(t)}v(rr,"u$1");be(rr,"isRelative");function mt(t){const e=$c.exec(t);return br(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}v(mt,"f$5");be(mt,"parseAbsoluteUrl");function mn(t){const e=xc.exec(t),r=e[2];return br("file:","",e[1]||"","",kr(r)?r:"/"+r,e[3]||"",e[4]||"")}v(mn,"w$4");be(mn,"parseFileUrl");function br(t,e,r,s,i,o,n){return{scheme:t,user:e,host:r,port:s,path:i,query:o,hash:n,type:7}}v(br,"y$5");be(br,"makeUrl");function sr(t){if(pn(t)){const r=mt("http:"+t);return r.scheme="",r.type=6,r}if(kr(t)){const r=mt("http://foo.com"+t);return r.scheme="",r.host="",r.type=5,r}if(gn(t))return mn(t);if(hn(t))return mt(t);const e=mt("http://foo.com/"+t);return e.scheme="",e.host="",e.type=t?t.startsWith("?")?3:t.startsWith("#")?2:4:1,e}v(sr,"p$4");be(sr,"parseUrl");function vn(t){if(t.endsWith("/.."))return t;const e=t.lastIndexOf("/");return t.slice(0,e+1)}v(vn,"P$3");be(vn,"stripPathFilename");function wn(t,e){jr(e,e.type),t.path==="/"?t.path=e.path:t.path=vn(e.path)+t.path}v(wn,"A$2");be(wn,"mergePaths");function jr(t,e){const r=e<=4,s=t.path.split("/");let i=1,o=0,n=!1;for(let u=1;u<s.length;u++){const h=s[u];if(!h){n=!0;continue}if(n=!1,h!=="."){if(h===".."){o?(n=!0,o--,i--):r&&(s[i++]=h);continue}s[i++]=h,o++}}let c="";for(let u=1;u<i;u++)c+="/"+s[u];(!c||n&&!c.endsWith("/.."))&&(c+="/"),t.path=c}v(jr,"d$3");be(jr,"normalizePath");function yn(t,e){if(!t&&!e)return"";const r=sr(t);let s=r.type;if(e&&s!==7){const o=sr(e),n=o.type;switch(s){case 1:r.hash=o.hash;case 2:r.query=o.query;case 3:case 4:wn(r,o);case 5:r.user=o.user,r.host=o.host,r.port=o.port;case 6:r.scheme=o.scheme}n>s&&(s=n)}jr(r,s);const i=r.query+r.hash;switch(s){case 2:case 3:return i;case 4:{const o=r.path.slice(1);return o?rr(e||t)&&!rr(o)?"./"+o+i:o+i:i||"."}case 5:return r.path+i;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+i}}v(yn,"F$2");be(yn,"resolve");var kc=Object.defineProperty,W=v((t,e)=>kc(t,"name",{value:e,configurable:!0}),"i$2");function $n(t){if(!t)return"";const e=t.lastIndexOf("/");return t.slice(0,e+1)}v($n,"ae");W($n,"stripFilename");function xn(t,e){const r=$n(t),s=e?e+"/":"";return i=>yn(s+(i||""),r)}v(xn,"ge");W(xn,"resolver");var Fe=0,Sr=1,Tr=2,Cr=3,kn=4,bn=1,jn=2;function Sn(t,e){const r=nr(t,0);if(r===t.length)return t;e||(t=t.slice());for(let s=r;s<t.length;s=nr(t,s+1))t[s]=Cn(t[s],e);return t}v(Sn,"he");W(Sn,"maybeSort");function nr(t,e){for(let r=e;r<t.length;r++)if(!Tn(t[r]))return r;return t.length}v(nr,"X$2");W(nr,"nextUnsortedSegmentLine");function Tn(t){for(let e=1;e<t.length;e++)if(t[e][Fe]<t[e-1][Fe])return!1;return!0}v(Tn,"_e$1");W(Tn,"isSorted");function Cn(t,e){return e||(t=t.slice()),t.sort(Ir)}v(Cn,"ve");W(Cn,"sortSegments");function Ir(t,e){return t[Fe]-e[Fe]}v(Ir,"$$4");W(Ir,"sortComparator");function In(t,e){const r=e.map(()=>[]);for(let s=0;s<t.length;s++){const i=t[s];for(let o=0;o<i.length;o++){const n=i[o];if(n.length===1)continue;const c=n[Sr],u=n[Tr],h=n[Cr],f=r[c];(f[u]||(f[u]=[])).push([h,s,n[Fe]])}}for(let s=0;s<r.length;s++){const i=r[s];for(let o=0;o<i.length;o++){const n=i[o];n&&n.sort(Ir)}}return r}v(In,"Se");W(In,"buildBySources");var Xe=!1;function Rn(t,e,r,s){for(;r<=s;){const i=r+(s-r>>1),o=t[i][Fe]-e;if(o===0)return Xe=!0,i;o<0?r=i+1:s=i-1}return Xe=!1,r-1}v(Rn,"Ee");W(Rn,"binarySearch");function Rr(t,e,r){for(let s=r+1;s<t.length&&t[s][Fe]===e;r=s++);return r}v(Rr,"H");W(Rr,"upperBound");function Er(t,e,r){for(let s=r-1;s>=0&&t[s][Fe]===e;r=s--);return r}v(Er,"Y");W(Er,"lowerBound");function Mr(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}v(Mr,"k$4");W(Mr,"memoizedState");function En(t,e,r,s){const{lastKey:i,lastNeedle:o,lastIndex:n}=r;let c=0,u=t.length-1;if(s===i){if(e===o)return Xe=n!==-1&&t[n][Fe]===e,n;e>=o?c=n===-1?0:n:u=n}return r.lastKey=s,r.lastNeedle=e,r.lastIndex=Rn(t,e,c,u)}v(En,"Me$1");W(En,"memoizedBinarySearch");function Gt(t){return typeof t=="string"?JSON.parse(t):t}v(Gt,"j$3");W(Gt,"parse");var bc=W(function(t,e){const r=Gt(t);if(!("sections"in r))return new Pr(r,e);const s=[],i=[],o=[],n=[],c=[];Or(r,e,s,i,o,n,c,0,0,1/0,1/0);const u={version:3,file:r.file,names:n,sources:i,sourcesContent:o,mappings:s,ignoreList:c};return Bn(u)},"FlattenMap");function Or(t,e,r,s,i,o,n,c,u,h,f){const{sections:p}=t;for(let l=0;l<p.length;l++){const{map:g,offset:y}=p[l];let R=h,B=f;if(l+1<p.length){const x=p[l+1].offset;R=Math.min(h,c+x.line),R===h?B=Math.min(f,u+x.column):R<h&&(B=u+x.column)}Mn(g,e,r,s,i,o,n,c+y.line,u+y.column,R,B)}}v(Or,"ee");W(Or,"recurse");function Mn(t,e,r,s,i,o,n,c,u,h,f){const p=Gt(t);if("sections"in p)return Or(...arguments);const l=new Pr(p,e),g=s.length,y=o.length,R=tt(l),{resolvedSources:B,sourcesContent:x,ignoreList:k}=l;if(Et(s,B),Et(o,l.names),x)Et(i,x);else for(let M=0;M<B.length;M++)i.push(null);if(k)for(let M=0;M<k.length;M++)n.push(k[M]+g);for(let M=0;M<R.length;M++){const S=c+M;if(S>h)return;const C=On(r,S),w=M===0?u:0,j=R[M];for(let A=0;A<j.length;A++){const P=j[A],q=w+P[Fe];if(S===h&&q>=f)return;if(P.length===1){C.push([q]);continue}const oe=g+P[Sr],Q=P[Tr],V=P[Cr];C.push(P.length===4?[q,oe,Q,V]:[q,oe,Q,V,y+P[kn]])}}}v(Mn,"me");W(Mn,"addSection");function Et(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}v(Et,"G$1");W(Et,"append");function On(t,e){for(let r=t.length;r<=e;r++)t[r]=[];return t[e]}v(On,"xe$1");W(On,"getLine");var Pn="`line` must be greater than 0 (lines start at line 1)",Fn="`column` must be greater than or equal to 0 (columns start at column 0)",Lt=-1,qt=1,Pr=class{static{v(this,"R")}static{W(this,"TraceMap")}constructor(e,r){const s=typeof e=="string";if(!s&&e._decodedMemo)return e;const i=Gt(e),{version:o,file:n,names:c,sourceRoot:u,sources:h,sourcesContent:f}=i;this.version=o,this.file=n,this.names=c||[],this.sourceRoot=u,this.sources=h,this.sourcesContent=f,this.ignoreList=i.ignoreList||i.x_google_ignoreList||void 0;const p=xn(r,u);this.resolvedSources=h.map(p);const{mappings:l}=i;if(typeof l=="string")this._encoded=l,this._decoded=void 0;else if(Array.isArray(l))this._encoded=void 0,this._decoded=Sn(l,s);else throw i.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(i)}`);this._decodedMemo=Mr(),this._bySources=void 0,this._bySourceMemos=void 0}};function An(t){var e,r;return(r=(e=t)._encoded)!=null?r:e._encoded=fn(t._decoded)}v(An,"oe");W(An,"encodedMappings");function tt(t){var e;return(e=t)._decoded||(e._decoded=ln(t._encoded))}v(tt,"O$2");W(tt,"decodedMappings");function jc(t,e,r){const s=tt(t);if(e>=s.length)return null;const i=s[e],o=xt(i,t._decodedMemo,e,r,qt);return o===-1?null:i[o]}v(jc,"Oe$1");W(jc,"traceSegment");function Ln(t,e){let{line:r,column:s,bias:i}=e;if(r--,r<0)throw new Error(Pn);if(s<0)throw new Error(Fn);const o=tt(t);if(r>=o.length)return vt(null,null,null,null);const n=o[r],c=xt(n,t._decodedMemo,r,s,i||qt);if(c===-1)return vt(null,null,null,null);const u=n[c];if(u.length===1)return vt(null,null,null,null);const{names:h,resolvedSources:f}=t;return vt(f[u[Sr]],u[Tr]+1,u[Cr],u.length===5?h[u[kn]]:null)}v(Ln,"Le$1");W(Ln,"originalPositionFor");function Sc(t,e){const{source:r,line:s,column:i,bias:o}=e;return Ar(t,r,s,i,o||qt,!1)}v(Sc,"ye");W(Sc,"generatedPositionFor");function Tc(t,e){const{source:r,line:s,column:i,bias:o}=e;return Ar(t,r,s,i,o||Lt,!0)}v(Tc,"Ce$1");W(Tc,"allGeneratedPositionsFor");function Cc(t,e){const r=tt(t),{names:s,resolvedSources:i}=t;for(let o=0;o<r.length;o++){const n=r[o];for(let c=0;c<n.length;c++){const u=n[c],h=o+1,f=u[0];let p=null,l=null,g=null,y=null;u.length!==1&&(p=i[u[1]],l=u[2]+1,g=u[3]),u.length===5&&(y=s[u[4]]),e({generatedLine:h,generatedColumn:f,source:p,originalLine:l,originalColumn:g,name:y})}}}v(Cc,"Ie");W(Cc,"eachMapping");function Fr(t,e){const{sources:r,resolvedSources:s}=t;let i=r.indexOf(e);return i===-1&&(i=s.indexOf(e)),i}v(Fr,"re");W(Fr,"sourceIndex");function Dn(t,e){const{sourcesContent:r}=t;if(r==null)return null;const s=Fr(t,e);return s===-1?null:r[s]}v(Dn,"Ne");W(Dn,"sourceContentFor");function Ic(t,e){const{ignoreList:r}=t;if(r==null)return!1;const s=Fr(t,e);return s===-1?!1:r.includes(s)}v(Ic,"be");W(Ic,"isIgnored");function Bn(t,e){const r=new Pr(Ut(t,[]),e);return r._decoded=t.mappings,r}v(Bn,"se");W(Bn,"presortedDecodedMap");function Rc(t){return Ut(t,tt(t))}v(Rc,"Re");W(Rc,"decodedMap");function Ec(t){return Ut(t,An(t))}v(Ec,"we$1");W(Ec,"encodedMap");function Ut(t,e){return{version:t.version,file:t.file,names:t.names,sourceRoot:t.sourceRoot,sources:t.sources,sourcesContent:t.sourcesContent,mappings:e,ignoreList:t.ignoreList||t.x_google_ignoreList}}v(Ut,"B$2");W(Ut,"clone");function vt(t,e,r,s){return{source:t,line:e,column:r,name:s}}v(vt,"b$2");W(vt,"OMapping");function it(t,e){return{line:t,column:e}}v(it,"y$4");W(it,"GMapping");function xt(t,e,r,s,i){let o=En(t,s,e,r);return Xe?o=(i===Lt?Rr:Er)(t,s,o):i===Lt&&o++,o===-1||o===t.length?-1:o}v(xt,"w$3");W(xt,"traceSegmentInternal");function Nn(t,e,r,s,i){let o=xt(t,e,r,s,qt);if(!Xe&&i===Lt&&o++,o===-1||o===t.length)return[];const n=Xe?s:t[o][Fe];Xe||(o=Er(t,n,o));const c=Rr(t,n,o),u=[];for(;o<=c;o++){const h=t[o];u.push(it(h[bn]+1,h[jn]))}return u}v(Nn,"Ue");W(Nn,"sliceGeneratedPositions");function Ar(t,e,r,s,i,o){var n,c;if(r--,r<0)throw new Error(Pn);if(s<0)throw new Error(Fn);const{sources:u,resolvedSources:h}=t;let f=u.indexOf(e);if(f===-1&&(f=h.indexOf(e)),f===-1)return o?[]:it(null,null);const p=(n=t)._bySourceMemos||(n._bySourceMemos=u.map(Mr)),l=((c=t)._bySources||(c._bySources=In(tt(t),p)))[f][r];if(l==null)return o?[]:it(null,null);const g=p[f];if(o)return Nn(l,g,r,s,i);const y=xt(l,g,r,s,i);if(y===-1)return it(null,null);const R=l[y];return it(R[bn]+1,R[jn])}v(Ar,"ie");W(Ar,"generatedPosition");var Mc=Object.defineProperty,Oc=v((t,e)=>Mc(t,"name",{value:e,configurable:!0}),"u"),Pc=Object.defineProperty,_n=Oc((t,e)=>Pc(t,"name",{value:e,configurable:!0}),"c");const Fc=jo(import.meta.url),gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lr=_n(t=>{if(typeof gt<"u"&&gt.versions&&gt.versions.node){const[e,r]=gt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return gt.getBuiltinModule(t)}return Fc(t)},"__cjs_getBuiltinModule"),{readFileSync:Cs}=Lr("node:fs"),{resolve:Ac,toNamespacedPath:Jt,dirname:Lc}=Lr("node:path"),{pathToFileURL:Dc}=Lr("node:url");var Bc=Object.defineProperty,kt=_n((t,e)=>Bc(t,"name",{value:e,configurable:!0}),"s");const Nc=/^data:application\/json[^,]+base64,/,_c=/^[a-z][a-z0-9+.-]*:\/\//i,Gc=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,qc=/\r?\n/,Gn=kt(t=>Nc.test(t),"isInlineMap"),Qt=kt((t,e)=>{const r=t instanceof Error?t.message:String(t),s=`${e}:
15
+ ${r}`;throw new Error(s)},"enhanceError"),Uc=kt((t,e)=>{const r=t.split(qc);let s;for(let o=r.length-1;o>=0&&!s;o--)s=Gc.exec(r[o])??void 0;if(!s)return;const i=s[1]??s[2];if(i){if(Gn(i))return i;if(!/^data:/i.test(i)&&!(_c.test(i)&&!i.startsWith("file:")))return Ac(e,i)}},"resolveSourceMapUrl"),Wc=kt(t=>{const e=t.slice(t.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),Hc=kt(t=>{let e;try{e=Cs(t,{encoding:"utf8"})}catch(o){Qt(o,`Error reading sourcemap for file "${Jt(t)}"`)}const r=Uc(e,Lc(t));if(!r)return;let s;const i=Gn(r);if(i)s=Wc(r);else try{s=Cs(r,{encoding:"utf8"})}catch(o){Qt(o,`Error reading sourcemap for file "${Jt(t)}"`)}try{const o=i?r:Dc(r).href;return new bc(s,o)}catch(o){Qt(o,`Error parsing sourcemap for file "${Jt(t)}"`)}},"loadSourceMap");var zc=Object.defineProperty,Pe=v((t,e)=>zc(t,"name",{value:e,configurable:!0}),"l$3");const Vc=Pe(t=>aa(t),"stripAnsi"),Kc=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,Yc=/^\s*at\s+/,Jc=Pe(t=>{const e=t.split(`
16
+ `);let r;for(let s=0;s<e.length;s++){const i=Kc.exec(e[s].trim());if(!i)continue;const o=[];for(let n=s+1;n<e.length&&n<=s+200;n++){const c=e[n];if(Yc.test(c))o.push(c.trim());else if(o.length>0||c.trim()!=="")break}if(o.length>0){const n=i.groups?.name??"Error",c=i.groups?.message??"";r={message:c,name:n,stack:`${n}: ${c}
17
17
  ${o.map(u=>` ${u}`).join(`
18
- `)}`}}}return r},"extractErrorBlock"),Gn=Pe(t=>{if(t.startsWith("file://"))try{return $o(t)}catch{return t}return t},"normalizeFramePath"),Jc=Pe(t=>!t.includes("node_modules")&&!t.startsWith("node:")&&!t.startsWith("internal/"),"isUserFrame"),Xc=Pe(t=>{try{return Wc(t)}catch{return}},"tryLoadSourceMap"),Qc=Pe((t,e)=>{if(!t.file||t.line===void 0)return;const r=Gn(t.file),s=vo(r)?r:fs(e,r);if(!Jc(s)||!Ze(s))return;const i=Xc(s);if(i){const o=An(i,{column:t.column===void 0?0:Math.max(0,t.column-1),line:t.line});if(o.source&&o.line!=null){const n=fs(wo(s),o.source),c=Ln(i,o.source)??(Ze(n)?at(n,"utf8"):void 0);if(c!==void 0)return{column:o.column==null?void 0:o.column+1,file:n,line:o.line,source:c}}}return{column:t.column,file:s,line:t.line,source:at(s,"utf8")}},"resolveFrame"),Cs=Pe((t,e)=>{const r=yo(e,t);return r&&!r.startsWith("..")?r:t},"shortPath"),qn=Pe((t,e)=>{if(!t?.trim())return t;try{const r=Yc(zc(t));if(!r)return t;const s=new Error(r.message);s.name=r.name,s.stack=r.stack;const i=hi(s);if(i.length===0)return t;const o=e.color,n={dim:Pe(l=>o?hs(l):l,"dim"),head:Pe(l=>o?ko(Vt(l)):l,"head"),loc:Pe(l=>o?xo(l):l,"loc")};let c,u;for(const l of i){const g=Qc(l,e.cwd);if(g){c=g,u=l;break}}const h=[n.head(`✖ ${r.name}${r.message?`: ${r.message}`:""}`)];if(c){const l=`${Cs(c.file,e.cwd)}:${c.line}${c.column?`:${c.column}`:""}`;h.push(` ${n.loc(l)}`,""),h.push(uc(c.source,{start:{column:c.column,line:c.line}},{color:o?{gutter:hs,marker:Vt,message:Vt}:void 0,linesAbove:2,linesBelow:3}))}const f=i.filter(l=>l!==u).slice(0,8).map(l=>{const g=l.methodName??"<anonymous>",y=l.file?`${Cs(Gn(l.file),e.cwd)}${l.line?`:${l.line}`:""}`:"";return n.dim(` at ${g}${y?` (${y})`:""}`)});f.length>0&&h.push("",...f);const p=n.dim("─".repeat(40));return`${h.join(`
18
+ `)}`}}}return r},"extractErrorBlock"),qn=Pe(t=>{if(t.startsWith("file://"))try{return xo(t)}catch{return t}return t},"normalizeFramePath"),Qc=Pe(t=>!t.includes("node_modules")&&!t.startsWith("node:")&&!t.startsWith("internal/"),"isUserFrame"),Xc=Pe(t=>{try{return Hc(t)}catch{return}},"tryLoadSourceMap"),Zc=Pe((t,e)=>{if(!t.file||t.line===void 0)return;const r=qn(t.file),s=wo(r)?r:hs(e,r);if(!Qc(s)||!Ze(s))return;const i=Xc(s);if(i){const o=Ln(i,{column:t.column===void 0?0:Math.max(0,t.column-1),line:t.line});if(o.source&&o.line!=null){const n=hs(yo(s),o.source),c=Dn(i,o.source)??(Ze(n)?at(n,"utf8"):void 0);if(c!==void 0)return{column:o.column==null?void 0:o.column+1,file:n,line:o.line,source:c}}}return{column:t.column,file:s,line:t.line,source:at(s,"utf8")}},"resolveFrame"),Is=Pe((t,e)=>{const r=$o(e,t);return r&&!r.startsWith("..")?r:t},"shortPath"),Un=Pe((t,e)=>{if(!t?.trim())return t;try{const r=Jc(Vc(t));if(!r)return t;const s=new Error(r.message);s.name=r.name,s.stack=r.stack;const i=pi(s);if(i.length===0)return t;const o=e.color,n={dim:Pe(l=>o?ps(l):l,"dim"),head:Pe(l=>o?bo(Vt(l)):l,"head"),loc:Pe(l=>o?ko(l):l,"loc")};let c,u;for(const l of i){const g=Zc(l,e.cwd);if(g){c=g,u=l;break}}const h=[n.head(`✖ ${r.name}${r.message?`: ${r.message}`:""}`)];if(c){const l=`${Is(c.file,e.cwd)}:${c.line}${c.column?`:${c.column}`:""}`;h.push(` ${n.loc(l)}`,""),h.push(fc(c.source,{start:{column:c.column,line:c.line}},{color:o?{gutter:ps,marker:Vt,message:Vt}:void 0,linesAbove:2,linesBelow:3}))}const f=i.filter(l=>l!==u).slice(0,8).map(l=>{const g=l.methodName??"<anonymous>",y=l.file?`${Is(qn(l.file),e.cwd)}${l.line?`:${l.line}`:""}`:"";return n.dim(` at ${g}${y?` (${y})`:""}`)});f.length>0&&h.push("",...f);const p=n.dim("─".repeat(40));return`${h.join(`
19
19
  `)}
20
20
  ${p}
21
- ${t}`}catch{return t}},"renderFailureOutput");var Zc=Object.defineProperty,Le=v((t,e)=>Zc(t,"name",{value:e,configurable:!0}),"t");const Un={delimiter:" ",language:{d:Le(()=>" d","d"),future:"in %s",h:Le(()=>" h","h"),m:Le(()=>" m","m"),mo:Le(()=>" mo","mo"),ms:Le(()=>" ms","ms"),past:"%s ago",s:Le(()=>" s","s"),w:Le(()=>" w","w"),y:Le(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Le(t=>{const e=t[0]*1e3+t[1]/1e6;return Ys(e,Un)},"formatHrtime");const et=Le(t=>Ys(t,Un),"formatMs");var el=Object.defineProperty,rt=v((t,e)=>el(t,"name",{value:e,configurable:!0}),"s$1");const ot=rt(t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache","isCacheStatus"),bt=rt(t=>{switch(t){case"failure":return{color:"red",icon:lr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Ws};case"skipped":return{color:"gray",icon:Nt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),wt=rt(t=>{const{color:e,icon:r}=bt(t);return $e(te.createElement(d,{color:e},r),{columns:10}).trim()},"getStatusIcon"),tl=rt(t=>{const{color:e,icon:r}=bt(t);switch(t){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return $e(te.createElement(d,null,te.createElement(d,{color:e},r)," ",te.createElement(d,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return $e(te.createElement(d,null,te.createElement(d,{dimColor:!0},r)," ",te.createElement(d,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return $e(te.createElement(d,{color:e},r),{columns:10}).trim()}},"getStatusPrefix"),rl=rt(t=>t==="azure"||t==="buildkite"||t==="github"||t==="gitlab"||t==="off"?t:process.env.GITHUB_ACTIONS==="true"?"github":process.env.GITLAB_CI==="true"?"gitlab":process.env.BUILDKITE==="true"?"buildkite":process.env.TF_BUILD?.toLowerCase()==="true"?"azure":"off","resolveCiGroupingMode"),sl=rt(t=>{const e=t.replaceAll(/\W+/g,"_"),r=jo("sha256").update(t).digest("hex").slice(0,6);return`${e}_${r}`},"toGitLabSectionKey"),nl=rt((t,e,r,s="auto")=>{const i=r.trim();if(!i)return;const o=`
22
- `,n=rl(s);if(n==="github"&&e!=="failure"){process.stdout.write(`::group::${wt(e)} ${t}${o}`),process.stdout.write(i+o),process.stdout.write(`::endgroup::${o}`);return}if(n==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),l=sl(t),g="\x1B[0K";process.stdout.write(`${g}section_start:${String(p)}:${l}[collapsed=true]\r${g}${wt(e)} ${t}${o}`),process.stdout.write(i+o);const y=Math.floor(Date.now()/1e3);process.stdout.write(`${g}section_end:${String(y)}:${l}\r${g}${o}`);return}if(n==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${wt(e)} ${t}${o}`),process.stdout.write(i+o);return}if(n==="azure"&&e!=="failure"){process.stdout.write(`##[group]${wt(e)} ${t}${o}`),process.stdout.write(i+o),process.stdout.write(`##[endgroup]${o}`);return}const c=process.stdout.columns||80,u=$e(te.createElement(d,{dimColor:!0},Nt.repeat(c)),{columns:c}).trim(),h=tl(e),f=$e(te.createElement(d,{bold:!0},t),{columns:c}).trim();process.stdout.write(`${u}${o}`),process.stdout.write(`${h} ${f}${o}`),process.stdout.write(i+o),process.stdout.write(`${u}${o}`)},"logCommandOutputCI");var il=Object.defineProperty,Dr=v((t,e)=>il(t,"name",{value:e,configurable:!0}),"d$1");const ol=Dr(t=>t==="running"?{color:"white",icon:"•"}:t==="pending"?{color:"gray",icon:"·"}:bt(t),"getDisplayInfo"),al=Dr(({autoScroll:t,focused:e,interactiveMode:r,showFullscreenHint:s,statusValue:i,supportsInteractive:o,taskId:n})=>{if(!n)return;if(r)return"Esc cancel | Enter send";const c=t?"":" PAUSED (f resume)",u=o?" i INPUT":"";return e&&i==="running"&&s?`⏎ FULLSCREEN${u} f FOLLOW${c}`:e&&i==="running"?`f FOLLOW${u}${c}`:e&&s?`<enter> full screen${c}`:e?c||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),Is=Dr(({autoScroll:t=!0,duration:e,focused:r,interactiveMode:s,output:i,scrollRef:o,showFullscreenHint:n,status:c,supportsInteractive:u=!0,taskId:h})=>{const f=c??"pending",{icon:p}=ol(f),l=r?"bold":"single",g=f==="failure"?"red":f==="success"||ot(f)?r?"green":"gray":f==="running"?r?"white":"cyan":r?"white":"gray",y=h?`${p} ${h}`:void 0,I=e===void 0?void 0:et(e),D=al({autoScroll:t,focused:r,interactiveMode:s??!1,showFullscreenHint:n??!1,statusValue:f,supportsInteractive:u,taskId:h});if(!h)return a.jsxs($,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[a.jsx(d,{dimColor:!0,children:"Select a task to view output"}),a.jsx(d,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const x=[];if(i)for(const k of i.split(`
23
- `))x.push(k.endsWith("\r")?k.slice(0,-1):k);return!i&&(f==="running"||f==="pending")?a.jsx($,{borderBottomTitle:D,borderColor:g,borderStyle:l,borderTopRightTitle:I,borderTopTitle:y,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:a.jsx($,{alignItems:"center",flexGrow:1,justifyContent:"center",children:a.jsx(d,{dimColor:!0,children:"Waiting for task output…"})})}):a.jsxs($,{borderBottomTitle:D,borderColor:s?"yellow":g,borderStyle:l,borderTopRightTitle:I,borderTopTitle:y,flexDirection:"column",flexGrow:1,children:[a.jsx($,{flexGrow:1,flexShrink:1,paddingY:1,children:a.jsx(qs,{flexGrow:1,followOutput:t,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.jsx(d,{children:x.join(`
24
- `)})})}),s&&a.jsx($,{flexShrink:0,justifyContent:"center",paddingX:1,children:a.jsx(d,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var cl=Object.defineProperty,lt=v((t,e)=>cl(t,"name",{value:e,configurable:!0}),"d");const ll={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Wn=lt(t=>t==="ready"?"green":t==="crashed"||t==="failed"?"red":t==="starting"?"cyan":"gray","statusColor"),dl=lt(({status:t})=>t==="starting"?a.jsx(d,{color:"cyan",children:a.jsx(zs,{type:"dots"})}):a.jsx(d,{bold:!0,color:Wn(t),children:ll[t]}),"StatusGlyph"),ul=lt(({active:t,focused:e,state:r})=>{const s=e&&t,i=s?">":" ",o=r.status==="ready"?r.port?`running, port ${String(r.port)}`:"running":r.status==="failed"||r.status==="crashed"?r.errorMessage??"exited":r.lastLine??"booting…";return a.jsxs($,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[a.jsx(d,{children:i}),a.jsx(d,{children:" "}),a.jsx($,{flexShrink:0,width:3,children:a.jsx(dl,{status:r.status})}),a.jsx($,{flexGrow:0,flexShrink:0,width:28,children:a.jsx(d,{bold:s,inverse:s,children:r.id})}),a.jsx($,{flexGrow:1,flexShrink:1,overflow:"hidden",children:a.jsxs(d,{color:Wn(r.status),dimColor:r.status!=="crashed"&&r.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},"ServiceRow"),fl=lt(({states:t})=>{const e=[];for(const s of t)s.status==="ready"&&e.push(s.id);const r=e.join(", ");return a.jsxs($,{paddingX:1,children:[a.jsxs(d,{bold:!0,color:"green",children:["● ","Services"]}),a.jsxs(d,{children:[" ",String(e.length)," / ",String(t.length)," running"]}),r.length>0&&a.jsxs(d,{dimColor:!0,children:[" ",r]}),a.jsx(d,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),hl=lt(({states:t})=>{const e=t.find(r=>r.status==="crashed"||r.status==="failed");return e?a.jsxs($,{flexDirection:"column",paddingX:1,children:[a.jsxs(d,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((r,s)=>a.jsxs(d,{color:"red",dimColor:!0,children:[" ",r]},`crash-${String(s)}`))]}):a.jsx(a.Fragment,{})},"CrashHeader"),pl=lt(({activeIndex:t,focused:e,store:r})=>{const s=K.useSyncExternalStore(r.subscribe,r.getSnapshot),i=r.getIds();if(i.length===0)return a.jsx(a.Fragment,{});const o=i.map(f=>s.get(f)).filter(f=>f!==void 0),n=r.getDockState(),c=n==="crash"?"red":n==="ready"?"gray":e?"white":"cyan",u=n==="crash"?"Services (crashed)":n==="ready"?"Services":"Services (starting)",h=e?n==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services";return n==="ready"&&!e?a.jsx($,{borderColor:c,borderStyle:"single",flexDirection:"row",flexShrink:0,children:a.jsx(fl,{states:o})}):a.jsxs($,{borderBottomTitle:h,borderColor:c,borderStyle:e?"bold":"single",borderTopTitle:u,flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[n==="crash"&&a.jsx(hl,{states:o}),o.map((f,p)=>a.jsx(ul,{active:p===t,focused:e,state:f},f.id))]})},"ServiceDock");var gl=Object.defineProperty,Wt=v((t,e)=>gl(t,"name",{value:e,configurable:!0}),"T$2");const Hn=6,zn=8,Vn=12,ml=Wt(t=>t==="running"||t==="pending"?Hs:t==="local-cache"||t==="local-cache-kept-existing"?"Local":t==="remote-cache"?"Remote":Nt,"getCacheLabel"),Rs=Wt((t,e)=>e[0]===t?"[1]":e[1]===t?"[2]":"","getPinLabel"),Es=Wt(({compact:t,focused:e,isSelected:r,pinLabel:s,row:i})=>{const{persistent:o,status:n,taskId:c}=i,u=e&&r,h=u?">":" ",f=n==="running"&&o===!0;let p;if(f)p=a.jsx(d,{bold:!0,color:"green",children:" ● "});else if(n==="running")p=a.jsxs(d,{bold:!0,color:"white",children:[" ",a.jsx(zs,{type:"dots"})," "]});else if(n==="pending")p=a.jsx(d,{bold:!0,color:"gray",children:" · "});else{const{color:g,icon:y}=bt(n);p=a.jsxs(d,{bold:!0,color:g,children:[" ",y," "]})}let l=Hs;return f?l="running":n!=="running"&&n!=="pending"?l=i.duration===void 0?Nt:et(i.duration):n==="running"&&i.elapsed!==void 0&&(l=et(i.elapsed)),a.jsxs($,{children:[a.jsx(d,{children:h}),a.jsx($,{width:Hn,children:p}),a.jsxs($,{flexGrow:1,children:[a.jsx(d,{bold:u,inverse:u,children:c}),s?a.jsx(d,{dimColor:!0,children:` ${s}`}):null]}),!t&&a.jsx($,{justifyContent:"flex-end",width:zn,children:a.jsx(d,{dimColor:!ot(n),children:ml(n)})}),!t&&a.jsx($,{justifyContent:"flex-end",width:Vn,children:a.jsx(d,{color:f?"green":void 0,dimColor:n==="pending"||f,children:l})})]})},"TaskListRow"),Os=Wt(({compact:t,filterActive:e,filterText:r,focused:s,headerStatus:i,parallelSlots:o=3,pinnedTaskIds:n,rows:c,scrollRef:u,selectedIndex:h,title:f})=>{const p=i==="error"?"red":i==="success"?"green":s?"white":"gray",l=c[h]?.taskId,g=[];let y=0;for(const k of c)k.status==="running"?g.push(k):k.status==="pending"&&(y+=1);const I=Math.min(o,g.length+y),D=I>1,x=[];if(D)for(let k=0;k<I;k++){const E=g[k];E?x.push(a.jsx(Es,{compact:t,focused:s,isSelected:E.taskId===l,pinLabel:Rs(E.taskId,n),row:E},`par-${E.taskId}`)):x.push(a.jsxs($,{children:[a.jsx(d,{children:" "}),a.jsx($,{width:Hn,children:a.jsx(d,{bold:!0,color:"gray",children:" · "})}),a.jsx(d,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(k)}`))}return a.jsxs($,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[a.jsxs($,{flexShrink:0,paddingX:1,children:[a.jsx(d,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(d,{children:` ${f}`}),!t&&a.jsxs($,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[a.jsx($,{justifyContent:"flex-end",width:zn,children:a.jsx(d,{dimColor:!0,children:"Cache"})}),a.jsx($,{justifyContent:"flex-end",width:Vn,children:a.jsx(d,{dimColor:!0,children:"Duration"})})]})]}),a.jsx(qs,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:u,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:c.map(k=>a.jsx(Es,{compact:t,focused:s,isSelected:k.taskId===l,pinLabel:Rs(k.taskId,n),row:k},k.taskId))}),D&&a.jsx($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:x}),e&&a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[a.jsx(d,{bold:!0,color:"white",children:"/ "}),a.jsx(d,{children:r}),a.jsx(d,{inverse:!0,children:" "})]})]})},"TaskListPanel");var vl=Object.defineProperty,wl=v((t,e)=>vl(t,"name",{value:e,configurable:!0}),"ue");const Ms=40,Ps=10,Fs=100,yl=Object.freeze([]),$l=wl(({autoExitSeconds:t,onRetryService:e,parallelSlots:r,projectNames:s,serviceDockStore:i,stdinRegistry:o,store:n,targets:c,tasks:u})=>{const{exit:h}=pi(),{columns:f,rows:p}=gi(),l=K.useSyncExternalStore(n.subscribe,n.getSnapshot),g=K.useCallback(M=>i?i.subscribe(M):()=>{},[i]);K.useSyncExternalStore(g,()=>i?i.getDockState():"ready");const y=i?i.getIds():yl,I=y.length>0,[D,x]=K.useState(0),[k,E]=K.useState(null),S=K.useSyncExternalStore(g,()=>k&&i?i.getState(k):void 0),[C,w]=K.useState(!1),j=K.useRef(null),F=K.useRef(null),P=K.useRef(null),[q,ae]=K.useState(!1),[Q,V]=K.useState(!0),ce=K.useRef({list:0,splitList:0,splitOutput:0}),Re=K.useCallback(()=>{l.viewMode==="list"?ce.current.list=F.current?.getScrollOffset()??0:l.viewMode==="split"&&(ce.current.splitList=F.current?.getScrollOffset()??0,ce.current.splitOutput=P.current?.getScrollOffset()??0)},[l.viewMode]),ie=K.useCallback(M=>{setTimeout(()=>{if(M==="list"){const T=ce.current.list;F.current?.scrollTo(T)}else if(M==="split"){const T=ce.current.splitList;T>0?F.current?.scrollTo(T):F.current?.scrollTo(Math.max(0,n.getSnapshot().selectedIndex-2)),P.current?.scrollTo(ce.current.splitOutput)}},0)},[n]),ge=K.useRef(!1);K.useEffect(()=>{l.done&&!ge.current&&(ge.current=!0,t>0&&ae(!0)),!l.done&&ge.current&&(ge.current=!1,ae(!1))},[l.done,t]);const Y=K.useMemo(()=>{const M=y.length>0?new Set(y):null,T=l.filterText?l.filterText.toLowerCase():null,A=[];for(const X of l.rows)M?.has(X.taskId)||l.statusFilter==="failed"&&X.status!=="failure"||l.statusFilter==="running"&&X.status!=="running"&&X.status!=="pending"||l.statusFilter==="passed"&&X.status!=="success"&&!ot(X.status)||T&&!X.taskId.toLowerCase().includes(T)||A.push(X);return A},[l.rows,l.filterText,l.statusFilter,y]),re=K.useMemo(()=>{let M=0;for(const T of l.rows)T.status==="running"&&(M+=1);return M},[l.rows]),ue=(Y[l.selectedIndex]??null)?.taskId??null,de=k?null:l.pinnedTaskIds[0]??ue,N=de?l.rows.find(M=>M.taskId===de):null,J=S??null,me=k?(J?.tailLines??[]).join(`
25
- `):de?l.outputs.get(de)??"":"",Ve=K.useMemo(()=>N?.status==="failure"&&me?qn(me,{color:!process.env.NO_COLOR,cwd:process.cwd()}):me,[N?.status,me]),Ke=k??de,st=k?J?.status==="crashed"||J?.status==="failed"?"failure":"running":N?.status,oe=mr(s,c,u),Ae=l.done?`Completed ${oe} (${et((l.endTime??Date.now())-l.startTime)})`:`Running ${oe}...`,qe=l.done?l.failed>0?"error":"success":"running",xe=K.useCallback(M=>{F.current?.scrollTo(Math.max(0,M-2))},[]);if(K.useEffect(()=>{l.interactiveMode&&N?.status!=="running"&&n.setInteractiveMode(!1)},[l.interactiveMode,N?.status,n]),K.useEffect(()=>{if(!de)return;let M=f;l.viewMode==="split"&&f>=Fs?M=f-Math.floor(f*.4)-2:(l.viewMode==="split"||l.viewMode==="fullscreen")&&(M=f-2);const T=Math.max(1,p-4);o.get(de)?.resize?.(M,T)},[f,p,l.viewMode,de]),os((M,T)=>{if(T.escape){n.setInteractiveMode(!1);return}if(!de)return;const A=o.get(de);if(!A){n.setInteractiveMode(!1);return}if(T.return)A.write("\r");else if(T.upArrow)A.write("\x1B[A");else if(T.downArrow)A.write("\x1B[B");else if(T.rightArrow)A.write("\x1B[C");else if(T.leftArrow)A.write("\x1B[D");else if(T.backspace)A.write("");else if(T.delete)A.write("\x1B[3~");else if(T.tab)A.write(" ");else if(T.home)A.write("\x1B[H");else if(T.end)A.write("\x1B[F");else if(T.pageUp)A.write("\x1B[5~");else if(T.pageDown)A.write("\x1B[6~");else if(T.ctrl&&M){const X=M.toUpperCase().codePointAt(0);X!==void 0&&X>=65&&X<=90&&A.write(String.fromCodePoint(X-64))}else M&&A.write(M)},{isActive:l.interactiveMode}),os((M,T)=>{if(M==="c"&&T.ctrl){h();return}if(!q){if(C){T.escape||M==="?"?w(!1):M==="q"?(w(!1),ae(!0)):T.downArrow||M==="j"?j.current?.scrollBy(1):T.upArrow||M==="k"?j.current?.scrollBy(-1):T.pageDown?j.current?.scrollBy(5):T.pageUp?j.current?.scrollBy(-5):T.home?j.current?.scrollToTop():T.end&&j.current?.scrollToBottom();return}if(M==="?"){w(!0);return}if(M==="q"){ae(!0);return}if(M==="r"&&l.done){n.requestRerun();return}if(M==="R"&&l.done){const A=Y[l.selectedIndex];A?.status==="failure"&&n.requestRetry(A.taskId);return}if(M==="F"&&!l.filterActive){const A=["all","failed","running","passed"],X=A.indexOf(l.statusFilter);n.setStatusFilter(A[(X+1)%A.length]);return}if(l.filterActive){if(T.escape){n.setFilterActive(!1);return}if(T.return){n.setFilterActive(!1);return}if(T.backspace){n.setFilter(l.filterText.slice(0,-1));return}if(M&&!T.ctrl&&!T.meta){n.setFilter(l.filterText+M);return}return}if(M==="i"&&N?.status==="running"&&(l.viewMode==="fullscreen"||l.viewMode==="split"&&l.focusedPanel==="output")){n.setInteractiveMode(!0);return}if(l.viewMode==="fullscreen"){if(T.escape){n.setViewMode("split"),ie("split");return}if(M==="f"){const A=!Q;V(A),A&&P.current?.scrollToBottom();return}if(T.downArrow||M==="j"){V(!1),P.current?.scrollBy(1);return}if(T.upArrow||M==="k"){V(!1),P.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&M==="d"){V(!1),P.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&M==="u"){V(!1),P.current?.scrollBy(-12);return}if(T.home){V(!1),P.current?.scrollToTop();return}if(T.end){V(!0),P.current?.scrollToBottom();return}return}if(l.focusedPanel==="dock"&&I&&i){if(T.tab){E(null),n.setFocusedPanel("tasks");return}if(T.escape){n.setFocusedPanel("tasks"),E(null),l.viewMode==="split"&&(n.setViewMode("list"),ie("list"));return}if(T.downArrow||M==="j"){x(A=>Math.min(A+1,y.length-1));return}if(T.upArrow||M==="k"){x(A=>Math.max(A-1,0));return}if(T.return){const A=y[D];A&&(E(A),V(!0),Re(),ce.current.splitList=0,ce.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),ie("split"));return}if((M==="r"||M==="R")&&e){const A=y[D],X=A?i.getState(A)?.status:void 0;if(A&&(X==="crashed"||X==="failed")){const Ye=e(A);Ye instanceof Promise&&Ye.catch(()=>{})}return}return}if(l.viewMode==="split"){if(T.tab){l.focusedPanel==="tasks"?n.setFocusedPanel("output"):I?n.setFocusedPanel("dock"):(E(null),n.setFocusedPanel("tasks"));return}if(l.focusedPanel==="output"){if(T.escape){if(k&&I){E(null),n.setViewMode("list"),n.setFocusedPanel("dock"),ie("list");return}E(null),n.setFocusedPanel("tasks");return}if(T.return){Re(),n.setViewMode("fullscreen");return}if(M==="f"){const A=!Q;V(A),A&&P.current?.scrollToBottom();return}if(T.downArrow||M==="j"){V(!1),P.current?.scrollBy(1);return}if(T.upArrow||M==="k"){V(!1),P.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&M==="d"){V(!1),P.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&M==="u"){V(!1),P.current?.scrollBy(-12);return}if(T.home){V(!1),P.current?.scrollToTop();return}if(T.end){V(!0),P.current?.scrollToBottom();return}return}if(T.escape){n.setViewMode("list"),ie("list");return}if(T.return){n.setFocusedPanel("output");return}}if(l.viewMode==="list"||l.viewMode==="split"&&l.focusedPanel==="tasks"){if(T.tab&&l.viewMode==="list"&&I){n.setFocusedPanel("dock");return}if(T.downArrow||M==="j"){const A=Math.min(l.selectedIndex+1,Math.max(0,Y.length-1));n.setSelectedIndex(A),xe(A);return}if(T.upArrow||M==="k"){const A=Math.max(l.selectedIndex-1,0);n.setSelectedIndex(A),xe(A);return}if(T.return&&l.viewMode==="list"){V(!0),Re(),ce.current.splitList=0,ce.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),ie("split");return}if(M==="/"){n.setFilterActive(!0);return}if(M==="1"&&ue){n.pinTask(0,ue);return}if(M==="2"&&ue){n.pinTask(1,ue);return}if(M==="0"){n.clearPins();return}T.escape&&l.filterText&&n.setFilter("")}}},{isActive:!l.interactiveMode}),f<Ms||p<Ps)return a.jsx($,{alignItems:"center",height:p,justifyContent:"center",width:f,children:a.jsxs(d,{color:"yellow",children:["Terminal too small (",f,"x",p,"). Minimum:"," ",Ms,"x",Ps]})});const Ue=a.jsxs($,{gap:1,children:[l.succeeded>0&&a.jsxs(d,{bold:!0,color:"green",children:["✓"," ",l.succeeded]}),l.failed>0&&a.jsxs(d,{bold:!0,color:"red",children:["✗"," ",l.failed]}),re>0&&a.jsxs(d,{color:"cyan",children:["◷"," ",re]}),a.jsxs(d,{dimColor:!0,children:[l.rows.length," ","total"]}),l.statusFilter!=="all"&&a.jsxs(d,{color:"yellow",children:["[",l.statusFilter,"]"]})]});let Ee;if(l.viewMode==="fullscreen")Ee=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Esc"}),a.jsx(d,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"^u ^d"}),a.jsx(d,{dimColor:!0,children:"PAGE"})]},"page"),...N?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"i"}),a.jsx(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q")];else if(l.done){const M=Y[l.selectedIndex]?.status==="failure";Ee=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"r"}),a.jsx(d,{dimColor:!0,children:"RERUN"})]},"r"),...M?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"R"}),a.jsx(d,{dimColor:!0,children:"RETRY"})]},"R")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"F"}),a.jsx(d,{dimColor:!0,children:"FILTER"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else l.viewMode==="split"&&l.focusedPanel==="output"?Ee=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Esc"}),a.jsx(d,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),...N?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"i"}),a.jsx(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Tab"}),a.jsx(d,{dimColor:!0,children:"PANEL"})]},"tab"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?")]:Ee=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"/"}),a.jsx(d,{dimColor:!0,children:"FILTER"})]},"/"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"F"}),a.jsx(d,{dimColor:!0,children:"STATUS"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...l.viewMode==="split"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Tab"}),a.jsx(d,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const ke=a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[a.jsx($,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Ee}),a.jsx($,{flexShrink:0,paddingX:1,children:Ue})]}),We=a.jsxs(mi,{backgroundColor:"#1e1e1e",footer:a.jsxs(d,{dimColor:!0,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",a.jsx(d,{bold:!0,color:"white",children:"?"}),"/",a.jsx(d,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:j,title:"KEYBOARD SHORTCUTS",visible:C,width:52,children:[a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"NAVIGATION"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(d,{dimColor:!0,children:" Move up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(d,{dimColor:!0,children:" Move down"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Tab"]}),a.jsx(d,{dimColor:!0,children:" Switch panel (split)"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsx(d,{dimColor:!0,children:" Back / close"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsx(d,{dimColor:!0,children:" Show output / fullscreen"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"VIEWS"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsxs(d,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsxs(d,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"ACTIONS"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","/"]}),a.jsx(d,{dimColor:!0,children:" Filter by text"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","F"]}),a.jsx(d,{dimColor:!0,children:" Filter by status"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","1"]}),a.jsx(d,{dimColor:!0,children:"/"}),a.jsx(d,{bold:!0,color:"white",children:"2"}),a.jsx(d,{dimColor:!0,children:" Pin to output pane"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","0"]}),a.jsx(d,{dimColor:!0,children:" Clear pins"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","r"]}),a.jsx(d,{dimColor:!0,children:" Rerun all (done)"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","R"]}),a.jsx(d,{dimColor:!0,children:" Retry failed task"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","i"]}),a.jsx(d,{dimColor:!0,children:" Interactive input (running task)"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"SCROLLING"}),a.jsx(d,{dimColor:!0,children:" (output panel)"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(d,{dimColor:!0,children:" Scroll up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(d,{dimColor:!0,children:" Scroll down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","^u"]}),a.jsx(d,{dimColor:!0,children:" Page up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","^d"]}),a.jsx(d,{dimColor:!0,children:" Page down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Home"]}),a.jsx(d,{dimColor:!0,children:" Top"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","End"]}),a.jsx(d,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","f"]}),a.jsx(d,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"GENERAL"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","q"]}),a.jsx(d,{dimColor:!0,children:" Quit"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","?"]}),a.jsx(d,{dimColor:!0,children:" Toggle help"})]})]})]})]}),be=a.jsx(vi,{autoExitSeconds:t>0?t:3,onCancel:v(()=>{ae(!1)},"onCancel"),visible:q}),we=I&&i?a.jsx(pl,{activeIndex:D,focused:l.focusedPanel==="dock",store:i}):null;if(l.viewMode==="fullscreen")return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Is,{autoScroll:Q,duration:N?.duration??N?.elapsed,focused:!0,interactiveMode:l.interactiveMode,output:Ve,scrollRef:P,status:st,supportsInteractive:!k,taskId:Ke})}),we,ke,be,We]});if(l.viewMode==="split"){const M=f>=Fs,T=a.jsx(Os,{compact:!0,filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel==="tasks",headerStatus:qe,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:Y,scrollRef:F,selectedIndex:l.selectedIndex,title:Ae}),A=a.jsx(Is,{autoScroll:Q,duration:N?.duration??N?.elapsed,focused:l.focusedPanel==="output",interactiveMode:l.interactiveMode,output:Ve,scrollRef:P,showFullscreenHint:!0,status:st,supportsInteractive:!k,taskId:Ke});if(M){const Ye=Math.floor(f*.4);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsxs($,{flexDirection:"row",flexGrow:1,children:[a.jsx($,{width:Ye,children:T}),a.jsx($,{flexGrow:1,children:A})]}),we,ke,be,We]})}const X=Math.floor(p*.45);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{height:X,children:T}),a.jsx($,{flexGrow:1,children:A}),we,ke,be,We]})}return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Os,{filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel!=="dock",headerStatus:qe,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:Y,scrollRef:F,selectedIndex:l.selectedIndex,title:Ae})}),we,ke,be,We]})},"VisTaskRunnerApp");var xl=Object.defineProperty,Xe=v((t,e)=>xl(t,"name",{value:e,configurable:!0}),"r$1");const kl=Xe(t=>{const{args:e,autoExit:r=!1,onRetryService:s,outputStyle:i="normal",projectNames:o,serviceDockStore:n,stdinRegistry:c,tasks:u}=t,h=new At(u),f=typeof e.parallel=="number"?e.parallel:3,p=r===!0?3:typeof r=="number"?r:0;let l,g;const y=new Promise(j=>{g=j});let I;const D=Xe(()=>{I&&(clearInterval(I),I=void 0)},"cleanup"),x=Xe(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),k=Xe(()=>{if(c){for(const j of c.values())j.kill?.();c.clear()}},"killAllPtyProcesses"),E=Xe(()=>{D(),w(),k(),x(),process.stdout.write("\x1B[?1049l\x1B[?25h"),l?.cleanup(),process.exit(1)},"onSignal"),S=Xe(()=>{const j=h.getSnapshot(),F=et(Date.now()-j.startTime),P=j.rows.filter(Q=>Q.status==="failure").map(Q=>Q.taskId),q=process.stdout.columns||80;process.stdout.write(`
26
- `);for(const Q of j.rows){const{persistent:V,status:ce,taskId:Re}=Q,ie=ce==="running"||ce==="pending",ge=bt(ce),Y=ie&&V?"■":ge.icon,re=ie&&V?"gray":ge.color;let ue="";switch(ce){case"local-cache":case"local-cache-kept-existing":{ue=" [local cache]";break}case"remote-cache":{ue=" [remote cache]";break}case"skipped":{ue=" [skipped]";break}default:{ie&&V?ue=" [stopped]":ie&&(ue=" [skipped]");break}}const de=Q.retryAttempts&&Q.retryAttempts>0?` [retried ${Q.retryAttempts}x]`:"",N=$e(te.createElement(d,null," ",te.createElement(d,{color:re},Y),` vis run ${Re}`,ue?te.createElement(d,{dimColor:!0},` ${ue}`):null,de?te.createElement(d,{color:"yellow"},de):null),{columns:q});process.stdout.write(`${N}
21
+ ${t}`}catch{return t}},"renderFailureOutput");var el=Object.defineProperty,Ae=v((t,e)=>el(t,"name",{value:e,configurable:!0}),"t");const Wn={delimiter:" ",language:{d:Ae(()=>" d","d"),future:"in %s",h:Ae(()=>" h","h"),m:Ae(()=>" m","m"),mo:Ae(()=>" mo","mo"),ms:Ae(()=>" ms","ms"),past:"%s ago",s:Ae(()=>" s","s"),w:Ae(()=>" w","w"),y:Ae(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Ae(t=>{const e=t[0]*1e3+t[1]/1e6;return Js(e,Wn)},"formatHrtime");const et=Ae(t=>Js(t,Wn),"formatMs");var tl=Object.defineProperty,rt=v((t,e)=>tl(t,"name",{value:e,configurable:!0}),"s$1");const ot=rt(t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache","isCacheStatus"),bt=rt(t=>{switch(t){case"failure":return{color:"red",icon:lr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Hs};case"skipped":return{color:"gray",icon:Nt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),wt=rt(t=>{const{color:e,icon:r}=bt(t);return ye(ee.createElement(d,{color:e},r),{columns:10}).trim()},"getStatusIcon"),rl=rt(t=>{const{color:e,icon:r}=bt(t);switch(t){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return ye(ee.createElement(d,null,ee.createElement(d,{color:e},r)," ",ee.createElement(d,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return ye(ee.createElement(d,null,ee.createElement(d,{dimColor:!0},r)," ",ee.createElement(d,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return ye(ee.createElement(d,{color:e},r),{columns:10}).trim()}},"getStatusPrefix"),sl=rt(t=>t==="azure"||t==="buildkite"||t==="github"||t==="gitlab"||t==="off"?t:process.env.GITHUB_ACTIONS==="true"?"github":process.env.GITLAB_CI==="true"?"gitlab":process.env.BUILDKITE==="true"?"buildkite":process.env.TF_BUILD?.toLowerCase()==="true"?"azure":"off","resolveCiGroupingMode"),nl=rt(t=>{const e=t.replaceAll(/\W+/g,"_"),r=So("sha256").update(t).digest("hex").slice(0,6);return`${e}_${r}`},"toGitLabSectionKey"),il=rt((t,e,r,s="auto")=>{const i=r.trim();if(!i)return;const o=`
22
+ `,n=sl(s);if(n==="github"&&e!=="failure"){process.stdout.write(`::group::${wt(e)} ${t}${o}`),process.stdout.write(i+o),process.stdout.write(`::endgroup::${o}`);return}if(n==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),l=nl(t),g="\x1B[0K";process.stdout.write(`${g}section_start:${String(p)}:${l}[collapsed=true]\r${g}${wt(e)} ${t}${o}`),process.stdout.write(i+o);const y=Math.floor(Date.now()/1e3);process.stdout.write(`${g}section_end:${String(y)}:${l}\r${g}${o}`);return}if(n==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${wt(e)} ${t}${o}`),process.stdout.write(i+o);return}if(n==="azure"&&e!=="failure"){process.stdout.write(`##[group]${wt(e)} ${t}${o}`),process.stdout.write(i+o),process.stdout.write(`##[endgroup]${o}`);return}const c=process.stdout.columns||80,u=ye(ee.createElement(d,{dimColor:!0},Nt.repeat(c)),{columns:c}).trim(),h=rl(e),f=ye(ee.createElement(d,{bold:!0},t),{columns:c}).trim();process.stdout.write(`${u}${o}`),process.stdout.write(`${h} ${f}${o}`),process.stdout.write(i+o),process.stdout.write(`${u}${o}`)},"logCommandOutputCI");var ol=Object.defineProperty,Dr=v((t,e)=>ol(t,"name",{value:e,configurable:!0}),"d$1");const al=Dr(t=>t==="running"?{color:"white",icon:"•"}:t==="pending"?{color:"gray",icon:"·"}:bt(t),"getDisplayInfo"),cl=Dr(({autoScroll:t,focused:e,interactiveMode:r,showFullscreenHint:s,statusValue:i,supportsInteractive:o,taskId:n})=>{if(!n)return;if(r)return"Esc cancel | Enter send";const c=t?"":" PAUSED (f resume)",u=o?" i INPUT":"";return e&&i==="running"&&s?`⏎ FULLSCREEN${u} f FOLLOW${c}`:e&&i==="running"?`f FOLLOW${u}${c}`:e&&s?`<enter> full screen${c}`:e?c||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),Rs=Dr(({autoScroll:t=!0,duration:e,focused:r,interactiveMode:s,output:i,scrollRef:o,showFullscreenHint:n,status:c,supportsInteractive:u=!0,taskId:h})=>{const f=c??"pending",{icon:p}=al(f),l=r?"bold":"single",g=f==="failure"?"red":f==="success"||ot(f)?r?"green":"gray":f==="running"?r?"white":"cyan":r?"white":"gray",y=h?`${p} ${h}`:void 0,R=e===void 0?void 0:et(e),B=cl({autoScroll:t,focused:r,interactiveMode:s??!1,showFullscreenHint:n??!1,statusValue:f,supportsInteractive:u,taskId:h});if(!h)return a.jsxs($,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[a.jsx(d,{dimColor:!0,children:"Select a task to view output"}),a.jsx(d,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const x=[];if(i)for(const k of i.split(`
23
+ `))x.push(k.endsWith("\r")?k.slice(0,-1):k);return!i&&(f==="running"||f==="pending")?a.jsx($,{borderBottomTitle:B,borderColor:g,borderStyle:l,borderTopRightTitle:R,borderTopTitle:y,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:a.jsx($,{alignItems:"center",flexGrow:1,justifyContent:"center",children:a.jsx(d,{dimColor:!0,children:"Waiting for task output…"})})}):a.jsxs($,{borderBottomTitle:B,borderColor:s?"yellow":g,borderStyle:l,borderTopRightTitle:R,borderTopTitle:y,flexDirection:"column",flexGrow:1,children:[a.jsx($,{flexGrow:1,flexShrink:1,paddingY:1,children:a.jsx(Us,{flexGrow:1,followOutput:t,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.jsx(d,{children:x.join(`
24
+ `)})})}),s&&a.jsx($,{flexShrink:0,justifyContent:"center",paddingX:1,children:a.jsx(d,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var ll=Object.defineProperty,lt=v((t,e)=>ll(t,"name",{value:e,configurable:!0}),"d");const dl={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Hn=lt(t=>t==="ready"?"green":t==="crashed"||t==="failed"?"red":t==="starting"?"cyan":"gray","statusColor"),ul=lt(({status:t})=>t==="starting"?a.jsx(d,{color:"cyan",children:a.jsx(Vs,{type:"dots"})}):a.jsx(d,{bold:!0,color:Hn(t),children:dl[t]}),"StatusGlyph"),fl=lt(({active:t,focused:e,state:r})=>{const s=e&&t,i=s?">":" ",o=r.status==="ready"?r.port?`running, port ${String(r.port)}`:"running":r.status==="failed"||r.status==="crashed"?r.errorMessage??"exited":r.lastLine??"booting…";return a.jsxs($,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[a.jsx(d,{children:i}),a.jsx(d,{children:" "}),a.jsx($,{flexShrink:0,width:3,children:a.jsx(ul,{status:r.status})}),a.jsx($,{flexGrow:0,flexShrink:0,width:28,children:a.jsx(d,{bold:s,inverse:s,children:r.id})}),a.jsx($,{flexGrow:1,flexShrink:1,overflow:"hidden",children:a.jsxs(d,{color:Hn(r.status),dimColor:r.status!=="crashed"&&r.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},"ServiceRow"),hl=lt(({states:t})=>{const e=[];for(const s of t)s.status==="ready"&&e.push(s.id);const r=e.join(", ");return a.jsxs($,{paddingX:1,children:[a.jsxs(d,{bold:!0,color:"green",children:["● ","Services"]}),a.jsxs(d,{children:[" ",String(e.length)," / ",String(t.length)," running"]}),r.length>0&&a.jsxs(d,{dimColor:!0,children:[" ",r]}),a.jsx(d,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),pl=lt(({states:t})=>{const e=t.find(r=>r.status==="crashed"||r.status==="failed");return e?a.jsxs($,{flexDirection:"column",paddingX:1,children:[a.jsxs(d,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((r,s)=>a.jsxs(d,{color:"red",dimColor:!0,children:[" ",r]},`crash-${String(s)}`))]}):a.jsx(a.Fragment,{})},"CrashHeader"),gl=lt(({activeIndex:t,focused:e,store:r})=>{const s=K.useSyncExternalStore(r.subscribe,r.getSnapshot),i=r.getIds();if(i.length===0)return a.jsx(a.Fragment,{});const o=i.map(f=>s.get(f)).filter(f=>f!==void 0),n=r.getDockState(),c=n==="crash"?"red":n==="ready"?"gray":e?"white":"cyan",u=n==="crash"?"Services (crashed)":n==="ready"?"Services":"Services (starting)",h=e?n==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services";return n==="ready"&&!e?a.jsx($,{borderColor:c,borderStyle:"single",flexDirection:"row",flexShrink:0,children:a.jsx(hl,{states:o})}):a.jsxs($,{borderBottomTitle:h,borderColor:c,borderStyle:e?"bold":"single",borderTopTitle:u,flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[n==="crash"&&a.jsx(pl,{states:o}),o.map((f,p)=>a.jsx(fl,{active:p===t,focused:e,state:f},f.id))]})},"ServiceDock");var ml=Object.defineProperty,Wt=v((t,e)=>ml(t,"name",{value:e,configurable:!0}),"T$2");const zn=6,Vn=8,Kn=12,vl=Wt(t=>t==="running"||t==="pending"?zs:t==="local-cache"||t==="local-cache-kept-existing"?"Local":t==="remote-cache"?"Remote":Nt,"getCacheLabel"),Es=Wt((t,e)=>e[0]===t?"[1]":e[1]===t?"[2]":"","getPinLabel"),Ms=Wt(({compact:t,focused:e,isSelected:r,pinLabel:s,row:i})=>{const{persistent:o,status:n,taskId:c}=i,u=e&&r,h=u?">":" ",f=n==="running"&&o===!0;let p;if(f)p=a.jsx(d,{bold:!0,color:"green",children:" ● "});else if(n==="running")p=a.jsxs(d,{bold:!0,color:"white",children:[" ",a.jsx(Vs,{type:"dots"})," "]});else if(n==="pending")p=a.jsx(d,{bold:!0,color:"gray",children:" · "});else{const{color:g,icon:y}=bt(n);p=a.jsxs(d,{bold:!0,color:g,children:[" ",y," "]})}let l=zs;return f?l="running":n!=="running"&&n!=="pending"?l=i.duration===void 0?Nt:et(i.duration):n==="running"&&i.elapsed!==void 0&&(l=et(i.elapsed)),a.jsxs($,{children:[a.jsx(d,{children:h}),a.jsx($,{width:zn,children:p}),a.jsxs($,{flexGrow:1,children:[a.jsx(d,{bold:u,inverse:u,children:c}),s?a.jsx(d,{dimColor:!0,children:` ${s}`}):null]}),!t&&a.jsx($,{justifyContent:"flex-end",width:Vn,children:a.jsx(d,{dimColor:!ot(n),children:vl(n)})}),!t&&a.jsx($,{justifyContent:"flex-end",width:Kn,children:a.jsx(d,{color:f?"green":void 0,dimColor:n==="pending"||f,children:l})})]})},"TaskListRow"),Os=Wt(({compact:t,filterActive:e,filterText:r,focused:s,headerStatus:i,parallelSlots:o=3,pinnedTaskIds:n,rows:c,scrollRef:u,selectedIndex:h,title:f})=>{const p=i==="error"?"red":i==="success"?"green":s?"white":"gray",l=c[h]?.taskId,g=[];let y=0;for(const k of c)k.status==="running"?g.push(k):k.status==="pending"&&(y+=1);const R=Math.min(o,g.length+y),B=R>1,x=[];if(B)for(let k=0;k<R;k++){const M=g[k];M?x.push(a.jsx(Ms,{compact:t,focused:s,isSelected:M.taskId===l,pinLabel:Es(M.taskId,n),row:M},`par-${M.taskId}`)):x.push(a.jsxs($,{children:[a.jsx(d,{children:" "}),a.jsx($,{width:zn,children:a.jsx(d,{bold:!0,color:"gray",children:" · "})}),a.jsx(d,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(k)}`))}return a.jsxs($,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[a.jsxs($,{flexShrink:0,paddingX:1,children:[a.jsx(d,{bold:!0,inverse:!0,children:" VIS "}),a.jsx(d,{children:` ${f}`}),!t&&a.jsxs($,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[a.jsx($,{justifyContent:"flex-end",width:Vn,children:a.jsx(d,{dimColor:!0,children:"Cache"})}),a.jsx($,{justifyContent:"flex-end",width:Kn,children:a.jsx(d,{dimColor:!0,children:"Duration"})})]})]}),a.jsx(Us,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:u,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:c.map(k=>a.jsx(Ms,{compact:t,focused:s,isSelected:k.taskId===l,pinLabel:Es(k.taskId,n),row:k},k.taskId))}),B&&a.jsx($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:x}),e&&a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[a.jsx(d,{bold:!0,color:"white",children:"/ "}),a.jsx(d,{children:r}),a.jsx(d,{inverse:!0,children:" "})]})]})},"TaskListPanel");var wl=Object.defineProperty,yl=v((t,e)=>wl(t,"name",{value:e,configurable:!0}),"ue");const Ps=40,Fs=10,As=100,$l=Object.freeze([]),xl=yl(({autoExitSeconds:t,onRetryService:e,parallelSlots:r,projectNames:s,serviceDockStore:i,stdinRegistry:o,store:n,targets:c,tasks:u})=>{const{exit:h}=gi(),{columns:f,rows:p}=mi(),l=K.useSyncExternalStore(n.subscribe,n.getSnapshot),g=K.useCallback(E=>i?i.subscribe(E):()=>{},[i]);K.useSyncExternalStore(g,()=>i?i.getDockState():"ready");const y=i?i.getIds():$l,R=y.length>0,[B,x]=K.useState(0),[k,M]=K.useState(null),S=K.useSyncExternalStore(g,()=>k&&i?i.getState(k):void 0),[C,w]=K.useState(!1),j=K.useRef(null),A=K.useRef(null),P=K.useRef(null),[q,oe]=K.useState(!1),[Q,V]=K.useState(!0),ae=K.useRef({list:0,splitList:0,splitOutput:0}),Ie=K.useCallback(()=>{l.viewMode==="list"?ae.current.list=A.current?.getScrollOffset()??0:l.viewMode==="split"&&(ae.current.splitList=A.current?.getScrollOffset()??0,ae.current.splitOutput=P.current?.getScrollOffset()??0)},[l.viewMode]),ne=K.useCallback(E=>{setTimeout(()=>{if(E==="list"){const T=ae.current.list;A.current?.scrollTo(T)}else if(E==="split"){const T=ae.current.splitList;T>0?A.current?.scrollTo(T):A.current?.scrollTo(Math.max(0,n.getSnapshot().selectedIndex-2)),P.current?.scrollTo(ae.current.splitOutput)}},0)},[n]),pe=K.useRef(!1);K.useEffect(()=>{l.done&&!pe.current&&(pe.current=!0,t>0&&oe(!0)),!l.done&&pe.current&&(pe.current=!1,oe(!1))},[l.done,t]);const $e=K.useMemo(()=>{const E=y.length>0?new Set(y):null,T=l.filterText?l.filterText.toLowerCase():null,F=[];for(const ie of l.rows)E?.has(ie.taskId)||l.statusFilter==="failed"&&ie.status!=="failure"||l.statusFilter==="running"&&ie.status!=="running"&&ie.status!=="pending"||l.statusFilter==="passed"&&ie.status!=="success"&&!ot(ie.status)||T&&!ie.taskId.toLowerCase().includes(T)||F.push(ie);return F},[l.rows,l.filterText,l.statusFilter,y]),J=K.useMemo(()=>{let E=0;for(const T of l.rows)T.status==="running"&&(E+=1);return E},[l.rows]),Y=($e[l.selectedIndex]??null)?.taskId??null,ue=k?null:l.pinnedTaskIds[0]??Y,ce=ue?l.rows.find(E=>E.taskId===ue):null,L=S??null,ge=k?(L?.tailLines??[]).join(`
25
+ `):ue?l.outputs.get(ue)??"":"",We=K.useMemo(()=>ce?.status==="failure"&&ge?Un(ge,{color:!process.env.NO_COLOR,cwd:process.cwd()}):ge,[ce?.status,ge]),Ke=k??ue,st=k?L?.status==="crashed"||L?.status==="failed"?"failure":"running":ce?.status,Ye=mr(s,c,u),re=l.done?`Completed ${Ye} (${et((l.endTime??Date.now())-l.startTime)})`:`Running ${Ye}...`,He=l.done?l.failed>0?"error":"success":"running",De=K.useCallback(E=>{A.current?.scrollTo(Math.max(0,E-2))},[]);if(K.useEffect(()=>{l.interactiveMode&&ce?.status!=="running"&&n.setInteractiveMode(!1)},[l.interactiveMode,ce?.status,n]),K.useEffect(()=>{if(!ue)return;let E=f;l.viewMode==="split"&&f>=As?E=f-Math.floor(f*.4)-2:(l.viewMode==="split"||l.viewMode==="fullscreen")&&(E=f-2);const T=Math.max(1,p-4);o.get(ue)?.resize?.(E,T)},[f,p,l.viewMode,ue]),as((E,T)=>{if(T.escape){n.setInteractiveMode(!1);return}if(!ue)return;const F=o.get(ue);if(!F){n.setInteractiveMode(!1);return}if(T.return)F.write("\r");else if(T.upArrow)F.write("\x1B[A");else if(T.downArrow)F.write("\x1B[B");else if(T.rightArrow)F.write("\x1B[C");else if(T.leftArrow)F.write("\x1B[D");else if(T.backspace)F.write("");else if(T.delete)F.write("\x1B[3~");else if(T.tab)F.write(" ");else if(T.home)F.write("\x1B[H");else if(T.end)F.write("\x1B[F");else if(T.pageUp)F.write("\x1B[5~");else if(T.pageDown)F.write("\x1B[6~");else if(T.ctrl&&E){const ie=E.toUpperCase().codePointAt(0);ie!==void 0&&ie>=65&&ie<=90&&F.write(String.fromCodePoint(ie-64))}else E&&F.write(E)},{isActive:l.interactiveMode}),as((E,T)=>{if(E==="c"&&T.ctrl){h();return}if(!q){if(C){T.escape||E==="?"?w(!1):E==="q"?(w(!1),oe(!0)):T.downArrow||E==="j"?j.current?.scrollBy(1):T.upArrow||E==="k"?j.current?.scrollBy(-1):T.pageDown?j.current?.scrollBy(5):T.pageUp?j.current?.scrollBy(-5):T.home?j.current?.scrollToTop():T.end&&j.current?.scrollToBottom();return}if(E==="?"){w(!0);return}if(E==="q"){oe(!0);return}if(E==="r"&&l.done){n.requestRerun();return}if(E==="R"&&l.done){const F=$e[l.selectedIndex];F?.status==="failure"&&n.requestRetry(F.taskId);return}if(E==="F"&&!l.filterActive){const F=["all","failed","running","passed"],ie=F.indexOf(l.statusFilter);n.setStatusFilter(F[(ie+1)%F.length]);return}if(l.filterActive){if(T.escape){n.setFilterActive(!1);return}if(T.return){n.setFilterActive(!1);return}if(T.backspace){n.setFilter(l.filterText.slice(0,-1));return}if(E&&!T.ctrl&&!T.meta){n.setFilter(l.filterText+E);return}return}if(E==="i"&&ce?.status==="running"&&(l.viewMode==="fullscreen"||l.viewMode==="split"&&l.focusedPanel==="output")){n.setInteractiveMode(!0);return}if(l.viewMode==="fullscreen"){if(T.escape){n.setViewMode("split"),ne("split");return}if(E==="f"){const F=!Q;V(F),F&&P.current?.scrollToBottom();return}if(T.downArrow||E==="j"){V(!1),P.current?.scrollBy(1);return}if(T.upArrow||E==="k"){V(!1),P.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&E==="d"){V(!1),P.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&E==="u"){V(!1),P.current?.scrollBy(-12);return}if(T.home){V(!1),P.current?.scrollToTop();return}if(T.end){V(!0),P.current?.scrollToBottom();return}return}if(l.focusedPanel==="dock"&&R&&i){if(T.tab){M(null),n.setFocusedPanel("tasks");return}if(T.escape){n.setFocusedPanel("tasks"),M(null),l.viewMode==="split"&&(n.setViewMode("list"),ne("list"));return}if(T.downArrow||E==="j"){x(F=>Math.min(F+1,y.length-1));return}if(T.upArrow||E==="k"){x(F=>Math.max(F-1,0));return}if(T.return){const F=y[B];F&&(M(F),V(!0),Ie(),ae.current.splitList=0,ae.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),ne("split"));return}if((E==="r"||E==="R")&&e){const F=y[B],ie=F?i.getState(F)?.status:void 0;if(F&&(ie==="crashed"||ie==="failed")){const ve=e(F);ve instanceof Promise&&ve.catch(()=>{})}return}return}if(l.viewMode==="split"){if(T.tab){l.focusedPanel==="tasks"?n.setFocusedPanel("output"):R?n.setFocusedPanel("dock"):(M(null),n.setFocusedPanel("tasks"));return}if(l.focusedPanel==="output"){if(T.escape){if(k&&R){M(null),n.setViewMode("list"),n.setFocusedPanel("dock"),ne("list");return}M(null),n.setFocusedPanel("tasks");return}if(T.return){Ie(),n.setViewMode("fullscreen");return}if(E==="f"){const F=!Q;V(F),F&&P.current?.scrollToBottom();return}if(T.downArrow||E==="j"){V(!1),P.current?.scrollBy(1);return}if(T.upArrow||E==="k"){V(!1),P.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&E==="d"){V(!1),P.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&E==="u"){V(!1),P.current?.scrollBy(-12);return}if(T.home){V(!1),P.current?.scrollToTop();return}if(T.end){V(!0),P.current?.scrollToBottom();return}return}if(T.escape){n.setViewMode("list"),ne("list");return}if(T.return){n.setFocusedPanel("output");return}}if(l.viewMode==="list"||l.viewMode==="split"&&l.focusedPanel==="tasks"){if(T.tab&&l.viewMode==="list"&&R){n.setFocusedPanel("dock");return}if(T.downArrow||E==="j"){const F=Math.min(l.selectedIndex+1,Math.max(0,$e.length-1));n.setSelectedIndex(F),De(F);return}if(T.upArrow||E==="k"){const F=Math.max(l.selectedIndex-1,0);n.setSelectedIndex(F),De(F);return}if(T.return&&l.viewMode==="list"){V(!0),Ie(),ae.current.splitList=0,ae.current.splitOutput=0,n.setViewMode("split"),n.setFocusedPanel("output"),ne("split");return}if(E==="/"){n.setFilterActive(!0);return}if(E==="1"&&Y){n.pinTask(0,Y);return}if(E==="2"&&Y){n.pinTask(1,Y);return}if(E==="0"){n.clearPins();return}T.escape&&l.filterText&&n.setFilter("")}}},{isActive:!l.interactiveMode}),f<Ps||p<Fs)return a.jsx($,{alignItems:"center",height:p,justifyContent:"center",width:f,children:a.jsxs(d,{color:"yellow",children:["Terminal too small (",f,"x",p,"). Minimum:"," ",Ps,"x",Fs]})});const Re=a.jsxs($,{gap:1,children:[l.succeeded>0&&a.jsxs(d,{bold:!0,color:"green",children:["✓"," ",l.succeeded]}),l.failed>0&&a.jsxs(d,{bold:!0,color:"red",children:["✗"," ",l.failed]}),J>0&&a.jsxs(d,{color:"cyan",children:["◷"," ",J]}),a.jsxs(d,{dimColor:!0,children:[l.rows.length," ","total"]}),l.statusFilter!=="all"&&a.jsxs(d,{color:"yellow",children:["[",l.statusFilter,"]"]})]});let xe;if(l.viewMode==="fullscreen")xe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Esc"}),a.jsx(d,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"^u ^d"}),a.jsx(d,{dimColor:!0,children:"PAGE"})]},"page"),...ce?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"i"}),a.jsx(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q")];else if(l.done){const E=$e[l.selectedIndex]?.status==="failure";xe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"r"}),a.jsx(d,{dimColor:!0,children:"RERUN"})]},"r"),...E?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"R"}),a.jsx(d,{dimColor:!0,children:"RETRY"})]},"R")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"F"}),a.jsx(d,{dimColor:!0,children:"FILTER"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else l.viewMode==="split"&&l.focusedPanel==="output"?xe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Esc"}),a.jsx(d,{dimColor:!0,children:"BACK"})]},"esc"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),...ce?.status==="running"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"i"}),a.jsx(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Tab"}),a.jsx(d,{dimColor:!0,children:"PANEL"})]},"tab"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?")]:xe=[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"q"}),a.jsx(d,{dimColor:!0,children:"QUIT"})]},"q"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"?"}),a.jsx(d,{dimColor:!0,children:"HELP"})]},"?"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"}),a.jsx(d,{dimColor:!0,children:"NAV"})]},"nav"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"/"}),a.jsx(d,{dimColor:!0,children:"FILTER"})]},"/"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"F"}),a.jsx(d,{dimColor:!0,children:"STATUS"})]},"F"),a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"⏎"}),a.jsx(d,{dimColor:!0,children:l.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...l.viewMode==="split"?[a.jsxs($,{gap:1,children:[a.jsx(d,{bold:!0,color:"white",children:"Tab"}),a.jsx(d,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const je=a.jsxs($,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[a.jsx($,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:xe}),a.jsx($,{flexShrink:0,paddingX:1,children:Re})]}),Be=a.jsxs(vi,{backgroundColor:"#1e1e1e",footer:a.jsxs(d,{dimColor:!0,children:[a.jsx(d,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",a.jsx(d,{bold:!0,color:"white",children:"?"}),"/",a.jsx(d,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:j,title:"KEYBOARD SHORTCUTS",visible:C,width:52,children:[a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"NAVIGATION"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(d,{dimColor:!0,children:" Move up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(d,{dimColor:!0,children:" Move down"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Tab"]}),a.jsx(d,{dimColor:!0,children:" Switch panel (split)"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsx(d,{dimColor:!0,children:" Back / close"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsx(d,{dimColor:!0,children:" Show output / fullscreen"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"VIEWS"})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Enter"]}),a.jsxs(d,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Esc"]}),a.jsxs(d,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"ACTIONS"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","/"]}),a.jsx(d,{dimColor:!0,children:" Filter by text"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","F"]}),a.jsx(d,{dimColor:!0,children:" Filter by status"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","1"]}),a.jsx(d,{dimColor:!0,children:"/"}),a.jsx(d,{bold:!0,color:"white",children:"2"}),a.jsx(d,{dimColor:!0,children:" Pin to output pane"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","0"]}),a.jsx(d,{dimColor:!0,children:" Clear pins"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","r"]}),a.jsx(d,{dimColor:!0,children:" Rerun all (done)"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","R"]}),a.jsx(d,{dimColor:!0,children:" Retry failed task"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","i"]}),a.jsx(d,{dimColor:!0,children:" Interactive input (running task)"})]})]}),a.jsxs($,{flexDirection:"column",marginBottom:1,children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"SCROLLING"}),a.jsx(d,{dimColor:!0,children:" (output panel)"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),a.jsx(d,{dimColor:!0,children:" Scroll up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),a.jsx(d,{dimColor:!0,children:" Scroll down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","^u"]}),a.jsx(d,{dimColor:!0,children:" Page up"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","^d"]}),a.jsx(d,{dimColor:!0,children:" Page down"})]})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","Home"]}),a.jsx(d,{dimColor:!0,children:" Top"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","End"]}),a.jsx(d,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","f"]}),a.jsx(d,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),a.jsxs($,{flexDirection:"column",children:[a.jsxs($,{marginBottom:1,children:[a.jsx(d,{dimColor:!0,children:"── "}),a.jsx(d,{bold:!0,color:"white",children:"GENERAL"})]}),a.jsxs($,{children:[a.jsx($,{width:24,children:a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","q"]}),a.jsx(d,{dimColor:!0,children:" Quit"})]})}),a.jsxs(d,{children:[a.jsxs(d,{bold:!0,color:"white",children:[" ","?"]}),a.jsx(d,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Ne=a.jsx(wi,{autoExitSeconds:t>0?t:3,onCancel:v(()=>{oe(!1)},"onCancel"),visible:q}),Ee=R&&i?a.jsx(gl,{activeIndex:B,focused:l.focusedPanel==="dock",store:i}):null;if(l.viewMode==="fullscreen")return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Rs,{autoScroll:Q,duration:ce?.duration??ce?.elapsed,focused:!0,interactiveMode:l.interactiveMode,output:We,scrollRef:P,status:st,supportsInteractive:!k,taskId:Ke})}),Ee,je,Ne,Be]});if(l.viewMode==="split"){const E=f>=As,T=a.jsx(Os,{compact:!0,filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel==="tasks",headerStatus:He,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:$e,scrollRef:A,selectedIndex:l.selectedIndex,title:re}),F=a.jsx(Rs,{autoScroll:Q,duration:ce?.duration??ce?.elapsed,focused:l.focusedPanel==="output",interactiveMode:l.interactiveMode,output:We,scrollRef:P,showFullscreenHint:!0,status:st,supportsInteractive:!k,taskId:Ke});if(E){const ve=Math.floor(f*.4);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsxs($,{flexDirection:"row",flexGrow:1,children:[a.jsx($,{width:ve,children:T}),a.jsx($,{flexGrow:1,children:F})]}),Ee,je,Ne,Be]})}const ie=Math.floor(p*.45);return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{height:ie,children:T}),a.jsx($,{flexGrow:1,children:F}),Ee,je,Ne,Be]})}return a.jsxs($,{flexDirection:"column",height:p,width:f,children:[a.jsx($,{flexGrow:1,children:a.jsx(Os,{filterActive:l.filterActive,filterText:l.filterText,focused:l.focusedPanel!=="dock",headerStatus:He,parallelSlots:r,pinnedTaskIds:l.pinnedTaskIds,rows:$e,scrollRef:A,selectedIndex:l.selectedIndex,title:re})}),Ee,je,Ne,Be]})},"VisTaskRunnerApp");var kl=Object.defineProperty,Qe=v((t,e)=>kl(t,"name",{value:e,configurable:!0}),"r$1");const bl=Qe(t=>{const{args:e,autoExit:r=!1,onRetryService:s,outputStyle:i="normal",projectNames:o,serviceDockStore:n,stdinRegistry:c,tasks:u}=t,h=new At(u),f=typeof e.parallel=="number"?e.parallel:3,p=r===!0?3:typeof r=="number"?r:0;let l,g;const y=new Promise(j=>{g=j});let R;const B=Qe(()=>{R&&(clearInterval(R),R=void 0)},"cleanup"),x=Qe(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),k=Qe(()=>{if(c){for(const j of c.values())j.kill?.();c.clear()}},"killAllPtyProcesses"),M=Qe(()=>{B(),w(),k(),x(),process.stdout.write("\x1B[?1049l\x1B[?25h"),l?.cleanup(),process.exit(1)},"onSignal"),S=Qe(()=>{const j=h.getSnapshot(),A=et(Date.now()-j.startTime),P=j.rows.filter(Q=>Q.status==="failure").map(Q=>Q.taskId),q=process.stdout.columns||80;process.stdout.write(`
26
+ `);for(const Q of j.rows){const{persistent:V,status:ae,taskId:Ie}=Q,ne=ae==="running"||ae==="pending",pe=bt(ae),$e=ne&&V?"■":pe.icon,J=ne&&V?"gray":pe.color;let Y="";switch(ae){case"local-cache":case"local-cache-kept-existing":{Y=" [local cache]";break}case"remote-cache":{Y=" [remote cache]";break}case"skipped":{Y=" [skipped]";break}default:{ne&&V?Y=" [stopped]":ne&&(Y=" [skipped]");break}}const ue=Q.retryAttempts&&Q.retryAttempts>0?` [retried ${Q.retryAttempts}x]`:"",ce=ye(ee.createElement(d,null," ",ee.createElement(d,{color:J},$e),` vis run ${Ie}`,Y?ee.createElement(d,{dimColor:!0},` ${Y}`):null,ue?ee.createElement(d,{color:"yellow"},ue):null),{columns:q});process.stdout.write(`${ce}
27
27
  `)}process.stdout.write(`
28
- `);const ae=$e(te.createElement(rn,{cached:j.cached,failed:j.failed,failedIds:P,projectNames:o,retriedIds:j.retriedIds.length>0?j.retriedIds:void 0,succeeded:j.succeeded,targets:e.targets,tasks:u,took:F}),{columns:q});if(process.stdout.write(`${ae}
29
- `),P.length>0&&i!=="quiet")for(const Q of P){const V=j.outputs.get(Q);if(V?.trim()){const ce=$e(te.createElement(d,null,`
30
- `,te.createElement(d,{bold:!0,color:"red"},` ${lr} vis run ${Q}`)),{columns:q});process.stdout.write(`${ce}
31
-
32
- `);const Re=V.trim().split(`
33
- `).map(ie=>` ${ie}`).join(`
34
- `);process.stdout.write(`${Re}
35
- `)}}},"printExitSummary");let C;const w=Xe(()=>{C&&(clearInterval(C),C=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){D(),h.markDone(),C||(C=setInterval(()=>{},1e3))},endTasks(j){h.endTasks(j)},printCacheDisabledByTask(j){h.addOutput(j.id,`ⓘ caching disabled by task via disableCache()
36
- `)},printEmptyFingerprintWarning(j,F){h.addOutput(j.id,`ⓘ caching skipped — ${F}
37
- `)},printSelfModifyingSkip(j,F){h.addOutput(j.id,`ⓘ caching skipped — task modified its own input${F.length===1?"":"s"} (${F.join(", ")})
38
- `)},printTaskTerminalOutput(j,F,P){h.getSnapshot().outputs.has(j.id)||h.addOutput(j.id,P)},startCommand(){process.on("SIGINT",E),process.on("SIGTERM",E),C||(C=setInterval(()=>{},1e3)),l=wi(te.createElement($l,{autoExitSeconds:p,onRetryService:s,parallelSlots:f,projectNames:o,serviceDockStore:n,stdinRegistry:c??new Map,store:h,targets:e.targets,tasks:u}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),l.waitUntilExit().then(()=>{w(),k(),x(),process.removeListener("SIGINT",E),process.removeListener("SIGTERM",E),S(),g()}).catch(()=>{w(),k(),x(),process.removeListener("SIGINT",E),process.removeListener("SIGTERM",E),g()})},startTasks(j){h.startTasks(j),I||(I=setInterval(()=>{h.tick()},100))}},renderIsDone:y,store:h}},"createDynamicOutputRenderer");var bl=Object.defineProperty,Br=v((t,e)=>bl(t,"name",{value:e,configurable:!0}),"p$1");const jl=Br(t=>t==="quiet"?"quiet":"normal","parseOutputStyle"),Sl=Br((t,e)=>{const r=t.overrides.visOptions;return r?.outputStyle==="normal"||r?.outputStyle==="quiet"?r.outputStyle:e},"resolveTaskOutputStyle");class Tl{static{v(this,"StaticOutputLifeCycle")}static{Br(this,"StaticOutputLifeCycle")}#e;#s;#r;#n=[];#t=[];#i=[];#o=new Map;#a;#c;#l;#u=0;constructor(e){this.#e=e.projectNames,this.#s=e.args.targets,this.#r=e.tasks,this.#a=e.logReporter,this.#c=e.outputStyle??"normal",this.#l=e.ciGrouping??"auto"}startCommand(){this.#u=Date.now();const e=process.stdout.columns||80,r=`Running ${mr(this.#e,this.#s,this.#r)}`,s=$e(te.createElement(er,{title:r,variant:"info"}),{columns:e});process.stdout.write(s);const i=this.#r[0],o=i?.overrides?Object.entries(i.overrides).filter(([n])=>n!=="command"):[];if(o.length>0){process.stdout.write(`
28
+ `);const oe=ye(ee.createElement(sn,{cached:j.cached,failed:j.failed,failedIds:P,projectNames:o,retriedIds:j.retriedIds.length>0?j.retriedIds:void 0,succeeded:j.succeeded,targets:e.targets,tasks:u,took:A}),{columns:q});if(process.stdout.write(`${oe}
29
+ `),P.length>0&&i!=="quiet")for(const Q of P){const V=j.outputs.get(Q);if(V?.trim()){const ae=ye(ee.createElement(d,null,`
30
+ `,ee.createElement(d,{bold:!0,color:"red"},` ${lr} vis run ${Q}`)),{columns:q});process.stdout.write(`${ae}
31
+
32
+ `);const Ie=V.trim().split(`
33
+ `).map(ne=>` ${ne}`).join(`
34
+ `);process.stdout.write(`${Ie}
35
+ `)}}},"printExitSummary");let C;const w=Qe(()=>{C&&(clearInterval(C),C=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){B(),h.markDone(),C||(C=setInterval(()=>{},1e3))},endTasks(j){h.endTasks(j)},printCacheDisabledByTask(j){h.addOutput(j.id,`ⓘ caching disabled by task via disableCache()
36
+ `)},printEmptyFingerprintWarning(j,A){h.addOutput(j.id,`ⓘ caching skipped — ${A}
37
+ `)},printSelfModifyingSkip(j,A){h.addOutput(j.id,`ⓘ caching skipped — task modified its own input${A.length===1?"":"s"} (${A.join(", ")})
38
+ `)},printTaskTerminalOutput(j,A,P){h.getSnapshot().outputs.has(j.id)||h.addOutput(j.id,P)},startCommand(){process.on("SIGINT",M),process.on("SIGTERM",M),C||(C=setInterval(()=>{},1e3)),l=yi(ee.createElement(xl,{autoExitSeconds:p,onRetryService:s,parallelSlots:f,projectNames:o,serviceDockStore:n,stdinRegistry:c??new Map,store:h,targets:e.targets,tasks:u}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),l.waitUntilExit().then(()=>{w(),k(),x(),process.removeListener("SIGINT",M),process.removeListener("SIGTERM",M),S(),g()}).catch(()=>{w(),k(),x(),process.removeListener("SIGINT",M),process.removeListener("SIGTERM",M),g()})},startTasks(j){h.startTasks(j),R||(R=setInterval(()=>{h.tick()},100))}},renderIsDone:y,store:h}},"createDynamicOutputRenderer");var jl=Object.defineProperty,Br=v((t,e)=>jl(t,"name",{value:e,configurable:!0}),"p$1");const Sl=Br(t=>t==="quiet"?"quiet":"normal","parseOutputStyle"),Tl=Br((t,e)=>{const r=t.overrides.visOptions;return r?.outputStyle==="normal"||r?.outputStyle==="quiet"?r.outputStyle:e},"resolveTaskOutputStyle");class Cl{static{v(this,"StaticOutputLifeCycle")}static{Br(this,"StaticOutputLifeCycle")}#e;#s;#r;#n=[];#t=[];#i=[];#o=new Map;#a;#c;#l;#u=0;constructor(e){this.#e=e.projectNames,this.#s=e.args.targets,this.#r=e.tasks,this.#a=e.logReporter,this.#c=e.outputStyle??"normal",this.#l=e.ciGrouping??"auto"}startCommand(){this.#u=Date.now();const e=process.stdout.columns||80,r=`Running ${mr(this.#e,this.#s,this.#r)}`,s=ye(ee.createElement(er,{title:r,variant:"info"}),{columns:e});process.stdout.write(s);const i=this.#r[0],o=i?.overrides?Object.entries(i.overrides).filter(([n])=>n!=="command"):[];if(o.length>0){process.stdout.write(`
39
39
  With additional flags:
40
- `);for(const[n,c]of o)process.stdout.write(`${za(" ",n,c)}
40
+ `);for(const[n,c]of o)process.stdout.write(`${Va(" ",n,c)}
41
41
  `)}process.stdout.write(`
42
- `)}startTasks(e){const r=process.stdout.columns||80;for(const s of e){const i=$e(te.createElement(d,null,te.createElement(d,{dimColor:!0},">"),` ${s.id}`),{columns:r});process.stdout.write(`${i}
43
- `)}}endTasks(e){const r=process.stdout.columns||80;for(const s of e){this.#o.set(s.task.id,s),s.status==="failure"?this.#n.push(s):ot(s.status)&&this.#t.push(s),s.retryAttempts&&s.retryAttempts>0&&this.#i.push(s);const i=wt(s.status),o=s.startTime&&s.endTime?` (${et(s.endTime-s.startTime)})`:"",n=ot(s.status)?" [cache]":"",c=s.retryAttempts&&s.retryAttempts>0?` [retried ${s.retryAttempts}x]`:"",u=$e(te.createElement(d,null,i,` ${s.task.id}`,n?te.createElement(d,{color:"cyan"},n):null,c?te.createElement(d,{color:"yellow"},c):null,o?te.createElement(d,{dimColor:!0},o):null),{columns:r});process.stdout.write(`${u}
44
- `)}}#d(e){const r=process.stdout.columns||80,s=$e(te.createElement(d,{dimColor:!0},` ⓘ ${e}`),{columns:r});process.stdout.write(`${s}
45
- `)}printCacheDisabledByTask(e){this.#d(`${e.id}: caching disabled by task via disableCache()`)}printSelfModifyingSkip(e,r){this.#d(`${e.id}: caching skipped — task modified its own input${r.length===1?"":"s"} (${r.join(", ")})`)}printEmptyFingerprintWarning(e,r){this.#d(`${e.id}: caching skipped — ${r}`)}printTaskTerminalOutput(e,r,s){if(Sl(e,this.#c)==="quiet"&&(r==="success"||ot(r)))return;const i=r==="failure"?qn(s,{color:!process.env.NO_COLOR,cwd:process.cwd()}):s;if(this.#a){this.#a.printTaskTerminalOutput(e,r,i);return}nl(e.id,r,i,this.#l)}endCommand(){const e=et(Date.now()-this.#u),r=this.#r.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
46
- `);const s=process.stdout.columns||80,i=$e(te.createElement(rn,{cached:this.#t.length,failed:this.#n.length,failedIds:this.#n.map(o=>o.task.id),projectNames:this.#e,retriedIds:this.#i.length>0?this.#i.map(o=>o.task.id):void 0,skippedIds:r.length>0?r:void 0,succeeded:this.#o.size-this.#n.length-this.#t.length,targets:this.#s,tasks:this.#r,took:e}),{columns:s});process.stdout.write(`${i}
47
- `)}}var Cl=Object.defineProperty,Ht=v((t,e)=>Cl(t,"name",{value:e,configurable:!0}),"o");const Il=Ht(async t=>{if(process.env.VIS_NO_SHELL_HISTORY||So()==="win32")return;const e=process.env.SHELL;if(!e)return;const r=ui(e);try{if(r==="zsh"){await Rl(t);return}if(r==="bash"){await El(t);return}r==="fish"&&await Ol(t)}catch{}},"appendToShellHistory"),Rl=Ht(async t=>{const e=process.env.HISTFILE??he(process.env.ZDOTDIR??ur(),".zsh_history"),r=`: ${Math.floor(Date.now()/1e3)}:0;${t}
48
- `;await dr(e,r)},"writeZshHistory"),El=Ht(async t=>{const e=process.env.HISTFILE??he(ur(),".bash_history");await dr(e,`${t}
49
- `)},"writeBashHistory"),Ol=Ht(async t=>{const e=he(ur(),".local","share","fish","fish_history"),r=`- cmd: ${t.replaceAll("\\","\\\\").replaceAll(`
42
+ `)}startTasks(e){const r=process.stdout.columns||80;for(const s of e){const i=ye(ee.createElement(d,null,ee.createElement(d,{dimColor:!0},">"),` ${s.id}`),{columns:r});process.stdout.write(`${i}
43
+ `)}}endTasks(e){const r=process.stdout.columns||80;for(const s of e){this.#o.set(s.task.id,s),s.status==="failure"?this.#n.push(s):ot(s.status)&&this.#t.push(s),s.retryAttempts&&s.retryAttempts>0&&this.#i.push(s);const i=wt(s.status),o=s.startTime&&s.endTime?` (${et(s.endTime-s.startTime)})`:"",n=ot(s.status)?" [cache]":"",c=s.retryAttempts&&s.retryAttempts>0?` [retried ${s.retryAttempts}x]`:"",u=ye(ee.createElement(d,null,i,` ${s.task.id}`,n?ee.createElement(d,{color:"cyan"},n):null,c?ee.createElement(d,{color:"yellow"},c):null,o?ee.createElement(d,{dimColor:!0},o):null),{columns:r});process.stdout.write(`${u}
44
+ `)}}#d(e){const r=process.stdout.columns||80,s=ye(ee.createElement(d,{dimColor:!0},` ⓘ ${e}`),{columns:r});process.stdout.write(`${s}
45
+ `)}printCacheDisabledByTask(e){this.#d(`${e.id}: caching disabled by task via disableCache()`)}printSelfModifyingSkip(e,r){this.#d(`${e.id}: caching skipped — task modified its own input${r.length===1?"":"s"} (${r.join(", ")})`)}printEmptyFingerprintWarning(e,r){this.#d(`${e.id}: caching skipped — ${r}`)}printTaskTerminalOutput(e,r,s){if(Tl(e,this.#c)==="quiet"&&(r==="success"||ot(r)))return;const i=r==="failure"?Un(s,{color:!process.env.NO_COLOR,cwd:process.cwd()}):s;if(this.#a){this.#a.printTaskTerminalOutput(e,r,i);return}il(e.id,r,i,this.#l)}endCommand(){const e=et(Date.now()-this.#u),r=this.#r.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
46
+ `);const s=process.stdout.columns||80,i=ye(ee.createElement(sn,{cached:this.#t.length,failed:this.#n.length,failedIds:this.#n.map(o=>o.task.id),projectNames:this.#e,retriedIds:this.#i.length>0?this.#i.map(o=>o.task.id):void 0,skippedIds:r.length>0?r:void 0,succeeded:this.#o.size-this.#n.length-this.#t.length,targets:this.#s,tasks:this.#r,took:e}),{columns:s});process.stdout.write(`${i}
47
+ `)}}var Il=Object.defineProperty,Ht=v((t,e)=>Il(t,"name",{value:e,configurable:!0}),"o");const Rl=Ht(async t=>{if(process.env.VIS_NO_SHELL_HISTORY||To()==="win32")return;const e=process.env.SHELL;if(!e)return;const r=fi(e);try{if(r==="zsh"){await El(t);return}if(r==="bash"){await Ml(t);return}r==="fish"&&await Ol(t)}catch{}},"appendToShellHistory"),El=Ht(async t=>{const e=process.env.HISTFILE??fe(process.env.ZDOTDIR??ur(),".zsh_history"),r=`: ${Math.floor(Date.now()/1e3)}:0;${t}
48
+ `;await dr(e,r)},"writeZshHistory"),Ml=Ht(async t=>{const e=process.env.HISTFILE??fe(ur(),".bash_history");await dr(e,`${t}
49
+ `)},"writeBashHistory"),Ol=Ht(async t=>{const e=fe(ur(),".local","share","fish","fish_history"),r=`- cmd: ${t.replaceAll("\\","\\\\").replaceAll(`
50
50
  `,String.raw`\n`)}
51
51
  when: ${Math.floor(Date.now()/1e3)}
52
- `;await dr(e,r)},"writeFishHistory");var Ml=Object.defineProperty,Qt=v((t,e)=>Ml(t,"name",{value:e,configurable:!0}),"e");const Pl=Qt(t=>{const{killGracePeriodMs:e=5e3,onTimeout:r,sendSignal:s,timeoutMs:i}=t;if(i<=0)return{cancel:Qt(()=>{},"cancel")};const o=Math.max(e,0);let n;const c=setTimeout(()=>{r?.(),s("SIGTERM"),o>0&&(n=setTimeout(()=>{s("SIGKILL")},o))},i);return{cancel:Qt(()=>{clearTimeout(c),n&&clearTimeout(n)},"cancel")}},"scheduleTimeoutKill");var Fl=Object.defineProperty,Al=v((t,e)=>Fl(t,"name",{value:e,configurable:!0}),"n");const Ll=Al((t,e)=>{const r=e?.trim();if(!r)return{filter:void 0,tasks:[...t]};const s=r.toLowerCase();return{filter:r,tasks:t.filter(i=>i.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var Dl=Object.defineProperty,Be=v((t,e)=>Dl(t,"name",{value:e,configurable:!0}),"a$1");const Bl=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
53
- `),Nl=Be(t=>{t.write(`${Bl}
54
- `)},"writeHelp"),_l=Be(async(t,e)=>{e.write("filter projects (empty to cancel) > ");const r=t,s=r.isRaw===!0;if(s)try{r.setRawMode?.(!1)}catch{}return await new Promise(i=>{let o="";const n=Be(c=>{o+=typeof c=="string"?c:c.toString("utf8");const u=o.indexOf(`
55
- `);if(u===-1)return;const h=o.slice(0,u).replace(/\r$/,"").trim();if(t.off("data",n),s)try{r.setRawMode?.(!0)}catch{}i(h.length>0?h:void 0)},"onData");t.on("data",n)})},"defaultPromptFilter"),Gl=Be(t=>{const{handlers:e}=t,r=t.input??process.stdin,s=t.output??process.stdout,i=t.promptFilter??_l;if(!r||r.isTTY===!1)return{close:Be(()=>{},"close")};eo(r);const o=r.isRaw===!0;try{r.setRawMode?.(!0)}catch{return{close:Be(()=>{},"close")}}typeof r.resume=="function"&&r.resume();let n=!1;const c=Be(async f=>{if(f.ctrl===!0&&f.name==="c"){await e.onQuit();return}if(!n)switch(f.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{n=!0;try{const p=await i(r,s);p===void 0?s.write(`filter cancelled.
56
- `):await e.onFilter(p)}finally{n=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),u=Be((f,p)=>{c(p).catch(l=>{s.write(`[vis watch] keybind handler failed: ${l.message}
57
- `)})},"onKeypress"),h=r;return h.on("keypress",u),{close:Be(()=>{if(h.off("keypress",u),!o)try{r.setRawMode?.(!1)}catch{}const f=r;if(typeof f.pause=="function")try{f.pause()}catch{}},"close")}},"installKeybinds");var ql=Object.defineProperty,ir=v((t,e)=>ql(t,"name",{value:e,configurable:!0}),"y");const Ul=ir(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Wl=ir(async t=>{const{initialTasks:e,probe:r,registeredEntries:s,taskGraph:i,visVersion:o}=t,n=new Map,c=new Map,u=new Map;for(const w of s)if(so(w.pid)){if(w.visVersion!==o){c.set(w.id,w);continue}n.set(w.id,w)}if(r){const w=[...n.values()],j=await Promise.all(w.map(async F=>{try{return[F.id,await r(F)]}catch{return[F.id,!1]}}));for(const[F,P]of j)if(!P){const q=n.get(F);n.delete(F),q&&u.set(F,q)}}const h=new Set(e.map(w=>w.id)),f=new Set,p=[],l=[],g=new Set;for(const w of Object.values(i.dependencies))for(const j of w)g.add(j);for(const[w,j]of Object.entries(i.tasks)){if(!Ul(j)?.service)continue;if(n.has(w)){f.add(w),l.push(n.get(w));continue}if(h.has(w)||!g.has(w))continue;const F=c.get(w),P=u.get(w);let q;F?q=`Service ${w} is registered with vis ${F.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${w}\` to pick up the new version.`:P?q=`Service ${w} is registered (PID ${String(P.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${w}\` to recover.`:q=`Target depends on the service ${w}, which is not running. Run \`vis service start ${w}\` first, or invoke \`${w}\` directly.`,p.push({message:q,targetId:w})}if(f.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:l,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:i};const y=new Map,I=ir(w=>{const j=new Set,F=[...i.dependencies[w]??[]],P=new Set;for(;F.length>0;){const q=F.pop();if(!P.has(q)){P.add(q),f.has(q)&&j.add(q);for(const ae of i.dependencies[q]??[])P.has(ae)||F.push(ae)}}return[...j].sort()},"collectTransitiveServices"),D=new Map;for(const w of Object.keys(i.dependencies)){if(f.has(w))continue;const j=I(w);if(j.length===0)continue;const F={};for(const P of j){const q=n.get(P);if(!q)continue;Object.assign(F,q.env);const ae=D.get(P);ae?ae.push(w):D.set(P,[w])}Object.keys(F).length>0&&y.set(w,F)}for(const w of D.values())w.sort();const x={};for(const[w,j]of Object.entries(i.tasks))f.has(w)||(x[w]=j);const k={};for(const[w,j]of Object.entries(i.dependencies))f.has(w)||(k[w]=j.filter(F=>!f.has(F)));const E=new Map;for(const w of Object.keys(x))E.set(w,0);for(const w of Object.values(k))for(const j of w)E.has(j)&&E.set(j,(E.get(j)??0)+1);const S=[];for(const w of i.roots)!f.has(w)&&x[w]&&S.push(w);for(const[w,j]of E)j===0&&!S.includes(w)&&x[w]&&S.push(w);const C=e.filter(w=>!f.has(w.id));return{diagnostics:p,initialTasks:C,satisfiedServices:l,serviceDependentsByServiceId:D,serviceEnvByTaskId:y,taskGraph:{dependencies:k,roots:S,tasks:x}}},"applyServiceRegistry");var Hl=Object.defineProperty,yt=v((t,e)=>Hl(t,"name",{value:e,configurable:!0}),"c");const It="[[VIS_BOOT]]",zl=250,Vl=1e3,As=3,Kl=yt(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),Ls=yt(t=>{try{const e=at(t,"utf8").trim(),r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}},"readPidFile");class Yl{static{v(this,"ServiceEventBridge")}static{yt(this,"ServiceEventBridge")}#e;#s;#r;#n;#t=new Map;#i=new Map;#o=new Map;#a=new Map;#c=new Set;constructor(e){this.#e=e.indexToId,this.#s=new Map(e.services),this.#r=e.sink,this.#n=e.workspaceRoot}onProcessEvent=yt(e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const r=this.#e.get(e.index);r===void 0||e.text===void 0||this.onTaskOutput(r,e.text)},"onProcessEvent");onTaskOutput(e,r){if(!this.#s.has(e))return;const s=((this.#t.get(e)??"")+r).split(`
58
- `),i=s.pop()??"";this.#t.set(e,i);for(const o of s)this.#l(e,o)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,r){this.#r.started(e,r)}onRegistryTaskStarted(e){this.#s.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,r,s){if(this.#s.get(e)?.mode!=="registry")return;if(s||r!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:r,killed:s});return}const i=await no(this.#n,e);if(!i){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:o}=i,n=o.readiness?.tcp?.port??o.port??0,c=o.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:c,logFile:i.logFile,pid:i.pid,port:n})}notifyRegistryReady(e,r){this.#r.ready(e,{host:r.host,port:r.port}),this.#h(e,r.logFile),r.pid!==null&&this.#p(e,r.pid)}notifyRegistryFailed(e,r,s){this.#r.failed(e,r,s)}async retry(e){const r=this.#s.get(e);if(r){if(this.#f(e),this.#t.delete(e),this.#i.delete(e),this.#r.starting(e),r.mode==="registry"){await this.#y(e,r.registry);return}r.mode==="ephemeral"&&this.#w(e,r.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#a.keys()])this.#f(e);this.#c.size>0&&(await Promise.race([Promise.all(this.#c),new Promise(e=>{setTimeout(e,2e3)})]),this.#c.clear()),this.#t.clear(),this.#i.clear()}#l(e,r){if(r.startsWith(It)){this.#u(e,r.slice(It.length));return}const s=this.#i.get(e)??[];s.push(r),s.length>As&&s.shift(),this.#i.set(e,s),this.#r.log(e,`${r}
52
+ `;await dr(e,r)},"writeFishHistory");var Pl=Object.defineProperty,Xt=v((t,e)=>Pl(t,"name",{value:e,configurable:!0}),"e");const Fl=Xt(t=>{const{killGracePeriodMs:e=5e3,onTimeout:r,sendSignal:s,timeoutMs:i}=t;if(i<=0)return{cancel:Xt(()=>{},"cancel")};const o=Math.max(e,0);let n;const c=setTimeout(()=>{r?.(),s("SIGTERM"),o>0&&(n=setTimeout(()=>{s("SIGKILL")},o))},i);return{cancel:Xt(()=>{clearTimeout(c),n&&clearTimeout(n)},"cancel")}},"scheduleTimeoutKill");var Al=Object.defineProperty,Ll=v((t,e)=>Al(t,"name",{value:e,configurable:!0}),"n");const Dl=Ll((t,e)=>{const r=e?.trim();if(!r)return{filter:void 0,tasks:[...t]};const s=r.toLowerCase();return{filter:r,tasks:t.filter(i=>i.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var Bl=Object.defineProperty,_e=v((t,e)=>Bl(t,"name",{value:e,configurable:!0}),"a$1");const Nl=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
53
+ `),_l=_e(t=>{t.write(`${Nl}
54
+ `)},"writeHelp"),Gl=_e(async(t,e)=>{e.write("filter projects (empty to cancel) > ");const r=t,s=r.isRaw===!0;if(s)try{r.setRawMode?.(!1)}catch{}return await new Promise(i=>{let o="";const n=_e(c=>{o+=typeof c=="string"?c:c.toString("utf8");const u=o.indexOf(`
55
+ `);if(u===-1)return;const h=o.slice(0,u).replace(/\r$/,"").trim();if(t.off("data",n),s)try{r.setRawMode?.(!0)}catch{}i(h.length>0?h:void 0)},"onData");t.on("data",n)})},"defaultPromptFilter"),ql=_e(t=>{const{handlers:e}=t,r=t.input??process.stdin,s=t.output??process.stdout,i=t.promptFilter??Gl;if(!r||r.isTTY===!1)return{close:_e(()=>{},"close")};to(r);const o=r.isRaw===!0;try{r.setRawMode?.(!0)}catch{return{close:_e(()=>{},"close")}}typeof r.resume=="function"&&r.resume();let n=!1;const c=_e(async f=>{if(f.ctrl===!0&&f.name==="c"){await e.onQuit();return}if(!n)switch(f.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{n=!0;try{const p=await i(r,s);p===void 0?s.write(`filter cancelled.
56
+ `):await e.onFilter(p)}finally{n=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),u=_e((f,p)=>{c(p).catch(l=>{s.write(`[vis watch] keybind handler failed: ${l.message}
57
+ `)})},"onKeypress"),h=r;return h.on("keypress",u),{close:_e(()=>{if(h.off("keypress",u),!o)try{r.setRawMode?.(!1)}catch{}const f=r;if(typeof f.pause=="function")try{f.pause()}catch{}},"close")}},"installKeybinds");var Ul=Object.defineProperty,ir=v((t,e)=>Ul(t,"name",{value:e,configurable:!0}),"y");const Wl=ir(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Hl=ir(async t=>{const{initialTasks:e,probe:r,registeredEntries:s,taskGraph:i,visVersion:o}=t,n=new Map,c=new Map,u=new Map;for(const w of s)if(no(w.pid)){if(w.visVersion!==o){c.set(w.id,w);continue}n.set(w.id,w)}if(r){const w=[...n.values()],j=await Promise.all(w.map(async A=>{try{return[A.id,await r(A)]}catch{return[A.id,!1]}}));for(const[A,P]of j)if(!P){const q=n.get(A);n.delete(A),q&&u.set(A,q)}}const h=new Set(e.map(w=>w.id)),f=new Set,p=[],l=[],g=new Set;for(const w of Object.values(i.dependencies))for(const j of w)g.add(j);for(const[w,j]of Object.entries(i.tasks)){if(!Wl(j)?.service)continue;if(n.has(w)){f.add(w),l.push(n.get(w));continue}if(h.has(w)||!g.has(w))continue;const A=c.get(w),P=u.get(w);let q;A?q=`Service ${w} is registered with vis ${A.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${w}\` to pick up the new version.`:P?q=`Service ${w} is registered (PID ${String(P.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${w}\` to recover.`:q=`Target depends on the service ${w}, which is not running. Run \`vis service start ${w}\` first, or invoke \`${w}\` directly.`,p.push({message:q,targetId:w})}if(f.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:l,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:i};const y=new Map,R=ir(w=>{const j=new Set,A=[...i.dependencies[w]??[]],P=new Set;for(;A.length>0;){const q=A.pop();if(!P.has(q)){P.add(q),f.has(q)&&j.add(q);for(const oe of i.dependencies[q]??[])P.has(oe)||A.push(oe)}}return[...j].sort()},"collectTransitiveServices"),B=new Map;for(const w of Object.keys(i.dependencies)){if(f.has(w))continue;const j=R(w);if(j.length===0)continue;const A={};for(const P of j){const q=n.get(P);if(!q)continue;Object.assign(A,q.env);const oe=B.get(P);oe?oe.push(w):B.set(P,[w])}Object.keys(A).length>0&&y.set(w,A)}for(const w of B.values())w.sort();const x={};for(const[w,j]of Object.entries(i.tasks))f.has(w)||(x[w]=j);const k={};for(const[w,j]of Object.entries(i.dependencies))f.has(w)||(k[w]=j.filter(A=>!f.has(A)));const M=new Map;for(const w of Object.keys(x))M.set(w,0);for(const w of Object.values(k))for(const j of w)M.has(j)&&M.set(j,(M.get(j)??0)+1);const S=[];for(const w of i.roots)!f.has(w)&&x[w]&&S.push(w);for(const[w,j]of M)j===0&&!S.includes(w)&&x[w]&&S.push(w);const C=e.filter(w=>!f.has(w.id));return{diagnostics:p,initialTasks:C,satisfiedServices:l,serviceDependentsByServiceId:B,serviceEnvByTaskId:y,taskGraph:{dependencies:k,roots:S,tasks:x}}},"applyServiceRegistry");var zl=Object.defineProperty,yt=v((t,e)=>zl(t,"name",{value:e,configurable:!0}),"c");const It="[[VIS_BOOT]]",Vl=250,Kl=1e3,Ls=3,Yl=yt(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),Ds=yt(t=>{try{const e=at(t,"utf8").trim(),r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}},"readPidFile");class Jl{static{v(this,"ServiceEventBridge")}static{yt(this,"ServiceEventBridge")}#e;#s;#r;#n;#t=new Map;#i=new Map;#o=new Map;#a=new Map;#c=new Set;constructor(e){this.#e=e.indexToId,this.#s=new Map(e.services),this.#r=e.sink,this.#n=e.workspaceRoot}onProcessEvent=yt(e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const r=this.#e.get(e.index);r===void 0||e.text===void 0||this.onTaskOutput(r,e.text)},"onProcessEvent");onTaskOutput(e,r){if(!this.#s.has(e))return;const s=((this.#t.get(e)??"")+r).split(`
58
+ `),i=s.pop()??"";this.#t.set(e,i);for(const o of s)this.#l(e,o)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,r){this.#r.started(e,r)}onRegistryTaskStarted(e){this.#s.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,r,s){if(this.#s.get(e)?.mode!=="registry")return;if(s||r!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:r,killed:s});return}const i=await io(this.#n,e);if(!i){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:o}=i,n=o.readiness?.tcp?.port??o.port??0,c=o.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:c,logFile:i.logFile,pid:i.pid,port:n})}notifyRegistryReady(e,r){this.#r.ready(e,{host:r.host,port:r.port}),this.#h(e,r.logFile),r.pid!==null&&this.#p(e,r.pid)}notifyRegistryFailed(e,r,s){this.#r.failed(e,r,s)}async retry(e){const r=this.#s.get(e);if(r){if(this.#f(e),this.#t.delete(e),this.#i.delete(e),this.#r.starting(e),r.mode==="registry"){await this.#y(e,r.registry);return}r.mode==="ephemeral"&&this.#w(e,r.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#a.keys()])this.#f(e);this.#c.size>0&&(await Promise.race([Promise.all(this.#c),new Promise(e=>{setTimeout(e,2e3)})]),this.#c.clear()),this.#t.clear(),this.#i.clear()}#l(e,r){if(r.startsWith(It)){this.#u(e,r.slice(It.length));return}const s=this.#i.get(e)??[];s.push(r),s.length>Ls&&s.shift(),this.#i.set(e,s),this.#r.log(e,`${r}
59
59
  `)}#u(e,r){let s;try{s=JSON.parse(r)}catch{this.#r.log(e,`${It+r}
60
60
  `);return}switch(s.event){case"failed":{const i=typeof s.reason=="string"?s.reason:"unknown",o={};for(const[n,c]of Object.entries(s))n!=="event"&&n!=="id"&&n!=="reason"&&(o[n]=c);this.#r.failed(e,i,o);break}case"ready":{const i=typeof s.host=="string"?s.host:"127.0.0.1",o=typeof s.port=="number"?s.port:0;this.#r.ready(e,{host:i,port:o}),this.#d(e);break}case"started":{const i=typeof s.pid=="number"?s.pid:null;this.#r.started(e,i);break}default:this.#r.log(e,`${It+r}
61
- `)}}#d(e){const r=this.#s.get(e);if(r?.ephemeral===void 0)return;this.#h(e,r.ephemeral.logFile);const s=Ls(r.ephemeral.pidFile);s!==null&&this.#p(e,s)}#h(e,r){if(this.#o.has(e)||!Ze(r))return;const s=Ji(r,"r"),i=(()=>{try{return us(r).size}catch{return 0}})(),o={fd:s,logFile:r,pollTimer:setInterval(()=>{this.#m(e)},zl),position:i};this.#o.set(e,o)}#m(e){const r=this.#o.get(e);if(r)try{const s=us(r.logFile);if(s.size<=r.position)return;const i=Buffer.alloc(s.size-r.position),o=Xi(r.fd,i,0,i.length,r.position);if(o>0){r.position+=o;const n=i.subarray(0,o).toString("utf8");for(const c of n.split(`
62
- `))c.length!==0&&this.#v(e,c);this.#r.log(e,n)}}catch{}}#v(e,r){const s=this.#i.get(e)??[];for(s.push(r);s.length>As;)s.shift();this.#i.set(e,s)}#p(e,r){if(this.#a.has(e))return;const s={pid:r,timer:setInterval(()=>{if(!Kl(r)){const i=[...this.#i.get(e)??[]];this.#f(e),this.#r.crashed(e,i)}},Vl)};this.#a.set(e,s)}#f(e){const r=this.#o.get(e);if(r){clearInterval(r.pollTimer);try{Qi(r.fd)}catch{}this.#o.delete(e)}const s=this.#a.get(e);s&&(clearInterval(s.timer),this.#a.delete(e))}#w(e,r){if(r===void 0)return;const s=Ls(r.pidFile);if(s!==null)try{process.kill(-s,"SIGTERM")}catch{}const i=Io("node",[r.scriptPath,r.configFile],{cwd:r.cwd,stdio:["ignore","pipe","pipe"]});i.stdout.on("data",n=>{this.#g(e,n)}),i.stderr.on("data",n=>{this.#g(e,n)}),i.on("error",n=>{this.#r.failed(e,"respawn-error",{message:n.message})});const o=new Promise(n=>{const c=yt(()=>{this.#c.delete(o),n()},"settle");i.once("exit",c),i.once("error",c)});this.#c.add(o)}#g(e,r){const s=((this.#t.get(e)??"")+r.toString("utf8")).split(`
63
- `),i=s.pop()??"";this.#t.set(e,i);for(const o of s)this.#l(e,o)}async#y(e,r){if(r!==void 0){try{await io({id:e,workspaceRoot:this.#n})}catch{}try{const s=await oo({command:r.command,config:r.config,cwd:r.cwd,env:r.env,id:e,workspaceRoot:this.#n}),i=r.config.readiness?.tcp?.port??r.config.port??0,o=r.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,s.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:s.entry.logFile,pid:s.entry.pid,port:i})}catch(s){const i=s instanceof Error?s.message:String(s);this.#r.failed(e,"retry-failed",{message:i})}}}}var Jl=Object.defineProperty,Ie=v((t,e)=>Jl(t,"name",{value:e,configurable:!0}),"f");const Xl=Ie(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Kn=Ie((t,e,r)=>{const s=[],i=[];for(const o of e){const n=r.tasks[o];if(!n){i.push({id:o,reason:"task not in graph"});continue}const c=n.overrides.command;if(!c){i.push({id:o,reason:"no command resolved"});continue}const u=Xl(n);if(!u?.service){i.push({id:o,reason:"no service config"});continue}const h=Bt(t,n.projectRoot,!!u.runFromWorkspaceRoot),{envFile:f}=u,p=f===void 0||f===!1?{}:or(h,f),l=u.service.env??{};s.push({command:c,config:u.service,cwd:h,env:{...p,...l},id:o})}return{services:s,skipped:i}},"extractPreflightTasks"),Ql=Ie((t,e)=>{const r=new Set(t),s=new Map;for(const n of t){const c=(e.dependencies[n]??[]).filter(u=>r.has(u));s.set(n,new Set(c))}const i=[],o=new Set;for(;s.size>0;){const n=[];for(const[c,u]of s){for(const h of u)o.has(h)&&u.delete(h);u.size===0&&n.push(c)}n.length===0&&n.push(...s.keys());for(const c of n)o.add(c),s.delete(c);n.sort(),i.push({ids:n})}return i},"planTopoLevels"),Zl=Ie((t,e)=>{const r=[];for(const s of Ql(t,e))r.push(...s.ids);return r},"linearize"),ed=String.raw`import { spawn } from "node:child_process";
61
+ `)}}#d(e){const r=this.#s.get(e);if(r?.ephemeral===void 0)return;this.#h(e,r.ephemeral.logFile);const s=Ds(r.ephemeral.pidFile);s!==null&&this.#p(e,s)}#h(e,r){if(this.#o.has(e)||!Ze(r))return;const s=Qi(r,"r"),i=(()=>{try{return fs(r).size}catch{return 0}})(),o={fd:s,logFile:r,pollTimer:setInterval(()=>{this.#m(e)},Vl),position:i};this.#o.set(e,o)}#m(e){const r=this.#o.get(e);if(r)try{const s=fs(r.logFile);if(s.size<=r.position)return;const i=Buffer.alloc(s.size-r.position),o=Xi(r.fd,i,0,i.length,r.position);if(o>0){r.position+=o;const n=i.subarray(0,o).toString("utf8");for(const c of n.split(`
62
+ `))c.length!==0&&this.#v(e,c);this.#r.log(e,n)}}catch{}}#v(e,r){const s=this.#i.get(e)??[];for(s.push(r);s.length>Ls;)s.shift();this.#i.set(e,s)}#p(e,r){if(this.#a.has(e))return;const s={pid:r,timer:setInterval(()=>{if(!Yl(r)){const i=[...this.#i.get(e)??[]];this.#f(e),this.#r.crashed(e,i)}},Kl)};this.#a.set(e,s)}#f(e){const r=this.#o.get(e);if(r){clearInterval(r.pollTimer);try{Zi(r.fd)}catch{}this.#o.delete(e)}const s=this.#a.get(e);s&&(clearInterval(s.timer),this.#a.delete(e))}#w(e,r){if(r===void 0)return;const s=Ds(r.pidFile);if(s!==null)try{process.kill(-s,"SIGTERM")}catch{}const i=Ro("node",[r.scriptPath,r.configFile],{cwd:r.cwd,stdio:["ignore","pipe","pipe"]});i.stdout.on("data",n=>{this.#g(e,n)}),i.stderr.on("data",n=>{this.#g(e,n)}),i.on("error",n=>{this.#r.failed(e,"respawn-error",{message:n.message})});const o=new Promise(n=>{const c=yt(()=>{this.#c.delete(o),n()},"settle");i.once("exit",c),i.once("error",c)});this.#c.add(o)}#g(e,r){const s=((this.#t.get(e)??"")+r.toString("utf8")).split(`
63
+ `),i=s.pop()??"";this.#t.set(e,i);for(const o of s)this.#l(e,o)}async#y(e,r){if(r!==void 0){try{await oo({id:e,workspaceRoot:this.#n})}catch{}try{const s=await ao({command:r.command,config:r.config,cwd:r.cwd,env:r.env,id:e,workspaceRoot:this.#n}),i=r.config.readiness?.tcp?.port??r.config.port??0,o=r.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,s.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:s.entry.logFile,pid:s.entry.pid,port:i})}catch(s){const i=s instanceof Error?s.message:String(s);this.#r.failed(e,"retry-failed",{message:i})}}}}var Ql=Object.defineProperty,Ce=v((t,e)=>Ql(t,"name",{value:e,configurable:!0}),"f");const Xl=Ce(t=>{const e=t.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Yn=Ce((t,e,r)=>{const s=[],i=[];for(const o of e){const n=r.tasks[o];if(!n){i.push({id:o,reason:"task not in graph"});continue}const c=n.overrides.command;if(!c){i.push({id:o,reason:"no command resolved"});continue}const u=Xl(n);if(!u?.service){i.push({id:o,reason:"no service config"});continue}const h=Bt(t,n.projectRoot,!!u.runFromWorkspaceRoot),{envFile:f}=u,p=f===void 0||f===!1?{}:or(h,f),l=u.service.env??{};s.push({command:c,config:u.service,cwd:h,env:{...p,...l},id:o})}return{services:s,skipped:i}},"extractPreflightTasks"),Zl=Ce((t,e)=>{const r=new Set(t),s=new Map;for(const n of t){const c=(e.dependencies[n]??[]).filter(u=>r.has(u));s.set(n,new Set(c))}const i=[],o=new Set;for(;s.size>0;){const n=[];for(const[c,u]of s){for(const h of u)o.has(h)&&u.delete(h);u.size===0&&n.push(c)}n.length===0&&n.push(...s.keys());for(const c of n)o.add(c),s.delete(c);n.sort(),i.push({ids:n})}return i},"planTopoLevels"),ed=Ce((t,e)=>{const r=[];for(const s of Zl(t,e))r.push(...s.ids);return r},"linearize"),td=String.raw`import { spawn } from "node:child_process";
64
64
  import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
65
65
  import { createConnection } from "node:net";
66
66
 
@@ -174,22 +174,22 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
174
174
  try { process.kill(-child.pid, "SIGTERM"); } catch {}
175
175
  process.exit(1);
176
176
  })();
177
- `,td=Ie(()=>{const t=Zi(he(To(),"vis-services-")),e=he(t,"bootstrap.mjs");return Vs(e,ed),{runDir:t,scriptPath:e}},"prepareBootstrap"),Yn=Ie((t,e,r)=>{const s=r.replaceAll(/[^\w-]/g,"_");return{configFile:he(t,`${s}.json`),logFile:he(t,`${s}.log`),pidFile:he(t,`${s}.pid`),scriptPath:e}},"buildBootstrapPaths"),rd=Ie(t=>{const{paths:e,service:r}=t,s=r.config.readiness?.tcp?.port??r.config.port;if(typeof s!="number")throw new TypeError(`Service ${r.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const i={...r.env,PATH:Ai(r.cwd,r.env)};return{command:r.command,cwd:r.cwd,env:i,host:r.config.readiness?.tcp?.host??"127.0.0.1",id:r.id,logFile:e.logFile,pidFile:e.pidFile,port:s,timeoutMs:r.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),sd=Ie(t=>`node ${JSON.stringify(t.scriptPath)} ${JSON.stringify(t.configFile)}`,"buildEphemeralCommand"),nd=Ie(t=>{const{id:e,visBin:r,workspaceRoot:s}=t;return`node ${JSON.stringify(r)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(s)}`},"buildRegistryCommand"),id=Ie(t=>{const{missingServiceIds:e,mode:r,taskGraph:s,visBin:i,workspaceRoot:o}=t,{services:n,skipped:c}=Kn(o,e,s);if(n.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:c};const u=Zl(n.map(x=>x.id),s),h=new Map(n.map(x=>[x.id,x])),f=[],p=[];if(r==="ephemeral")for(const x of u){const k=h.get(x);k&&p.push({id:x,payload:rd({paths:{logFile:"",pidFile:""},service:k})})}let l;r==="ephemeral"&&(l=td());let g;for(const x of u){const k=h.get(x),E=s.tasks[x];if(!k||!E)continue;let S;if(r==="ephemeral"){const C=Yn(l.runDir,l.scriptPath,x),w={...p.find(j=>j.id===x).payload,logFile:C.logFile,pidFile:C.pidFile};Vs(C.configFile,JSON.stringify(w)),S=sd(C),f.push(C.pidFile)}else S=nd({id:x,visBin:i,workspaceRoot:o});if(E.overrides={...E.overrides,command:S},E.cache=!1,s.tasks[x]=E,g!==void 0){const C=s.dependencies[x]??[];C.includes(g)||(s.dependencies[x]=[...C,g])}g=x}const y=new Set(u),I=new Map,D=Ie(x=>{const k=new Set,E=[...s.dependencies[x]??[]],S=new Set;for(;E.length>0;){const C=E.pop();if(!S.has(C)){S.add(C),y.has(C)&&k.add(C);for(const w of s.dependencies[C]??[])S.has(w)||E.push(w)}}return[...k].sort()},"collectTransitive");for(const x of Object.keys(s.dependencies)){if(y.has(x))continue;const k=D(x);if(k.length===0)continue;const E={};for(const S of k){const C=h.get(S);C?.config.env&&Object.assign(E,C.config.env)}Object.keys(E).length>0&&I.set(x,E)}return{chain:u,ephemeralPidFiles:f,runDir:l?.runDir,serviceEnvByTaskId:I,skipped:c}},"injectServiceTasks"),od=new Set(["auto","ephemeral","off","persistent"]),ad=Ie(t=>{const{cli:e,config:r,isCi:s,isPersistentTarget:i,isTty:o,target:n}=t;if(e!==void 0&&!od.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const c=e??r??(o&&!s?"auto":"off");return c==="off"?"off":c==="ephemeral"?"ephemeral":c==="persistent"?"registry":i||n==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var cd=Object.defineProperty,Ge=v((t,e)=>cd(t,"name",{value:e,configurable:!0}),"l$1");const Jn=Ge(t=>t.replace(/^--?/u,""),"asKebab"),ld=new Set(["0","1","false","no","true","yes"]),dd=Ge(t=>!t.startsWith("-")||/^-(?:\d|\.\d)/u.test(t),"isValueToken"),Ds=Ge((t,e,r,s,i,o)=>{if(s!==void 0)return t.set(e,s),0;const n=i[o+1];return(r?.type??"string")==="boolean"?n!==void 0&&ld.has(n.toLowerCase())?(t.set(e,n.toLowerCase()),1):(t.set(e,"true"),0):n!==void 0&&dd(n)?(t.set(e,n),1):(t.set(e,"true"),0)},"captureValue"),ud=Ge((t,e)=>{const r=t.type??"string";if(r==="number"){const s=e.trim(),i=Number(s);return s===""||!Number.isFinite(i)?{error:`--${t.name} expects a number, got "${e}"`}:{value:i}}if(r==="boolean")return["1","true","yes"].includes(e.toLowerCase())?{value:!0}:["0","false","no"].includes(e.toLowerCase())?{value:!1}:{error:`--${t.name} expects a boolean, got "${e}"`};if(r==="enum"){const s=t.choices??[];return s.includes(e)?{value:e}:{error:`--${t.name} must be one of [${s.join(", ")}], got "${e}"`}}return{value:e}},"coerce"),fd=Ge(t=>{const e=[],r=new Set;for(const s of t){const i=s.name||"<unnamed>";(!s.name||!/^[a-zA-Z][\w-]*$/u.test(s.name))&&e.push(`argument name "${i}" is empty or invalid (start with a letter; use letters, digits, '-', '_')`),r.has(s.name)&&e.push(`duplicate argument name "${i}"`),r.add(s.name),s.alias!==void 0&&s.alias.length!==1&&e.push(`argument "${i}" alias "${s.alias}" must be a single character`);const o=s.type??"string";if(o==="enum"&&(s.choices===void 0||s.choices.length===0)&&e.push(`argument "${i}" has type "enum" but declares no choices`),s.default!==void 0){const n=typeof s.default;o==="number"&&n==="number"||o==="boolean"&&n==="boolean"||(o==="string"||o==="enum")&&n==="string"?o==="enum"&&s.choices&&!s.choices.includes(s.default)&&e.push(`argument "${i}" default "${String(s.default)}" is not one of its choices`):e.push(`argument "${i}" default ${JSON.stringify(s.default)} does not match type "${o}"`)}}return e},"validateArgumentSchema"),hd=Ge((t,e)=>{const r=new Map,s=new Map;for(const h of t)r.set(h.name,h),h.alias&&s.set(h.alias,h);const i=new Map,o=[];for(let h=0;h<e.length;h+=1){const f=e[h];if(f==="--"){o.push(...e.slice(h+1));break}if(f.startsWith("--no-")){i.set(Jn(f.slice(5)),"false");continue}const p=/^--([^=]+)(?:=(.*))?$/su.exec(f);if(p){const y=p[1];h+=Ds(i,y,r.get(y),p[2],e,h);continue}const l=/^-([^=-])(?:=(.*))?$/su.exec(f),g=l?.[1];if(l&&g!==void 0){const y=s.get(g);h+=Ds(i,y?.name??g,y,l[2],e,h);continue}o.push(f)}const n={},c=[];let u=0;for(const h of t){let f=i.get(h.name);if(f===void 0&&h.positional&&u<o.length&&(f=o[u],u+=1),f===void 0){h.default!==void 0?n[h.name]=h.default:h.required&&c.push(`missing required argument --${h.name}`);continue}const{error:p,value:l}=ud(h,f);p?c.push(p):l!==void 0&&(n[h.name]=l)}return{errors:c,values:n}},"parseTaskArguments"),pd=Ge(t=>`VIS_ARG_${Jn(t).replaceAll(/[^a-zA-Z0-9]+/gu,"_").toUpperCase()}`,"taskArgumentEnvName"),gd=Ge(t=>{const e={};for(const[r,s]of Object.entries(t))e[pd(r)]=String(s);return e},"taskArgumentEnv"),Zt=Ge((t,e,r)=>{const s=[`Usage: vis run ${t} [-- <args>]`];if(e&&s.push("",e),r.length===0)return s.join(`
177
+ `,rd=Ce(()=>{const t=eo(fe(Co(),"vis-services-")),e=fe(t,"bootstrap.mjs");return Ks(e,td),{runDir:t,scriptPath:e}},"prepareBootstrap"),Jn=Ce((t,e,r)=>{const s=r.replaceAll(/[^\w-]/g,"_");return{configFile:fe(t,`${s}.json`),logFile:fe(t,`${s}.log`),pidFile:fe(t,`${s}.pid`),scriptPath:e}},"buildBootstrapPaths"),sd=Ce(t=>{const{paths:e,service:r}=t,s=r.config.readiness?.tcp?.port??r.config.port;if(typeof s!="number")throw new TypeError(`Service ${r.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const i={...r.env,PATH:Li(r.cwd,r.env)};return{command:r.command,cwd:r.cwd,env:i,host:r.config.readiness?.tcp?.host??"127.0.0.1",id:r.id,logFile:e.logFile,pidFile:e.pidFile,port:s,timeoutMs:r.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),nd=Ce(t=>`node ${JSON.stringify(t.scriptPath)} ${JSON.stringify(t.configFile)}`,"buildEphemeralCommand"),id=Ce(t=>{const{id:e,visBin:r,workspaceRoot:s}=t;return`node ${JSON.stringify(r)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(s)}`},"buildRegistryCommand"),od=Ce(t=>{const{missingServiceIds:e,mode:r,taskGraph:s,visBin:i,workspaceRoot:o}=t,{services:n,skipped:c}=Yn(o,e,s);if(n.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:c};const u=ed(n.map(x=>x.id),s),h=new Map(n.map(x=>[x.id,x])),f=[],p=[];if(r==="ephemeral")for(const x of u){const k=h.get(x);k&&p.push({id:x,payload:sd({paths:{logFile:"",pidFile:""},service:k})})}let l;r==="ephemeral"&&(l=rd());let g;for(const x of u){const k=h.get(x),M=s.tasks[x];if(!k||!M)continue;let S;if(r==="ephemeral"){const C=Jn(l.runDir,l.scriptPath,x),w={...p.find(j=>j.id===x).payload,logFile:C.logFile,pidFile:C.pidFile};Ks(C.configFile,JSON.stringify(w)),S=nd(C),f.push(C.pidFile)}else S=id({id:x,visBin:i,workspaceRoot:o});if(M.overrides={...M.overrides,command:S},M.cache=!1,s.tasks[x]=M,g!==void 0){const C=s.dependencies[x]??[];C.includes(g)||(s.dependencies[x]=[...C,g])}g=x}const y=new Set(u),R=new Map,B=Ce(x=>{const k=new Set,M=[...s.dependencies[x]??[]],S=new Set;for(;M.length>0;){const C=M.pop();if(!S.has(C)){S.add(C),y.has(C)&&k.add(C);for(const w of s.dependencies[C]??[])S.has(w)||M.push(w)}}return[...k].sort()},"collectTransitive");for(const x of Object.keys(s.dependencies)){if(y.has(x))continue;const k=B(x);if(k.length===0)continue;const M={};for(const S of k){const C=h.get(S);C?.config.env&&Object.assign(M,C.config.env)}Object.keys(M).length>0&&R.set(x,M)}return{chain:u,ephemeralPidFiles:f,runDir:l?.runDir,serviceEnvByTaskId:R,skipped:c}},"injectServiceTasks"),ad=new Set(["auto","ephemeral","off","persistent"]),cd=Ce(t=>{const{cli:e,config:r,isCi:s,isPersistentTarget:i,isTty:o,target:n}=t;if(e!==void 0&&!ad.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const c=e??r??(o&&!s?"auto":"off");return c==="off"?"off":c==="ephemeral"?"ephemeral":c==="persistent"?"registry":i||n==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var ld=Object.defineProperty,Ue=v((t,e)=>ld(t,"name",{value:e,configurable:!0}),"l$1");const Qn=Ue(t=>t.replace(/^--?/u,""),"asKebab"),dd=new Set(["0","1","false","no","true","yes"]),ud=Ue(t=>!t.startsWith("-")||/^-(?:\d|\.\d)/u.test(t),"isValueToken"),Bs=Ue((t,e,r,s,i,o)=>{if(s!==void 0)return t.set(e,s),0;const n=i[o+1];return(r?.type??"string")==="boolean"?n!==void 0&&dd.has(n.toLowerCase())?(t.set(e,n.toLowerCase()),1):(t.set(e,"true"),0):n!==void 0&&ud(n)?(t.set(e,n),1):(t.set(e,"true"),0)},"captureValue"),fd=Ue((t,e)=>{const r=t.type??"string";if(r==="number"){const s=e.trim(),i=Number(s);return s===""||!Number.isFinite(i)?{error:`--${t.name} expects a number, got "${e}"`}:{value:i}}if(r==="boolean")return["1","true","yes"].includes(e.toLowerCase())?{value:!0}:["0","false","no"].includes(e.toLowerCase())?{value:!1}:{error:`--${t.name} expects a boolean, got "${e}"`};if(r==="enum"){const s=t.choices??[];return s.includes(e)?{value:e}:{error:`--${t.name} must be one of [${s.join(", ")}], got "${e}"`}}return{value:e}},"coerce"),hd=Ue(t=>{const e=[],r=new Set;for(const s of t){const i=s.name||"<unnamed>";(!s.name||!/^[a-zA-Z][\w-]*$/u.test(s.name))&&e.push(`argument name "${i}" is empty or invalid (start with a letter; use letters, digits, '-', '_')`),r.has(s.name)&&e.push(`duplicate argument name "${i}"`),r.add(s.name),s.alias!==void 0&&s.alias.length!==1&&e.push(`argument "${i}" alias "${s.alias}" must be a single character`);const o=s.type??"string";if(o==="enum"&&(s.choices===void 0||s.choices.length===0)&&e.push(`argument "${i}" has type "enum" but declares no choices`),s.default!==void 0){const n=typeof s.default;o==="number"&&n==="number"||o==="boolean"&&n==="boolean"||(o==="string"||o==="enum")&&n==="string"?o==="enum"&&s.choices&&!s.choices.includes(s.default)&&e.push(`argument "${i}" default "${String(s.default)}" is not one of its choices`):e.push(`argument "${i}" default ${JSON.stringify(s.default)} does not match type "${o}"`)}}return e},"validateArgumentSchema"),pd=Ue((t,e)=>{const r=new Map,s=new Map;for(const h of t)r.set(h.name,h),h.alias&&s.set(h.alias,h);const i=new Map,o=[];for(let h=0;h<e.length;h+=1){const f=e[h];if(f==="--"){o.push(...e.slice(h+1));break}if(f.startsWith("--no-")){i.set(Qn(f.slice(5)),"false");continue}const p=/^--([^=]+)(?:=(.*))?$/su.exec(f);if(p){const y=p[1];h+=Bs(i,y,r.get(y),p[2],e,h);continue}const l=/^-([^=-])(?:=(.*))?$/su.exec(f),g=l?.[1];if(l&&g!==void 0){const y=s.get(g);h+=Bs(i,y?.name??g,y,l[2],e,h);continue}o.push(f)}const n={},c=[];let u=0;for(const h of t){let f=i.get(h.name);if(f===void 0&&h.positional&&u<o.length&&(f=o[u],u+=1),f===void 0){h.default!==void 0?n[h.name]=h.default:h.required&&c.push(`missing required argument --${h.name}`);continue}const{error:p,value:l}=fd(h,f);p?c.push(p):l!==void 0&&(n[h.name]=l)}return{errors:c,values:n}},"parseTaskArguments"),gd=Ue(t=>`VIS_ARG_${Qn(t).replaceAll(/[^a-zA-Z0-9]+/gu,"_").toUpperCase()}`,"taskArgumentEnvName"),md=Ue(t=>{const e={};for(const[r,s]of Object.entries(t))e[gd(r)]=String(s);return e},"taskArgumentEnv"),Zt=Ue((t,e,r)=>{const s=[`Usage: vis run ${t} [-- <args>]`];if(e&&s.push("",e),r.length===0)return s.join(`
178
178
  `);s.push("","Arguments:");const i=r.map(n=>{const c=n.positional?`<${n.name}>`:`--${n.name}`,u=n.alias?`, -${n.alias}`:"";return{left:`${c}${u}`,right:n}}),o=Math.max(...i.map(n=>n.left.length));for(const{left:n,right:c}of i){const u=[],h=c.type??"string";u.push(h==="enum"?`enum(${(c.choices??[]).join("|")})`:h),c.required&&u.push("required"),c.default!==void 0&&u.push(`default: ${String(c.default)}`);const f=`${c.description??""}${c.description?" ":""}[${u.join(", ")}]`;s.push(` ${n.padEnd(o)} ${f}`)}return s.join(`
179
- `)},"renderTaskArgumentsHelp");var md=Object.defineProperty,vd=v((t,e)=>md(t,"name",{value:e,configurable:!0}),"l");const wd=vd((t,e,r,s)=>{if(!r||r.length===0)return{env:{},kind:"ok"};const i=fd(r);if(i.length>0)return{errors:i.map(n=>`invalid \`arguments\` schema for "${t}": ${n}`),help:Zt(t,e,r),kind:"invalid"};if(s.includes("--help")||s.includes("-h"))return{kind:"help",text:Zt(t,e,r)};const o=hd(r,s);return o.errors.length>0?{errors:o.errors,help:Zt(t,e,r),kind:"invalid"}:{env:gd(o.values),kind:"ok"}},"resolveTaskArguments");var yd=Object.defineProperty,O=v((t,e)=>yd(t,"name",{value:e,configurable:!0}),"a");const Nr="VIS_AFFECTED_FILES",$d=2e3,Bs=O(async(t,e,r,s,i,o)=>{const n=t.map(S=>{const C=S.overrides.command;if(!C)return;const w=S.overrides.visOptions,j=Bt(e,S.projectRoot,!!w?.runFromWorkspaceRoot),F=w?.envFile?or(j,w.envFile):{},P=r&&(w?.affectedFiles==="env"||w?.affectedFiles==="both")?{[Nr]:r.join(`
180
- `)}:{},q=o?.get(S.id)??{},ae=ya({interactive:!!i,taskPty:S.pty,workspacePty:w?.pty});return{command:C,cwd:j,env:{INIT_CWD:s,...F,...q,...P,...S.overrides[Gr]},name:S.id,...ae?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(S=>S!==void 0);if(n.length===0)return;if(!i){await Mt(n,{killOthers:["failure"],onEvent:O(()=>{},"onEvent")});return}const{abortSignal:c,lifeCycle:u,stdinRegistry:h,store:f}=i,p=n.map(S=>t.find(C=>C.id===S.name)).filter(Boolean),l=O(S=>n[S]?.stdin==="pty","isPtyIndex"),g=new Map,y=O(S=>{if(!l(S))return;let C=g.get(S);return C||(C=new ar(Dt),g.set(S,C)),C},"getTermBuffer");f.unmarkDone(),u.startTasks?.(p);const I=new Map,D=new Map;let x;const k=O(()=>{for(const S of D.values())try{S("SIGTERM")}catch{}x||(x=setTimeout(()=>{for(const S of D.values())try{S("SIGKILL")}catch{}D.clear()},2e3),x.unref?.())},"killAll");let E;c&&(E=O(()=>{k()},"abortListener"),c.then(()=>{E?.()}).catch(()=>{E?.()}));try{await Mt(n,{killOthers:["failure"],onEvent:O(S=>{const C=p[S.index];if(C)switch(S.kind){case"close":{const w=I.get(C.id)??Date.now(),j=S.killed||S.exitCode===0?"success":"failure";u.endTasks?.([{code:S.exitCode??0,endTime:Date.now(),startTime:w,status:j,task:C,terminalOutput:f.getSnapshot().outputs.get(C.id)??""}]),D.delete(S.index),h?.delete(C.id);break}case"error":{if(S.message){const w=y(S.index);w?(w.write(`${S.message}
179
+ `)},"renderTaskArgumentsHelp");var vd=Object.defineProperty,wd=v((t,e)=>vd(t,"name",{value:e,configurable:!0}),"l");const yd=wd((t,e,r,s)=>{if(!r||r.length===0)return{env:{},kind:"ok"};const i=hd(r);if(i.length>0)return{errors:i.map(n=>`invalid \`arguments\` schema for "${t}": ${n}`),help:Zt(t,e,r),kind:"invalid"};if(s.includes("--help")||s.includes("-h"))return{kind:"help",text:Zt(t,e,r)};const o=pd(r,s);return o.errors.length>0?{errors:o.errors,help:Zt(t,e,r),kind:"invalid"}:{env:md(o.values),kind:"ok"}},"resolveTaskArguments");var $d=Object.defineProperty,O=v((t,e)=>$d(t,"name",{value:e,configurable:!0}),"a");const Nr="VIS_AFFECTED_FILES",xd=2e3,Ns=O(async(t,e,r,s,i,o)=>{const n=t.map(S=>{const C=S.overrides.command;if(!C)return;const w=S.overrides.visOptions,j=Bt(e,S.projectRoot,!!w?.runFromWorkspaceRoot),A=w?.envFile?or(j,w.envFile):{},P=r&&(w?.affectedFiles==="env"||w?.affectedFiles==="both")?{[Nr]:r.join(`
180
+ `)}:{},q=o?.get(S.id)??{},oe=$a({interactive:!!i,taskPty:S.pty,workspacePty:w?.pty});return{command:C,cwd:j,env:{INIT_CWD:s,...A,...q,...P,...S.overrides[Gr]},name:S.id,...oe?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(S=>S!==void 0);if(n.length===0)return;if(!i){await Ot(n,{killOthers:["failure"],onEvent:O(()=>{},"onEvent")});return}const{abortSignal:c,lifeCycle:u,stdinRegistry:h,store:f}=i,p=n.map(S=>t.find(C=>C.id===S.name)).filter(Boolean),l=O(S=>n[S]?.stdin==="pty","isPtyIndex"),g=new Map,y=O(S=>{if(!l(S))return;let C=g.get(S);return C||(C=new ar(Dt),g.set(S,C)),C},"getTermBuffer");f.unmarkDone(),u.startTasks?.(p);const R=new Map,B=new Map;let x;const k=O(()=>{for(const S of B.values())try{S("SIGTERM")}catch{}x||(x=setTimeout(()=>{for(const S of B.values())try{S("SIGKILL")}catch{}B.clear()},2e3),x.unref?.())},"killAll");let M;c&&(M=O(()=>{k()},"abortListener"),c.then(()=>{M?.()}).catch(()=>{M?.()}));try{await Ot(n,{killOthers:["failure"],onEvent:O(S=>{const C=p[S.index];if(C)switch(S.kind){case"close":{const w=R.get(C.id)??Date.now(),j=S.killed||S.exitCode===0?"success":"failure";u.endTasks?.([{code:S.exitCode??0,endTime:Date.now(),startTime:w,status:j,task:C,terminalOutput:f.getSnapshot().outputs.get(C.id)??""}]),B.delete(S.index),h?.delete(C.id);break}case"error":{if(S.message){const w=y(S.index);w?(w.write(`${S.message}
181
181
  `),f.setOutput(C.id,w.toString())):f.addOutput(C.id,`${S.message}
182
- `)}break}case"started":{I.set(C.id,Date.now()),S.kill&&D.set(S.index,S.kill),S.write&&h&&h.set(C.id,{kill:S.kill,resize:S.resize,write:S.write});break}case"stderr":case"stdout":{if(S.text){const w=y(S.index);w?(w.write(S.text),f.setOutput(C.id,w.toString())):f.addOutput(C.id,`${S.text}
183
- `)}break}}},"onEvent")})}finally{x&&(clearTimeout(x),x=void 0),f.markDone()}},"runPersistentTasks"),Ns=O(t=>{try{return process.kill(-t,0),!0}catch{try{return process.kill(t,0),!0}catch{return!1}}},"isPidAlive"),xd=O(t=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,t)},"sleepSyncMs"),kd=O(t=>{const{extraPids:e=[],pidFiles:r,runDir:s}=t,i=[],o=O(n=>{try{process.kill(-n,"SIGTERM")}catch{try{process.kill(n,"SIGTERM")}catch{}}},"sendSigterm");for(const n of r){let c;try{const u=fi(n),h=Number.parseInt(u.trim(),10);c=Number.isFinite(h)&&h>0?h:void 0}catch{continue}c!==void 0&&(i.push(c),o(c))}for(const n of e)!Number.isFinite(n)||n<=0||(i.push(n),o(n));if(i.length>0){const n=Date.now()+1500;for(;Date.now()<n;){let c=!0;for(const u of i)if(Ns(u)){c=!1;break}if(c)break;xd(100)}for(const c of i)if(Ns(c))try{process.kill(-c,"SIGKILL")}catch{try{process.kill(c,"SIGKILL")}catch{}}}s&&yi(s)},"cleanupEphemeralServices"),Dt=256*1024;class bd{static{v(this,"Yn")}static{O(this,"OutputRingBuffer")}#e;#s="";#r=!1;constructor(e){this.#e=e}append(e){this.#s+=e,this.#s.length>this.#e&&(this.#s=this.#s.slice(-this.#e),this.#r=!0)}toString(){return this.#r?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
184
- ${this.#s}`:this.#s}}const Xn=O(t=>{const e=t.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),jd=O(t=>`'${t.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),_r=O(t=>process.platform==="win32"?t.length>0&&!/[\s"&|<>^()%!]/.test(t)?t:`"${t.replaceAll('"','""')}"`:jd(t),"shellQuote"),Sd=O((t,e,r)=>{if(!e||e.length===0||r===!1||r===void 0)return t;if(r==="args"||r==="both"){const s=e.map(i=>_r(i)).join(" ");return`${t} ${s}`}return t},"buildAffectedFilesArgs"),Qn="visForwardedArgs",Gr="visTaskArgEnv",Td=O((t,e)=>{const r=e.overrides[Qn];if(!Array.isArray(r)||r.length===0)return t;const s=r.map(i=>_r(i)).join(" ");return`${t} ${s}`},"appendForwardedArgs"),Cd=O(async(t,e,r)=>{if(!e)return r();const s=t.get(e)??Promise.resolve();let i;const o=new Promise(c=>{i=c}),n=s.then(()=>o);t.set(e,n),await s;try{return await r()}finally{i(),t.get(e)===n&&t.delete(e)}},"withMutex"),Id=O(t=>{let e=Math.max(0,Math.floor(t));return{claim(r){const s=Math.max(0,Math.min(r,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),Rd=O((t,e,r)=>{const s=`${e}\0${typeof r=="string"?r:String(r)}`,i=t.get(s);if(i)return i;const o=or(e,r);return t.set(s,o),o},"loadEnvFileCached"),_s=O(t=>{const e=new Map;return async(r,s)=>{const{affectedFiles:i,currentOs:o,hooks:n,initCwd:c,lifeCycle:u,mutexPool:h,onOutput:f,onOutputReplace:p,retryBudget:l,serviceEnvByTaskId:g,serviceEventBridge:y,stdinRegistry:I,strictEnv:D,workspaceRoot:x}=t,k=Xn(r),E=Bt(x,s.cwd??r.projectRoot,k?.runFromWorkspaceRoot===!0),S=r.overrides.command;if(!S)return{code:0,terminalOutput:`No command configured for ${r.target.project}:${r.target.target}`};const C=Td(S,r),w=Sd(C,i,k?.affectedFiles),j=$i(k,o),F=k?.shellArgs,P=F&&F.length>0?F.join(" "):"-c",q=j?`${j} ${P} ${_r(w)}`:w,ae=k?.envFile?Rd(e,E,k.envFile):void 0,Q={};i&&i.length>0&&(k?.affectedFiles==="env"||k?.affectedFiles==="both")&&(Q[Nr]=i.join(`
185
- `));const V=g?.get(r.id),ce={INIT_CWD:c,...ae,...V,...s.env,...Q,...r.overrides[Gr]};if(k?.strictEnv??D??!1){const J=Ca({command:w,processEnv:process.env,taskEnv:ce,taskId:r.id});if(J){const me=Ia(J);return u?.onTaskStderr?.(r,me),{code:1,terminalOutput:me}}}const Re=k?.pty===!0,ie=!!I,ge=r.pty===!0?!0:r.pty===!1?!1:ie||Re;ge&&(r.cache=!1);const Y=ge?void 0:new bd(Dt),re=ge?new ar(Dt):void 0;let ue;const de=O(J=>{if(J.kind==="started"&&(ue=J.kill,J.write&&I&&I.set(r.id,{kill:J.kill,resize:J.resize,write:J.write}),y?.onRegistryTaskStarted(r.id)),(J.kind==="stdout"||J.kind==="stderr")&&J.text!==void 0)if(J.kind==="stdout"?u?.onTaskStdout?.(r,J.text):u?.onTaskStderr?.(r,J.text),re)re.write(J.text),ie&&p?.(r.id,re.toString()),y&&y.onTaskOutput(r.id,J.text);else{const me=`${J.text}
186
- `;Y.append(me),f?.(r.id,me)}J.kind==="close"&&(I&&I.delete(r.id),y&&y.onRegistryTaskClosed(r.id,J.exitCode??0,!!J.killed).catch(()=>{}))},"onEvent"),N=O(async()=>{const J=k?.retryCount??0,me=k?.retryDelay,Ve=l?l.claim(J):J,Ke=typeof k?.timeout=="number"&&k.timeout>0?k.timeout:0,st=typeof k?.killGracePeriodMs=="number"&&k.killGracePeriodMs>=0?k.killGracePeriodMs:5e3;let oe=!1,Ae=0;const qe=Pl({killGracePeriodMs:st,onTimeout:O(()=>{oe=!0},"onTimeout"),sendSignal:O(ke=>{ue?.(ke)},"sendSignal"),timeoutMs:Ke});let xe;try{xe=await Mt([{command:q,cwd:E,env:ce,name:r.id,...ge?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:de,...Ve>0?{restart:{delay:me??"exponential",onRetry:O(async(ke,We,be)=>{Ae=ke,n&&await n.callHook("task:retry",r,ke,be)},"onRetry"),tries:Ve}}:{}})}finally{qe.cancel()}const Ue=xe.closeEvents[0],Ee=re?re.toString():Y.toString();return oe?{code:124,retryAttempts:Ae,terminalOutput:`${Ee}
182
+ `)}break}case"started":{R.set(C.id,Date.now()),S.kill&&B.set(S.index,S.kill),S.write&&h&&h.set(C.id,{kill:S.kill,resize:S.resize,write:S.write});break}case"stderr":case"stdout":{if(S.text){const w=y(S.index);w?(w.write(S.text),f.setOutput(C.id,w.toString())):f.addOutput(C.id,`${S.text}
183
+ `)}break}}},"onEvent")})}finally{x&&(clearTimeout(x),x=void 0),f.markDone()}},"runPersistentTasks"),_s=O(t=>{try{return process.kill(-t,0),!0}catch{try{return process.kill(t,0),!0}catch{return!1}}},"isPidAlive"),kd=O(t=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,t)},"sleepSyncMs"),bd=O(t=>{const{extraPids:e=[],pidFiles:r,runDir:s}=t,i=[],o=O(n=>{try{process.kill(-n,"SIGTERM")}catch{try{process.kill(n,"SIGTERM")}catch{}}},"sendSigterm");for(const n of r){let c;try{const u=hi(n),h=Number.parseInt(u.trim(),10);c=Number.isFinite(h)&&h>0?h:void 0}catch{continue}c!==void 0&&(i.push(c),o(c))}for(const n of e)!Number.isFinite(n)||n<=0||(i.push(n),o(n));if(i.length>0){const n=Date.now()+1500;for(;Date.now()<n;){let c=!0;for(const u of i)if(_s(u)){c=!1;break}if(c)break;kd(100)}for(const c of i)if(_s(c))try{process.kill(-c,"SIGKILL")}catch{try{process.kill(c,"SIGKILL")}catch{}}}s&&$i(s)},"cleanupEphemeralServices"),Dt=256*1024;class jd{static{v(this,"Kn")}static{O(this,"OutputRingBuffer")}#e;#s="";#r=!1;constructor(e){this.#e=e}append(e){this.#s+=e,this.#s.length>this.#e&&(this.#s=this.#s.slice(-this.#e),this.#r=!0)}toString(){return this.#r?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
184
+ ${this.#s}`:this.#s}}const Xn=O(t=>{const e=t.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),Sd=O(t=>`'${t.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),_r=O(t=>process.platform==="win32"?t.length>0&&!/[\s"&|<>^()%!]/.test(t)?t:`"${t.replaceAll('"','""')}"`:Sd(t),"shellQuote"),Td=O((t,e,r)=>{if(!e||e.length===0||r===!1||r===void 0)return t;if(r==="args"||r==="both"){const s=e.map(i=>_r(i)).join(" ");return`${t} ${s}`}return t},"buildAffectedFilesArgs"),Zn="visForwardedArgs",Gr="visTaskArgEnv",Cd=O((t,e)=>{const r=e.overrides[Zn];if(!Array.isArray(r)||r.length===0)return t;const s=r.map(i=>_r(i)).join(" ");return`${t} ${s}`},"appendForwardedArgs"),Id=O(async(t,e,r)=>{if(!e)return r();const s=t.get(e)??Promise.resolve();let i;const o=new Promise(c=>{i=c}),n=s.then(()=>o);t.set(e,n),await s;try{return await r()}finally{i(),t.get(e)===n&&t.delete(e)}},"withMutex"),Rd=O(t=>{let e=Math.max(0,Math.floor(t));return{claim(r){const s=Math.max(0,Math.min(r,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),Ed=O((t,e,r)=>{const s=`${e}\0${typeof r=="string"?r:String(r)}`,i=t.get(s);if(i)return i;const o=or(e,r);return t.set(s,o),o},"loadEnvFileCached"),Gs=O(t=>{const e=new Map;return async(r,s)=>{const{affectedFiles:i,currentOs:o,hooks:n,initCwd:c,lifeCycle:u,mutexPool:h,onOutput:f,onOutputReplace:p,retryBudget:l,serviceEnvByTaskId:g,serviceEventBridge:y,stdinRegistry:R,strictEnv:B,workspaceRoot:x}=t,k=Xn(r),M=Bt(x,s.cwd??r.projectRoot,k?.runFromWorkspaceRoot===!0),S=r.overrides.command;if(!S)return{code:0,terminalOutput:`No command configured for ${r.target.project}:${r.target.target}`};const C=Cd(S,r),w=Td(C,i,k?.affectedFiles),j=xi(k,o),A=k?.shellArgs,P=A&&A.length>0?A.join(" "):"-c",q=j?`${j} ${P} ${_r(w)}`:w,oe=k?.envFile?Ed(e,M,k.envFile):void 0,Q={};i&&i.length>0&&(k?.affectedFiles==="env"||k?.affectedFiles==="both")&&(Q[Nr]=i.join(`
185
+ `));const V=g?.get(r.id),ae={INIT_CWD:c,...oe,...V,...s.env,...Q,...r.overrides[Gr]};if(k?.strictEnv??B??!1){const L=Ia({command:w,processEnv:process.env,taskEnv:ae,taskId:r.id});if(L){const ge=Ra(L);return u?.onTaskStderr?.(r,ge),{code:1,terminalOutput:ge}}}const Ie=k?.pty===!0,ne=!!R,pe=r.pty===!0?!0:r.pty===!1?!1:ne||Ie;pe&&(r.cache=!1);const $e=pe?void 0:new jd(Dt),J=pe?new ar(Dt):void 0;let Y;const ue=O(L=>{if(L.kind==="started"&&(Y=L.kill,L.write&&R&&R.set(r.id,{kill:L.kill,resize:L.resize,write:L.write}),y?.onRegistryTaskStarted(r.id)),(L.kind==="stdout"||L.kind==="stderr")&&L.text!==void 0)if(L.kind==="stdout"?u?.onTaskStdout?.(r,L.text):u?.onTaskStderr?.(r,L.text),J)J.write(L.text),ne&&p?.(r.id,J.toString()),y&&y.onTaskOutput(r.id,L.text);else{const ge=`${L.text}
186
+ `;$e.append(ge),f?.(r.id,ge)}L.kind==="close"&&(R&&R.delete(r.id),y&&y.onRegistryTaskClosed(r.id,L.exitCode??0,!!L.killed).catch(()=>{}))},"onEvent"),ce=O(async()=>{const L=k?.retryCount??0,ge=k?.retryDelay,We=l?l.claim(L):L,Ke=typeof k?.timeout=="number"&&k.timeout>0?k.timeout:0,st=typeof k?.killGracePeriodMs=="number"&&k.killGracePeriodMs>=0?k.killGracePeriodMs:5e3;let Ye=!1,re=0;const He=Fl({killGracePeriodMs:st,onTimeout:O(()=>{Ye=!0},"onTimeout"),sendSignal:O(je=>{Y?.(je)},"sendSignal"),timeoutMs:Ke});let De;try{De=await Ot([{command:q,cwd:M,env:ae,name:r.id,...pe?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:ue,...We>0?{restart:{delay:ge??"exponential",onRetry:O(async(je,Be,Ne)=>{re=je,n&&await n.callHook("task:retry",r,je,Ne)},"onRetry"),tries:We}}:{}})}finally{He.cancel()}const Re=De.closeEvents[0],xe=J?J.toString():$e.toString();return Ye?{code:124,retryAttempts:re,terminalOutput:`${xe}
187
187
  [timeout] Task "${r.id}" exceeded ${Ke}ms budget.
188
- `}:{code:Ue?.exitCode??1,retryAttempts:Ae,terminalOutput:Ee}},"runOnce");return h?Cd(h,k?.mutex,N):N()}},"createConcurrentExecutor"),Ed=O(t=>{if(!t||t.trim().length===0)return;const e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?{invalid:t}:{value:Math.floor(e)}},"parseEnvConcurrency"),Od=O(async(t,e)=>{const r=await Li(t,{dataDirectory:Ot(t)});if(!r){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Di(t,{dataDirectory:Ot(t)})}.`);return}const s=(r.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${r.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(r.stats.total)}`),e.info(` Succeeded: ${String(r.stats.succeeded)}`),e.info(` Cached: ${String(r.stats.cached)}`),e.info(` Failed: ${String(r.stats.failed)}`),e.info(` Skipped: ${String(r.stats.skipped)}`),e.info(""),r.stats.failed>0){const o=r.tasks.filter(n=>n.exitCode!==void 0&&n.exitCode!==0);e.info("Failed tasks:");for(const n of o){const c=n.duration??0;e.info(` × ${n.taskId} (exit ${String(n.exitCode??-1)}, ${c}ms)`)}e.info("")}const i=[...r.tasks].filter(o=>typeof o.duration=="number").sort((o,n)=>(n.duration??0)-(o.duration??0)).slice(0,5);if(i.length>0){e.info("Slowest tasks:");for(const o of i)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),Md=O(t=>{if(!(t===void 0||t==="")){if(t!=="read"&&t!=="write"&&t!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${t}")`);return t}},"parseCacheMode"),Pd=O(t=>{if(!(t===void 0||t==="")){if(t!=="http"&&t!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${t}")`);return t}},"parseCacheBackend"),Qd=O(async({argument:t,logger:e,options:r,runtime:s,visConfig:i,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const n=o;if(xi(n),r.lastDetails===!0){await Od(n,e);return}const c=process.cwd(),u=await ki(n),{config:h,packageJsons:f,projectOptions:p,workspace:l}=bi(n,i,u),g=ji(n,l,f);let y=t[0];if(!y){const m=ws(l);if(process.stdout.isTTY&&process.stdin.isTTY){const b=await Aa(m);if(!b){e.info("No target selected.");return}y=b,await Il(`vis run ${b}`)}else{e.info("Available targets:"),e.info(""),e.info(Fa(m)),e.info(""),e.info("Usage: vis run <target>");return}}if(h.constraints&&!r.skipConstraints){const m=Bi(g,h.constraints);if(m.length>0){for(const b of m)e.error(`[${b.rule}] ${b.message}`);throw new Error(`${m.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(r.affected){const m=[y];r.parallel!==void 0&&m.push(`--parallel=${String(r.parallel)}`),r.cache||m.push("--no-cache"),r.query&&m.push(`--query=${String(r.query)}`),r.reverse&&m.push("--reverse"),typeof r.runnerTags=="string"&&r.runnerTags!==""&&m.push(`--runner-tags=${r.runnerTags}`),await s.runCommand("affected",{argv:m});return}const I=await go(y,l,process.cwd(),n),D=Ea(p),x=Oa(I.target,D);x!==I.target&&e.debug?.(`Resolved alias "${I.target}" → "${x}"`);let k=I.projects;const E=t.slice(1).map(String);if(r.projects){const m=new Set(r.projects.split(",").map(b=>b.trim()));if(k=k.filter(b=>m.has(b)),k.length===0)throw new Error(`No matching projects found for: ${String(r.projects)}`)}if(r.query&&(k=mo(k,l,r.query),k.length===0)){e.info(`Query "${String(r.query)}" matched no projects.`);return}const S=Si(),C=process.env[Nr],w=C?C.split(`
189
- `).filter(Boolean):void 0,j=(typeof r.runnerTags=="string"?r.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,F=j?new Set(j.split(",").map(m=>m.trim()).filter(Boolean)):void 0,P=[],q=new Map;for(const m of k){const b=p.get(m)?.[x];if(!b)continue;const R=b.options;if(!R?.internal){if(!Ti(R,!!pt)){e.debug?.(`Skipping ${m}:${x} — runInCI filter`);continue}if(!Ci(R,F)){e.debug?.(`Skipping ${m}:${x} — runner-tags filter`);continue}P.push(m),q.set(m,b)}}if(P.length===0){const m=ws(l),b=Object.entries(l.projects).filter(([,R])=>R.targets?.[x]!==void 0).map(([R])=>R);if(e.error(`No projects have the "${x}" target.`),b.length>0){e.info(""),e.info(`Target "${x}" exists in these projects but was filtered out:`);for(const R of b.slice(0,5))e.info(` - ${R}`);b.length>5&&e.info(` …and ${b.length-5} more`)}else{const R=en(x,m,3);R.length>0&&(e.info(""),e.info(R.length===1?`Did you mean "${R[0]}"?`:`Did you mean one of: ${R.map(_=>`"${_}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ae=r.pty===!0,Q=P.map(m=>({project:m,schema:q.get(m)?.arguments})).filter(m=>Array.isArray(m.schema)&&m.schema.length>0),V=new Map;for(const{project:m,schema:b}of Q){const R=JSON.stringify(b),_=V.get(R)??[];_.push(m),V.set(R,_)}if(V.size>1){const m=[...V.values()].map(b=>b.join(", ")).join(" | ");throw new Error(`Target "${x}" declares conflicting \`arguments\` schemas across projects (${m}). Run a single project (e.g. \`vis run ${Q[0]?.project}:${x}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ce=Q[0]?.schema,Re=q.get(Q[0]?.project??P[0])?.description,ie=wd(x,Re,ce,E);if(ie.kind==="help"){e.info(ie.text);return}if(ie.kind==="invalid"){e.info(`Invalid arguments for "${x}":`);for(const m of ie.errors)e.info(` ✖ ${m}`);throw e.info(""),e.info(ie.help),new Error(`Invalid arguments for target "${x}"`)}const ge=ie.env;let Y=P.map(m=>{const b=l.projects[m],R=q.get(m),_={project:m,target:x},z=`${m}:${x}`,Z=ae?{...R.options,pty:R.options?.pty??!0}:R.options,G=R.command?as(R.command,{affectedFiles:w,projectRoot:b?.root}):R.command,B=b?.root&&b.root.length>0?b.root:".",le=(R.outputs??[]).map(L=>typeof L!="string"?L:L.replaceAll("{projectRoot}",B).replaceAll("{projectName}",m));return{cache:R.cache,id:z,outputs:le,overrides:{command:G,...E.length>0?{[Qn]:E}:{},...Object.keys(ge).length>0?{[Gr]:ge}:{},...Z?{visOptions:Z}:{}},parallelism:R.parallelism,projectRoot:b?.root,target:_}});const re=[],ue=[];for(const m of Y)Xn(m)?.persistent?(m.cache=!1,re.push(m)):ue.push(m);Y=ue;const de=Ni(r.partition);if(de&&(Y=_i.partitionTasks(Y,de),e.info(`Partition ${de.index}/${de.total}: running ${Y.length} task(s)`),Y.length===0)){e.info("No tasks assigned to this partition.");return}let N=Gi([...Y,...re],{onCycleBroken:O(m=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${m.join(" → ")}`)},"onCycleBroken"),projectGraph:g,targetDefaults:h.tasks,workspace:l});for(const[m,b]of Object.entries(N.tasks)){const R=b.target.project,_=b.target.target,z=p.get(R)?.[_];if(!z)continue;const Z=l.projects[R];let G=!1;const B={...b.overrides};B.visOptions===void 0&&z.options&&(B.visOptions=z.options,G=!0),B.command===void 0&&z.command&&(B.command=as(z.command,{affectedFiles:w,projectRoot:Z?.root}),G=!0),G&&(b.overrides=B,N.tasks[m]=b)}if(typeof r.skipCache=="string"&&r.skipCache.trim()!=="")if(r.cache){const m=ka(r.skipCache,l,Object.keys(N.tasks));for(const b of m.skipTaskIds){const R=N.tasks[b];R!==void 0&&(R.cache=!1)}m.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${m.unmatchedPatterns.map(b=>`"${b}"`).join(", ")}`),m.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(m.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await ro(n,h.toolchain,{error:O(m=>{e.error(m)},"error"),info:O(m=>{e.info(m)},"info"),warn:O(m=>{e.warn(m)},"warn")},!!r.skipToolchain);const J=r.preflight!==!1&&h.preflight?.lockfile!==!1,me=Ki(n,pt,{warn:O(m=>{e.warn(m)},"warn")},{skip:!J});if(!me.shouldContinue)throw new Error(`${me.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);J&&!pt&&process.stdin.isTTY&&process.stdout.isTTY&&await ma(n,{interactive:!0,logger:{info:O(m=>{e.info(m)},"info"),warn:O(m=>{e.warn(m)},"warn")},projectManifests:[...f.values()]});const Ve=process.env.VIS_VERSION??"0.0.0",Ke=r.dryRun?void 0:async m=>{try{return await ho(m.config,{timeoutMs:$d}),!0}catch{return!1}},st=await ao(n),oe=await Wl({initialTasks:[...Y,...re],probe:Ke,registeredEntries:st,taskGraph:N,visVersion:Ve}),Ae=[];let qe,xe=0;const Ue=[],Ee=new Map;let ke=[];const We=new Set;let be=null,we=null;if(oe.diagnostics.length>0){const m=!!(process.stdout.isTTY&&process.stdin.isTTY),b=r.dryRun?"off":ad({cli:r.services,config:h.run?.services,isCi:!!pt,isPersistentTarget:re.length>0,isTty:m,target:x});if(b==="off"){for(const B of oe.diagnostics)e.error(B.message);throw new Error(`${oe.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const R=oe.diagnostics.map(B=>B.targetId),_=b,z=_==="registry"?Kn(n,R,N):void 0,Z=process.argv[1]??"vis",G=id({missingServiceIds:R,mode:_,taskGraph:N,visBin:Z,workspaceRoot:n});if(G.skipped.length>0){for(const{id:B,reason:le}of G.skipped)e.error(`Cannot auto-start ${B}: ${le}`);throw new Error(`${G.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Ae.push(...G.ephemeralPidFiles),qe=G.runDir,ke=G.chain;for(const B of G.chain)We.add(B);if(_==="registry"&&(xe=G.chain.length,Ue.push(...G.chain)),G.chain.length>0){const B=new ys(G.chain),le=new Map;if(_==="ephemeral"&&G.runDir)for(const L of G.chain){const H=Yn(G.runDir,`${G.runDir}/bootstrap.mjs`,L);le.set(L,{ephemeral:{configFile:H.configFile,cwd:n,logFile:H.logFile,pidFile:H.pidFile,scriptPath:H.scriptPath},mode:"ephemeral"})}else if(_==="registry"&&z)for(const L of z.services)le.set(L.id,{mode:"registry",registry:{command:L.command,config:L.config,cwd:L.cwd,env:L.env}});if(le.size>0){const L=new Yl({indexToId:new Map,services:le,sink:{crashed:O((H,U)=>{B.markCrashed(H,U)},"crashed"),failed:O((H,U,se)=>{B.markFailed(H,U,se)},"failed"),log:O((H,U)=>{B.appendLog(H,U)},"log"),ready:O((H,U)=>{B.markReady(H,U)},"ready"),started:O((H,U)=>{B.markStarted(H,U),_==="registry"&&U!==null&&Ee.set(H,U)},"started"),starting:O(H=>{B.markStarting(H)},"starting")},workspaceRoot:n});be=B,we=L}}for(const[B,le]of G.serviceEnvByTaskId){const L=oe.serviceEnvByTaskId.get(B)??{};oe.serviceEnvByTaskId.set(B,{...L,...le})}}const M=new Set(re.map(m=>m.id));if(Y=oe.initialTasks.filter(m=>!M.has(m.id)),N=oe.taskGraph,ke.length>0&&(Y=[...ke.map(m=>N.tasks[m]).filter(m=>m!==void 0),...Y]),re.length>0){const m=new Set(re.map(Z=>Z.id)),b={};for(const[Z,G]of Object.entries(N.tasks))m.has(Z)||(b[Z]=G);const R={};for(const[Z,G]of Object.entries(N.dependencies))m.has(Z)||(R[Z]=G.filter(B=>!m.has(B)));const _=new Set;for(const Z of Object.values(R))for(const G of Z)_.add(G);const z=Object.keys(b).filter(Z=>!_.has(Z));N={dependencies:R,roots:z,tasks:b}}const{serviceEnvByTaskId:T}=oe;if(oe.satisfiedServices.length>0){const m=oe.satisfiedServices.map(b=>b.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${m}`),be)for(const b of oe.satisfiedServices)be.registerService(b.id);else be=new ys(oe.satisfiedServices.map(b=>b.id));for(const b of oe.satisfiedServices){const R=b.config.readiness?.tcp?.port??b.config.port??0,_=b.config.readiness?.tcp?.host??"127.0.0.1";be.markReady(b.id,{host:_,port:R})}}if(r.reverse&&(N=qi(N),e.debug?.(`Reversed task graph: ${String(N.roots.length)} new root(s) (originally leaves)`)),r.dryRun){const m=Object.keys(N.tasks).length,b=N.roots.length;e.info(`Execution plan (${String(m)} task(s), ${String(b)} root(s)):`),e.info("");const R=new Set,_=O((z,Z)=>{if(R.has(z))return;R.add(z);for(const le of N.dependencies[z]??[])_(le,Z+1);const G=N.tasks[z],B=" ".repeat(Z+1);e.info(`${B}${z}${G?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const z of N.roots)_(z,0);for(const z of Object.keys(N.tasks))_(z,0);re.length>0&&(e.info(""),e.info(` + ${String(re.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const A=Date.now(),X=co(),Ye=O((m,b)=>{const R=b instanceof Error?b.message:String(b);e.warn(`Plugin error in ${m}: ${R}`)},"onHookError");await lo(X,h.plugins);const dt=typeof r.profile=="string"?r.profile:void 0,qr=O(async m=>{if(!dt)return;const b=cs(m,N,A),R=dt.startsWith("/")?dt:`${n}/${dt}`;await Ui(b,R),e.info(`Profile written to ${dt}`)},"maybeWriteProfile"),jt=h.taskRunner??{},Zn=Ii(n,r.cacheDir,jt.cacheDirectory,h.sharedWorktreeCache),ei=Ri(Zn,n,h.branchScopedCache),nt=Ed(process.env.VIS_RUN_CONCURRENCY_LIMIT);nt&&"invalid"in nt&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${nt.invalid} is not a positive number; falling back to default concurrency.`);const ti=nt&&"value"in nt?nt.value:void 0,ri=r.parallel??ti??3,Ur=r.strictEnv??h.strictEnv??!1,Wr=new Set,Je={dryRun:r.dryRun??!1,parallel:ri,skipNxCache:!r.cache,summarize:r.summarize??!1,...jt,cacheDirectory:ei,namedInputs:h.namedInputs,dataDirectory:jt.dataDirectory??Ot(n),onFingerprint:O(async(m,b)=>{await X.callHook("task:fingerprint",m,b)},"onFingerprint"),onDiagnostic:O((m,b)=>{Wr.has(m)||(Wr.add(m),e.warn(b))},"onDiagnostic")},Hr=Wi(jt.remoteCache);if(Hr){const m=Md(r.cacheMode),b=Pd(r.cacheBackend);if(Je.remoteCache={...Hr,...m?{mode:m}:{},...b?{backend:b}:{}},Je.remoteCache.attestation){const{expectedIdentity:R,requireOnDownload:_}=Je.remoteCache.attestation;if(!(R!==void 0&&("github"in R&&typeof R.github?.ref=="string"&&typeof R.github.repo=="string"&&typeof R.github.workflow=="string"||"oidcIssuer"in R&&typeof R.oidcIssuer=="string"&&(typeof R.san=="string"||typeof R.sanRegex=="string"))))throw new Error("[vis run] remoteCache.attestation requires a pinned keyless signer via `expectedIdentity`. Use one of:\n • { github: { repo, workflow, ref } } (GitHub Actions — recommended)\n • { oidcIssuer, san } (literal identity; vis regex-escapes + anchors it)\n • { oidcIssuer, sanRegex } (advanced: raw regex, you own anchoring)\nWithout it, verification is integrity-only — use `remoteCache.signing` (HMAC) for that instead.");"sanRegex"in R&&(!R.sanRegex.startsWith("^")||!R.sanRegex.endsWith("$"))&&e.warn("[vis run] remoteCache.attestation.expectedIdentity.sanRegex is not anchored (^…$). sigstore matches it as a regex; an unanchored value is substring-matched and weakens the identity pin. Prefer the literal `san` form unless you need a pattern.");const{installCommandFor:z,isSigstoreInstalled:Z}=await import("./loader.js");Z()||e.warn(`[vis run] remoteCache.attestation is configured but the optional \`sigstore\` package is not installed. Cache uploads will be unsigned and signed entries can't be verified until you install it:
190
- ${z(n)}`);const{buildCacheAttestationHooks:G}=await import("./cache-attestation.js");Je.remoteCache.attestation=G({expectedIdentity:R,onReject:O((B,le)=>{e.warn(`[vis run] remote cache entry ${B.slice(0,12)} rejected: attestation ${le}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:O(B=>{e.warn(`[vis run] attestation verification failed: ${B}`)},"onVerifyFailure"),requireOnDownload:_,workspaceRoot:n})}}else(r.cacheMode||r.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const si=process.stdout.isTTY&&!pt,ni=h.tui?.autoExit??!1,zr={args:{parallel:Je.parallel,targets:[x]},autoExit:ni,projectNames:P,tasks:[...Y,...re]},Vr=typeof r.retryBudget=="number"?r.retryBudget:void 0,Kr=Vr===void 0?void 0:Id(Vr),Yr=new uo(X,Ye),Jr=new to(n),Xr=jl(typeof r.outputStyle=="string"?r.outputStyle.toLowerCase():void 0);if(oe.satisfiedServices.length>0)for(const m of oe.satisfiedServices){const b=oe.serviceDependentsByServiceId.get(m.id)??[];try{await X.callHook("service:attach",m,b)}catch(R){Ye("service:attach",R)}}await X.callHook("run:before",{tasks:Y,workspaceRoot:n});const ut=r.stopServices===!0;let Qr=!1;const Zr=O(()=>{if(Qr)return;Qr=!0,we&&we.dispose().catch(()=>{});const m=ut?[...Ee.values()]:void 0;kd({extraPids:m,pidFiles:Ae,runDir:qe})},"runCleanupOnce"),St=O(()=>{Zr()},"onCleanupSignal"),es=Ae.length>0||qe!==void 0||ut&&Ue.length>0;es&&(process.on("SIGINT",St),process.on("SIGTERM",St));try{if(si){const m=new Map,b=kl({...zr,onRetryService:we?L=>we.retry(L):void 0,outputStyle:Xr,serviceDockStore:be,stdinRegistry:m}),{lifeCycle:R,store:_}=b,z=new ls([R,Yr,Jr]),Z=_s({affectedFiles:w,currentOs:S,hooks:X,initCwd:c,lifeCycle:z,mutexPool:new Map,onOutput:O((L,H)=>{we&&We.has(L)?we.onTaskOutput(L,H):_.addOutput(L,H)},"onOutput"),onOutputReplace:O((L,H)=>{_.setOutput(L,H)},"onOutputReplace"),retryBudget:Kr,serviceEnvByTaskId:T,serviceEventBridge:we??void 0,stdinRegistry:m,strictEnv:Ur,workspaceRoot:n});let G="rerun",B=null,le=new Map;for(;G!=="quit";){if(G==="rerun"){if(le=await ds(Y,Je,{lifeCycle:z,projectGraph:g,taskExecutor:Z,taskGraph:N,workspaceRoot:n}),re.length>0&&!r.failFast){const L=new Promise(H=>{const U=_.subscribe(()=>{const se=_.getSnapshot();(se.rerunRequested||se.retryTaskId)&&(U(),H())});b.renderIsDone.then(()=>{U(),H()}).catch(()=>{U(),H()})});await Bs(re,n,w,c,{abortSignal:L,lifeCycle:z,stdinRegistry:m,store:_},T)}}else if(G==="retry"&&B){const L=Y.find(U=>U.id===B),H=L?.overrides.command;if(L&&H){const U=Bt(n,L.projectRoot,!1);z.startTasks?.([L]);const se=new ar(Dt),ye=(await Mt([{command:H,cwd:U,name:L.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:O(fe=>{fe.kind==="started"&&fe.write&&m.set(L.id,{kill:fe.kill,resize:fe.resize,write:fe.write}),(fe.kind==="stdout"||fe.kind==="stderr")&&fe.text&&(se.write(fe.text),_.setOutput(L.id,se.toString())),fe.kind==="close"&&m.delete(L.id)},"onEvent")})).closeEvents[0];z.endTasks?.([{code:ye?.exitCode??1,status:ye?.exitCode===0?"success":"failure",task:L,terminalOutput:_.getSnapshot().outputs.get(L.id)}])}else L&&z.endTasks?.([{code:1,status:"failure",task:L,terminalOutput:`No command configured for ${L.id}`}]);B=null,_.markDone()}G=await new Promise(L=>{const H=_.subscribe(()=>{const U=_.getSnapshot();U.rerunRequested&&(_.acknowledgeRerun(),H(),L("rerun")),U.retryTaskId&&(B=_.acknowledgeRetry(),H(),L("retry"))});b.renderIsDone.then(()=>{H(),L("quit")}).catch(()=>{H(),L("quit")})})}await b.renderIsDone,await X.callHook("run:after",le),await qr(le),xe>0&&(e.info(""),ut?e.info(`${String(xe)} service(s) stopped (--stop-services).`):e.info(`${String(xe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const m=new Map,b=typeof r.log=="string"?r.log.toLowerCase():"",R=b==="labeled"||b==="grouped"||b==="interleaved"?b:void 0,_=R?Hi(R):void 0,z=new ls([new Tl({...zr,ciGrouping:i?.run?.ciGrouping??"auto",logReporter:_,outputStyle:Xr}),Yr,Jr]),Z=_s({affectedFiles:w,currentOs:S,hooks:X,initCwd:c,lifeCycle:z,mutexPool:m,retryBudget:Kr,serviceEnvByTaskId:T,serviceEventBridge:we??void 0,strictEnv:Ur,workspaceRoot:n}),G=O(async()=>{const U=Date.now(),se=await ds(Y,Je,{lifeCycle:z,projectGraph:g,taskExecutor:Z,taskGraph:N,workspaceRoot:n}),ye=Date.now()-U;if(r.summarize){const Ce=cs(se,N,A);await zi(Ce,n,{dataDirectory:Ot(n)})}let fe=!1;for(const[,Ce]of se)Ce.status==="failure"&&(fe=!0);const Te=Ei(se,ye),Oe=Oi(n),He=Mi(n,ye,Oe);return e.info(""),e.info(` ${Te}${He?` ${He}`:""}`),{hasFailure:fe,results:se,runHistory:Oe}},"runOnce"),B=await G();await X.callHook("run:after",B.results),await qr(B.results);const{hasFailure:le}=B;if(r.watch){const U=P.map(ve=>{const je=l.projects[ve]?.root;if(je)return je.startsWith("/")?je:`${n}/${je}`}).filter(ve=>ve!==void 0),se=Y;let ye;const fe=O(ve=>{const je=Ll(se,ve);return ye=je.filter,Y=je.tasks,je.tasks.length},"applyFilter");let Te=!1,Oe=B.results;const He=O(()=>{const ve=ps(Oe,n);if(ve.directories.length>0&&ve.files.size>0){const je=Co(ve.files,n,ve.directories);return{handle:gs({filter:je,onChange:Tt,paths:ve.directories}),mode:"tracked"}}return{handle:gs({onChange:Tt,paths:U}),mode:"roots"}},"buildHandle");let Ce;const Tt=O(async ve=>{if(!Te){Te=!0;try{e.info(`Change detected in ${ve.length} file(s), rerunning…`),Oe=(await G()).results,Ce?.close(),Ce=He().handle}finally{Te=!1}}},"onChangeHandler"),ts=He();Ce=ts.handle;const ii=ts.mode==="tracked"?`Watching ${String(ps(Oe,n).files.size)} tracked file(s)`:`Watching ${String(U.length)} project root(s)`;e.info(`${ii} — edit a file to rerun, press h for keybinds, q to quit.`);const zt=O(async()=>{if(!Te){Te=!0;try{if(Y.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Oe=(await G()).results,Ce?.close(),Ce=He().handle}finally{Te=!1}}},"triggerRerun");await new Promise(ve=>{let je=!1,rs;const ss=O(()=>{ns()},"onSigint"),ns=O(()=>{je||(je=!0,rs?.close(),process.off("SIGINT",ss),Ce?.close(),ve())},"exit");process.on("SIGINT",ss),rs=Gl({handlers:{onClearFilter:O(async()=>{const ft=fe(void 0);e.info(`Filter cleared — running ${String(ft)} task(s).`),await zt()},"onClearFilter"),onFilter:O(async ft=>{const oi=ye,is=fe(ft);if(is===0){e.info(`Filter "${ft}" matched no projects — keeping previous filter.`),fe(oi);return}e.info(`Filter "${ft}" matched ${String(is)} task(s).`),await zt()},"onFilter"),onHelp:O(()=>{Nl(process.stdout)},"onHelp"),onQuit:O(()=>{ns()},"onQuit"),onRerun:zt}})});return}if(r.flaky!==!1){const U=Pi(n,{minRuns:2},B.runHistory);if(U.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const se of Fi(U))e.info(` ${se}`);e.info("")}}const L=[];for(const[U,se]of B.results)se.retryAttempts&&se.retryAttempts>0&&L.push(U);const H=r.failOnRetry===!0&&L.length>0;if(H){const U=L.slice(0,5),se=L.length-U.length,ye=se>0?`${U.join(", ")}, and ${String(se)} more`:U.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(L.length)} task(s) succeeded only after retry: ${ye}`)}if(le||H){const U=H&&!le?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",se=2e3,ye=[];for(const[fe,Te]of B.results){if(Te.status!=="failure")continue;const Oe=Te.terminalOutput??"",He=Oe.length>se?`…${Oe.slice(-se)}`:Oe,Ce=Te.code??"?";ye.push(` ${fe} (exit ${String(Ce)}):
191
- ${He.split(`
188
+ `}:{code:Re?.exitCode??1,retryAttempts:re,terminalOutput:xe}},"runOnce");return h?Id(h,k?.mutex,ce):ce()}},"createConcurrentExecutor"),Md=O(t=>{if(!t||t.trim().length===0)return;const e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?{invalid:t}:{value:Math.floor(e)}},"parseEnvConcurrency"),Od=O(async(t,e)=>{const r=await Di(t,{dataDirectory:Mt(t)});if(!r){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Bi(t,{dataDirectory:Mt(t)})}.`);return}const s=(r.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${r.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(r.stats.total)}`),e.info(` Succeeded: ${String(r.stats.succeeded)}`),e.info(` Cached: ${String(r.stats.cached)}`),e.info(` Failed: ${String(r.stats.failed)}`),e.info(` Skipped: ${String(r.stats.skipped)}`),e.info(""),r.stats.failed>0){const o=r.tasks.filter(n=>n.exitCode!==void 0&&n.exitCode!==0);e.info("Failed tasks:");for(const n of o){const c=n.duration??0;e.info(` × ${n.taskId} (exit ${String(n.exitCode??-1)}, ${c}ms)`)}e.info("")}const i=[...r.tasks].filter(o=>typeof o.duration=="number").sort((o,n)=>(n.duration??0)-(o.duration??0)).slice(0,5);if(i.length>0){e.info("Slowest tasks:");for(const o of i)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),Pd=O(t=>{if(!(t===void 0||t==="")){if(t!=="read"&&t!=="write"&&t!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${t}")`);return t}},"parseCacheMode"),Fd=O(t=>{if(!(t===void 0||t==="")){if(t!=="http"&&t!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${t}")`);return t}},"parseCacheBackend"),Ad=O(t=>{if(!(t===void 0||t==="")){if(t!=="declared"&&t!=="trace")throw new Error(`--hash-mode must be one of: declared, trace (received "${t}")`);return t}},"parseHashMode"),eu=O(async({argument:t,logger:e,options:r,runtime:s,visConfig:i,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const n=o;if(ki(n),r.lastDetails===!0){await Od(n,e);return}const c=process.cwd(),u=await bi(n),{config:h,packageJsons:f,projectOptions:p,workspace:l}=ji(n,i,u),g=Si(n,l,f);let y=t[0];if(!y){const m=ys(l);if(process.stdout.isTTY&&process.stdin.isTTY){const b=await La(m);if(!b){e.info("No target selected.");return}y=b,await Rl(`vis run ${b}`)}else{e.info("Available targets:"),e.info(""),e.info(Aa(m)),e.info(""),e.info("Usage: vis run <target>");return}}if(h.constraints&&!r.skipConstraints){const m=Ni(g,h.constraints);if(m.length>0){for(const b of m)e.error(`[${b.rule}] ${b.message}`);throw new Error(`${m.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(r.affected){const m=[y];r.parallel!==void 0&&m.push(`--parallel=${String(r.parallel)}`),r.cache||m.push("--no-cache"),r.query&&m.push(`--query=${String(r.query)}`),r.reverse&&m.push("--reverse"),typeof r.runnerTags=="string"&&r.runnerTags!==""&&m.push(`--runner-tags=${r.runnerTags}`),await s.runCommand("affected",{argv:m});return}const R=await mo(y,l,process.cwd(),n),B=Ma(p),x=Oa(R.target,B);x!==R.target&&e.debug?.(`Resolved alias "${R.target}" → "${x}"`);let k=R.projects;const M=t.slice(1).map(String);if(r.projects){const m=new Set(r.projects.split(",").map(b=>b.trim()));if(k=k.filter(b=>m.has(b)),k.length===0)throw new Error(`No matching projects found for: ${String(r.projects)}`)}if(r.query&&(k=vo(k,l,r.query),k.length===0)){e.info(`Query "${String(r.query)}" matched no projects.`);return}const S=Ti(),C=process.env[Nr],w=C?C.split(`
189
+ `).filter(Boolean):void 0,j=(typeof r.runnerTags=="string"?r.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,A=j?new Set(j.split(",").map(m=>m.trim()).filter(Boolean)):void 0,P=[],q=new Map;for(const m of k){const b=p.get(m)?.[x];if(!b)continue;const I=b.options;if(!I?.internal){if(!Ci(I,!!pt)){e.debug?.(`Skipping ${m}:${x} — runInCI filter`);continue}if(!Ii(I,A)){e.debug?.(`Skipping ${m}:${x} — runner-tags filter`);continue}P.push(m),q.set(m,b)}}if(P.length===0){const m=ys(l),b=Object.entries(l.projects).filter(([,I])=>I.targets?.[x]!==void 0).map(([I])=>I);if(e.error(`No projects have the "${x}" target.`),b.length>0){e.info(""),e.info(`Target "${x}" exists in these projects but was filtered out:`);for(const I of b.slice(0,5))e.info(` - ${I}`);b.length>5&&e.info(` …and ${b.length-5} more`)}else{const I=tn(x,m,3);I.length>0&&(e.info(""),e.info(I.length===1?`Did you mean "${I[0]}"?`:`Did you mean one of: ${I.map(G=>`"${G}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const oe=r.pty===!0,Q=P.map(m=>({project:m,schema:q.get(m)?.arguments})).filter(m=>Array.isArray(m.schema)&&m.schema.length>0),V=new Map;for(const{project:m,schema:b}of Q){const I=JSON.stringify(b),G=V.get(I)??[];G.push(m),V.set(I,G)}if(V.size>1){const m=[...V.values()].map(b=>b.join(", ")).join(" | ");throw new Error(`Target "${x}" declares conflicting \`arguments\` schemas across projects (${m}). Run a single project (e.g. \`vis run ${Q[0]?.project}:${x}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ae=Q[0]?.schema,Ie=q.get(Q[0]?.project??P[0])?.description,ne=yd(x,Ie,ae,M);if(ne.kind==="help"){e.info(ne.text);return}if(ne.kind==="invalid"){e.info(`Invalid arguments for "${x}":`);for(const m of ne.errors)e.info(` ✖ ${m}`);throw e.info(""),e.info(ne.help),new Error(`Invalid arguments for target "${x}"`)}const pe=ne.env,$e=Ad(r.hashMode);let J=P.map(m=>{const b=l.projects[m],I=q.get(m),G={project:m,target:x},z=`${m}:${x}`,X=oe?{...I.options,pty:I.options?.pty??!0}:I.options,_=I.command?cs(I.command,{affectedFiles:w,projectRoot:b?.root}):I.command,N=b?.root&&b.root.length>0?b.root:".",le=(I.outputs??[]).map(D=>typeof D!="string"?D:D.replaceAll("{projectRoot}",N).replaceAll("{projectName}",m));return{cache:I.cache,hashMode:$e??I.hashMode,id:z,outputs:le,overrides:{command:_,...M.length>0?{[Zn]:M}:{},...Object.keys(pe).length>0?{[Gr]:pe}:{},...X?{visOptions:X}:{}},parallelism:I.parallelism,projectRoot:b?.root,target:G}});const Y=[],ue=[];for(const m of J)Xn(m)?.persistent?(m.cache=!1,Y.push(m)):ue.push(m);J=ue;const ce=_i(r.partition);if(ce&&(J=Gi.partitionTasks(J,ce),e.info(`Partition ${ce.index}/${ce.total}: running ${J.length} task(s)`),J.length===0)){e.info("No tasks assigned to this partition.");return}let L=qi([...J,...Y],{onCycleBroken:O(m=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${m.join(" → ")}`)},"onCycleBroken"),projectGraph:g,targetDefaults:h.tasks,workspace:l});for(const[m,b]of Object.entries(L.tasks)){const I=b.target.project,G=b.target.target,z=p.get(I)?.[G];if(!z)continue;const X=l.projects[I];let _=!1;const N={...b.overrides};N.visOptions===void 0&&z.options&&(N.visOptions=z.options,_=!0),N.command===void 0&&z.command&&(N.command=cs(z.command,{affectedFiles:w,projectRoot:X?.root}),_=!0),_&&(b.overrides=N,L.tasks[m]=b)}if(typeof r.skipCache=="string"&&r.skipCache.trim()!=="")if(r.cache){const m=ba(r.skipCache,l,Object.keys(L.tasks));for(const b of m.skipTaskIds){const I=L.tasks[b];I!==void 0&&(I.cache=!1)}m.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${m.unmatchedPatterns.map(b=>`"${b}"`).join(", ")}`),m.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(m.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await so(n,h.toolchain,{error:O(m=>{e.error(m)},"error"),info:O(m=>{e.info(m)},"info"),warn:O(m=>{e.warn(m)},"warn")},!!r.skipToolchain);const ge=r.preflight!==!1&&h.preflight?.lockfile!==!1,We=Yi(n,pt,{warn:O(m=>{e.warn(m)},"warn")},{skip:!ge});if(!We.shouldContinue)throw new Error(`${We.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);ge&&!pt&&process.stdin.isTTY&&process.stdout.isTTY&&await va(n,{interactive:!0,logger:{info:O(m=>{e.info(m)},"info"),warn:O(m=>{e.warn(m)},"warn")},projectManifests:[...f.values()]});const Ke=process.env.VIS_VERSION??"0.0.0",st=r.dryRun?void 0:async m=>{try{return await po(m.config,{timeoutMs:xd}),!0}catch{return!1}},Ye=await co(n),re=await Hl({initialTasks:[...J,...Y],probe:st,registeredEntries:Ye,taskGraph:L,visVersion:Ke}),He=[];let De,Re=0;const xe=[],je=new Map;let Be=[];const Ne=new Set;let Ee=null,E=null;if(re.diagnostics.length>0){const m=!!(process.stdout.isTTY&&process.stdin.isTTY),b=r.dryRun?"off":cd({cli:r.services,config:h.run?.services,isCi:!!pt,isPersistentTarget:Y.length>0,isTty:m,target:x});if(b==="off"){for(const N of re.diagnostics)e.error(N.message);throw new Error(`${re.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const I=re.diagnostics.map(N=>N.targetId),G=b,z=G==="registry"?Yn(n,I,L):void 0,X=process.argv[1]??"vis",_=od({missingServiceIds:I,mode:G,taskGraph:L,visBin:X,workspaceRoot:n});if(_.skipped.length>0){for(const{id:N,reason:le}of _.skipped)e.error(`Cannot auto-start ${N}: ${le}`);throw new Error(`${_.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}He.push(..._.ephemeralPidFiles),De=_.runDir,Be=_.chain;for(const N of _.chain)Ne.add(N);if(G==="registry"&&(Re=_.chain.length,xe.push(..._.chain)),_.chain.length>0){const N=new $s(_.chain),le=new Map;if(G==="ephemeral"&&_.runDir)for(const D of _.chain){const H=Jn(_.runDir,`${_.runDir}/bootstrap.mjs`,D);le.set(D,{ephemeral:{configFile:H.configFile,cwd:n,logFile:H.logFile,pidFile:H.pidFile,scriptPath:H.scriptPath},mode:"ephemeral"})}else if(G==="registry"&&z)for(const D of z.services)le.set(D.id,{mode:"registry",registry:{command:D.command,config:D.config,cwd:D.cwd,env:D.env}});if(le.size>0){const D=new Jl({indexToId:new Map,services:le,sink:{crashed:O((H,U)=>{N.markCrashed(H,U)},"crashed"),failed:O((H,U,te)=>{N.markFailed(H,U,te)},"failed"),log:O((H,U)=>{N.appendLog(H,U)},"log"),ready:O((H,U)=>{N.markReady(H,U)},"ready"),started:O((H,U)=>{N.markStarted(H,U),G==="registry"&&U!==null&&je.set(H,U)},"started"),starting:O(H=>{N.markStarting(H)},"starting")},workspaceRoot:n});Ee=N,E=D}}for(const[N,le]of _.serviceEnvByTaskId){const D=re.serviceEnvByTaskId.get(N)??{};re.serviceEnvByTaskId.set(N,{...D,...le})}}const T=new Set(Y.map(m=>m.id));if(J=re.initialTasks.filter(m=>!T.has(m.id)),L=re.taskGraph,Be.length>0&&(J=[...Be.map(m=>L.tasks[m]).filter(m=>m!==void 0),...J]),Y.length>0){const m=new Set(Y.map(X=>X.id)),b={};for(const[X,_]of Object.entries(L.tasks))m.has(X)||(b[X]=_);const I={};for(const[X,_]of Object.entries(L.dependencies))m.has(X)||(I[X]=_.filter(N=>!m.has(N)));const G=new Set;for(const X of Object.values(I))for(const _ of X)G.add(_);const z=Object.keys(b).filter(X=>!G.has(X));L={dependencies:I,roots:z,tasks:b}}const{serviceEnvByTaskId:F}=re;if(re.satisfiedServices.length>0){const m=re.satisfiedServices.map(b=>b.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${m}`),Ee)for(const b of re.satisfiedServices)Ee.registerService(b.id);else Ee=new $s(re.satisfiedServices.map(b=>b.id));for(const b of re.satisfiedServices){const I=b.config.readiness?.tcp?.port??b.config.port??0,G=b.config.readiness?.tcp?.host??"127.0.0.1";Ee.markReady(b.id,{host:G,port:I})}}if(r.reverse&&(L=Ui(L),e.debug?.(`Reversed task graph: ${String(L.roots.length)} new root(s) (originally leaves)`)),r.dryRun){const m=Object.keys(L.tasks).length,b=L.roots.length;e.info(`Execution plan (${String(m)} task(s), ${String(b)} root(s)):`),e.info("");const I=new Set,G=O((z,X)=>{if(I.has(z))return;I.add(z);for(const D of L.dependencies[z]??[])G(D,X+1);const _=L.tasks[z],N=" ".repeat(X+1),le=`${_?.cache===!1?" (no-cache)":""}${_?.hashMode==="trace"?" (trace)":""}`;e.info(`${N}${z}${le}`)},"walkPlan");for(const z of L.roots)G(z,0);for(const z of Object.keys(L.tasks))G(z,0);Y.length>0&&(e.info(""),e.info(` + ${String(Y.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const ie=Date.now(),ve=lo(),qr=O((m,b)=>{const I=b instanceof Error?b.message:String(b);e.warn(`Plugin error in ${m}: ${I}`)},"onHookError");await uo(ve,h.plugins);const dt=typeof r.profile=="string"?r.profile:void 0,Ur=O(async m=>{if(!dt)return;const b=ls(m,L,ie),I=dt.startsWith("/")?dt:`${n}/${dt}`;await Wi(b,I),e.info(`Profile written to ${dt}`)},"maybeWriteProfile"),jt=h.taskRunner??{},ei=Ri(n,r.cacheDir,jt.cacheDirectory,h.sharedWorktreeCache),ti=Ei(ei,n,h.branchScopedCache),nt=Md(process.env.VIS_RUN_CONCURRENCY_LIMIT);nt&&"invalid"in nt&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${nt.invalid} is not a positive number; falling back to default concurrency.`);const ri=nt&&"value"in nt?nt.value:void 0,si=r.parallel??ri??3,Wr=r.strictEnv??h.strictEnv??!1,Hr=new Set,Je={dryRun:r.dryRun??!1,parallel:si,skipNxCache:!r.cache,summarize:r.summarize??!1,...jt,cacheDirectory:ti,namedInputs:h.namedInputs,dataDirectory:jt.dataDirectory??Mt(n),onFingerprint:O(async(m,b)=>{await ve.callHook("task:fingerprint",m,b)},"onFingerprint"),onDiagnostic:O((m,b)=>{Hr.has(m)||(Hr.add(m),e.warn(b))},"onDiagnostic")},zr=Hi(jt.remoteCache);if(zr){const m=Pd(r.cacheMode),b=Fd(r.cacheBackend);if(Je.remoteCache={...zr,...m?{mode:m}:{},...b?{backend:b}:{}},Je.remoteCache.attestation){const{expectedIdentity:I,requireOnDownload:G}=Je.remoteCache.attestation;if(!(I!==void 0&&("github"in I&&typeof I.github?.ref=="string"&&typeof I.github.repo=="string"&&typeof I.github.workflow=="string"||"oidcIssuer"in I&&typeof I.oidcIssuer=="string"&&(typeof I.san=="string"||typeof I.sanRegex=="string"))))throw new Error("[vis run] remoteCache.attestation requires a pinned keyless signer via `expectedIdentity`. Use one of:\n • { github: { repo, workflow, ref } } (GitHub Actions — recommended)\n • { oidcIssuer, san } (literal identity; vis regex-escapes + anchors it)\n • { oidcIssuer, sanRegex } (advanced: raw regex, you own anchoring)\nWithout it, verification is integrity-only — use `remoteCache.signing` (HMAC) for that instead.");"sanRegex"in I&&(!I.sanRegex.startsWith("^")||!I.sanRegex.endsWith("$"))&&e.warn("[vis run] remoteCache.attestation.expectedIdentity.sanRegex is not anchored (^…$). sigstore matches it as a regex; an unanchored value is substring-matched and weakens the identity pin. Prefer the literal `san` form unless you need a pattern.");const{installCommandFor:z,isSigstoreInstalled:X}=await import("./loader.js");X()||e.warn(`[vis run] remoteCache.attestation is configured but the optional \`sigstore\` package is not installed. Cache uploads will be unsigned and signed entries can't be verified until you install it:
190
+ ${z(n)}`);const{buildCacheAttestationHooks:_}=await import("./cache-attestation.js");Je.remoteCache.attestation=_({expectedIdentity:I,onReject:O((N,le)=>{e.warn(`[vis run] remote cache entry ${N.slice(0,12)} rejected: attestation ${le}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:O(N=>{e.warn(`[vis run] attestation verification failed: ${N}`)},"onVerifyFailure"),requireOnDownload:G,workspaceRoot:n})}}else(r.cacheMode||r.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ni=process.stdout.isTTY&&!pt,ii=h.tui?.autoExit??!1,Vr={args:{parallel:Je.parallel,targets:[x]},autoExit:ii,projectNames:P,tasks:[...J,...Y]},Kr=typeof r.retryBudget=="number"?r.retryBudget:void 0,Yr=Kr===void 0?void 0:Rd(Kr),Jr=new fo(ve,qr),Qr=new ro(n),Xr=Sl(typeof r.outputStyle=="string"?r.outputStyle.toLowerCase():void 0);if(re.satisfiedServices.length>0)for(const m of re.satisfiedServices){const b=re.serviceDependentsByServiceId.get(m.id)??[];try{await ve.callHook("service:attach",m,b)}catch(I){qr("service:attach",I)}}await ve.callHook("run:before",{tasks:J,workspaceRoot:n});const ut=r.stopServices===!0;let Zr=!1;const es=O(()=>{if(Zr)return;Zr=!0,E&&E.dispose().catch(()=>{});const m=ut?[...je.values()]:void 0;bd({extraPids:m,pidFiles:He,runDir:De})},"runCleanupOnce"),St=O(()=>{es()},"onCleanupSignal"),ts=He.length>0||De!==void 0||ut&&xe.length>0;ts&&(process.on("SIGINT",St),process.on("SIGTERM",St));try{if(ni){const m=new Map,b=bl({...Vr,onRetryService:E?D=>E.retry(D):void 0,outputStyle:Xr,serviceDockStore:Ee,stdinRegistry:m}),{lifeCycle:I,store:G}=b,z=new ds([I,Jr,Qr]),X=Gs({affectedFiles:w,currentOs:S,hooks:ve,initCwd:c,lifeCycle:z,mutexPool:new Map,onOutput:O((D,H)=>{E&&Ne.has(D)?E.onTaskOutput(D,H):G.addOutput(D,H)},"onOutput"),onOutputReplace:O((D,H)=>{G.setOutput(D,H)},"onOutputReplace"),retryBudget:Yr,serviceEnvByTaskId:F,serviceEventBridge:E??void 0,stdinRegistry:m,strictEnv:Wr,workspaceRoot:n});let _="rerun",N=null,le=new Map;for(;_!=="quit";){if(_==="rerun"){if(le=await us(J,Je,{lifeCycle:z,projectGraph:g,taskExecutor:X,taskGraph:L,workspaceRoot:n}),Y.length>0&&!r.failFast){const D=new Promise(H=>{const U=G.subscribe(()=>{const te=G.getSnapshot();(te.rerunRequested||te.retryTaskId)&&(U(),H())});b.renderIsDone.then(()=>{U(),H()}).catch(()=>{U(),H()})});await Ns(Y,n,w,c,{abortSignal:D,lifeCycle:z,stdinRegistry:m,store:G},F)}}else if(_==="retry"&&N){const D=J.find(U=>U.id===N),H=D?.overrides.command;if(D&&H){const U=Bt(n,D.projectRoot,!1);z.startTasks?.([D]);const te=new ar(Dt),we=(await Ot([{command:H,cwd:U,name:D.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:O(de=>{de.kind==="started"&&de.write&&m.set(D.id,{kill:de.kill,resize:de.resize,write:de.write}),(de.kind==="stdout"||de.kind==="stderr")&&de.text&&(te.write(de.text),G.setOutput(D.id,te.toString())),de.kind==="close"&&m.delete(D.id)},"onEvent")})).closeEvents[0];z.endTasks?.([{code:we?.exitCode??1,status:we?.exitCode===0?"success":"failure",task:D,terminalOutput:G.getSnapshot().outputs.get(D.id)}])}else D&&z.endTasks?.([{code:1,status:"failure",task:D,terminalOutput:`No command configured for ${D.id}`}]);N=null,G.markDone()}_=await new Promise(D=>{const H=G.subscribe(()=>{const U=G.getSnapshot();U.rerunRequested&&(G.acknowledgeRerun(),H(),D("rerun")),U.retryTaskId&&(N=G.acknowledgeRetry(),H(),D("retry"))});b.renderIsDone.then(()=>{H(),D("quit")}).catch(()=>{H(),D("quit")})})}await b.renderIsDone,await ve.callHook("run:after",le),await Ur(le),Re>0&&(e.info(""),ut?e.info(`${String(Re)} service(s) stopped (--stop-services).`):e.info(`${String(Re)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const m=new Map,b=typeof r.log=="string"?r.log.toLowerCase():"",I=b==="labeled"||b==="grouped"||b==="interleaved"?b:void 0,G=I?zi(I):void 0,z=new ds([new Cl({...Vr,ciGrouping:i?.run?.ciGrouping??"auto",logReporter:G,outputStyle:Xr}),Jr,Qr]),X=Gs({affectedFiles:w,currentOs:S,hooks:ve,initCwd:c,lifeCycle:z,mutexPool:m,retryBudget:Yr,serviceEnvByTaskId:F,serviceEventBridge:E??void 0,strictEnv:Wr,workspaceRoot:n}),_=O(async()=>{const U=Date.now(),te=await us(J,Je,{lifeCycle:z,projectGraph:g,taskExecutor:X,taskGraph:L,workspaceRoot:n}),we=Date.now()-U;if(r.summarize){const Te=ls(te,L,ie);await Vi(Te,n,{dataDirectory:Mt(n)})}let de=!1;for(const[,Te]of te)Te.status==="failure"&&(de=!0);const Se=Mi(te,we),Me=Oi(n),ze=Pi(n,we,Me);return e.info(""),e.info(` ${Se}${ze?` ${ze}`:""}`),{hasFailure:de,results:te,runHistory:Me}},"runOnce"),N=await _();await ve.callHook("run:after",N.results),await Ur(N.results);const{hasFailure:le}=N;if(r.watch){const U=P.map(me=>{const ke=l.projects[me]?.root;if(ke)return ke.startsWith("/")?ke:`${n}/${ke}`}).filter(me=>me!==void 0),te=J;let we;const de=O(me=>{const ke=Dl(te,me);return we=ke.filter,J=ke.tasks,ke.tasks.length},"applyFilter");let Se=!1,Me=N.results;const ze=O(()=>{const me=gs(Me,n);if(me.directories.length>0&&me.files.size>0){const ke=Io(me.files,n,me.directories);return{handle:ms({filter:ke,onChange:Tt,paths:me.directories}),mode:"tracked"}}return{handle:ms({onChange:Tt,paths:U}),mode:"roots"}},"buildHandle");let Te;const Tt=O(async me=>{if(!Se){Se=!0;try{e.info(`Change detected in ${me.length} file(s), rerunning…`),Me=(await _()).results,Te?.close(),Te=ze().handle}finally{Se=!1}}},"onChangeHandler"),rs=ze();Te=rs.handle;const oi=rs.mode==="tracked"?`Watching ${String(gs(Me,n).files.size)} tracked file(s)`:`Watching ${String(U.length)} project root(s)`;e.info(`${oi} — edit a file to rerun, press h for keybinds, q to quit.`);const zt=O(async()=>{if(!Se){Se=!0;try{if(J.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Me=(await _()).results,Te?.close(),Te=ze().handle}finally{Se=!1}}},"triggerRerun");await new Promise(me=>{let ke=!1,ss;const ns=O(()=>{is()},"onSigint"),is=O(()=>{ke||(ke=!0,ss?.close(),process.off("SIGINT",ns),Te?.close(),me())},"exit");process.on("SIGINT",ns),ss=ql({handlers:{onClearFilter:O(async()=>{const ft=de(void 0);e.info(`Filter cleared — running ${String(ft)} task(s).`),await zt()},"onClearFilter"),onFilter:O(async ft=>{const ai=we,os=de(ft);if(os===0){e.info(`Filter "${ft}" matched no projects — keeping previous filter.`),de(ai);return}e.info(`Filter "${ft}" matched ${String(os)} task(s).`),await zt()},"onFilter"),onHelp:O(()=>{_l(process.stdout)},"onHelp"),onQuit:O(()=>{is()},"onQuit"),onRerun:zt}})});return}if(r.flaky!==!1){const U=Fi(n,{minRuns:2},N.runHistory);if(U.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const te of Ai(U))e.info(` ${te}`);e.info("")}}const D=[];for(const[U,te]of N.results)te.retryAttempts&&te.retryAttempts>0&&D.push(U);const H=r.failOnRetry===!0&&D.length>0;if(H){const U=D.slice(0,5),te=D.length-U.length,we=te>0?`${U.join(", ")}, and ${String(te)} more`:U.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(D.length)} task(s) succeeded only after retry: ${we}`)}if(le||H){const U=H&&!le?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",te=2e3,we=[];for(const[de,Se]of N.results){if(Se.status!=="failure")continue;const Me=Se.terminalOutput??"",ze=Me.length>te?`…${Me.slice(-te)}`:Me,Te=Se.code??"?";we.push(` ${de} (exit ${String(Te)}):
191
+ ${ze.split(`
192
192
  `).map(Tt=>` ${Tt}`).join(`
193
- `)}`)}throw new Error(ye.length>0?`${U}
194
- ${ye.join(`
195
- `)}`:U)}re.length>0&&!r.failFast&&await Bs(re,n,w,c,void 0,T),xe>0&&(e.info(""),ut?e.info(`${String(xe)} service(s) stopped (--stop-services).`):e.info(`${String(xe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{Zr(),es&&(process.off("SIGINT",St),process.off("SIGTERM",St)),ut&&Ue.length>0&&await Promise.all(Ue.map(async m=>{try{await fo(n,m)}catch{}}))}},"execute");export{Id as createRetryBudget,Qd as default};
193
+ `)}`)}throw new Error(we.length>0?`${U}
194
+ ${we.join(`
195
+ `)}`:U)}Y.length>0&&!r.failFast&&await Ns(Y,n,w,c,void 0,F),Re>0&&(e.info(""),ut?e.info(`${String(Re)} service(s) stopped (--stop-services).`):e.info(`${String(Re)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{es(),ts&&(process.off("SIGINT",St),process.off("SIGTERM",St)),ut&&xe.length>0&&await Promise.all(xe.map(async m=>{try{await ho(n,m)}catch{}}))}},"execute");export{Rd as createRetryBudget,eu as default};