/* Socket Lib - Built with esbuild */
var S=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var B=(n,t)=>{for(var i in t)S(n,i,{get:t[i],enumerable:!0})},D=(n,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of $(t))!z.call(n,e)&&e!==i&&S(n,e,{get:()=>t[e],enumerable:!(o=C(t,e))||o.enumerable});return n};var K=n=>D(S({},"__esModule",{value:!0}),n);var j={};B(j,{execNpm:()=>k,execPnpm:()=>h,execScript:()=>W,execYarn:()=>b,isNpmAuditFlag:()=>F,isNpmFundFlag:()=>v,isNpmLoglevelFlag:()=>m,isNpmNodeOptionsFlag:()=>T,isNpmProgressFlag:()=>x,isPnpmFrozenLockfileFlag:()=>N,isPnpmIgnoreScriptsFlag:()=>P,isPnpmInstallCommand:()=>I,isPnpmLoglevelFlag:()=>y});module.exports=K(j);var w=require("#env/ci"),A=require("#constants/platform"),O=require("./bin"),d=require("./debug"),g=require("./fs"),L=require("./objects"),f=require("./spawn");const M=new Set(["--ignore-scripts","--no-ignore-scripts"]),R=new Set(["--frozen-lockfile","--no-frozen-lockfile"]),U=new Set(["install","i"]),Y=new Set(["install","i","add","update","up","remove","rm","link","ln","unlink","import","rebuild","rb"]),H=new Set(["install","add","upgrade","remove","link","unlink","import"]);function k(n,t){const i=(0,d.isDebug)(),o=n.indexOf("--"),e=(o===-1?n:n.slice(0,o)).filter(s=>!F(s)&&!v(s)&&!x(s)),p=o===-1?[]:n.slice(o),r=i||e.some(m)?[]:["--loglevel","warn"],l=require("#constants/agents").NPM_BIN_PATH;return(0,f.spawn)(l,["--no-audit","--no-fund","--no-progress",...r,...e,...p],{__proto__:null,shell:A.WIN32,...t})}function h(n,t){const{allowLockfileUpdate:i,...o}={__proto__:null,...t},e=(0,d.isDebug)(),p=n.indexOf("--"),r=(p===-1?n:n.slice(0,p)).filter(q=>!x(q)),l=p===-1?[]:n.slice(p),s=r[0],c=s?Y.has(s):!1,u=e||r.some(y)?[]:["--loglevel","warn"],a=r.some(P),E=!c||a?[]:["--ignore-scripts"],_=[];return(0,w.getCI)()&&i&&s&&I(s)&&!r.some(N)&&_.push("--no-frozen-lockfile"),(0,O.execBin)("pnpm",[...u,...E,..._,...r,...l],o)}function b(n,t){const i=(0,d.isDebug)(),o=n.indexOf("--"),e=(o===-1?n:n.slice(0,o)).filter(a=>!x(a)),p=o===-1?[]:n.slice(o),r=e[0],l=r?H.has(r):!1,s=i||e.some(m)?[]:["--silent"],c=e.some(P),u=!l||c?[]:["--ignore-scripts"];return(0,O.execBin)("yarn",[...s,...u,...e,...p],{__proto__:null,...t})}function F(n){return/^--(no-)?audit(=.*)?$/.test(n)}function v(n){return/^--(no-)?fund(=.*)?$/.test(n)}function m(n){return/^--loglevel(=.*)?$/.test(n)||/^--(silent|verbose|info|warn|error|quiet)$/.test(n)?!0:/^-(s|q|d|dd|ddd|v)$/.test(n)}function T(n){return/^--node-options(=.*)?$/.test(n)}function x(n){return/^--(no-)?progress(=.*)?$/.test(n)}function P(n){return M.has(n)}function N(n){return R.has(n)}function I(n){return U.has(n)}const y=m;function W(n,t,i){let o,e;!Array.isArray(t)&&t!==null&&typeof t=="object"?(o=t,e=[]):(o=i,e=t||[]);const{prepost:p,...r}={__proto__:null,...o};if(r.shell===!0)return(0,f.spawn)(n,e,r);const l=!p&&require("#constants/node").supportsNodeRun(),s=(0,L.getOwn)(r,"cwd")??process.cwd();return(0,g.findUpSync)(require("#constants/agents").PNPM_LOCK_YAML,{cwd:s})?h(["run",n,...e],r):(0,g.findUpSync)(require("#constants/agents").PACKAGE_LOCK_JSON,{cwd:s})?k(["run",n,...e],r):(0,g.findUpSync)(require("#constants/agents").YARN_LOCK,{cwd:s})?b(["run",n,...e],r):(0,f.spawn)(require("#constants/node").getExecPath(),[...require("#constants/node").getNodeNoWarningsFlags(),...l?["--run"]:[require("#constants/agents").NPM_REAL_EXEC_PATH,"run"],n,...e],{...r})}0&&(module.exports={execNpm,execPnpm,execScript,execYarn,isNpmAuditFlag,isNpmFundFlag,isNpmLoglevelFlag,isNpmNodeOptionsFlag,isNpmProgressFlag,isPnpmFrozenLockfileFlag,isPnpmIgnoreScriptsFlag,isPnpmInstallCommand,isPnpmLoglevelFlag});
//# sourceMappingURL=agent.js.map
