var a=Object.defineProperty;var s=(n,e)=>a(n,"name",{value:e,configurable:!0});import{createRequire as f}from"node:module";import{m as v}from"../packem_shared/index-Dc3ht2bL.js";const d=f(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=s(n=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,r]=t.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return t.getBuiltinModule(n)}return d(n)},"__cjs_getBuiltinModule"),{execSync:p,spawnSync:m}=l("node:child_process");var g=Object.defineProperty,y=s((n,e)=>g(n,"name",{value:e,configurable:!0}),"r");const w=y(async({argument:n,logger:e,options:r})=>{const c=n?.[0];e.info("info: checking for updates...");const o=v.version;let i;try{const u=p("npm view @visulima/vis version",{encoding:"utf8"}).trim();i=c??u}catch{throw new Error("Failed to query npm registry. Check your network connection.")}if(o===i&&!r.force){e.info(`
✓ Already up to date (${o})`);return}if(r.check){o===i?e.info(`✓ Already up to date (${o})`):e.info(`info: found @visulima/vis@${i} (current: ${o})`);return}if(e.info(`info: found @visulima/vis@${i} (current: ${o})`),e.info("info: installing..."),m("npm",["install","-g",`@visulima/vis@${i}`],{encoding:"utf8",stdio:"inherit"}).status!==0)throw new Error("Failed to update. Try running with sudo or fix npm permissions.");e.info(`
✓ Updated @visulima/vis from ${o} → ${i}`)},"execute");export{w as default};
