@visulima/vis 1.0.0-alpha.24 → 1.0.0-alpha.25

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 (90) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/LICENSE.md +1260 -152
  3. package/README.md +5 -3
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +1 -1
  6. package/dist/config/index.d.ts +19 -0
  7. package/dist/packem_chunks/bin.js +299 -290
  8. package/dist/packem_chunks/fix.js +1 -1
  9. package/dist/packem_chunks/handler.js +1 -1
  10. package/dist/packem_chunks/handler10.js +2 -2
  11. package/dist/packem_chunks/handler11.js +1 -1
  12. package/dist/packem_chunks/handler12.js +1 -1
  13. package/dist/packem_chunks/handler13.js +1 -1
  14. package/dist/packem_chunks/handler14.js +10 -10
  15. package/dist/packem_chunks/handler15.js +1 -1
  16. package/dist/packem_chunks/handler16.js +1 -1
  17. package/dist/packem_chunks/handler17.js +1 -1
  18. package/dist/packem_chunks/handler18.js +1 -1
  19. package/dist/packem_chunks/handler19.js +1 -1
  20. package/dist/packem_chunks/handler2.js +2 -2
  21. package/dist/packem_chunks/handler20.js +1 -1
  22. package/dist/packem_chunks/handler21.js +5 -5
  23. package/dist/packem_chunks/handler22.js +2 -2
  24. package/dist/packem_chunks/handler23.js +2 -2
  25. package/dist/packem_chunks/handler24.js +1 -1
  26. package/dist/packem_chunks/handler25.js +1 -1
  27. package/dist/packem_chunks/handler27.js +1 -1
  28. package/dist/packem_chunks/handler28.js +1 -1
  29. package/dist/packem_chunks/handler29.js +1 -1
  30. package/dist/packem_chunks/handler3.js +1 -1
  31. package/dist/packem_chunks/handler30.js +1 -1
  32. package/dist/packem_chunks/handler31.js +1 -1
  33. package/dist/packem_chunks/handler32.js +3 -3
  34. package/dist/packem_chunks/handler34.js +5 -28
  35. package/dist/packem_chunks/handler35.js +22 -5
  36. package/dist/packem_chunks/handler36.js +60 -21
  37. package/dist/packem_chunks/handler37.js +6 -61
  38. package/dist/packem_chunks/handler38.js +24 -6
  39. package/dist/packem_chunks/handler39.js +152 -707
  40. package/dist/packem_chunks/handler4.js +1 -1
  41. package/dist/packem_chunks/handler40.js +10 -24
  42. package/dist/packem_chunks/handler41.js +25 -286
  43. package/dist/packem_chunks/handler42.js +707 -152
  44. package/dist/packem_chunks/handler43.js +24 -10
  45. package/dist/packem_chunks/handler44.js +322 -25
  46. package/dist/packem_chunks/handler45.js +46 -24
  47. package/dist/packem_chunks/handler46.js +1 -1
  48. package/dist/packem_chunks/handler47.js +7 -7
  49. package/dist/packem_chunks/handler48.js +65 -58
  50. package/dist/packem_chunks/handler5.js +3 -3
  51. package/dist/packem_chunks/handler6.js +1 -1
  52. package/dist/packem_chunks/handler8.js +1 -1
  53. package/dist/packem_chunks/handler9.js +1 -1
  54. package/dist/packem_chunks/heal-accept.js +1 -1
  55. package/dist/packem_chunks/heal.js +1 -1
  56. package/dist/packem_chunks/help-command.js +16 -16
  57. package/dist/packem_chunks/index.js +6 -6
  58. package/dist/packem_chunks/list.js +1 -1
  59. package/dist/packem_chunks/loader.js +1 -1
  60. package/dist/packem_chunks/prune.js +3 -3
  61. package/dist/packem_chunks/run.js +1 -1
  62. package/dist/packem_chunks/sync2.js +1 -1
  63. package/dist/packem_chunks/tripwire.js +1 -1
  64. package/dist/packem_chunks/verify-lockfile.js +1 -1
  65. package/dist/packem_shared/affected-shas-Dm7eqcI8.js +1 -0
  66. package/dist/packem_shared/{ai-analysis-B8pDCOuT.js → ai-analysis-Csn82p17.js} +1 -1
  67. package/dist/packem_shared/{ai-fix-DiGSrGKv.js → ai-fix-BlYyz5bI.js} +3 -3
  68. package/dist/packem_shared/{cyclonedx-DPEW0nwS.js → cyclonedx-D6F9rAay.js} +1 -1
  69. package/dist/packem_shared/dependency-scan-s2MD0vi-.js +1 -0
  70. package/dist/packem_shared/{docker-_pBC9Loj.js → docker-BU-7veP5.js} +1 -1
  71. package/dist/packem_shared/index-D9ZIw4ra.js +29 -0
  72. package/dist/packem_shared/{index-D_tAc2nS.js → index-PexbdLyT.js} +1 -1
  73. package/dist/packem_shared/lifecycle-ChCFTm5Q.js +2 -0
  74. package/dist/packem_shared/{lockfile-CQLFNyVa.js → lockfile-BG1HvBzH.js} +1 -1
  75. package/dist/packem_shared/{min-release-age-Cz6HbF-I.js → min-release-age-heJgeP7o.js} +1 -1
  76. package/dist/packem_shared/{pm-runner-Dnj9J3KF.js → pm-runner-Cj76BV8q.js} +1 -1
  77. package/dist/packem_shared/{provenance-yESbF7Vs.js → provenance-CdvMwB2R.js} +1 -1
  78. package/dist/packem_shared/{resolve-explicit-BpxcFRuk.js → resolve-explicit-CRFybyxv.js} +1 -1
  79. package/dist/packem_shared/{s1ngularity-B_xjP4lC.js → s1ngularity-CiZla5EP.js} +1 -1
  80. package/dist/packem_shared/{signatures-DBwSnMBB.js → signatures-BsEDWhME.js} +1 -1
  81. package/dist/packem_shared/{typosquats-Citu7BRY.js → typosquats-_7T7U2q2.js} +1 -1
  82. package/dist/packem_shared/vis-update-app-qhQPV97i.js +1 -0
  83. package/index.js +52 -52
  84. package/package.json +14 -25
  85. package/schemas/project.schema.json +4 -0
  86. package/schemas/vis-config.schema.json +5 -0
  87. package/dist/packem_shared/dependency-scan-BbtivycX.js +0 -1
  88. package/dist/packem_shared/index-B8Ko8mwG.js +0 -29
  89. package/dist/packem_shared/lifecycle-DJDsjoic.js +0 -2
  90. package/dist/packem_shared/vis-update-app-BWA1kA1q.js +0 -1
