@visulima/vis 2.0.1 → 2.0.2
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.
- package/CHANGELOG.md +28 -0
- package/LICENSE.md +862 -170
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +3 -3
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +68 -68
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +145 -143
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +3 -3
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +3 -3
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +3 -3
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler51.js +2 -2
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +4 -4
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +2 -2
- package/dist/packem_chunks/handler61.js +13 -13
- package/dist/packem_chunks/handler62.js +3 -3
- package/dist/packem_chunks/handler63.js +2 -2
- package/dist/packem_chunks/handler64.js +4 -4
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +16 -16
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +15 -15
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +5 -5
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +23 -23
- package/dist/packem_chunks/handler73.js +5 -5
- package/dist/packem_chunks/handler74.js +22 -22
- package/dist/packem_chunks/handler75.js +2 -2
- package/dist/packem_chunks/handler76.js +5 -5
- package/dist/packem_chunks/handler77.js +18 -18
- package/dist/packem_chunks/handler78.js +25 -25
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +2 -2
- package/dist/packem_chunks/heal.js +4 -4
- package/dist/packem_chunks/help-command.js +46 -46
- package/dist/packem_chunks/index3.js +3 -3
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +2 -2
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +6 -6
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{advisories-BGeuHJQg.js → advisories-CCBGdU8U.js} +1 -1
- package/dist/packem_shared/{affected-selection-B85ND6JV.js → affected-selection-Dj-ymxhw.js} +1 -1
- package/dist/packem_shared/{affected-shas-BWRRAB47.js → affected-shas-PwkVbPch.js} +1 -1
- package/dist/packem_shared/ai-analysis-bGCAc1jR.js +68 -0
- package/dist/packem_shared/{ai-fix-BgBU0TOz.js → ai-fix-DV5-dHBY.js} +4 -4
- package/dist/packem_shared/{augment-HVeX6LpU.js → augment-24KX2nkI.js} +1 -1
- package/dist/packem_shared/{bin-DKod8Iqo.js → bin-CtzhnYMp.js} +1 -1
- package/dist/packem_shared/{build-scripts-CM8M1xcG.js → build-scripts-w4SNeR7D.js} +1 -1
- package/dist/packem_shared/{command-runtime-BVi4lL8k.js → command-runtime-BLFPUYAT.js} +1 -1
- package/dist/packem_shared/{cyclonedx-y7VLI-1d.js → cyclonedx-C4KaVTn1.js} +3 -3
- package/dist/packem_shared/{dependency-scan-BAzKpXdW.js → dependency-scan-D_ona0Qm.js} +1 -1
- package/dist/packem_shared/{docker-D1LStSlH.js → docker-DaVs-9wK.js} +27 -27
- package/dist/packem_shared/{en-BxrK-n-J.js → en-D3CfXlO7.js} +13 -13
- package/dist/packem_shared/{failure-log-ChuFC-8f.js → failure-log-CTneNcio.js} +2 -2
- package/dist/packem_shared/glob-BUjyjdE8-C4M8e02u.js +1 -0
- package/dist/packem_shared/index-CTMU29dI.js +1 -0
- package/dist/packem_shared/index-uBVnF4ji.js +35 -0
- package/dist/packem_shared/index.server-CusjRLCh.js +2 -0
- package/dist/packem_shared/{lifecycle-Db0qh6vR.js → lifecycle-B8A2T3gx.js} +1 -1
- package/dist/packem_shared/{lockfile-CDQ0n4P5.js → lockfile-Bccery3L.js} +1 -1
- package/dist/packem_shared/{manifests-Da_no4ZH.js → manifests-BDkwiVbh.js} +1 -1
- package/dist/packem_shared/{min-release-age-V6L6dpiP.js → min-release-age-OaYpLwux.js} +1 -1
- package/dist/packem_shared/missing-package-json-BqS-OnKd.js +1 -0
- package/dist/packem_shared/{native-config-sync-C0pUePad.js → native-config-sync-Ds1FtcrM.js} +3 -3
- package/dist/packem_shared/{osv-bloom-DNFpvSSO.js → osv-bloom-pKp7urSB.js} +2 -2
- package/dist/packem_shared/package-version-C47v64aB.js +4 -0
- package/dist/packem_shared/packument-HBVbyf7x.js +1 -0
- package/dist/packem_shared/pm-runner-C6eTANt1.js +1 -0
- package/dist/packem_shared/{project-name-filter-u2Q7YpQH.js → project-name-filter-CJ3XX2TI.js} +1 -1
- package/dist/packem_shared/{provenance-9OT8sTqn.js → provenance-D4Cza8cp.js} +1 -1
- package/dist/packem_shared/{readJsonSync-BnWiH5-R-BpnwAB0Z.js → readJsonSync-DweZd5ZA-0eZh9sGm.js} +1 -1
- package/dist/packem_shared/{registry-keys-CYHd7qU2.js → registry-keys-C0ez2VND.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-DC3XssJa.js → resolve-explicit-BbT764KS.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-f5l4ODsH.js → resolve-runtime-D_vZovbB.js} +1 -1
- package/dist/packem_shared/{run-file-zB4ACnUy.js → run-file-DyPFFN9U.js} +1 -1
- package/dist/packem_shared/{runtime-check-CWvAfu5u.js → runtime-check-D4um-yQq.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DsmC71xt.js → s1ngularity-St6dhKiq.js} +1 -1
- package/dist/packem_shared/scan-progress-q-N2JtIp.js +2 -0
- package/dist/packem_shared/{selectors-CtxnIT4X.js → selectors-Ce_6UAoY.js} +1 -1
- package/dist/packem_shared/{signatures-Dwx5fD4g.js → signatures-Dyeyg1q9.js} +1 -1
- package/dist/packem_shared/target-merge-Cfy7c__2.js +11 -0
- package/dist/packem_shared/{target-options-BO4Uxt0k.js → target-options-7XcbqGDe.js} +1 -1
- package/dist/packem_shared/{toolchain-BY8lJaSN.js → toolchain-C_pNMBM6.js} +1 -1
- package/dist/packem_shared/{typosquats-BUGgotNu.js → typosquats-xzcAGPiM.js} +1 -1
- package/dist/packem_shared/{use-measured-height-BLZt9dW2.js → use-measured-height-CBjN0fle.js} +1 -1
- package/dist/packem_shared/{verify-B0ztxKMa.js → verify-Dve9PQj3.js} +1 -1
- package/dist/packem_shared/vis-update-app-DMAC2pPf.js +1 -0
- package/dist/packem_shared/vis-user-error-xmha3L4n.js +30 -0
- package/dist/packem_shared/{watch-CGrUW_JD.js → watch-BXOOX7lx.js} +1 -1
- package/dist/packem_shared/{watch-loop-DIwSMjlA.js → watch-loop-Q7UpkVbr.js} +4 -4
- package/dist/runtime/preload.js +1 -1
- package/index.js +52 -52
- package/package.json +16 -16
- package/dist/packem_shared/ai-analysis-oNMAj1wd.js +0 -68
- package/dist/packem_shared/glob-BUjyjdE8-BSrdzgma.js +0 -1
- package/dist/packem_shared/index-BJw7gKD1.js +0 -1
- package/dist/packem_shared/index-DND6ptxQ.js +0 -35
- package/dist/packem_shared/index.server-qvZ-cy29.js +0 -2
- package/dist/packem_shared/missing-package-json-Jw8IEHct.js +0 -1
- package/dist/packem_shared/package-version-DjHDww_5.js +0 -4
- package/dist/packem_shared/packument-N3EWbZpL.js +0 -1
- package/dist/packem_shared/pm-runner-Bssje5qH.js +0 -1
- package/dist/packem_shared/scan-progress-Ch8s3Uwl.js +0 -2
- package/dist/packem_shared/target-merge-b7bE1AEx.js +0 -11
- package/dist/packem_shared/vis-update-app-D1gLJB1O.js +0 -1
- package/dist/packem_shared/vis-user-error-DjFv8uxy.js +0 -28
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as N}from"node:module";import{l as j,m as v,H as R,j as S,z as J}from"./index-DND6ptxQ.js";import{withEnhancedPath as H,collectNodeModulesBinDirs as F}from"@visulima/task-runner";import{s as $}from"./index-BAe6e0XE.js";import{resolveDlx as V,whichBin as Y,detectPackageManager as G,execPmCommandInteractive as K,resolveAdd as Q,resolveRemove as X,resolveDedupe as Z,resolveWhy as ee,resolveLink as ne,resolveUnlink as se,resolvePmCommand as re,resolveInstall as ae,resolveExec as oe}from"#native";let T;const q=e=>(T??=N(import.meta.url))(e),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[n,s]=b.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return b.getBuiltinModule(e)}return q(e)},{spawn:z,spawnSync:E}=B("node:child_process"),h=(e,n,s,r)=>{for(const a of n)e.push("--filter",a);s&&e.push("--recursive"),r&&e.push("--workspace-root")},ie=e=>{const n=[],s=[];return h(n,e.filter,e.recursive,e.workspaceRoot),e.silent&&n.push("--silent"),e.frozenLockfile&&n.push("--frozen-lockfile"),n.push("install"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.force&&n.push("--force"),e.ignoreScripts&&n.push("--ignore-scripts"),e.lockfileOnly&&n.push("--lockfile-only"),e.noOptional&&n.push("--no-optional"),e.offline&&n.push("--offline"),{args:n,bin:"aube",warnings:s}},te=e=>{const n=[],s=[];return h(n,e.filter,!1,!1),n.push("add"),e.saveDev&&n.push("--save-dev"),e.exact&&n.push("--save-exact"),e.global&&n.push("--global"),e.optional&&n.push("--save-optional"),e.peer&&n.push("--save-peer"),e.workspace&&s.push("aube has no flag for the `workspace:` protocol; it auto-detects local workspace members during add. Ignoring --workspace."),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:s}},pe=e=>{const n=[];return h(n,e.filter,e.recursive,!1),n.push("remove"),e.saveDev&&n.push("--save-dev"),e.global&&n.push("--global"),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:[]}},ue=e=>{const n=["dedupe"];return e&&n.push("--check"),{args:n,bin:"aube",warnings:[]}},ce=e=>{const n=[],s=[];h(n,e.filter,e.recursive,!1),n.push("why"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.json&&n.push("--json"),e.long&&n.push("--long"),e.parseable&&n.push("--parseable"),e.depth!==void 0&&s.push("aube why does not accept --depth; ignoring."),e.noOptional&&s.push("aube why does not accept --no-optional; ignoring."),e.global&&s.push("aube why does not accept --global; ignoring.");const[r,...a]=e.packages;return r===void 0?s.push("aube why requires a package name; none provided."):(a.length>0&&s.push("aube why takes a single package; using the first."),n.push(r)),{args:n,bin:"aube",warnings:s}},le=e=>{const n=[];e.silent&&n.push("--silent"),n.push("dlx");for(const s of e.additionalPackages)n.push("--package",s);return e.shellMode&&n.push("--shell-mode"),n.push(e.package),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},ge=e=>{const n=[];return h(n,e.filter,e.recursive,e.workspaceRoot),n.push("exec"),e.parallel&&n.push("--parallel"),e.reverse&&n.push("--reverse"),e.shellMode&&n.push("--shell-mode"),n.push(e.command),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},de=e=>{const n=["link"];return e!==null&&n.push(e),{args:n,bin:"aube",warnings:[]}},he=(e,n)=>{const s=[],r=[];return n&&s.push("--recursive"),s.push("unlink"),e.length>1&&r.push("aube unlink takes a single package; using the first."),e.length>0&&s.push(e[0]),{args:s,bin:"aube",warnings:r}},fe=e=>{const n=["view","--",e.package],s=[],[r,...a]=e.fields;return r!==void 0?(a.length>0&&s.push("aube view only supports a single field; using the first."),e.json&&s.push("aube view does not support --json with a field selector; printing the field without --json."),n.push(r)):e.json&&n.push("--json"),{args:n,bin:"aube",warnings:s}},Je=e=>{const n=[],s=[];return h(n,e.filters,e.recursive,e.workspaceRoot),n.push("update"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.global&&n.push("--global"),e.interactive&&n.push("--interactive"),e.latest&&n.push("--latest"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"aube",warnings:s}},me=new Set(["fund","ping","search","token"]),be=(e,n)=>me.has(e)?{args:[e,...n],bin:"npm",warnings:[`'${e}' is not natively supported by aube. Delegating to npm.`]}:{args:[e,...n],bin:"aube",warnings:[]},k=256*1024,ke=e=>{const n=e?{...process.env,...e}:{...process.env};return process.stderr.isTTY&&n.FORCE_COLOR===void 0&&n.NO_COLOR===void 0&&(n.FORCE_COLOR="1"),n},W=e=>e!==""&&!/[\s"&()<>^|%!]/u.test(e)?e:`"${e.replaceAll(/(\\*)"/gu,String.raw`$1$1\"`).replace(/(\\+)$/u,"$1$1").replaceAll(/[&()<>^|%!]/gu,String.raw`^$&`)}"`,we=async(e,n,s)=>new Promise((r,a)=>{const o=process.platform==="win32",i=z(o?W(e):e,o?n.map(t=>W(t)):[...n],{cwd:s.cwd,env:ke(s.env),shell:o,stdio:["inherit","pipe","pipe"],windowsHide:!0});let u=[],l=0;const g=t=>{if(u.push(t),l+=t.length,!(l<=k)){for(;u.length>1&&l-u[0].length>k;)l-=u.shift().length;if(u.length===1&&l>k){const d=u[0];u[0]=d.subarray(d.length-k),l=k}}},m=()=>Buffer.concat(u).toString("utf8");i.stdout?.on("data",t=>{process.stdout.write(t),g(t)}),i.stderr?.on("data",t=>{process.stderr.write(t),g(t)}),i.on("error",a),i.on("close",t=>{const d=m();u=[],r({code:t??1,output:d})})}),w=e=>{const n=$.coerce(e);return n?$.gte(n,"11.0.0"):!1},c=e=>e.name==="yarn"&&!e.version.startsWith("1."),x=e=>e.name==="yarn"&&e.version.startsWith("1."),ve=e=>e[0]==="rm"?["remove",...e.slice(1)]:e,ye=(e,n,s)=>{switch(n){case"audit":return c(e)?{args:["npm","audit",...s],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"config":{if(c(e)){const[r,...a]=s;return r==="delete"?{args:["config","unset",...a],bin:"yarn",kind:"rewrite",warning:"yarn berry uses `config unset`, not `config delete`."}:{kind:"passthrough"}}return e.name==="bun"?{kind:"skip",warning:"bun has no `config` CLI. Edit bunfig.toml or .npmrc directly."}:e.name==="deno"?{kind:"skip",warning:"deno has no registry-config CLI. Edit deno.json directly."}:{kind:"passthrough"}}case"dist-tag":return x(e)?{args:["tag",...s],bin:"yarn",kind:"rewrite",warning:"yarn 1 has no `dist-tag`; using `yarn tag`."}:c(e)?{args:["npm","tag",...ve(s)],bin:"yarn",kind:"rewrite"}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`dist-tag\`. Use \`npm dist-tag\` instead.`}:{kind:"passthrough"};case"login":case"logout":return c(e)?{args:["npm",n,...s],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:[n,...s],bin:"npm",kind:"rewrite",warning:`bun has no \`${n}\`; falling back to \`npm ${n}\` (writes ~/.npmrc, which bun reads).`}:e.name==="deno"?{kind:"skip",warning:`deno has no \`${n}\`. JSR uses browser OAuth via \`deno publish\`.`}:{kind:"passthrough"};case"owner":return e.name==="pnpm"&&w(e.version)?{args:["owner",...s],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `owner`; falling back to `npm owner`."}:c(e)?{args:["owner",...s],bin:"npm",kind:"rewrite",warning:"yarn berry has no `owner` (not in `yarn npm`); falling back to `npm owner`."}:e.name==="bun"?{args:["owner",...s],bin:"npm",kind:"rewrite",warning:"bun has no `owner`; falling back to `npm owner`."}:e.name==="deno"?{kind:"skip",warning:"deno has no `owner`. JSR uses scope-member roles via the web UI."}:{kind:"passthrough"};case"ping":return e.name==="pnpm"&&w(e.version)?{args:["ping",...s],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `ping`; falling back to `npm ping`."}:{kind:"passthrough"};case"plugin":return c(e)?{kind:"passthrough"}:{kind:"skip",warning:`${e.name} does not support yarn-style plugins. Skipping (no-op).`};case"prune":return x(e)?{kind:"skip",warning:"yarn 1 has no `prune`. Use `yarn install --production` for a prod-only tree."}:c(e)?{kind:"skip",warning:"yarn berry has no `prune`. Use `yarn workspaces focus --production` instead."}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`prune\`. Pruning happens automatically on install.`}:{kind:"passthrough"};case"publish":return c(e)?{args:["npm","publish",...s],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"rebuild":return x(e)?{kind:"skip",warning:"yarn 1 has no `rebuild`. Re-install instead."}:e.name==="bun"?{kind:"skip",warning:"bun has no `rebuild`. Use `bun install --force` instead."}:e.name==="deno"?{kind:"skip",warning:"deno has no `rebuild`."}:{kind:"passthrough"};case"search":return e.name==="pnpm"&&w(e.version)?{args:["search",...s],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `search`; falling back to `npm search`."}:{kind:"passthrough"};case"token":return e.name==="pnpm"&&w(e.version)?{args:["token",...s],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `token`; falling back to `npm token`."}:{kind:"passthrough"};case"whoami":return e.name==="pnpm"&&w(e.version)?{args:["whoami",...s],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `whoami`; falling back to `npm whoami`."}:c(e)?{args:["npm","whoami",...s],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:["pm","whoami",...s],bin:"bun",kind:"rewrite"}:e.name==="deno"?{kind:"skip",warning:"deno has no `whoami`. JSR uses browser auth."}:{kind:"passthrough"};default:return{kind:"passthrough"}}},O=e=>Y(e)!==null,$e=e=>{const n=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"],["bun.lock","bun"],["bun.lockb","bun"],["deno.lock","deno"]];let s=e;for(;;){for(const[a,o]of n)if(j(v(s,a)))return o;const r=R(s);if(r===s||S(s).root===s)return;s=r}},He=(e,n)=>{if(n.name!=="aube")return;const s=$e(e);if(s!==void 0)return`Resolved installer is aube but the workspace has a ${s} lockfile. Aube reads and writes ${s}'s lockfile format in place, but its byte output may differ subtly — expect a one-time churn diff on the first install, and ongoing drift if your team mixes tools on the same lockfile. To pin the choice across the team, set \`install.backend\` in vis.config; to bypass aube for this run, pass --no-aube.`},_=e=>{if(j(e))try{return JSON.parse(J(e,{buffer:!1}))}catch{return}},je=e=>{let n=e;for(;;){const s=v(n,"package.json"),r=_(s);if(r&&typeof r.packageManager=="string"&&r.packageManager.length>0)return r.packageManager;const a=R(n);if(a===n||S(n).root===n)return;n=a}},P=new Set(["npm","pnpm","yarn"]),M=(e,n,s)=>s===!1||!P.has(n)||!O("corepack")?!1:s===!0?!0:je(e)!==void 0,Fe=(e,n)=>{const s=n.backend,r=process.env.VIS_INSTALLER,a=s??r??n.configBackend,o=n.configCorepack??"auto";if(a&&a!=="auto"){if(a==="aube"&&!O("aube"))throw new Error('install.backend is set to "aube" but the `aube` binary is not on PATH. Install it via `npm i -g @endevco/aube`, `mise use -g aube`, or `brew install endevco/tap/aube`.');return{name:a,useCorepack:M(e,a,o),version:"latest"}}if(O("aube"))return{name:"aube",useCorepack:!1,version:"latest"};const i=xe(e);return{...i,useCorepack:M(e,i.name,o)}},xe=e=>{if(!j(e))throw new Error(`Could not detect package manager in ${e}. Directory does not exist.`);const n=G(e);return{name:n.name,version:n.version||"latest"}},L=(e,n)=>n.useCorepack!==!0||!P.has(n.name)||e.bin==="corepack"||e.bin!==n.name?e:{...e,args:[n.name,...e.args],bin:"corepack"},Oe=(e,n,s)=>{if(s===void 0)return K(e.bin,e.args,n);const r=E(e.bin,e.args,{cwd:n,env:{...process.env,...s},stdio:"inherit"});if(r.error)throw r.error;return r.status??1},p=(e,n,s,r,a={})=>{const o=L(n,e);for(const i of o.warnings)r.warn(`warning: ${i}`);return a.dry?(r.log(`[dry-run] ${o.bin} ${o.args.join(" ")}`),0):Oe(o,s,a.env)},f=(e,n,s,r,a={})=>p(e,n(),s,r,a),Re=(e,n)=>n==="aube"||n==="deno"?e:{...e,args:[...e.args,"--prefer-offline"]},Se=(e,n,s)=>n!=="yarn"||s.startsWith("1.")||!e.args.includes("--immutable")||e.args.includes("--immutable-cache")?e:{...e,args:[...e.args,"--immutable-cache"]},I=(e,n,s)=>{let r=e.name==="aube"?ie(n):ae(e.name,e.version,{...n,silent:n.silent||s.silent===!0});return s.preferOffline&&(r=Re(r,e.name)),s.ciMode&&(r=Se(r,e.name,e.version)),r},Ve=(e,n,s,r,a={})=>{const o=I(e,n,a);return C(e,o,s,r,{dry:a.dry,env:a.env})},Ye=async(e,n,s,r,a={})=>{const o=L(I(e,n,a),e);for(const i of o.warnings)r.warn(`warning: ${i}`);return a.dry?(r.log(`[dry-run] ${o.bin} ${o.args.join(" ")}`),{code:0,output:""}):we(o.bin,o.args,{cwd:s,env:a.env?{...process.env,...a.env}:process.env})},A=(e,n)=>{const s=n==="deno"?"--quiet":"--silent";return{...e,args:[...e.args,s]}},_e=(e,n)=>n==="yarn"||n==="aube"?null:{...e,args:[...e.args,"--dry-run"]},C=(e,n,s,r,a)=>{if(a.dry!==!0)return p(e,n,s,r,a);const o=_e(n,e.name);return o===null?p(e,n,s,r,a):p(e,o,s,r,{env:a.env})},Ce=(e,n)=>n==="aube"?{...e,args:[...e.args,"--ignore-scripts"]}:n==="deno"?e:{...e,args:[...e.args,"--ignore-scripts"]},De=(e,n,s,r,a={})=>{let o=e.name==="aube"?te(n):Q(e.name,e.version,n);a.ignoreScripts&&(o=Ce(o,e.name)),a.silent&&(o=A(o,e.name));const i=C(e,o,s,r,{dry:a.dry,env:a.env});return i===0&&a.autoInstallPeers&&Pe(e,n,s,r,a),i},We=e=>{if(e.startsWith("@")){const s=e.indexOf("/");if(s===-1)return e;const r=e.indexOf("@",s);return r===-1?e:e.slice(0,r)}const n=e.indexOf("@");return n===-1?e:e.slice(0,n)},Me=(e,n)=>{let s=e;for(;;){const r=v(s,"node_modules",n,"package.json"),a=_(r);if(a)return a;const o=R(s);if(o===s||S(s).root===s)return;s=o}},Ee=e=>{const n=_(v(e,"package.json")),s=new Set;if(!n)return s;for(const r of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const a=n[r];if(a)for(const o of Object.keys(a))s.add(o)}return s},Pe=(e,n,s,r,a)=>{if(e.name==="deno")return;const o=Ee(s),i=new Map;for(const g of n.packages){const m=We(g),t=Me(s,m);if(!t?.peerDependencies)continue;const d=t.peerDependenciesMeta??{};for(const[y,U]of Object.entries(t.peerDependencies))d[y]?.optional||o.has(y)||i.has(y)||i.set(y,U)}if(i.size===0)return;const u=[...i.entries()].map(([g,m])=>`${g}@${m}`);r.log(`auto-installing peer dependencies: ${u.join(", ")}`);const l={exact:!1,filter:n.filter,global:!1,optional:!1,packages:u,peer:!1,saveDev:n.saveDev,workspace:!1,workspaceRoot:n.workspaceRoot};De(e,l,s,r,{ignoreScripts:a.ignoreScripts})},Ge=(e,n,s,r,a={})=>{let o=e.name==="aube"?pe(n):X(e.name,e.version,n);return a.silent&&(o=A(o,e.name)),C(e,o,s,r,{dry:a.dry,env:a.env})},Ke=(e,n,s,r,a={})=>e.name==="aube"?p(e,ue(n),s,r,a):f(e,()=>Z(e.name,e.version,n),s,r,a),Qe=(e,n,s,r,a={})=>e.name==="aube"?p(e,ce(n),s,r,a):f(e,()=>ee(e.name,e.version,n),s,r,a),Le=(e,n)=>{if(e.name==="aube")return fe(n);const s=[],r=[],a=e.name;switch(e.name){case"bun":{const o=$.coerce(e.version);o&&$.lt(o,"1.3.0")&&r.push(`bun ${e.version} does not support \`bun pm view\` (added in bun 1.3). Upgrade bun, or run \`npm view ${n.package}\` instead.`),s.push("pm","view","--",n.package,...n.fields),n.json&&s.push("--json");break}case"deno":{const o=n.package.startsWith("npm:")||n.package.startsWith("jsr:")||n.package.startsWith("https://")||n.package.startsWith("http://")||n.package.startsWith("file:")?n.package:`npm:${n.package}`;s.push("info","--",o),n.json&&s.push("--json"),n.fields.length>0&&r.push("deno info does not accept field selectors; ignoring.");break}case"npm":case"pnpm":{s.push("view","--",n.package,...n.fields),n.json&&s.push("--json");break}case"yarn":{if(e.version.startsWith("1.")){s.push("info","--",n.package);const[o,...i]=n.fields;o!==void 0&&(i.length>0&&r.push("yarn v1 only supports querying one field at a time; using the first."),s.push(o)),n.json&&s.push("--json")}else s.push("npm","info","--",n.package),n.fields.length>0&&r.push("yarn berry does not support field arguments to 'npm info'; ignoring."),n.json&&s.push("--json");break}default:{const o=e.name;throw new Error(`Unsupported package manager: ${o}`)}}return{args:s,bin:a,warnings:r}},Xe=(e,n,s,r,a={})=>p(e,Le(e,n),s,r,a),Ze=(e,n,s,r,a={})=>e.name==="aube"?p(e,de(n),s,r,a):f(e,()=>ne(e.name,e.version,n),s,r,a),en=(e,n,s,r,a,o={})=>e.name==="aube"?p(e,he(n,s),r,a,o):f(e,()=>se(e.name,e.version,n,s),r,a,o),Ie=(e,n,s)=>{if(e.args.includes("--offline")||e.args.includes("--cached-only"))return e;const r=(a,o)=>{const i=[...e.args];return i.splice(o,0,a),{...e,args:i}};switch(n){case"aube":case"pnpm":return r("--offline",1);case"bun":return{...e,warnings:[...e.warnings,"bun x does not support --offline. Pre-install the package via `vis install` so bun x resolves from the local cache."]};case"deno":return r("--cached-only",1);case"npm":return r("--offline",1);case"yarn":return s.startsWith("1.")?r("--offline",0):{...e,warnings:[...e.warnings,"yarn berry has no --offline flag for dlx. Configure `enableNetwork: false` in .yarnrc.yml or set `enableMirror: true` for offline-first behavior."]};default:{const a=n;return{...e,warnings:[...e.warnings,`applyDlxOffline: unsupported pm ${String(a)}`]}}}},nn=(e,n,s,r,a={})=>{let o=e.name==="aube"?le(n):V(e.name,e.version,n);return a.offline&&(o=Ie(o,e.name,e.version)),p(e,o,s,r,{dry:a.dry,env:a.env})},D=process.platform==="win32",Ae=D?[".exe",".cmd",".bat",".ps1",""]:[""],Ue=(e,n)=>{if(!(e.includes("/")||e.includes("\\")))for(const s of F(n))for(const r of Ae){const a=v(s,`${e}${r}`);if(j(a))return D?a.replaceAll("/","\\"):a}},sn=(e,n,s)=>{const r=Ue(e,s);if(r===void 0||D&&!r.toLowerCase().endsWith(".exe"))return null;const a=E(r,n,{cwd:s,env:H({...process.env},s),stdio:"inherit"});if(a.error)throw a.error;return a.status??1},rn=(e,n,s,r,a={})=>e.name==="aube"?p(e,ge(n),s,r,a):f(e,()=>oe(e.name,e.version,n),s,r,a),an=(e,n,s,r,a,o={})=>{if(e.name==="aube")return p(e,be(n,s),r,a,o);const i=ye(e,n,s);return i.kind==="skip"?(a.warn(`warning: ${i.warning}`),0):i.kind==="rewrite"?p(e,{args:i.args,bin:i.bin,warnings:i.warning?[i.warning]:[]},r,a,o):f(e,()=>re(e.name,e.version,n,s),r,a,o)};export{en as $,xe as A,Ye as C,Ge as E,He as I,sn as L,Ke as M,rn as N,Qe as P,Ze as S,an as U,nn as W,Xe as a,Fe as h,De as j,we as s,Je as v,Ve as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{E as x,s as k,I as y,V as S}from"./index.server-qvZ-cy29.js";import{j as e,l as c,e as i,d as $,a as g}from"../packem_chunks/catalog.js";import"./en-BxrK-n-J.js";import{I as C}from"./index-BWl4DbMp.js";import{S as m}from"../packem_chunks/cli-main.js";import{Spinner as T}from"@visulima/tui-kit/spinner";import{D as j,W as I,T as E,C as R}from"./symbols-DPTlrJ3B.js";const w=({rows:a})=>e.jsx(c,{flexDirection:"column",children:a.map(t=>{let r;switch(t.status){case"error":{r=e.jsx(i,{color:"red",children:R});break}case"ok":{r=e.jsx(i,{color:"green",children:E});break}case"running":{r=e.jsx(i,{color:"white",children:e.jsx(T,{type:"dots"})});break}case"warn":{r=e.jsx(i,{color:"yellow",children:I});break}default:{r=e.jsx(i,{dimColor:!0,children:j});break}}return e.jsxs(c,{children:[e.jsx(c,{width:3,children:r}),e.jsx(c,{flexGrow:1,children:e.jsx(i,{children:t.label})}),t.summary?e.jsx(c,{children:e.jsxs(i,{dimColor:!0,children:[j," ",t.summary]})}):null]},t.id)})}),v={error:S(m.failure),ok:y(m.success),pending:x(m.dash),skip:x(m.dash),warn:k(m.warning)},D=(a,t,r)=>{const h=r?`${a} ${x(`— ${r}`)}`:a;return` ${v[t]} ${h}
|
|
2
|
-
`},V=(a,t={})=>{const r=t.stream??process.stderr,h=typeof r.isTTY=="boolean"&&r.isTTY&&!C,b=t.live??h,o=new Map;for(const s of a)o.set(s.id,{id:s.id,label:s.label,status:"pending"});if(!b||a.length===0)return{finish:(s,n,u)=>{const l=o.get(s);l&&(o.set(s,{...l,status:n,summary:u}),r.write(D(l.label,n,u)))},start:s=>{const n=o.get(s);n&&o.set(s,{...n,status:"running"})},stop:()=>{}};const f=()=>a.map(s=>o.get(s.id));let d=$(g.createElement(w,{rows:f()}),{interactive:!0,patchConsole:!1});const p=()=>{d?.rerender(g.createElement(w,{rows:f()}))};return{finish:(s,n,u)=>{const l=o.get(s);l&&(o.set(s,{...l,status:n,summary:u}),p())},start:s=>{const n=o.get(s);n&&(o.set(s,{...n,status:"running"}),p())},stop:()=>{d&&(p(),d.unmount(),d=void 0)}}};export{V as s};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{createRequire as ao}from"node:module";let po;const co=e=>(po??=ao(import.meta.url))(e),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,fo=e=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[t,o]=de.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return de.getBuiltinModule(e)}return co(e)},{createRequire:go}=fo("node:module");let ho;const bo=e=>(ho??=go(import.meta.url))(e),be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xt=e=>{if(typeof be<"u"&&be.versions&&be.versions.node){const[t,o]=be.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return be.getBuiltinModule(e)}return bo(e)},{homedir:yo,tmpdir:pt}=Xt("node:os"),{env:et,cwd:mo,platform:$t}=be,{createRequire:k}=Xt("node:module"),vo=0,Wt=2,Ao=Symbol("findUpStop"),Ro=/^[A-Z]:\//i,ot=(e="")=>e&&e.replaceAll("\\","/").replace(Ro,t=>t.toUpperCase()),Eo=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,_o=/^[A-Z]:$/i,xo=/.(\.[^./]+)$/,To=/^[/\\]|^[a-z]:[/\\]/i,Co=/\/$/,$o=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",So=(e,t)=>{let o="",c=0,p=-1,r=0,u;for(let a=0;a<=e.length;++a){if(a<e.length)u=e[a];else{if(u==="/")break;u="/"}if(u==="/"){if(!(p===a-1||r===1))if(r===2){if(o.length<2||c!==2||!o.endsWith(".")||o.at(-2)!=="."){if(o.length>2){const f=o.lastIndexOf("/");f===-1?(o="",c=0):(o=o.slice(0,f),c=o.length-1-o.lastIndexOf("/")),p=a,r=0;continue}else if(o.length>0){o="",c=0,p=a,r=0;continue}}t&&(o+=o.length>0?"/..":"..",c=2)}else o.length>0?o+=`/${e.slice(p+1,a)}`:o=e.slice(p+1,a),c=a-p-1;p=a,r=0}else u==="."&&r!==-1?++r:r=-1}return o},tt=e=>Eo.test(e),ct=function(...e){e=e.map(c=>ot(c));let t="",o=!1;for(let c=e.length-1;c>=-1&&!o;c--){const p=c>=0?e[c]:$o();!p||p.length===0||(t=`${p}/${t}`,o=tt(p))}return t=So(t,!o),o&&!tt(t)?`/${t}`:t.length>0?t:"."},Oo=function(e){return xo.exec(ot(e))?.[1]??""},qt=e=>{const t=ot(e).replace(Co,""),o=t.lastIndexOf("/");if(o===-1)return tt(e)?"/":".";const c=t.slice(0,o);return _o.test(c)?`${c}/`:c||(tt(e)?"/":".")},ko=(e,t)=>{const o=ot(e);return o.slice(o.lastIndexOf("/")+1)},wo=function(e){const t=To.exec(e)?.[0]?.replaceAll("\\","/")??"",o=ko(e),c=Oo(o);return{base:o,dir:qt(e),ext:c,name:o.slice(0,o.length-c.length),root:t}},Ho=k(import.meta.url),ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,No=e=>{if(typeof ye<"u"&&ye.versions&&ye.versions.node){const[t,o]=ye.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ye.getBuiltinModule(e)}return Ho(e)},{fileURLToPath:Lo}=No("node:url");function Bo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var St,Ot;function Io(){return Ot||(Ot=1,St=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),St}var Mo=Io();const Do=Bo(Mo);new Set(Do);const ut=e=>ot(e instanceof URL?Lo(e):e),Qt=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},Go=k(import.meta.url),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Po=e=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[t,o]=me.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return me.getBuiltinModule(e)}return Go(e)};Po("node:fs/promises");const Uo=k(import.meta.url),ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fo=e=>{if(typeof ve<"u"&&ve.versions&&ve.versions.node){const[t,o]=ve.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ve.getBuiltinModule(e)}return Uo(e)};Fo("node:fs");const kt=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},jo=k(import.meta.url),Ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zo=e=>{if(typeof Ae<"u"&&Ae.versions&&Ae.versions.node){const[t,o]=Ae.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ae.getBuiltinModule(e)}return jo(e)};zo("node:fs/promises");const Ko=k(import.meta.url),Re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xo=e=>{if(typeof Re<"u"&&Re.versions&&Re.versions.node){const[t,o]=Re.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Re.getBuiltinModule(e)}return Ko(e)},{lstatSync:wt,mkdirSync:Wo}=Xo("node:fs"),Ee=e=>{Qt(e);try{const t=wt(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(kt(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{Wo(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const o=wt(e);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(kt(o))}'`,{cause:t})}},qo=k(import.meta.url),_e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qo=e=>{if(typeof _e<"u"&&_e.versions&&_e.versions.node){const[t,o]=_e.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return _e.getBuiltinModule(e)}return qo(e)};Qo("node:fs/promises");const Zo=k(import.meta.url),xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yo=e=>{if(typeof xe<"u"&&xe.versions&&xe.versions.node){const[t,o]=xe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return xe.getBuiltinModule(e)}return Zo(e)};Yo("node:fs");const Vo=k(import.meta.url),Te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jo=e=>{if(typeof Te<"u"&&Te.versions&&Te.versions.node){const[t,o]=Te.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Te.getBuiltinModule(e)}return Vo(e)};Jo("node:fs/promises");const er=k(import.meta.url),Ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,tr=e=>{if(typeof Ce<"u"&&Ce.versions&&Ce.versions.node){const[t,o]=Ce.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ce.getBuiltinModule(e)}return er(e)};tr("node:fs");const or=k(import.meta.url),$e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rr=e=>{if(typeof $e<"u"&&$e.versions&&$e.versions.node){const[t,o]=$e.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return $e.getBuiltinModule(e)}return or(e)};rr("node:fs/promises");const sr=k(import.meta.url),Se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,nr=e=>{if(typeof Se<"u"&&Se.versions&&Se.versions.node){const[t,o]=Se.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Se.getBuiltinModule(e)}return sr(e)};nr("node:fs");k(import.meta.url);const ur=k(import.meta.url),Oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ir=e=>{if(typeof Oe<"u"&&Oe.versions&&Oe.versions.node){const[t,o]=Oe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Oe.getBuiltinModule(e)}return ur(e)};ir("node:fs/promises");const lr=k(import.meta.url),ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ar=e=>{if(typeof ke<"u"&&ke.versions&&ke.versions.node){const[t,o]=ke.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ke.getBuiltinModule(e)}return lr(e)};ar("node:fs");const pr=k(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,cr=e=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[t,o]=we.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return we.getBuiltinModule(e)}return pr(e)};cr("node:fs/promises");const fr=k(import.meta.url),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gr=e=>{if(typeof He<"u"&&He.versions&&He.versions.node){const[t,o]=He.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return He.getBuiltinModule(e)}return fr(e)},{statSync:hr,lstatSync:br}=gr("node:fs"),dr=(e,t={})=>{const o=t.cwd?ut(t.cwd):process.cwd();let c=ct(o);const{root:p}=wo(c),r=ut(t.stopAt??p),u=ct(c,r),a=t.type??"file",f=function(h){return[e]};t.allowSymlinks??=!0;const $=t.allowSymlinks?hr:br;for(;c&&c!==u&&c!==p;){for(let h of f()){if(h===Ao)return;if(h===void 0)continue;Buffer.isBuffer(h)?h=h.toString():h instanceof URL&&(h=ut(h));const x=tt(h)?h:ct(c,h);try{const T=$(x);if(a==="file"&&T.isFile()||a==="directory"&&T.isDirectory())return x}catch{}}c=qt(c)}};function xt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ht={},ft,Nt;function lt(){if(Nt)return ft;Nt=1;const e="[^\\\\/]",t=Symbol("unignore"),o="\\.",c="\\+",p="\\?",r="\\/",u="(?=.)",a="[^/]",f=`(?:${r}|$)`,$=`(?:^|${r})`,h=`${o}{1,2}${f}`,x=`(?!${o})`,T=`(?!${$}${h})`,E=`(?!${o}{0,1}${f})`,B=`(?!${h})`,te=`[^.${r}]`,Q=`${a}*?`,K="/",b={DOT_LITERAL:o,PLUS_LITERAL:c,QMARK_LITERAL:p,SLASH_LITERAL:r,ONE_CHAR:u,QMARK:a,END_ANCHOR:f,DOTS_SLASH:h,NO_DOT:x,NO_DOTS:T,NO_DOT_SLASH:E,NO_DOTS_SLASH:B,QMARK_NO_DOT:te,STAR:Q,START_ANCHOR:$,SEP:K},y={...b,SLASH_LITERAL:"[\\\\/]",QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${o}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[\\\\/])${o}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},s={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return ft={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:s,UNIGNORE:t,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(m){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${m.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(m){return m===!0?y:b}},ft}var Lt;function at(){return Lt||(Lt=1,(function(e){const{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:c,REGEX_SPECIAL_CHARS_GLOBAL:p}=lt();e.isObject=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),e.hasRegexChars=r=>c.test(r),e.isRegexChar=r=>r.length===1&&e.hasRegexChars(r),e.escapeRegex=r=>r.replace(p,"\\$1"),e.toPosixSlashes=r=>r.replace(t,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const r=navigator.platform.toLowerCase();return r==="win32"||r==="windows"}return process.platform?process.platform==="win32":!1},e.removeBackslashes=r=>r.replace(o,u=>u==="\\"?"":u),e.escapeLast=(r,u,a)=>{const f=r.lastIndexOf(u,a);return f===-1?r:r[f-1]==="\\"?e.escapeLast(r,u,f-1):`${r.slice(0,f)}\\${r.slice(f)}`},e.removePrefix=(r,u={})=>{let a=r;return a.startsWith("./")&&(a=a.slice(2),u.prefix="./"),a},e.wrapOutput=(r,u={},a={})=>{const f=a.contains?"":"^",$=a.contains?"":"$";let h=`${f}(?:${r})${$}`;return u.negated===!0&&(h=`(?:^(?!${h}).*$)`),h},e.basename=(r,{windows:u}={})=>{const a=r.split(u?/[\\/]/:"/"),f=a[a.length-1];return f===""?a[a.length-2]:f}})(Ht)),Ht}var gt,Bt;function yr(){if(Bt)return gt;Bt=1;const e=at(),{CHAR_ASTERISK:t,CHAR_AT:o,CHAR_BACKWARD_SLASH:c,CHAR_COMMA:p,CHAR_DOT:r,CHAR_EXCLAMATION_MARK:u,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:f,CHAR_LEFT_PARENTHESES:$,CHAR_LEFT_SQUARE_BRACKET:h,CHAR_PLUS:x,CHAR_QUESTION_MARK:T,CHAR_RIGHT_CURLY_BRACE:E,CHAR_RIGHT_PARENTHESES:B,CHAR_RIGHT_SQUARE_BRACKET:te}=lt(),Q=b=>b===a||b===c,K=b=>{b.isPrefix!==!0&&(b.depth=b.isGlobstar?1/0:1)};return gt=(b,y)=>{const s=y||{},m=b.length-1,A=s.parts===!0||s.scanToEnd===!0,R=[],v=[],w=[];let X=b,Z=-1,U=0,re=0,W=!1,se=!1,M=!1,ae=!1,ge=!1,ne=!1,L=!1,ue=!1,he=!1,q=!1,z=0,V,_,O={value:"",depth:0,isGlob:!1};const l=()=>Z>=m,Y=()=>X.charCodeAt(Z+1),F=()=>(V=_,X.charCodeAt(++Z));for(;Z<m;){_=F();let H;if(_===c){L=O.backslashes=!0,_=F(),_===f&&(ne=!0);continue}if(ne===!0||_===f){for(z++;l()!==!0&&(_=F());){if(_===c){L=O.backslashes=!0,F();continue}if(_===f){z++;continue}if(ne!==!0&&_===r&&(_=F())===r){if(W=O.isBrace=!0,M=O.isGlob=!0,q=!0,A===!0)continue;break}if(ne!==!0&&_===p){if(W=O.isBrace=!0,M=O.isGlob=!0,q=!0,A===!0)continue;break}if(_===E&&(z--,z===0)){ne=!1,W=O.isBrace=!0,q=!0;break}}if(A===!0)continue;break}if(_===a){if(R.push(Z),v.push(O),O={value:"",depth:0,isGlob:!1},q===!0)continue;if(V===r&&Z===U+1){U+=2;continue}re=Z+1;continue}if(s.noext!==!0&&(_===x||_===o||_===t||_===T||_===u)&&Y()===$){if(M=O.isGlob=!0,ae=O.isExtglob=!0,q=!0,_===u&&Z===U&&(he=!0),A===!0){for(;l()!==!0&&(_=F());){if(_===c){L=O.backslashes=!0,_=F();continue}if(_===B){M=O.isGlob=!0,q=!0;break}}continue}break}if(_===t){if(V===t&&(ge=O.isGlobstar=!0),M=O.isGlob=!0,q=!0,A===!0)continue;break}if(_===T){if(M=O.isGlob=!0,q=!0,A===!0)continue;break}if(_===h){for(;l()!==!0&&(H=F());){if(H===c){L=O.backslashes=!0,F();continue}if(H===te){se=O.isBracket=!0,M=O.isGlob=!0,q=!0;break}}if(A===!0)continue;break}if(s.nonegate!==!0&&_===u&&Z===U){ue=O.negated=!0,U++;continue}if(s.noparen!==!0&&_===$){if(M=O.isGlob=!0,A===!0){for(;l()!==!0&&(_=F());){if(_===$){L=O.backslashes=!0,_=F();continue}if(_===B){q=!0;break}}continue}break}if(M===!0){if(q=!0,A===!0)continue;break}}s.noext===!0&&(ae=!1,M=!1);let P=X,n="",i="";U>0&&(n=X.slice(0,U),X=X.slice(U),re-=U),P&&M===!0&&re>0?(P=X.slice(0,re),i=X.slice(re)):M===!0?(P="",i=X):P=X,P&&P!==""&&P!=="/"&&P!==X&&Q(P.charCodeAt(P.length-1))&&(P=P.slice(0,-1)),s.unescape===!0&&(i&&(i=e.removeBackslashes(i)),P&&L===!0&&(P=e.removeBackslashes(P)));const ee={prefix:n,input:b,start:U,base:P,glob:i,isBrace:W,isBracket:se,isGlob:M,isExtglob:ae,isGlobstar:ge,negated:ue,negatedExtglob:he};if(s.tokens===!0&&(ee.maxDepth=0,Q(_)||v.push(O),ee.tokens=v),s.parts===!0||s.tokens===!0){let H;for(let D=0;D<R.length;D++){const pe=H?H+1:U,J=R[D],ce=b.slice(pe,J);s.tokens&&(D===0&&U!==0?(v[D].isPrefix=!0,v[D].value=n):v[D].value=ce,K(v[D]),ee.maxDepth+=v[D].depth),(D!==0||ce!=="")&&w.push(ce),H=J}if(H&&H+1<b.length){const D=b.slice(H+1);w.push(D),s.tokens&&(v[v.length-1].value=D,K(v[v.length-1]),ee.maxDepth+=v[v.length-1].depth)}ee.slashes=R,ee.parts=w}return ee},gt}var ht,It;function mr(){if(It)return ht;It=1;const e=lt(),t=at(),{MAX_LENGTH:o,POSIX_REGEX_SOURCE:c,REGEX_NON_SPECIAL_CHARS:p,REGEX_SPECIAL_CHARS_BACKREF:r,REPLACEMENTS:u}=e,a=(b,y)=>typeof y.expandRange=="function"?y.expandRange(...b,y):(b.sort(),`[${b.join("-")}]`),f=(b,y)=>`Missing ${b}: "${y}" - use "\\\\${y}" to match literal characters`,$=b=>{const y=[];let s=0,m=0,A=0,R="",v=!1;for(const w of b){if(v===!0){R+=w,v=!1;continue}if(w==="\\"){R+=w,v=!0;continue}if(w==='"'){A=A===1?0:1,R+=w;continue}if(A===0){if(w==="[")s++;else if(w==="]"&&s>0)s--;else if(s===0){if(w==="(")m++;else if(w===")"&&m>0)m--;else if(w==="|"&&m===0){y.push(R),R="";continue}}}R+=w}return y.push(R),y},h=b=>{let y=!1;for(const s of b){if(y===!0){y=!1;continue}if(s==="\\"){y=!0;continue}if(/[?*+@!()[\]{}]/.test(s))return!1}return!0},x=b=>{let y=b.trim(),s=!0;for(;s===!0;)s=!1,/^@\([^\\()[\]{}|]+\)$/.test(y)&&(y=y.slice(2,-1),s=!0);if(h(y))return y.replace(/\\(.)/g,"$1")},T=b=>{const y=b.map(x).filter(Boolean);for(let s=0;s<y.length;s++)for(let m=s+1;m<y.length;m++){const A=y[s],R=y[m],v=A[0];if(!(!v||A!==v.repeat(A.length)||R!==v.repeat(R.length))&&(A===R||A.startsWith(R)||R.startsWith(A)))return!0}return!1},E=(b,y=!0)=>{if(b[0]!=="+"&&b[0]!=="*"||b[1]!=="(")return;let s=0,m=0,A=0,R=!1;for(let v=1;v<b.length;v++){const w=b[v];if(R===!0){R=!1;continue}if(w==="\\"){R=!0;continue}if(w==='"'){A=A===1?0:1;continue}if(A!==1){if(w==="["){s++;continue}if(w==="]"&&s>0){s--;continue}if(!(s>0)){if(w==="("){m++;continue}if(w===")"&&(m--,m===0))return y===!0&&v!==b.length-1?void 0:{type:b[0],body:b.slice(2,v),end:v}}}}},B=b=>{let y=0;const s=[];for(;y<b.length;){const m=E(b.slice(y),!1);if(!m||m.type!=="*")return;const A=$(m.body).map(v=>v.trim());if(A.length!==1)return;const R=x(A[0]);if(!R||R.length!==1)return;s.push(R),y+=m.end+1}return s.length<1?void 0:`${s.length===1?t.escapeRegex(s[0]):`[${s.map(m=>t.escapeRegex(m)).join("")}]`}*`},te=b=>{let y=0,s=b.trim(),m=E(s);for(;m;)y++,s=m.body.trim(),m=E(s);return y},Q=(b,y)=>{if(y.maxExtglobRecursion===!1)return{risky:!1};const s=typeof y.maxExtglobRecursion=="number"?y.maxExtglobRecursion:e.DEFAULT_MAX_EXTGLOB_RECURSION,m=$(b).map(A=>A.trim());if(m.length>1&&(m.some(A=>A==="")||m.some(A=>/^[*?]+$/.test(A))||T(m)))return{risky:!0};for(const A of m){const R=B(A);if(R)return{risky:!0,safeOutput:R};if(te(A)>s)return{risky:!0}}return{risky:!1}},K=(b,y)=>{if(typeof b!="string")throw new TypeError("Expected a string");b=u[b]||b;const s={...y},m=typeof s.maxLength=="number"?Math.min(o,s.maxLength):o;let A=b.length;if(A>m)throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${m}`);const R={type:"bos",value:"",output:s.prepend||""},v=[R],w=s.capture?"":"?:",X=e.globChars(s.windows),Z=e.extglobChars(X),{DOT_LITERAL:U,PLUS_LITERAL:re,SLASH_LITERAL:W,ONE_CHAR:se,DOTS_SLASH:M,NO_DOT:ae,NO_DOT_SLASH:ge,NO_DOTS_SLASH:ne,QMARK:L,QMARK_NO_DOT:ue,STAR:he,START_ANCHOR:q}=X,z=d=>`(${w}(?:(?!${q}${d.dot?M:U}).)*?)`,V=s.dot?"":ae,_=s.dot?L:ue;let O=s.bash===!0?z(s):he;s.capture&&(O=`(${O})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);const l={input:b,index:-1,start:0,dot:s.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};b=t.removePrefix(b,l),A=b.length;const Y=[],F=[],P=[];let n=R,i;const ee=()=>l.index===A-1,H=l.peek=(d=1)=>b[l.index+d],D=l.advance=()=>b[++l.index]||"",pe=()=>b.slice(l.index+1),J=(d="",I=0)=>{l.consumed+=d,l.index+=I},ce=d=>{l.output+=d.output!=null?d.output:d.value,J(d.value)},io=()=>{let d=1;for(;H()==="!"&&(H(2)!=="("||H(3)==="?");)D(),l.start++,d++;return d%2===0?!1:(l.negated=!0,l.start++,!0)},st=d=>{l[d]++,P.push(d)},fe=d=>{l[d]--,P.pop()},C=d=>{if(n.type==="globstar"){const I=l.braces>0&&(d.type==="comma"||d.type==="brace"),g=d.extglob===!0||Y.length&&(d.type==="pipe"||d.type==="paren");d.type!=="slash"&&d.type!=="paren"&&!I&&!g&&(l.output=l.output.slice(0,-n.output.length),n.type="star",n.value="*",n.output=O,l.output+=n.output)}if(Y.length&&d.type!=="paren"&&(Y[Y.length-1].inner+=d.value),(d.value||d.output)&&ce(d),n&&n.type==="text"&&d.type==="text"){n.output=(n.output||n.value)+d.value,n.value+=d.value;return}d.prev=n,v.push(d),n=d},nt=(d,I)=>{const g={...Z[I],conditions:1,inner:""};g.prev=n,g.parens=l.parens,g.output=l.output,g.startIndex=l.index,g.tokensIndex=v.length;const S=(s.capture?"(":"")+g.open;st("parens"),C({type:d,value:I,output:l.output?"":se}),C({type:"paren",extglob:!0,value:D(),output:S}),Y.push(g)},lo=d=>{const I=b.slice(d.startIndex,l.index+1),g=b.slice(d.startIndex+2,l.index),S=Q(g,s);if((d.type==="plus"||d.type==="star")&&S.risky){const N=S.safeOutput?(d.output?"":se)+(s.capture?`(${S.safeOutput})`:S.safeOutput):void 0,ie=v[d.tokensIndex];ie.type="text",ie.value=I,ie.output=N||t.escapeRegex(I);for(let le=d.tokensIndex+1;le<v.length;le++)v[le].value="",v[le].output="",delete v[le].suffix;l.output=d.output+ie.output,l.backtrack=!0,C({type:"paren",extglob:!0,value:i,output:""}),fe("parens");return}let G=d.close+(s.capture?")":""),j;if(d.type==="negate"){let N=O;if(d.inner&&d.inner.length>1&&d.inner.includes("/")&&(N=z(s)),(N!==O||ee()||/^\)+$/.test(pe()))&&(G=d.close=`)$))${N}`),d.inner.includes("*")&&(j=pe())&&/^\.[^\\/.]+$/.test(j)){const ie=K(j,{...y,fastpaths:!1}).output;G=d.close=`)${ie})${N})`}d.prev.type==="bos"&&(l.negatedExtglob=!0)}C({type:"paren",extglob:!0,value:i,output:G}),fe("parens")};if(s.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(b)){let d=!1,I=b.replace(r,(g,S,G,j,N,ie)=>j==="\\"?(d=!0,g):j==="?"?S?S+j+(N?L.repeat(N.length):""):ie===0?_+(N?L.repeat(N.length):""):L.repeat(G.length):j==="."?U.repeat(G.length):j==="*"?S?S+j+(N?O:""):O:S?g:`\\${g}`);return d===!0&&(s.unescape===!0?I=I.replace(/\\/g,""):I=I.replace(/\\+/g,g=>g.length%2===0?"\\\\":g?"\\":"")),I===b&&s.contains===!0?(l.output=b,l):(l.output=t.wrapOutput(I,l,y),l)}for(;!ee();){if(i=D(),i==="\0")continue;if(i==="\\"){const g=H();if(g==="/"&&s.bash!==!0||g==="."||g===";")continue;if(!g){i+="\\",C({type:"text",value:i});continue}const S=/^\\+/.exec(pe());let G=0;if(S&&S[0].length>2&&(G=S[0].length,l.index+=G,G%2!==0&&(i+="\\")),s.unescape===!0?i=D():i+=D(),l.brackets===0){C({type:"text",value:i});continue}}if(l.brackets>0&&(i!=="]"||n.value==="["||n.value==="[^")){if(s.posix!==!1&&i===":"){const g=n.value.slice(1);if(g.includes("[")&&(n.posix=!0,g.includes(":"))){const S=n.value.lastIndexOf("["),G=n.value.slice(0,S),j=n.value.slice(S+2),N=c[j];if(N){n.value=G+N,l.backtrack=!0,D(),!R.output&&v.indexOf(n)===1&&(R.output=se);continue}}}(i==="["&&H()!==":"||i==="-"&&H()==="]")&&(i=`\\${i}`),i==="]"&&(n.value==="["||n.value==="[^")&&(i=`\\${i}`),s.posix===!0&&i==="!"&&n.value==="["&&(i="^"),n.value+=i,ce({value:i});continue}if(l.quotes===1&&i!=='"'){i=t.escapeRegex(i),n.value+=i,ce({value:i});continue}if(i==='"'){l.quotes=l.quotes===1?0:1,s.keepQuotes===!0&&C({type:"text",value:i});continue}if(i==="("){st("parens"),C({type:"paren",value:i});continue}if(i===")"){if(l.parens===0&&s.strictBrackets===!0)throw new SyntaxError(f("opening","("));const g=Y[Y.length-1];if(g&&l.parens===g.parens+1){lo(Y.pop());continue}C({type:"paren",value:i,output:l.parens?")":"\\)"}),fe("parens");continue}if(i==="["){if(s.nobracket===!0||!pe().includes("]")){if(s.nobracket!==!0&&s.strictBrackets===!0)throw new SyntaxError(f("closing","]"));i=`\\${i}`}else st("brackets");C({type:"bracket",value:i});continue}if(i==="]"){if(s.nobracket===!0||n&&n.type==="bracket"&&n.value.length===1){C({type:"text",value:i,output:`\\${i}`});continue}if(l.brackets===0){if(s.strictBrackets===!0)throw new SyntaxError(f("opening","["));C({type:"text",value:i,output:`\\${i}`});continue}fe("brackets");const g=n.value.slice(1);if(n.posix!==!0&&g[0]==="^"&&!g.includes("/")&&(i=`/${i}`),n.value+=i,ce({value:i}),s.literalBrackets===!1||t.hasRegexChars(g))continue;const S=t.escapeRegex(n.value);if(l.output=l.output.slice(0,-n.value.length),s.literalBrackets===!0){l.output+=S,n.value=S;continue}n.value=`(${w}${S}|${n.value})`,l.output+=n.value;continue}if(i==="{"&&s.nobrace!==!0){st("braces");const g={type:"brace",value:i,output:"(",outputIndex:l.output.length,tokensIndex:l.tokens.length};F.push(g),C(g);continue}if(i==="}"){const g=F[F.length-1];if(s.nobrace===!0||!g){C({type:"text",value:i,output:i});continue}let S=")";if(g.dots===!0){const G=v.slice(),j=[];for(let N=G.length-1;N>=0&&(v.pop(),G[N].type!=="brace");N--)G[N].type!=="dots"&&j.unshift(G[N].value);S=a(j,s),l.backtrack=!0}if(g.comma!==!0&&g.dots!==!0){const G=l.output.slice(0,g.outputIndex),j=l.tokens.slice(g.tokensIndex);g.value=g.output="\\{",i=S="\\}",l.output=G;for(const N of j)l.output+=N.output||N.value}C({type:"brace",value:i,output:S}),fe("braces"),F.pop();continue}if(i==="|"){Y.length>0&&Y[Y.length-1].conditions++,C({type:"text",value:i});continue}if(i===","){let g=i;const S=F[F.length-1];S&&P[P.length-1]==="braces"&&(S.comma=!0,g="|"),C({type:"comma",value:i,output:g});continue}if(i==="/"){if(n.type==="dot"&&l.index===l.start+1){l.start=l.index+1,l.consumed="",l.output="",v.pop(),n=R;continue}C({type:"slash",value:i,output:W});continue}if(i==="."){if(l.braces>0&&n.type==="dot"){n.value==="."&&(n.output=U);const g=F[F.length-1];n.type="dots",n.output+=i,n.value+=i,g.dots=!0;continue}if(l.braces+l.parens===0&&n.type!=="bos"&&n.type!=="slash"){C({type:"text",value:i,output:U});continue}C({type:"dot",value:i,output:U});continue}if(i==="?"){if(!(n&&n.value==="(")&&s.noextglob!==!0&&H()==="("&&H(2)!=="?"){nt("qmark",i);continue}if(n&&n.type==="paren"){const g=H();let S=i;(n.value==="("&&!/[!=<:]/.test(g)||g==="<"&&!/<([!=]|\w+>)/.test(pe()))&&(S=`\\${i}`),C({type:"text",value:i,output:S});continue}if(s.dot!==!0&&(n.type==="slash"||n.type==="bos")){C({type:"qmark",value:i,output:ue});continue}C({type:"qmark",value:i,output:L});continue}if(i==="!"){if(s.noextglob!==!0&&H()==="("&&(H(2)!=="?"||!/[!=<:]/.test(H(3)))){nt("negate",i);continue}if(s.nonegate!==!0&&l.index===0){io();continue}}if(i==="+"){if(s.noextglob!==!0&&H()==="("&&H(2)!=="?"){nt("plus",i);continue}if(n&&n.value==="("||s.regex===!1){C({type:"plus",value:i,output:re});continue}if(n&&(n.type==="bracket"||n.type==="paren"||n.type==="brace")||l.parens>0){C({type:"plus",value:i});continue}C({type:"plus",value:re});continue}if(i==="@"){if(s.noextglob!==!0&&H()==="("&&H(2)!=="?"){C({type:"at",extglob:!0,value:i,output:""});continue}C({type:"text",value:i});continue}if(i!=="*"){(i==="$"||i==="^")&&(i=`\\${i}`);const g=p.exec(pe());g&&(i+=g[0],l.index+=g[0].length),C({type:"text",value:i});continue}if(n&&(n.type==="globstar"||n.star===!0)){n.type="star",n.star=!0,n.value+=i,n.output=O,l.backtrack=!0,l.globstar=!0,J(i);continue}let d=pe();if(s.noextglob!==!0&&/^\([^?]/.test(d)){nt("star",i);continue}if(n.type==="star"){if(s.noglobstar===!0){J(i);continue}const g=n.prev,S=g.prev,G=g.type==="slash"||g.type==="bos",j=S&&(S.type==="star"||S.type==="globstar");if(s.bash===!0&&(!G||d[0]&&d[0]!=="/")){C({type:"star",value:i,output:""});continue}const N=l.braces>0&&(g.type==="comma"||g.type==="brace"),ie=Y.length&&(g.type==="pipe"||g.type==="paren");if(!G&&g.type!=="paren"&&!N&&!ie){C({type:"star",value:i,output:""});continue}for(;d.slice(0,3)==="/**";){const le=b[l.index+4];if(le&&le!=="/")break;d=d.slice(3),J("/**",3)}if(g.type==="bos"&&ee()){n.type="globstar",n.value+=i,n.output=z(s),l.output=n.output,l.globstar=!0,J(i);continue}if(g.type==="slash"&&g.prev.type!=="bos"&&!j&&ee()){l.output=l.output.slice(0,-(g.output+n.output).length),g.output=`(?:${g.output}`,n.type="globstar",n.output=z(s)+(s.strictSlashes?")":"|$)"),n.value+=i,l.globstar=!0,l.output+=g.output+n.output,J(i);continue}if(g.type==="slash"&&g.prev.type!=="bos"&&d[0]==="/"){const le=d[1]!==void 0?"|$":"";l.output=l.output.slice(0,-(g.output+n.output).length),g.output=`(?:${g.output}`,n.type="globstar",n.output=`${z(s)}${W}|${W}${le})`,n.value+=i,l.output+=g.output+n.output,l.globstar=!0,J(i+D()),C({type:"slash",value:"/",output:""});continue}if(g.type==="bos"&&d[0]==="/"){n.type="globstar",n.value+=i,n.output=`(?:^|${W}|${z(s)}${W})`,l.output=n.output,l.globstar=!0,J(i+D()),C({type:"slash",value:"/",output:""});continue}if(N&&d[0]==="/"){n.type="globstar",n.value+=i,n.output=`(?:^|${W}|${z(s)}${W})`,l.output+=n.output,l.globstar=!0,J(i+D()),C({type:"slash",value:"/",output:""});continue}l.output=l.output.slice(0,-n.output.length),n.type="globstar",n.output=z(s),n.value+=i,l.output+=n.output,l.globstar=!0,J(i);continue}const I={type:"star",value:i,output:O};if(s.bash===!0){I.output=".*?",(n.type==="bos"||n.type==="slash")&&(I.output=V+I.output),C(I);continue}if(n&&(n.type==="bracket"||n.type==="paren")&&s.regex===!0){I.output=i,C(I);continue}(l.index===l.start||n.type==="slash"||n.type==="dot")&&(n.type==="dot"?(l.output+=ge,n.output+=ge):s.dot===!0?(l.output+=ne,n.output+=ne):(l.output+=V,n.output+=V),H()!=="*"&&(l.output+=se,n.output+=se)),C(I)}for(;l.brackets>0;){if(s.strictBrackets===!0)throw new SyntaxError(f("closing","]"));l.output=t.escapeLast(l.output,"["),fe("brackets")}for(;l.parens>0;){if(s.strictBrackets===!0)throw new SyntaxError(f("closing",")"));l.output=t.escapeLast(l.output,"("),fe("parens")}for(;l.braces>0;){if(s.strictBrackets===!0)throw new SyntaxError(f("closing","}"));l.output=t.escapeLast(l.output,"{"),fe("braces")}if(s.strictSlashes!==!0&&(n.type==="star"||n.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${W}?`}),l.backtrack===!0){l.output="";for(const d of l.tokens)l.output+=d.output!=null?d.output:d.value,d.suffix&&(l.output+=d.suffix)}return l};return K.fastpaths=(b,y)=>{const s={...y},m=typeof s.maxLength=="number"?Math.min(o,s.maxLength):o,A=b.length;if(A>m)throw new SyntaxError(`Input length: ${A}, exceeds maximum allowed length: ${m}`);b=u[b]||b;const{DOT_LITERAL:R,SLASH_LITERAL:v,ONE_CHAR:w,DOTS_SLASH:X,NO_DOT:Z,NO_DOTS:U,NO_DOTS_SLASH:re,STAR:W,START_ANCHOR:se}=e.globChars(s.windows),M=s.dot?U:Z,ae=s.dot?re:Z,ge=s.capture?"":"?:",ne={negated:!1,prefix:""};let L=s.bash===!0?".*?":W;s.capture&&(L=`(${L})`);const ue=V=>V.noglobstar===!0?L:`(${ge}(?:(?!${se}${V.dot?X:R}).)*?)`,he=V=>{switch(V){case"*":return`${M}${w}${L}`;case".*":return`${R}${w}${L}`;case"*.*":return`${M}${L}${R}${w}${L}`;case"*/*":return`${M}${L}${v}${w}${ae}${L}`;case"**":return M+ue(s);case"**/*":return`(?:${M}${ue(s)}${v})?${ae}${w}${L}`;case"**/*.*":return`(?:${M}${ue(s)}${v})?${ae}${L}${R}${w}${L}`;case"**/.*":return`(?:${M}${ue(s)}${v})?${R}${w}${L}`;default:{const _=/^(.*?)\.(\w+)$/.exec(V);if(!_)return;const O=he(_[1]);return O?O+R+_[2]:void 0}}},q=t.removePrefix(b,ne);let z=he(q);return z&&s.strictSlashes!==!0&&(z+=`${v}?`),z},ht=K,ht}var bt,Mt;function vr(){if(Mt)return bt;Mt=1;const e=yr(),t=mr(),o=at(),c=lt(),p=u=>u&&typeof u=="object"&&!Array.isArray(u),r=(u,a,f=!1)=>{if(Array.isArray(u)){const Q=u.map(K=>r(K,a,f));return K=>{for(const b of Q){const y=b(K);if(y)return y}return!1}}const $=p(u)&&u.tokens&&u.input;if(u===""||typeof u!="string"&&!$)throw new TypeError("Expected pattern to be a non-empty string");const h=a||{},x=h.windows,T=$?r.compileRe(u,a):r.makeRe(u,a,!1,!0),E=T.state;delete T.state;let B=()=>!1;if(h.ignore){const Q={...a,ignore:null,onMatch:null,onResult:null};B=r(h.ignore,Q,f)}const te=(Q,K=!1)=>{const{isMatch:b,match:y,output:s}=r.test(Q,T,a,{glob:u,posix:x}),m={glob:u,state:E,regex:T,posix:x,input:Q,output:s,match:y,isMatch:b};if(typeof h.onResult=="function"&&h.onResult(m),b===!1)return m.isMatch=!1,K?m:!1;e:if(B(Q)){if(typeof h.onIgnore=="function"&&h.onIgnore(m)===c.UNIGNORE){m.isMatch=!0;break e}return m.isMatch=!1,K?m:!1}return typeof h.onMatch=="function"&&h.onMatch(m),K?m:!0};return f&&(te.state=E),te};return r.test=(u,a,f,{glob:$,posix:h}={})=>{if(typeof u!="string")throw new TypeError("Expected input to be a string");if(u==="")return{isMatch:!1,output:""};const x=f||{},T=x.format||(h?o.toPosixSlashes:null);let E=u===$,B=E&&T?T(u):u;return E===!1&&(B=T?T(u):u,E=B===$),(E===!1||x.capture===!0)&&(x.matchBase===!0||x.basename===!0?E=r.matchBase(u,a,f,h):E=a.exec(B)),{isMatch:!!E,match:E,output:B}},r.matchBase=(u,a,f)=>(a instanceof RegExp?a:r.makeRe(a,f)).test(o.basename(u)),r.isMatch=(u,a,f)=>r(a,f)(u),r.parse=(u,a)=>Array.isArray(u)?u.map(f=>r.parse(f,a)):t(u,{...a,fastpaths:!1}),r.scan=(u,a)=>e(u,a),r.compileRe=(u,a,f=!1,$=!1)=>{if(f===!0)return u.output;const h=a||{},x=h.contains?"":"^",T=h.contains?"":"$";let E=`${x}(?:${u.output})${T}`;u&&u.negated===!0&&(E=`^(?!${E}).*$`);const B=r.toRegex(E,a);return $===!0&&(B.state=u),B},r.makeRe=(u,a={},f=!1,$=!1)=>{if(!u||typeof u!="string")throw new TypeError("Expected a non-empty string");let h={negated:!1,fastpaths:!0};return a.fastpaths!==!1&&(u[0]==="."||u[0]==="*")&&(h.output=t.fastpaths(u,a)),h.output||(h=t(u,a)),r.compileRe(h,a,f,$)},r.toRegex=(u,a)=>{try{const f=a||{};return new RegExp(u,f.flags||(f.nocase?"i":""))}catch(f){if(a&&a.debug===!0)throw f;return/$^/}},r.constants=c,bt=r,bt}var dt,Dt;function Ar(){if(Dt)return dt;Dt=1;const e=vr(),t=at();function o(c,p,r=!1){return p&&(p.windows===null||p.windows===void 0)&&(p={...p,windows:t.isWindows()}),e(c,p,r)}return Object.assign(o,e),dt=o,dt}var Rr=Ar();xt(Rr);const Er=k(import.meta.url),Ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rt=e=>{if(typeof Ne<"u"&&Ne.versions&&Ne.versions.node){const[t,o]=Ne.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ne.getBuiltinModule(e)}return Er(e)};rt("fs");rt("fs");rt("path");rt("url");const{createRequire:_r}=rt("module");var Gt=_r(import.meta.url);try{Gt.resolve("picomatch"),Gt("picomatch")}catch{}var yt,Pt;function xr(){if(Pt)return yt;Pt=1;/*!
|
|
2
|
-
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/return yt=function(e){if(typeof e!="string"||e==="")return!1;for(var t;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1},yt}var mt,Ut;function Zt(){if(Ut)return mt;Ut=1;/*!
|
|
7
|
-
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
10
|
-
* Released under the MIT License.
|
|
11
|
-
*/var e=xr(),t={"{":"}","(":")","[":"]"},o=function(p){if(p[0]==="!")return!0;for(var r=0,u=-2,a=-2,f=-2,$=-2,h=-2;r<p.length;){if(p[r]==="*"||p[r+1]==="?"&&/[\].+)]/.test(p[r])||a!==-1&&p[r]==="["&&p[r+1]!=="]"&&(a<r&&(a=p.indexOf("]",r)),a>r&&(h===-1||h>a||(h=p.indexOf("\\",r),h===-1||h>a)))||f!==-1&&p[r]==="{"&&p[r+1]!=="}"&&(f=p.indexOf("}",r),f>r&&(h=p.indexOf("\\",r),h===-1||h>f))||$!==-1&&p[r]==="("&&p[r+1]==="?"&&/[:!=]/.test(p[r+2])&&p[r+3]!==")"&&($=p.indexOf(")",r),$>r&&(h=p.indexOf("\\",r),h===-1||h>$))||u!==-1&&p[r]==="("&&p[r+1]!=="|"&&(u<r&&(u=p.indexOf("|",r)),u!==-1&&p[u+1]!==")"&&($=p.indexOf(")",u),$>u&&(h=p.indexOf("\\",u),h===-1||h>$))))return!0;if(p[r]==="\\"){var x=p[r+1];r+=2;var T=t[x];if(T){var E=p.indexOf(T,r);E!==-1&&(r=E+1)}if(p[r]==="!")return!0}else r++}return!1},c=function(p){if(p[0]==="!")return!0;for(var r=0;r<p.length;){if(/[*?{}()[\]]/.test(p[r]))return!0;if(p[r]==="\\"){var u=p[r+1];r+=2;var a=t[u];if(a){var f=p.indexOf(a,r);f!==-1&&(r=f+1)}if(p[r]==="!")return!0}else r++}return!1};return mt=function(p,r){if(typeof p!="string"||p==="")return!1;if(e(p))return!0;var u=o;return r&&r.strict===!1&&(u=c),u(p)},mt}const Tr=k(import.meta.url),Le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yt=e=>{if(typeof Le<"u"&&Le.versions&&Le.versions.node){const[t,o]=Le.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Le.getBuiltinModule(e)}return Tr(e)},Cr=Yt("path"),$r=Yt("os");var vt,Ft;function Sr(){if(Ft)return vt;Ft=1;var e=Zt(),t=Cr.posix.dirname,o=$r.platform()==="win32",c="/",p=/\\/g,r=/\\([!*?|[\](){}])/g;vt=function(f,$){var h=Object.assign({flipBackslashes:!0},$);h.flipBackslashes&&o&&f.indexOf(c)<0&&(f=f.replace(p,c)),u(f)&&(f+=c),f+="a";do f=t(f);while(a(f));return f.replace(r,"$1")};function u(f){var $=f.slice(-1),h;switch($){case"}":h="{";break;case"]":h="[";break;default:return!1}var x=f.indexOf(h);return x<0?!1:f.slice(x+1,-1).includes(c)}function a(f){return/\([^()]+$/.test(f)||f[0]==="{"||f[0]==="["||/[^\\][{[]/.test(f)?!0:e(f)}return vt}var Or=Sr();xt(Or);const kr=k(import.meta.url),Be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wr=e=>{if(typeof Be<"u"&&Be.versions&&Be.versions.node){const[t,o]=Be.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Be.getBuiltinModule(e)}return kr(e)};wr("node:fs/promises");const Hr=k(import.meta.url),Ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nr=e=>{if(typeof Ie<"u"&&Ie.versions&&Ie.versions.node){const[t,o]=Ie.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ie.getBuiltinModule(e)}return Hr(e)},{accessSync:Lr}=Nr("node:fs");function _t(e,t=vo){Qt(e),e=ut(e);try{return Lr(e,t),!0}catch{return!1}}var Br=Zt();xt(Br);const Ir=k(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vt=e=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[t,o]=Me.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Me.getBuiltinModule(e)}return Ir(e)};Vt("node:fs/promises");Vt("node:fs");let Mr=class extends Error{constructor(e){super(`ENOENT: ${e}`)}get code(){return"ENOENT"}set code(e){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(e){throw new Error("Cannot overwrite name of NotFoundError")}};const Dr=k(import.meta.url),De=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jt=e=>{if(typeof De<"u"&&De.versions&&De.versions.node){const[t,o]=De.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return De.getBuiltinModule(e)}return Dr(e)};Jt("node:fs/promises");Jt("node:zlib");const Gr=k(import.meta.url),Ge=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,eo=e=>{if(typeof Ge<"u"&&Ge.versions&&Ge.versions.node){const[t,o]=Ge.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ge.getBuiltinModule(e)}return Gr(e)};eo("node:fs");eo("node:zlib");const Pr=k(import.meta.url),Pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ur=e=>{if(typeof Pe<"u"&&Pe.versions&&Pe.versions.node){const[t,o]=Pe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Pe.getBuiltinModule(e)}return Pr(e)},{createRequire:to}=Ur("node:module"),Fr=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&Fr.set("AggregateError",AggregateError);const jr=to(import.meta.url),Ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zr=e=>{if(typeof Ue<"u"&&Ue.versions&&Ue.versions.node){const[t,o]=Ue.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ue.getBuiltinModule(e)}return jr(e)};zr("node:util");const Kr=to(import.meta.url),Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Tt=e=>{if(typeof Fe<"u"&&Fe.versions&&Fe.versions.node){const[t,o]=Fe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Fe.getBuiltinModule(e)}return Kr(e)};Tt("node:fs");Tt("node:path");Tt("node:url");const Xr=k(import.meta.url),je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,oo=e=>{if(typeof je<"u"&&je.versions&&je.versions.node){const[t,o]=je.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return je.getBuiltinModule(e)}return Xr(e)};oo("node:fs");oo("node:fs/promises");const Wr=k(import.meta.url),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qr=e=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[t,o]=ze.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ze.getBuiltinModule(e)}return Wr(e)};qr("node:fs");const Qr=k(import.meta.url),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Zr=e=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[t,o]=Ke.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ke.getBuiltinModule(e)}return Qr(e)};Zr("node:fs/promises");const Yr=k(import.meta.url),Xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vr=e=>{if(typeof Xe<"u"&&Xe.versions&&Xe.versions.node){const[t,o]=Xe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Xe.getBuiltinModule(e)}return Yr(e)};Vr("node:fs");k(import.meta.url);const Jr=k(import.meta.url),We=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,es=e=>{if(typeof We<"u"&&We.versions&&We.versions.node){const[t,o]=We.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return We.getBuiltinModule(e)}return Jr(e)};es("node:crypto");new TextEncoder;const ts=k(import.meta.url),qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,os=e=>{if(typeof qe<"u"&&qe.versions&&qe.versions.node){const[t,o]=qe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return qe.getBuiltinModule(e)}return ts(e)};os("node:fs/promises");const rs=k(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ss=e=>{if(typeof Qe<"u"&&Qe.versions&&Qe.versions.node){const[t,o]=Qe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Qe.getBuiltinModule(e)}return rs(e)};ss("node:fs");const ns=k(import.meta.url),Ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,us=e=>{if(typeof Ze<"u"&&Ze.versions&&Ze.versions.node){const[t,o]=Ze.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ze.getBuiltinModule(e)}return ns(e)};us("node:fs/promises");const is=k(import.meta.url),Ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ls=e=>{if(typeof Ye<"u"&&Ye.versions&&Ye.versions.node){const[t,o]=Ye.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ye.getBuiltinModule(e)}return is(e)};ls("node:fs");const as=k(import.meta.url),Ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ct=e=>{if(typeof Ve<"u"&&Ve.versions&&Ve.versions.node){const[t,o]=Ve.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ve.getBuiltinModule(e)}return as(e)},ps=Ct("fs"),cs=Ct("os"),fs=Ct("path");var At={},jt;function gs(){if(jt)return At;jt=1;var e=Object.defineProperty,t=(h,x)=>e(h,"name",{value:x,configurable:!0}),o=ps,c=cs,p=fs;const r=t(h=>{let x="";for(let T=0;T<h.length;T+=1){const E=h[T],B=E.toUpperCase();x+=E===B?E.toLowerCase():B}return x},"invertCase"),u=new Map,a=t((h,x)=>{const T=p.join(h,`.is-fs-case-sensitive-test-${process.pid}`);try{return x.writeFileSync(T,""),!x.existsSync(r(T))}finally{try{x.unlinkSync(T)}catch{}}},"checkDirectoryCaseWithWrite"),f=t((h,x,T)=>{try{return a(h,T)}catch(E){if(x===void 0)return a(c.tmpdir(),T);throw E}},"checkDirectoryCaseWithFallback"),$=t((h,x=o,T=!0)=>{const E=h??process.cwd();if(T&&u.has(E))return u.get(E);let B;const te=r(E);return te!==E&&x.existsSync(E)?B=!x.existsSync(te):B=f(E,h,x),T&&u.set(E,B),B},"isFsCaseSensitive");return At.isFsCaseSensitive=$,At}gs();const hs=/^[A-Z]:\//i,ro=(e="")=>e&&e.replaceAll("\\","/").replace(hs,t=>t.toUpperCase()),bs=/^[/\\]{2}/,ds=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,so=/^[A-Z]:$/i,ys=/\/$/,Rt="/",ms=(e,t)=>{let o="",c=0,p=-1,r=0,u;for(let a=0;a<=e.length;++a){if(a<e.length)u=e[a];else{if(u==="/")break;u="/"}if(u==="/"){if(!(p===a-1||r===1))if(r===2){if(o.length<2||c!==2||!o.endsWith(".")||o.at(-2)!=="."){if(o.length>2){const f=o.lastIndexOf("/");f===-1?(o="",c=0):(o=o.slice(0,f),c=o.length-1-o.lastIndexOf("/")),p=a,r=0;continue}else if(o.length>0){o="",c=0,p=a,r=0;continue}}t&&(o+=o.length>0?"/..":"..",c=2)}else o.length>0?o+=`/${e.slice(p+1,a)}`:o=e.slice(p+1,a),c=a-p-1;p=a,r=0}else u==="."&&r!==-1?++r:r=-1}return o},it=e=>ds.test(e),no=function(e){if(e.length===0)return".";e=ro(e);const t=bs.exec(e),o=it(e),c=e.at(-1)==="/";return e=ms(e,!o),e.length===0?o?"/":c?"./":".":(c&&(e+="/"),so.test(e)&&(e+="/"),t?o?`//${e}`:`//./${e}`:o&&!it(e)?`/${e}`:e)},oe=(...e)=>{let t="";for(const o of e)if(o)if(t.length>0){const c=t.at(-1)==="/",p=o[0]==="/";c&&p?t+=o.slice(1):t+=c||p?o:`/${o}`}else t+=o;return no(t)},vs=e=>{const t=ro(e).replace(ys,""),o=t.lastIndexOf("/");if(o===-1)return it(e)?"/":".";const c=t.slice(0,o);return so.test(c)?`${c}/`:c||(it(e)?"/":".")},uo=e=>e instanceof URL?new URL(e).pathname:e,zt=e=>{const t=yo();if($t==="win32"){const c=et.LOCALAPPDATA??(t?oe(t,"AppData","Local"):pt());return oe(c,e,"Cache")}if($t==="darwin"){const c=t?oe(t,"Library","Caches"):pt();return oe(c,e)}const o=et.XDG_CACHE_HOME??(t?oe(t,".cache"):pt());return oe(o,e)},As=e=>{if(e.length===0)return;const t=e.map(r=>no(uo(r)).split(Rt));let o=Number.POSITIVE_INFINITY;for(const r of t)r.length<o&&(o=r.length);const c=[];for(let r=0;r<o;r+=1){const u=t[0][r];if(t.every(a=>a[r]===u))c.push(u);else break}const p=c.join(Rt);return p===""?Rt:p},Je=(e,t)=>{if(e!==void 0)return t?(...o)=>oe(e,...o):e},Rs=e=>{if(e?.files&&e.files.length>0){const t=As(e.files);if(t!==void 0)return t}return e?.cwd??mo()},Es=e=>new Mr(`No package.json found searching upwards from '${uo(e)}'.`),Et=e=>!_t(e,Wt)&&_t(e),_s=(e,t)=>{if(et.CACHE_DIR&&!["0","1","false","true"].includes(et.CACHE_DIR)){const a=oe(et.CACHE_DIR,e);return t?.create&&Ee(a),Je(a,t?.thunk)}const o=Rs(t),c=dr("package.json",{cwd:o,type:"file"});if(!c){if(t?.useGlobalCacheFallback){const a=zt(e);return t.create&&Ee(a),Je(a,t.thunk)}if(t?.throwError)throw Es(o);return}const p=oe(vs(c),"node_modules"),r=oe(p,".cache"),u=oe(r,e);if(_t(u,Wt))return t?.create&&Ee(u),Je(u,t?.thunk);if(Et(u)||Et(r)||Et(p)){if(t?.useGlobalCacheFallback){const a=zt(e);return t.create&&Ee(a),Je(a,t.thunk)}return}return t?.create&&Ee(u),Je(u,t?.thunk)},$s=_s,Kt="@inherit",xs=["aliases","dependsOn","inputs","outputs"],Ts=(e,t)=>{if(t===void 0)return e===void 0?void 0:[...e];if(!t.includes(Kt))return[...t];const o=[];for(const c of t){if(c===Kt){e!==void 0&&o.push(...e);continue}o.push(c)}return o},Ss=(e,t)=>{const o={...e,...t};for(const c of xs){const p=e?.[c],r=t?.[c],u=Ts(p,r);u===void 0?delete o[c]:o[c]=u}return o};export{$s as k,Ss as m};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,l,e as r,r as g}from"../packem_chunks/catalog.js";import{I as ae,J as je,K as ge,M as ne}from"../packem_chunks/cli-main.js";import{Spinner as me}from"@visulima/tui-kit/spinner";import{Dialog as J}from"@visulima/tui-kit/dialog";import{ScrollView as fe}from"@visulima/tui-kit/scroll-view";import{B as ue}from"./en-BxrK-n-J.js";import{ScrollBar as ye}from"@visulima/tui-kit/scroll-bar";import{Tab as we}from"@visulima/tui-kit/tab";import{Tabs as Ce}from"@visulima/tui-kit/tabs";import{u as ke}from"./use-measured-height-BLZt9dW2.js";const We=({current:a,total:t})=>{const{columns:i}=ae(),s=i||80,d=t>0?Math.min(1,a/t):0,h=`${String(Math.round(d*100)).padStart(3)}%`,f=`${String(a)}/${String(t)}`,y=Math.max(10,s-2-h.length-1),p=Math.round(y*d),j=y-p;return e.jsxs(l,{flexDirection:"column",paddingX:1,children:[e.jsxs(l,{children:[e.jsx(me,{type:"dots"}),e.jsx(r,{children:" Checking catalog dependencies "}),e.jsx(r,{dimColor:!0,children:f})]}),e.jsxs(l,{children:[e.jsx(r,{color:"cyan",children:"━".repeat(p)}),e.jsx(r,{dimColor:!0,children:"─".repeat(j)}),e.jsxs(r,{dimColor:!0,children:[" ",h]})]})]})},_=["default","name","updateType","severity"],ce=a=>{const t=a.vulnerabilities?.map(i=>i.severity)??[];return t.includes("CRITICAL")?4:t.includes("HIGH")?3:t.includes("MODERATE")?2:t.includes("LOW")?1:0},de={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},he=(a,t)=>{if(t==="default")return a;const i=[...a];return t==="name"?i.sort((s,d)=>s.packageName.localeCompare(d.packageName)):t==="updateType"?i.sort((s,d)=>(de[d.updateType]??0)-(de[s.updateType]??0)||s.packageName.localeCompare(d.packageName)):i.sort((s,d)=>ce(d)-ce(s)||s.packageName.localeCompare(d.packageName)),i},Z=a=>`${a.ecosystem}|${a.file}:${String(a.line)}|${a.name}`,A=a=>`${a.catalogName} ${a.packageName}`,Y=a=>{const t=new Map;for(const i of a){const s=t.get(i.catalogName);s?s.push(i):t.set(i.catalogName,[i])}return t},G=(a,t,i)=>{let s=a;if(t!=="all"&&(s=t==="security"?s.filter(d=>d.vulnerabilities&&d.vulnerabilities.length>0||d.socketReport&&d.socketReport.alerts.length>0):s.filter(d=>d.updateType===t)),i){const d=i.toLowerCase();s=s.filter(h=>h.packageName.toLowerCase().includes(d))}return s};class ze{#e;#l=new Set;#t;#s;#i=null;constructor(t,i=null,s=[]){this.#t=t,this.#s=s,i&&(this.#i=new Map(i.recommendations.map(d=>[d.package,d]))),this.#e={aiResult:i,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(s.map(d=>Z(d))),checkedEntries:new Set(t.map(d=>A(d))),ecosystemEntries:s,entries:t,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:Y(t),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=()=>this.#e;subscribe=t=>(this.#l.add(t),()=>{this.#l.delete(t)});getFilteredEntries(){return he(G(this.#t,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(t){if(t===this.#e.sortMode)return;const i=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,s=he(G(this.#t,this.#e.filterType,this.#e.filterText),t),d=i?Math.max(0,s.findIndex(h=>h.packageName===i)):0;this.#r({...this.#e,selectedIndex:d,sortMode:t})}cycleSortMode(){const t=_.indexOf(this.#e.sortMode),i=_[(t+1)%_.length]??"default";this.setSortMode(i)}getRecommendation(t){return this.#i?.get(t)}getCheckedEntries(){return this.#t.filter(t=>this.#e.checkedEntries.has(A(t)))}getCheckedEcosystemEntries(){return this.#s.filter(t=>this.#e.checkedEcosystemKeys.has(Z(t)))}toggleEcosystemCheck(t){const i=new Set(this.#e.checkedEcosystemKeys);i.has(t)?i.delete(t):i.add(t),this.#r({...this.#e,checkedEcosystemKeys:i})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#s.map(t=>Z(t)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(t){const i=this.getFilteredEntries(),s=Math.max(0,Math.min(t,i.length-1));s!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:s})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:t})}setFilterType(t){if(t!==this.#e.filterType){const i=G(this.#t,t,this.#e.filterText);this.#r({...this.#e,entries:i,filterType:t,groupedByCatalog:Y(i),selectedIndex:0})}}setFilter(t){const i=G(this.#t,this.#e.filterType,t);this.#r({...this.#e,entries:i,filterText:t,groupedByCatalog:Y(i),selectedIndex:0})}setFilterActive(t){if(t!==this.#e.filterActive)if(t)this.#r({...this.#e,filterActive:!0});else{const i=G(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:i,filterActive:!1,filterText:"",groupedByCatalog:Y(i),selectedIndex:0})}}toggleCheck(t){const i=A(t),s=new Set(this.#e.checkedEntries);s.has(i)?s.delete(i):s.add(i),this.#r({...this.#e,allChecked:s.size===this.#t.length,checkedEntries:s})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(t=>A(t)))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const t=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:t.length},phase:"applying"})}updateApplyProgress(t){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:t}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(t){this.#r({...this.#e,error:t,phase:"error"})}#r(t){this.#e=t;for(const i of this.#l)try{i()}catch{}}}const be={major:"red",minor:"yellow",patch:"green"},Te={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Se={critical:"red",high:"red",low:"gray",medium:"yellow"},Ee={critical:"red",high:"red",low:"green",medium:"yellow"},ve={defer:"gray",review:"yellow",skip:"red",update:"green"},Re=({changelogUrl:a,entry:t,focused:i,recommendation:s,scrollRef:d})=>{const h=i?"white":"gray";if(!t)return e.jsx(l,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No package selected"})});const f=be[t.updateType]??"white",y=t.vulnerabilities&&t.vulnerabilities.length>0,p=t.socketReport?.score.overall??0,j=t.socketReport?ue(p):"gray";return e.jsxs(l,{borderColor:h,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsx(l,{flexShrink:0,paddingTop:1,paddingX:2,children:e.jsx(r,{bold:!0,color:"white",children:t.displayName??t.packageName})}),e.jsxs(fe,{flexGrow:1,flexShrink:1,paddingX:2,ref:d,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[e.jsx(r,{}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Current:"})}),e.jsx(r,{children:t.currentRange})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Target:"})}),e.jsx(r,{children:t.newRange}),e.jsxs(r,{bold:!0,color:f,children:[" ","(",t.updateType,")"]})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Version:"})}),e.jsx(r,{children:t.targetVersion})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:t.kind==="ecosystem"?"Source:":"Catalog:"})}),e.jsx(r,{color:t.kind==="ecosystem"?"cyan":void 0,children:t.catalogName})]}),t.acceptedRisk&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{color:"gray",children:"── "}),e.jsx(r,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),e.jsxs(l,{flexDirection:"column",paddingLeft:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Reason: "}),e.jsx(r,{children:t.acceptedRisk.reason})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Accepted: "}),e.jsx(r,{children:t.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),y&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"red",children:"SECURITY"}),e.jsx(r,{}),t.vulnerabilities.map(n=>e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{gap:1,children:[e.jsxs(r,{bold:!0,color:Te[n.severity]??"gray",children:["⚠"," ",n.severity]}),e.jsx(r,{bold:!0,children:n.id})]}),e.jsx(l,{paddingLeft:2,children:e.jsx(r,{children:n.summary})}),e.jsxs(l,{gap:2,paddingLeft:2,children:[n.cvssScore!==void 0&&e.jsxs(r,{dimColor:!0,children:["CVSS:",String(n.cvssScore)]}),n.fixedVersions.length>0&&e.jsxs(r,{dimColor:!0,children:["Fixed in:",n.fixedVersions.join(", ")]})]})]},n.id))]}),t.socketReport&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Overall: "}),e.jsxs(r,{bold:!0,color:j,children:[String(Math.round(p*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Supply Chain: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.supplyChain*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Quality: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.quality*100)),"%"]})]})]}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Maintenance: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.maintenance*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Vulnerability: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.vulnerability*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"License: "}),e.jsxs(r,{children:[t.socketReport.license||"unknown"," ","(",String(Math.round(t.socketReport.score.license*100)),"%)"]})]})]}),t.socketReport.alerts.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsxs(r,{bold:!0,color:"yellow",children:["⚠"," ",String(t.socketReport.alerts.length)," ","alert",t.socketReport.alerts.length===1?"":"s",":"]}),t.socketReport.alerts.map(n=>e.jsxs(l,{gap:1,paddingLeft:2,children:[e.jsxs(r,{bold:!0,color:Se[n.severity]??"gray",children:["[",n.severity.toUpperCase(),"]"]}),e.jsx(r,{children:n.type}),e.jsxs(r,{dimColor:!0,children:["(",n.category,")"]})]},n.key))]})]}),s&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"AI ANALYSIS"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Action: "}),e.jsx(r,{bold:!0,color:ve[s.action]??"white",children:s.action})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Risk: "}),e.jsx(r,{bold:!0,color:Ee[s.riskLevel]??"white",children:s.riskLevel})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Effort: "}),e.jsx(r,{bold:!0,children:s.effort})]})]}),s.reason&&e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{children:s.reason})}),s.breakingChanges.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Breaking changes:"}),s.breakingChanges.map((n,I)=>e.jsxs(r,{children:[" ","•"," ",n]},String(I)))]})]}),a&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"CHANGELOG"}),e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{color:"cyan",underline:!0,children:a})})]}),e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LINKS"}),e.jsx(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:t.kind==="ecosystem"?e.jsx(r,{color:"cyan",underline:!0,children:t.detailUrl??t.displayName??t.packageName}):e.jsxs(r,{color:"cyan",underline:!0,children:["https://npmx.dev/",t.packageName]})})]}),!s&&t.kind!=="ecosystem"&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"GUIDANCE"}),e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.updateType==="major"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),e.jsx(r,{dimColor:!0,children:" Review the changelog before updating."}),e.jsx(r,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),t.updateType==="minor"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),e.jsx(r,{dimColor:!0,children:" Generally safe to update."})]}),t.updateType==="patch"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),e.jsx(r,{dimColor:!0,children:" Safe to update."})]}),!s&&e.jsx(r,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},Ae={major:"red",minor:"yellow",patch:"green"},Ie=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],De=({checked:a,entry:t,isSelected:i})=>{const s=Ae[t.updateType]??"white",d=t.vulnerabilities&&t.vulnerabilities.length>0,h=t.socketReport&&t.socketReport.alerts.length>0,f=!!t.acceptedRisk,y=a?"☑":"☐",p=t.socketReport?`${String(Math.round(t.socketReport.score.overall*100))}%`:"",j=t.socketReport?ue(t.socketReport.score.overall):"gray";return e.jsxs(l,{flexShrink:0,height:1,children:[e.jsx(r,{children:i?">":" "}),e.jsxs(r,{color:a?"white":"gray",children:[" ",y," "]}),d||h?e.jsx(r,{color:f?"gray":"red",children:f?"✓ ":"⚠ "}):e.jsx(r,{children:" "}),e.jsx(l,{flexGrow:1,children:e.jsxs(r,{bold:i,inverse:i,wrap:"truncate",children:[t.displayName??t.packageName,f?" [ack]":""]})}),p&&e.jsxs(r,{color:j,children:[" ",p]}),e.jsxs(r,{dimColor:!0,children:[" ",t.currentRange]}),e.jsxs(r,{dimColor:!0,children:[" ","→"," "]}),e.jsxs(r,{children:[t.newRange," "]}),e.jsx(r,{bold:!0,color:s,children:t.updateType})]})},Me=({count:a,ecosystem:t=!1,name:i})=>e.jsxs(l,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{color:t?"cyan":void 0,dimColor:!t,children:[t?"◈":"▼"," "]}),e.jsx(r,{bold:!0,color:t?"cyan":"white",children:i.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",a,")"]}),t&&e.jsxs(r,{color:"cyan",dimColor:!0,children:[" ","ci/cd refs"]})]}),Ne=({checkedEntries:a,entries:t,filterActive:i,filteredOutCount:s,filterText:d,filterType:h,focused:f,groupedByCatalog:y,isDryRun:p,onViewportHeightChange:j,scrollOffset:n,selectedIndex:I,totalCatalogEntries:D,totalChecked:E,totalEntries:H,viewportHeight:L})=>{const P=f?"white":"gray",{measuredHeight:m,ref:v}=ke(L,j);let F=0,S=0,M=0,R=0;for(const x of t)x.updateType==="major"?F++:x.updateType==="minor"?S++:M++,(x.vulnerabilities&&x.vulnerabilities.length>0||x.socketReport&&x.socketReport.alerts.length>0)&&R++;const C=[];F>0&&C.push(`${F} major`),S>0&&C.push(`${S} minor`),M>0&&C.push(`${M} patch`),R>0&&C.push(`${R} vulnerable`);const N=C.length>0?` (${C.join(", ")})`:"",w=t.filter(x=>x.kind==="ecosystem").length,k=t.length-w;let O=0;for(const x of t)a.has(A(x))&&O++;const U=[];let $=0;for(const[x,b]of y){U.push(e.jsx(Me,{count:b.length,ecosystem:b[0]?.kind==="ecosystem",name:x},`hdr-${x}`));for(const T of b){const W=$;U.push(e.jsx(De,{checked:a.has(A(T)),entry:T,isSelected:W===I},A(T))),$++}}let B=0;for(const[,x]of y)B+=2+x.length;const V=B>m&&m>0;return e.jsxs(l,{borderColor:P,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(l,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[w>0?k:H,E>0?`/${E}`:""," ",w>0?"pkgs":"outdated",N,D>E?` · ${D-E} dupes`:""]}),w>0&&e.jsxs(r,{color:"cyan",children:[" ","◈",w," ","ci/cd"]}),!p&&O>0&&e.jsxs(r,{dimColor:!0,children:[" ","—",O," ","selected"]})]}),e.jsx(l,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(Ce,{isFocused:f,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:()=>{},showIndex:!1,value:h,children:Ie.map(({id:x,label:b})=>e.jsx(we,{name:x,children:b},x))})}),i&&e.jsxs(l,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:d}),e.jsx(r,{inverse:!0,children:" "})]}),s>0&&e.jsx(l,{flexShrink:0,paddingX:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",s," ","package",s===1?"":"s"," ","filtered out by target constraint — press"," ",e.jsx(r,{bold:!0,color:"white",children:"f"})," ","to view"]})}),e.jsxs(l,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:v,children:[e.jsx(l,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(l,{flexDirection:"column",marginTop:-n,children:U})}),V&&e.jsx(l,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(ye,{contentHeight:B,placement:"inset",scrollOffset:n,style:"block",viewportHeight:m})})]},`list-${h}-${d}`)]})},Be=100,Le=40,Pe=10,Fe=[],K=["all","major","minor","patch","security"],Qe=({autoExitSeconds:a=0,changelogUrls:t,checkedCount:i=0,filteredOutEntries:s=Fe,isDryRun:d,store:h,totalCatalogEntries:f=0})=>{const{exit:y}=je(),{columns:p,rows:j}=ae(),n=g.useSyncExternalStore(h.subscribe,h.getSnapshot),[I,D]=g.useState(!1),[E,H]=g.useState(!1),L=g.useRef(null),P=g.useRef(null),m=g.useRef(null),v=g.useRef(null),[F,S]=g.useState(0),[M,R]=g.useState(!1),[C,N]=g.useState(!1),w=g.useMemo(()=>h.getFilteredEntries(),[n.entries,n.filterType,n.filterText,n.sortMode]),k=w[n.selectedIndex]??null,O=k?h.getRecommendation(k.packageName):void 0,U=k&&t?t.get(k.packageName):void 0,$=g.useCallback(o=>{let c=0,u=0;for(const[,Q]of n.groupedByCatalog){c+=2;for(let oe=0;oe<Q.length;oe++){if(u===o)return c;c+=1,u++}}return c},[n.groupedByCatalog]),B=Math.max(1,j-8-(n.filterActive?1:0)),[V,x]=g.useState(B),b=V>0?V:B,T=g.useCallback(o=>{const c=$(o);S(u=>c>u+b-2?Math.max(0,c-b+2):c<u+1?Math.max(0,c-1):u)},[$,b]);if(g.useEffect(()=>{m.current?.scrollToTop()},[k?.packageName]),ge((o,c)=>{if(o==="c"&&c.ctrl){y();return}if(!C){if(E){c.escape||o==="f"||o==="q"?H(!1):c.downArrow||o==="j"?P.current?.scrollBy(1):(c.upArrow||o==="k")&&P.current?.scrollBy(-1);return}if(M){o==="u"||c.return?(R(!1),h.startApply(),y(h.getCheckedEntries())):c.escape||o==="q"?R(!1):c.downArrow||o==="j"?v.current?.scrollBy(1):c.upArrow||o==="k"?v.current?.scrollBy(-1):c.pageDown?v.current?.scrollBy(5):c.pageUp&&v.current?.scrollBy(-5);return}if(I){c.escape||o==="?"?D(!1):o==="q"?(D(!1),N(!0)):c.downArrow||o==="j"?L.current?.scrollBy(1):(c.upArrow||o==="k")&&L.current?.scrollBy(-1);return}if(o==="?"){D(!0);return}if(o==="q"){N(!0);return}if(c.tab){h.setFocusedPanel(n.focusedPanel==="list"?"detail":"list");return}if(n.focusedPanel==="list"&&(c.leftArrow||c.rightArrow)){const u=K.indexOf(n.filterType),Q=c.rightArrow?(u+1)%K.length:(u-1+K.length)%K.length;S(0),m.current?.scrollToTop(),h.setFilterType(K[Q]);return}if(o==="f"&&s.length>0){H(u=>!u);return}if(n.filterActive){if(c.escape){h.setFilterActive(!1);return}if(c.return){h.setFilterActive(!1);return}if(c.backspace){S(0),h.setFilter(n.filterText.slice(0,-1));return}if(o&&!c.ctrl&&!c.meta){S(0),h.setFilter(n.filterText+o);return}return}if(n.focusedPanel==="list"){if(c.downArrow||o==="j"){const u=Math.min(n.selectedIndex+1,w.length-1);h.setSelectedIndex(u),T(u);return}if(c.upArrow||o==="k"){const u=Math.max(n.selectedIndex-1,0);h.setSelectedIndex(u),T(u);return}if(c.pageDown){const u=Math.min(n.selectedIndex+10,w.length-1);h.setSelectedIndex(u),T(u);return}if(c.pageUp){const u=Math.max(n.selectedIndex-10,0);h.setSelectedIndex(u),T(u);return}if(c.home){h.setSelectedIndex(0),S(0);return}if(c.end){const u=w.length-1;h.setSelectedIndex(u),T(u);return}if(o===" "||c.return){k&&h.toggleCheck(k);return}if(o==="a"){h.toggleAll();return}if(o==="s"){h.cycleSortMode(),T(h.getSnapshot().selectedIndex);return}if(o==="/"){h.setFilterActive(!0);return}if(o==="u"&&!d&&n.checkedEntries.size>0){R(!0);return}if(c.rightArrow){h.setFocusedPanel("detail");return}return}if(n.focusedPanel==="detail"){if(c.escape||c.leftArrow){h.setFocusedPanel("list");return}if(c.downArrow||o==="j"){m.current?.scrollBy(1);return}if(c.upArrow||o==="k"){m.current?.scrollBy(-1);return}if(c.pageDown){m.current?.scrollBy(10);return}if(c.pageUp){m.current?.scrollBy(-10);return}if(c.home){m.current?.scrollToTop();return}c.end&&m.current?.scrollToBottom()}}},{isActive:!0}),p<Le||j<Pe)return e.jsx(l,{alignItems:"center",height:j,justifyContent:"center",width:p,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",p,"x",j,")"]})});const W=p>=Be,q=[e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]},"sp"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:"ALL"})]},"a")];!d&&n.checkedEntries.size>0&&q.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"green",children:"u"}),e.jsx(r,{dimColor:!0,children:"APPLY"})]},"u")),s.length>0&&q.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"yellow",children:"f"}),e.jsxs(r,{dimColor:!0,children:["FILTERED (",s.length,")"]})]},"fo")),q.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"lr"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"SEARCH"})]},"f"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t"));const ee=e.jsx(l,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsx(l,{flexWrap:"wrap",gap:2,paddingX:1,children:q})}),re=e.jsxs(J,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:L,title:"KEYBOARD SHORTCUTS",visible:I,width:52,children:[e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(l,{children:[e.jsx(l,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"SELECTION"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Space"]}),e.jsx(r,{dimColor:!0,children:" Toggle check on package"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","a"]}),e.jsx(r,{dimColor:!0,children:" Toggle check all"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","s"]}),e.jsx(r,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","←→"]}),e.jsx(r,{dimColor:!0,children:" Switch filter tab"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]}),s.length>0&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","f"]}),e.jsx(r,{dimColor:!0,children:" View filtered-out packages"})]})]}),e.jsxs(l,{flexDirection:"column",children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),!d&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","u"]}),e.jsx(r,{dimColor:!0,children:" Apply selected updates"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),X=h.getCheckedEntries(),z=X.filter(o=>o.updateType==="major").length,xe=e.jsxs(l,{alignItems:"center",flexDirection:"column",children:[z>0&&e.jsx(l,{marginBottom:1,marginTop:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",z," ","major update",z===1?"":"s"," ","— review breaking changes"]})}),e.jsxs(r,{dimColor:!0,children:["Press"," ",e.jsx(r,{bold:!0,color:"white",children:"u"})," ","or"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),te=e.jsx(J,{footer:xe,scrollRef:v,title:`Apply ${X.length} update${X.length===1?"":"s"}?`,visible:M,width:70,children:X.map(o=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",o.displayName??o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))}),le=s.length>0?e.jsx(J,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"f"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:P,title:`${s.length} PACKAGE${s.length===1?"":"S"} FILTERED BY TARGET`,visible:E,width:70,children:e.jsxs(l,{flexDirection:"column",children:[e.jsx(l,{marginBottom:1,children:e.jsxs(r,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",e.jsx(r,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),s.map(o=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))]})}):null,se=e.jsx(Ne,{checkedEntries:n.checkedEntries,entries:w,filterActive:n.filterActive,filteredOutCount:s.length,filterText:n.filterText,filterType:n.filterType,focused:n.focusedPanel==="list",groupedByCatalog:n.groupedByCatalog,isDryRun:d,onViewportHeightChange:x,scrollOffset:F,selectedIndex:n.selectedIndex,totalCatalogEntries:f,totalChecked:i,totalEntries:w.length,viewportHeight:b}),ie=e.jsx(Re,{changelogUrl:U,entry:k,focused:n.focusedPanel==="detail",recommendation:O,scrollRef:m});if(W){const o=Math.floor(p*.35);return e.jsxs(l,{flexDirection:"column",height:j,width:p,children:[e.jsxs(l,{flexDirection:"row",flexGrow:1,children:[e.jsx(l,{flexGrow:1,children:se}),e.jsx(l,{width:o,children:ie})]}),ee,te,le,e.jsx(ne,{autoExitSeconds:a||3,onCancel:()=>{N(!1)},visible:C}),re]})}const pe=Math.floor(j*.55);return e.jsxs(l,{flexDirection:"column",height:j,width:p,children:[e.jsx(l,{height:pe,children:se}),e.jsx(l,{flexGrow:1,children:ie}),ee,te,le,e.jsx(ne,{autoExitSeconds:a||3,onCancel:()=>{N(!1)},visible:C}),re]})};export{ze as U,Qe as b,Z as e,We as u};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import{createRequire as Ut}from"node:module";import{t as fe,g as jt,p as G,b as Rt,i as Ae,a as Bt,h as Wt,c as zt,u as Se}from"./package-version-DjHDww_5.js";let Vt;const Dt=t=>(Vt??=Ut(import.meta.url))(t),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Tt=t=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[e,n]=ne.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ne.getBuiltinModule(t)}return Dt(t)},{createRequire:Ce}=Tt("node:module"),Ft=16,ge=32,qt=64,j=128,he="positionals";let Gt;const Ht=t=>(Gt??=Ce(import.meta.url))(t),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jt=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,n]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ie.getBuiltinModule(t)}return Ht(t)},{createRequire:at}=Jt("node:module"),Kt=globalThis.process??Object.create(null),Me={versions:{}},Ee=new Proxy(Kt,{get(t,e){if(e in t)return t[e];if(e in Me)return Me[e]}}),Yt=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
-
`),Xt=(t,e,n,i)=>{const s={column:0,line:-1,...t.start},o={...s,...t.end},c=s.line,a=s.column,u=o.line,r=o.column;let l=Math.max(c-(n+1),0),d=Math.min(e.length,u+i);c===-1&&(l=0),u===-1&&(d=e.length);const p=u-c,f={};if(p)for(let h=0;h<=p;h++){const g=h+c;if(!a)f[g]=!0;else if(h===0){const $=e[g-1]?.length;f[g]=[a,($??0)-a+1]}else if(h===p)f[g]=[0,r];else{const $=e[g-h]?.length;f[g]=[0,$]}}else a===r?f[c]=a?[a,0]:!0:f[c]=[a,(r??0)-(a??0)];return{end:d,markerLines:f,start:l}},Qt=Ee.platform==="win32"&&!Ee.env?.WT_SESSION?">":"❯",Zt=(t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:h=>h,marker:h=>h,message:h=>h,...n?.color}},s=typeof e.start.column=="number";let o=(t.includes("\r")?Yt(t):t).split(`
|
|
3
|
-
`);typeof i.tabWidth=="number"&&t.includes(" ")&&(o=o.map(h=>h.replaceAll(" "," ".repeat(i.tabWidth))));const{end:c,markerLines:a,start:u}=Xt(e,o,i.linesAbove,i.linesBelow),r=String(c).length,{gutter:l,marker:d,message:p}=i.color;let f=o.slice(u,c).map((h,g)=>{const $=u+1+g,w=a[$],y=String($).padStart(r),x=!a[$+1],N=` ${y}${i.showGutter?" |":""}`;if(w){let k="";if(Array.isArray(w)){const I=h.replaceAll(/[^\t]/g," ").slice(0,Math.max(w[0]-1,0)),O=w[1]||1;k=[`
|
|
4
|
-
`,i.prefix+l(N.replaceAll(/\d/g," "))," ",I,d("^").repeat(O)].join(""),x&&i.message&&(k+=` ${p(i.message)}`)}return[i.prefix+d(Qt),l(N),h.length>0?` ${h}`:"",k].join("")}return`${i.prefix} ${l(N)}${h.length>0?` ${h}`:""}`}).join(`
|
|
5
|
-
`);return i.message&&!s&&(f=`${i.prefix+" ".repeat(r+1)+i.message}
|
|
6
|
-
${f}`),f},en=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&en.set("AggregateError",AggregateError);let tn;const nn=t=>(tn??=at(import.meta.url))(t),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,on=t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,n]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return oe.getBuiltinModule(t)}return nn(t)};on("node:util");const sn=()=>Ee.env?.DEBUG==="true",J=(t,...e)=>{if(sn()){const n=e.map(i=>typeof i=="function"?i():i);console.debug(`error:parse-stacktrace: ${t}`,...n)}},K="<unknown>",rn=/^(?:node:internal\/|node:|internal\/)/,an=t=>t!==void 0&&rn.test(t),ln=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,cn=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,un=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,pn=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,hn=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,dn=/in\s(.*)\s\(at\s(.+)\)\sat/,fn=/^(?:.*@)?(.*):(\d+):(\d+)$/,mn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,gn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wn=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Pe=/\(error: ([^)]*)\)/,yn=/at\s/,vn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,$n=/Error: |AggregateError:/,lt=/^Anonymous function$/,xn=/^\s*in\s.*/,bn=/^.*?\s*at\s.*/,Nn=/^.*?\s*@.*|\[native code\]/,ct=(t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:K,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},ut=(t,e)=>{const n=un.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},An=t=>{const e=dn.exec(t);if(e){J(`parse nested node error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]??K,raw:t,type:void 0}}const n=hn.exec(t);if(n){J(`parse node error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(yn,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??K,raw:t,type:t.startsWith("internal")?"internal":void 0};return ut(i,`${n[2]}:${n[3]}:${n[4]}`),i}},En=t=>{const e=ln.exec(t);if(e){J(`parse chrome error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,o;if(i){const r=cn.exec(t);if(r){const l=vn.exec(r[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):r[2]&&(e[2]=r[1]),r[2]&&(s={column:r[4]?+r[4]:void 0,file:r[2],line:r[3]?+r[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const l=pn.exec(t);l&&(o={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0},s={column:l[6]?+l[6]:void 0,file:l[1],line:l[5]?+l[5]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[c,a]=ct(e[1]?e[1].replace(lt,"<anonymous>"):K,e[2]),u={column:e[4]?+e[4]:void 0,evalOrigin:s,file:a,line:e[3]?+e[3]:void 0,methodName:c,raw:t,type:i?"eval":n?"native":an(a)?"internal":void 0};return o?(u.column=o.column,u.file=o.file,u.line=o.line):ut(u,`${a}:${e[3]}:${e[4]}`),u}},kn=(t,e)=>{const n=mn.exec(t);if(n){J(`parse gecko error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),s=i&&n[3]&&gn.exec(n[3]);let o;i&&s&&(n[3]=s[1],o={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=s[2]);const[c,a]=ct(n[1]?n[1].replace(lt,"<anonymous>"):K,n[3]);let u;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?u=e.column:!i&&n[5]&&(u=+n[5]);let r;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?r=e.line:n[4]&&(r=+n[4]),{column:u,evalOrigin:o,file:a,line:r,methodName:c,raw:t,type:i?"eval":a.includes("[native code]")?"native":void 0}}},Cn=(t,e)=>{const n=wn.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return J(`parse firefox error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||K,raw:t,type:void 0}},On=t=>{const e=fn.exec(t);if(e)return J(`parse react android native error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:K,raw:t,type:void 0}},pt=(t,{filter:e,frameLimit:n=50}={})=>{const i=t;let s=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
|
|
7
|
-
`).map(o=>(Pe.test(o)?o.replace(Pe,"$1"):o).trim()).filter(o=>!$n.test(o)&&o!=="eval code");return e&&(s=s.filter(o=>e(o))),s=s.slice(0,n),s.reduce((o,c,a)=>{if(!c||c.length>1024)return o;let u;if(xn.test(c))u=An(c);else if(bn.test(c))u=En(c);else if(Nn.test(c)){let r;if(a===0){const l=t,d=l.columnNumber,p=l.lineNumber,f=l.line,h=l.column;d||p?r={column:d,line:p,type:"firefox"}:(f||h)&&(r={column:h,line:f,type:"safari"})}u=Cn(c,r)??kn(c,r)}else u=On(c);return u?o.push(u):J(`parse error stack line: "${c}"`,"not parser found"),o},[])};let _n;const In=t=>(_n??=at(import.meta.url))(t),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Oe=t=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[e,n]=Z.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Z.getBuiltinModule(t)}return In(t)},{existsSync:Ln,readFileSync:Sn}=Oe("node:fs"),{relative:Mn,resolve:Ue,sep:Pn}=Oe("node:path"),{cwd:Un}=Z,{fileURLToPath:Vn}=Oe("node:url"),Y=(t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),ht=t=>t.replaceAll("\\","/"),Dn=(t,e)=>{const n=t.replace("async file:","file:");return ht(Mn(e,n.startsWith("file:")?Vn(n):n))},Tn=(t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},dt=(t,{color:e,hideErrorTitle:n,indentation:i,prefix:s},o)=>`${Y(s,i,o)}${Tn(t,n,e)}
|
|
8
|
-
`,ft=(t,{color:e,indentation:n,prefix:i},s)=>{if(t.hint===void 0)return;const o=Y(i,n,s);let c="";if(Array.isArray(t.hint))for(const a of t.hint)c+=`${o+a}
|
|
9
|
-
`;else c+=o+t.hint;return e.hint(c)},mt=(t,e)=>{if(!e||t.file===void 0||t.line===void 0)return{trace:t};try{const n=e({column:t.column,file:t.file,line:t.line});return n?{source:n.source,trace:{...t,column:n.column??t.column,file:n.file??t.file,line:n.line??t.line}}:{trace:t}}catch{return{trace:t}}},_e=(t,e,n=0)=>{const{color:i,cwd:s,displayShortPath:o,indentation:c,prefix:a}=e,{trace:u}=mt(t,e.sourceMap),r=o?Dn(u.file,s):ht(u.file),{fileLine:l,method:d}=i;return`${Y(a,c,n)}at ${u.methodName?`${d(u.methodName)} `:""}${l(r)}:${l(u.line?.toString()??"")}`},jn=(t,e)=>{if(e.allowAllFilePaths)return!0;const n=Ue(e.cwd),i=Ue(n,t);return i===n||i.startsWith(n+Pn)},gt=(t,e,n)=>{const{color:i,indentation:s,linesAbove:o,linesBelow:c,prefix:a,showGutter:u,showLineNumbers:r,tabWidth:l}=e,{source:d,trace:p}=mt(t,e.sourceMap);if(p.file===void 0)return;let f;if(d===void 0){const h=p.file.replace("file://","");if(!jn(h,e)||!Ln(h))return;f=Sn(h,"utf8")}else f=d;return Zt(f,{start:{column:p.column,line:p.line}},{color:i,linesAbove:o,linesBelow:c,prefix:Y(a,s,n),showGutter:u,showLineNumbers:r,tabWidth:l})},wt=(t,e,n)=>{if(t.errors.length===0)return;let i=`${Y(e.prefix,e.indentation,n)}Errors:
|
|
10
|
-
|
|
11
|
-
`,s=!0;for(const o of t.errors)s?s=!1:i+=`
|
|
12
|
-
|
|
13
|
-
`,i+=vt(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
14
|
-
${i}`},yt=(t,e,n,i=new Set)=>{i.add(t);let s=`${Y(e.prefix,e.indentation,n)}Caused by:
|
|
15
|
-
|
|
16
|
-
`;const o=t.cause;s+=dt(o,e,n);const c=pt(o).shift(),a=ft(o,e,n);if(a&&(s+=`${a}
|
|
17
|
-
`),c&&(s+=_e(c,e,n),!e.hideErrorCauseCodeView)){const u=gt(c,e,n);u!==void 0&&(s+=`
|
|
18
|
-
${u}`)}if(o instanceof AggregateError){const u=wt(o,e,n);u!==void 0&&(s+=`
|
|
19
|
-
${u}`)}return o.cause&&(s+=i.has(o)?`
|
|
20
|
-
${Y(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:`
|
|
21
|
-
${yt(o,e,n+1,i)}`),`
|
|
22
|
-
${s}`},Rn=(t,e)=>(t.length>0?`
|
|
23
|
-
`:"")+t.map(n=>_e(n,e)).join(`
|
|
24
|
-
`),vt=(t,e,n)=>{const i={allowAllFilePaths:!1,cwd:Un(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:c=>c,gutter:c=>c,hint:c=>c,marker:c=>c,message:c=>c,method:c=>c,title:c=>c,...e.color}},s=pt(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),o=s.shift();return[e.hideMessage?void 0:dt(t,i,n),ft(t,i,n),o?_e(o,i,n):void 0,o&&!i.hideErrorCodeView?gt(o,i,n):void 0,t instanceof AggregateError?wt(t,i,n):void 0,t.cause===void 0?void 0:yt(t,i,n),s.length>0?Rn(s,i):void 0].filter(Boolean).join(`
|
|
25
|
-
`)},Bn=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return vt(t,e,0)};class te extends Error{loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:s,name:o,stack:c,title:a}){super(s,{cause:e}),this.title=a,this.name=o,this.stack=c??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}class E extends te{code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}}const R=new Uint32Array(65536),Wn=(t,e)=>{const n=t.length,i=e.length,s=1<<n-1;let o=-1,c=0,a=n,u=n;for(;u--;)R[t.charCodeAt(u)]|=1<<u;for(u=0;u<i;u++){let r=R[e.charCodeAt(u)];const l=r|c;r|=(r&o)+o^o,c|=~(r|o),o&=r,c&s&&a++,o&s&&a--,c=c<<1|1,o=o<<1|~(l|c),c&=l}for(u=n;u--;)R[t.charCodeAt(u)]=0;return a},zn=(t,e)=>{const n=e.length,i=t.length,s=[],o=[],c=Math.ceil(n/32),a=Math.ceil(i/32);for(let h=0;h<c;h++)o[h]=-1,s[h]=0;let u=0;for(;u<a-1;u++){let h=0,g=-1;const $=u*32,w=Math.min(32,i)+$;for(let y=$;y<w;y++)R[t.charCodeAt(y)]|=1<<y;for(let y=0;y<n;y++){const x=R[e.charCodeAt(y)],N=o[y/32|0]>>>y&1,k=s[y/32|0]>>>y&1,I=x|h,O=((x|k)&g)+g^g|x|k;let m=h|~(O|g),v=g&O;m>>>31^N&&(o[y/32|0]^=1<<y),v>>>31^k&&(s[y/32|0]^=1<<y),m=m<<1|N,v=v<<1|k,g=v|~(I|m),h=m&I}for(let y=$;y<w;y++)R[t.charCodeAt(y)]=0}let r=0,l=-1;const d=u*32,p=Math.min(32,i-d)+d;for(let h=d;h<p;h++)R[t.charCodeAt(h)]|=1<<h;let f=i;for(let h=0;h<n;h++){const g=R[e.charCodeAt(h)],$=o[h/32|0]>>>h&1,w=s[h/32|0]>>>h&1,y=g|r,x=((g|w)&l)+l^l|g|w;let N=r|~(x|l),k=l&x;f+=N>>>i-1&1,f-=k>>>i-1&1,N>>>31^$&&(o[h/32|0]^=1<<h),k>>>31^w&&(s[h/32|0]^=1<<h),N=N<<1|$,k=k<<1|w,l=k|~(y|N),r=N&y}for(let h=d;h<p;h++)R[t.charCodeAt(h)]=0;return f},Fn=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Wn(t,e):zn(t,e)};let qn;const Gn=t=>(qn??=Ce(import.meta.url))(t),se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hn=t=>{if(typeof se<"u"&&se.versions&&se.versions.node){const[e,n]=se.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return se.getBuiltinModule(t)}return Gn(t)},{createRequire:Jn}=Hn("node:module"),$t=String.raw,Ve=$t`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Kn=()=>new RegExp($t`\p{RI}{2}|(?)${Ve}(?:\u200D${Ve})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const hs=/^[ \t]*(?:\r\n|\r|\n)/,ds=/(?:\r\n|\r|\n)[ \t]*$/,fs=/^(?:[\r\n]|$)/,ms=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,gs=/^[ \t]*[\r\n][ \t\r\n]*$/,ws=/\r\n|\n|\r/g,ys=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,vs=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,z=Kn(),Yn=/[-_./\s]+/g,de=/(\u001B\[[0-9;]*[a-z])/i,De=new RegExp("\\p{Script=Arabic}","u"),Xn=new RegExp("\\p{Script=Bengali}","u"),X=new RegExp("\\p{Script=Cyrillic}","u"),Qn=new RegExp("\\p{Script=Devanagari}","u"),Zn=new RegExp("\\p{Script=Ethiopic}","u"),we=new RegExp("\\p{Script=Greek}","u"),Te=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ei=new RegExp("\\p{Script=Gujarati}","u"),ti=new RegExp("\\p{Script=Gurmukhi}","u"),je=new RegExp("\\p{Script=Hangul}","u"),Re=new RegExp("\\p{Script=Hebrew}","u"),ni=new RegExp("\\p{Script=Hiragana}","u"),Be=new RegExp("\\p{Script=Han}","u"),ii=new RegExp("\\p{Script=Kannada}","u"),oi=new RegExp("\\p{Script=Katakana}","u"),si=new RegExp("\\p{Script=Khmer}","u"),ri=new RegExp("\\p{Script=Lao}","u"),P=new RegExp("\\p{Script=Latin}","u"),ai=new RegExp("\\p{Script=Malayalam}","u"),li=new RegExp("\\p{Script=Myanmar}","u"),ci=new RegExp("\\p{Script=Oriya}","u"),ui=new RegExp("\\p{Script=Sinhala}","u"),pi=new RegExp("\\p{Script=Tamil}","u"),hi=new RegExp("\\p{Script=Telugu}","u"),di=new RegExp("\\p{Script=Thai}","u"),fi=new RegExp("\\p{Script=Tibetan}","u"),We=/[\u02BB\u02BC\u0027]/u,mi=t=>t.replace(z,"");class gi{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}}let wi;const yi=t=>(wi??=Jn(import.meta.url))(t),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vi=t=>{if(typeof re<"u"&&re.versions&&re.versions.node){const[e,n]=re.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return re.getBuiltinModule(t)}return yi(t)},{stripVTControlCharacters:$i}=vi("node:util"),ye=new gi(1e3),xi=/[.*+?^${}()|[\]\\]/g,bi=t=>{const e=t.join("");if(ye.has(e)){const s=ye.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(xi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return ye.set(e,i),i},Ni=t=>{const e=[];let n=0,i;for(z.lastIndex=0;(i=z.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=z.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},Ai=/[ČŠŽĐ]/i,xt=new Uint8Array(128),bt=new Uint8Array(128),Nt=new Uint8Array(128);for(let t=0;t<128;t++)xt[t]=t>=65&&t<=90?1:0,bt[t]=t>=97&&t<=122?1:0,Nt[t]=t>=48&&t<=57?1:0;const ve=t=>xt[t],ze=t=>bt[t],$e=t=>Nt[t],B=(t,e,n,i,s)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const f of c)if(f(t[0])){o=!0;break}if(!o&&!n)return[t];const a=[...t],u=[];let r=a[0],l="other";const d=Object.entries(e);for(const f of d){const[h,g]=f;if(g(a[0])){l=h;break}}let p=n&&i?a[0]===a[0].toLocaleUpperCase(i):!1;for(let f=1;f<a.length;f++){const h=a[f];let g="other";for(const y of d){const[x,N]=y;if(N(h)){g=x;break}}const $=n&&i?h===h.toLocaleUpperCase(i):!1;let w=!1;s?w=s(l,g,p,$,h,f,a):(l!==g&&l!=="other"&&g!=="other"&&(w=!0),n&&g!=="other"&&!p&&$&&(w=!0)),w?(u.push(r),r=h):r+=h,l=g,n&&(p=$)}return r&&r.length>0&&u.push(r),u.length>0?u:[t]},Ei=(t,e,n,i)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return i.push(s),e+s.length;return e},At=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],s=t.length;for(let o=1;o<s;o++){const c=Ei(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const a=t.codePointAt(o-1),u=t.codePointAt(o),r=a&&a<128&&ve(a),l=u&&u<128&&ve(u),d=a&&a<128&&ze(a),p=a&&a<128&&$e(a),f=u&&u<128&&$e(u);if(d&&l){i.push(t.slice(n,o)),n=o;continue}if(p&&!f||!p&&f){i.push(t.slice(n,o)),n=o;continue}if(f&&!p){let h=!1,g=!1;if(o+1<s){const $=t.codePointAt(o+1);h=$&&$<128&&ve($),g=$&&$<128&&$e($)}if(!g&&h){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<s){const h=t.codePointAt(o+1),g=h&&h<128&&ze(h);if(r&&l&&g){const $=t.slice(n,o+1);e.has($)||(i.push(t.slice(n,o)),n=o)}}}return n<s&&i.push(t.slice(n)),i.filter(o=>o!=="")},Et=(t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],l=r.length,d=[];let p=r[0],f=r[0]===r[0].toLocaleUpperCase(e),h=f,g=f?0:-1;for(let $=1;$<l;$++){const w=r[$],y=w===w.toLocaleUpperCase(e);if(y===f)p+=w;else if(y)p&&p.length>0&&(d.push(p),p=w),h=!0,g=$;else{if(h&&$-g>1){const x=r[$-1],N=p.slice(0,-1);N&&N.length>0&&d.push(N),p=x+w}else p+=w;h=!1,g=-1}f=y}return p&&p.length>0&&d.push(p),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!X.test(t)&&!P.test(t))return[t];const r=[...t],l=r.length,d=[];let p=r[0];const f=r[0];let h;X.test(f)?h=1:P.test(f)?h=2:h=0;let g=f===f.toLocaleUpperCase(e);for(let w=1;w<l;w++){const y=r[w];let x;X.test(y)?x=1:P.test(y)?x=2:x=0;const N=y===y.toLocaleUpperCase(e);h!==x&&(h===1||h===2)&&(x===1||x===2)||x===h&&!g&&N?(d.push(p),p=y):p+=y,h=x,g=N}p&&p.length>0&&d.push(p);const $=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&P.test(d[w])&&X.test(d[w+1][0])?($.push(d[w]+d[w+1]),w+=1):$.push(d[w]);return $}if(e.startsWith("el")){if(!we.test(t)&&!P.test(t))return[t];const r=[];Te.lastIndex=0;let l;for(;(l=Te.exec(t))!==null;)r.push(l[0]);r.length===0&&r.push(t);const d=[];if(r.length===1){const p=r[0];if(!p||!we.test(p[0])||p.length===1)return[p??t]}for(const p of r){if(!p)continue;if(!we.test(p[0])||p.length===1){d.push(p);continue}const f=p.length;let h=p[0],g=p[0]===p[0].toLocaleUpperCase(e);for(let $=1;$<f;$++){const w=p[$],y=w===w.toLocaleUpperCase(e);!g&&y?(d.push(h),h=w):h+=w,g=y}h&&d.push(h)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),l=r?{hiragana:p=>ni.test(p),kanji:p=>Be.test(p),katakana:p=>oi.test(p),latin:p=>P.test(p)}:{hangul:p=>je.test(p),latin:p=>P.test(p)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const p=B(t,l,!1,e,(h,g)=>h==="hiragana"&&g==="katakana"||h==="katakana"&&g==="hiragana"||h==="hiragana"&&g==="latin"||h==="katakana"&&g==="latin"||h==="kanji"&&g==="latin"||h==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const h of p){const g=h;g.length===1&&d.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[t]}return B(t,l,!1,e,(p,f)=>p==="hangul"&&f==="latin"||p==="latin"&&f==="hangul")}if(e.startsWith("sl")){const r=[...t],l=r.length,d=[];let p=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<l;h++){const g=r[h],$=g===g.toLocaleUpperCase(e),w=Ai.test(g),y=h<l-1&&r[h+1]===r[h+1].toLocaleUpperCase(e);!f&&$||w&&y?(d.push(p),p=g,w&&y&&(d.push(p),p="")):p+=g,f=$}return p&&p.length>0&&d.push(p),d}if(e.startsWith("zh"))return B(t,{han:r=>Be.test(r),latin:r=>P.test(r)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=l=>Re.test(l)||De.test(l);return B(t,{latin:l=>P.test(l),rtl:l=>r(l)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=l=>Qn.test(l)||Xn.test(l)||ei.test(l)||ti.test(l)||ii.test(l)||pi.test(l)||hi.test(l)||ai.test(l)||ui.test(l)||di.test(l)||ri.test(l)||fi.test(l)||li.test(l)||Zn.test(l)||si.test(l)||ci.test(l);return B(t,{indic:l=>r(l),latin:l=>P.test(l)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return B(t,{cyrillic:r=>X.test(r),latin:r=>P.test(r)},!0,e);if(["ar","fa","he"].includes(e))return B(t,{latin:r=>P.test(r),rtl:r=>Re.test(r)||De.test(r)},!1,e);if(e.startsWith("ko"))return B(t,{hangul:r=>je.test(r),latin:r=>P.test(r)},!1,e);if(e.startsWith("uz")){if(!X.test(t)&&!P.test(t))return[t];const r=[...t],l=r.length,d=[];let p=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<l;h++){const g=r[h],$=g===g.toLocaleUpperCase(e);if(We.test(g)||We.test(r[h-1])){p+=g;continue}!f&&$?(d.push(p),p=g):p+=g,f=$}return p&&p.length>0&&d.push(p),d}const s=[...t],o=s.length,c=[];let a=s[0],u=s[0]===s[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){c.push(r),a=s[r.length],u=a===a.toLocaleUpperCase(e);break}for(let r=1;r<o;r++){const l=s[r],d=l===l.toLocaleUpperCase(e);let p=0;for(const f of n)if(t.startsWith(f,r)){c.push(a,f),p=f.length,a="";const h=f.at(-1);h&&(u=h===h.toLocaleUpperCase(e));break}if(p>0){r+=p-1;continue}!u&&d?(c.push(a),a=l):a+=l,u=d}return a&&c.push(a),c},ki=(t,e,n)=>{const i=[],s=de.test(t)?t.split(de).filter(Boolean):[t];for(const o of s){const c=o;if(de.test(c))i.push(c);else{z.lastIndex=0;const a=z.test(c)?Ni(c).filter(Boolean):[c];for(const u of a)if(z.lastIndex=0,z.test(u))i.push(u);else if(e){const r=e.toLowerCase().split("-")[0];i.push(...Et(u,r,n))}else i.push(...At(u,n))}}return i},Ci=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:s=[],locale:o,normalize:c=!1,separators:a,stripAnsi:u=!1,stripEmoji:r=!1}=e,l=new Set([...s].toSorted((w,y)=>y.length-w.length));let d=t;u&&(d=$i(d)),r&&(d=mi(d));let p;Array.isArray(a)?p=bi(a):a instanceof RegExp?p=a:p=Yn;const f=[];let h=d;const g=p.flags.includes("g")?p:new RegExp(p.source,`${p.flags}g`);for(;h.length>0;){const w=g.exec(h);if(!w){h===".."?f.push(".."):h==="."?f.push("."):h.length>0&&f.push(h);break}const y=w.index,x=w[0],N=x.length,k=h.slice(0,y),I=h.slice(y+N);if(x.startsWith("../"))f.push(".."),h=h.slice(y+3);else if(x.startsWith("./"))f.push("."),h=h.slice(y+2);else if(y===0&&x==="..")f.push(".."),h=h.slice(2);else if(y===0&&x===".")f.push("."),h=h.slice(1);else{k.length>0&&f.push(k);let O=0;for(;(O=x.indexOf("../",O))!==-1;)f.push(".."),O+=3;for(O=0;(O=x.indexOf("./",O))!==-1;)(O===0||x[O-1]!==".")&&f.push("."),O+=2;let m=I;for(;m.startsWith("../");)f.push(".."),m=m.slice(3);for(;m.startsWith("./");)f.push("."),m=m.slice(2);if(m===".."){f.push("..");break}else if(m==="."){f.push(".");break}else h=m}g.lastIndex=0}if(f.length===0){const w=d.split(p).filter(Boolean);f.push(...w)}let $=[];for(const w of f)n||i?$.push(...ki(w,o,l)):o?$.push(...Et(w,o,l)):$.push(...At(w,l));return c&&($=$.map(w=>l.has(w)?w:o&&w===w.toLocaleUpperCase(o)?w[0]+w.slice(1).toLocaleLowerCase(o):w.toUpperCase()===w&&!l.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),$};let Oi;const _i=t=>(Oi??=Ce(import.meta.url))(t),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ii=t=>{if(typeof ae<"u"&&ae.versions&&ae.versions.node){const[e,n]=ae.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ae.getBuiltinModule(t)}return _i(t)},{writeFile:Li,stat:Si,rm:Mi,readFile:Fe,readdir:Pi,mkdir:Ui,access:Vi}=Ii("node:fs/promises"),ce=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let F=class extends E{commandName;constructor(t,e=[]){const n=`Command "${t}" not found${e.length>0?`. Did you mean: ${e.join(", ")}?`:""}`;super(n,"COMMAND_NOT_FOUND",{commandName:t,suggestions:e}),this.name="CommandNotFoundError",this.commandName=t,e.length>0&&(this.hint=`Try one of these commands: ${e.join(", ")}`)}},kt=class extends E{option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}},Di=class extends E{unknownOptions;constructor(t,e){const n=t.join(", "),i=`Found unknown ${t.length===1?"option":"options"}: ${n}`;super(i,"UNKNOWN_OPTION",{suggestions:e,unknownOptions:t}),this.name="UnknownOptionError",this.unknownOptions=t,e&&e.length>0&&(this.hint=`Did you mean: ${e.join(", ")}?`)}},Ti=class extends E{pluginName;constructor(t,e,n){super(`Plugin "${t}" error: ${e}`,"PLUGIN_ERROR",{originalError:n,pluginName:t}),this.name="PluginError",this.pluginName=t,n&&(this.cause=n)}},ji=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(t){this.logger=t}hasPlugins(){return this.plugins.size>0}register(t){if(this.initialized)throw new Error(`Cannot register plugin "${t.name}" after initialization`);if(this.plugins.has(t.name))throw new Error(`Plugin "${t.name}" is already registered`);fe().CEREBRO_OUTPUT_LEVEL===String(j)&&this.logger.debug(`registering plugin: ${t.name}`),this.plugins.set(t.name,t),this.cachedDependencyOrder=void 0}async init(t){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const e=this.getDependencyOrder();this.logger.debug(`initializing ${String(e.length)} plugin(s)...`);for(const n of e)if(typeof n.init=="function"){this.logger.debug(`initializing plugin: ${n.name}`);try{await n.init(t)}catch(i){const s=new Ti(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(s.message),s}}this.initialized=!0}async executeLifecycle(t,e,n){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const i=this.getDependencyOrder();for(const s of i){const o=s[t];if(typeof o=="function"){this.logger.debug(`executing ${t} hook for plugin: ${s.name}`);try{await(t==="afterCommand"?o(e,n):o(e))}catch(c){throw this.logger.error(`Error in ${t} hook for plugin "${s.name}":`,c),c}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const i of n)if(typeof i.onError=="function"){this.logger.debug(`executing error handler for plugin: ${i.name}`);try{await i.onError(t,e)}catch(s){this.logger.error(`Error in error handler for plugin "${i.name}":`,s)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=s=>{if(e.has(s))return;if(n.has(s))throw new Error(`Circular dependency detected involving plugin "${s}"`);const o=this.plugins.get(s);if(!o)throw new Error(`Plugin "${s}" not found`);if(n.add(s),o.dependencies)for(const c of o.dependencies)i(c);n.delete(s),e.add(s),t.push(o)};for(const s of this.plugins.keys())i(s);return this.cachedDependencyOrder=t,t}validateDependencies(){for(const t of this.plugins.values())if(t.dependencies){for(const e of t.dependencies)if(!this.plugins.has(e))throw new Error(`Plugin "${t.name}" depends on "${e}" which is not registered`)}}};const le=t=>t.type?.name==="Boolean",Ri=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},qe=t=>(le(t)||(t.typeLabel=t.typeLabel??Ri(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Bi=new RegExp(/^-([^\d-])$/),Wi=new RegExp(/^--(\S+)/),zi=new RegExp(/^-([^\d-]{2,})$/),Fi=t=>Bi.test(t)||Wi.test(t)||zi.test(t),qi=(t,e)=>{const n=e[0]&&Fi(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}};class Ie extends te{optionName;value;constructor(e,n,i){super({hint:`Pass a valid ${i} value for '${e}'.`,message:`Invalid ${i} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,Ie.prototype)}}let Gi=class Ct extends te{optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,Ct.prototype)}},Ge=class Ot extends te{optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,Ot.prototype)}},Hi=class _t extends te{value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,_t.prototype)}};class S extends te{constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,S.prototype)}}const He=(t,e,n)=>{const i=Number(t);if(e&&Number.isNaN(i)&&String(t).trim().toLowerCase()!=="nan")throw new Ie(n??"",String(t),"Number");return i},Je=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Ke=t=>t===Number||typeof t=="function"&&t.name==="Number",Ye=t=>t===String||typeof t=="function"&&t.name==="String",Ji=(t,e,n={})=>{const{optionName:i,strictTypes:s}=n;return Array.isArray(t)?Je(e)?t.map(Boolean):Ke(e)?t.map(o=>He(o,s,i)):Ye(e)?t.map(String):t.map(o=>e(String(o))):t===null?null:Je(e)?!!t:Ke(e)?He(t,s,i):Ye(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},_=(t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},Ki=/-([a-z])/g,Yi=/^\d+$/,ue=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Xi=t=>t.codePointAt(0)===95,Xe=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],Qe=t=>t==="__proto__"||t==="constructor"||t==="prototype",Ze=(t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},et=(t,e,n,i,s)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??s?.get(c)}return o},Qi=(t,e,n,i)=>{const s=n.debug??!1;_(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(s,"Starting argument resolution","resolver"),_(s,"Tokens:","resolver",t),_(s,"Definitions:","resolver",e),_(s,"Processing tokens...","resolver");const o=new Map,c=new Map,a=n.caseInsensitive?new Map:void 0,u=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,l=n.camelCase?new Map:void 0;for(const m of e)if(o.set(m.name,m),m.alias&&c.set(m.alias,m),n.caseInsensitive&&a&&(a.set(m.name.toLowerCase(),m),m.alias&&u&&u.set(m.alias.toLowerCase(),m)),n.camelCase&&r&&l){const v=m.name.replaceAll(Ki,(b,L)=>L.toUpperCase());r.set(m.name,v),l.set(v,m.name)}const d=Object.create(null),p=Object.create(null),f=[],h=[],g=new Set;let $=!1;const w=e.find(m=>m.defaultOption),y=e.some(m=>m.group),x=e.find(m=>m.type===Number);for(let m=0;m<t.length;m++){const v=t[m];if(v.kind==="option-terminator"){d._unknown=i.slice(v.index),$=!0;break}if(v.kind==="option"&&v.name){let b=et(v.name,o,c,a,u);!b&&v.value===void 0&&x&&Yi.test(v.name)&&(b=x,v.value=v.name,v.name=x.name);let L=!1;if(!b&&n.negation&&v.value===void 0&&v.name.startsWith("no-")){const C=v.name.slice(3),U=et(C,o,c,a,u);U?.type&&ue(U.type)&&(b=U,L=!0)}const A=b?b.name:v.name,M=b?.multiple,V=b?.lazyMultiple;if(Object.hasOwn(p,A)&&p[A]!==void 0&&!M&&!V&&!n.partial)throw new Gi(A);if(!b&&n.partial){const C=v.rawName??`--${v.name}${v.value!==void 0&&v.inlineValue?`=${v.value}`:""}`;f.push({index:v.index,value:C});continue}if(!b&&n.stopAtFirstUnknown){d._unknown=i.slice(v.index);break}if(!b&&!n.partial)throw new Ge(v.name);if(v.value===void 0){const C=t[m+1],U=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,D=C&&b&&!(b.type&&ue(b.type))&&(C.kind==="positional"||U),Pt=b&&b.defaultOption&&!b.multiple&&!b.lazyMultiple;if(D&&(!b?.defaultOption||Pt))if(M){let T=m+1;const me=[];for(;T<t.length&&(t[T].kind==="positional"||t[T].kind==="option"&&!("name"in t[T])&&t[T].value!==void 0);)me.push(t[T].value),g.add(t[T].index),T++;p[A]=p[A]===void 0?me:Xe(p[A],me),m=T-1}else V?(Ze(p,A,C.value,!0),g.add(C.index),m++):(p[A]=C.value,g.add(C.index),m++);else b?.type&&ue(b.type)?Ze(p,A,!L,M):p[A]=M?[]:null}else{let{value:C}=v;if(b?.type&&ue(b.type))switch(C){case"":{if(n.partial){p._unknown??=[];const D=`${v.rawName??`--${v.name}`}${v.value?`=${v.value}`:""}`;p._unknown.push(D),h.push({index:v.index,value:D}),C=!0}else throw new Ge(v.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const U=[C];if(M){let D=m+1;for(;D<t.length&&t[D].kind==="positional";)U.push(t[D].value),g.add(t[D].index),D++;m=D-1}p[A]===void 0?p[A]=M||V?U:C:M||V?p[A]=Xe(p[A],U):p[A]=C}}else if(v.kind==="positional"&&n.stopAtFirstUnknown&&!g.has(v.index)&&!w){_(s,`Found unconsumed positional token at index ${String(v.index)}, stopping processing`,"resolver"),d._unknown=i.slice(v.index);break}}for(const[m,v]of Object.entries(p)){const b=o.get(m);b&&(b.multiple||b.lazyMultiple)&&!Array.isArray(v)&&(p[m]=[v])}const N=m=>m.kind==="option"&&!o.has(m.name??"")&&!c.has(m.name??"")&&(!n.caseInsensitive||!a?.has(m.name?.toLowerCase()??"")&&!u?.has(m.name?.toLowerCase()??""));let k=-1,I=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!$&&(k=t.findIndex(m=>N(m)),k!==-1&&(I=t[k].index)),w){const m=[],v=[];for(const b of t)b.kind==="positional"&&!g.has(b.index)&&b.index<I&&(m.push(b.value),v.push(b));if(m.length>0){const b=p[w.name],L=w.multiple??w.lazyMultiple;b===void 0?L?(v.forEach(A=>g.add(A.index)),p[w.name]=m):(g.add(v[0].index),p[w.name]=m[0]):L&&(v.forEach(A=>g.add(A.index)),p[w.name]=Array.isArray(b)?[...m,...b]:[...m,b])}}if(!n.partial){for(const m of t)if(m.kind==="positional"&&!g.has(m.index))throw new Hi(i[m.index])}if(n.partial&&!n.stopAtFirstUnknown){const m=[...f];if(p._unknown)for(const v of h)m.push({index:v.index,value:v.value});for(const v of t)v.kind==="positional"&&!g.has(v.index)&&m.push({index:v.index,value:i[v.index]});m.length>0&&(m.sort((v,b)=>v.index-b.index),d._unknown=m.map(v=>v.value))}if(n.stopAtFirstUnknown&&!$){const m=t.findIndex(b=>b.kind==="positional"&&!g.has(b.index));let v=-1;if(k!==-1&&m!==-1?v=Math.min(k,m):k!==-1?v=k:m!==-1&&(v=m),v>=0){const b=t[v].index;d._unknown=i.slice(b)}}else f.length>0&&!n.partial&&(d._unknown=f.map(m=>m.value));for(const[m,v]of Object.entries(p)){const b=n.camelCase?r?.get(m)??m:m,L=o.get(m);L?.type?d[b]=Ji(v,L.type,{optionName:L.name,strictTypes:n.strictTypes}):d[b]=v===void 0?null:v}for(const m of e){const v=n.camelCase?r?.get(m.name)??m.name:m.name;!(v in d)&&m.defaultValue!==void 0&&(m.multiple??m.lazyMultiple?d[v]=Array.isArray(m.defaultValue)?[...m.defaultValue]:[m.defaultValue]:d[v]=m.defaultValue)}if(y){const m={},v={},b={};for(const A of e)if(A.group){const M=Array.isArray(A.group)?A.group:[A.group];for(const V of M)Qe(V)||(m[V]??={})}for(const A of Object.keys(d))if(!Xi(A)){v[A]=d[A];let M=A;n.camelCase&&(M=l?.get(A)??A);const V=o.get(M);if(V?.group){const C=Array.isArray(V.group)?V.group:[V.group];for(const U of C)Qe(U)||m[U]&&(m[U][A]=d[A])}else b[A]=d[A]}const L={_all:v};for(const[A,M]of Object.entries(m))L[A]=M;Object.keys(b).length>0&&(L._none=b),d._unknown&&(L._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,L)}const O=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));return _(s,"Final parsed result:","resolver",O),O},ee="-".codePointAt(0),H="=",Zi=H.codePointAt(0),eo="--",to="-",no="--",It=t=>t.length>2&&t.startsWith(no),io=t=>It(t)&&!t.includes(H,3),oo=t=>It(t)&&t.includes(H,3),so=t=>{if(t.length!==2||t.codePointAt(0)!==ee||t.codePointAt(1)===ee)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},ro=t=>!(t.length<=2||t.codePointAt(0)!==ee||t.codePointAt(1)===ee),ao=t=>{const e=[];let n=0,i=[],s=0,o=-1,c=0;for(;s<i.length||n<t.length;){let a;if(s<i.length?(a=i[s],s++):(a=t[n],n++),c>0?c--:o++,a===eo){e.push({index:o,kind:"option-terminator"});const u=[...i.slice(s),...t.slice(n)],r=u.map((l,d)=>({index:o+d+1,kind:"positional",value:l}));e.push(...r),o+=u.length;break}if(so(a)){const u=a.charAt(1);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(ro(a)&&!a.includes(H)){const u=[];let r="",l=!1;for(let d=1;d<a.length;d++){const p=a.charAt(d);l?r+=p:p.codePointAt(0)===Zi?l=!0:u.push(`${to}${p}`)}if(l)if(u.length>0){const d=u.pop();u.push(`${d}=${r}`)}else u.push(r);i=s<i.length?[...u,...i.slice(s)]:u,s=0,c=u.length;continue}if(io(a)){const u=a.slice(2);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(oo(a)){const u=a.indexOf(H),r=a.slice(2,u),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}if(a.length>2&&a.codePointAt(0)===ee&&a.codePointAt(1)!==ee&&a.includes(H)){const u=a.indexOf(H),r=a.charAt(1),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}e.push({index:o,kind:"positional",value:a})}return e},lo=/\d/,co=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",uo=t=>typeof t=="function",po=(t,e,n)=>{const i=n?.debug??!1;_(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,o=new Set,c=new Set,a=new Set;let u=0;for(const r of t){if(_(i,"Checking definition:","validation",r),!r.name)throw _(i,"Validation failed: name is required","validation"),new S("Invalid option definition: name is required");if(typeof r.name!="string")throw new S("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new S("Invalid option definition: name cannot be empty");const l=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&c.has(l))throw new S(`Invalid option definition: duplicate name '${r.name}'`);if(o.has(r.name)||e&&a.has(l))throw new S(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&c.add(l),r.alias!==void 0){if(typeof r.alias!="string")throw new S("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new S("Invalid option definition: alias must be a single character");if(lo.test(r.alias))throw new S("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new S('Invalid option definition: alias cannot be "-"');const d=e?r.alias.toLowerCase():"";if(o.has(r.alias)||e&&a.has(d))throw new S(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&c.has(d))throw new S(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);o.add(r.alias),e&&a.add(d)}if(r.defaultOption&&(u++,r.type!==void 0&&co(r.type)))throw new S("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&uo(r.type)))throw new S("Invalid option definition: invalid type")}if(u>1)throw _(i,"Validation failed: multiple defaultOptions not allowed","validation"),new S("Invalid option definition: multiple defaultOptions not allowed");_(i,"Validation completed successfully","validation")};function ho(t,e={}){const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const s=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",s),po(s,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);o=o.filter(l=>!r.has(l))}_(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(r=>{if(r.startsWith("--")){const l=r.indexOf("="),d=(l===-1?r.slice(2):r.slice(2,l)).toLowerCase();return l===-1?`--${d}`:`--${d}${r.slice(l)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const l=r.slice(1).split("=",2),d=l[0],p=l[1];if(!d)return r;const f=d.toLowerCase();return p===void 0?`-${f}`:`-${f}=${p}`}return r}));const a=ao(c.map(String));_(n,"Tokenized arguments:","index",a);const u=Qi(a,s,i,o);return _(n,"Command-line-args parsing completed","index"),u}class fo{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let xe=class extends E{commandName;constructor(t,e,n){super(`Failed to load command "${t}": ${e}`,"COMMAND_LOADER_ERROR",{commandName:t,reason:e}),this.name="CommandLoaderError",this.commandName=t,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",n!==void 0&&(this.cause=n)}};const mo=/^-{1,2}(\w+)(=(.+))?$/,Lt=(t,e,n,i)=>{const s=mo.exec(t);if(s===null)return{};const o=s[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(a=>a.name===o||a.alias===o);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},tt=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},go=new Set(["0","1","false","true"]),wo=(t,e,n,i)=>{if(e.length===0||t.length===0)return{};const s=(o,c)=>{const{argName:a,argValue:u,option:r}=Lt(c,e,n,i),{lastOption:l}=o;return r&&le(r)&&u&&a?o.partial[a]=tt(u,r):o.lastName&&l&&le(l)&&go.has(c)&&(o.partial[o.lastName]=tt(c,l)),{lastName:a,lastOption:r,partial:o.partial}};return t.reduce(s,{partial:{}}).partial},yo=new Set(["0","1","false","true"]),vo=(t,e,n,i)=>{if(e.length===0||t.length===0)return t;const s=(o,c)=>{const{argValue:a,option:u}=Lt(c,e,n,i),{lastOption:r}=o;if(r&&le(r)&&yo.has(c)){const{args:l}=o;return{args:l.slice(0,-1)}}return u&&le(u)&&a?{args:o.args}:{args:[...o.args,c],lastOption:u}};return t.reduce(s,{args:[]}).args},$o=t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},xo=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},bo=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return xo(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},No=/_./g,Ao=/^[A-Z]/,Eo=t=>t.toLowerCase().replaceAll(No,e=>e[1]?.toUpperCase()??e).replace(Ao,e=>e.toLowerCase()),ko=t=>{if(!t||t.length===0)return{};const e={},n=fe();for(const i of t){const s=n[i.name],o=bo(i,s),c=o===void 0?i.defaultValue:o,a=Eo(i.name);e[a]=c}return e},Co=t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const s=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of s)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},St=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new xe(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new xe(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new xe(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},Oo=(t,e,n,i)=>{const s=new fo(t.name,t),{_all:o,_unknown:c,positionals:a}=e,u=Object.keys(n).length>0?{...o,...n}:o;he in u&&delete u[he],s.argument=a?.[he]??[],s.rawUnknown=[...c??[]];const r=Object.keys(i).length>0;return s.options=r?{...u,...i}:u,s.env=ko(t.env),s},_o=(t,e,n)=>{const i=t.options??[],s=i.length>0;let o=$o(s?[...i,...n]:n);if(o.length>0){for(const r of o)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:he,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,a;if(s){const{optionMapByAlias:r,optionMapByName:l}=Co(i);c=vo(e,i,l,r),a=wo(e,i,l,r)}else c=e,a={};const u=ho(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:a,parsedArgs:u}},Q=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await St(t))(e);let Io=class extends E{commandName;missingOptions;constructor(t,e){super(`Command "${t}" is missing required options: ${e.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:t,missingOptions:e}),this.name="CommandValidationError",this.commandName=t,this.missingOptions=e,this.hint=`Provide the following required options: ${e.join(", ")}`}},Lo=class extends E{choices;option;value;constructor(t,e,n){super(`Invalid value "${e}" for option "${t}". Allowed values: ${n.join(", ")}`,"INVALID_CHOICE",{choices:n,option:t,value:e}),this.name="InvalidChoiceError",this.option=t,this.value=e,this.choices=n,this.hint=`Use one of: ${n.map(i=>`--${t} ${i}`).join(", ")}`}};const nt=(t,e,n=!1)=>{const i=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}i.push(s)}return i},So=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Fn(t,e)<=t.length/3,W=(t,e)=>{const n=t.toLowerCase();return e.filter(i=>So(i.toLowerCase(),n))},Mo=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const s=i.startsWith("--");let o=`Found unknown ${s?"option":"argument"} "${i}"`;if(s){const c=W(i.replace("--",""),(e.options??[]).map(a=>a.name));if(c.length>0){const[a,...u]=c.map(r=>`--${r}`);o+=u.length>0?`, did you mean ${a??""} or ${u.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
26
|
-
`))},Po=(t,e,n)=>{const i=n.__requiredOptions__,s=i?nt(i,e,!0):nt(t,e,!1);if(s.length>0)throw new Io(n.name,s.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&Mo(e,n)},Uo=(t,e,n)=>{const i=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(i.length>0){const s=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(c=>e[c]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(s)throw new kt(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},Vo=(t,e)=>{const n=e.options;if(n)for(const i of n){if(!i.choices||i.choices.length===0)continue;const s=t[i.name];if(s==null)continue;const o=Array.isArray(s)?s:[s];for(const c of o){const a=String(c);if(!i.choices.includes(a))throw new Lo(i.name,a,i.choices)}}},Do=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const o=e.get(s.name)??[];o.push(s),e.set(s.name,o)}if(typeof s.alias=="string"&&s.alias.length>0){const o=n.get(s.alias)??[];o.push(s),n.set(s.alias,o)}else if(Array.isArray(s.alias)){for(const o of s.alias)if(o.length>0){const c=n.get(o)??[];c.push(s),n.set(o,c)}}}const i=[];for(const[s,o]of e)o.length>1&&i.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[s,o]of n)o.length>1&&i.push(`Duplicate option alias "-${s}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
27
|
-
`))},To=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let s=1;s<=e.length;s+=1){const o=e[s-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:s})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},q=t=>t.join(" "),it=(t,e)=>e&&e.length>0?[...e,t]:[t],jo=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Ro=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Bo=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let s="",o="";for(let c=0;c<n;c++){const a=t[c];if(de.test(a)){s?(i.push(s+o+a),s="",o=""):(i.length>0&&i.push(e),s=a);continue}s?(o&&(o+=e),o+=a):(i.length>0&&i.push(e),i.push(a))}return i.join("")},Mt=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Bo(Ci(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(i=>{const s=i,o=s.toLowerCase();return n?(n=!1,jo(o)):Ro(o)}),"")},Wo=/^no-/,zo=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Mt(e.name)})},Fo=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const s=i.name.replace(Wo,"");if(!e.has(s)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:s};n.push(o),e.add(s)}}n.length>0&&t.options.push(...n)},qo=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=Mt(o.name);i.set(c,o)}const s=Object.keys(n).filter(o=>i.has(o));if(s.length!==0)for(const o of s){const c=o.charAt(2);if(!c)continue;const a=c.toLowerCase()+o.slice(3),u=i.get(o);u&&(u.__negated__=!0),n[a]=!n[o],Reflect.deleteProperty(n,o)}},Go=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:i}=t;for(const s of Object.keys(i)){const o=n.get(s);if(o?.implies){const{implies:c}=o;for(const[a,u]of Object.entries(c))i[a]===void 0&&(i[a]=u)}}},Ho=()=>!!process.versions.electron,Jo=()=>Ho()&&!process.defaultApp,Ko=()=>Jo()?0:1,Yo=t=>t.slice(Ko()+1),Xo=" ",Qo=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),Zo=t=>{if(typeof t=="string")return t.split(Xo);const e=Ae();return Qo(t,e)?Yo(t):t},es=t=>{const e=o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),G(1)},n=(o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let a;if(typeof o=="string")a=o;else try{a=JSON.stringify(o)}catch{a=String(o)}t.error(`Promise rejection: ${a}`)}G(1)},i=Se("uncaughtException",e),s=Se("unhandledRejection",n);return()=>{i(),s()}},ot=100,ts=/^[a-z][\w-]*$/i,ke=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new E(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},st=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new E(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},be=(t,e)=>{if(typeof t!="object"||t===null)throw new E(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},pe=t=>{const e=ke(t,"Command name");if(e.length>ot)throw new E(`Command name is too long (maximum ${String(ot)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new E(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!ts.test(e))throw new E(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},ns=new Set([`
|
|
28
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),is=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArgumentLength??1e6;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Argument is too long (maximum ${String(i)} characters)`);if(n.checkDangerousChars){for(const s of t)if(ns.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},rt=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArguments??1e5;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Too many arguments (maximum ${String(i)})`);return t.map(s=>is(s,n))},os=/^-([^\d-])$/,ss=/^--(\S+)/,rs=/^-([^\d-]{2,})$/,Ne=t=>os.test(t)||ss.test(t)||rs.test(t),as={access:(t,e)=>Vi(t,e),mkdir:(t,e)=>Ui(t,e),readdir:t=>Pi(t),readFile:(async(t,e)=>e===void 0?Fe(t):Fe(t,e)),rm:(t,e)=>Mi(t,e),stat:t=>Si(t),writeFile:(t,e,n)=>Li(t,e,n)},ls=(t,e,n)=>{const i=e.indexOf("--"),s=i===-1?new Set:new Set(e.slice(i+1)),o=n.filter(u=>u.startsWith("--")&&u!=="--"&&!s.has(u));if(o.length===0)return;const c=(t.options??[]).map(u=>u.name),a=o.flatMap(u=>W(u.slice(2),c).map(r=>`--${r}`));throw new Di(o,a)};class Le{#t;#e;#u;#p;#f;#m;#A;#E;#k;#$;#C;#x;#O;#_=ge;#h;#n;#i;#o;#s;#r;#g=!1;#I;#L=!1;#w;#y;#v;#l=[];#V(){return this.#w===void 0&&(this.#w=[...this.#i.keys()]),this.#w}#S(){return this.#y===void 0&&(this.#y=[...this.#n.keys()]),this.#y}#a(){return this.#v===void 0&&(this.#v=[...this.#V(),...this.#S()]),this.#v}#M(){return this.#l.length===0?ce:[...ce,...this.#l]}#P(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#b(){if(this.#u===void 0){const e=Zo(this.#e.argv);this.#u=rt(e,{maxArguments:this.#x}),this.#D()}return this.#u}#N(){return this.#$??fe()}#d(e){this.#_=e,this.#N().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){const e=this.#N().CEREBRO_OUTPUT_LEVEL,n=e===void 0?Number.NaN:Number(e);return Number.isNaN(n)?this.#_:n}#D(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#d(Ft),e=!0;break}if(n==="--verbose"||n==="-v"){this.#d(qt),e=!0;break}if(n==="--debug"){this.#d(j),e=!0;break}}e||this.#d(Object.hasOwn(this.#N(),"DEBUG")?j:ge)}#T(){this.#L||(this.#I=es(this.#t),this.#L=!0)}#j(){return{arch:Rt(),argv:this.#b(),cwd:this.#p,env:this.#$??fe(),exit:this.#k??(e=>G(e??0)),platform:jt(),stdin:this.#C}}#U(e,n,i,s){this.#c()===j&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:a}=_o(e,n,this.#M()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),Po(o,r,e);const l=Oo(e,a,c,i);l.runtime=this,l.argv=this.#b(),l.fs=this.#E??as,l.process=this.#j(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const p=e.options.filter(f=>f.name.startsWith("no-"));for(const f of p){const h=f.name.slice(3),g=`--${f.name}`,$=`--${h}`,w=n.includes(g),y=n.includes($);if(w&&y)throw new kt(h,f.name)}}return d&&(qo(l,e),Go(l,e)),Uo(o,l.options,e),Vo(l.options,e),this.#O&&ls(e,n,l.rawUnknown),this.#c()===j&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(l.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(l.argument,null,2))),{arguments_:o,booleanValues:c,commandArgs:r,parsedArgs:a,toolbox:l}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new E("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??Ae(),s=n.cwd??Bt();if(this.#e={...n,argv:i,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new E("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new E("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new E("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new E("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const r=["debug","error","info","log","warn"],l=[],d=this.#e.logger;for(const p of r)typeof d[p]!="function"&&l.push(p);if(l.length>0)throw new E(`Logger object is missing required methods: ${l.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:l});this.#t=this.#e.logger}else this.#t={...console,debug:(...r)=>{this.#c()===j&&console.debug(...r)}};this.#m=this.#e.packageVersion,this.#A=this.#e.packageName,this.#p=this.#e.cwd,this.#s="help",this.#r={};const o=n.fs;if(o!==void 0&&(typeof o!="object"||o===null))throw new E("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const c=n.exit;if(c!==void 0&&typeof c!="function")throw new E("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new E("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const u=n.stdin;if(u!==void 0&&typeof u!="string")throw new E("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#E=n.fs,this.#k=n.exit,this.#$=n.env,this.#C=n.stdin??"",this.#x=n.maxArguments,this.#O=n.strictOptions??!1,this.#d(ge),this.#n=new Map,this.#i=new Map,this.#o=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#m?` v${this.#m}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){be(e,"Command"),pe(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new E(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new E(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?pe(e.alias):st(e.alias,"Command alias").forEach(r=>pe(r))),e.argument&&be(e.argument,"Command argument"),e.options&&be(e.options,"Command options"),e.commandPath&&(st(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{pe(r)}));const s=it(e.name,e.commandPath),o=q(s);if(this.#i.has(o))throw new E(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),u=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!c&&u)throw new E(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)qe(r);if(Do(e),Fo(e),zo(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),c&&a!==void 0)this.#n.set(o,e);else{if(!c&&a!==void 0&&!u){const r=it(a.name,a.commandPath);this.#n.set(q(r),a)}this.#n.set(e.name,e)}if(this.#i.set(o,s),this.#o.set(o,e),this.#P(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===j&&this.#t.debug("adding alias",l),this.#n.has(l))throw new E(`Command alias "${l}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:l,commandName:e.name});this.#n.set(l,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ce.map(o=>o.name)),s=new Set(ce.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new E(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new E(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new E(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",qe(n),this.#l.push(n),this}getGlobalOptions(){return this.#M()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#h?this.#h:(this.#h=new ji(this.#t),this.#h.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#h)}getCliName(){return this.#f}getPackageVersion(){return this.#m}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#p}dispose(){this.#I?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...s}=e;if(!this.#n.has("help")){const{default:y}=await import("../packem_chunks/help-command.js");this.addCommand(new y(this.#n))}const o=this.#S(),c=this.#i;this.#T();const a=this.#b();let u,r=[...a];this.#c()===j&&(this.#t.debug(`process.execPath: ${Wt()}`),this.#t.debug(`process.execArgv: ${zt().join(" ")}`),this.#t.debug(`process.argv: ${Ae().join(" ")}`));const l=To(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!Ne(a[0])&&!Ne(a[1])){const x=[];let N=0;for(;N<a.length;){const I=a[N];if(!I||Ne(I))break;x.push(I),N+=1}const k=q(x);if(x[0]&&!o.includes(x[0])){const I=this.#a(),O=W(k,I);throw new F(k,O)}}let y;try{y=qi([null,...o],[...a])}catch(x){if(x instanceof Error&&x.name==="INVALID_COMMAND"&&"command"in x){const N=x.command,k=this.#a(),I=W(N,k);throw new F(N,I)}throw x}y.command&&(u=[y.command],r=y.argv)}if(!u)if(this.#s)u=[this.#s];else{const y=this.#a();throw new F("",y)}const d=q(u),p=this.#i.get(d);let f;if(p){if(f=this.#o.get(d),!f||q(p)!==d){const y=this.#a(),x=W(d,y);throw new F(d,x)}}else{const y=u.at(-1);if(f=y?this.#n.get(y):void 0,!f){const x=this.#a(),N=W(d,x);throw new F(d,N)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),i?G(1):void 0;const h=r;let g,$;try{({commandArgs:g,toolbox:$}=this.#U(f,h,s,d))}catch(y){if(this.#t.error(y),i)return G(1);throw y}const w=this.getPluginManager();try{!this.#g&&w.hasPlugins()&&(await w.init({cli:this,cwd:this.#p,logger:this.#t}),this.#g=!0),await w.executeLifecycle("execute",$),await w.executeLifecycle("beforeCommand",$);let y;const x=g.global;if(x?.help){const N=this.#n.get("help");if(!N)throw new E("Help command not found","COMMAND_NOT_FOUND");y=await Q(N,$)}else if(x?.version??x?.V){const N=this.#n.get("version");if(!N)throw new E("Version command not found","COMMAND_NOT_FOUND");y=await Q(N,$)}else y=await Q(f,$);return await w.executeLifecycle("afterCommand",$,y),i?G(0):void 0}catch(y){throw await w.executeErrorHandlers(y,$),y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...s}=n;ke(e,"Command name");const o=e.split(" ").filter(Boolean),c=q(o),a=this.#i.get(c)?this.#o.get(c):this.#n.get(e);if(!a){const p=this.#a(),f=W(c||e,p);throw new F(e,f)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new E(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const u=[...rt(i,{maxArguments:this.#x})];this.#c()===j&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#U(a,u,s,c||e),d=this.getPluginManager();try{!this.#g&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#p,logger:this.#t}),this.#g=!0),await d.executeLifecycle("execute",l),await d.executeLifecycle("beforeCommand",l);let p;const f=r.global;if(f?.help){const h=this.#n.get("help");if(!h)throw new E("Help command not found","COMMAND_NOT_FOUND");p=await Q(h,l)}else if(f?.version??f?.V){const h=this.#n.get("version");if(!h)throw new E("Version command not found","COMMAND_NOT_FOUND");p=await Q(h,l)}else p=await Q(a,l);return await d.executeLifecycle("afterCommand",l,p),p}catch(p){throw await d.executeErrorHandlers(p,l),p}}clone(e){const n={...this.#e,...e},i=new Le(this.#f,n);for(const[s,o]of this.#n)i.#n.set(s,o);for(const[s,o]of this.#i)i.#i.set(s,[...o]);for(const[s,o]of this.#o)i.#o.set(s,o);for(const s of this.#l)i.#l.push(s);return i.#s=this.#s,i.#r={...this.#r},i.#P(),i}async getAction(e){ke(e,"Command name");const n=e.split(" ").filter(Boolean),i=q(n),s=this.#i.get(i)?this.#o.get(i):this.#n.get(e);if(!s){const o=this.#a(),c=W(i||e,o);throw new F(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return St(s);throw new E(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}const $s=(t,e)=>new Le(t,e),xs=(t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:i,runtime:s}=n,{concise:o,detailed:c=!1,exitOnError:a=!0,formatter:u,logErrors:r=!0,renderOptions:l={}}=t;if(r)if(u)i.error(u(e));else if(!c&&o?.(e))i.error(e.message);else if(c){const d=s.getCwd(),p=Bn(e,{cwd:d,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...l});i.error(p)}else i.error(e);a&&G(1)},version:"1.0.0"}),bs=async t=>{try{await t.run({shouldExitProcess:!1})}catch{process.exitCode=process.exitCode||1}finally{process.exit(process.exitCode??0)}},Ns={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"],["vis dlx --info create-vite","Always show the first-run panel (size, score, permissions, changelog)"],["vis dlx --yes create-vite my-app","Skip the first-run panel and confirmation"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler66.js"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean},{alias:"y",defaultValue:!1,description:"Skip the first-run info panel and confirmation prompt (also via VIS_DLX_YES — note this auto-approves every package)",name:"yes",type:Boolean},{defaultValue:!1,description:"Always show the first-run info panel (size, security score, permissions, changelog), even for an approved package",name:"info",type:Boolean},{defaultValue:!1,description:"Disable the first-run info panel entirely (also via VIS_DLX_NO_INFO)",name:"no-info",type:Boolean}]};class cs extends Error{isVisUserError=!0;constructor(e,n){super(e,n),this.name="VisUserError"}}const As=t=>t instanceof cs||t instanceof Error&&t.isVisUserError===!0;export{z as L,$s as V,cs as a,ys as b,gs as c,fs as d,Ns as e,ms as f,E as g,As as i,vs as l,ds as n,ws as o,xs as p,bs as r,hs as s};
|