@@ -1,24 +1,46 @@
1
- var Fe=Object.defineProperty;var $=(e,o)=>Fe(e,"name",{value:o,configurable:!0});import{createRequire as Ae}from"node:module";import{M as g,i as S,$ as M}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{aV as pe,aW as Z,aX as Ne,aY as Me,aZ as Q,a_ as Be,a$ as He,aO as De,a8 as We,aN as Le,b0 as he,b1 as me,b2 as ke}from"./bin.js";import{b as ye}from"./config.js";import{NATIVE_BINDING_VERSION as ie,allKnownTags as qe,tagsFromPath as Ge,tagsFromPaths as Je,parseShebang as Ke}from"#native";const _e=Ae(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,V=$(e=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[o,t]=I.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return I.getBuiltinModule(e)}return _e(e)},"__cjs_getBuiltinModule"),{readdirSync:de,statSync:z,readFileSync:B,existsSync:H,writeFileSync:x,unlinkSync:Pe,rmSync:Te,chmodSync:Ce}=V("node:fs"),{cwd:N}=I,{createInterface:Ie}=V("node:readline"),{spawnSync:R}=V("node:child_process"),{basename:Ve}=V("node:path");var Ue=Object.defineProperty,q=$((e,o)=>Ue(e,"name",{value:o,configurable:!0}),"c$5");const ze=/^# ([^:\s]\S*)(?::\s+(.+))?$/,Ye=q(e=>{const o=[],t=e.split(`
2
- `);let r;for(const s of t){if(s.startsWith("#!")||s.startsWith("# Generated by")||s.startsWith("# NOTE:")||s==="set -e"||s==="")continue;const n=ze.exec(s);if(n){r&&o.push(r),r={command:"",id:n[1]??"",...n[2]?{name:n[2]}:{}};continue}r?r.command=r.command.length>0?`${r.command}
3
- ${s}`:s:r={command:s,id:"(custom)"}}return r&&o.push(r),o},"parseStageScript"),Xe=q((e,o)=>{const t=g(e,o),r=[],s=new Set(pe);if(S(t))for(const n of de(t)){if(n.startsWith(".")||n==="_"||!s.has(n))continue;const i=g(t,n);if(!z(i).isFile())continue;const a=M(i),c=Ye(a);r.push({blocks:c,rawLineCount:a.split(`
4
- `).length,stage:n})}return r.sort((n,i)=>n.stage.localeCompare(i.stage)),{hooksDirectory:o,stages:r}},"listHooks"),Ze=q(e=>{const o=[];if(e.stages.length===0)return o.push(`No hooks installed in ${e.hooksDirectory}/.`),o;o.push(`Hooks in ${e.hooksDirectory}/:`);for(const t of e.stages)if(o.push("",`${t.stage} (${t.rawLineCount} lines)`),t.blocks.length===0)o.push(" (empty)");else for(const r of t.blocks){const s=r.name?`${r.id} — ${r.name}`:r.id;o.push(` - ${s}`);const n=r.command.split(`
5
- `).find(i=>i.trim()!=="");if(n){const i=n.length>120?`${n.slice(0,117)}...`:n;o.push(` ${i}`)}}return o},"formatListResult"),Qe=q((e,o)=>{const t=Xe(N(),e);for(const r of Ze(t))o.info(r)},"runList");var eo=Object.defineProperty,O=$((e,o)=>eo(e,"name",{value:o,configurable:!0}),"o$2");const ae=5;if(ie!==ae)throw new Error(`vis native binding ABI mismatch: expected ${ae}, got ${ie}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const $e={".releaserc":["release-config","vis-config"],".releaserc.json":["release-config","vis-config"],"aube-lock.yaml":["aube-lock","lockfile"],"aube-workspace.yaml":["aube-workspace","vis-config"],"nx.json":["nx-workspace","vis-config"],"packem.config.js":["packem-config","vis-config"],"packem.config.mjs":["packem-config","vis-config"],"packem.config.ts":["packem-config","vis-config"],"pnpm-workspace.yaml":["pnpm-workspace","vis-config"],"project.json":["nx-project","vis-config"],"turbo.json":["turbo-config","vis-config"],"vis.config.js":["vis-config"],"vis.config.ts":["vis-config"]},ve=[[".releaserc.json",["release-config","vis-config"]]],we=O(e=>{const o=new Set,t=Ve(e),r=$e[t];if(r)for(const n of r)o.add(n);const s=t.toLowerCase();for(const[n,i]of ve)if(s.endsWith(n))for(const a of i)o.add(a);return o},"classifyVis"),be=new Set([...Object.values($e).flat(),...ve.flatMap(([,e])=>e)]);let K;const xe=O(()=>(K||(K=new Set(qe())),K),"getPrekUniverse");O(e=>{const o=new Set(Ge(e)),t=we(e);return{all:new Set([...o,...t]),prek:o,vis:t}},"classify");const oo=O(e=>{const o=Je([...e]),t=new Map;for(const[r,s]of e.entries()){const n=new Set(o[r]),i=we(s),a=new Set([...n,...i]);t.set(s,{all:a,prek:n,vis:i})}return t},"classifyMany");O(e=>Ke(e),"parseShebang");const to=O(e=>xe().has(e)||be.has(e),"isKnownTag");O(e=>xe().has(e),"isPrekTag");O(e=>be.has(e),"isVisTag");const ro=O((e,o)=>{const{all:t}=e;if(o.types&&o.types.length>0){for(const r of o.types)if(!t.has(r))return!1}if(o.typesOr&&o.typesOr.length>0){let r=!1;for(const s of o.typesOr)if(t.has(s)){r=!0;break}if(!r)return!1}if(o.excludeTypes&&o.excludeTypes.length>0){for(const r of o.excludeTypes)if(t.has(r))return!1}return!0},"matchesFilter");var no=Object.defineProperty,_=$((e,o)=>no(e,"name",{value:o,configurable:!0}),"i$3");const so=_(e=>{let o=0;const{length:t}=e,r=_(()=>{for(;o<t&&/\s/.test(e[o]);)o+=1},"skipWs"),s=_(()=>{if(e[o]!=='"')throw new Error(`expected string at ${o}`);o+=1;const c=o;for(;o<t&&e[o]!=='"';)o+=e[o]==="\\"?2:1;const l=e.slice(c,o);return o+=1,JSON.parse(`"${l}"`)},"parseString"),n=_(()=>{switch(r(),e[o]){case'"':{s();break}case"[":{i();break}case"{":{a();break}default:for(;o<t&&!",}]".includes(e[o])&&!/\s/.test(e[o]);)o+=1}},"parseValue"),i=_(()=>{if(o+=1,r(),e[o]==="]"){o+=1;return}for(;o<t;)if(n(),r(),e[o]===",")o+=1,r();else if(e[o]==="]"){o+=1;return}},"parseArray"),a=_(()=>{o+=1,r();const c=new Set;if(e[o]==="}"){o+=1;return}for(;o<t;){r();const l=s();if(c.has(l))throw new Error(`Duplicate key: ${l}`);if(c.add(l),r(),e[o]!==":")throw new Error(`expected colon at ${o}`);if(o+=1,n(),r(),e[o]===",")o+=1,r();else if(e[o]==="}"){o+=1;return}}},"parseObject");r(),n()},"detectDuplicateJsonKeys"),io=_((e,o,t)=>{let r=0;for(const s of e){const n=B(g(t.root,s),"utf8");try{JSON.parse(n),so(n)}catch(i){const a=i instanceof Error?i.message:String(i);t.logger.info(`${s}: Failed to json decode (${a})`),r=1}}return r},"runCheckJson");var ao=Object.defineProperty,Ee=$((e,o)=>ao(e,"name",{value:o,configurable:!0}),"c$4");const co=Ee(e=>{const o=R("git",["rev-parse","--git-dir"],{cwd:e,encoding:"utf8"});if(o.status!==0)return!1;const t=o.stdout.trim(),r=t.startsWith("/")?t:g(e,t);return H(g(r,"MERGE_MSG"))?H(g(r,"MERGE_HEAD"))||H(g(r,"rebase-apply"))||H(g(r,"rebase-merge")):!1},"isInMerge"),fo=["<<<<<<< ","======= ",`=======\r
6
- `,`=======
7
- `,">>>>>>> "],lo=Ee((e,o,t)=>{if(!o.includes("--assume-in-merge")&&!co(t.root))return 0;let r=0;for(const s of e){const n=B(g(t.root,s),"utf8").split(`
8
- `);for(let i=0;i<n.length;i+=1){const a=n[i]+(i<n.length-1?`
9
- `:"");for(const c of fo)a.startsWith(c)&&(t.logger.info(`${s}:${i+1}: Merge conflict string ${JSON.stringify(c.trim())} found`),r=1)}}return r},"runCheckMergeConflict");var uo=Object.defineProperty,go=$((e,o)=>uo(e,"name",{value:o,configurable:!0}),"c$3");const po=go((e,o,t)=>{let r=0;for(const s of e){const n=g(t.root,s),i=B(n);if(i.length===0)continue;let a=i.length;const c=i[a-1];if(c!==10&&c!==13){x(n,Buffer.concat([i,Buffer.from([10])])),t.logger.info(`Fixing ${s}`),r=1;continue}for(;a>0&&(i[a-1]===10||i[a-1]===13);)a-=1;if(a===0){x(n,Buffer.alloc(0)),t.logger.info(`Fixing ${s}`),r=1;continue}const l=i.subarray(a);let d;l[0]===13&&l[1]===10?d=Buffer.from([13,10]):l[0]===13?d=Buffer.from([13]):d=Buffer.from([10]),!l.equals(d)&&(x(n,Buffer.concat([i.subarray(0,a),d])),t.logger.info(`Fixing ${s}`),r=1)}return r},"runEndOfFileFixer");var ho=Object.defineProperty,ce=$((e,o)=>ho(e,"name",{value:o,configurable:!0}),"h$2");const mo={cr:Buffer.from([13]),crlf:Buffer.from([13,10]),lf:Buffer.from([10])},ko=new Set(["auto","cr","crlf","lf","no"]),yo=ce((e,o,t)=>{let r="auto";for(let n=0;n<o.length;n+=1){const i=o[n];if(i==="-f"||i==="--fix"){n+=1;const a=o[n];if(a===void 0)return t.logger.error(`mixed-line-ending: ${i} requires a value (auto|no|lf|crlf|cr)`),2;r=a}else i.startsWith("--fix=")&&(r=i.slice(6))}if(!ko.has(r))return t.logger.error(`mixed-line-ending: invalid --fix value ${r}`),2;let s=0;for(const n of e){const i=g(t.root,n),a=B(i),c=[],l=ce(f=>{const p=c.find(b=>b.kind===f);p?p.count+=1:c.push({count:1,kind:f})},"bumpCount"),d=[];let u=0;for(let f=0;f<a.length;f+=1){const p=a[f];p===13&&a[f+1]===10?(d.push({content:a.subarray(u,f),ending:"crlf"}),l("crlf"),f+=1,u=f+1):p===13?(d.push({content:a.subarray(u,f),ending:"cr"}),l("cr"),u=f+1):p===10&&(d.push({content:a.subarray(u,f),ending:"lf"}),l("lf"),u=f+1)}u<a.length&&d.push({content:a.subarray(u),ending:null});const m=c.length>1;if(r==="no"){m&&(t.logger.info(`${n}: mixed line endings`),s=1);continue}let k;if(r==="auto"){if(!m)continue;let f;for(const p of c)(!f||p.count>f.count)&&(f=p);k=f?.kind}else if(k=r,!c.some(f=>f.kind!==k&&f.count>0))continue;const w=mo[k],h=[];for(const f of d)h.push(f.content),f.ending!==null&&h.push(w);x(i,Buffer.concat(h)),t.logger.info(`${n}: fixed mixed line endings`),s=1}return s},"runMixedLineEnding");var $o=Object.defineProperty,vo=$((e,o)=>$o(e,"name",{value:o,configurable:!0}),"g$3");const fe=new Set([9,11,12,13,32]),wo=/\.(?:md|markdown|mdown|mdx)$/i,bo=vo((e,o,t)=>{let r=0;for(const s of e){const n=wo.test(s),i=g(t.root,s),a=B(i),c=[];let l=0;for(;l<=a.length;){let u=l;for(;u<a.length&&a[u]!==10;)u+=1;const m=u<a.length&&a[u]===10;let k=u,w=!1;m&&u>l&&a[u-1]===13&&(w=!0,k=u-1);const h=a.subarray(l,k);let f=h.length;for(;f>0&&fe.has(h[f-1]);)f-=1;const p=h.some(b=>!fe.has(b));if(n&&h.length>=2&&h[h.length-1]===32&&h[h.length-2]===32&&p&&(f=Math.min(f+2,h.length)),c.push(h.subarray(0,f)),w&&c.push(Buffer.from([13])),m&&c.push(Buffer.from([10])),!m)break;l=u+1}const d=Buffer.concat(c);d.equals(a)||(x(i,d),t.logger.info(`Fixing ${s}`),r=1)}return r},"runTrailingWhitespace");var xo=Object.defineProperty,Se=$((e,o)=>xo(e,"name",{value:o,configurable:!0}),"t");const ee={"check-json":io,"check-merge-conflict":lo,"end-of-file-fixer":po,"mixed-line-ending":yo,"trailing-whitespace":bo},Eo=Object.keys(ee).sort();Se(e=>Object.hasOwn(ee,e),"isBuiltin");const So=Se(e=>ee[e],"getBuiltin");var Ro=Object.defineProperty,j=$((e,o)=>Ro(e,"name",{value:o,configurable:!0}),"r");const F="config.json",W=1,Oo=new Set(["alwaysRun","args","builtin","entry","exclude","excludeTypes","fail","files","id","name","passFilenames","types","typesOr","verbose"]),jo=new Set(["failFast","stages","version"]),Fo=["args","exclude","excludeTypes","files","passFilenames","types","typesOr"],Re=j((e,o)=>g(e,o,F),"configPath"),Y=j(e=>e!==null&&typeof e=="object"&&!Array.isArray(e),"isStringRecord"),D=j(e=>{if(!Array.isArray(e))return;const o=[];for(const t of e){if(typeof t!="string")return;o.push(t)}return o},"asStringArray"),L=j(e=>typeof e=="boolean"?e:void 0,"asBoolean"),C=j(e=>typeof e=="string"&&e.length>0?e:void 0,"asNonEmptyString"),Ao=j((e,o,t)=>{if(!Y(e))throw new TypeError("hook entry must be an object");if(typeof e.id!="string"||e.id.length===0)throw new TypeError("hook entry is missing `id`");const r={id:e.id},s=L(e.alwaysRun);s!==void 0&&(r.alwaysRun=s);const n=D(e.args);n&&(r.args=n);const i=C(e.builtin);i&&(r.builtin=i);const a=C(e.entry);a&&(r.entry=a);const c=C(e.exclude);c&&(r.exclude=c);const l=D(e.excludeTypes);l&&(r.excludeTypes=l);const d=C(e.fail);d&&(r.fail=d);const u=C(e.files);u&&(r.files=u);const m=C(e.name);m&&(r.name=m);const k=L(e.passFilenames);k!==void 0&&(r.passFilenames=k);const w=D(e.types);w&&(r.types=w);const h=D(e.typesOr);h&&(r.typesOr=h);const f=L(e.verbose);if(f!==void 0&&(r.verbose=f),[r.builtin,r.entry,r.fail].filter(p=>p!==void 0).length!==1)throw new TypeError(`hook "${r.id}" must set exactly one of \`builtin\`, \`entry\`, \`fail\``);if(r.fail!==void 0){const p=Fo.filter(b=>r[b]!==void 0);if(p.length>0)throw new TypeError(`hook "${r.id}" is a \`fail\` entry — remove ${p.join(", ")} (filters do not apply)`)}for(const p of Object.keys(e))Oo.has(p)||o.push({hookId:r.id,message:`unknown field "${p}" ignored`,stage:t});return r},"parseEntry"),_o=j((e,o)=>{if(!Y(e))throw new TypeError("hook config must be an object");if(e.version!==W)throw new TypeError(`unsupported hook config version: expected ${W}, got ${String(e.version)}`);if(!Y(e.stages))throw new TypeError("hook config is missing `stages` map");const t={};for(const[n,i]of Object.entries(e.stages)){if(!Array.isArray(i))throw new TypeError(`hook config: stage "${n}" must be an array`);t[n]=i.map(a=>Ao(a,o,n))}const r={stages:t,version:W},s=L(e.failFast);s!==void 0&&(r.failFast=s);for(const n of Object.keys(e))jo.has(n)||o.push({message:`unknown top-level field "${n}" ignored`});return r},"parseConfig"),Oe=j((e,o=Z,t)=>{const r=Re(e,o);if(!S(r))return;const s=M(r);let n;try{n=JSON.parse(s)}catch(i){const a=i instanceof Error?i.message:String(i);throw new TypeError(`failed to parse ${r}: ${a}`,{cause:i})}return _o(n,t??[])},"loadHookConfig"),Po=j((e,o,t)=>{const r=Re(e,o);x(r,`${JSON.stringify(t,void 0,4)}
10
- `,"utf8")},"writeHookConfig");var To=Object.defineProperty,v=$((e,o)=>To(e,"name",{value:o,configurable:!0}),"d");const Co=new Map([["pre-commit/pre-commit-hooks#check-json","check-json"],["pre-commit/pre-commit-hooks#check-merge-conflict","check-merge-conflict"],["pre-commit/pre-commit-hooks#end-of-file-fixer","end-of-file-fixer"],["pre-commit/pre-commit-hooks#mixed-line-ending","mixed-line-ending"],["pre-commit/pre-commit-hooks#trailing-whitespace","trailing-whitespace"]]),Io=/[<>=!~]=/,No=/github\.com[/:]([^/\s]+\/[^/\s.]+)/i,Mo="# Generated by `vis hook migrate` from prek",Bo=v(e=>`#!/usr/bin/env sh
11
- ${Mo}
12
- exec vis hook run ${e} "$@"
13
- `,"stageScriptBody"),oe=v(e=>{for(const o of Ne)if(S(g(e,o)))return o},"detectPrekConfig"),Ho=v(e=>Me[e]??e,"mapPrekStage"),Do=v(e=>No.exec(e)?.[1]??e,"normalizeRepoKey"),Wo=v(e=>{if(Io.test(e))return;if(e.startsWith("@")){const r=e.indexOf("@",1);if(r===-1)return{name:e,version:"latest"};const s=e.slice(r+1).trim();return{name:e.slice(0,r),version:s||"latest"}}const o=e.indexOf("@");if(o===-1)return{name:e,version:"latest"};const t=e.slice(o+1).trim();return{name:e.slice(0,o),version:t||"latest"}},"parseAdditionalDep"),Lo=v(e=>{const o=[];for(const t of[e.types,e.types_or,e.exclude_types])for(const r of t??[])to(r)||o.push(r);return o},"unknownTypes"),Vo=v((e,o)=>(e.stages&&e.stages.length>0?e.stages:o??["pre-commit"]).map(t=>Ho(t)),"resolveStages"),qo=v((e,o,t)=>{const r=e.id??"<unknown>",s=Q.has(o),n={id:r};return e.name&&(n.name=e.name),e.language==="fail"?(n.fail=e.entry??e.name??r,n):(t?n.builtin=t:e.entry&&(n.entry=e.entry),Array.isArray(e.args)&&e.args.length>0&&(n.args=[...e.args]),s||(e.files&&(n.files=e.files),e.exclude&&(n.exclude=e.exclude),e.types&&e.types.length>0&&(n.types=[...e.types]),e.types_or&&e.types_or.length>0&&(n.typesOr=[...e.types_or]),e.exclude_types&&e.exclude_types.length>0&&(n.excludeTypes=[...e.exclude_types])),(e.pass_filenames===!1||s)&&(n.passFilenames=!1),(e.always_run||s)&&(n.alwaysRun=!0),e.verbose&&(n.verbose=!0),n)},"buildHookEntry"),Go=v((e,o,t,r)=>{if(Array.isArray(e.additional_dependencies))for(const s of e.additional_dependencies){const n=Wo(s);if(!n){r.push(`"${o}": additional_dependency "${s}" uses a pip-style pin and cannot be added to package.json — install manually.`);continue}t.push({hookId:o,name:n.name,raw:s,version:n.version})}},"collectAdditionalDeps"),Jo=v(e=>{const o={},t=[],r=[],s=[],n=[];(e.files||e.exclude)&&r.push("top-level files/exclude filter dropped — apply it per hook if needed");for(const a of e.repos??[]){const c=a.repo??"<unknown>",l=c==="local",d=l?void 0:Do(c);for(const u of a.hooks??[]){const m=u.id??"<unknown>";let k;if(l){const f=u.language??"system";if(!Be.has(f)){t.push({hookId:m,reason:`language "${f}" needs an isolated toolchain — run via prek or reimplement as a system command`,repo:c});continue}if(f!=="fail"&&!u.entry){t.push({hookId:m,reason:"missing `entry`",repo:c});continue}}else if(d&&(k=Co.get(`${d}#${m}`)),!k){t.push({hookId:m,reason:`remote repo "${c}"@${a.rev??"?"} has no bundled equivalent — run via prek or replace with a system command`,repo:c});continue}Go(u,m,n,s);const w=Lo(u);w.length>0&&r.push(`hook "${m}": unsupported types ${w.join(", ")} — those entries are ignored by the dispatcher`);const h=Vo(u,e.default_stages);for(const f of h){if(f==="manual")continue;if(!He.has(f)){t.push({hookId:m,reason:`unsupported stage "${f}"`,repo:c});continue}const p=qo(u,f,k),b=o[f];b?b.push(p):o[f]=[p]}}}const i={stages:o,version:W};return e.fail_fast&&(i.failFast=!0),{additionalDeps:n,config:i,droppedFilters:r,manualSteps:s,skippedHooks:t}},"convertPrekConfig"),Ko=v(e=>{const o=De(e);if(o&&typeof o=="object")return o},"parsePrekConfig"),Uo=v(e=>{if(e.endsWith(".toml")){const t=We(e);return t&&typeof t=="object"?t:void 0}const o=M(e);return Ko(o)},"loadPrekConfig"),zo=v((e,o,t)=>{const r=g(e,"package.json"),s=[],n=[];if(!S(r)||o.length===0)return{added:s,skipped:n};const i=M(r),a=JSON.parse(i),c=a.devDependencies??{},l=a.dependencies??{};for(const u of o){if(u.name in c||u.name in l){n.push(u.name);continue}c[u.name]=u.version,s.push(u.name)}if(s.length===0)return{added:s,skipped:n};a.devDependencies=c;const d=Le(r,i,{defaultIndent:" ",useEditorconfig:t});return x(r,`${JSON.stringify(a,void 0,d)}
14
- `,"utf8"),{added:s,skipped:n}},"mergeAdditionalDependencies"),Yo=v((e,o)=>{const t=g(e,o);ye(t),x(g(t,"README.md"),["# Vis hook config","","`config.json` is the single source of truth for what each stage","script runs. Auto-generated by `vis hook migrate`. Edit by hand","or re-run the migrator after updating your prek config.","",`Bundled builtins: ${Eo.join(", ")}`,""].join(`
15
- `),"utf8")},"writeConfigReadme"),Xo=v((e,o)=>{R("prek",["--version"],{cwd:e,encoding:"utf8"}).status===0?R("prek",["uninstall"],{cwd:e,encoding:"utf8"}).status===0?o.info("Detached prek via `prek uninstall`."):o.info("`prek uninstall` did not exit cleanly — continuing. You may need to run it manually."):o.info("prek binary not found on PATH — skipping `prek uninstall`. Run it manually if prek is installed elsewhere.")},"detachPrek"),je=v((e,o,t,r={})=>{const s=oe(e),n=r.dryRun===!0;if(!s)return{isError:!0,message:"No prek configuration found (.pre-commit-config.yaml, .pre-commit-config.yml, or prek.toml)"};t.info(`Found prek config at ${s}`);const i=g(e,s),a=M(i),c=Uo(i);if(!c)return{isError:!0,message:`Could not parse ${s}`};const{additionalDeps:l,config:d,droppedFilters:u,manualSteps:m,skippedHooks:k}=Jo(c),w=Object.keys(d.stages);if(w.length===0&&k.length===0)return{isError:!0,message:`${s} has no hooks to migrate`};if(!n){const y=R("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"});if(y.status===0){const J=y.stdout?.toString().trim();J&&(J.includes(".prek")||J.includes("prek-hooks"))&&R("git",["config","--local","--unset","core.hooksPath"],{cwd:e})}const T=he(o);if(T.isError)return T;T.message&&t.info(T.message)}const h=g(e,o);n||ye(h),n?t.info(` (would write) ${o}/${F}`):(Po(e,o,d),Yo(e,o),t.info(` Wrote ${o}/${F}`));let f=0;for(const y of w){const T=Bo(y);n?t.info(` (would write) ${o}/${y}`):(x(g(h,y),T,{mode:493}),t.info(` Wrote ${o}/${y}`)),f+=1}const{added:p,skipped:b}=n?{added:l.map(y=>y.name),skipped:[]}:zo(e,l,r.useEditorconfig);if(p.length>0){const y=n?"would add":"Added";t.info(`${y} ${p.length} package${p.length===1?"":"s"} to devDependencies: ${p.join(", ")}`),n||t.info("Run your package manager's install (e.g. `pnpm install`) to pick up the new devDependencies.")}b.length>0&&t.info(`Skipped ${b.length} already-declared package${b.length===1?"":"s"}: ${b.join(", ")}`),n||Xo(e,t);const se=`${i}.bak`;if(n?t.info(` (would remove) ${s} and back it up to ${s}.bak`):(S(se)||x(se,a,"utf8"),Pe(i),t.info(`Removed ${s} (backup at ${s}.bak)`)),k.length>0){t.warn(`Skipped ${k.length} hook${k.length===1?"":"s"} that cannot run without prek:`);for(const y of k)t.warn(` - ${y.repo}::${y.hookId} — ${y.reason}`)}if(u.length>0){t.warn("Partial filter translations:");for(const y of u)t.warn(` - ${y}`)}if(m.length>0){t.warn("Manual follow-up required:");for(const y of m)t.warn(` - ${y}`)}return{isError:!1,message:`${n?"would migrate":"Migration complete:"} ${f} stage script${f===1?"":"s"} ${n?"into":"written to"} ${o}/`}},"migrateFromPrek");var Zo=Object.defineProperty,te=$((e,o)=>Zo(e,"name",{value:o,configurable:!0}),"i$2");const Qo=te(e=>{const o=[];let t=0;for(let r=0;r<e.length;r+=1)e[r]===0&&(r>t&&o.push(e.subarray(t,r).toString("utf8")),t=r+1);return t<e.length&&o.push(e.subarray(t).toString("utf8")),o},"splitNulBuffer"),U=te((e,o,t)=>{const r=R("git",[...e],{cwd:t,encoding:"buffer"});if(r.status!==0){const s=r.stderr?r.stderr.toString():"";throw new Error(`git ${o} failed${s?`: ${s.trim()}`:""}`)}return r.stdout.length===0?[]:Qo(r.stdout)},"gitListFiles"),et=te((e,o)=>{switch(e.kind){case"all":return U(["ls-files","-z"],"ls-files",o);case"range":return U(["diff","--name-only","--diff-filter=ACM","-z",e.fromRef,e.toRef],"diff --from-ref/--to-ref",o);case"staged":return U(["diff","--cached","--name-only","--diff-filter=ACM","-z"],"diff --cached",o);default:{const t=e;throw new Error(`unknown discover mode: ${JSON.stringify(t)}`)}}},"discoverFiles");var ot=Object.defineProperty,re=$((e,o)=>ot(e,"name",{value:o,configurable:!0}),"i$1");const le=re((e,o)=>{try{return new RegExp(e)}catch(t){const r=t instanceof Error?t.message:String(t);throw new Error(`invalid ${o} regex ${JSON.stringify(e)}: ${r}`,{cause:t})}},"compileRegex"),tt=re(e=>e.types&&e.types.length>0||e.typesOr&&e.typesOr.length>0||e.excludeTypes&&e.excludeTypes.length>0||!1,"hasTagFilters"),rt=re((e,o)=>{let t=e;if(o.files){const n=le(o.files,"files");t=t.filter(i=>n.test(i))}if(o.exclude){const n=le(o.exclude,"exclude");t=t.filter(i=>!n.test(i))}if(!tt(o))return[...t];const r=oo(t),s={excludeTypes:o.excludeTypes,types:o.types,typesOr:o.typesOr};return t.filter(n=>{const i=r.get(n);return i?ro(i,s):!1})},"applyHookFilter");var nt=Object.defineProperty,A=$((e,o)=>nt(e,"name",{value:o,configurable:!0}),"u$2");const st=32*1024,it=A((e,o)=>{const t=[],r=Math.max(1024,st-o);let s=[],n=0;for(const i of e){const a=Buffer.byteLength(i,"utf8")+8;n+a>r&&s.length>0&&(t.push(s),s=[],n=0),s.push(i),n+=a}return s.length>0&&t.push(s),t},"chunkFiles"),at=A(e=>({error:A(o=>{e.error(o)},"error"),info:A(o=>{e.info(o)},"info")}),"builtinLoggerFor"),ue=A((e,o,t)=>t?t.message:o?`terminated by signal ${o}`:`exited with status ${String(e)}`,"describeSpawnFailure"),ct=A((e,o,t,r,s)=>{const n=r?s.extraArgs:[];if(!t||o.length===0){const c=R("sh",["-c",e,"sh",...n],{cwd:s.root,stdio:"inherit"});return c.status===null?(s.logger.error(`hook command failed: ${ue(c.status,c.signal,c.error)}`),1):c.status}const i=Buffer.byteLength(e,"utf8")+Buffer.byteLength("sh","utf8")+Buffer.byteLength("-c","utf8")+n.reduce((c,l)=>c+Buffer.byteLength(l,"utf8")+8,0)+64;let a=0;for(const c of it(o,i)){const l=R("sh",["-c",`${e} "$@"`,"sh",...n,...c],{cwd:s.root,stdio:"inherit"});l.status===null?(s.logger.error(`hook command failed: ${ue(l.status,l.signal,l.error)}`),a|=1):a|=l.status}return a},"runShellCommand"),ft=A((e,o,t)=>{if(e.fail!==void 0)return t.logger.info(e.fail),1;const r=Q.has(t.stage);let s;try{s=rt(o,e)}catch(c){const l=c instanceof Error?c.message:String(c);return t.logger.error(`hook "${e.id}": ${l}`),2}if(s.length===0&&e.alwaysRun!==!0&&!r)return 0;const n=e.passFilenames!==!1;if(e.verbose){const c=e.name??e.id;t.logger.info(`+ ${c}`)}if(e.builtin){const c=So(e.builtin);if(!c)return t.logger.error(`unknown builtin "${e.builtin}" referenced by hook "${e.id}"`),2;const l={logger:at(t.logger),root:t.root};try{return c(s,e.args??[],l)}catch(d){const u=d instanceof Error?d.message:String(d);return t.logger.error(`builtin "${e.builtin}" crashed: ${u}`),1}}if(e.entry===void 0)return t.logger.error(`hook "${e.id}" has no \`entry\`, \`builtin\`, or \`fail\` to run`),2;const i=(e.args??[]).map(c=>`'${c.replaceAll("'",String.raw`'\''`)}'`).join(" "),a=i?`${e.entry} ${i}`:e.entry;return ct(a,s,n,r,t)},"runHookEntry"),lt=A((e,o,t,r)=>{const s=e.stages[o];if(!s||s.length===0)return 0;let n=0;for(const i of s){const a=ft(i,t,r);if(a!==0&&(n|=a,e.failFast))return n}return n},"runStage");var ut=Object.defineProperty,ne=$((e,o)=>ut(e,"name",{value:o,configurable:!0}),"s");const gt="pre-commit",dt=ne(e=>{if(e.lastCommit&&(e.fromRef||e.toRef))throw new Error("--last-commit cannot be combined with --from-ref or --to-ref");const o=e.lastCommit?"HEAD~1":e.fromRef,t=e.lastCommit?"HEAD":e.toRef;if(o&&!t||t&&!o)throw new Error("--from-ref and --to-ref must be specified together");return o&&t?{fromRef:o,kind:"range",toRef:t}:e.allFiles?{kind:"all"}:{kind:"staged"}},"resolveDiscoverMode"),pt=ne((e,o,t,r)=>{const s=t.stage??gt,n=Oe(e,o);if(!n)throw new Error(`No hook config found at ${o}/config.json. Install or migrate hooks first.`);const i=n.stages[s];if(!i||i.length===0)return r.info(`No hooks configured for stage "${s}".`),0;const a=Q.has(s)?void 0:dt(t),c=a?.kind==="all"?" (--all-files)":a?.kind==="range"?` (${a.fromRef}..${a.toRef})`:"";r.info(`Running ${s}${c}`);const l=a?et(a,e):[],d={extraArgs:t.extraArgs??[],logger:r,root:e,stage:s};return lt(n,s,l,d)},"runHookStage"),ht=ne((e,o,t)=>{const r=pt(N(),e,o,t);if(r!==0)throw new Error(`Hook stage exited with code ${r}`)},"runRun");var mt=Object.defineProperty,kt=$((e,o)=>mt(e,"name",{value:o,configurable:!0}),"e");const yt=kt((e=Z)=>{if(R("git",["config","--local","core.hooksPath"]).status!==0)return{isError:!1,message:"No custom hooks path configured"};const{status:o,stderr:t}=R("git",["config","--local","--unset","core.hooksPath"]);if(o===null)return{isError:!0,message:"git command not found"};if(o&&o!==5)return{isError:!0,message:String(t)};const r=g(e,"_");return S(r)&&Te(r,{force:!0,recursive:!0}),{isError:!1,message:""}},"uninstallHooks");var $t=Object.defineProperty,G=$((e,o)=>$t(e,"name",{value:o,configurable:!0}),"u");const vt=new Set(pe),wt=G(e=>{const o=R("sh",["-n",e],{encoding:"utf8"});if(o.status===null)return`failed to run "sh -n" (${o.error?.message??"unknown error"})`;if(o.status!==0)return o.stderr.trim()||`sh -n exited with ${o.status}`},"runSyntaxCheck"),bt=G((e,o)=>{const t=[],r=g(e,o),s=R("git",["config","--local","core.hooksPath"],{cwd:e,encoding:"utf8"});if(s.status===0){const i=s.stdout.trim(),a=`${o}/_`;i&&i!==a&&t.push({kind:"warning",message:`core.hooksPath is "${i}" — expected "${a}". Re-run \`vis hook install\` to fix.`})}else t.push({kind:"warning",message:"core.hooksPath is not set — run `vis hook install`."});if(S(g(r,"_"))||t.push({kind:"error",message:`Dispatcher directory ${o}/_ is missing. Run \`vis hook install\`.`}),!S(r))return t.push({kind:"error",message:`Hooks directory ${o}/ is missing.`}),{issues:t,ok:!1};let n=!1;for(const i of de(r)){if(i.startsWith(".")||i==="_"||i===F||i==="README.md")continue;if(!vt.has(i)){t.push({kind:"warning",message:`Unknown hook "${i}" — not a standard git hook.`,path:g(o,i)});continue}const a=g(r,i);if(!z(a).isFile())continue;n=!0;const c=z(a).mode&511;(c&64)===0&&t.push({kind:"warning",message:`Script is not owner-executable (mode ${c.toString(8)}).`,path:g(o,i)});const l=wt(a);l&&t.push({kind:"error",message:`Shell syntax error: ${l}`,path:g(o,i)})}if(n){const i=g(r,F);if(S(i))try{Oe(e,o)}catch(a){t.push({kind:"error",message:`${F} is malformed: ${a instanceof Error?a.message:String(a)}`,path:g(o,F)})}else t.push({kind:"error",message:`Stage scripts are present but ${o}/${F} is missing. Re-run \`vis hook migrate\`.`})}return{issues:t,ok:!t.some(i=>i.kind==="error")}},"validateHooks"),xt=G((e,o)=>{if(e.issues.length===0)return[`Hook directory ${o}/ looks good.`];const t=[];for(const r of e.issues){const s=r.kind==="error"?"ERROR":"WARN ",n=r.path?` (${r.path})`:"";t.push(`${s} ${r.message}${n}`)}return t.push("",e.ok?"No errors — warnings only.":`${e.issues.filter(r=>r.kind==="error").length} error(s).`),t},"formatValidationResult"),Et=G((e,o)=>{const t=bt(N(),e),r=xt(t,e);for(const s of r)s.startsWith("ERROR")||s.startsWith("WARN")?o.warn(s):o.info(s);if(!t.ok)throw new Error("Hook validation failed")},"runValidate");var St=Object.defineProperty,E=$((e,o)=>St(e,"name",{value:o,configurable:!0}),"i");const P=E(e=>e.hooksDir??Z,"resolveHooksDirectory"),ge=E(e=>new Promise(o=>{const t=Ie({input:process.stdin,output:process.stdout});t.question(`${e} (y/N) `,r=>{t.close();const s=r.trim().toLowerCase();o(s==="y"||s==="yes")})}),"confirmPrompt"),Rt=E(async(e,o,t)=>{const r=N(),s=me(r),n=oe(r);if(s&&n)throw new Error(`Found both husky (${s}/) and prek (${n}). Remove or migrate one before running \`vis hook install\`.`);if(s){if(o.info(`Existing husky installation found at ${s}/`),await ge("Would you like to migrate your husky hooks to vis?")){const a=ke(r,e,o,{useEditorconfig:t});if(a.isError)throw new Error(a.message);a.message&&o.info(a.message);return}o.info("Aborting install. Remove husky first or run 'vis hook migrate' to migrate.");return}if(n){if(o.info(`Existing prek configuration found at ${n}`),await ge("Would you like to migrate your prek hooks to vis?")){const a=je(r,e,o,{useEditorconfig:t});if(a.isError)throw new Error(a.message);a.message&&o.info(a.message);return}o.info("Aborting install. Remove the prek config first or run 'vis hook migrate' to migrate.");return}o.info(`Installing git hooks in ${e}/...`);const i=he(e);if(i.message){if(i.isError)throw new Error(i.message);o.info(i.message);return}S(g(r,e,"pre-commit"))||x(g(r,e,"pre-commit"),`#!/usr/bin/env sh
16
- `,{mode:493}),o.info("Git hooks installed successfully.")},"executeInstall"),Ot=E((e,o,t,r)=>{const s=N(),n=me(s),i=oe(s);if(n&&i)throw new Error(`Found both husky (${n}/) and prek (${i}). Migrate one at a time rename or remove one before retrying.`);if(!n&&!i)throw new Error("No husky (.husky/) or prek (.pre-commit-config.yaml / prek.toml) configuration found to migrate.");o&&t.info("(dry-run) no files will be written");const a=n?ke(s,e,t,{dryRun:o,useEditorconfig:r}):je(s,e,t,{dryRun:o,useEditorconfig:r});if(a.isError)throw new Error(a.message);a.message&&t.info(a.message)},"executeMigrate"),X="# vis:secrets-hook",jt=`#!/usr/bin/env sh
17
- ${X}
18
- # Scan staged files for secrets before each commit. Remove this block or the whole file to disable.
19
- pnpm exec vis secrets --staged --quiet || exit 1
20
- `,Ft=E((e,o,t)=>{if(e!=="secrets")throw new Error(`Unknown hook add target "${String(e)}". Currently supported: "secrets".`);const r=N(),s=g(r,o,"pre-commit");if(!S(g(r,o)))throw new Error(`Hooks directory ${o}/ does not exist. Run \`vis hook install\` first.`);if(S(s)){const n=M(s);if(n.includes(X)){t.info(`Secrets hook already present in ${s}.`);return}if(/\bvis secrets\b/.test(n)){t.warn(`Found a \`vis secrets\` invocation in ${s} without the managed marker — leaving it untouched.`);return}const i=`${n.trimEnd()}
21
-
22
- ${X}
23
- pnpm exec vis secrets --staged --quiet || exit 1
24
- `;x(s,i),Ce(s,493),t.info(`Appended secrets scan to ${s}.`);return}x(s,jt,{mode:493}),t.info(`Created ${s} with a secrets-scan pre-commit check.`)},"executeAdd"),At=E((e,o)=>{o.info("Removing git hooks...");const t=yt(e);if(t.message){if(t.isError)throw new Error(t.message);o.info(t.message);return}o.info("Git hooks removed successfully.")},"executeUninstall"),_t=E(async({logger:e,options:o,visConfig:t})=>{await Rt(P(o),e,t?.editorconfig??!0)},"hookInstallImpl"),Pt=E(({logger:e,options:o})=>{At(P(o),e)},"hookUninstallImpl"),Tt=E(({logger:e,options:o,visConfig:t})=>{Ot(P(o),!!o.dryRun,e,t?.editorconfig??!0)},"hookMigrateImpl"),Ct=E(({logger:e,options:o})=>{Qe(P(o),e)},"hookListImpl"),It=E(({logger:e,options:o})=>{Et(P(o),e)},"hookValidateImpl"),Nt=E(({argument:e,logger:o,options:t})=>{ht(P(t),{allFiles:!!t.allFiles,extraArgs:e.slice(1),fromRef:t.fromRef,lastCommit:!!t.lastCommit,stage:e[0],toRef:t.toRef},o)},"hookRunImpl"),Mt=E(({argument:e,logger:o,options:t})=>{Ft(e[0],P(t),o)},"hookAddImpl"),qt=_t,Gt=Pt,Jt=Tt,Kt=Ct,Ut=It,zt=Nt,Yt=Mt;export{Yt as hookAddExecute,qt as hookInstallExecute,Kt as hookListExecute,Jt as hookMigrateExecute,zt as hookRunExecute,Gt as hookUninstallExecute,Ut as hookValidateExecute};
1
+ var yt=Object.defineProperty;var E=(e,t)=>yt(e,"name",{value:t,configurable:!0});import{createRequire as vt}from"node:module";import{q as tt,I as nt,e as P,T as Z,E as F,j as wt}from"../packem_shared/index.server-B7ETiT4C.js";import{M,i as N,$ as Q,a as bt}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{aF as Rt,ac as ne,o as Pe,aS as xt,F as q,aW as At,W as Ct,G as St,H as st,aX as Et,aY as ot,i as xe,O as jt,R as Tt,b as Ot,V as It,aZ as Dt,K as Ut,a_ as Nt,s as ve,U as Pt,a$ as Bt,b0 as Vt,b1 as Mt,b2 as _t}from"./bin.js";import{render as Be,renderToString as Ae}from"@visulima/tui";import{Text as L}from"@visulima/tui/components/text";import _ from"react";import{H as Ft,e as qt,Z as Ve}from"../packem_shared/ai-analysis-Csn82p17.js";import{k as Wt,s as ce,b as rt,R as Lt}from"../packem_shared/pm-runner-Cj76BV8q.js";import{r as Ht,b as Gt,p as zt}from"../packem_shared/resolve-explicit-CRFybyxv.js";import{r as Kt,s as Yt}from"../packem_shared/typosquats-_7T7U2q2.js";import{U as Jt,C as Zt,a as Me}from"../packem_shared/vis-update-app-qhQPV97i.js";import{h as it,P as at}from"../packem_shared/peer-warnings-EvSJ18gE.js";import{d as Xt}from"../packem_shared/utils-DrNg0XTR.js";import{r as en,q as tn}from"../packem_shared/advisories-U1QKY_tg.js";import{B as nn}from"./config.js";const kt=vt(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qe=E(e=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[t,n]=ie.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return ie.getBuiltinModule(e)}return kt(e)},"__cjs_getBuiltinModule"),{createInterface:et}=Qe("node:readline"),{existsSync:Qt}=Qe("node:fs");var sn=Object.defineProperty,ee=E((e,t)=>sn(e,"name",{value:t,configurable:!0}),"s$1");const on=ee(e=>{const t=[];for(const n of e.filters)t.push("--filter",n);return e.workspaceRoot&&t.push("--filter","."),t.push("update"),e.latest&&t.push("--latest"),e.recursive&&t.push("--recursive"),e.interactive&&t.push("--interactive"),e.dev&&t.push("--dev"),e.prod&&t.push("--prod"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"pnpm"}},"resolvePnpm"),rn=ee(e=>{const t=[];return e.filters.length>0&&t.push("workspace",e.filters[0]),t.push("upgrade"),e.latest&&t.push("--latest"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnV1"),an=ee(e=>{const t=[];if(e.filters.length>0||e.recursive){t.push("workspaces","foreach","--all");for(const n of e.filters)t.push("--include",n)}return t.push("up"),e.interactive&&t.push("--interactive"),t.push(...e.packages),{args:t,bin:"yarn"}},"resolveYarnBerry"),cn=ee((e,t)=>{const n=["update"];e.latest&&t.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&t.push("npm does not support --interactive mode.");for(const s of e.filters)n.push("--workspace",s);return e.recursive&&n.push("--workspaces"),e.workspaceRoot&&n.push("--include-workspace-root"),e.dev&&n.push("--dev"),e.prod&&n.push("--production"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"npm"}},"resolveNpm"),ln=ee(e=>{const t=["update"];e.latest&&t.push("--latest");for(const n of e.filters)t.push("--filter",n);return t.push(...e.packages),{args:t,bin:"bun"}},"resolveBun"),un=ee((e,t)=>{const n=["outdated","--update"];return e.latest&&n.push("--latest"),e.interactive&&n.push("--interactive"),e.filters.length>0&&t.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&t.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&t.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&t.push("deno outdated has no --no-save flag; ignoring."),n.push(...e.packages),{args:n,bin:"deno"}},"resolveDeno"),dn=ee((e,t,n)=>{const s=[];if(n.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:s};let r;switch(e){case"aube":{const o=Wt(n);r={args:o.args,bin:o.bin},s.push(...o.warnings);break}case"bun":{r=ln(n);break}case"deno":{r=un(n,s);break}case"npm":{r=cn(n,s);break}case"pnpm":{r=on(n);break}case"yarn":{r=t.startsWith("1.")?rn(n):an(n);break}default:{const o=e;throw new Error(`Unsupported package manager: ${String(o)}`)}}return{command:r,warnings:s}},"resolveUpdateCommand");var pn=Object.defineProperty,z=E((e,t)=>pn(e,"name",{value:t,configurable:!0}),"d$4");const ct=z(e=>{const t=e.indexOf("@");return t<=0?e:e.slice(0,t)},"stripVersionSpec"),fn=z(e=>{switch(e){case"github-actions":return"actions";case"docker":case"docker-compose":return"docker";case"gitlab-ci":return"gitlab";default:return}},"mapDependabotEcosystem"),gn=z((e,t)=>{const n=[".github/dependabot.yml",".github/dependabot.yaml"];for(const s of n){const r=M(e,s);if(!N(r))continue;let o;try{o=Rt(Q(r))}catch{continue}if(o?.updates){for(const i of o.updates){const a=fn(i["package-ecosystem"]);if(!(!a||!Array.isArray(i.ignore)))for(const d of i.ignore){const l=d["dependency-name"];typeof l=="string"&&l.length>0&&t[a].add(ct(l))}}return}}},"loadDependabot"),mn=Object.freeze({"docker-compose":"docker",dockerfile:"docker","github-actions":"actions",gitlabci:"gitlab","gitlabci-include":"gitlab"}),hn=Object.freeze({docker:"docker","github-tags":"actions"}),Ce=z((e,t)=>{if(t)for(const n of t)typeof n=="string"&&n.length>0&&e.add(ct(n))},"addAll"),$n=z(e=>{let t="",n=0;const s=e.length;let r=!1,o="";for(;n<s;){const i=e[n]??"";if(r){if(t+=i,i==="\\"&&n+1<s){t+=e[n+1]??"",n+=2;continue}i===o&&(r=!1),n+=1;continue}if(i==='"'||i==="'"){r=!0,o=i,t+=i,n+=1;continue}if(i==="/"&&e[n+1]==="/"){for(;n<s&&e[n]!==`
2
+ `;)n+=1;continue}if(i==="/"&&e[n+1]==="*"){for(n+=2;n<s&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}if(i===","){let a=n+1;for(;a<s&&/\s/.test(e[a]??"");)a+=1;const d=e[a];if(d==="}"||d==="]"){n+=1;continue}}t+=i,n+=1}return t},"stripJsonComments"),yn=z((e,t)=>{const n=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of n){const r=M(e,s);if(!N(r))continue;let o;try{const a=Q(r);o=JSON.parse($n(a))}catch{continue}if(!o)continue;if(Array.isArray(o.ignoreDeps))for(const a of["actions","docker","gitlab"])Ce(t[a],o.ignoreDeps);const i=[["github-actions","actions"],["dockerfile","docker"],["docker-compose","docker"],["gitlabci","gitlab"],["gitlabci-include","gitlab"]];for(const[a,d]of i){const l=o[a];Ce(t[d],l?.ignoreDeps)}if(!Array.isArray(o.packageRules))return;for(const a of o.packageRules){if(a.enabled!==!1)continue;const d=new Set;for(const c of a.matchManagers??[]){const f=mn[c];f&&d.add(f)}for(const c of a.matchDatasources??[]){const f=hn[c];f&&d.add(f)}d.size===0&&(d.add("actions"),d.add("docker"),d.add("gitlab"));const l=[...a.matchPackageNames??[],...a.matchDepNames??[],...a.matchPackagePatterns??[]];for(const c of d)Ce(t[c],l)}return}},"loadRenovate"),vn=z(e=>{const t={actions:new Set,docker:new Set,gitlab:new Set};return gn(e,t),yn(e,t),t},"loadIgnoreRules"),je=z((e,t,n)=>{const s=n[t];if(s.size===0)return!1;if(s.has(e))return!0;for(const r of s)if(/[*?[\]/.+]/.test(r))try{const o=r.replace(/[.+^${}()|]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");if(new RegExp(`^${o}$`).test(e))return!0}catch{}return!1},"isIgnored");var kn=Object.defineProperty,ke=E((e,t)=>kn(e,"name",{value:t,configurable:!0}),"o$1");const H=ke(e=>{const t=e.trim();if(t==="")return;const n=t.startsWith("v")||t.startsWith("V")?t.slice(1):t,s=(ce.valid(n)?ce.parse(n):void 0)??ce.coerce(n,{includePrerelease:!0});if(s)return{major:s.major,minor:s.minor,patch:s.patch,prerelease:s.prerelease.length>0,raw:t,normalized:`${String(s.major)}.${String(s.minor)}.${String(s.patch)}${s.prerelease.length>0?`-${s.prerelease.join(".")}`:""}`}},"parseTag"),wn=ke((e,t)=>ce.rcompare(e.normalized,t.normalized),"compareTagsDesc"),Te=ke((e,t,n,s)=>{if(!t&&n!=="latest")return;const r=e.filter(o=>!s&&o.prerelease?!1:t?n==="patch"&&(o.major!==t.major||o.minor!==t.minor)||n==="minor"&&o.major!==t.major?!1:ce.gt(o.normalized,t.normalized):!0);if(r.length!==0)return r.toSorted(wn)[0]},"pickBestTag"),Oe=ke((e,t)=>!e||!t?"unknown":t.major!==e.major?"major":t.minor!==e.minor?"minor":t.patch!==e.patch?"patch":"unknown","classifyUpdate");var bn=Object.defineProperty,Ie=E((e,t)=>bn(e,"name",{value:t,configurable:!0}),"i$1");const Rn="GitHub Actions",_e=Ie((e,t)=>`${e}@${t}`,"keyOf"),xn=Ie(e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),"toAdvisory"),An=Ie((e,t)=>{if(t.length===0)return t;const n=en(e);if(!Qt(n))return t;const s=new Map;for(const o of t){const i=o.currentVersion??o.currentRef;i&&s.set(_e(o.name,i),{name:o.name,version:i})}if(s.size===0)return t;const r=new Map;try{for(const[o,i]of s){const a=tn([i],{ecosystem:Rn,workspaceRoot:e}).get(i.name);a&&a.length>0&&r.set(o,a)}}catch{return t}return r.size===0?t:t.map(o=>{const i=o.currentVersion??o.currentRef;if(!i)return o;const a=r.get(_e(o.name,i));return a?{...o,advisories:a.map(xn)}:o})},"decorateActionsAdvisories");var Cn=Object.defineProperty,Sn=E((e,t)=>Cn(e,"name",{value:t,configurable:!0}),"i");const lt=Sn(e=>{if(!e)return{};const t={};for(const n of e.split(",")){const s=/^\s*<([^>]+)>\s*;\s*(.+)$/.exec(n);if(!s)continue;const r=s[1]??"",o=s[2]??"",i=/rel\s*=\s*"?([^";\s]+)"?/i.exec(o)?.[1]?.toLowerCase();i==="next"?t.next=r:i==="prev"||i==="previous"?t.previous=r:i==="last"?t.last=r:i==="first"&&(t.first=r)}return t},"parseLinkHeader");var En=Object.defineProperty,jn=E((e,t)=>En(e,"name",{value:t,configurable:!0}),"l$1");class Tn{static{E(this,"ActionsResolver")}static{jn(this,"ActionsResolver")}token;apiBase;fetchImpl;tagsCache=new Map;commitCache=new Map;constructor(t){this.token=t.token??process.env.GITHUB_TOKEN??process.env.GH_TOKEN,this.apiBase=t.apiBase??"https://api.github.com",this.fetchImpl=t.fetch??fetch}async listTags(t,n){const s=`${t}/${n}`,r=this.tagsCache.get(s);if(r)return r;const o=this.fetchTags(t,n);return this.tagsCache.set(s,o),o}async resolveRef(t,n,s){const r=`${t}/${n}@${s}`,o=this.commitCache.get(r);if(o)return o;const i=this.fetchCommit(t,n,s);return this.commitCache.set(r,i),i}buildHeaders(){const t={Accept:"application/vnd.github+json","User-Agent":"vis-update-actions","X-GitHub-Api-Version":"2022-11-28"};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}async fetchTags(t,n){const s=`${this.apiBase}/repos/${encodeURIComponent(t)}/${encodeURIComponent(n)}/tags?per_page=100`,r={tags:[],parsed:[]},o=[];let i=s,a=0;for(;i&&a<5;){const l=i;let c;try{c=await this.fetchImpl(l,{headers:this.buildHeaders()})}catch{return r}if(!c.ok)return r;let f;try{f=await c.json()}catch{return r}if(!Array.isArray(f))return r;for(const g of f){const m=typeof g.name=="string"?g.name:"",$=typeof g.commit?.sha=="string"?g.commit.sha:"";m!==""&&$!==""&&o.push({name:m,sha:$})}i=lt(c.headers.get("link")).next,a+=1}const d=[];for(const l of o){const c=H(l.name);c&&d.push({...c,sha:l.sha})}return{parsed:d,tags:o}}async fetchCommit(t,n,s){const r=`${this.apiBase}/repos/${encodeURIComponent(t)}/${encodeURIComponent(n)}/commits/${encodeURIComponent(s)}`;try{const o=await this.fetchImpl(r,{headers:this.buildHeaders()});if(!o.ok)return;const i=await o.json();return typeof i.sha!="string"?void 0:{committedAt:i.commit?.committer?.date,sha:i.sha}}catch{return}}}var On=Object.defineProperty,ue=E((e,t)=>On(e,"name",{value:t,configurable:!0}),"f$1");const In=".github/workflows",Dn=".github/actions",Un=/^(\s*-?\s*uses:\s*)(['"]?)([^'"\s#]+)\2(\s*#\s*(.+))?\s*$/,Nn=/^[a-f0-9]{40}$/i,Pn=/actions-up-ignore-next-line(?::\s*(.+))?/i,Bn=/actions-up-ignore-start/i,Vn=/actions-up-ignore-end/i,Mn=ue(e=>{const t=e.split("/");if(t.length<2)return;const[n,s,...r]=t;if(!(!n||!s))return{owner:n,repo:s,subpath:r.length>0?r.join("/"):void 0}},"splitSlug"),_n=ue((e,t)=>{const n=t.split(/\r?\n/),s=[];let r,o=!1;for(let i=0;i<n.length;i++){const a=n[i]??"";if(Bn.test(a)&&(o=!0),Vn.test(a)){o=!1;continue}const d=a.trim(),l=d===""||d.startsWith("#")?Pn.exec(a):void 0;if(l){r=l[1]??"actions-up-ignore-next-line";continue}const c=Un.exec(a);if(!c){r=void 0;continue}const f=c[2]??"",g=f==="'"||f==='"'?f:"",m=c[3]??"",$=c[5]?.trim();if(m.startsWith("./")||m.startsWith("../")||m.startsWith("docker://")){r=void 0;continue}const C=m.lastIndexOf("@");if(C<=0){r=void 0;continue}const R=m.slice(0,C),v=m.slice(C+1),k=Mn(R);if(!k){r=void 0;continue}let h=r??(o?"actions-up-ignore-block":void 0);if($){const p=/^actions-up-ignore(?:-next-line)?(?::\s*(.+))?(?:\s|$)/i.exec($);p&&(h=h??p[1]??"actions-up-ignore")}r=void 0,s.push({file:e,ignoreReason:h,isSha:Nn.test(v),line:i+1,original:`${g}${m}${g}`,owner:k.owner,quote:g,ref:v,repo:k.repo,slug:R,subpath:k.subpath,trailingComment:$&&!h?$:void 0})}return s},"extractUsesFromContent"),Fe=ue(e=>e.endsWith(".yml")||e.endsWith(".yaml"),"isWorkflowFile"),Fn=ue((e,t=[])=>{const n=[],s=new Set,r=ue(a=>{if(s.has(a))return;s.add(a);let d;try{d=Q(a)}catch{return}const l=_n(a,d);n.push(...l)},"collectFile"),o=M(e,In);if(N(o))for(const a of ne(o,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))Fe(a.name)&&r(a.path);const i=M(e,Dn);if(N(i))for(const a of ne(i,{includeDirs:!1,includeSymlinks:!1,maxDepth:3}))(a.name==="action.yml"||a.name==="action.yaml")&&r(a.path);for(const a of["action.yml","action.yaml"]){const d=M(e,a);N(d)&&r(d)}for(const a of t){const d=bt(a)?a:M(e,a);if(N(d))for(const l of ne(d,{includeDirs:!1,includeSymlinks:!1}))Fe(l.name)&&r(l.path)}return n},"scanActionsRepository");var qn=Object.defineProperty,de=E((e,t)=>qn(e,"name",{value:t,configurable:!0}),"d$3");const Wn=40,Ln=1440*60*1e3,Hn=new Set(["main","master","develop","trunk","edge","stable"]),Gn=de(e=>e.length===Wn&&/^[a-f0-9]{40}$/i.test(e)?!1:Hn.has(e.toLowerCase())?!0:H(e)===void 0,"looksLikeBranch"),qe=de((e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},"matchesPattern"),zn=de((e,t,n,s)=>{const r=s==="sha"||e.isSha,{quote:o}=e;return r?`${o}${e.slug}@${t}${o} # ${n}`:`${o}${e.slug}@${n}${o}`},"buildReplacement"),Kn=de(async(e,t)=>{const{ignoreRules:n,options:s,references:r,resolverOptions:o}=t,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const l=new Tn({apiBase:o?.apiBase,fetch:o?.fetch,token:s.githubToken??o?.token}),c=new Map;for(const v of r){const k=`${v.owner}/${v.repo}`,h=c.get(k)??[];h.push(v),c.set(k,h)}const f=Math.max(1,s.maxConcurrentRequests),g=[...c.keys()];let m=0;const $=de(async v=>{const k=c.get(v)??[],[h,p]=v.split("/");if(!h||!p)return;let y;try{y=await l.listTags(h,p)}catch{for(const u of k)d.push({file:u.file,reason:`failed to list tags for ${v}`});return}for(const u of k){const w=u.slug;let b;if(u.ignoreReason?b=u.ignoreReason:qe(w,s.exclude)?b="matched --exclude":s.include.length>0&&!qe(w,s.include)?b="not matched by --include":s.respectDependabotConfig&&n&&je(w,"actions",n)&&(b="ignored by dependabot/renovate config"),b){a.push({currentRef:u.ref,currentVersion:u.isSha?u.trailingComment?.replace(/^#\s*/,""):u.ref,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:w,newRef:u.ref,newVersion:void 0,original:u.original,reason:b,replacement:u.original,updateType:"unknown"});continue}if(!s.includeBranches&&!u.isSha&&Gn(u.ref)){a.push({currentRef:u.ref,currentVersion:u.ref,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:w,newRef:u.ref,newVersion:void 0,original:u.original,reason:"branch reference (use --include-branches)",replacement:u.original,updateType:"unknown"});continue}const j=u.isSha?u.trailingComment?.replace(/^#\s*/,"").split(/\s+/)[0]??"":u.ref,S=H(j);if(u.isSha&&!S&&s.mode!=="latest"){a.push({currentRef:u.ref,currentVersion:void 0,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:w,newRef:u.ref,newVersion:void 0,original:u.original,reason:`SHA pin has no version-hint comment; cannot apply --target=${s.mode}`,replacement:u.original,updateType:"unknown"});continue}const x=Te(y.parsed,S,s.mode,!1);if(!x)continue;if(s.minAgeDays!==void 0){const D=await l.resolveRef(h,p,x.sha),K=D?.committedAt?new Date(D.committedAt).getTime():void 0;if(K&&(Date.now()-K)/Ln<s.minAgeDays){a.push({currentRef:u.ref,currentVersion:S?.raw,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:w,newRef:u.ref,newVersion:x.raw,original:u.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:u.original,updateType:"unknown"});continue}}const T=s.style==="sha"||u.isSha?x.sha:x.raw,B=zn(u,x.sha,x.raw,s.style);i.push({currentRef:u.ref,currentVersion:S?.raw??u.trailingComment?.replace(/^#\s*/,""),ecosystem:"actions",file:u.file,line:u.line,name:w,newRef:T,newVersion:x.raw,original:u.original,replacement:B,updateType:Oe(S,x),url:`https://github.com/${h}/${p}/releases/tag/${x.raw}`})}},"processGroup"),C=[];for(let v=0;v<Math.min(f,g.length);v++)C.push((async()=>{for(;m<g.length;){const k=g[m];m+=1,k!==void 0&&await $(k)}})());await Promise.all(C);const R=An(e,i);return{failed:d,ignored:a,updates:R}},"checkActions");var Yn=Object.defineProperty,ut=E((e,t)=>Yn(e,"name",{value:t,configurable:!0}),"u$3");const Jn=ut(e=>e.toSorted((t,n)=>t.file!==n.file?t.file<n.file?-1:1:t.line-n.line),"orderUpdates"),Zn=ut(e=>{const t=[],n=[];if(e.length===0)return{applied:t,skipped:n};const s=Jn(e),r=new Map;for(const o of s){const i=r.get(o.file)??[];i.push(o),r.set(o.file,i)}for(const[o,i]of r){let a;try{a=Q(o)}catch(g){for(const m of i)n.push({reason:`read failed: ${g.message}`,update:m});continue}const d=a.includes(`\r
3
+ `)?`\r
4
+ `:`
5
+ `,l=a.split(/\r?\n/),c=[];for(const g of i){const m=g.line-1,$=l[m];if($===void 0){n.push({reason:`line ${String(g.line)} out of range`,update:g});continue}const C=$.indexOf(g.original);if(C<0){n.push({reason:"original token not found on expected line",update:g});continue}const R=$.slice(0,C),v=$.slice(C+g.original.length),k=/#\s*v?\d/.test(g.replacement)&&/^\s*#\s*v?\d[\w.+-]*\s*$/i.test(v)?"":v;l[m]=`${R}${g.replacement}${k}`,c.push(g)}if(c.length===0)continue;const f=l.join(d);try{nn(o,f),t.push(...c)}catch(g){for(const m of c)n.push({reason:`write failed: ${g.message}`,update:m})}}return{applied:t,skipped:n}},"applyEcosystemUpdates");var Xn=Object.defineProperty,me=E((e,t)=>Xn(e,"name",{value:t,configurable:!0}),"u$2");class Qn{static{E(this,"DockerRegistry")}static{me(this,"DockerRegistry")}tokens;fetchImpl;tagCache=new Map;constructor(t={}){this.tokens=t.tokens??{},this.fetchImpl=t.fetch??fetch}async listTags(t,n,s){const r=`${t}/${n}/${s}`,o=this.tagCache.get(r);if(o)return o;const i=t==="docker.io"?this.listDockerHubTags(n,s):this.listV2Tags(t,n,s);return this.tagCache.set(r,i),i}async listDockerHubTags(t,n){const s={parsed:[],raw:[]},r=[],o=new Map;let i=`https://hub.docker.com/v2/repositories/${encodeURIComponent(t)}/${encodeURIComponent(n)}/tags?page_size=100`,a=0;for(;i&&a<5;){try{const d=await this.fetchImpl(i,{headers:{Accept:"application/json"}});if(!d.ok)break;const l=await d.json();if(Array.isArray(l.results)){for(const c of l.results)if(typeof c.name=="string"&&(r.push(c.name),typeof c.last_updated=="string")){const f=Date.parse(c.last_updated);Number.isNaN(f)||o.set(c.name,f)}}i=typeof l.next=="string"?l.next:void 0}catch{break}a+=1}return r.length===0?s:{parsed:r.map(d=>{const l=H(d);if(l)return{...l,lastUpdated:o.get(d)}}).filter(d=>d!==void 0),raw:r}}async listV2Tags(t,n,s){const r={parsed:[],raw:[]},o=n==="library"?s:`${n}/${s}`,i={Accept:"application/json"},a=this.tokens[t]??process.env[`DOCKER_REGISTRY_TOKEN_${t.toUpperCase().replaceAll(/[^A-Z0-9]/g,"_")}`];a&&(i.Authorization=`Bearer ${a}`);const d=`https://${t}`,l=[];let c=`${d}/v2/${o}/tags/list?n=100`,f=i,g=0;const m=me(()=>{const $=[];for(const C of l){const R=H(C);R&&$.push({...R,lastUpdated:void 0})}return{parsed:$,raw:l}},"buildResult");for(;c&&g<5;){try{let $=await this.fetchImpl(c,{headers:f});if($.status===401&&f===i){const v=ts($.headers.get("www-authenticate"));if(v){const k=await this.fetchBearerToken(v);k&&(f={...i,Authorization:`Bearer ${k}`},$=await this.fetchImpl(c,{headers:f}))}}if(!$.ok)return g===0?r:m();const C=await $.json();if(!Array.isArray(C.tags))return g===0?r:m();for(const v of C.tags)typeof v=="string"&&l.push(v);const R=lt($.headers.get("link"));R.next?c=new URL(R.next,d).toString():c=void 0}catch{return g===0?r:m()}g+=1}return l.length===0?r:m()}async fetchBearerToken(t){const n=new URLSearchParams({scope:t.scope,service:t.service}),s=`${t.realm}?${n.toString()}`;try{const r=await this.fetchImpl(s,{headers:{Accept:"application/json"}});if(!r.ok)return;const o=await r.json();return o.token??o.access_token}catch{return}}}const es=me(e=>{const t=[];let n=0;const s=e.length;for(;n<s;){for(;n<s&&/\s/.test(e[n]??"");)n+=1;const r=n;for(;n<s&&e[n]!=="="&&e[n]!==",";)n+=1;const o=e.slice(r,n).trim();if(e[n]!=="="){for(;n<s&&e[n]!==",";)n+=1;n+=1;continue}n+=1;let i="";if(e[n]==='"'){for(n+=1;n<s&&e[n]!=='"';){if(e[n]==="\\"&&n+1<s){i+=e[n+1]??"",n+=2;continue}i+=e[n]??"",n+=1}n+=1}else{for(;n<s&&e[n]!==",";)i+=e[n]??"",n+=1;i=i.trim()}for(o.length>0&&t.push({key:o,value:i});n<s&&(/\s/.test(e[n]??"")||e[n]===",");)n+=1}return t},"splitAuthParams"),ts=me(e=>{if(!e)return;const t=/^Bearer\s+(.*)$/i.exec(e);if(!t)return;const n=new Map;for(const{key:o,value:i}of es(t[1]??""))n.set(o.toLowerCase(),i);const s=n.get("realm"),r=n.get("service");if(s)return{realm:s,scope:n.get("scope")??"",service:r??""}},"parseAuthenticate");var ns=Object.defineProperty,G=E((e,t)=>ns(e,"name",{value:t,configurable:!0}),"d$2");const ss="docker.io",os="sha256:",he=G(e=>{const t=e.trim();if(t===""||t.startsWith("$")||t.includes("${")||t.includes("$("))return;let n=t,s;const r=n.indexOf("@"+os);r>=0&&(s=n.slice(r+1),n=n.slice(0,r));let o=ss,i=n;const a=n.indexOf("/");if(a>0){const $=n.slice(0,a);($==="localhost"||$.includes(".")||$.includes(":"))&&(o=$,i=n.slice(a+1))}let d="latest",l=i;const c=i.lastIndexOf(":");c>=0&&!i.slice(c).includes("/")&&(d=i.slice(c+1),l=i.slice(0,c));let f="library",g=l;const m=l.indexOf("/");if(m>=0&&(f=l.slice(0,m),g=l.slice(m+1)),g!=="")return{digest:s,name:g,namespace:f,original:t,registry:o,tag:d}},"parseImageReference"),$e=/vis-update-ignore-next-line/i,dt=/vis-update-ignore(?:\s|$|:)/i,pt=G(e=>{const t=e.trim();return t===""||t.startsWith("#")},"isCommentOnlyLine"),rs=/^(\s*FROM\s+(?:--\S+\s+)*)([^\s#]+)(\s+AS\s+\S+)?(\s*#.*)?$/i,is=G((e,t)=>{const n=t.split(/\r?\n/),s=[];let r=!1;for(let o=0;o<n.length;o++){const i=n[o]??"";if($e.test(i)&&pt(i)){r=!0;continue}const a=rs.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[2]??"";if(d==="scratch"){r=!1;continue}const l=a[4]?.trim();let c=r?"vis-update-ignore-next-line":void 0;l&&$e.test(l)?c=c??"vis-update-ignore-next-line":l&&dt.test(l)&&(c=c??"vis-update-ignore");const f=he(d);r=!1,f&&s.push({...f,file:e,ignoreReason:c,kind:"dockerfile",line:o+1})}return s},"extractFromDockerfile"),as=/^(\s*image:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,cs=G((e,t)=>{const n=t.split(/\r?\n/),s=[];let r=!1;for(let o=0;o<n.length;o++){const i=n[o]??"";if($e.test(i)&&pt(i)){r=!0;continue}const a=as.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[3]??"",l=a[4]?.trim();let c=r?"vis-update-ignore-next-line":void 0;l&&$e.test(l)?c=c??"vis-update-ignore-next-line":l&&dt.test(l)&&(c=c??"vis-update-ignore");const f=he(d);r=!1,f&&s.push({...f,file:e,ignoreReason:c,kind:"compose",line:o+1})}return s},"extractFromCompose"),We=G(e=>{const t=e.toLowerCase();return t==="dockerfile"||t.startsWith("dockerfile.")?!0:t.endsWith(".dockerfile")},"isDockerfile"),ls=G(e=>{const t=e.toLowerCase();return/^(?:docker-)?compose(?:\..+)?\.ya?ml$/.test(t)},"isComposeFile"),us=new Set([".git","node_modules",".pnpm-store",".turbo",".nx","dist","build",".cache"]),ds=/(?:^|\/)(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)(?:\/|$)/,ps=G(e=>{const t=[];if(!N(e))return t;const n=G((s,r)=>{let o;try{o=Q(s)}catch{return}t.push(...r==="dockerfile"?is(s,o):cs(s,o))},"collect");for(const s of ne(e,{includeDirs:!1,includeSymlinks:!1,skip:[ds]})){const{name:r}=s;us.has(r)||(We(r)?n(s.path,"dockerfile"):ls(r)&&n(s.path,"compose"))}for(const s of["Dockerfile","dockerfile","compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"]){const r=M(e,s);N(r)&&(t.some(o=>o.file===r)||n(r,We(s)?"dockerfile":"compose"))}return t},"scanDockerRepository");var fs=Object.defineProperty,X=E((e,t)=>fs(e,"name",{value:t,configurable:!0}),"c");const gs=864e5,Le=X((e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},"matchesPattern"),He=X(e=>{const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return e.registry==="docker.io"?t:`${e.registry}/${t}`},"displayName"),ms=X(e=>e.digest!==void 0&&e.digest.length>0,"hasDigestPin"),hs=X(e=>{if(e.registry==="docker.io")return`https://hub.docker.com/${e.namespace==="library"?`_/${e.name}`:`r/${e.namespace}/${e.name}`}/tags`;const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`https://${e.registry}/${t}`},"buildRegistryUrl"),$s=X((e,t)=>{const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`${e.registry==="docker.io"?n:`${e.registry}/${n}`}:${t}`},"buildReplacement"),ft=X(async(e,t)=>{const{ignoreRules:n,options:s,references:r,registryOptions:o}=t,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const l=new Qn({fetch:o?.fetch,tokens:o?.tokens}),c=new Map;for(const R of r){const v=`${R.registry}|${R.namespace}|${R.name}`,k=c.get(v)??[];k.push(R),c.set(v,k)}const f=Math.max(1,s.maxConcurrentRequests),g=[...c.keys()];let m=0;const $=X(async R=>{const v=c.get(R)??[],k=v[0];if(!k)return;let h;try{h=await l.listTags(k.registry,k.namespace,k.name)}catch{for(const p of v)d.push({file:p.file,reason:`failed to list tags for ${He(p)}`});return}for(const p of v){const y=He(p);let u;if(p.ignoreReason?u=p.ignoreReason:Le(y,s.exclude)?u="matched --exclude":s.include.length>0&&!Le(y,s.include)?u="not matched by --include":s.respectDependabotConfig&&n&&je(y,"docker",n)&&(u="ignored by dependabot/renovate config"),u){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:y,newRef:p.tag,newVersion:void 0,original:p.original,reason:u,replacement:p.original,updateType:"unknown"});continue}if(ms(p)){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:y,newRef:p.tag,newVersion:void 0,original:p.original,reason:"digest-pinned image (refresh the pin manually to update)",replacement:p.original,updateType:"digest"});continue}const w=H(p.tag);if(!w&&!s.includeBranches){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:y,newRef:p.tag,newVersion:void 0,original:p.original,reason:"non-semver tag (use --include-branches)",replacement:p.original,updateType:"unknown"});continue}if(!w&&s.mode!=="latest"){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:y,newRef:p.tag,newVersion:void 0,original:p.original,reason:`branch ref has no version baseline for --target=${s.mode}`,replacement:p.original,updateType:"unknown"});continue}const b=Te(h.parsed,w,s.mode,!1);if(!b)continue;if(s.minAgeDays!==void 0&&b.lastUpdated!==void 0&&(Date.now()-b.lastUpdated)/gs<s.minAgeDays){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:y,newRef:b.raw,newVersion:b.raw,original:p.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:p.original,updateType:"unknown"});continue}const j=b.raw,S=$s(p,j);i.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,line:p.line,name:y,newRef:j,newVersion:j,original:p.original,replacement:S,updateType:Oe(w,b),url:hs(p)})}},"processGroup"),C=[];for(let R=0;R<Math.min(f,g.length);R++)C.push((async()=>{for(;m<g.length;){const v=g[m];m+=1,v!==void 0&&await $(v)}})());return await Promise.all(C),{failed:d,ignored:a,updates:i}},"checkDocker");var ys=Object.defineProperty,vs=E((e,t)=>ys(e,"name",{value:t,configurable:!0}),"g$1");class ks{static{E(this,"GitlabResolver")}static{vs(this,"GitlabResolver")}token;tokenHeader;defaultApiBase;fetchImpl;tagCache=new Map;constructor(t){const n=t.token??process.env.GITLAB_TOKEN;n?(this.token=n,this.tokenHeader="PRIVATE-TOKEN"):process.env.CI_JOB_TOKEN?(this.token=process.env.CI_JOB_TOKEN,this.tokenHeader="JOB-TOKEN"):(this.token=void 0,this.tokenHeader="PRIVATE-TOKEN"),this.defaultApiBase=t.apiBase??"https://gitlab.com",this.fetchImpl=t.fetch??fetch}async listTags(t){const n=this.tagCache.get(t);if(n)return n;const s=this.fetchTags(t);return this.tagCache.set(t,s),s}resolveHostAndPath(t){const n=t.indexOf("/");if(n>0){const s=t.slice(0,n);if(s.includes("."))return{host:`https://${s}`,path:t.slice(n+1)}}return{host:this.defaultApiBase,path:t}}async fetchTags(t){const{host:n,path:s}=this.resolveHostAndPath(t),r=encodeURIComponent(s),o=`${n}/api/v4/projects/${r}/repository/tags?per_page=100`,i={Accept:"application/json","User-Agent":"vis-update-gitlab"};this.token&&(i[this.tokenHeader]=this.token);try{const a=await this.fetchImpl(o,{headers:i});if(!a.ok)return{error:`HTTP ${String(a.status)} from ${n}`,parsed:[],tags:[]};const d=await a.json();if(!Array.isArray(d))return{error:`unexpected response shape from ${n}`,parsed:[],tags:[]};const l=d.map(f=>({name:typeof f.name=="string"?f.name:"",sha:typeof f.commit?.id=="string"?f.commit.id:""})).filter(f=>f.name!==""),c=[];for(const f of l){const g=H(f.name);g&&c.push({...g,sha:f.sha})}return{parsed:c,tags:l}}catch(a){return{error:a instanceof Error?a.message:"fetch failed",parsed:[],tags:[]}}}}var ws=Object.defineProperty,ye=E((e,t)=>ws(e,"name",{value:t,configurable:!0}),"x");const bs=/vis-update-ignore-next-line/i,ae=/vis-update-ignore(?:\s|$|:)/i,Rs=new Set([".gitlab-ci.yml",".gitlab-ci.yaml"]),xs=ye(e=>Rs.has(e)||e.endsWith(".gitlab-ci.yml")||e.endsWith(".gitlab-ci.yaml"),"isGitlabCiFile"),As=/^(\s*-?\s*project:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,Cs=/^(\s*ref:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,Ss=/^(\s*-?\s*component:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,Es=/^(\s*image:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,js=/^\s*(?:-\s*)?(?:include:\s*)?\{([^}]*)\}\s*(?:#.*)?$/,Ts=/project:\s*(['"]?)([^'"\s,}]+)\1/,Os=/ref:\s*(['"]?)([^'"\s,}]+)\1/,Is=/component:\s*(['"]?)([^'"\s,}]+)\1/,Ds=/^(\s*-\s*name:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,Us=/^(\s*-\s*)(['"]?)([^'"\s#:]+:[^'"\s#]+)\2(\s*#.*)?$/,Ns=/^\s*-?\s*[a-z_][\w-]*:\s*(?:#.*)?$/i,Ps=ye((e,t)=>{const n=t.split(/\r?\n/),s=[],r=[];let o,i=!1,a=!1,d=-1;for(let l=0;l<n.length;l++){const c=n[l]??"",f=c.trim(),g=f===""||f.startsWith("#");if(bs.test(c)&&g){i=!0;continue}const m=/^(\s*)services:\s*(?:#.*)?$/.exec(c);if(m){a=!0,d=m[1]?.length??0;continue}a&&f!==""&&!f.startsWith("-")&&!f.startsWith("#")&&c.search(/\S/)<=d&&(a=!1,d=-1);const $=Es.exec(c);if($){const h=$[3]??"",p=he(h);if(p){const y=$[4]?.trim();let u=i?"vis-update-ignore-next-line":void 0;y&&ae.test(y)&&(u=u??"vis-update-ignore"),r.push({...p,file:e,ignoreReason:u,kind:"compose",line:l+1})}i=!1;continue}if(a){const h=Ds.exec(c),p=h?void 0:Us.exec(c),y=h??p;if(y){const u=y[3]??"",w=he(u);if(w){const b=y[4]?.trim();let j=i?"vis-update-ignore-next-line":void 0;b&&ae.test(b)&&(j=j??"vis-update-ignore"),r.push({...w,file:e,ignoreReason:j,kind:"compose",line:l+1})}}}const C=As.exec(c);if(C){o={line:l+1,project:C[3]??""};continue}const R=Cs.exec(c);if(R&&o){const h=R[4]?.trim();let p=i?"vis-update-ignore-next-line":void 0;h&&ae.test(h)&&(p=p??"vis-update-ignore"),s.push({file:e,ignoreReason:p,kind:"project",line:l+1,original:R[3]??"",project:o.project,ref:R[3]??""}),o=void 0,i=!1;continue}const v=Ss.exec(c);if(v){const h=v[3]??"",p=h.lastIndexOf("@");if(p>0){const y=h.slice(0,p),u=h.slice(p+1),w=y.lastIndexOf("/"),b=w>0?y.slice(0,w):y,j=w>0?y.slice(w+1):void 0,S=v[4]?.trim();let x=i?"vis-update-ignore-next-line":void 0;S&&ae.test(S)&&(x=x??"vis-update-ignore"),s.push({componentName:j,file:e,ignoreReason:x,kind:"component",line:l+1,original:h,project:b,ref:u})}i=!1;continue}const k=js.exec(c);if(k){const h=k[1]??"",p=/#(.*)$/.exec(c)?.[1]?.trim();let y=i?"vis-update-ignore-next-line":void 0;p&&ae.test(p)&&(y=y??"vis-update-ignore");const u=Is.exec(h);if(u){const w=u[2]??"",b=w.lastIndexOf("@");if(b>0){const j=w.slice(0,b),S=w.slice(b+1),x=j.lastIndexOf("/"),T=x>0?j.slice(0,x):j,B=x>0?j.slice(x+1):void 0;s.push({componentName:B,file:e,ignoreReason:y,kind:"component",line:l+1,original:w,project:T,ref:S})}}else{const w=Ts.exec(h),b=Os.exec(h);w&&b&&s.push({file:e,ignoreReason:y,kind:"project",line:l+1,original:b[2]??"",project:w[2]??"",ref:b[2]??""})}i=!1;continue}f!==""&&!f.startsWith("#")&&!Ns.test(c)&&(i=!1)}return{images:r,includes:s}},"extractFromGitlabCi"),Ge=/^(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)$/,Bs=ye(e=>{const t=[],n=[];if(!N(e))return{images:n,includes:t};const s=ye(o=>{let i;try{i=Q(o)}catch{return}const{images:a,includes:d}=Ps(o,i);t.push(...d),n.push(...a)},"collect");for(const o of[".gitlab-ci.yml",".gitlab-ci.yaml"]){const i=M(e,o);N(i)&&s(i)}const r=M(e,".gitlab");if(N(r))for(const o of ne(r,{includeDirs:!1,includeSymlinks:!1,skip:[Ge]}))(o.name.endsWith(".yml")||o.name.endsWith(".yaml"))&&s(o.path);for(const o of ne(e,{includeDirs:!1,includeSymlinks:!1,maxDepth:2,skip:[Ge]}))xs(o.name)&&!n.some(i=>i.file===o.path)&&!t.some(i=>i.file===o.path)&&s(o.path);return{images:n,includes:t}},"scanGitlabRepository");var Vs=Object.defineProperty,le=E((e,t)=>Vs(e,"name",{value:t,configurable:!0}),"p$1");const ze=le((e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},"matchesPattern"),Ms=le((e,t,n)=>{const s=e.indexOf("/");return s>0&&e.slice(0,s).includes(".")?`https://${e.slice(0,s)}/${e.slice(s+1)}/-/releases/${t}`:`${n}/${e}/-/releases/${t}`},"buildReleaseUrl"),_s=le(async(e,t)=>{const{ignoreRules:n,imageReferences:s,includes:r,options:o,registryOptions:i,resolverOptions:a}=t,d=[],l=[],c=[];if(s.length>0){const h=await ft(e,{ignoreRules:n,options:o,references:s,registryOptions:i});for(const p of h.updates)d.push({...p,ecosystem:"gitlab"});for(const p of h.ignored)l.push({...p,ecosystem:"gitlab"});c.push(...h.failed)}if(r.length===0)return{failed:c,ignored:l,updates:d};const f=new ks({apiBase:a?.apiBase,fetch:a?.fetch,token:o.gitlabToken??a?.token}),g=a?.apiBase??"https://gitlab.com",m=new Map;for(const h of r){const p=m.get(h.project)??[];p.push(h),m.set(h.project,p)}const $=Math.max(1,o.maxConcurrentRequests),C=[...m.keys()];let R=0;const v=le(async h=>{const p=m.get(h)??[];let y;try{y=await f.listTags(h)}catch{for(const u of p)c.push({file:u.file,reason:`failed to list tags for ${h}`});return}if(y.error){for(const u of p)c.push({file:u.file,reason:`failed to list tags for ${h}: ${y.error}`});return}for(const u of p){const w=u.kind==="component"&&u.componentName?`${u.project}/${u.componentName}`:u.project;let b;u.ignoreReason?b=u.ignoreReason:ze(w,o.exclude)?b="matched --exclude":o.include.length>0&&!ze(w,o.include)?b="not matched by --include":o.respectDependabotConfig&&n&&je(w,"gitlab",n)&&(b="ignored by dependabot/renovate config");const j=le(B=>({currentRef:u.ref,currentVersion:u.ref,ecosystem:"gitlab",file:u.file,ignored:!0,line:u.line,name:w,newRef:u.ref,newVersion:void 0,original:u.original,reason:B,replacement:u.original,updateType:"unknown"}),"buildIgnored");if(b){l.push(j(b));continue}const S=H(u.ref);if(!S&&!o.includeBranches){l.push(j("branch reference (use --include-branches)"));continue}if(!S&&o.mode!=="latest"){l.push(j(`branch ref has no version baseline for --target=${o.mode}`));continue}const x=Te(y.parsed,S,o.mode,!1);if(!x)continue;let T;u.kind==="component"?T=`${u.componentName?`${u.project}/${u.componentName}`:u.project}@${x.raw}`:T=x.raw,d.push({currentRef:u.ref,currentVersion:S?.raw??u.ref,ecosystem:"gitlab",file:u.file,line:u.line,name:w,newRef:x.raw,newVersion:x.raw,original:u.original,replacement:T,updateType:Oe(S,x),url:Ms(u.project,x.raw,g)})}},"processGroup"),k=[];for(let h=0;h<Math.min($,C.length);h++)k.push((async()=>{for(;R<C.length;){const p=C[R];R+=1,p!==void 0&&await v(p)}})());return await Promise.all(k),{failed:c,ignored:l,updates:d}},"checkGitlab");var Fs=Object.defineProperty,qs=E((e,t)=>Fs(e,"name",{value:t,configurable:!0}),"d$1");const Ws={disabled:new Set,exclude:[],githubToken:void 0,gitlabToken:void 0,include:[],includeBranches:!1,maxConcurrentRequests:8,minAgeDays:void 0,mode:"latest",respectDependabotConfig:!0,style:"sha"},Ls=qs(async e=>{const t={...Ws,...e.options,disabled:e.options?.disabled??new Set},n=t.respectDependabotConfig?vn(e.workspaceRoot):void 0,s={actions:{failed:[],ignored:[],updates:[]},docker:{failed:[],ignored:[],updates:[]},gitlab:{failed:[],ignored:[],updates:[]}},r=[];let o=0;if(!t.disabled.has("actions")){const d=Fn(e.workspaceRoot);d.length>0&&(o+=1,r.push(Kn(e.workspaceRoot,{ignoreRules:n,options:t,references:d}).then(l=>{s.actions=l})))}if(!t.disabled.has("docker")){const d=ps(e.workspaceRoot);d.length>0&&(o+=1,r.push(ft(e.workspaceRoot,{ignoreRules:n,options:t,references:d}).then(l=>{s.docker=l})))}if(!t.disabled.has("gitlab")){const{images:d,includes:l}=Bs(e.workspaceRoot);d.length+l.length>0&&(o+=1,r.push(_s(e.workspaceRoot,{ignoreRules:n,imageReferences:d,includes:l,options:t}).then(c=>{s.gitlab=c})))}await Promise.all(r);const i=[...s.actions.updates,...s.docker.updates,...s.gitlab.updates],a=[...s.actions.ignored,...s.docker.ignored,...s.gitlab.ignored];return{failed:[...s.actions.failed,...s.docker.failed,...s.gitlab.failed],ignored:a,perEcosystem:s,scanned:o,updates:i}},"checkEcosystems");var Hs=Object.defineProperty,se=E((e,t)=>Hs(e,"name",{value:t,configurable:!0}),"r");const Gs={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},Se=se(e=>e.updateType==="major","isBreakingUpdate"),zs=se(e=>{switch(e){case"major":return Z;case"minor":return P;case"patch":return nt;default:return tt}},"colorForUpdateType"),Ke=se(e=>{const t=zs(e.updateType),n=e.currentVersion??e.currentRef,s=e.newVersion??e.newRef,r=e.url?` ${F(e.url)}`:"",o=e.advisories&&e.advisories.length>0?` ${Z(`⚠ ${String(e.advisories.length)} advisor${e.advisories.length===1?"y":"ies"}`)}`:"";return` ${t(e.updateType.padEnd(7))} ${e.name} ${F(n)} → ${s}${o}${r}`},"formatUpdateLine"),Ye=se(e=>!e.advisories||e.advisories.length===0?[]:e.advisories.map(t=>` ${t.severity==="CRITICAL"||t.severity==="HIGH"?Z(t.severity):P(t.severity)} ${t.id} ${F(t.summary)}`),"formatAdvisoryLines"),Ks=se((e,t)=>{const n=[],s=e.updates.length;if(s===0&&e.scanned===0)return"";if(s===0){if(e.failed.length===0&&e.ignored.length===0)return n.push(`${nt("✓")} All ecosystem references up to date.`),n.join(`
6
+ `);if(n.push(`${P("⚠")} No actionable updates found.`),e.failed.length>0){n.push(`
7
+ ${P("Failed lookups:")}`);for(const o of e.failed)n.push(` ${o.file}: ${o.reason}`)}if(t.showIgnored&&e.ignored.length>0){n.push(`
8
+ ${F("Ignored:")}`);for(const o of e.ignored)n.push(` ${F(o.name)} ${F(o.reason??"")}`)}return n.join(`
9
+ `)}n.push(`
10
+ ${tt("Ecosystem updates")} — ${String(s)} reference${s===1?"":"s"} can be bumped:`);const r=e.updates.filter(o=>Se(o));if(r.length>0){n.push(`
11
+ ${Z(wt(`⚠ Breaking changes (${String(r.length)})`))}`),n.push(` ${F("Review release notes before applying — these cross a major-version boundary.")}`);for(const o of r)n.push(Ke(o)),n.push(...Ye(o))}for(const o of Object.keys(e.perEcosystem)){const i=e.perEcosystem[o];if(i.updates.length!==0){n.push(`
12
+ ${Gs[o]} (${String(i.updates.length)})`);for(const a of i.updates)n.push(Ke(a)),n.push(...Ye(a))}}if(t.showIgnored&&e.ignored.length>0){n.push(`
13
+ ${F("Ignored:")}`);for(const o of e.ignored)n.push(` ${F(o.name)} ${F(o.reason??"")}`)}if(e.failed.length>0){n.push(`
14
+ ${P("Failed lookups:")}`);for(const o of e.failed)n.push(` ${o.file}: ${o.reason}`)}return n.join(`
15
+ `)},"formatEcosystemReport"),Ys=se(e=>JSON.stringify({ecosystems:{failed:e.failed,ignored:e.ignored,perEcosystem:e.perEcosystem,scanned:e.scanned,updates:e.updates}},void 0,2),"formatEcosystemJson");var Js=Object.defineProperty,te=E((e,t)=>Js(e,"name",{value:t,configurable:!0}),"o");const Zs=te(()=>{const e=et({input:process.stdin,output:process.stdout});return{ask:te(t=>new Promise(n=>{e.question(t,s=>{n(s.trim())})}),"ask"),close:te(()=>{e.close()},"close"),write:te(t=>{process.stdout.write(`${t}
16
+ `)},"write")}},"createReadlineIO"),Xs=te((e,t)=>e.split(",").map(n=>Number.parseInt(n.trim(),10)-1).filter(n=>Number.isInteger(n)&&n>=0&&n<t),"parseIndexSelection"),Qs=te(async(e,t=Zs())=>{if(e.length===0)return t.close(),[];t.write(""),t.write("Outdated ecosystem references:");for(const[s,r]of e.entries()){const o=r.currentVersion??r.currentRef,i=r.newVersion??r.newRef,a=Se(r)?" [BREAKING]":"";t.write(` ${String(s+1)}. [${r.ecosystem}] ${r.name}: ${o} ${i} (${r.updateType})${a}`)}t.write("");const n=(await t.ask("Apply updates? [a]ll / [s]afe / [n]one / numbers: ")).toLowerCase();if(n==="a"||n==="all")return t.close(),e;if(n==="s"||n==="safe")return t.close(),e.filter(s=>!Se(s));if(n==="n"||n==="none"||n==="")return t.close(),[];if(/^[\d ,]+$/.test(n)){const s=Xs(n,e.length);return t.close(),s.map(r=>e[r]).filter(r=>r!==void 0)}return t.close(),[]},"promptEcosystemSelection");var eo=Object.defineProperty,U=E((e,t)=>eo(e,"name",{value:t,configurable:!0}),"y");const gt=U(e=>{const t=e.trim();if(t==="")return;const n=/^(\d+(?:\.\d+)?)\s*([mhdw])?$/i.exec(t);if(!n)return;const s=Number.parseFloat(n[1]);if(!(!Number.isFinite(s)||s<0))switch((n[2]??"m").toLowerCase()){case"d":return s*60*24;case"h":return s*60;case"m":return s;case"w":return s*60*24*7;default:return}},"parseTimeStringToMinutes"),to=U(e=>{const t=e.trim();return/^\d+(?:\.\d+)?$/.test(t)?Number.parseFloat(t)*1440:gt(t)},"parseNpmReleaseAgeValue"),jo=U(e=>!Number.isFinite(e)||e<=0?"0m":e%1440===0?`${String(e/1440)}d`:e%60===0?`${String(e/60)}h`:`${String(e)}m`,"formatMinutesAsTimeString"),no=U((e,t)=>{try{switch(t){case"bun":{const n=M(e,"bunfig.toml");if(N(n)){const s=xt(n),r=s?.install?.minimumReleaseAge;return{excludes:Array.isArray(s?.install?.minimumReleaseAgeExcludes)?s.install.minimumReleaseAgeExcludes:void 0,minutes:typeof r=="number"?Math.round(r/60):void 0}}break}case"npm":{const n=M(e,".npmrc");if(N(n)){const s=Q(n),r=/^\s*min-release-age\s*=\s*([^\s#;]+)/m.exec(s);return{minutes:r?to(r[1]):void 0}}break}case"pnpm":{const n=M(e,"pnpm-workspace.yaml");if(N(n)){const s=Pe(n);return{excludes:Array.isArray(s?.minimumReleaseAgeExclude)?s.minimumReleaseAgeExclude:void 0,minutes:typeof s?.minimumReleaseAge=="number"?s.minimumReleaseAge:void 0}}break}case"yarn":{const n=M(e,".yarnrc.yml");if(N(n)){const s=Pe(n)?.npmMinimalAgeGate;if(typeof s=="string")return{minutes:gt(s)};if(typeof s=="number")return{minutes:s}}break}}}catch{}return{}},"readPmNativeMinimumReleaseAge"),so=U((e,t,n)=>{const s=e.latest?"latest":e.target??t.target??"latest";if(!["latest","minor","patch"].includes(s))throw new Error(`Invalid target "${s}". Use: latest, minor, or patch.`);const r=e.maxConcurrentRequests,o=typeof r=="number"&&r>0?r:t.maxConcurrentRequests,i=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(i!==void 0&&!["any","same","stable"].includes(i))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const a=i??t.releaseChannel;return{exclude:[...q(e.exclude),...q(t.exclude)],ignore:q(t.ignore),include:[...q(e.include),...q(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,maxConcurrentRequests:o,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,releaseChannel:a,security:e.security===!1?!1:e.ai||(t.security??!0),target:s}},"buildCatalogCheckOptions"),Je=U((e,t)=>{if(e.length!==0){t.info(`
17
+ ${P("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},"logFilteredByTarget"),Ze=U((e,t,n,s,r)=>{n==="json"?process.stdout.write(`${At({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
18
+ `):n==="minimal"?process.stdout.write(`${Ct(e)}
19
+ `):(St(e,s),s.info(st(e,r)))},"writeFormattedOutput"),Xe=U(async(e,t,n,s,r,o,i)=>{const a=Et(e,n,t,!0,{useEditorconfig:i}),d=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(r.info(`
20
+ Updated ${d}`),a&&r.info(`Backup saved to ${a}`),s.changelog){r.info(`
21
+ Fetching changelogs...`);const l=await ot(n,void 0,o);for(const c of l){const f=c.releaseUrl??c.repoUrl??c.npmUrl;r.info(` ${c.packageName}: ${f}`)}}if(s.install??!0){const l=t,c=["install"];r.info(`Running ${l} ${c.join(" ")}...
22
+ `);try{const{code:f,output:g}=await rt(l,c,{cwd:e,env:process.env});f!==0?r.warn(`${l} ${c.join(" ")} failed. You may need to run it manually.`):s.peer!==!0&&it(g)&&r.info(at)}catch{r.warn(`${l} ${c.join(" ")} failed. You may need to run it manually.`)}}},"applyCatalogAndInstall"),Ee={applied:!1,canceled:!1,jsonEmitted:!1},oo=U(async(e,t,n,s,r,o)=>{const i=n.update??{},a=[["global","--global is not supported in catalog mode"],["recursive","--recursive is not needed in catalog mode (catalogs are workspace-level)"],["filter","--filter is not supported in catalog mode (use --include/--exclude instead)"],["no-save","--no-save is not supported in catalog mode"],["workspace-root","--workspace-root is not needed in catalog mode"],["no-optional","--no-optional is not supported in catalog mode"]];for(const[A,O]of a)s[A]&&o.warn(`${P("⚠")} ${O}, ignoring.`);const d=xe("minReleaseAge"),{excludes:l,minutes:c}=d?{excludes:void 0,minutes:void 0}:no(e,t),f=d?void 0:i.minimumReleaseAge??c,g=d?void 0:i.minimumReleaseAgeExclude??l;if(d&&(i.minimumReleaseAge!==void 0||c!==void 0)&&o.info("minimumReleaseAge gate disabled via MARSHALL_DISABLE_MIN_RELEASE_AGE."),!d&&i.minimumReleaseAge!==void 0&&c!==void 0&&i.minimumReleaseAge!==c){const A=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";o.warn(`${P("⚠")} minimumReleaseAge mismatch: vis config = ${String(i.minimumReleaseAge)} min, ${A} = ${String(c)} min. Consider keeping them in sync.`)}const m=jt(e),$=s["include-internal"],C=s.peer,R=Tt(e,t,{depFields:i.depFields,dev:s.dev,includeInternal:$,peer:C,prod:s.prod});if(R.size===0)return o.info("No catalogs found."),Ee;const v={...i,minimumReleaseAge:f,minimumReleaseAgeExclude:g},k=so(s,v,r);let h=0;for(const A of R.values())h+=A.size;const p=!!process.stdout.isTTY&&!ve;let y;const u=p?(A,O)=>{y?y.rerender(_.createElement(Me,{current:A,total:O})):(process.stdout.write(`
23
+ `),y=Be(_.createElement(Me,{current:A,total:O}),{interactive:!0,patchConsole:!1}))}:(A,O)=>{o.info(`Checking ${String(A)}/${String(O)} dependencies...`)};p||o.info(`Checking ${String(h)} catalog dependencies...
24
+ `);const w=new Set;xe("socket")&&w.add("socket"),xe("depsDev")&&w.add("deps-dev");const b=n.security?.policies?.score?.minimum,j=Ot(n.security,{disabled:w,minimumScore:b}),{checkedCount:S,failed:x,filteredByTarget:T,ignored:B,outdated:D}=await It(R,k,m,u,e,j,n.security?.acceptedRisks);y&&(y.clear(),y.unmount());const K=$?{ignored:[],outdated:[]}:Dt(e,{depFields:i.depFields,dev:s.dev,exclude:k.exclude,ignore:k.ignore,include:k.include,packageMode:k.packageMode,peer:C,prod:s.prod,target:k.target});if(K.outdated.length>0){const A=new Set(D.map(O=>`${O.catalogName}|${O.packageName}`));for(const O of K.outdated)A.has(`${O.catalogName}|${O.packageName}`)||D.push(O)}if(K.ignored.length>0)for(const A of K.ignored)B.includes(A)||B.push(A);const De=S-D.length-x.length;if(x.length>0&&o.warn(`Failed to fetch: ${x.join(", ")}`),B.length>0&&o.info(`Skipped ${String(B.length)} ignored package${B.length===1?"":"s"}: ${B.join(", ")}`),!p&&S>D.length){const A=[...R.values()].reduce((re,we)=>re+we.size,0),O=A>S?` (${String(A)} catalog entries, ${String(A-S)} duplicates)`:"";o.info(`Checked ${String(S)} unique packages${O}: ${String(D.length)} outdated, ${String(De)} up-to-date${x.length>0?`, ${String(x.length)} failed`:""}${T.length>0?`, ${String(T.length)} skipped by target`:""}`)}if(D.length===0)return T.length>0?o.info(`All catalog dependencies are up to date within the current target.
25
+ ${String(T.length)} package${T.length===1?" has":"s have"} newer versions available with --target latest:
26
+ ${T.map(A=>` ${A.packageName} ${A.currentRange} → ${A.newRange} (${A.updateType})`).join(`
27
+ `)}`):o.info("All catalog dependencies are up to date."),Ee;const Y=s.format??i.format??"table";let W;if(s.ai){const A=Ft(s.aiType??"impact");W=await qt(D,o,n.ai,A)}const pe=!!s.dryRun;if(!pe&&r.length>0&&s.marshallCheck!==!1){const A=await Ht(r);if(A.length>0){const O=await Gt(A,{config:n?.security?.marshalls,workspaceRoot:e});if(!await zt(O))return process.exitCode=1,{applied:!1,canceled:!0,jsonEmitted:!1}}}if(p&&Y==="table"){const A=new Jt(D,W??null);let O;if(s.changelog){o.info("Fetching changelogs...");const I=await ot(D,void 0,m);O=new Map;for(const V of I){const J=V.releaseUrl??V.repoUrl??V.npmUrl;J&&O.set(V.packageName,J)}}const re=n.tui?.autoExit??!1,we=re===!0?3:typeof re=="number"?re:0,Ue=await Be(_.createElement(Zt,{autoExitSeconds:we,changelogUrls:O,checkedCount:S,filteredOutEntries:T,isDryRun:pe,store:A,totalCatalogEntries:h}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),be=process.stdout.columns||80;process.stdout.write(`
28
+ `);for(const I of D){const V=I.vulnerabilities?.length||I.socketReport&&I.socketReport.alerts.length>0,J=!!I.acceptedRisk,Re=V?J?"✓":"⚠":"✓",ht=J?"gray":I.updateType==="major"?"red":I.updateType==="minor"?"yellow":"green",ge=I.socketReport?.score.overall,$t=ge===void 0?"":` [${String(Math.round(ge*100))}%]`,Ne=ge===void 0?void 0:Ut(ge);process.stdout.write(`${Ae(_.createElement(L,null," ",_.createElement(L,{color:ht},Re),` ${I.packageName} ${I.currentRange} → ${I.newRange}`,_.createElement(L,{dimColor:!0},` ${I.updateType}`),Ne?_.createElement(L,{color:Ne},$t):null),{columns:be})}
29
+ `)}if(process.stdout.write(`
30
+ `),o.info(st(D,b)),S>D.length){const I=[...R.values()].reduce((J,Re)=>J+Re.size,0),V=I>S?` (${String(I)} catalog entries, ${String(I-S)} duplicates)`:"";o.log(),o.info(`Checked ${String(S)} unique packages${V}: ${String(De)} up-to-date${x.length>0?`, ${String(x.length)} failed`:""}`)}if(T.length>0){process.stdout.write(`
31
+ `);const I=`${String(T.length)} package${T.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${Ae(_.createElement(L,{color:"yellow"},` ${I}`),{columns:be})}
32
+ `);for(const V of T)process.stdout.write(`${Ae(_.createElement(L,null," ",_.createElement(L,{dimColor:!0},V.packageName),` ${V.currentRange} → ${V.newRange}`,_.createElement(L,{dimColor:!0},` ${V.updateType}`)),{columns:be})}
33
+ `)}const fe=Array.isArray(Ue)?Ue:[];if(fe.length>0&&!pe){o.info(`
34
+ Applying ${String(fe.length)} updates...
35
+ `);const I={...s,install:s.install??i.install};return await Xe(e,t,fe,I,o,m,n.editorconfig??!0),{applied:!0,canceled:!1,jsonEmitted:!1}}return{applied:!1,canceled:fe.length===0,jsonEmitted:!1}}if(pe){if(Y==="json"){const A={failed:x,filteredByTarget:T,ignored:B,outdated:D};W&&(A.aiAnalysis=W),process.stdout.write(`${JSON.stringify(A,void 0,2)}
36
+ `)}else o.info(`Would update ${String(D.length)} dependencies:
37
+ `),Ze(D,x,Y,o,b),W&&(o.info(""),o.info(Ve(W))),Je(T,o);return{applied:!1,canceled:!1,jsonEmitted:Y==="json"}}W&&Y!=="json"&&(o.info(Ve(W)),o.info(""));let oe=D;if(s.interactive&&(oe=await Nt(D),oe.length===0))return o.info("No updates selected."),{applied:!1,canceled:!0,jsonEmitted:!1};o.info(`Updating ${String(oe.length)} catalog dependencies...
38
+ `),Ze(oe,[],Y,o,b),Je(T,o);const mt={...s,install:s.install??i.install};return await Xe(e,t,oe,mt,o,m),{applied:!0,canceled:!1,jsonEmitted:Y==="json"}},"executeCatalogUpdate"),ro=U(async(e,t,n,s,r,o)=>{const i={dev:s.dev,filters:q(s.filter),global:s.global,interactive:s.interactive,latest:s.latest||s.target==="latest",noOptional:s.optional===!1,noSave:s.save===!1,packages:r,prod:s.prod,recursive:s.recursive,workspaceRoot:s.workspaceRoot},{command:a,warnings:d}=dn(t,n,i);for(const c of d)o.warn(c);const l=`${a.bin} ${a.args.join(" ")}`.trim();if(s.dryRun)return o.info(`Would run: ${l}`),Ee;o.info(`Running: ${l}`);try{const{code:c,output:f}=await rt(a.bin,a.args,{cwd:e,env:process.env});if(c!==0)return o.error(`
39
+ ${Z("✖")} Update failed (exit code ${String(c)})`),o.error(` Command: ${l}`),o.error(` Directory: ${e}
40
+ `),process.exitCode=c,{applied:!1,canceled:!1,jsonEmitted:!1};s.peer!==!0&&it(f)&&o.info(at)}catch(c){const f=c.status??1;return o.error(`
41
+ ${Z("✖")} Update failed (exit code ${String(f)})`),o.error(` Command: ${l}`),o.error(` Directory: ${e}
42
+ `),process.exitCode=f,{applied:!1,canceled:!1,jsonEmitted:!1}}return{applied:!0,canceled:!1,jsonEmitted:!1}},"executePmWrapper"),io=U(async(e,t,n)=>{const s=e.latest===!0||e.target==="latest";if(t||!s||e.dryRun===!0||e.yes===!0||e.interactive===!0)return!0;if(!(process.stdout.isTTY&&!ve))return n.error(`${Z("✖")} Refusing to run blanket --latest update in a non-interactive context.`),n.error(" Re-run with --yes to confirm, --dry-run to preview, or pass explicit package names."),process.exitCode=1,!1;const r=et({input:process.stdin,output:process.stdout});try{const o=(await new Promise(i=>{r.question(`${P("⚠")} About to upgrade ALL dependencies to their latest versions. This may include breaking changes.
43
+ Continue? [y/N] `,i)})).trim().toLowerCase();return o==="y"||o==="yes"?!0:(n.info("Aborted."),!1)}finally{r.close()}},"requireBlanketUpdateConfirmation"),ao=U((e,t)=>{const n=new Set;e.actions===!1&&n.add("actions"),e.docker===!1&&n.add("docker"),e.gitlab===!1&&n.add("gitlab");const s=e.style??"sha";if(s!=="sha"&&s!=="preserve")throw new Error(`Invalid --style "${s}". Use: sha or preserve.`);const r=e.latest===!0?"latest":e.target??"latest";if(r!=="latest"&&r!=="minor"&&r!=="patch")throw new Error(`Invalid target "${r}". Use: latest, minor, or patch.`);const o=r,i=t.update??{};return{disabled:n,exclude:[...q(e.exclude),...q(i.exclude)],githubToken:e.actionsToken??void 0,gitlabToken:e.gitlabToken??void 0,include:q(e.include),includeBranches:e.includeBranches===!0,maxConcurrentRequests:typeof e.maxConcurrentRequests=="number"&&e.maxConcurrentRequests>0?e.maxConcurrentRequests:8,minAgeDays:typeof i.minimumReleaseAge=="number"&&i.minimumReleaseAge>0?i.minimumReleaseAge/1440:void 0,mode:o,respectDependabotConfig:!0,style:s}},"buildEcosystemOptions"),co=U((e,t)=>e.dryRun===!0||process.exitCode!==void 0&&process.exitCode!==0||t.canceled?!1:!!(e.yes===!0||e.interactive===!0&&t.applied||t.applied&&process.stdout.isTTY&&!ve),"shouldApplyEcosystem"),lo=U(async(e,t,n,s,r)=>{const o=ao(t,n);if(o.disabled.size===3)return;let i;try{i=await Ls({options:o,workspaceRoot:e})}catch(g){s.warn(`${P("⚠")} Ecosystem update scan failed: ${g.message}`);return}if(i.scanned===0)return i;const a=t.format??"table",d=!!t.dryRun;if(a==="json")r.jsonEmitted?s.warn(`${P("⚠")} ${String(i.updates.length)} ecosystem update${i.updates.length===1?"":"s"} available but not emitted in --format=json (catalog already wrote one JSON document). Rerun with --format=table or --no-catalog to see them.`):process.stdout.write(`${Ys(i)}
44
+ `);else if(a!=="minimal"){const g=Ks(i,{showIgnored:t.interactive===!0});g&&s.info(g)}if(d||i.updates.length===0)return i;if(!co(t,r))return s.info(`
45
+ ${P("ℹ")} ${String(i.updates.length)} ecosystem reference${i.updates.length===1?"":"s"} can be bumped. Re-run with \`--yes\` to apply (or \`--no-actions\` / \`--no-docker\` / \`--no-gitlab\` to silence by ecosystem).`),i;let l=i.updates;if(t.interactive===!0&&process.stdout.isTTY&&!ve&&(l=await Qs(i.updates),l.length===0))return s.info(`${P("ℹ")} No ecosystem updates selected.`),i;const{applied:c,skipped:f}=Zn(l);if(c.length>0&&s.info(`
46
+ ${String(c.length)} ecosystem reference${c.length===1?"":"s"} updated.`),f.length>0){s.warn(`${P("⚠")} ${String(f.length)} ecosystem update${f.length===1?"":"s"} skipped:`);for(const g of f)s.warn(` ${g.update.name} (${g.update.file}:${String(g.update.line)}): ${g.reason}`)}return i},"runEcosystemUpdate"),uo=U(e=>{const t=e.style;if(t!==void 0&&t!=="sha"&&t!=="preserve")throw new Error(`Invalid --style "${t}". Use: sha or preserve.`);const n=e.target;if(n!==void 0&&n!=="latest"&&n!=="minor"&&n!=="patch")throw new Error(`Invalid --target "${n}". Use: latest, minor, or patch.`)},"validateEcosystemFlags"),To=U(async({argument:e,logger:t,options:n,visConfig:s,workspaceRoot:r})=>{if(!r)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");uo(n);let o=e;const i=r,{packageManager:a}=Pt(i);if(n.typosquatCheck!==!1){if(o.length>0){const c=o.map(m=>Xt(m)),f=s?.security?.typosquatAllowlist,g=await Kt(c.map(m=>m.name),f);if(!g.ok){process.exitCode=1;return}o=c.map((m,$)=>{const C=g.packages[$];return C!==m.name?m.versionSpec?`${C}@${m.versionSpec}`:C??"":o[$]??""})}else if(!await Yt(i,s?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Bt(i,a)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(Vt(i,a))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!await io(n,o.length>0,t))return;const d=n.catalog!==!1&&Mt(i,a);let l;if(d)l=await oo(i,a,s??{},n,o,t);else{const c=Lt(i,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),f=c.name==="aube"?"":_t(c.name);l=await ro(i,c.name,f,n,o,t)}o.length===0&&await lo(i,n,s??{},t,l)},"execute");export{To as default,jo as formatMinutesAsTimeString,to as parseNpmReleaseAgeValue,gt as parseTimeStringToMinutes,no as readPmNativeMinimumReleaseAge,io as requireBlanketUpdateConfirmation,lo as runEcosystemUpdate};
@@ -1,3 +1,3 @@
1
- var Ve=Object.defineProperty;var y=(n,e)=>Ve(n,"name",{value:e,configurable:!0});import{createRequire as He}from"node:module";import{render as Ye}from"@visulima/tui";import{aE as Ke,s as Qe}from"./bin.js";import Ze,{useMemo as q,useSyncExternalStore as er,useState as C,useRef as Z,useEffect as ae,useCallback as rr}from"react";import{A as tr}from"../packem_shared/pm-runner-Dnj9J3KF.js";import{b as nr}from"./config.js";import{o as ir,M as de,i as cr,$ as sr,K as ar}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";import{Box as c}from"@visulima/tui/components/box";import{Dialog as lr}from"@visulima/tui/components/dialog";import{Tab as dr}from"@visulima/tui/components/tab";import{Tabs as ur}from"@visulima/tui/components/tabs";import{Text as t}from"@visulima/tui/components/text";import{useApp as hr}from"@visulima/tui/hooks/use-app";import{useInput as H}from"@visulima/tui/hooks/use-input";import{useWindowSize as mr}from"@visulima/tui/hooks/use-window-size";import{TextInput as he}from"@visulima/tui/components/text-input";import{ScrollBar as je}from"@visulima/tui/components/scroll-bar";import{ScrollView as gr}from"@visulima/tui/components/scroll-view";const Je=He(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=y(n=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[e,s]=V.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return V.getBuiltinModule(n)}return Je(n)},"__cjs_getBuiltinModule"),{writeFileSync:or}=qe("node:fs");var fr=Object.defineProperty,pr=y((n,e)=>fr(n,"name",{value:e,configurable:!0}),"a$1"),vr=Object.defineProperty,yr=pr((n,e)=>vr(n,"name",{value:e,configurable:!0}),"r"),br=Object.defineProperty,wr=yr((n,e)=>br(n,"name",{value:e,configurable:!0}),"n");const xr=wr((n,{whitespace:e=!0}={})=>n.replace(ir,s=>s.startsWith('"')||s[1]==="*"&&!s.endsWith("*/")?s:e?s.replaceAll(/\S/g," "):""),"stripJsonComments"),$=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var Cr=Object.defineProperty,Oe=y((n,e)=>Cr(n,"name",{value:e,configurable:!0}),"s$6");const kr=Oe(n=>{const e=de(n,".devcontainer","devcontainer.json");if(!cr(e))return null;const s=sr(e),l=xr(s),a=l!==s;let o;try{o=JSON.parse(l)}catch(d){const g=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse ${e}: ${g}`,{cause:d})}return{config:o,hadComments:a}},"readDevcontainerJson"),Sr=Oe((n,e,s)=>{const l=s?ar(s):de(n,".devcontainer"),a=s??de(l,"devcontainer.json");nr(l),or(a,`${JSON.stringify(e,null,2)}
1
+ var Ve=Object.defineProperty;var y=(n,e)=>Ve(n,"name",{value:e,configurable:!0});import{createRequire as He}from"node:module";import{render as Ye}from"@visulima/tui";import{au as Ke,s as Qe}from"./bin.js";import Ze,{useMemo as q,useSyncExternalStore as er,useState as C,useRef as Z,useEffect as ae,useCallback as rr}from"react";import{A as tr}from"../packem_shared/pm-runner-Cj76BV8q.js";import{b as nr}from"./config.js";import{o as ir,M as de,i as cr,$ as sr,K as ar}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";import{Box as c}from"@visulima/tui/components/box";import{Dialog as lr}from"@visulima/tui/components/dialog";import{Tab as dr}from"@visulima/tui/components/tab";import{Tabs as ur}from"@visulima/tui/components/tabs";import{Text as t}from"@visulima/tui/components/text";import{useApp as hr}from"@visulima/tui/hooks/use-app";import{useInput as H}from"@visulima/tui/hooks/use-input";import{useWindowSize as mr}from"@visulima/tui/hooks/use-window-size";import{TextInput as he}from"@visulima/tui/components/text-input";import{ScrollBar as je}from"@visulima/tui/components/scroll-bar";import{ScrollView as gr}from"@visulima/tui/components/scroll-view";const Je=He(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=y(n=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[e,s]=V.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return V.getBuiltinModule(n)}return Je(n)},"__cjs_getBuiltinModule"),{writeFileSync:or}=qe("node:fs");var fr=Object.defineProperty,pr=y((n,e)=>fr(n,"name",{value:e,configurable:!0}),"a$1"),vr=Object.defineProperty,yr=pr((n,e)=>vr(n,"name",{value:e,configurable:!0}),"r"),br=Object.defineProperty,wr=yr((n,e)=>br(n,"name",{value:e,configurable:!0}),"n");const xr=wr((n,{whitespace:e=!0}={})=>n.replace(ir,s=>s.startsWith('"')||s[1]==="*"&&!s.endsWith("*/")?s:e?s.replaceAll(/\S/g," "):""),"stripJsonComments"),$=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var Cr=Object.defineProperty,Oe=y((n,e)=>Cr(n,"name",{value:e,configurable:!0}),"s$6");const kr=Oe(n=>{const e=de(n,".devcontainer","devcontainer.json");if(!cr(e))return null;const s=sr(e),l=xr(s),a=l!==s;let o;try{o=JSON.parse(l)}catch(d){const g=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse ${e}: ${g}`,{cause:d})}return{config:o,hadComments:a}},"readDevcontainerJson"),Sr=Oe((n,e,s)=>{const l=s?ar(s):de(n,".devcontainer"),a=s??de(l,"devcontainer.json");nr(l),or(a,`${JSON.stringify(e,null,2)}
2
2
  `,"utf8")},"writeDevcontainerJson");var Er=Object.defineProperty,Ir=y((n,e)=>Er(n,"name",{value:e,configurable:!0}),"s$5");const Tr={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},Pr=[{featureMatch:"docker-in-docker",mounts:[]},{featureMatch:"docker-outside-of-docker",mounts:[{source:"/var/run/docker.sock",target:"/var/run/docker.sock",type:"bind"}]},{featureMatch:"/features/git:",mounts:[{source:"${localWorkspaceFolderBasename}-git-config",target:"/home/node/.gitconfig",type:"volume"}]}],xe=Ir((n,e,s)=>{const l=[],a=new Set(s.map(d=>typeof d=="string"?d:d.target));if(n)for(const d of Tr[n])a.has(d.target)||l.push(d);const o=Object.keys(e);for(const{featureMatch:d,mounts:g}of Pr)if(o.some(f=>f.includes(d)))for(const f of g)a.has(f.target)||l.push(f);return l},"getSuggestedMounts"),A=["general","features","ports","lifecycle","extensions","environment","mounts","compose"];var Dr=Object.defineProperty,ee=y((n,e)=>Dr(n,"name",{value:e,configurable:!0}),"c$1");const J=ee(n=>structuredClone(n),"deepClone");class jr{static{y(this,"DevcontainerStore")}static{ee(this,"DevcontainerStore")}#o=new Set;#e;constructor(e,s,l=null){const a=e===null,o=e??{name:""},d=J(o);this.#e={config:d,detectedPm:l,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:s,isDirty:!1,mode:a?"create":"edit",originalConfig:a?null:J(o),section:"general",showTemplateSelector:a,suggestedMounts:xe(l,d.features??{},d.mounts??[]),templateIndex:0}}getSnapshot=ee(()=>this.#e,"getSnapshot");subscribe=ee(e=>(this.#o.add(e),()=>{this.#o.delete(e)}),"subscribe");setSection(e){e!==this.#e.section&&this.#r({...this.#e,fieldEditing:!1,fieldIndex:0,section:e})}nextSection(){const e=(A.indexOf(this.#e.section)+1)%A.length;this.setSection(A[e])}previousSection(){const e=(A.indexOf(this.#e.section)-1+A.length)%A.length;this.setSection(A[e])}setFieldIndex(e){e!==this.#e.fieldIndex&&this.#r({...this.#e,fieldIndex:Math.max(0,e)})}setFieldEditing(e){e!==this.#e.fieldEditing&&this.#r({...this.#e,fieldEditing:e})}setTemplateIndex(e){const s=Math.max(0,Math.min(e,$.length-1));s!==this.#e.templateIndex&&this.#r({...this.#e,templateIndex:s})}applyTemplate(e){const s=$.find(l=>l.id===e);s&&this.#r(this.#t({...this.#e,config:J(s.config),isDirty:!0,showTemplateSelector:!1}))}dismissTemplateSelector(){this.#r({...this.#e,showTemplateSelector:!1})}updateConfig(e){this.#r({...this.#e,config:{...this.#e.config,...e},isDirty:!0})}toggleFeature(e){const s={...this.#e.config.features};s[e]===void 0?s[e]={}:delete s[e],this.#r(this.#t({...this.#e,config:{...this.#e.config,features:s},isDirty:!0}))}setFeatureSearch(e){this.#r({...this.#e,featureSearch:e,fieldIndex:0})}addPort(e){const s=this.#e.config.forwardPorts??[];if(s.includes(e))return;const l=[...s,e];this.#r({...this.#e,config:{...this.#e.config,forwardPorts:l},isDirty:!0})}removePort(e){const s=[...this.#e.config.forwardPorts??[]];s.splice(e,1),this.#r({...this.#e,config:{...this.#e.config,forwardPorts:s.length>0?s:void 0},isDirty:!0})}toggleExtension(e){const s={...this.#e.config.customizations},l={...s.vscode},a=[...l.extensions??[]],o=a.indexOf(e);o===-1?a.push(e):a.splice(o,1),l.extensions=a.length>0?a:void 0,s.vscode=l.extensions||l.settings?l:void 0,this.#r({...this.#e,config:{...this.#e.config,customizations:s.vscode||s.jetbrains?s:void 0},isDirty:!0})}setExtensionSearch(e){this.#r({...this.#e,extensionSearch:e,fieldIndex:0})}addEnvVar(e,s,l){const a=e==="container"?"containerEnv":"remoteEnv",o={...this.#e.config[a],[s]:l};this.#r({...this.#e,config:{...this.#e.config,[a]:o},isDirty:!0})}removeEnvVar(e,s){const l=e==="container"?"containerEnv":"remoteEnv",a={...this.#e.config[l]};delete a[s],this.#r({...this.#e,config:{...this.#e.config,[l]:Object.keys(a).length>0?a:void 0},isDirty:!0})}addMount(e){const s=[...this.#e.config.mounts??[],e];this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:s},isDirty:!0}))}removeMount(e){const s=[...this.#e.config.mounts??[]];s.splice(e,1),this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:s.length>0?s:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const e=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#r(this.#t({...this.#e,config:{...this.#e.config,mounts:e},isDirty:!0}))}setLifecycleCommand(e,s){this.#r({...this.#e,config:{...this.#e.config,[e]:s||void 0},isDirty:!0})}markClean(){this.#r({...this.#e,isDirty:!1,originalConfig:J(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const e=J(this.#e.config);for(const[s,l]of Object.entries(e))(l===""||l===void 0)&&delete e[s];return e.build&&(e.build.dockerfile===""&&delete e.build.dockerfile,e.build.context===""&&delete e.build.context,e.build.args&&Object.keys(e.build.args).length===0&&delete e.build.args,Object.keys(e.build).length===0&&delete e.build),e.forwardPorts?.length===0&&delete e.forwardPorts,e.mounts?.length===0&&delete e.mounts,e.runServices?.length===0&&delete e.runServices,e.capAdd?.length===0&&delete e.capAdd,e.securityOpt?.length===0&&delete e.securityOpt,e.features&&Object.keys(e.features).length===0&&delete e.features,e.customizations?.vscode?.extensions?.length===0&&delete e.customizations.vscode.extensions,e.customizations?.vscode&&Object.keys(e.customizations.vscode).length===0&&delete e.customizations.vscode,e.customizations&&Object.keys(e.customizations).length===0&&delete e.customizations,e.containerEnv&&Object.keys(e.containerEnv).length===0&&delete e.containerEnv,e.remoteEnv&&Object.keys(e.remoteEnv).length===0&&delete e.remoteEnv,e}#t(e){return{...e,suggestedMounts:xe(e.detectedPm,e.config.features??{},e.config.mounts??[])}}#r(e){this.#e=e;for(const s of this.#o)try{s()}catch{}}}const Ce=[{category:"linting",description:"Integrates ESLint into the editor",id:"dbaeumer.vscode-eslint",name:"ESLint"},{category:"linting",description:"Stylelint CSS/SCSS linting",id:"stylelint.vscode-stylelint",name:"Stylelint"},{category:"formatting",description:"Opinionated code formatter",id:"esbenp.prettier-vscode",name:"Prettier"},{category:"formatting",description:"EditorConfig file support",id:"editorconfig.editorconfig",name:"EditorConfig"},{category:"formatting",description:"Fast Rust-based formatter and linter",id:"biomejs.biome",name:"Biome"},{category:"language",description:"Rich TypeScript and JavaScript support",id:"ms-vscode.vscode-typescript-next",name:"TypeScript Nightly"},{category:"language",description:"Tailwind CSS IntelliSense",id:"bradlc.vscode-tailwindcss",name:"Tailwind CSS"},{category:"language",description:"YAML language support with schemas",id:"redhat.vscode-yaml",name:"YAML"},{category:"language",description:"TOML language support",id:"tamasfe.even-better-toml",name:"TOML"},{category:"language",description:"Dockerfile and Docker Compose support",id:"ms-azuretools.vscode-docker",name:"Docker"},{category:"language",description:"Python language support with Pylance",id:"ms-python.python",name:"Python"},{category:"language",description:"Go language support",id:"golang.go",name:"Go"},{category:"language",description:"Rust language support via rust-analyzer",id:"rust-lang.rust-analyzer",name:"rust-analyzer"},{category:"git",description:"Git supercharged: blame, history, stash, etc.",id:"eamodio.gitlens",name:"GitLens"},{category:"git",description:"GitHub Pull Requests and Issues",id:"github.vscode-pull-request-github",name:"GitHub PR"},{category:"testing",description:"Vitest test explorer integration",id:"vitest.explorer",name:"Vitest Explorer"},{category:"testing",description:"Jest test runner and assertions",id:"orta.vscode-jest",name:"Jest"},{category:"debugging",description:"REST client for testing APIs",id:"humao.rest-client",name:"REST Client"},{category:"debugging",description:"Error Lens: inline error highlighting",id:"usernamehw.errorlens",name:"Error Lens"},{category:"other",description:"Intelligent code completion with AI",id:"github.copilot",name:"GitHub Copilot"},{category:"other",description:"Path autocompletion for imports",id:"christian-kohler.path-intellisense",name:"Path Intellisense"},{category:"other",description:"Import cost display in editor",id:"wix.vscode-import-cost",name:"Import Cost"},{category:"other",description:"Todo Tree: highlight and list TODOs",id:"gruntfuggly.todo-tree",name:"Todo Tree"}],ke=[{category:"language",description:"Node.js runtime via nvm with optional pnpm/yarn",id:"ghcr.io/devcontainers/features/node:1",name:"Node.js"},{category:"language",description:"Python runtime with pip and optional tools",id:"ghcr.io/devcontainers/features/python:1",name:"Python"},{category:"language",description:"Go compiler and tools",id:"ghcr.io/devcontainers/features/go:1",name:"Go"},{category:"language",description:"Rust toolchain via rustup",id:"ghcr.io/devcontainers/features/rust:1",name:"Rust"},{category:"language",description:"Java runtime and JDK via SDKMAN",id:"ghcr.io/devcontainers/features/java:1",name:"Java"},{category:"language",description:".NET SDK and runtime",id:"ghcr.io/devcontainers/features/dotnet:2",name:".NET"},{category:"tool",description:"Common utilities: zsh, Oh My Zsh, git, curl, etc.",id:"ghcr.io/devcontainers/features/common-utils:2",name:"Common Utilities"},{category:"tool",description:"Git version control",id:"ghcr.io/devcontainers/features/git:1",name:"Git"},{category:"tool",description:"Git Large File Storage support",id:"ghcr.io/devcontainers/features/git-lfs:1",name:"Git LFS"},{category:"tool",description:"GitHub CLI for repository management",id:"ghcr.io/devcontainers/features/github-cli:1",name:"GitHub CLI"},{category:"tool",description:"Run Docker containers inside the dev container",id:"ghcr.io/devcontainers/features/docker-in-docker:2",name:"Docker-in-Docker"},{category:"tool",description:"Access host Docker daemon from inside the container",id:"ghcr.io/devcontainers/features/docker-outside-of-docker:1",name:"Docker-from-Docker"},{category:"tool",description:"kubectl, Helm, and Minikube for Kubernetes",id:"ghcr.io/devcontainers/features/kubectl-helm-minikube:1",name:"Kubernetes Tools"},{category:"tool",description:"Infrastructure as code with Terraform",id:"ghcr.io/devcontainers/features/terraform:1",name:"Terraform"},{category:"tool",description:"Nix package manager",id:"ghcr.io/devcontainers/features/nix:1",name:"Nix"},{category:"tool",description:"SSH server for remote connections to the container",id:"ghcr.io/devcontainers/features/sshd:1",name:"SSH Server"},{category:"cloud",description:"Amazon Web Services CLI v2",id:"ghcr.io/devcontainers/features/aws-cli:1",name:"AWS CLI"},{category:"cloud",description:"Microsoft Azure CLI",id:"ghcr.io/devcontainers/features/azure-cli:1",name:"Azure CLI"},{category:"cloud",description:"Google Cloud Platform CLI",id:"ghcr.io/devcontainers/features/gcloud:1",name:"Google Cloud CLI"},{category:"database",description:"PostgreSQL client tools",id:"ghcr.io/devcontainers-extra/features/postgres-client:1",name:"PostgreSQL Client"},{category:"database",description:"Redis client tools",id:"ghcr.io/devcontainers-extra/features/redis-client:1",name:"Redis Client"}];var Or=Object.defineProperty,Fe=y((n,e)=>Or(n,"name",{value:e,configurable:!0}),"r$1");const me=Fe(n=>{if(!n)return ke;const e=n.toLowerCase();return ke.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterFeatures"),ge=Fe(n=>{if(!n)return Ce;const e=n.toLowerCase();return Ce.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterExtensions");var Fr=Object.defineProperty,Ar=y((n,e)=>Fr(n,"name",{value:e,configurable:!0}),"l$1");const Ae=["dockerComposeFile","service"],Lr={dockerComposeFile:"Compose File",service:"Service"},Se={dockerComposeFile:"docker-compose.yml",service:"app"},Mr={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},Br=Ar(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:l})=>{const a=!!n.dockerComposeFile,o=!!(n.image||n.build);return i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),o&&a&&r(c,{marginBottom:1,children:r(t,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Ae.map((d,g)=>{const f=g===s,p=n[d]??"",x=Array.isArray(n[d])?n[d].join(", "):p;return i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{children:[r(c,{width:20,children:i(t,{bold:f,color:f?"cyan":"white",children:[f?"❯ ":" ",Lr[d],":"]})}),r(c,{flexGrow:1,children:f&&e?r(he,{defaultValue:x,onChange:y(v=>{l({[d]:v||void 0})},"onChange"),placeholder:Se[d]}):r(t,{color:x?"white":"gray",children:x||Se[d]})})]}),r(c,{paddingLeft:4,children:r(t,{dimColor:!0,children:Mr[d]})})]},d)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},"DockerComposeSection"),Nr=Ae.length;var $r=Object.defineProperty,Le=y((n,e)=>$r(n,"name",{value:e,configurable:!0}),"h$2");const zr=Le(({config:n,fieldIndex:e})=>{const s=n.containerEnv??{},l=n.remoteEnv??{},a=Object.keys(s),o=Object.keys(l),d=a.length,g=a.length+1,f=g+o.length,p=e<=d,x=e>d;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{borderColor:p?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:a.length>0?1:0,children:[r(t,{bold:!0,color:p?"cyan":"white",children:"containerEnv"}),r(t,{dimColor:!0,children:" — baked into the container image"})]}),a.map((v,w)=>{const k=w===e;return r(c,{flexShrink:0,children:i(t,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",r(t,{bold:!0,children:v}),r(t,{dimColor:!0,children:" = "}),r(t,{children:s[v]})]})},v)}),r(c,{flexShrink:0,marginTop:a.length>0?1:0,children:i(t,{color:e===d?"cyan":"gray",inverse:e===d,children:[" ","+ Add variable..."]})})]}),i(c,{borderColor:x?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:o.length>0?1:0,children:[r(t,{bold:!0,color:x?"cyan":"white",children:"remoteEnv"}),r(t,{dimColor:!0,children:" — set at runtime by the IDE"})]}),o.map((v,w)=>{const k=g+w===e;return r(c,{flexShrink:0,children:i(t,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",r(t,{bold:!0,children:v}),r(t,{dimColor:!0,children:" = "}),r(t,{children:l[v]})]})},v)}),r(c,{flexShrink:0,marginTop:o.length>0?1:0,children:i(t,{color:e===f?"cyan":"gray",inverse:e===f,children:[" ","+ Add variable..."]})})]}),r(c,{flexShrink:0,marginTop:1,children:i(t,{dimColor:!0,wrap:"truncate",children:[r(t,{bold:!0,color:"white",children:"a"}),"/",r(t,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",r(t,{bold:!0,color:"white",children:"d"})," ","remove"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"EnvironmentSection"),Gr=Le(n=>{const e=Object.keys(n.containerEnv??{}).length,s=Object.keys(n.remoteEnv??{}).length;return e+1+s+1},"getEnvFieldCount");var Rr=Object.defineProperty,_r=y((n,e)=>Rr(n,"name",{value:e,configurable:!0}),"g$2");const Wr=_r(({config:n,fieldIndex:e,scrollOffset:s,searchText:l,viewportHeight:a})=>{const o=q(()=>new Set(n.customizations?.vscode?.extensions),[n.customizations?.vscode?.extensions]),d=q(()=>ge(l),[l]),g=d.length,f=g>a&&a>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),l&&i(t,{dimColor:!0,children:["— filter:"," ",r(t,{color:"yellow",children:l})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[r(t,{children:v?">":" "}),i(t,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),r(c,{flexGrow:1,children:i(t,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(t,{dimColor:!0,children:[" ","-",p.id]})]})})]},p.id)})})}),f&&r(c,{flexShrink:0,marginLeft:1,marginRight:1,children:r(je,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:a})})]}),d.length===0&&r(c,{paddingX:1,children:r(t,{dimColor:!0,children:"No extensions match the search."})})]})},"ExtensionsSection");var Ur=Object.defineProperty,Xr=y((n,e)=>Ur(n,"name",{value:e,configurable:!0}),"g$1");const Vr=Xr(({config:n,fieldIndex:e,scrollOffset:s,searchText:l,viewportHeight:a})=>{const o=q(()=>new Set(Object.keys(n.features??{})),[n.features]),d=q(()=>me(l),[l]),g=d.length,f=g>a&&a>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),l&&i(t,{dimColor:!0,children:["— filter:"," ",r(t,{color:"yellow",children:l})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[r(t,{children:v?">":" "}),i(t,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),r(c,{flexGrow:1,children:i(t,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(t,{dimColor:!0,children:[" ","-",p.description]})]})})]},p.id)})})}),f&&r(c,{flexShrink:0,marginLeft:1,marginRight:1,children:r(je,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:a})})]}),d.length===0&&r(c,{paddingX:1,children:r(t,{dimColor:!0,children:"No features match the search."})})]})},"FeaturesSection");var Hr=Object.defineProperty,Jr=y((n,e)=>Hr(n,"name",{value:e,configurable:!0}),"u$1");const ue=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],qr={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},Ee={containerUser:"root",image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"My Dev Container",remoteUser:"node",shutdownAction:"none | stopContainer",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}",workspaceMount:"source=${localWorkspaceFolder},target=...,type=bind"},re=["privileged","overrideCommand"],Yr={overrideCommand:"Override Command",privileged:"Privileged"},Kr=ue.length+re.length,Qr=Jr(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:l})=>i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"General Configuration"})}),ue.map((a,o)=>{const d=o===s,g=n[a]??"";return i(c,{marginBottom:1,children:[r(c,{width:20,children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",qr[a],":"]})}),r(c,{flexGrow:1,children:d&&e?r(he,{defaultValue:g,onChange:y(f=>{l({[a]:f})},"onChange"),placeholder:Ee[a]}):r(t,{color:g?"white":"gray",children:g||Ee[a]})})]},a)}),re.map((a,o)=>{const d=ue.length+o===s,g=n[a]??!1;return i(c,{marginBottom:o<re.length-1?1:0,children:[r(c,{width:20,children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",Yr[a],":"]})}),r(c,{flexGrow:1,children:i(t,{color:g?"green":"gray",children:[g?"yes":"no",d&&r(t,{dimColor:!0,children:" (Space to toggle)"})]})})]},a)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",r(t,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"GeneralSection"),Me=Kr,le=re;var Zr=Object.defineProperty,et=y((n,e)=>Zr(n,"name",{value:e,configurable:!0}),"s$3");const Be=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],rt={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},tt={onCreateCommand:"Runs once when the container is first created",postAttachCommand:"Runs each time the IDE attaches",postCreateCommand:"Runs after the container is created and workspace mounted",postStartCommand:"Runs each time the container starts"},ot=et(({config:n,fieldEditing:e,fieldIndex:s,onSetCommand:l})=>i(c,{flexDirection:"column",paddingX:1,children:[r(c,{marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Be.map((a,o)=>{const d=o===s,g=n[a],f=Array.isArray(g)?g.join(" && "):g??"";return i(c,{flexDirection:"column",marginBottom:1,children:[r(c,{children:i(t,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",rt[a]]})}),r(c,{paddingLeft:4,children:r(t,{dimColor:!0,children:tt[a]})}),r(c,{paddingLeft:4,children:d&&e?r(he,{defaultValue:f,onChange:y(p=>{l(a,p)},"onChange"),placeholder:"e.g. npm install"}):r(t,{color:f?"green":"gray",children:f||"(not set)"})})]},a)}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"LifecycleSection"),nt=Be.length;var it=Object.defineProperty,Ne=y((n,e)=>it(n,"name",{value:e,configurable:!0}),"s$2");const Ie=Ne(n=>typeof n=="string"?n:`[${n.type}] ${n.source} → ${n.target}`,"formatMount"),ct=Ne(({addingMount:n,config:e,detectedPm:s,fieldIndex:l,mountPhase:a,mountSource:o,mountTarget:d,mountType:g,suggestedMounts:f})=>{const p=e.mounts??[];return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(t,{bold:!0,color:"cyan",children:[p.length," ","mounts"]}),s&&i(t,{dimColor:!0,children:["— detected:"," ",r(t,{color:"white",children:s})]})]}),f.length>0&&!n&&i(c,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[i(c,{flexShrink:0,children:[r(t,{bold:!0,color:"yellow",children:"Suggested mounts"}),i(t,{dimColor:!0,children:[" ","— press"," ",r(t,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),f.map((x,v)=>r(c,{flexShrink:0,children:i(t,{dimColor:!0,wrap:"truncate",children:[" + ",Ie(x)]})},`suggestion-${String(v)}`))]}),p.length>0&&r(c,{flexDirection:"column",marginBottom:1,children:p.map((x,v)=>{const w=v===l;return i(c,{flexShrink:0,height:1,children:[r(t,{children:w?">":" "}),r(c,{flexGrow:1,children:i(t,{bold:w,inverse:w,wrap:"truncate",children:[" ",Ie(x)]})})]},`mount-${String(v)}`)})}),!n&&r(c,{flexShrink:0,children:i(t,{color:l===p.length?"cyan":"gray",inverse:l===p.length,children:[" ","+ Add mount..."]})}),n&&i(c,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[r(c,{flexShrink:0,marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"New Mount"})}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="source",color:a==="source"?"cyan":"white",children:[a==="source"?"❯ ":" ","Source:"]})}),r(t,{color:o?"yellow":"gray",children:o||(a==="source"?"_":"(type source, Enter to continue)")})]}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="target",color:a==="target"?"cyan":"white",children:[a==="target"?"❯ ":" ","Target:"]})}),r(t,{color:d?"yellow":"gray",children:d||(a==="target"?"_":"/container/path")})]}),i(c,{flexShrink:0,children:[r(c,{width:12,children:i(t,{bold:a==="type",color:a==="type"?"cyan":"white",children:[a==="type"?"❯ ":" ","Type:"]})}),a==="type"?i(t,{children:[r(t,{bold:g==="volume",color:g==="volume"?"cyan":"gray",children:"[1] volume"})," ",r(t,{bold:g==="bind",color:g==="bind"?"cyan":"gray",children:"[2] bind"})," ",r(t,{bold:g==="tmpfs",color:g==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):r(t,{color:"gray",children:g})]}),r(c,{flexShrink:0,marginTop:1,children:r(t,{dimColor:!0,wrap:"truncate",children:a==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),p.length===0&&!n&&f.length===0&&r(c,{marginTop:1,children:r(t,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},"MountsSection");var st=Object.defineProperty,at=y((n,e)=>st(n,"name",{value:e,configurable:!0}),"s$1");const lt=at(({addingPort:n,addPortValue:e,config:s,fieldIndex:l})=>{const a=s.forwardPorts??[],o=l===a.length;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{marginBottom:1,children:[r(t,{bold:!0,color:"cyan",children:"Forwarded Ports"}),i(t,{dimColor:!0,children:[" ","(",a.length," ","ports)"]})]}),a.map((d,g)=>{const f=g===l;return r(c,{children:i(t,{color:f?"cyan":void 0,inverse:f,children:[" ",String(d)]})},`port-${String(d)}`)}),r(c,{marginTop:a.length>0?1:0,children:i(t,{color:o?"cyan":"gray",inverse:o,children:[" ",o&&n?i(t,{children:["Enter port:"," ",r(t,{color:"yellow",children:e||"_"})]}):"+ Add port..."]})}),r(c,{marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"Enter"})," ",o?"type port number, Enter to confirm":"select"," ",r(t,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"PortsSection");var dt=Object.defineProperty,ut=y((n,e)=>dt(n,"name",{value:e,configurable:!0}),"a");const ht=ut(({focused:n,hadComments:e,jsonPreview:s,mode:l,scrollRef:a})=>i(c,{borderColor:n?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,paddingX:1,children:[r(t,{bold:!0,color:n?"cyan":"white",children:"Preview"}),i(t,{dimColor:!0,children:[" ","(",l==="create"?"new":"edit",")"]})]}),e&&l==="edit"&&r(c,{flexShrink:0,paddingX:1,children:r(t,{color:"yellow",children:"Comments will not be preserved."})}),r(gr,{flexGrow:1,ref:a,scrollbar:!0,scrollbarColor:"gray",children:s.split(`
3
3
  `).map((o,d)=>r(t,{color:"green",children:o},`line-${String(d)}`))})]}),"PreviewPanel");var mt=Object.defineProperty,gt=y((n,e)=>mt(n,"name",{value:e,configurable:!0}),"r");const ft=gt(n=>{const e=[],s=[],l=[];if(!n.image&&!n.build&&!n.dockerComposeFile&&e.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),n.build&&(n.image&&s.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),n.build.dockerfile||e.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),n.dockerComposeFile&&!n.service&&e.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),n.features!==void 0&&(typeof n.features!="object"||Array.isArray(n.features))&&e.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),n.forwardPorts)if(Array.isArray(n.forwardPorts))for(const[a,o]of n.forwardPorts.entries())typeof o=="number"&&(o<1||o>65535)&&e.push({field:"forwardPorts",message:`Invalid port ${String(o)} at index ${String(a)}`});else e.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return n.customizations?.vscode?.extensions&&!Array.isArray(n.customizations.vscode.extensions)&&e.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),n.customizations?.vscode?.settings&&typeof n.customizations.vscode.settings!="object"&&e.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),n.name||l.push({field:"name",message:"Consider adding a name for better identification"}),(!n.features||Object.keys(n.features).length===0)&&l.push({field:"features",message:"Consider adding features for common tools"}),(!n.customizations?.vscode?.extensions||n.customizations.vscode.extensions.length===0)&&l.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),n.privileged&&s.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:e,suggestions:l,valid:e.length===0,warnings:s}},"validateConfig");var pt=Object.defineProperty,$e=y((n,e)=>pt(n,"name",{value:e,configurable:!0}),"$");const Te=80,Pe=15,vt=120,ze=[{description:"Container name, base image, workspace folder, and user",id:"general",label:"General"},{description:"Installable tools and runtimes (Node, Python, Docker, etc.)",id:"features",label:"Features"},{description:"Ports to forward from the container to your host",id:"ports",label:"Ports"},{description:"Commands to run at different stages of the container lifecycle",id:"lifecycle",label:"Lifecycle"},{description:"VS Code extensions to auto-install in the container",id:"extensions",label:"Extensions"},{description:"Environment variables for the container and IDE",id:"environment",label:"Env"},{description:"Volume and bind mounts for persistent data and caches",id:"mounts",label:"Mounts"},{description:"Docker Compose integration for multi-container setups",id:"compose",label:"Compose"}],yt=new Map(ze.map(n=>[n.id,n.description])),bt=$e((n,e,s,l)=>{switch(n){case"compose":return Nr;case"environment":return Gr(e);case"extensions":return ge(l).length;case"features":return me(s).length;case"general":return Me;case"lifecycle":return nt;case"mounts":return(e.mounts?.length??0)+1;case"ports":return(e.forwardPorts?.length??0)+1;default:return 0}},"getFieldCount"),wt=$e(({onSave:n,store:e})=>{const{exit:s}=hr(),{columns:l,rows:a}=mr(),o=er(e.subscribe,e.getSnapshot),[d,g]=C(!1),[f,p]=C(!1),[x,v]=C(!1),[w,k]=C(null),[S,D]=C("editor"),[Y,fe]=C(0),[te,oe]=C(!1),[pe,z]=C(""),[G,R]=C(null),[_,j]=C(""),[ve,O]=C(""),[W,L]=C("key"),[ne,K]=C(!1),[ie,M]=C(""),[ce,B]=C(""),[ye,U]=C("volume"),[I,N]=C("source"),se=Z(null),F=Z(null),P=Z(null),Q=Z(!0);ae(()=>(Q.current=!0,()=>{Q.current=!1,P.current&&clearTimeout(P.current)}),[]);const be=bt(o.section,o.config,o.featureSearch,o.extensionSearch),X=Math.max(1,a-9);ae(()=>{o.section!=="features"&&o.section!=="extensions"||fe(h=>o.fieldIndex>=h+X?o.fieldIndex-X+1:o.fieldIndex<h?o.fieldIndex:h)},[o.fieldIndex,o.section,X]),ae(()=>{fe(0)},[o.section,o.featureSearch,o.extensionSearch]);const Ge=rr(()=>{const h=e.cleanConfig(),m=ft(h);if(!m.valid){const b=m.errors[0];k(b?`Error: ${b.message}`:"Validation failed"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{Q.current&&k(null)},3e3);return}n(h),e.markClean();const u=m.warnings.length;k(u>0?`Saved! (${String(u)} warning${u>1?"s":""})`:"Saved!"),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{Q.current&&k(null)},2e3)},[n,e]);H((h,m)=>{if(m.downArrow||h==="j")e.setTemplateIndex(o.templateIndex+1);else if(m.upArrow||h==="k")e.setTemplateIndex(o.templateIndex-1);else if(m.return){const u=$[o.templateIndex];u&&e.applyTemplate(u.id)}else m.escape&&e.dismissTemplateSelector()},{isActive:o.showTemplateSelector}),H((h,m)=>{if(m.escape){oe(!1),z("");return}if(m.return){const u=Number.parseInt(pe,10);!Number.isNaN(u)&&u>0&&u<=65535&&e.addPort(u),oe(!1),z("");return}if(m.backspace){z(u=>u.slice(0,-1));return}h&&/^\d$/u.test(h)&&z(u=>u+h)},{isActive:te}),H((h,m)=>{if(m.escape){R(null),j(""),O(""),L("key");return}if(m.return){if(W==="key"&&_){L("value");return}if(W==="value"&&_){e.addEnvVar(G,_,ve),R(null),j(""),O(""),L("key");return}}if(m.backspace){W==="key"?j(u=>u.slice(0,-1)):O(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(W==="key"?j(u=>u+h):O(u=>u+h))},{isActive:G!==null}),H((h,m)=>{if(m.escape){K(!1),M(""),B(""),N("source");return}if(m.return){if(I==="source"&&ie){N("target");return}if(I==="target"&&ce){N("type");return}if(I==="type"){e.addMount({source:ie,target:ce,type:ye}),K(!1),M(""),B(""),N("source");return}}if(I==="type"){switch(h){case"1":{U("volume");break}case"2":{U("bind");break}case"3":{U("tmpfs");break}}return}if(m.backspace){I==="source"?M(u=>u.slice(0,-1)):I==="target"&&B(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(I==="source"?M(u=>u+h):I==="target"&&B(u=>u+h))},{isActive:ne}),H((h,m)=>{if(h==="c"&&m.ctrl){s();return}if(!f){if(d){m.escape||h==="?"?g(!1):m.downArrow||h==="j"?se.current?.scrollBy(1):m.upArrow||h==="k"?se.current?.scrollBy(-1):h==="q"&&(g(!1),p(!0));return}if(x){if(m.escape){v(!1),o.section==="features"?e.setFeatureSearch(""):e.setExtensionSearch("");return}if(m.return){v(!1);return}if(m.backspace){o.section==="features"?e.setFeatureSearch(o.featureSearch.slice(0,-1)):e.setExtensionSearch(o.extensionSearch.slice(0,-1));return}if(h&&!m.ctrl&&!m.meta){o.section==="features"?e.setFeatureSearch(o.featureSearch+h):e.setExtensionSearch(o.extensionSearch+h);return}return}if(o.fieldEditing){if(m.escape){e.setFieldEditing(!1);return}if(m.return){e.setFieldEditing(!1);return}return}if(h==="?"){g(!0);return}if(h==="q"){o.isDirty?p(!0):s();return}if(h==="s"){Ge();return}if(m.tab){D(u=>u==="editor"?"preview":"editor");return}if(S==="preview"){if(m.downArrow||h==="j"){F.current?.scrollBy(1);return}if(m.upArrow||h==="k"){F.current?.scrollBy(-1);return}if(m.pageDown){F.current?.scrollBy(10);return}if(m.pageUp){F.current?.scrollBy(-10);return}if(m.home){F.current?.scrollToTop();return}if(m.end){F.current?.scrollToBottom();return}m.escape&&D("editor");return}if(m.downArrow||h==="j"){be>0&&e.setFieldIndex(Math.min(o.fieldIndex+1,be-1));return}if(m.upArrow||h==="k"){e.setFieldIndex(Math.max(o.fieldIndex-1,0));return}if(m.return){switch(o.section){case"compose":case"general":case"lifecycle":{e.setFieldEditing(!0);break}case"environment":{const u=Object.keys(o.config.containerEnv??{}).length,b=u,T=u+1+Object.keys(o.config.remoteEnv??{}).length;o.fieldIndex===b?(R("container"),j(""),O(""),L("key")):o.fieldIndex===T&&(R("remote"),j(""),O(""),L("key"));break}case"mounts":{const u=o.config.mounts??[];o.fieldIndex===u.length&&(K(!0),M(""),B(""),U("volume"),N("source"));break}case"ports":{const u=o.config.forwardPorts??[];o.fieldIndex===u.length&&(oe(!0),z(""));break}}return}if(h===" "){switch(o.section){case"extensions":{const u=ge(o.extensionSearch)[o.fieldIndex];u&&e.toggleExtension(u.id);break}case"features":{const u=me(o.featureSearch)[o.fieldIndex];u&&e.toggleFeature(u.id);break}case"general":{const u=Me-le.length,b=o.fieldIndex-u;if(b>=0&&b<le.length){const T=le[b];e.updateConfig({[T]:!o.config[T]})}break}}return}if(h==="/"){(o.section==="features"||o.section==="extensions")&&v(!0);return}if(h==="A"&&o.section==="mounts"){e.applySuggestedMounts();return}if(h==="a"){if(o.section==="environment"){const u=Object.keys(o.config.containerEnv??{}).length,b=o.fieldIndex<=u?"container":"remote";R(b),j(""),O(""),L("key")}else o.section==="mounts"&&(K(!0),M(""),B(""),U("volume"),N("source"));return}if(h==="d")switch(o.section){case"environment":{const u=Object.keys(o.config.containerEnv??{}),b=Object.keys(o.config.remoteEnv??{});if(o.fieldIndex<u.length)e.removeEnvVar("container",u[o.fieldIndex]),u.length===1||o.fieldIndex>=u.length-1&&e.setFieldIndex(u.length-2);else{const T=o.fieldIndex-u.length-1;T>=0&&T<b.length&&(e.removeEnvVar("remote",b[T]),b.length===1||T>=b.length-1&&e.setFieldIndex(o.fieldIndex-1))}break}case"mounts":{const u=o.config.mounts??[];if(o.fieldIndex<u.length){e.removeMount(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}case"ports":{const u=o.config.forwardPorts??[];if(o.fieldIndex<u.length){e.removePort(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}}}},{isActive:!o.showTemplateSelector&&!te&&G===null&&!ne});const Re=q(()=>e.getJsonPreview(),[o.config]);if(l<Te||a<Pe)return r(c,{alignItems:"center",height:a,justifyContent:"center",width:l,children:i(t,{color:"yellow",children:["Terminal too small (",l,"x",a,"), need"," ",Te,"x",Pe]})});if(o.showTemplateSelector)return r(c,{alignItems:"center",flexDirection:"column",height:a,justifyContent:"center",width:l,children:i(c,{borderColor:"cyan",borderStyle:"round",flexDirection:"column",paddingX:2,paddingY:1,width:60,children:[r(c,{justifyContent:"center",marginBottom:1,children:r(t,{bold:!0,color:"cyan",children:"Select a Template"})}),$.map((h,m)=>{const u=m===o.templateIndex;return r(c,{children:i(t,{color:u?"cyan":void 0,inverse:u,children:[u?" ❯ ":" ",r(t,{bold:u,children:h.name}),i(t,{dimColor:!0,children:[" ","-",h.description]})]})},h.id)}),r(c,{justifyContent:"center",marginTop:1,children:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",r(t,{bold:!0,color:"white",children:"Enter"})," ","select"," ",r(t,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let E;switch(o.section){case"compose":{E=r(Br,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"environment":{E=i(c,{flexDirection:"column",children:[r(zr,{config:o.config,fieldIndex:o.fieldIndex}),G!==null&&r(c,{marginTop:1,paddingX:1,children:i(t,{color:"cyan",children:["Add"," ",G," ","env:"," ",W==="key"?i(t,{children:["key=",r(t,{color:"yellow",children:_||"_"})," ","(Enter to set value)"]}):i(t,{children:[_,"=",r(t,{color:"yellow",children:ve||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{E=r(Wr,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.extensionSearch,viewportHeight:X});break}case"features":{E=r(Vr,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.featureSearch,viewportHeight:X});break}case"general":{E=r(Qr,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"lifecycle":{E=r(ot,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onSetCommand:y((h,m)=>{e.setLifecycleCommand(h,m)},"onSetCommand")});break}case"mounts":{E=r(ct,{addingMount:ne,config:o.config,detectedPm:o.detectedPm,fieldIndex:o.fieldIndex,mountPhase:I,mountSource:ie,mountTarget:ce,mountType:ye,suggestedMounts:o.suggestedMounts});break}case"ports":{E=r(lt,{addingPort:te,addPortValue:pe,config:o.config,fieldIndex:o.fieldIndex});break}default:E=r(t,{children:"Unknown section"})}const _e=i(c,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[i(c,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"q"}),r(t,{dimColor:!0,children:"QUIT"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"?"}),r(t,{dimColor:!0,children:"HELP"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"↑↓"}),r(t,{dimColor:!0,children:"NAV"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"Space"}),r(t,{dimColor:!0,children:"CHECK"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"←→"}),r(t,{dimColor:!0,children:"TABS"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"Tab"}),r(t,{dimColor:!0,children:"PANEL"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"/"}),r(t,{dimColor:!0,children:"FILTER"})]}),i(c,{gap:1,children:[r(t,{bold:!0,color:"white",children:"s"}),r(t,{dimColor:!0,children:"SAVE"})]})]}),i(c,{paddingX:1,children:[w&&i(t,{color:w.startsWith("Error")?"red":"green",children:[w," "]}),o.isDirty&&r(t,{color:"yellow",children:"[modified]"}),!o.isDirty&&!w&&r(t,{dimColor:!0,children:"[saved]"})]})]}),We=i(lr,{footer:i(t,{dimColor:!0,children:[r(t,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(t,{bold:!0,color:"white",children:"?"}),"/",r(t,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:se,title:"KEYBOARD SHORTCUTS",visible:d,width:56,children:[i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"NAVIGATION"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"←→"}),r(t,{dimColor:!0,children:" Switch tabs"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"↑↓"}),"/",r(t,{bold:!0,color:"white",children:"j/k"}),r(t,{dimColor:!0,children:" Navigate within section"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Tab"}),r(t,{dimColor:!0,children:" Switch editor/preview panel"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Enter"}),r(t,{dimColor:!0,children:" Edit selected field"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Esc"}),r(t,{dimColor:!0,children:" Stop editing / cancel"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"Space"}),r(t,{dimColor:!0,children:" Toggle selection"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"/"}),r(t,{dimColor:!0,children:" Search / filter"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"a"}),r(t,{dimColor:!0,children:" Add new entry"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"d"}),r(t,{dimColor:!0,children:" Delete selected entry"})]})]}),i(c,{flexDirection:"column",children:[i(c,{marginBottom:1,children:[r(t,{dimColor:!0,children:"── "}),r(t,{bold:!0,color:"white",children:"ACTIONS"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"s"}),r(t,{dimColor:!0,children:" Save configuration"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"q"}),r(t,{dimColor:!0,children:" Quit"})]}),i(t,{children:[" ",r(t,{bold:!0,color:"white",children:"?"}),r(t,{dimColor:!0,children:" Toggle help"})]})]})]}),Ue=r(ht,{focused:S==="preview",hadComments:o.hadComments,jsonPreview:Re,mode:o.mode,scrollRef:F}),we=l>=vt,Xe=we?Math.floor(l*.38):0;return i(c,{flexDirection:"column",height:a,width:l,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[r(t,{bold:!0,inverse:!0,children:" VIS "}),i(t,{wrap:"truncate",children:[o.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),r(c,{flexShrink:0,paddingX:1,paddingY:1,children:r(ur,{defaultValue:o.section,keyMap:{useNumbers:!1,useTab:!1},onChange:y(h=>{e.setSection(h),D("editor")},"onChange"),showIndex:!1,children:ze.map(({id:h,label:m})=>r(dr,{name:h,children:m},h))})}),r(c,{flexShrink:0,paddingRight:2,children:r(t,{dimColor:!0,wrap:"truncate",children:yt.get(o.section)??""})}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r(c,{borderColor:S==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:E}),we&&r(c,{flexShrink:0,width:Xe,children:Ue})]}),_e,r(Ke,{autoExitSeconds:3,onCancel:y(()=>{p(!1)},"onCancel"),visible:f}),We]})},"VisDevcontainerApp");var xt=Object.defineProperty,De=y((n,e)=>xt(n,"name",{value:e,configurable:!0}),"c");const _t=De(async({logger:n,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const l=s,a=e.template,o=e.output,d=!!process.stdout.isTTY&&!Qe;let g=null;try{g=tr(l).name}catch{}const f=kr(l);let p=f?.config??null;const x=f?.hadComments??!1;if(a&&!f){const S=$.find(D=>D.id===a);if(!S){const D=$.map(Y=>Y.id).join(", ");throw new Error(`Unknown template "${a}". Valid templates: ${D}`)}p=S.config}if(!d){p?n.info(JSON.stringify(p,null,2)):(n.error("No existing devcontainer.json found. Use --template to generate one in non-TTY mode."),process.exitCode=1);return}process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const v=setInterval(()=>{},1e3),w=new jr(p,x,g);a&&!f&&w.dismissTemplateSelector();let k=null;if(await Ye(Ze.createElement(wt,{onSave:De(S=>{Sr(l,S,o),k=S},"onSave"),store:w}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(v),k){const S=o??".devcontainer/devcontainer.json";n.info(`DevContainer config saved to ${S}`)}},"execute");export{_t as default};