@under_koen/bsm 1.10.2 → 1.11.1
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/dist/index.js +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
var Nn=Object.create;var ps=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var Dn=Object.getPrototypeOf,Fn=Object.prototype.hasOwnProperty;var fi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Mn=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ln(t))!Fn.call(e,r)&&r!==i&&ps(e,r,{get:()=>t[r],enumerable:!(s=On(t,r))||s.enumerable});return e};var ds=(e,t,i)=>(i=e!=null?Nn(Dn(e)):{},Mn(t||!e||!e.__esModule?ps(i,"default",{value:e,enumerable:!0}):i,e));var ys=fi((Cu,xs)=>{"use strict";function Bn(e,t){var i=e;t.slice(0,-1).forEach(function(r){i=i[r]||{}});var s=t[t.length-1];return s in i}function ms(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function gs(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}xs.exports=function(e,t){t||(t={});var i={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(i.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?i.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(g){i.bools[g]=!0});var s={};function r(g){return s[g].some(function(_){return i.bools[_]})}Object.keys(t.alias||{}).forEach(function(g){s[g]=[].concat(t.alias[g]),s[g].forEach(function(_){s[_]=[g].concat(s[g].filter(function(L){return _!==L}))})}),[].concat(t.string).filter(Boolean).forEach(function(g){i.strings[g]=!0,s[g]&&[].concat(s[g]).forEach(function(_){i.strings[_]=!0})});var n=t.default||{},a={_:[]};function o(g,_){return i.allBools&&/^--[^=]+$/.test(_)||i.strings[g]||i.bools[g]||s[g]}function h(g,_,L){for(var I=g,q=0;q<_.length-1;q++){var M=_[q];if(gs(I,M))return;I[M]===void 0&&(I[M]={}),(I[M]===Object.prototype||I[M]===Number.prototype||I[M]===String.prototype)&&(I[M]={}),I[M]===Array.prototype&&(I[M]=[]),I=I[M]}var k=_[_.length-1];gs(I,k)||((I===Object.prototype||I===Number.prototype||I===String.prototype)&&(I={}),I===Array.prototype&&(I=[]),I[k]===void 0||i.bools[k]||typeof I[k]=="boolean"?I[k]=L:Array.isArray(I[k])?I[k].push(L):I[k]=[I[k],L])}function c(g,_,L){if(!(L&&i.unknownFn&&!o(g,L)&&i.unknownFn(L)===!1)){var I=!i.strings[g]&&ms(_)?Number(_):_;h(a,g.split("."),I),(s[g]||[]).forEach(function(q){h(a,q.split("."),I)})}}Object.keys(i.bools).forEach(function(g){c(g,n[g]===void 0?!1:n[g])});var l=[];e.indexOf("--")!==-1&&(l=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var f=0;f<e.length;f++){var p=e[f],d,x;if(/^--.+=/.test(p)){var m=p.match(/^--([^=]+)=([\s\S]*)$/);d=m[1];var S=m[2];i.bools[d]&&(S=S!=="false"),c(d,S,p)}else if(/^--no-.+/.test(p))d=p.match(/^--no-(.+)/)[1],c(d,!1,p);else if(/^--.+/.test(p))d=p.match(/^--(.+)/)[1],x=e[f+1],x!==void 0&&!/^(-|--)[^-]/.test(x)&&!i.bools[d]&&!i.allBools&&(!s[d]||!r(d))?(c(d,x,p),f+=1):/^(true|false)$/.test(x)?(c(d,x==="true",p),f+=1):c(d,i.strings[d]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var y=p.slice(1,-1).split(""),E=!1,b=0;b<y.length;b++){if(x=p.slice(b+2),x==="-"){c(y[b],x,p);continue}if(/[A-Za-z]/.test(y[b])&&x[0]==="="){c(y[b],x.slice(1),p),E=!0;break}if(/[A-Za-z]/.test(y[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(x)){c(y[b],x,p),E=!0;break}if(y[b+1]&&y[b+1].match(/\W/)){c(y[b],p.slice(b+2),p),E=!0;break}else c(y[b],i.strings[y[b]]?"":!0,p)}d=p.slice(-1)[0],!E&&d!=="-"&&(e[f+1]&&!/^(-|--)[^-]/.test(e[f+1])&&!i.bools[d]&&(!s[d]||!r(d))?(c(d,e[f+1],p),f+=1):e[f+1]&&/^(true|false)$/.test(e[f+1])?(c(d,e[f+1]==="true",p),f+=1):c(d,i.strings[d]?"":!0,p))}else if((!i.unknownFn||i.unknownFn(p)!==!1)&&a._.push(i.strings._||!ms(p)?p:Number(p)),t.stopEarly){a._.push.apply(a._,e.slice(f+1));break}}return Object.keys(n).forEach(function(g){Bn(a,g.split("."))||(h(a,g.split("."),n[g]),(s[g]||[]).forEach(function(_){h(a,_.split("."),n[g])}))}),t["--"]?a["--"]=l.slice():l.forEach(function(g){a._.push(g)}),a}});var vs=fi((Pu,Un)=>{Un.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var Es=fi(ft=>{"use strict";var ws=vs(),D=process.env;Object.defineProperty(ft,"_vendors",{value:ws.map(function(e){return e.constant})});ft.name=null;ft.isPR=null;ft.id=null;D.CI!=="false"&&ws.forEach(function(e){let i=(Array.isArray(e.env)?e.env:[e.env]).every(function(s){return Ss(s)});ft[e.constant]=i,i&&(ft.name=e.name,ft.isPR=jn(e),ft.id=e.constant)});ft.isCI=!!(D.CI!=="false"&&(D.BUILD_ID||D.BUILD_NUMBER||D.CI||D.CI_APP_ID||D.CI_BUILD_ID||D.CI_BUILD_NUMBER||D.CI_NAME||D.CONTINUOUS_INTEGRATION||D.RUN_ID||ft.name));function Ss(e){return typeof e=="string"?!!D[e]:"env"in e?D[e.env]&&D[e.env].includes(e.includes):"any"in e?e.any.some(function(t){return!!D[t]}):Object.keys(e).every(function(t){return D[t]===e[t]})}function jn(e){switch(typeof e.pr){case"string":return!!D[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return D[e.pr.env]===t}):e.pr.env in D&&D[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(t){return!!D[t]}):Ss(e.pr);default:return null}}});var kn=ds(ys(),1);import{createPrompt as yu,useState as ui,useKeypress as bu,useMemo as vu}from"@inquirer/core";var A=class{static silent=!1;static silence(){this.silent=!0}static log(...t){this.silent||console.log(...t)}static error(...t){this.silent||console.error(...t)}};var bs={name:"@under_koen/bsm",version:"1.10.2",description:"BSM (Basic Script Manager) is a useful tool that enables you to create clear and concise scripts without cluttering your `package.json` file.",license:"MIT",author:"Koen van Staveren <koen@underkoen.nl>",homepage:"https://github.com/UnderKoen/bsm#readme",repository:{type:"git",url:"https://github.com/UnderKoen/bsm.git"},bugs:{url:"https://github.com/UnderKoen/bsm/issues"},type:"module",main:"dist/index.js",bin:{bsm:"./dist/index.js"},files:["dist"],scripts:{build:"bsm","build:dev":"bsm","build:prod":"bsm","build:watch":"bsm",lint:"bsm",prettier:"bsm",prepublishOnly:"bsm build.prod",test:"bsm","test:cov":"bsm test.cov"},dependencies:{"@inquirer/core":"^10.3.0"},devDependencies:{"@eslint/js":"^9.21.0","@inquirer/core":"^10.3.0","@semantic-release/changelog":"^6.0.3","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.0","@semantic-release/npm":"^13.1.1","@types/minimist":"^1.2.5","@types/node":"^22.13.9","@types/sinon":"^17.0.4","@typescript-eslint/eslint-plugin":"^8.26.0","@typescript-eslint/parser":"^8.26.0","@under_koen/bsm":"^1.9.1",c8:"^10.1.3","ci-info":"^4.1.0","cpy-cli":"^6.0.0",defu:"^6.1.4",esbuild:"^0.25.0",eslint:"^9.21.0","eslint-config-prettier":"^10.0.2",glob:"^11.0.3",globals:"^16.0.0",minimist:"^1.2.8",mlly:"^1.8.0",prettier:"^3.5.3","prettier-package-json":"^2.8.0",rimraf:"^6.0.1","semantic-release":"^25.0.1",sinon:"^21.0.0",tsx:"^4.20.6",typescript:"^5.8.2","typescript-eslint":"^8.26.0",uvu:"^0.5.6"},keywords:["script","scripting"]};var lt=class e{static printHelp(t,i){let s=i._;if(s.length===0)A.log(`
|
|
2
|
+
var Nn=Object.create;var ps=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var Dn=Object.getPrototypeOf,Fn=Object.prototype.hasOwnProperty;var fi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Mn=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ln(t))!Fn.call(e,r)&&r!==i&&ps(e,r,{get:()=>t[r],enumerable:!(s=On(t,r))||s.enumerable});return e};var ds=(e,t,i)=>(i=e!=null?Nn(Dn(e)):{},Mn(t||!e||!e.__esModule?ps(i,"default",{value:e,enumerable:!0}):i,e));var ys=fi((Cu,xs)=>{"use strict";function Bn(e,t){var i=e;t.slice(0,-1).forEach(function(r){i=i[r]||{}});var s=t[t.length-1];return s in i}function ms(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function gs(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}xs.exports=function(e,t){t||(t={});var i={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(i.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?i.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(g){i.bools[g]=!0});var s={};function r(g){return s[g].some(function(_){return i.bools[_]})}Object.keys(t.alias||{}).forEach(function(g){s[g]=[].concat(t.alias[g]),s[g].forEach(function(_){s[_]=[g].concat(s[g].filter(function(L){return _!==L}))})}),[].concat(t.string).filter(Boolean).forEach(function(g){i.strings[g]=!0,s[g]&&[].concat(s[g]).forEach(function(_){i.strings[_]=!0})});var n=t.default||{},a={_:[]};function o(g,_){return i.allBools&&/^--[^=]+$/.test(_)||i.strings[g]||i.bools[g]||s[g]}function h(g,_,L){for(var I=g,q=0;q<_.length-1;q++){var M=_[q];if(gs(I,M))return;I[M]===void 0&&(I[M]={}),(I[M]===Object.prototype||I[M]===Number.prototype||I[M]===String.prototype)&&(I[M]={}),I[M]===Array.prototype&&(I[M]=[]),I=I[M]}var k=_[_.length-1];gs(I,k)||((I===Object.prototype||I===Number.prototype||I===String.prototype)&&(I={}),I===Array.prototype&&(I=[]),I[k]===void 0||i.bools[k]||typeof I[k]=="boolean"?I[k]=L:Array.isArray(I[k])?I[k].push(L):I[k]=[I[k],L])}function c(g,_,L){if(!(L&&i.unknownFn&&!o(g,L)&&i.unknownFn(L)===!1)){var I=!i.strings[g]&&ms(_)?Number(_):_;h(a,g.split("."),I),(s[g]||[]).forEach(function(q){h(a,q.split("."),I)})}}Object.keys(i.bools).forEach(function(g){c(g,n[g]===void 0?!1:n[g])});var l=[];e.indexOf("--")!==-1&&(l=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var f=0;f<e.length;f++){var p=e[f],d,x;if(/^--.+=/.test(p)){var m=p.match(/^--([^=]+)=([\s\S]*)$/);d=m[1];var S=m[2];i.bools[d]&&(S=S!=="false"),c(d,S,p)}else if(/^--no-.+/.test(p))d=p.match(/^--no-(.+)/)[1],c(d,!1,p);else if(/^--.+/.test(p))d=p.match(/^--(.+)/)[1],x=e[f+1],x!==void 0&&!/^(-|--)[^-]/.test(x)&&!i.bools[d]&&!i.allBools&&(!s[d]||!r(d))?(c(d,x,p),f+=1):/^(true|false)$/.test(x)?(c(d,x==="true",p),f+=1):c(d,i.strings[d]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var y=p.slice(1,-1).split(""),E=!1,b=0;b<y.length;b++){if(x=p.slice(b+2),x==="-"){c(y[b],x,p);continue}if(/[A-Za-z]/.test(y[b])&&x[0]==="="){c(y[b],x.slice(1),p),E=!0;break}if(/[A-Za-z]/.test(y[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(x)){c(y[b],x,p),E=!0;break}if(y[b+1]&&y[b+1].match(/\W/)){c(y[b],p.slice(b+2),p),E=!0;break}else c(y[b],i.strings[y[b]]?"":!0,p)}d=p.slice(-1)[0],!E&&d!=="-"&&(e[f+1]&&!/^(-|--)[^-]/.test(e[f+1])&&!i.bools[d]&&(!s[d]||!r(d))?(c(d,e[f+1],p),f+=1):e[f+1]&&/^(true|false)$/.test(e[f+1])?(c(d,e[f+1]==="true",p),f+=1):c(d,i.strings[d]?"":!0,p))}else if((!i.unknownFn||i.unknownFn(p)!==!1)&&a._.push(i.strings._||!ms(p)?p:Number(p)),t.stopEarly){a._.push.apply(a._,e.slice(f+1));break}}return Object.keys(n).forEach(function(g){Bn(a,g.split("."))||(h(a,g.split("."),n[g]),(s[g]||[]).forEach(function(_){h(a,_.split("."),n[g])}))}),t["--"]?a["--"]=l.slice():l.forEach(function(g){a._.push(g)}),a}});var vs=fi((Pu,Un)=>{Un.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var Es=fi(ft=>{"use strict";var ws=vs(),D=process.env;Object.defineProperty(ft,"_vendors",{value:ws.map(function(e){return e.constant})});ft.name=null;ft.isPR=null;ft.id=null;D.CI!=="false"&&ws.forEach(function(e){let i=(Array.isArray(e.env)?e.env:[e.env]).every(function(s){return Ss(s)});ft[e.constant]=i,i&&(ft.name=e.name,ft.isPR=jn(e),ft.id=e.constant)});ft.isCI=!!(D.CI!=="false"&&(D.BUILD_ID||D.BUILD_NUMBER||D.CI||D.CI_APP_ID||D.CI_BUILD_ID||D.CI_BUILD_NUMBER||D.CI_NAME||D.CONTINUOUS_INTEGRATION||D.RUN_ID||ft.name));function Ss(e){return typeof e=="string"?!!D[e]:"env"in e?D[e.env]&&D[e.env].includes(e.includes):"any"in e?e.any.some(function(t){return!!D[t]}):Object.keys(e).every(function(t){return D[t]===e[t]})}function jn(e){switch(typeof e.pr){case"string":return!!D[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return D[e.pr.env]===t}):e.pr.env in D&&D[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(t){return!!D[t]}):Ss(e.pr);default:return null}}});var kn=ds(ys(),1);import{createPrompt as yu,useState as ui,useKeypress as bu,useMemo as vu}from"@inquirer/core";var A=class{static silent=!1;static silence(){this.silent=!0}static log(...t){this.silent||console.log(...t)}static error(...t){this.silent||console.error(...t)}};var bs={name:"@under_koen/bsm",version:"1.11.1",description:"BSM (Basic Script Manager) is a useful tool that enables you to create clear and concise scripts without cluttering your `package.json` file.",license:"MIT",author:"Koen van Staveren <koen@underkoen.nl>",homepage:"https://github.com/UnderKoen/bsm#readme",repository:{type:"git",url:"https://github.com/UnderKoen/bsm.git"},bugs:{url:"https://github.com/UnderKoen/bsm/issues"},type:"module",main:"dist/index.js",bin:{bsm:"./dist/index.js"},files:["dist"],scripts:{build:"bsm","build:dev":"bsm","build:prod":"bsm","build:watch":"bsm",lint:"bsm",prettier:"bsm",prepublishOnly:"bsm build.prod",test:"bsm","test:cov":"bsm test.cov"},dependencies:{"@inquirer/core":"^10.3.0"},devDependencies:{"@eslint/js":"^9.21.0","@inquirer/core":"^10.3.0","@semantic-release/changelog":"^6.0.3","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.0","@semantic-release/npm":"^13.1.1","@types/minimist":"^1.2.5","@types/node":"^22.13.9","@types/sinon":"^17.0.4","@typescript-eslint/eslint-plugin":"^8.26.0","@typescript-eslint/parser":"^8.26.0","@under_koen/bsm":"^1.10.1",c8:"^10.1.3","ci-info":"^4.1.0","cpy-cli":"^6.0.0",defu:"^6.1.4",esbuild:"^0.25.0",eslint:"^9.21.0","eslint-config-prettier":"^10.0.2",glob:"^11.0.3",globals:"^16.0.0",minimist:"^1.2.8",mlly:"^1.8.0",prettier:"^3.5.3","prettier-package-json":"^2.8.0",rimraf:"^6.0.1","semantic-release":"^25.0.1",sinon:"^21.0.0",tsx:"^4.20.6",typescript:"^5.8.2","typescript-eslint":"^8.26.0",uvu:"^0.5.6"},keywords:["script","scripting"]};var lt=class e{static printHelp(t,i){let s=i._;if(s.length===0)A.log(`
|
|
3
3
|
\x1B[1mAvailable commands:\x1B[0m`),e.printCommands(t.scripts);else for(let r of s){A.log(`
|
|
4
4
|
\x1B[1mAvailable commands: \x1B[90m${r}\x1B[0m`);let n=r.split("."),a=[[t.scripts,[],n]];for(;a.length>0;){let o=a.shift();if(o[2].length===0)e.printCommands(o[0],o[1]);else if(o[2][0]==="*"){if(typeof o[0]=="object")if(Array.isArray(o[0]))for(let h=0;h<o[0].length;h++)a.push([o[0][h],[...o[1],h.toString()],[]]);else for(let h in o[0])Object.hasOwn(o[0],h)&&a.push([o[0][h],[...o[1],h],o[2].slice(1)])}else{let h=o[2][0];if(typeof o[0]=="object")if(Array.isArray(o[0])){let c=parseInt(h);a.push([o[0][c],[...o[1],c.toString()],o[2].slice(1)])}else a.push([o[0][h],[...o[1],h],o[2].slice(1)])}}}process.exit(0)}static printCommands(t,i=[],s=!0){if(Array.isArray(t))t.forEach((r,n)=>{e.printCommand(r,[...i,n.toString()])});else if(typeof t=="object"){s&&i.length>0&&e.printCommand(t,[...i]);for(let r in t)Object.hasOwn(t,r)&&e.printCommand(t[r],[...i,r])}else e.printCommand(t,i)}static printCommand(t,i){if(t===void 0){A.error(`\x1B[31mScript '${i.join(".")}' not found\x1B[0m`);return}let s=e.getCommandHelp(t,i);s&&A.log(s)}static getCommandHelp(t,i){if(i[i.length-1]==="$description")return;let s=`\x1B[92m${i.join(".")}\x1B[0m\x1B[90m - \x1B[0m`,r;return typeof t=="string"?r=t:typeof t=="function"?r="\x1B[90m<function>\x1B[0m":Array.isArray(t)?r=`\x1B[90m[${t.length}]\x1B[0m`:Object.hasOwn(t,"$description")?r=`\x1B[90m${t.$description}\x1B[0m`:r=`\x1B[90m{${Object.keys(t).join(", ")}}\x1B[0m`,`${s}${r}`}static printVersion(){A.log(bs.version),process.exit(0)}};var An=ds(Es(),1);import gu from"node:child_process";import xu from"path";import fs from"fs";function pi(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function di(e,t,i=".",s){if(!pi(t))return di(e,{},i,s);let r=Object.assign({},t);for(let n in e){if(n==="__proto__"||n==="constructor")continue;let a=e[n];a!=null&&(s&&s(r,n,a,i)||(Array.isArray(a)&&Array.isArray(r[n])?r[n]=[...a,...r[n]]:pi(a)&&pi(r[n])?r[n]=di(a,r[n],(i?`${i}.`:"")+n.toString(),s):r[n]=a))}return r}function mi(e){return(...t)=>t.reduce((i,s)=>di(i,s,"",e),{})}var _s=mi(),Ou=mi((e,t,i)=>{if(e[t]!==void 0&&typeof i=="function")return e[t]=i(e[t]),!0}),Lu=mi((e,t,i)=>{if(Array.isArray(e[t])&&typeof i=="function")return e[t]=i(e[t]),!0});var $n=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],ks=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],Wn="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",Ps="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",gi={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},xi="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Gn={5:xi,"5module":xi+" export import",6:xi+" const class extends export import super"},zn=/^in(stanceof)?$/,Hn=new RegExp("["+Ps+"]"),qn=new RegExp("["+Ps+Wn+"]");function bi(e,t){for(var i=65536,s=0;s<t.length;s+=2){if(i+=t[s],i>e)return!1;if(i+=t[s+1],i>=e)return!0}return!1}function yt(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Hn.test(String.fromCharCode(e)):t===!1?!1:bi(e,ks)}function kt(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&qn.test(String.fromCharCode(e)):t===!1?!1:bi(e,ks)||bi(e,$n)}var P=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function st(e,t){return new P(e,{beforeExpr:!0,binop:t})}var rt={beforeExpr:!0},Z={startsExpr:!0},Ei={};function T(e,t){return t===void 0&&(t={}),t.keyword=e,Ei[e]=new P(e,t)}var u={num:new P("num",Z),regexp:new P("regexp",Z),string:new P("string",Z),name:new P("name",Z),privateId:new P("privateId",Z),eof:new P("eof"),bracketL:new P("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new P("]"),braceL:new P("{",{beforeExpr:!0,startsExpr:!0}),braceR:new P("}"),parenL:new P("(",{beforeExpr:!0,startsExpr:!0}),parenR:new P(")"),comma:new P(",",rt),semi:new P(";",rt),colon:new P(":",rt),dot:new P("."),question:new P("?",rt),questionDot:new P("?."),arrow:new P("=>",rt),template:new P("template"),invalidTemplate:new P("invalidTemplate"),ellipsis:new P("...",rt),backQuote:new P("`",Z),dollarBraceL:new P("${",{beforeExpr:!0,startsExpr:!0}),eq:new P("=",{beforeExpr:!0,isAssign:!0}),assign:new P("_=",{beforeExpr:!0,isAssign:!0}),incDec:new P("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new P("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:st("||",1),logicalAND:st("&&",2),bitwiseOR:st("|",3),bitwiseXOR:st("^",4),bitwiseAND:st("&",5),equality:st("==/!=/===/!==",6),relational:st("</>/<=/>=",7),bitShift:st("<</>>/>>>",8),plusMin:new P("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:st("%",10),star:st("*",10),slash:st("/",10),starstar:new P("**",{beforeExpr:!0}),coalesce:st("??",1),_break:T("break"),_case:T("case",rt),_catch:T("catch"),_continue:T("continue"),_debugger:T("debugger"),_default:T("default",rt),_do:T("do",{isLoop:!0,beforeExpr:!0}),_else:T("else",rt),_finally:T("finally"),_for:T("for",{isLoop:!0}),_function:T("function",Z),_if:T("if"),_return:T("return",rt),_switch:T("switch"),_throw:T("throw",rt),_try:T("try"),_var:T("var"),_const:T("const"),_while:T("while",{isLoop:!0}),_with:T("with"),_new:T("new",{beforeExpr:!0,startsExpr:!0}),_this:T("this",Z),_super:T("super",Z),_class:T("class",Z),_extends:T("extends",rt),_export:T("export"),_import:T("import",Z),_null:T("null",Z),_true:T("true",Z),_false:T("false",Z),_in:T("in",{beforeExpr:!0,binop:7}),_instanceof:T("instanceof",{beforeExpr:!0,binop:7}),_typeof:T("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:T("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:T("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},J=/\r\n?|\n|\u2028|\u2029/,Kn=new RegExp(J.source,"g");function Gt(e){return e===10||e===13||e===8232||e===8233}function Ns(e,t,i){i===void 0&&(i=e.length);for(var s=t;s<i;s++){var r=e.charCodeAt(s);if(Gt(r))return s<i-1&&r===13&&e.charCodeAt(s+1)===10?s+2:s+1}return-1}var Os=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,G=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ls=Object.prototype,Qn=Ls.hasOwnProperty,Yn=Ls.toString,zt=Object.hasOwn||(function(e,t){return Qn.call(e,t)}),Cs=Array.isArray||(function(e){return Yn.call(e)==="[object Array]"}),As=Object.create(null);function Tt(e){return As[e]||(As[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Et(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Xn=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ae=function(t,i){this.line=t,this.column=i};ae.prototype.offset=function(t){return new ae(this.line,this.column+t)};var Le=function(t,i,s){this.start=i,this.end=s,t.sourceFile!==null&&(this.source=t.sourceFile)};function Ds(e,t){for(var i=1,s=0;;){var r=Ns(e,s,t);if(r<0)return new ae(i,t-s);++i,s=r}}var vi={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Is=!1;function Zn(e){var t={};for(var i in vi)t[i]=e&&zt(e,i)?e[i]:vi[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Is&&typeof console=="object"&&console.warn&&(Is=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
5
5
|
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Cs(t.onToken)){var s=t.onToken;t.onToken=function(r){return s.push(r)}}return Cs(t.onComment)&&(t.onComment=Jn(t,t.onComment)),t}function Jn(e,t){return function(i,s,r,n,a,o){var h={type:i?"Block":"Line",value:s,start:r,end:n};e.locations&&(h.loc=new Le(this,a,o)),e.ranges&&(h.range=[r,n]),t.push(h)}}var oe=1,Ht=2,_i=4,Fs=8,Ci=16,Ms=32,De=64,Bs=128,Bt=256,he=512,Fe=oe|Ht|Bt;function Ai(e,t){return Ht|(e?_i:0)|(t?Fs:0)}var ke=0,Ii=1,Ct=2,Vs=3,Us=4,js=5,V=function(t,i,s){this.options=t=Zn(t),this.sourceFile=t.sourceFile,this.keywords=Tt(Gn[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var r="";t.allowReserved!==!0&&(r=gi[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(r+=" await")),this.reservedWords=Tt(r);var n=(r?r+" ":"")+gi.strict;this.reservedWordsStrict=Tt(n),this.reservedWordsStrictBind=Tt(n+" "+gi.strictBind),this.input=String(i),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf(`
|
|
@@ -13,13 +13,13 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
13
13
|
Automatic extension resolution of the "main" field is deprecated for ES modules.`,"DeprecationWarning","DEP0151"):Vt.emitWarning(`No "main" or "exports" field defined in the package.json for ${a} resolving the main entry point "${n.slice(a.length)}", imported from ${o}.
|
|
14
14
|
Default "index" lookups for the main are deprecated for ES modules.`,"DeprecationWarning","DEP0151")}function Tr(e){try{return ji(e)}catch{}}function Oi(e){let t=ji(e,{throwIfNoEntry:!1}),i=t?t.isFile():void 0;return i??!1}function uo(e,t,i){let s;if(t.main!==void 0){if(s=new B(t.main,e),Oi(s))return s;let a=[`./${t.main}.js`,`./${t.main}.json`,`./${t.main}.node`,`./${t.main}/index.js`,`./${t.main}/index.json`,`./${t.main}/index.node`],o=-1;for(;++o<a.length&&(s=new B(a[o],e),!Oi(s));)s=void 0;if(s)return wr(s,e,i,t.main),s}let r=["./index.js","./index.json","./index.node"],n=-1;for(;++n<r.length&&(s=new B(r[n],e),!Oi(s));)s=void 0;if(s)return wr(s,e,i,t.main),s;throw new Gi(N(new B(".",e)),N(i))}function co(e,t,i){if(oo.exec(e.pathname)!==null)throw new We(e.pathname,'must not include encoded "/" or "\\" characters',N(t));let s;try{s=N(e)}catch(n){let a=n;throw Object.defineProperty(a,"input",{value:String(e)}),Object.defineProperty(a,"module",{value:String(t)}),a}let r=Tr(s.endsWith("/")?s.slice(-1):s);if(r&&r.isDirectory()){let n=new no(s,N(t));throw n.url=String(e),n}if(!r||!r.isFile()){let n=new Gi(s||e.pathname,t&&N(t),!0);throw n.url=String(e),n}{let n=Da(s),{search:a,hash:o}=e;e=$e(n+(s.endsWith($i.sep)?"/":"")),e.search=a,e.hash=o}return e}function lo(e,t,i){return new so(e,t&&N(new B(".",t)),N(i))}function Li(e,t,i){return new ro(N(new B(".",t)),e,i&&N(i))}function fo(e,t,i,s,r){let n=`request is not a valid match in pattern "${t}" for the "${s?"imports":"exports"}" resolution of ${N(i)}`;throw new We(e,n,r&&N(r))}function le(e,t,i,s,r){return t=typeof t=="object"&&t!==null?JSON.stringify(t,null,""):`${t}`,new io(N(new B(".",i)),e,t,s,r&&N(r))}function po(e,t,i,s,r,n,a,o,h){if(t!==""&&!n&&e[e.length-1]!=="/")throw le(i,e,s,a,r);if(!e.startsWith("./")){if(a&&!e.startsWith("../")&&!e.startsWith("/")){let p=!1;try{new B(e),p=!0}catch{}if(!p){let d=n?Ue.call(je,e,()=>t):e+t;return Pr(d,s,h)}}throw le(i,e,s,a,r)}if(xr.exec(e.slice(2))!==null)if(yr.exec(e.slice(2))===null){if(!o){let p=n?i.replace("*",()=>t):i+t,d=n?Ue.call(je,e,()=>t):e;vr(d,p,i,s,a,r,!0)}}else throw le(i,e,s,a,r);let c=new B(e,s),l=c.pathname,f=new B(".",s).pathname;if(!l.startsWith(f))throw le(i,e,s,a,r);if(t==="")return c;if(xr.exec(t)!==null){let p=n?i.replace("*",()=>t):i+t;if(yr.exec(t)===null){if(!o){let d=n?Ue.call(je,e,()=>t):e;vr(d,p,i,s,a,r,!1)}}else fo(p,i,s,a,r)}return n?new B(Ue.call(je,c.href,()=>t)):new B(t,c)}function mo(e){let t=Number(e);return`${t}`!==e?!1:t>=0&&t<4294967295}function Kt(e,t,i,s,r,n,a,o,h){if(typeof t=="string")return po(t,i,s,e,r,n,a,o,h);if(Array.isArray(t)){let c=t;if(c.length===0)return null;let l,f=-1;for(;++f<c.length;){let p=c[f],d;try{d=Kt(e,p,i,s,r,n,a,o,h)}catch(x){let m=x;if(l=m,m.code==="ERR_INVALID_PACKAGE_TARGET")continue;throw x}if(d!==void 0){if(d===null){l=null;continue}return d}}if(l==null)return null;throw l}if(typeof t=="object"&&t!==null){let c=Object.getOwnPropertyNames(t),l=-1;for(;++l<c.length;){let f=c[l];if(mo(f))throw new Ir(N(e),r,'"exports" cannot contain numeric property keys.')}for(l=-1;++l<c.length;){let f=c[l];if(f==="default"||h&&h.has(f)){let p=t[f],d=Kt(e,p,i,s,r,n,a,o,h);if(d===void 0)continue;return d}}return null}if(t===null)return null;throw le(s,t,e,a,r)}function go(e,t,i){if(typeof e=="string"||Array.isArray(e))return!0;if(typeof e!="object"||e===null)return!1;let s=Object.getOwnPropertyNames(e),r=!1,n=0,a=-1;for(;++a<s.length;){let o=s[a],h=o===""||o[0]!==".";if(n++===0)r=h;else if(r!==h)throw new Ir(N(t),i,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return r}function xo(e,t,i){if(Vt.noDeprecation)return;let s=N(t);br.has(s+"|"+e)||(br.add(s+"|"+e),Vt.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${s}${i?` imported from ${N(i)}`:""}. Mapping specifiers ending in "/" is no longer supported.`,"DeprecationWarning","DEP0155"))}function Sr(e,t,i,s,r){let n=i.exports;if(go(n,e,s)&&(n={".":n}),Rr.call(n,t)&&!t.includes("*")&&!t.endsWith("/")){let l=n[t],f=Kt(e,l,"",t,s,!1,!1,!1,r);if(f==null)throw Li(t,e,s);return f}let a="",o="",h=Object.getOwnPropertyNames(n),c=-1;for(;++c<h.length;){let l=h[c],f=l.indexOf("*");if(f!==-1&&t.startsWith(l.slice(0,f))){t.endsWith("/")&&xo(t,e,s);let p=l.slice(f+1);t.length>=l.length&&t.endsWith(p)&&kr(a,l)===1&&l.lastIndexOf("*")===f&&(a=l,o=t.slice(f,t.length-p.length))}}if(a){let l=n[a],f=Kt(e,l,o,a,s,!0,!1,t.endsWith("/"),r);if(f==null)throw Li(t,e,s);return f}throw Li(t,e,s)}function kr(e,t){let i=e.indexOf("*"),s=t.indexOf("*"),r=i===-1?e.length:i+1,n=s===-1?t.length:s+1;return r>n?-1:n>r||i===-1?1:s===-1||e.length>t.length?-1:t.length>e.length?1:0}function yo(e,t,i){if(e==="#"||e.startsWith("#/")||e.endsWith("/")){let n="is not a valid internal imports specifier name";throw new We(e,n,N(t))}let s,r=Wi(t);if(r.exists){s=$e(r.pjsonPath);let n=r.imports;if(n)if(Rr.call(n,e)&&!e.includes("*")){let a=Kt(s,n[e],"",e,t,!1,!0,!1,i);if(a!=null)return a}else{let a="",o="",h=Object.getOwnPropertyNames(n),c=-1;for(;++c<h.length;){let l=h[c],f=l.indexOf("*");if(f!==-1&&e.startsWith(l.slice(0,-1))){let p=l.slice(f+1);e.length>=l.length&&e.endsWith(p)&&kr(a,l)===1&&l.lastIndexOf("*")===f&&(a=l,o=e.slice(f,e.length-p.length))}}if(a){let l=n[a],f=Kt(s,l,o,a,t,!0,!0,!1,i);if(f!=null)return f}}}throw lo(e,s,t)}function bo(e,t){let i=e.indexOf("/"),s=!0,r=!1;e[0]==="@"&&(r=!0,i===-1||e.length===0?s=!1:i=e.indexOf("/",i+1));let n=i===-1?e:e.slice(0,i);if(ao.exec(n)!==null&&(s=!1),!s)throw new We(e,"is not a valid package name",N(t));let a="."+(i===-1?"":e.slice(i));return{packageName:n,packageSubpath:a,isScoped:r}}function Pr(e,t,i){if(Ui.includes(e))return new B("node:"+e);let{packageName:s,packageSubpath:r,isScoped:n}=bo(e,t),a=Wi(t);if(a.exists){let l=$e(a.pjsonPath);if(a.name===s&&a.exports!==void 0&&a.exports!==null)return Sr(l,r,a,t,i)}let o=new B("./node_modules/"+s+"/package.json",t),h=N(o),c;do{let l=Tr(h.slice(0,-13));if(!l||!l.isDirectory()){c=h,o=new B((n?"../../../../node_modules/":"../../../node_modules/")+s+"/package.json",o),h=N(o);continue}let f=Ar(h,{base:t,specifier:e});return f.exports!==void 0&&f.exports!==null?Sr(o,r,f,t,i):r==="."?uo(o,f,t):new B(r,o)}while(h.length!==c.length);throw new Gi(s,N(t),!1)}function vo(e){return e[0]==="."&&(e.length===1||e[1]==="/"||e[1]==="."&&(e.length===2||e[2]==="/"))}function wo(e){return e===""?!1:e[0]==="/"?!0:vo(e)}function So(e,t,i,s){let r=t.protocol,a=r==="data:"||r==="http:"||r==="https:",o;if(wo(e))try{o=new B(e,t)}catch(h){let c=new gr(e,t);throw c.cause=h,c}else if(r==="file:"&&e[0]==="#")o=yo(e,t,i);else try{o=new B(e)}catch(h){if(a&&!Ui.includes(e)){let c=new gr(e,t);throw c.cause=h,c}o=Pr(e,t,i)}return Nt(o!==void 0,"expected to be defined"),o.protocol!=="file:"?o:co(o,t)}function Vi(e){return typeof e=="string"&&!e.startsWith("file://")?Mi(e):Mi(N(e))}function Di(e){return $e(Vi(e)).toString()}function Eo(e){return typeof e!="string"&&(e=e.toString()),/(?:node|data|http|https|file):/.test(e)?e:_r.has(e)?"node:"+e:"file://"+encodeURI(Mi(e))}var _o=new Set(["node","import"]),Co=[".mjs",".cjs",".js",".json"],Ao=new Set(["ERR_MODULE_NOT_FOUND","ERR_UNSUPPORTED_DIR_IMPORT","MODULE_NOT_FOUND","ERR_PACKAGE_PATH_NOT_EXPORTED"]);function Er(e,t,i){try{return So(e,t,i)}catch(s){if(!Ao.has(s==null?void 0:s.code))throw s}}function Io(e,t={}){if(typeof e!="string")if(e instanceof URL)e=Vi(e);else throw new TypeError("input must be a `string` or `URL`");if(/(?:node|data|http|https):/.test(e))return e;if(_r.has(e))return"node:"+e;if(e.startsWith("file://")&&(e=Vi(e)),Pi(e))try{if(ji(e).isFile())return Di(e)}catch(a){if((a==null?void 0:a.code)!=="ENOENT")throw a}let i=t.conditions?new Set(t.conditions):_o,s=(Array.isArray(t.url)?t.url:[t.url]).filter(Boolean).map(a=>new URL(Eo(a.toString())));s.length===0&&s.push(new URL(Di(process.cwd())));let r=[...s];for(let a of s)a.protocol==="file:"&&r.push(new URL("./",a),new URL(ki(a.pathname,"_index.js"),a),new URL("node_modules",a));let n;for(let a of r){if(n=Er(e,a,i),n)break;for(let o of["","/index"]){for(let h of t.extensions||Co)if(n=Er(ki(e,o)+h,a,i),n)break;if(n)break}if(n)break}if(!n){let a=new Error(`Cannot find module ${e} imported from ${r.join(", ")}`);throw a.code="ERR_MODULE_NOT_FOUND",a}return Di(n)}function Ro(e,t){return Io(e,t)}function Nr(e,t){try{return Promise.resolve(Ro(e,t))}catch(i){return Promise.reject(i)}}var ko=Object.freeze({scripts:{},config:{defaultHelpBehavior:"help",caseInsensitive:!1,idempotency:{location:"./node_modules/.cache/bsm/idempotency",useFileContent:!1}}}),tt=class{static getSource(t){return Array.isArray(t)?t[0]:t}static async loadExtensions(t){return!Object.hasOwn(t,"extends")||!t.extends?[]:(await Promise.all([...t.extends].map(i=>this.loadFile(i,!1)))).filter(i=>i!==void 0)}static interopDefault(t){return typeof t!="object"||t===null?t:"default"in t?t.default:t}static async loadFile(t,i=!0){if(!t)return;let s=this.getSource(t);try{s=await Nr(s,{url:process.cwd()+"/"})}catch{if(i)return;A.error(`\x1B[31mCannot find config '${s}' to extend\x1B[0m`),process.exit(1)}try{let r=this.interopDefault(await import(s));typeof r=="function"&&(r=await r(...Array.isArray(t)?t.slice(1):[]));let n=await this.loadExtensions(r);return _s(r,...n,ko)}catch(r){A.error(r),Array.isArray(t)&&(t=t[0]),A.error(`\x1B[31mError loading config '${t}'\x1B[0m`),process.exit(1)}}static async load(t){let i=[t.config,process.env.BSM_CONFIG,"./package.scripts.js","./package.scripts.cjs","./package.scripts.mjs","./package.scripts.json"].filter(s=>s!==void 0);for(let s of i){let r=await this.loadFile(s);if(r)return process.env.BSM_CONFIG=s,this._config=r,r}A.error(`\x1B[31mCannot find config ${i.map(s=>`'${s}'`).join(" or ")}\x1B[0m`),process.exit(1)}static _config;static get config(){if(this._config)return this._config;throw new Error("Config not loaded")}};import{createHash as mu}from"node:crypto";import $t from"fs";import Cn from"path";var zi=(e,t,i)=>{let s=e instanceof RegExp?Or(e,i):e,r=t instanceof RegExp?Or(t,i):t,n=s!==null&&r!=null&&Po(s,r,i);return n&&{start:n[0],end:n[1],pre:i.slice(0,n[0]),body:i.slice(n[0]+s.length,n[1]),post:i.slice(n[1]+r.length)}},Or=(e,t)=>{let i=t.match(e);return i?i[0]:null},Po=(e,t,i)=>{let s,r,n,a,o,h=i.indexOf(e),c=i.indexOf(t,h+1),l=h;if(h>=0&&c>0){if(e===t)return[h,c];for(s=[],n=i.length;l>=0&&!o;){if(l===h)s.push(l),h=i.indexOf(e,l+1);else if(s.length===1){let f=s.pop();f!==void 0&&(o=[f,c])}else r=s.pop(),r!==void 0&&r<n&&(n=r,a=c),c=i.indexOf(t,l+1);l=h<c&&h>=0?h:c}s.length&&a!==void 0&&(o=[n,a])}return o};var Lr="\0SLASH"+Math.random()+"\0",Dr="\0OPEN"+Math.random()+"\0",qi="\0CLOSE"+Math.random()+"\0",Fr="\0COMMA"+Math.random()+"\0",Mr="\0PERIOD"+Math.random()+"\0",No=new RegExp(Lr,"g"),Oo=new RegExp(Dr,"g"),Lo=new RegExp(qi,"g"),Do=new RegExp(Fr,"g"),Fo=new RegExp(Mr,"g"),Mo=/\\\\/g,Bo=/\\{/g,Vo=/\\}/g,Uo=/\\,/g,jo=/\\./g;function Hi(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function $o(e){return e.replace(Mo,Lr).replace(Bo,Dr).replace(Vo,qi).replace(Uo,Fr).replace(jo,Mr)}function Wo(e){return e.replace(No,"\\").replace(Oo,"{").replace(Lo,"}").replace(Do,",").replace(Fo,".")}function Br(e){if(!e)return[""];let t=[],i=zi("{","}",e);if(!i)return e.split(",");let{pre:s,body:r,post:n}=i,a=s.split(",");a[a.length-1]+="{"+r+"}";let o=Br(n);return n.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),t.push.apply(t,a),t}function Vr(e){return e?(e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),fe($o(e),!0).map(Wo)):[]}function Go(e){return"{"+e+"}"}function zo(e){return/^-?0\d/.test(e)}function Ho(e,t){return e<=t}function qo(e,t){return e>=t}function fe(e,t){let i=[],s=zi("{","}",e);if(!s)return[e];let r=s.pre,n=s.post.length?fe(s.post,!1):[""];if(/\$$/.test(s.pre))for(let a=0;a<n.length;a++){let o=r+"{"+s.body+"}"+n[a];i.push(o)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),h=a||o,c=s.body.indexOf(",")>=0;if(!h&&!c)return s.post.match(/,(?!,).*\}/)?(e=s.pre+"{"+s.body+qi+s.post,fe(e)):[e];let l;if(h)l=s.body.split(/\.\./);else if(l=Br(s.body),l.length===1&&l[0]!==void 0&&(l=fe(l[0],!1).map(Go),l.length===1))return n.map(p=>s.pre+l[0]+p);let f;if(h&&l[0]!==void 0&&l[1]!==void 0){let p=Hi(l[0]),d=Hi(l[1]),x=Math.max(l[0].length,l[1].length),m=l.length===3&&l[2]!==void 0?Math.abs(Hi(l[2])):1,S=Ho;d<p&&(m*=-1,S=qo);let E=l.some(zo);f=[];for(let b=p;S(b,d);b+=m){let g;if(o)g=String.fromCharCode(b),g==="\\"&&(g="");else if(g=String(b),E){let _=x-g.length;if(_>0){let L=new Array(_+1).join("0");b<0?g="-"+L+g.slice(1):g=L+g}}f.push(g)}}else{f=[];for(let p=0;p<l.length;p++)f.push.apply(f,fe(l[p],!1))}for(let p=0;p<f.length;p++)for(let d=0;d<n.length;d++){let x=r+f[p]+n[d];(!t||h||x)&&i.push(x)}}return i}var pe=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var Ko={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},de=e=>e.replace(/[[\]\\-]/g,"\\$&"),Qo=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ur=e=>e.join(""),jr=(e,t)=>{let i=t;if(e.charAt(i)!=="[")throw new Error("not in a brace expression");let s=[],r=[],n=i+1,a=!1,o=!1,h=!1,c=!1,l=i,f="";t:for(;n<e.length;){let m=e.charAt(n);if((m==="!"||m==="^")&&n===i+1){c=!0,n++;continue}if(m==="]"&&a&&!h){l=n+1;break}if(a=!0,m==="\\"&&!h){h=!0,n++;continue}if(m==="["&&!h){for(let[S,[y,E,b]]of Object.entries(Ko))if(e.startsWith(S,n)){if(f)return["$.",!1,e.length-i,!0];n+=S.length,b?r.push(y):s.push(y),o=o||E;continue t}}if(h=!1,f){m>f?s.push(de(f)+"-"+de(m)):m===f&&s.push(de(m)),f="",n++;continue}if(e.startsWith("-]",n+1)){s.push(de(m+"-")),n+=2;continue}if(e.startsWith("-",n+1)){f=m,n+=2;continue}s.push(de(m)),n++}if(l<n)return["",!1,0,!1];if(!s.length&&!r.length)return["$.",!1,e.length-i,!0];if(r.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let m=s[0].length===2?s[0].slice(-1):s[0];return[Qo(m),!1,l-i,!1]}let p="["+(c?"^":"")+Ur(s)+"]",d="["+(c?"":"^")+Ur(r)+"]";return[s.length&&r.length?"("+p+"|"+d+")":s.length?p:d,o,l-i,!0]};var dt=(e,{windowsPathsNoEscape:t=!1,magicalBraces:i=!0}={})=>i?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var Yo=new Set(["!","?","+","*","@"]),$r=e=>Yo.has(e),Xo="(?!(?:^|/)\\.\\.?(?:$|/))",Ge="(?!\\.)",Zo=new Set(["[","."]),Jo=new Set(["..","."]),th=new Set("().*{}+?[]^$\\!"),eh=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ki="[^/]",Wr=Ki+"*?",Gr=Ki+"+?",Qt=class e{type;#t;#e;#n=!1;#r=[];#a;#v;#y;#c=!1;#o;#f;#l=!1;constructor(t,i,s={}){this.type=t,t&&(this.#e=!0),this.#a=i,this.#t=this.#a?this.#a.#t:this,this.#o=this.#t===this?s:this.#t.#o,this.#y=this.#t===this?[]:this.#t.#y,t==="!"&&!this.#t.#c&&this.#y.push(this),this.#v=this.#a?this.#a.#r.length:0}get hasMagic(){if(this.#e!==void 0)return this.#e;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#f=this.#r.map(t=>String(t)).join("")}#h(){if(this!==this.#t)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let t;for(;t=this.#y.pop();){if(t.type!=="!")continue;let i=t,s=i.#a;for(;s;){for(let r=i.#v+1;!s.type&&r<s.#r.length;r++)for(let n of t.#r){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(s.#r[r])}i=s,s=i.#a}}return this}push(...t){for(let i of t)if(i!==""){if(typeof i!="string"&&!(i instanceof e&&i.#a===this))throw new Error("invalid part: "+i);this.#r.push(i)}}toJSON(){var i;let t=this.type===null?this.#r.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#r.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#c&&((i=this.#a)==null?void 0:i.type)==="!")&&t.push({}),t}isStart(){var i;if(this.#t===this)return!0;if(!((i=this.#a)!=null&&i.isStart()))return!1;if(this.#v===0)return!0;let t=this.#a;for(let s=0;s<this.#v;s++){let r=t.#r[s];if(!(r instanceof e&&r.type==="!"))return!1}return!0}isEnd(){var i,s,r;if(this.#t===this||((i=this.#a)==null?void 0:i.type)==="!")return!0;if(!((s=this.#a)!=null&&s.isEnd()))return!1;if(!this.type)return(r=this.#a)==null?void 0:r.isEnd();let t=this.#a?this.#a.#r.length:0;return this.#v===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let i=new e(this.type,t);for(let s of this.#r)i.copyIn(s);return i}static#i(t,i,s,r){let n=!1,a=!1,o=-1,h=!1;if(i.type===null){let d=s,x="";for(;d<t.length;){let m=t.charAt(d++);if(n||m==="\\"){n=!n,x+=m;continue}if(a){d===o+1?(m==="^"||m==="!")&&(h=!0):m==="]"&&!(d===o+2&&h)&&(a=!1),x+=m;continue}else if(m==="["){a=!0,o=d,h=!1,x+=m;continue}if(!r.noext&&$r(m)&&t.charAt(d)==="("){i.push(x),x="";let S=new e(m,i);d=e.#i(t,S,d,r),i.push(S);continue}x+=m}return i.push(x),d}let c=s+1,l=new e(null,i),f=[],p="";for(;c<t.length;){let d=t.charAt(c++);if(n||d==="\\"){n=!n,p+=d;continue}if(a){c===o+1?(d==="^"||d==="!")&&(h=!0):d==="]"&&!(c===o+2&&h)&&(a=!1),p+=d;continue}else if(d==="["){a=!0,o=c,h=!1,p+=d;continue}if($r(d)&&t.charAt(c)==="("){l.push(p),p="";let x=new e(d,l);l.push(x),c=e.#i(t,x,c,r);continue}if(d==="|"){l.push(p),p="",f.push(l),l=new e(null,i);continue}if(d===")")return p===""&&i.#r.length===0&&(i.#l=!0),l.push(p),p="",i.push(...f,l),c;p+=d}return i.type=null,i.#e=void 0,i.#r=[t.substring(s-1)],c}static fromGlob(t,i={}){let s=new e(null,void 0,i);return e.#i(t,s,0,i),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[i,s,r,n]=this.toRegExpSource();if(!(r||this.#e||this.#o.nocase&&!this.#o.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let o=(this.#o.nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${i}$`,o),{_src:i,_glob:t})}get options(){return this.#o}toRegExpSource(t){var h;let i=t??!!this.#o.dot;if(this.#t===this&&this.#h(),!this.type){let c=this.isStart()&&this.isEnd()&&!this.#r.some(x=>typeof x!="string"),l=this.#r.map(x=>{let[m,S,y,E]=typeof x=="string"?e.#w(x,this.#e,c):x.toRegExpSource(t);return this.#e=this.#e||y,this.#n=this.#n||E,m}).join(""),f="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&Jo.has(this.#r[0]))){let m=Zo,S=i&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),y=!i&&!t&&m.has(l.charAt(0));f=S?Xo:y?Ge:""}let p="";return this.isEnd()&&this.#t.#c&&((h=this.#a)==null?void 0:h.type)==="!"&&(p="(?:$|\\/)"),[f+l+p,dt(l),this.#e=!!this.#e,this.#n]}let s=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",n=this.#d(i);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let c=this.toString();return this.#r=[c],this.type=null,this.#e=void 0,[c,dt(this.toString()),!1,!1]}let a=!s||t||i||!Ge?"":this.#d(!0);a===n&&(a=""),a&&(n=`(?:${n})(?:${a})*?`);let o="";if(this.type==="!"&&this.#l)o=(this.isStart()&&!i?Ge:"")+Gr;else{let c=this.type==="!"?"))"+(this.isStart()&&!i&&!t?Ge:"")+Wr+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=r+n+c}return[o,dt(n),this.#e=!!this.#e,this.#n]}#d(t){return this.#r.map(i=>{if(typeof i=="string")throw new Error("string type in extglob ast??");let[s,r,n,a]=i.toRegExpSource(t);return this.#n=this.#n||a,s}).filter(i=>!(this.isStart()&&this.isEnd())||!!i).join("|")}static#w(t,i,s=!1){let r=!1,n="",a=!1;for(let o=0;o<t.length;o++){let h=t.charAt(o);if(r){r=!1,n+=(th.has(h)?"\\":"")+h;continue}if(h==="\\"){o===t.length-1?n+="\\\\":r=!0;continue}if(h==="["){let[c,l,f,p]=jr(t,o);if(f){n+=c,a=a||l,o+=f-1,i=i||p;continue}}if(h==="*"){n+=s&&t==="*"?Gr:Wr,i=!0;continue}if(h==="?"){n+=Ki,i=!0;continue}n+=eh(h)}return[n,dt(t),!!i,a]}};var Yt=(e,{windowsPathsNoEscape:t=!1,magicalBraces:i=!1}={})=>i?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var Y=(e,t,i={})=>(pe(t),!i.nocomment&&t.charAt(0)==="#"?!1:new et(t,i).match(e)),ih=/^\*+([^+@!?\*\[\(]*)$/,sh=e=>t=>!t.startsWith(".")&&t.endsWith(e),rh=e=>t=>t.endsWith(e),nh=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),ah=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),oh=/^\*+\.\*+$/,hh=e=>!e.startsWith(".")&&e.includes("."),uh=e=>e!=="."&&e!==".."&&e.includes("."),ch=/^\.\*+$/,lh=e=>e!=="."&&e!==".."&&e.startsWith("."),fh=/^\*+$/,ph=e=>e.length!==0&&!e.startsWith("."),dh=e=>e.length!==0&&e!=="."&&e!=="..",mh=/^\?+([^+@!?\*\[\(]*)?$/,gh=([e,t=""])=>{let i=qr([e]);return t?(t=t.toLowerCase(),s=>i(s)&&s.toLowerCase().endsWith(t)):i},xh=([e,t=""])=>{let i=Kr([e]);return t?(t=t.toLowerCase(),s=>i(s)&&s.toLowerCase().endsWith(t)):i},yh=([e,t=""])=>{let i=Kr([e]);return t?s=>i(s)&&s.endsWith(t):i},bh=([e,t=""])=>{let i=qr([e]);return t?s=>i(s)&&s.endsWith(t):i},qr=([e])=>{let t=e.length;return i=>i.length===t&&!i.startsWith(".")},Kr=([e])=>{let t=e.length;return i=>i.length===t&&i!=="."&&i!==".."},Qr=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",zr={win32:{sep:"\\"},posix:{sep:"/"}},vh=Qr==="win32"?zr.win32.sep:zr.posix.sep;Y.sep=vh;var W=Symbol("globstar **");Y.GLOBSTAR=W;var wh="[^/]",Sh=wh+"*?",Eh="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",_h="(?:(?!(?:\\/|^)\\.).)*?",Ch=(e,t={})=>i=>Y(i,e,t);Y.filter=Ch;var ht=(e,t={})=>Object.assign({},e,t),Ah=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Y;let t=Y;return Object.assign((s,r,n={})=>t(s,r,ht(e,n)),{Minimatch:class extends t.Minimatch{constructor(r,n={}){super(r,ht(e,n))}static defaults(r){return t.defaults(ht(e,r)).Minimatch}},AST:class extends t.AST{constructor(r,n,a={}){super(r,n,ht(e,a))}static fromGlob(r,n={}){return t.AST.fromGlob(r,ht(e,n))}},unescape:(s,r={})=>t.unescape(s,ht(e,r)),escape:(s,r={})=>t.escape(s,ht(e,r)),filter:(s,r={})=>t.filter(s,ht(e,r)),defaults:s=>t.defaults(ht(e,s)),makeRe:(s,r={})=>t.makeRe(s,ht(e,r)),braceExpand:(s,r={})=>t.braceExpand(s,ht(e,r)),match:(s,r,n={})=>t.match(s,r,ht(e,n)),sep:t.sep,GLOBSTAR:W})};Y.defaults=Ah;var Yr=(e,t={})=>(pe(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Vr(e));Y.braceExpand=Yr;var Ih=(e,t={})=>new et(e,t).makeRe();Y.makeRe=Ih;var Rh=(e,t,i={})=>{let s=new et(t,i);return e=e.filter(r=>s.match(r)),s.options.nonull&&!e.length&&e.push(t),e};Y.match=Rh;var Hr=/[?*]|[+@!]\(.*?\)|\[|\]/,Th=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),et=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,i={}){pe(t),i=i||{},this.options=i,this.pattern=t,this.platform=i.platform||Qr,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!i.windowsPathsNoEscape||i.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!i.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!i.nonegate,this.comment=!1,this.empty=!1,this.partial=!!i.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=i.windowsNoMagicRoot!==void 0?i.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let i of t)if(typeof i!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,i=this.options;if(!i.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],i.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map((n,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=n[0]===""&&n[1]===""&&(n[2]==="?"||!Hr.test(n[2]))&&!Hr.test(n[3]),c=/^[a-z]:/i.test(n[0]);if(h)return[...n.slice(0,4),...n.slice(4).map(l=>this.parse(l))];if(c)return[n[0],...n.slice(1).map(l=>this.parse(l))]}return n.map(h=>this.parse(h))});if(this.debug(this.pattern,r),this.set=r.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let a=this.set[n];a[0]===""&&a[1]===""&&this.globParts[n][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let r=0;r<t[s].length;r++)t[s][r]==="**"&&(t[s][r]="*");let{optimizationLevel:i=1}=this.options;return i>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):i>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(i=>{let s=-1;for(;(s=i.indexOf("**",s+1))!==-1;){let r=s;for(;i[r+1]==="**";)r++;r!==s&&i.splice(s,r-s)}return i})}levelOneOptimize(t){return t.map(i=>(i=i.reduce((s,r)=>{let n=s[s.length-1];return r==="**"&&n==="**"?s:r===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(s.pop(),s):(s.push(r),s)},[]),i.length===0?[""]:i))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let i=!1;do{if(i=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let n=t[r];r===1&&n===""&&t[0]===""||(n==="."||n==="")&&(i=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(i=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let r=t[s-1];r&&r!=="."&&r!==".."&&r!=="**"&&(i=!0,t.splice(s-1,2),s-=2)}}while(i);return t.length===0?[""]:t}firstPhasePreProcess(t){let i=!1;do{i=!1;for(let s of t){let r=-1;for(;(r=s.indexOf("**",r+1))!==-1;){let a=r;for(;s[a+1]==="**";)a++;a>r&&s.splice(r+1,a-r);let o=s[r+1],h=s[r+2],c=s[r+3];if(o!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;i=!0,s.splice(r,1);let l=s.slice(0);l[r]="**",t.push(l),r--}if(!this.preserveMultipleSlashes){for(let a=1;a<s.length-1;a++){let o=s[a];a===1&&o===""&&s[0]===""||(o==="."||o==="")&&(i=!0,s.splice(a,1),a--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(i=!0,s.pop())}let n=0;for(;(n=s.indexOf("..",n+1))!==-1;){let a=s[n-1];if(a&&a!=="."&&a!==".."&&a!=="**"){i=!0;let h=n===1&&s[n+1]==="**"?["."]:[];s.splice(n-1,2,...h),s.length===0&&s.push(""),n-=2}}}}while(i);return t}secondPhasePreProcess(t){for(let i=0;i<t.length-1;i++)for(let s=i+1;s<t.length;s++){let r=this.partsMatch(t[i],t[s],!this.preserveMultipleSlashes);if(r){t[i]=[],t[s]=r;break}}return t.filter(i=>i.length)}partsMatch(t,i,s=!1){let r=0,n=0,a=[],o="";for(;r<t.length&&n<i.length;)if(t[r]===i[n])a.push(o==="b"?i[n]:t[r]),r++,n++;else if(s&&t[r]==="**"&&i[n]===t[r+1])a.push(t[r]),r++;else if(s&&i[n]==="**"&&t[r]===i[n+1])a.push(i[n]),n++;else if(t[r]==="*"&&i[n]&&(this.options.dot||!i[n].startsWith("."))&&i[n]!=="**"){if(o==="b")return!1;o="a",a.push(t[r]),r++,n++}else if(i[n]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(o==="a")return!1;o="b",a.push(i[n]),r++,n++}else return!1;return t.length===i.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,i=!1,s=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)i=!i,s++;s&&(this.pattern=t.slice(s)),this.negate=i}matchOne(t,i,s=!1){let r=this.options;if(this.isWindows){let m=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),S=!m&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),y=typeof i[0]=="string"&&/^[a-z]:$/i.test(i[0]),E=!y&&i[0]===""&&i[1]===""&&i[2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3]),b=S?3:m?0:void 0,g=E?3:y?0:void 0;if(typeof b=="number"&&typeof g=="number"){let[_,L]=[t[b],i[g]];_.toLowerCase()===L.toLowerCase()&&(i[g]=_,g>b?i=i.slice(g):b>g&&(t=t.slice(b)))}}let{optimizationLevel:n=1}=this.options;n>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:i}),this.debug("matchOne",t.length,i.length);for(var a=0,o=0,h=t.length,c=i.length;a<h&&o<c;a++,o++){this.debug("matchOne loop");var l=i[o],f=t[a];if(this.debug(i,l,f),l===!1)return!1;if(l===W){this.debug("GLOBSTAR",[i,l,f]);var p=a,d=o+1;if(d===c){for(this.debug("** at the end");a<h;a++)if(t[a]==="."||t[a]===".."||!r.dot&&t[a].charAt(0)===".")return!1;return!0}for(;p<h;){var x=t[p];if(this.debug(`
|
|
15
15
|
globstar while`,t,p,i,d,x),this.matchOne(t.slice(p),i.slice(d),s))return this.debug("globstar found match!",p,h,x),!0;if(x==="."||x===".."||!r.dot&&x.charAt(0)==="."){this.debug("dot detected!",t,p,i,d);break}this.debug("globstar swallow a segment, and continue"),p++}return!!(s&&(this.debug(`
|
|
16
|
-
>>> no match, partial?`,t,p,i,d),p===h))}let m;if(typeof l=="string"?(m=f===l,this.debug("string match",l,f,m)):(m=l.test(f),this.debug("pattern match",l,f,m)),!m)return!1}if(a===h&&o===c)return!0;if(a===h)return s;if(o===c)return a===h-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return Yr(this.pattern,this.options)}parse(t){pe(t);let i=this.options;if(t==="**")return W;if(t==="")return"";let s,r=null;(s=t.match(fh))?r=i.dot?dh:ph:(s=t.match(ih))?r=(i.nocase?i.dot?ah:nh:i.dot?rh:sh)(s[1]):(s=t.match(mh))?r=(i.nocase?i.dot?xh:gh:i.dot?yh:bh)(s):(s=t.match(oh))?r=i.dot?uh:hh:(s=t.match(ch))&&(r=lh);let n=Qt.fromGlob(t,this.options).toMMPattern();return r&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:r}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let i=this.options,s=i.noglobstar?Sh:i.dot?Eh:_h,r=new Set(i.nocase?["i"]:[]),n=t.map(h=>{let c=h.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))r.add(p);return typeof f=="string"?Th(f):f===W?W:f._src});c.forEach((f,p)=>{let d=c[p+1],x=c[p-1];f!==W||x===W||(x===void 0?d!==void 0&&d!==W?c[p+1]="(?:\\/|"+s+"\\/)?"+d:c[p]=s:d===void 0?c[p-1]=x+"(?:\\/|\\/"+s+")?":d!==W&&(c[p-1]=x+"(?:\\/|\\/"+s+"\\/)"+d,c[p+1]=W))});let l=c.filter(f=>f!==W);if(this.partial&&l.length>=1){let f=[];for(let p=1;p<=l.length;p++)f.push(l.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return l.join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];n="^"+a+n+o+"$",this.partial&&(n="^(?:\\/|"+a+n.slice(1,-1)+o+")$"),this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,i=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&i)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let n=this.set;this.debug(this.pattern,"set",n);let a=r[r.length-1];if(!a)for(let o=r.length-2;!a&&o>=0;o--)a=r[o];for(let o=0;o<n.length;o++){let h=n[o],c=r;if(s.matchBase&&h.length===1&&(c=[a]),this.matchOne(c,h,i))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return Y.defaults(t).Minimatch}};Y.AST=Qt;Y.Minimatch=et;Y.escape=Yt;Y.unescape=dt;import{fileURLToPath as hu}from"node:url";var kh=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Jr=new Set,Qi=typeof process=="object"&&process?process:{},tn=(e,t,i,s)=>{typeof Qi.emitWarning=="function"?Qi.emitWarning(e,t,i,s):console.error(`[${i}] ${t}: ${e}`)},ze=globalThis.AbortController,Xr=globalThis.AbortSignal,Zr;if(typeof ze>"u"){Xr=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,r){this._onabort.push(r)}},ze=class{constructor(){t()}signal=new Xr;abort(s){var r,n;if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let a of this.signal._onabort)a(s);(n=(r=this.signal).onabort)==null||n.call(r,s)}}};let e=((Zr=Qi.env)==null?void 0:Zr.LRU_CACHE_IGNORE_AC_WARNING)!=="1",t=()=>{e&&(e=!1,tn("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var Ph=e=>!Jr.has(e),jc=Symbol("type"),Ot=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),en=e=>Ot(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Xt:null:null,Xt=class extends Array{constructor(t){super(t),this.fill(0)}},Yi=class e{heap;length;static#t=!1;static create(t){let i=en(t);if(!i)return[];e.#t=!0;let s=new e(t,i);return e.#t=!1,s}constructor(t,i){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},me=class e{#t;#e;#n;#r;#a;#v;#y;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#f;#l;#h;#i;#d;#w;#b;#m;#R;#g;#E;#A;#x;#S;#I;#p;#s;static unsafeExposeInternals(t){return{starts:t.#A,ttls:t.#x,sizes:t.#E,keyMap:t.#l,keyList:t.#h,valList:t.#i,next:t.#d,prev:t.#w,get head(){return t.#b},get tail(){return t.#m},free:t.#R,isBackgroundFetch:i=>t.#u(i),backgroundFetch:(i,s,r,n)=>t.#W(i,s,r,n),moveToTail:i=>t.#M(i),indexes:i=>t.#k(i),rindexes:i=>t.#N(i),isStale:i=>t.#C(i)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#f}get size(){return this.#o}get fetchMethod(){return this.#v}get memoMethod(){return this.#y}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#a}constructor(t){let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:h,dispose:c,onInsert:l,disposeAfter:f,noDisposeOnSet:p,noUpdateTTL:d,maxSize:x=0,maxEntrySize:m=0,sizeCalculation:S,fetchMethod:y,memoMethod:E,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:g,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:L,ignoreFetchAbort:I,perf:q}=t;if(q!==void 0&&typeof(q==null?void 0:q.now)!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#c=q??kh,i!==0&&!Ot(i))throw new TypeError("max option must be a nonnegative integer");let M=i?en(i):Array;if(!M)throw new Error("invalid max value: "+i);if(this.#t=i,this.#e=x,this.maxEntrySize=m||this.#e,this.sizeCalculation=S,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#y=E,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#v=y,this.#I=!!y,this.#l=new Map,this.#h=new Array(i).fill(void 0),this.#i=new Array(i).fill(void 0),this.#d=new M(i),this.#w=new M(i),this.#b=0,this.#m=0,this.#R=Yi.create(i),this.#o=0,this.#f=0,typeof c=="function"&&(this.#n=c),typeof l=="function"&&(this.#r=l),typeof f=="function"?(this.#a=f,this.#g=[]):(this.#a=void 0,this.#g=void 0),this.#S=!!this.#n,this.#s=!!this.#r,this.#p=!!this.#a,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!L,this.ignoreFetchAbort=!!I,this.maxEntrySize!==0){if(this.#e!==0&&!Ot(this.#e))throw new TypeError("maxSize must be a positive integer if specified");if(!Ot(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!g,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=Ot(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!Ot(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#t===0&&this.ttl===0&&this.#e===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let k="LRU_CACHE_UNBOUNDED";Ph(k)&&(Jr.add(k),tn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,e))}}getRemainingTTL(t){return this.#l.has(t)?1/0:0}#O(){let t=new Xt(this.#t),i=new Xt(this.#t);this.#x=t,this.#A=i,this.#j=(n,a,o=this.#c.now())=>{if(i[n]=a!==0?o:0,t[n]=a,a!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#C(n)&&this.#P(this.#h[n],"expire")},a+1);h.unref&&h.unref()}},this.#T=n=>{i[n]=t[n]!==0?this.#c.now():0},this.#_=(n,a)=>{if(t[a]){let o=t[a],h=i[a];if(!o||!h)return;n.ttl=o,n.start=h,n.now=s||r();let c=n.now-h;n.remainingTTL=o-c}};let s=0,r=()=>{let n=this.#c.now();if(this.ttlResolution>0){s=n;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#l.get(n);if(a===void 0)return 0;let o=t[a],h=i[a];if(!o||!h)return 1/0;let c=(s||r())-h;return o-c},this.#C=n=>{let a=i[n],o=t[n];return!!o&&!!a&&(s||r())-a>o}}#T=()=>{};#_=()=>{};#j=()=>{};#C=()=>!1;#B(){let t=new Xt(this.#t);this.#f=0,this.#E=t,this.#L=i=>{this.#f-=t[i],t[i]=0},this.#D=(i,s,r,n)=>{if(this.#u(s))return 0;if(!Ot(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!Ot(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#V=(i,s,r)=>{if(t[i]=s,this.#e){let n=this.#e-t[i];for(;this.#f>n;)this.#F(!0)}this.#f+=t[i],r&&(r.entrySize=s,r.totalCalculatedSize=this.#f)}}#L=t=>{};#V=(t,i,s)=>{};#D=(t,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:t=this.allowStale}={}){if(this.#o)for(let i=this.#m;!(!this.#$(i)||((t||!this.#C(i))&&(yield i),i===this.#b));)i=this.#w[i]}*#N({allowStale:t=this.allowStale}={}){if(this.#o)for(let i=this.#b;!(!this.#$(i)||((t||!this.#C(i))&&(yield i),i===this.#m));)i=this.#d[i]}#$(t){return t!==void 0&&this.#l.get(this.#h[t])===t}*entries(){for(let t of this.#k())this.#i[t]!==void 0&&this.#h[t]!==void 0&&!this.#u(this.#i[t])&&(yield[this.#h[t],this.#i[t]])}*rentries(){for(let t of this.#N())this.#i[t]!==void 0&&this.#h[t]!==void 0&&!this.#u(this.#i[t])&&(yield[this.#h[t],this.#i[t]])}*keys(){for(let t of this.#k()){let i=this.#h[t];i!==void 0&&!this.#u(this.#i[t])&&(yield i)}}*rkeys(){for(let t of this.#N()){let i=this.#h[t];i!==void 0&&!this.#u(this.#i[t])&&(yield i)}}*values(){for(let t of this.#k())this.#i[t]!==void 0&&!this.#u(this.#i[t])&&(yield this.#i[t])}*rvalues(){for(let t of this.#N())this.#i[t]!==void 0&&!this.#u(this.#i[t])&&(yield this.#i[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,i={}){for(let s of this.#k()){let r=this.#i[s],n=this.#u(r)?r.__staleWhileFetching:r;if(n!==void 0&&t(n,this.#h[s],this))return this.get(this.#h[s],i)}}forEach(t,i=this){for(let s of this.#k()){let r=this.#i[s],n=this.#u(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(i,n,this.#h[s],this)}}rforEach(t,i=this){for(let s of this.#N()){let r=this.#i[s],n=this.#u(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(i,n,this.#h[s],this)}}purgeStale(){let t=!1;for(let i of this.#N({allowStale:!0}))this.#C(i)&&(this.#P(this.#h[i],"expire"),t=!0);return t}info(t){let i=this.#l.get(t);if(i===void 0)return;let s=this.#i[i],r=this.#u(s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(this.#x&&this.#A){let a=this.#x[i],o=this.#A[i];if(a&&o){let h=a-(this.#c.now()-o);n.ttl=h,n.start=Date.now()}}return this.#E&&(n.size=this.#E[i]),n}dump(){let t=[];for(let i of this.#k({allowStale:!0})){let s=this.#h[i],r=this.#i[i],n=this.#u(r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let a={value:n};if(this.#x&&this.#A){a.ttl=this.#x[i];let o=this.#c.now()-this.#A[i];a.start=Math.floor(Date.now()-o)}this.#E&&(a.size=this.#E[i]),t.unshift([s,a])}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let r=Date.now()-s.start;s.start=this.#c.now()-r}this.set(i,s.value,s)}}set(t,i,s={}){var p,d,x,m,S,y,E;if(i===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:h}=s,{noUpdateTTL:c=this.noUpdateTTL}=s,l=this.#D(t,i,s.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#P(t,"set"),this;let f=this.#o===0?void 0:this.#l.get(t);if(f===void 0)f=this.#o===0?this.#m:this.#R.length!==0?this.#R.pop():this.#o===this.#t?this.#F(!1):this.#o,this.#h[f]=t,this.#i[f]=i,this.#l.set(t,f),this.#d[this.#m]=f,this.#w[f]=this.#m,this.#m=f,this.#o++,this.#V(f,l,h),h&&(h.set="add"),c=!1,this.#s&&((p=this.#r)==null||p.call(this,i,t,"add"));else{this.#M(f);let b=this.#i[f];if(i!==b){if(this.#I&&this.#u(b)){b.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=b;g!==void 0&&!a&&(this.#S&&((d=this.#n)==null||d.call(this,g,t,"set")),this.#p&&((x=this.#g)==null||x.push([g,t,"set"])))}else a||(this.#S&&((m=this.#n)==null||m.call(this,b,t,"set")),this.#p&&((S=this.#g)==null||S.push([b,t,"set"])));if(this.#L(f),this.#V(f,l,h),this.#i[f]=i,h){h.set="replace";let g=b&&this.#u(b)?b.__staleWhileFetching:b;g!==void 0&&(h.oldValue=g)}}else h&&(h.set="update");this.#s&&((y=this.onInsert)==null||y.call(this,i,t,i===b?"update":"replace"))}if(r!==0&&!this.#x&&this.#O(),this.#x&&(c||this.#j(f,r,n),h&&this.#_(h,f)),!a&&this.#p&&this.#g){let b=this.#g,g;for(;g=b==null?void 0:b.shift();)(E=this.#a)==null||E.call(this,...g)}return this}pop(){var t;try{for(;this.#o;){let i=this.#i[this.#b];if(this.#F(!0),this.#u(i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(this.#p&&this.#g){let i=this.#g,s;for(;s=i==null?void 0:i.shift();)(t=this.#a)==null||t.call(this,...s)}}}#F(t){var n,a;let i=this.#b,s=this.#h[i],r=this.#i[i];return this.#I&&this.#u(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#p)&&(this.#S&&((n=this.#n)==null||n.call(this,r,s,"evict")),this.#p&&((a=this.#g)==null||a.push([r,s,"evict"]))),this.#L(i),t&&(this.#h[i]=void 0,this.#i[i]=void 0,this.#R.push(i)),this.#o===1?(this.#b=this.#m=0,this.#R.length=0):this.#b=this.#d[i],this.#l.delete(s),this.#o--,i}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=this.#l.get(t);if(n!==void 0){let a=this.#i[n];if(this.#u(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#C(n))r&&(r.has="stale",this.#_(r,n));else return s&&this.#T(n),r&&(r.has="hit",this.#_(r,n)),!0}else r&&(r.has="miss");return!1}peek(t,i={}){let{allowStale:s=this.allowStale}=i,r=this.#l.get(t);if(r===void 0||!s&&this.#C(r))return;let n=this.#i[r];return this.#u(n)?n.__staleWhileFetching:n}#W(t,i,s,r){let n=i===void 0?void 0:this.#i[i];if(this.#u(n))return n;let a=new ze,{signal:o}=s;o==null||o.addEventListener("abort",()=>a.abort(o.reason),{signal:a.signal});let h={signal:a.signal,options:s,context:r},c=(m,S=!1)=>{let{aborted:y}=a.signal,E=s.ignoreFetchAbort&&m!==void 0;if(s.status&&(y&&!S?(s.status.fetchAborted=!0,s.status.fetchError=a.signal.reason,E&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),y&&!E&&!S)return f(a.signal.reason);let b=d,g=this.#i[i];return(g===d||E&&S&&g===void 0)&&(m===void 0?b.__staleWhileFetching!==void 0?this.#i[i]=b.__staleWhileFetching:this.#P(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,m,h.options))),m},l=m=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=m),f(m)),f=m=>{let{aborted:S}=a.signal,y=S&&s.allowStaleOnFetchAbort,E=y||s.allowStaleOnFetchRejection,b=E||s.noDeleteOnFetchRejection,g=d;if(this.#i[i]===d&&(!b||g.__staleWhileFetching===void 0?this.#P(t,"fetch"):y||(this.#i[i]=g.__staleWhileFetching)),E)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),g.__staleWhileFetching;if(g.__returned===g)throw m},p=(m,S)=>{var E;let y=(E=this.#v)==null?void 0:E.call(this,t,n,h);y&&y instanceof Promise&&y.then(b=>m(b===void 0?void 0:b),S),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(m(void 0),s.allowStaleOnFetchAbort&&(m=b=>c(b,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(p).then(c,l),x=Object.assign(d,{__abortController:a,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(t,x,{...h.options,status:void 0}),i=this.#l.get(t)):this.#i[i]=x,x}#u(t){if(!this.#I)return!1;let i=t;return!!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof ze}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:h=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:m,forceRefresh:S=!1,status:y,signal:E}=i;if(!this.#I)return y&&(y.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:y});let b={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:a,noDisposeOnSet:o,size:h,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:x,ignoreFetchAbort:d,status:y,signal:E},g=this.#l.get(t);if(g===void 0){y&&(y.fetch="miss");let _=this.#W(t,g,b,m);return _.__returned=_}else{let _=this.#i[g];if(this.#u(_)){let k=s&&_.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",k&&(y.returnedStale=!0)),k?_.__staleWhileFetching:_.__returned=_}let L=this.#C(g);if(!S&&!L)return y&&(y.fetch="hit"),this.#M(g),r&&this.#T(g),y&&this.#_(y,g),_;let I=this.#W(t,g,b,m),M=I.__staleWhileFetching!==void 0&&s;return y&&(y.fetch=L?"stale":"refresh",M&&L&&(y.returnedStale=!0)),M?I.__staleWhileFetching:I.__returned=I}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=this.#y;if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...a}=i,o=this.get(t,a);if(!n&&o!==void 0)return o;let h=s(t,o,{options:a,context:r});return this.set(t,h,a),h}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:a}=i,o=this.#l.get(t);if(o!==void 0){let h=this.#i[o],c=this.#u(h);return a&&this.#_(a,o),this.#C(o)?(a&&(a.get="stale"),c?(a&&s&&h.__staleWhileFetching!==void 0&&(a.returnedStale=!0),s?h.__staleWhileFetching:void 0):(n||this.#P(t,"expire"),a&&s&&(a.returnedStale=!0),s?h:void 0)):(a&&(a.get="hit"),c?h.__staleWhileFetching:(this.#M(o),r&&this.#T(o),h))}else a&&(a.get="miss")}#G(t,i){this.#w[i]=t,this.#d[t]=i}#M(t){t!==this.#m&&(t===this.#b?this.#b=this.#d[t]:this.#G(this.#w[t],this.#d[t]),this.#G(this.#m,t),this.#m=t)}delete(t){return this.#P(t,"delete")}#P(t,i){var r,n,a,o;let s=!1;if(this.#o!==0){let h=this.#l.get(t);if(h!==void 0)if(s=!0,this.#o===1)this.#U(i);else{this.#L(h);let c=this.#i[h];if(this.#u(c)?c.__abortController.abort(new Error("deleted")):(this.#S||this.#p)&&(this.#S&&((r=this.#n)==null||r.call(this,c,t,i)),this.#p&&((n=this.#g)==null||n.push([c,t,i]))),this.#l.delete(t),this.#h[h]=void 0,this.#i[h]=void 0,h===this.#m)this.#m=this.#w[h];else if(h===this.#b)this.#b=this.#d[h];else{let l=this.#w[h];this.#d[l]=this.#d[h];let f=this.#d[h];this.#w[f]=this.#w[h]}this.#o--,this.#R.push(h)}}if(this.#p&&((a=this.#g)!=null&&a.length)){let h=this.#g,c;for(;c=h==null?void 0:h.shift();)(o=this.#a)==null||o.call(this,...c)}return s}clear(){return this.#U("delete")}#U(t){var i,s,r;for(let n of this.#N({allowStale:!0})){let a=this.#i[n];if(this.#u(a))a.__abortController.abort(new Error("deleted"));else{let o=this.#h[n];this.#S&&((i=this.#n)==null||i.call(this,a,o,t)),this.#p&&((s=this.#g)==null||s.push([a,o,t]))}}if(this.#l.clear(),this.#i.fill(void 0),this.#h.fill(void 0),this.#x&&this.#A&&(this.#x.fill(0),this.#A.fill(0)),this.#E&&this.#E.fill(0),this.#b=0,this.#m=0,this.#R.length=0,this.#f=0,this.#o=0,this.#p&&this.#g){let n=this.#g,a;for(;a=n==null?void 0:n.shift();)(r=this.#a)==null||r.call(this,...a)}}};import{posix as $h,win32 as as}from"node:path";import{fileURLToPath as Wh}from"node:url";import{lstatSync as Gh,readdir as zh,readdirSync as Hh,readlinkSync as qh,realpathSync as Kh}from"fs";import*as Qh from"node:fs";import{lstat as Xh,readdir as Zh,readlink as Jh,realpath as tu}from"node:fs/promises";import{EventEmitter as ss}from"node:events";import on from"node:stream";import{StringDecoder as Nh}from"node:string_decoder";var sn=typeof process=="object"&&process?process:{stdout:null,stderr:null},Oh=e=>!!e&&typeof e=="object"&&(e instanceof Dt||e instanceof on||Lh(e)||Dh(e)),Lh=e=>!!e&&typeof e=="object"&&e instanceof ss&&typeof e.pipe=="function"&&e.pipe!==on.Writable.prototype.pipe,Dh=e=>!!e&&typeof e=="object"&&e instanceof ss&&typeof e.write=="function"&&typeof e.end=="function",At=Symbol("EOF"),It=Symbol("maybeEmitEnd"),Lt=Symbol("emittedEnd"),He=Symbol("emittingEnd"),ge=Symbol("emittedError"),qe=Symbol("closed"),rn=Symbol("read"),Ke=Symbol("flush"),nn=Symbol("flushChunk"),mt=Symbol("encoding"),Zt=Symbol("decoder"),U=Symbol("flowing"),xe=Symbol("paused"),Jt=Symbol("resume"),j=Symbol("buffer"),X=Symbol("pipes"),$=Symbol("bufferLength"),Xi=Symbol("bufferPush"),Qe=Symbol("bufferShift"),z=Symbol("objectMode"),F=Symbol("destroyed"),Zi=Symbol("error"),Ji=Symbol("emitData"),an=Symbol("emitEnd"),ts=Symbol("emitEnd2"),wt=Symbol("async"),es=Symbol("abort"),Ye=Symbol("aborted"),ye=Symbol("signal"),Ut=Symbol("dataListeners"),it=Symbol("discarded"),be=e=>Promise.resolve().then(e),Fh=e=>e(),Mh=e=>e==="end"||e==="finish"||e==="prefinish",Bh=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Vh=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),Xe=class{src;dest;opts;ondrain;constructor(t,i,s){this.src=t,this.dest=i,this.opts=s,this.ondrain=()=>t[Jt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},is=class extends Xe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,i,s){super(t,i,s),this.proxyErrors=r=>i.emit("error",r),t.on("error",this.proxyErrors)}},Uh=e=>!!e.objectMode,jh=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Dt=class extends ss{[U]=!1;[xe]=!1;[X]=[];[j]=[];[z];[mt];[wt];[Zt];[At]=!1;[Lt]=!1;[He]=!1;[qe]=!1;[ge]=null;[$]=0;[F]=!1;[ye];[Ye]=!1;[Ut]=0;[it]=!1;writable=!0;readable=!0;constructor(...t){let i=t[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Uh(i)?(this[z]=!0,this[mt]=null):jh(i)?(this[mt]=i.encoding,this[z]=!1):(this[z]=!1,this[mt]=null),this[wt]=!!i.async,this[Zt]=this[mt]?new Nh(this[mt]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[j]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[X]});let{signal:s}=i;s&&(this[ye]=s,s.aborted?this[es]():s.addEventListener("abort",()=>this[es]()))}get bufferLength(){return this[$]}get encoding(){return this[mt]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[z]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[wt]}set async(t){this[wt]=this[wt]||!!t}[es](){var t,i;this[Ye]=!0,this.emit("abort",(t=this[ye])==null?void 0:t.reason),this.destroy((i=this[ye])==null?void 0:i.reason)}get aborted(){return this[Ye]}set aborted(t){}write(t,i,s){var n;if(this[Ye])return!1;if(this[At])throw new Error("write after end");if(this[F])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(s=i,i="utf8"),i||(i="utf8");let r=this[wt]?be:Fh;if(!this[z]&&!Buffer.isBuffer(t)){if(Vh(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Bh(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[z]?(this[U]&&this[$]!==0&&this[Ke](!0),this[U]?this.emit("data",t):this[Xi](t),this[$]!==0&&this.emit("readable"),s&&r(s),this[U]):t.length?(typeof t=="string"&&!(i===this[mt]&&!((n=this[Zt])!=null&&n.lastNeed))&&(t=Buffer.from(t,i)),Buffer.isBuffer(t)&&this[mt]&&(t=this[Zt].write(t)),this[U]&&this[$]!==0&&this[Ke](!0),this[U]?this.emit("data",t):this[Xi](t),this[$]!==0&&this.emit("readable"),s&&r(s),this[U]):(this[$]!==0&&this.emit("readable"),s&&r(s),this[U])}read(t){if(this[F])return null;if(this[it]=!1,this[$]===0||t===0||t&&t>this[$])return this[It](),null;this[z]&&(t=null),this[j].length>1&&!this[z]&&(this[j]=[this[mt]?this[j].join(""):Buffer.concat(this[j],this[$])]);let i=this[rn](t||null,this[j][0]);return this[It](),i}[rn](t,i){if(this[z])this[Qe]();else{let s=i;t===s.length||t===null?this[Qe]():typeof s=="string"?(this[j][0]=s.slice(t),i=s.slice(0,t),this[$]-=t):(this[j][0]=s.subarray(t),i=s.subarray(0,t),this[$]-=t)}return this.emit("data",i),!this[j].length&&!this[At]&&this.emit("drain"),i}end(t,i,s){return typeof t=="function"&&(s=t,t=void 0),typeof i=="function"&&(s=i,i="utf8"),t!==void 0&&this.write(t,i),s&&this.once("end",s),this[At]=!0,this.writable=!1,(this[U]||!this[xe])&&this[It](),this}[Jt](){this[F]||(!this[Ut]&&!this[X].length&&(this[it]=!0),this[xe]=!1,this[U]=!0,this.emit("resume"),this[j].length?this[Ke]():this[At]?this[It]():this.emit("drain"))}resume(){return this[Jt]()}pause(){this[U]=!1,this[xe]=!0,this[it]=!1}get destroyed(){return this[F]}get flowing(){return this[U]}get paused(){return this[xe]}[Xi](t){this[z]?this[$]+=1:this[$]+=t.length,this[j].push(t)}[Qe](){return this[z]?this[$]-=1:this[$]-=this[j][0].length,this[j].shift()}[Ke](t=!1){do;while(this[nn](this[Qe]())&&this[j].length);!t&&!this[j].length&&!this[At]&&this.emit("drain")}[nn](t){return this.emit("data",t),this[U]}pipe(t,i){if(this[F])return t;this[it]=!1;let s=this[Lt];return i=i||{},t===sn.stdout||t===sn.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,s?i.end&&t.end():(this[X].push(i.proxyErrors?new is(this,t,i):new Xe(this,t,i)),this[wt]?be(()=>this[Jt]()):this[Jt]()),t}unpipe(t){let i=this[X].find(s=>s.dest===t);i&&(this[X].length===1?(this[U]&&this[Ut]===0&&(this[U]=!1),this[X]=[]):this[X].splice(this[X].indexOf(i),1),i.unpipe())}addListener(t,i){return this.on(t,i)}on(t,i){let s=super.on(t,i);if(t==="data")this[it]=!1,this[Ut]++,!this[X].length&&!this[U]&&this[Jt]();else if(t==="readable"&&this[$]!==0)super.emit("readable");else if(Mh(t)&&this[Lt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[ge]){let r=i;this[wt]?be(()=>r.call(this,this[ge])):r.call(this,this[ge])}return s}removeListener(t,i){return this.off(t,i)}off(t,i){let s=super.off(t,i);return t==="data"&&(this[Ut]=this.listeners("data").length,this[Ut]===0&&!this[it]&&!this[X].length&&(this[U]=!1)),s}removeAllListeners(t){let i=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[Ut]=0,!this[it]&&!this[X].length&&(this[U]=!1)),i}get emittedEnd(){return this[Lt]}[It](){!this[He]&&!this[Lt]&&!this[F]&&this[j].length===0&&this[At]&&(this[He]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[qe]&&this.emit("close"),this[He]=!1)}emit(t,...i){let s=i[0];if(t!=="error"&&t!=="close"&&t!==F&&this[F])return!1;if(t==="data")return!this[z]&&!s?!1:this[wt]?(be(()=>this[Ji](s)),!0):this[Ji](s);if(t==="end")return this[an]();if(t==="close"){if(this[qe]=!0,!this[Lt]&&!this[F])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[ge]=s,super.emit(Zi,s);let n=!this[ye]||this.listeners("error").length?super.emit("error",s):!1;return this[It](),n}else if(t==="resume"){let n=super.emit("resume");return this[It](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...i);return this[It](),r}[Ji](t){for(let s of this[X])s.dest.write(t)===!1&&this.pause();let i=this[it]?!1:super.emit("data",t);return this[It](),i}[an](){return this[Lt]?!1:(this[Lt]=!0,this.readable=!1,this[wt]?(be(()=>this[ts]()),!0):this[ts]())}[ts](){if(this[Zt]){let i=this[Zt].end();if(i){for(let s of this[X])s.dest.write(i);this[it]||super.emit("data",i)}}for(let i of this[X])i.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[z]||(t.dataLength=0);let i=this.promise();return this.on("data",s=>{t.push(s),this[z]||(t.dataLength+=s.length)}),await i,t}async concat(){if(this[z])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[mt]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,i)=>{this.on(F,()=>i(new Error("stream destroyed"))),this.on("error",s=>i(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[it]=!1;let t=!1,i=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[At])return i();let n,a,o=f=>{this.off("data",h),this.off("end",c),this.off(F,l),i(),a(f)},h=f=>{this.off("error",o),this.off("end",c),this.off(F,l),this.pause(),n({value:f,done:!!this[At]})},c=()=>{this.off("error",o),this.off("data",h),this.off(F,l),i(),n({done:!0,value:void 0})},l=()=>o(new Error("stream destroyed"));return new Promise((f,p)=>{a=p,n=f,this.once(F,l),this.once("error",o),this.once("end",c),this.once("data",h)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[it]=!1;let t=!1,i=()=>(this.pause(),this.off(Zi,i),this.off(F,i),this.off("end",i),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Zi,i),this.once(F,i),{next:s,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(t){if(this[F])return t?this.emit("error",t):this.emit(F),this;this[F]=!0,this[it]=!0,this[j].length=0,this[$]=0;let i=this;return typeof i.close=="function"&&!this[qe]&&i.close(),t?this.emit("error",t):this.emit(F),this}static get isStream(){return Oh}};var Yh=Kh.native,we={lstatSync:Gh,readdir:zh,readdirSync:Hh,readlinkSync:qh,realpathSync:Yh,promises:{lstat:Xh,readdir:Zh,readlink:Jh,realpath:tu}},fn=e=>!e||e===we||e===Qh?we:{...we,...e,promises:{...we.promises,...e.promises||{}}},pn=/^\\\\\?\\([a-z]:)\\?$/i,eu=e=>e.replace(/\//g,"\\").replace(pn,"$1\\"),iu=/[\\\/]/,ct=0,dn=1,mn=2,St=4,gn=6,xn=8,jt=10,yn=12,ut=15,ve=~ut,rs=16,hn=32,Se=64,gt=128,Ze=256,ti=512,un=Se|gt|ti,su=1023,ns=e=>e.isFile()?xn:e.isDirectory()?St:e.isSymbolicLink()?jt:e.isCharacterDevice()?mn:e.isBlockDevice()?gn:e.isSocket()?yn:e.isFIFO()?dn:ct,cn=new Map,Ee=e=>{let t=cn.get(e);if(t)return t;let i=e.normalize("NFKD");return cn.set(e,i),i},ln=new Map,Je=e=>{let t=ln.get(e);if(t)return t;let i=Ee(e.toLowerCase());return ln.set(e,i),i},ei=class extends me{constructor(){super({max:256})}},os=class extends me{constructor(t=16*1024){super({maxSize:t,sizeCalculation:i=>i.length+1})}},bn=Symbol("PathScurry setAsCwd"),H=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#a;get uid(){return this.#a}#v;get gid(){return this.#v}#y;get rdev(){return this.#y}#c;get blksize(){return this.#c}#o;get ino(){return this.#o}#f;get size(){return this.#f}#l;get blocks(){return this.#l}#h;get atimeMs(){return this.#h}#i;get mtimeMs(){return this.#i}#d;get ctimeMs(){return this.#d}#w;get birthtimeMs(){return this.#w}#b;get atime(){return this.#b}#m;get mtime(){return this.#m}#R;get ctime(){return this.#R}#g;get birthtime(){return this.#g}#E;#A;#x;#S;#I;#p;#s;#O;#T;#_;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,i=ct,s,r,n,a,o){this.name=t,this.#E=n?Je(t):Ee(t),this.#s=i&su,this.nocase=n,this.roots=r,this.root=s||this,this.#O=a,this.#x=o.fullpath,this.#I=o.relative,this.#p=o.relativePosix,this.parent=o.parent,this.parent?this.#t=this.parent.#t:this.#t=fn(o.fs)}depth(){return this.#A!==void 0?this.#A:this.parent?this.#A=this.parent.depth()+1:this.#A=0}childrenCache(){return this.#O}resolve(t){if(!t)return this;let i=this.getRootString(t),r=t.substring(i.length).split(this.splitSep);return i?this.getRoot(i).#j(r):this.#j(r)}#j(t){let i=this;for(let s of t)i=i.child(s);return i}children(){let t=this.#O.get(this);if(t)return t;let i=Object.assign([],{provisional:0});return this.#O.set(this,i),this.#s&=~rs,i}child(t,i){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),r=this.nocase?Je(t):Ee(t);for(let h of s)if(h.#E===r)return h;let n=this.parent?this.sep:"",a=this.#x?this.#x+n+t:void 0,o=this.newChild(t,ct,{...i,parent:this,fullpath:a});return this.canReaddir()||(o.#s|=gt),s.push(o),o}relative(){if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let t=this.name,i=this.parent;if(!i)return this.#I=this.name;let s=i.relative();return s+(!s||!i.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#p!==void 0)return this.#p;let t=this.name,i=this.parent;if(!i)return this.#p=this.fullpathPosix();let s=i.relativePosix();return s+(!s||!i.parent?"":"/")+t}fullpath(){if(this.#x!==void 0)return this.#x;let t=this.name,i=this.parent;if(!i)return this.#x=this.name;let r=i.fullpath()+(i.parent?this.sep:"")+t;return this.#x=r}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let r=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(r)?this.#S=`//?/${r}`:this.#S=r}let t=this.parent,i=t.fullpathPosix(),s=i+(!i||!t.parent?"":"/")+this.name;return this.#S=s}isUnknown(){return(this.#s&ut)===ct}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&ut)===xn}isDirectory(){return(this.#s&ut)===St}isCharacterDevice(){return(this.#s&ut)===mn}isBlockDevice(){return(this.#s&ut)===gn}isFIFO(){return(this.#s&ut)===dn}isSocket(){return(this.#s&ut)===yn}isSymbolicLink(){return(this.#s&jt)===jt}lstatCached(){return this.#s&hn?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#_}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let t=this.#s&ut;return!(t!==ct&&t!==jt||this.#s&Ze||this.#s>)}calledReaddir(){return!!(this.#s&rs)}isENOENT(){return!!(this.#s>)}isNamed(t){return this.nocase?this.#E===Je(t):this.#E===Ee(t)}async readlink(){var i;let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await this.#t.promises.readlink(this.fullpath()),r=(i=await this.parent.realpath())==null?void 0:i.resolve(s);if(r)return this.#T=r}catch(s){this.#$(s.code);return}}readlinkSync(){var i;let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=this.#t.readlinkSync(this.fullpath()),r=(i=this.parent.realpathSync())==null?void 0:i.resolve(s);if(r)return this.#T=r}catch(s){this.#$(s.code);return}}#C(t){this.#s|=rs;for(let i=t.provisional;i<t.length;i++){let s=t[i];s&&s.#B()}}#B(){this.#s>||(this.#s=(this.#s|gt)&ve,this.#L())}#L(){let t=this.children();t.provisional=0;for(let i of t)i.#B()}#V(){this.#s|=ti,this.#D()}#D(){if(this.#s&Se)return;let t=this.#s;(t&ut)===St&&(t&=ve),this.#s=t|Se,this.#L()}#k(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#B():this.children().provisional=0}#N(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#B()}#$(t=""){let i=this.#s;i|=Ze,t==="ENOENT"&&(i|=gt),(t==="EINVAL"||t==="UNKNOWN")&&(i&=ve),this.#s=i,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#F(t,i){return this.#u(t,i)||this.#W(t,i)}#W(t,i){let s=ns(t),r=this.newChild(t.name,s,{parent:this}),n=r.#s&ut;return n!==St&&n!==jt&&n!==ct&&(r.#s|=Se),i.unshift(r),i.provisional++,r}#u(t,i){for(let s=i.provisional;s<i.length;s++){let r=i[s];if((this.nocase?Je(t.name):Ee(t.name))===r.#E)return this.#G(t,r,s,i)}}#G(t,i,s,r){let n=i.name;return i.#s=i.#s&ve|ns(t),n!==t.name&&(i.name=t.name),s!==r.provisional&&(s===r.length-1?r.pop():r.splice(s,1),r.unshift(i)),r.provisional++,i}async lstat(){if((this.#s>)===0)try{return this.#M(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#N(t.code)}}lstatSync(){if((this.#s>)===0)try{return this.#M(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#N(t.code)}}#M(t){let{atime:i,atimeMs:s,birthtime:r,birthtimeMs:n,blksize:a,blocks:o,ctime:h,ctimeMs:c,dev:l,gid:f,ino:p,mode:d,mtime:x,mtimeMs:m,nlink:S,rdev:y,size:E,uid:b}=t;this.#b=i,this.#h=s,this.#g=r,this.#w=n,this.#c=a,this.#l=o,this.#R=h,this.#d=c,this.#e=l,this.#v=f,this.#o=p,this.#n=d,this.#m=x,this.#i=m,this.#r=S,this.#y=y,this.#f=E,this.#a=b;let g=ns(t);this.#s=this.#s&ve|g|hn,g!==ct&&g!==St&&g!==jt&&(this.#s|=Se)}#P=[];#U=!1;#H(t){this.#U=!1;let i=this.#P.slice();this.#P.length=0,i.forEach(s=>s(null,t))}readdirCB(t,i=!1){if(!this.canReaddir()){i?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let n=s.slice(0,s.provisional);i?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#P.push(t),this.#U)return;this.#U=!0;let r=this.fullpath();this.#t.readdir(r,{withFileTypes:!0},(n,a)=>{if(n)this.#k(n.code),s.provisional=0;else{for(let o of a)this.#F(o,s);this.#C(s)}this.#H(s.slice(0,s.provisional))})}#z;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let i=this.fullpath();if(this.#z)await this.#z;else{let s=()=>{};this.#z=new Promise(r=>s=r);try{for(let r of await this.#t.promises.readdir(i,{withFileTypes:!0}))this.#F(r,t);this.#C(t)}catch(r){this.#k(r.code),t.provisional=0}this.#z=void 0,s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let i=this.fullpath();try{for(let s of this.#t.readdirSync(i,{withFileTypes:!0}))this.#F(s,t);this.#C(t)}catch(s){this.#k(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#s&un)return!1;let t=ut&this.#s;return t===ct||t===St||t===jt}shouldWalk(t,i){return(this.#s&St)===St&&!(this.#s&un)&&!t.has(this)&&(!i||i(this))}async realpath(){if(this.#_)return this.#_;if(!((ti|Ze|gt)&this.#s))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#_=this.resolve(t)}catch{this.#V()}}realpathSync(){if(this.#_)return this.#_;if(!((ti|Ze|gt)&this.#s))try{let t=this.#t.realpathSync(this.fullpath());return this.#_=this.resolve(t)}catch{this.#V()}}[bn](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let i=new Set([]),s=[],r=this;for(;r&&r.parent;)i.add(r),r.#I=s.join(this.sep),r.#p=s.join("/"),r=r.parent,s.push("..");for(r=t;r&&r.parent&&!i.has(r);)r.#I=void 0,r.#p=void 0,r=r.parent}},ii=class e extends H{sep="\\";splitSep=iu;constructor(t,i=ct,s,r,n,a,o){super(t,i,s,r,n,a,o)}newChild(t,i=ct,s={}){return new e(t,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return as.parse(t).root}getRoot(t){if(t=eu(t.toUpperCase()),t===this.root.name)return this.root;for(let[i,s]of Object.entries(this.roots))if(this.sameRoot(t,i))return this.roots[t]=s;return this.roots[t]=new te(t,this).root}sameRoot(t,i=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(pn,"$1\\"),t===i}},si=class e extends H{splitSep="/";sep="/";constructor(t,i=ct,s,r,n,a,o){super(t,i,s,r,n,a,o)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,i=ct,s={}){return new e(t,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ri=class{root;rootPath;roots;cwd;#t;#e;#n;nocase;#r;constructor(t=process.cwd(),i,s,{nocase:r,childrenCacheSize:n=16*1024,fs:a=we}={}){this.#r=fn(a),(t instanceof URL||t.startsWith("file://"))&&(t=Wh(t));let o=i.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#t=new ei,this.#e=new ei,this.#n=new os(n);let h=o.substring(this.rootPath.length).split(s);if(h.length===1&&!h[0]&&h.pop(),r===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=h.length-1,f=i.sep,p=this.rootPath,d=!1;for(let x of h){let m=l--;c=c.child(x,{relative:new Array(m).fill("..").join(f),relativePosix:new Array(m).fill("..").join("/"),fullpath:p+=(d?"":f)+x}),d=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let i="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(i=i?`${a}/${i}`:a,this.isAbsolute(a)))break}let s=this.#t.get(i);if(s!==void 0)return s;let r=this.cwd.resolve(i).fullpath();return this.#t.set(i,r),r}resolvePosix(...t){let i="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(i=i?`${a}/${i}`:a,this.isAbsolute(a)))break}let s=this.#e.get(i);if(s!==void 0)return s;let r=this.cwd.resolve(i).fullpathPosix();return this.#e.set(i,r),r}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,i={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s}=i;if(t.canReaddir()){let r=await t.readdir();return s?r:r.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,i={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0}=i;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(r=>r.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=await t.readlink();return i?s:s==null?void 0:s.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return i?s:s==null?void 0:s.fullpath()}async realpath(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=await t.realpath();return i?s:s==null?void 0:s.fullpath()}realpathSync(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return i?s:s==null?void 0:s.fullpath()}async walk(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=[];(!n||n(t))&&o.push(s?t:t.fullpath());let h=new Set,c=(f,p)=>{h.add(f),f.readdirCB((d,x)=>{if(d)return p(d);let m=x.length;if(!m)return p();let S=()=>{--m===0&&p()};for(let y of x)(!n||n(y))&&o.push(s?y:y.fullpath()),r&&y.isSymbolicLink()?y.realpath().then(E=>E!=null&&E.isUnknown()?E.lstat():E).then(E=>E!=null&&E.shouldWalk(h,a)?c(E,S):S()):y.shouldWalk(h,a)?c(y,S):S()},!0)},l=t;return new Promise((f,p)=>{c(l,d=>{if(d)return p(d);f(o)})})}walkSync(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=[];(!n||n(t))&&o.push(s?t:t.fullpath());let h=new Set([t]);for(let c of h){let l=c.readdirSync();for(let f of l){(!n||n(f))&&o.push(s?f:f.fullpath());let p=f;if(f.isSymbolicLink()){if(!(r&&(p=f.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(h,a)&&h.add(p)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,i={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd),this.stream(t,i)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i;(!n||n(t))&&(yield s?t:t.fullpath());let o=new Set([t]);for(let h of o){let c=h.readdirSync();for(let l of c){(!n||n(l))&&(yield s?l:l.fullpath());let f=l;if(l.isSymbolicLink()){if(!(r&&(f=l.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(o,a)&&o.add(f)}}}stream(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=new Dt({objectMode:!0});(!n||n(t))&&o.write(s?t:t.fullpath());let h=new Set,c=[t],l=0,f=()=>{let p=!1;for(;!p;){let d=c.shift();if(!d){l===0&&o.end();return}l++,h.add(d);let x=(S,y,E=!1)=>{if(S)return o.emit("error",S);if(r&&!E){let b=[];for(let g of y)g.isSymbolicLink()&&b.push(g.realpath().then(_=>_!=null&&_.isUnknown()?_.lstat():_));if(b.length){Promise.all(b).then(()=>x(null,y,!0));return}}for(let b of y)b&&(!n||n(b))&&(o.write(s?b:b.fullpath())||(p=!0));l--;for(let b of y){let g=b.realpathCached()||b;g.shouldWalk(h,a)&&c.push(g)}p&&!o.flowing?o.once("drain",f):m||f()},m=!0;d.readdirCB(x,!0),m=!1}};return f(),o}streamSync(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=new Dt({objectMode:!0}),h=new Set;(!n||n(t))&&o.write(s?t:t.fullpath());let c=[t],l=0,f=()=>{let p=!1;for(;!p;){let d=c.shift();if(!d){l===0&&o.end();return}l++,h.add(d);let x=d.readdirSync();for(let m of x)(!n||n(m))&&(o.write(s?m:m.fullpath())||(p=!0));l--;for(let m of x){let S=m;if(m.isSymbolicLink()){if(!(r&&(S=m.realpathSync())))continue;S.isUnknown()&&S.lstatSync()}S.shouldWalk(h,a)&&c.push(S)}}p&&!o.flowing&&o.once("drain",f)};return f(),o}chdir(t=this.cwd){let i=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[bn](i)}},te=class extends ri{sep="\\";constructor(t=process.cwd(),i={}){let{nocase:s=!0}=i;super(t,as,"\\",{...i,nocase:s}),this.nocase=s;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(t){return as.parse(t).root.toUpperCase()}newRoot(t){return new ii(this.rootPath,St,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},ee=class extends ri{sep="/";constructor(t=process.cwd(),i={}){let{nocase:s=!1}=i;super(t,$h,"/",{...i,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new si(this.rootPath,St,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},_e=class extends ee{constructor(t=process.cwd(),i={}){let{nocase:s=!0}=i;super(t,{...i,nocase:s})}},Jc=process.platform==="win32"?ii:si,vn=process.platform==="win32"?te:process.platform==="darwin"?_e:ee;var ru=e=>e.length>=1,nu=e=>e.length>=1,ie=class e{#t;#e;#n;length;#r;#a;#v;#y;#c;#o;#f=!0;constructor(t,i,s,r){if(!ru(t))throw new TypeError("empty pattern list");if(!nu(i))throw new TypeError("empty glob list");if(i.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#e=i,this.#n=s,this.#r=r,this.#n===0){if(this.isUNC()){let[n,a,o,h,...c]=this.#t,[l,f,p,d,...x]=this.#e;c[0]===""&&(c.shift(),x.shift());let m=[n,a,o,h,""].join("/"),S=[l,f,p,d,""].join("/");this.#t=[m,...c],this.#e=[S,...x],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...a]=this.#t,[o,...h]=this.#e;a[0]===""&&(a.shift(),h.shift());let c=n+"/",l=o+"/";this.#t=[c,...a],this.#e=[l,...h],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===W}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#v=this.#v||(this.#n===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#a!==void 0?this.#a:this.hasMore()?(this.#a=new e(this.#t,this.#e,this.#n+1,this.#r),this.#a.#o=this.#o,this.#a.#c=this.#c,this.#a.#y=this.#y,this.#a):this.#a=null}isUNC(){let t=this.#t;return this.#c!==void 0?this.#c:this.#c=this.#r==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#y!==void 0?this.#y:this.#y=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#o!==void 0?this.#o:this.#o=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}};var au=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",se=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:i,nocase:s,noext:r,noglobstar:n,platform:a=au}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:i,nocase:s,noext:r,noglobstar:n,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let o of t)this.add(o)}add(t){let i=new et(t,this.mmopts);for(let s=0;s<i.set.length;s++){let r=i.set[s],n=i.globParts[s];if(!r||!n)throw new Error("invalid pattern object");for(;r[0]==="."&&n[0]===".";)r.shift(),n.shift();let a=new ie(r,n,0,this.platform),o=new et(a.globString(),this.mmopts),h=n[n.length-1]==="**",c=a.isAbsolute();c?this.absolute.push(o):this.relative.push(o),h&&(c?this.absoluteChildren.push(o):this.relativeChildren.push(o))}}ignored(t){let i=t.fullpath(),s=`${i}/`,r=t.relative()||".",n=`${r}/`;for(let a of this.relative)if(a.match(r)||a.match(n))return!0;for(let a of this.absolute)if(a.match(i)||a.match(s))return!0;return!1}childrenIgnored(t){let i=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let r of this.relativeChildren)if(r.match(s))return!0;for(let r of this.absoluteChildren)if(r.match(i))return!0;return!1}};var hs=class e{store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,i){var s;return(s=this.store.get(t.fullpath()))==null?void 0:s.has(i.globString())}storeWalked(t,i){let s=t.fullpath(),r=this.store.get(s);r?r.add(i.globString()):this.store.set(s,new Set([i.globString()]))}},us=class{store=new Map;add(t,i,s){let r=(i?2:0)|(s?1:0),n=this.store.get(t);this.store.set(t,n===void 0?r:r&n)}entries(){return[...this.store.entries()].map(([t,i])=>[t,!!(i&2),!!(i&1)])}},cs=class{store=new Map;add(t,i){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(r=>r.globString()===i.globString())||s.push(i):this.store.set(t,[i])}get(t){let i=this.store.get(t);if(!i)throw new Error("attempting to walk unknown path");return i}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},Ce=class e{hasWalkedCache;matches=new us;subwalks=new cs;patterns;follow;dot;opts;constructor(t,i){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=i?i.copy():new hs}processPatterns(t,i){this.patterns=i;let s=i.map(r=>[t,r]);for(let[r,n]of s){this.hasWalkedCache.storeWalked(r,n);let a=n.root(),o=n.isAbsolute()&&this.opts.absolute!==!1;if(a){r=r.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let f=n.rest();if(f)n=f;else{this.matches.add(r,!0,!1);continue}}if(r.isENOENT())continue;let h,c,l=!1;for(;typeof(h=n.pattern())=="string"&&(c=n.rest());)r=r.resolve(h),n=c,l=!0;if(h=n.pattern(),c=n.rest(),l){if(this.hasWalkedCache.hasWalked(r,n))continue;this.hasWalkedCache.storeWalked(r,n)}if(typeof h=="string"){let f=h===".."||h===""||h===".";this.matches.add(r.resolve(h),o,f);continue}else if(h===W){(!r.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(r,n);let f=c==null?void 0:c.pattern(),p=c==null?void 0:c.rest();if(!c||(f===""||f===".")&&!p)this.matches.add(r,o,f===""||f===".");else if(f===".."){let d=r.parent||r;p?this.hasWalkedCache.hasWalked(d,p)||this.subwalks.add(d,p):this.matches.add(d,o,!0)}}else h instanceof RegExp&&this.subwalks.add(r,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,i){let s=this.subwalks.get(t),r=this.child();for(let n of i)for(let a of s){let o=a.isAbsolute(),h=a.pattern(),c=a.rest();h===W?r.testGlobstar(n,a,c,o):h instanceof RegExp?r.testRegExp(n,h,c,o):r.testString(n,h,c,o)}return r}testGlobstar(t,i,s,r){if((this.dot||!t.name.startsWith("."))&&(i.hasMore()||this.matches.add(t,r,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,i):t.isSymbolicLink()&&(s&&i.checkFollowGlobstar()?this.subwalks.add(t,s):i.markFollowGlobstar()&&this.subwalks.add(t,i)))),s){let n=s.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,s.rest(),r);else if(n===".."){let a=t.parent||t;this.subwalks.add(a,s)}else n instanceof RegExp&&this.testRegExp(t,n,s.rest(),r)}}testRegExp(t,i,s,r){i.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}testString(t,i,s,r){t.isNamed(i)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}};var ou=(e,t)=>typeof e=="string"?new se([e],t):Array.isArray(e)?new se(e,t):e,ni=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#n;signal;maxDepth;includeChildMatches;constructor(t,i,s){if(this.patterns=t,this.path=i,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#e=ou(s.ignore??[],s),!this.includeChildMatches&&typeof this.#e.add!="function")){let r="cannot ignore child matches, ignore lacks add() method.";throw new Error(r)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#r(t){var i,s;return this.seen.has(t)||!!((s=(i=this.#e)==null?void 0:i.ignored)!=null&&s.call(i,t))}#a(t){var i,s;return!!((s=(i=this.#e)==null?void 0:i.childrenIgnored)!=null&&s.call(i,t))}pause(){this.paused=!0}resume(){var i;if((i=this.signal)!=null&&i.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){var i;(i=this.signal)!=null&&i.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,i){if(i&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let a=await n.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(n,i)}matchCheckTest(t,i){var s;return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!i||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!((s=t.realpathCached())!=null&&s.isDirectory()))&&!this.#r(t)?t:void 0}matchCheckSync(t,i){if(i&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let a=n.realpathSync();a&&(a!=null&&a.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(n,i)}matchFinish(t,i){var n;if(this.#r(t))return;if(!this.includeChildMatches&&((n=this.#e)!=null&&n.add)){let a=`${t.relativePosix()}/**`;this.#e.add(a)}let s=this.opts.absolute===void 0?i:this.opts.absolute;this.seen.add(t);let r=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let a=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(a+r)}else{let a=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!a.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(a?o+a+r:"."+r)}}async match(t,i,s){let r=await this.matchCheck(t,s);r&&this.matchFinish(r,i)}matchSync(t,i,s){let r=this.matchCheckSync(t,s);r&&this.matchFinish(r,i)}walkCB(t,i,s){var r;(r=this.signal)!=null&&r.aborted&&s(),this.walkCB2(t,i,new Ce(this.opts),s)}walkCB2(t,i,s,r){var o;if(this.#a(t))return r();if((o=this.signal)!=null&&o.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(t,i,s,r));return}s.processPatterns(t,i);let n=1,a=()=>{--n===0&&r()};for(let[h,c,l]of s.matches.entries())this.#r(h)||(n++,this.match(h,c,l).then(()=>a()));for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirCached();h.calledReaddir()?this.walkCB3(h,c,s,a):h.readdirCB((l,f)=>this.walkCB3(h,f,s,a),!0)}a()}walkCB3(t,i,s,r){s=s.filterEntries(t,i);let n=1,a=()=>{--n===0&&r()};for(let[o,h,c]of s.matches.entries())this.#r(o)||(n++,this.match(o,h,c).then(()=>a()));for(let[o,h]of s.subwalks.entries())n++,this.walkCB2(o,h,s.child(),a);a()}walkCBSync(t,i,s){var r;(r=this.signal)!=null&&r.aborted&&s(),this.walkCB2Sync(t,i,new Ce(this.opts),s)}walkCB2Sync(t,i,s,r){var o;if(this.#a(t))return r();if((o=this.signal)!=null&&o.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(t,i,s,r));return}s.processPatterns(t,i);let n=1,a=()=>{--n===0&&r()};for(let[h,c,l]of s.matches.entries())this.#r(h)||this.matchSync(h,c,l);for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirSync();this.walkCB3Sync(h,c,s,a)}a()}walkCB3Sync(t,i,s,r){s=s.filterEntries(t,i);let n=1,a=()=>{--n===0&&r()};for(let[o,h,c]of s.matches.entries())this.#r(o)||this.matchSync(o,h,c);for(let[o,h]of s.subwalks.entries())n++,this.walkCB2Sync(o,h,s.child(),a);a()}},Ae=class extends ni{matches=new Set;constructor(t,i,s){super(t,i,s)}matchEmit(t){this.matches.add(t)}async walk(){var t;if((t=this.signal)!=null&&t.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((i,s)=>{this.walkCB(this.path,this.patterns,()=>{var r;(r=this.signal)!=null&&r.aborted?s(this.signal.reason):i(this.matches)})}),this.matches}walkSync(){var t;if((t=this.signal)!=null&&t.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{var i;if((i=this.signal)!=null&&i.aborted)throw this.signal.reason}),this.matches}},Ie=class extends ni{results;constructor(t,i,s){super(t,i,s),this.results=new Dt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var uu=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",xt=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,i){if(!i)throw new TypeError("glob options required");if(this.withFileTypes=!!i.withFileTypes,this.signal=i.signal,this.follow=!!i.follow,this.dot=!!i.dot,this.dotRelative=!!i.dotRelative,this.nodir=!!i.nodir,this.mark=!!i.mark,i.cwd?(i.cwd instanceof URL||i.cwd.startsWith("file://"))&&(i.cwd=hu(i.cwd)):this.cwd="",this.cwd=i.cwd||"",this.root=i.root,this.magicalBraces=!!i.magicalBraces,this.nobrace=!!i.nobrace,this.noext=!!i.noext,this.realpath=!!i.realpath,this.absolute=i.absolute,this.includeChildMatches=i.includeChildMatches!==!1,this.noglobstar=!!i.noglobstar,this.matchBase=!!i.matchBase,this.maxDepth=typeof i.maxDepth=="number"?i.maxDepth:1/0,this.stat=!!i.stat,this.ignore=i.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!i.windowsPathsNoEscape||i.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(i.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=i.platform||uu,this.opts={...i,platform:this.platform},i.scurry){if(this.scurry=i.scurry,i.nocase!==void 0&&i.nocase!==i.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let h=i.platform==="win32"?te:i.platform==="darwin"?_e:i.platform?ee:vn;this.scurry=new h(this.cwd,{nocase:i.nocase,fs:i.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",r={...i,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new et(h,r)),[a,o]=n.reduce((h,c)=>(h[0].push(...c.set),h[1].push(...c.globParts),h),[[],[]]);this.patterns=a.map((h,c)=>{let l=o[c];if(!l)throw new Error("invalid pattern object");return new ie(h,l,0,this.platform)})}async walk(){return[...await new Ae(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Ae(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Ie(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Ie(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var ls=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let i of e)if(new et(i,t).hasMagic())return!0;return!1};function ai(e,t={}){return new xt(e,t).streamSync()}function En(e,t={}){return new xt(e,t).stream()}function oi(e,t={}){return new xt(e,t).walkSync()}async function wn(e,t={}){return new xt(e,t).walk()}function hi(e,t={}){return new xt(e,t).iterateSync()}function _n(e,t={}){return new xt(e,t).iterate()}var cu=ai,lu=Object.assign(En,{sync:ai}),fu=hi,pu=Object.assign(_n,{sync:hi}),du=Object.assign(oi,{stream:ai,iterate:hi}),Sn=Object.assign(wn,{glob:wn,globSync:oi,sync:du,globStream:En,stream:lu,globStreamSync:ai,streamSync:cu,globIterate:_n,iterate:pu,globIterateSync:hi,iterateSync:fu,Glob:xt,hasMagic:ls,escape:Yt,unescape:dt});Sn.glob=Sn;var Rt=class{static get useFileContent(){var t,i;return((i=(t=tt.config.config)==null?void 0:t.idempotency)==null?void 0:i.useFileContent)??!1}static get location(){var t,i;return((i=(t=tt.config.config)==null?void 0:t.idempotency)==null?void 0:i.location)??"./node_modules/.cache/bsm/idempotency"}static updateHashForFile(t,i){try{if(this.useFileContent){let s=$t.readFileSync(i);t.update(s)}else{let s=$t.lstatSync(i);t.update(s.ctimeMs.toString()),t.update(s.mtimeMs.toString())}}catch{}}static updateHashForDir(t,i){try{$t.readdirSync(i,{withFileTypes:!0,recursive:!0}).forEach(s=>{if(s.name==null)return;let r=Cn.join(s.parentPath??s.path??i,s.name).replace(/\\/g,"/");t.update(r),s.isFile()&&this.updateHashForFile(t,r)})}catch{}}static updateHashForGlob(t,i){try{let s=oi(i,{withFileTypes:!0});for(let r of s){let n=Cn.relative(process.cwd(),r.fullpath());r.isFile()?this.updateHashForFile(t,n):this.updateHashForDir(t,n)}}catch{}}static calculateIdempotencyHash(t,i){var n;let s=[];if(Array.isArray(t))s.push(...t);else if(typeof t=="string")s.push(t);else for(let a of Object.values(t))Array.isArray(a)?s.push(...a):s.push(a);let r=mu("sha256");for(let a of s){let o=a.split(":")[0],h=a.substring(o.length+1);switch(o){case"static":r.update(h);break;case"env":r.update(h),r.update(((n=i==null?void 0:i.env)==null?void 0:n[h])??process.env[h]??Buffer.of());break;case"file":this.updateHashForFile(r,h);break;case"dir":this.updateHashForDir(r,h);break;case"glob":this.updateHashForGlob(r,h);break;default:A.log(`\x1B[33m[Idempotency]\x1B[0m Unknown type: ${o}, using value as static`),r.update(a)}}return r.digest("hex")}static getFileName(t){let i=t.join(".");return`${this.location}/${i}.hash`.replaceAll("*","__all__")}static saveIdempotencyHash(t,i){$t.mkdirSync(this.location,{recursive:!0}),$t.writeFileSync(this.getFileName(i),t)}static getSavedIdempotencyHash(t){let i=this.getFileName(t);if($t.existsSync(i))return $t.readFileSync(i,"utf-8")}static checkIdempotency(t,i,s){let r=t.$idempotency,n=this.calculateIdempotencyHash(r,s);return this.getSavedIdempotencyHash(i)===n}static saveIdempotency(t,i){let s=t.$idempotency,r=this.calculateIdempotencyHash(s);this.saveIdempotencyHash(r,i)}static hasIdempotencyEnabled(t){return process.env.BSM_DISABLE_IDEMPOTENCY==="true"||!Object.hasOwn(t,"$idempotency")?!1:Object.hasOwn(t,"$idempotencyEnabled")?!!t.$idempotencyEnabled:!0}};var Ft=class extends Error{constructor(i,s){super();this.code=i;this.script=s}},re=class extends Ft{constructor(i,s){super(1,s);this.func=i;this.script=s}};var Mt=class e{static async run(t){let i=tt.config;await e.runScript(i.scripts,t.split("."),[],{})}static async runScript(t,i,s,r){typeof t=="function"?await e.executeFunction(t,i,s,r):typeof t=="string"?await e.executeString(t,i,s,r):typeof t=="object"?Array.isArray(t)?await e.executeArray(t,i,s,r):await e.executeObject(t,i,s,r):await e.notFound(s,r)}static async notFound(t,i,s){var r;if(!i.ignoreNotFound){if(s){let n=t[t.length-1],a=t.slice(0,-1);if(a.length===0?A.error(`\x1B[31mScript '${n}' does not exist\x1B[0m`):A.error(`\x1B[31mScript '${a.join(".")}' does not have a '${n}' script\x1B[0m`),((r=tt.config.config)==null?void 0:r.defaultHelpBehavior)==="interactive"){let o=await Wt.selectScript(tt.config,{_:[t.join(".")]});await this.run(o[0]),process.exit(0)}else A.log(),Object.hasOwn(s,"$description")&&(lt.printCommand(s,a),A.log()),A.log("\x1B[1mTry one of the following:\x1B[0m"),lt.printCommands(s,a,!1)}else A.error(`\x1B[31mScript '${t.join(".")}' not found\x1B[0m`);process.exit(127)}}static async executeFunction(t,i,s,r){var o;A.log(`> \x1B[93mExecuting JavaScript function\x1B[0m \x1B[90m(${[...s].join(".")})\x1B[0m`);let n,a=process.env;try{process.env={...process.env,...r.env},n=await t.call(null,process.argv)}catch(h){throw h instanceof Error&&(h.stack=(o=h.stack)==null?void 0:o.split(" at executeFunction")[0]),new re(h,s.join("."))}finally{process.env=a}if(n==null){i.length>0&&await e.notFound([...s,...i],r);return}await e.runScript(n,i,s,{...r,excludeArgs:!0})}static async executeString(t,i,s,r){if(i.length>0){await e.notFound([...s,...i],r);return}!r.excludeArgs&&process.argv.length&&(t+=" "+process.argv.join(" ")),A.log(`> ${t} \x1B[90m(${s.join(".")})\x1B[0m`),process.env.BSM_LOG_FILE&&fs.appendFileSync(process.env.BSM_LOG_FILE,`${new Date().toISOString()} ${t} ${s.join(".")} ${process.cwd()}
|
|
17
|
-
`),t!==""&&(t=t.replace(/bsm ~/g,"bsm \\~"),await new Promise((n,a)=>{gu.spawn(t,[],{stdio:"inherit",shell:!0,env:{...process.env,...r.env,BSM_PATH:s.slice(0,-1).join("."),BSM_SCRIPT:s.join(".")}}).on("close",h=>{h===0?n():a(new Ft(h,s.join(".")))})}))}static async executeArray(t,i,s,r){if(i.length===0||i[0]==="*")for(let n=0;n<t.length;n++)await e.runScript(t[n],i.slice(1),[...s,n.toString()],{...r,ignoreNotFound:i[0]==="*"?!0:r.ignoreNotFound});else{let n=i[0],a=e.subscript(t,n);if(a)await e.runScript(a[1],i.slice(1),[...s,a[0]],r);else{await e.notFound([...s,n],r,t);return}}}static shouldRun(t,i,s,r){return Rt.hasIdempotencyEnabled(t)&&Rt.checkIdempotency(t,[...s,...i],r)?(A.log(`\x1B[90mNot running ${[...s,...i].join(".")} because the idempotency hash is the same\x1B[0m`),!1):!0}static async executeObject(t,i,s,r){try{if(Object.hasOwn(t,"$env")&&(r.env={...r.env,...e.getEnv(t.$env)})
|
|
16
|
+
>>> no match, partial?`,t,p,i,d),p===h))}let m;if(typeof l=="string"?(m=f===l,this.debug("string match",l,f,m)):(m=l.test(f),this.debug("pattern match",l,f,m)),!m)return!1}if(a===h&&o===c)return!0;if(a===h)return s;if(o===c)return a===h-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return Yr(this.pattern,this.options)}parse(t){pe(t);let i=this.options;if(t==="**")return W;if(t==="")return"";let s,r=null;(s=t.match(fh))?r=i.dot?dh:ph:(s=t.match(ih))?r=(i.nocase?i.dot?ah:nh:i.dot?rh:sh)(s[1]):(s=t.match(mh))?r=(i.nocase?i.dot?xh:gh:i.dot?yh:bh)(s):(s=t.match(oh))?r=i.dot?uh:hh:(s=t.match(ch))&&(r=lh);let n=Qt.fromGlob(t,this.options).toMMPattern();return r&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:r}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let i=this.options,s=i.noglobstar?Sh:i.dot?Eh:_h,r=new Set(i.nocase?["i"]:[]),n=t.map(h=>{let c=h.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))r.add(p);return typeof f=="string"?Th(f):f===W?W:f._src});c.forEach((f,p)=>{let d=c[p+1],x=c[p-1];f!==W||x===W||(x===void 0?d!==void 0&&d!==W?c[p+1]="(?:\\/|"+s+"\\/)?"+d:c[p]=s:d===void 0?c[p-1]=x+"(?:\\/|\\/"+s+")?":d!==W&&(c[p-1]=x+"(?:\\/|\\/"+s+"\\/)"+d,c[p+1]=W))});let l=c.filter(f=>f!==W);if(this.partial&&l.length>=1){let f=[];for(let p=1;p<=l.length;p++)f.push(l.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return l.join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];n="^"+a+n+o+"$",this.partial&&(n="^(?:\\/|"+a+n.slice(1,-1)+o+")$"),this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,i=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&i)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let n=this.set;this.debug(this.pattern,"set",n);let a=r[r.length-1];if(!a)for(let o=r.length-2;!a&&o>=0;o--)a=r[o];for(let o=0;o<n.length;o++){let h=n[o],c=r;if(s.matchBase&&h.length===1&&(c=[a]),this.matchOne(c,h,i))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return Y.defaults(t).Minimatch}};Y.AST=Qt;Y.Minimatch=et;Y.escape=Yt;Y.unescape=dt;import{fileURLToPath as hu}from"node:url";var kh=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Jr=new Set,Qi=typeof process=="object"&&process?process:{},tn=(e,t,i,s)=>{typeof Qi.emitWarning=="function"?Qi.emitWarning(e,t,i,s):console.error(`[${i}] ${t}: ${e}`)},ze=globalThis.AbortController,Xr=globalThis.AbortSignal,Zr;if(typeof ze>"u"){Xr=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,r){this._onabort.push(r)}},ze=class{constructor(){t()}signal=new Xr;abort(s){var r,n;if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let a of this.signal._onabort)a(s);(n=(r=this.signal).onabort)==null||n.call(r,s)}}};let e=((Zr=Qi.env)==null?void 0:Zr.LRU_CACHE_IGNORE_AC_WARNING)!=="1",t=()=>{e&&(e=!1,tn("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var Ph=e=>!Jr.has(e),jc=Symbol("type"),Ot=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),en=e=>Ot(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Xt:null:null,Xt=class extends Array{constructor(t){super(t),this.fill(0)}},Yi=class e{heap;length;static#t=!1;static create(t){let i=en(t);if(!i)return[];e.#t=!0;let s=new e(t,i);return e.#t=!1,s}constructor(t,i){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},me=class e{#t;#e;#n;#r;#a;#v;#y;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#f;#l;#h;#i;#d;#w;#b;#m;#R;#g;#E;#A;#x;#S;#I;#p;#s;static unsafeExposeInternals(t){return{starts:t.#A,ttls:t.#x,sizes:t.#E,keyMap:t.#l,keyList:t.#h,valList:t.#i,next:t.#d,prev:t.#w,get head(){return t.#b},get tail(){return t.#m},free:t.#R,isBackgroundFetch:i=>t.#u(i),backgroundFetch:(i,s,r,n)=>t.#W(i,s,r,n),moveToTail:i=>t.#M(i),indexes:i=>t.#k(i),rindexes:i=>t.#N(i),isStale:i=>t.#C(i)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#f}get size(){return this.#o}get fetchMethod(){return this.#v}get memoMethod(){return this.#y}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#a}constructor(t){let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:h,dispose:c,onInsert:l,disposeAfter:f,noDisposeOnSet:p,noUpdateTTL:d,maxSize:x=0,maxEntrySize:m=0,sizeCalculation:S,fetchMethod:y,memoMethod:E,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:g,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:L,ignoreFetchAbort:I,perf:q}=t;if(q!==void 0&&typeof(q==null?void 0:q.now)!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#c=q??kh,i!==0&&!Ot(i))throw new TypeError("max option must be a nonnegative integer");let M=i?en(i):Array;if(!M)throw new Error("invalid max value: "+i);if(this.#t=i,this.#e=x,this.maxEntrySize=m||this.#e,this.sizeCalculation=S,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#y=E,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#v=y,this.#I=!!y,this.#l=new Map,this.#h=new Array(i).fill(void 0),this.#i=new Array(i).fill(void 0),this.#d=new M(i),this.#w=new M(i),this.#b=0,this.#m=0,this.#R=Yi.create(i),this.#o=0,this.#f=0,typeof c=="function"&&(this.#n=c),typeof l=="function"&&(this.#r=l),typeof f=="function"?(this.#a=f,this.#g=[]):(this.#a=void 0,this.#g=void 0),this.#S=!!this.#n,this.#s=!!this.#r,this.#p=!!this.#a,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!L,this.ignoreFetchAbort=!!I,this.maxEntrySize!==0){if(this.#e!==0&&!Ot(this.#e))throw new TypeError("maxSize must be a positive integer if specified");if(!Ot(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!g,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=Ot(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!Ot(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#t===0&&this.ttl===0&&this.#e===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let k="LRU_CACHE_UNBOUNDED";Ph(k)&&(Jr.add(k),tn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,e))}}getRemainingTTL(t){return this.#l.has(t)?1/0:0}#O(){let t=new Xt(this.#t),i=new Xt(this.#t);this.#x=t,this.#A=i,this.#j=(n,a,o=this.#c.now())=>{if(i[n]=a!==0?o:0,t[n]=a,a!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#C(n)&&this.#P(this.#h[n],"expire")},a+1);h.unref&&h.unref()}},this.#T=n=>{i[n]=t[n]!==0?this.#c.now():0},this.#_=(n,a)=>{if(t[a]){let o=t[a],h=i[a];if(!o||!h)return;n.ttl=o,n.start=h,n.now=s||r();let c=n.now-h;n.remainingTTL=o-c}};let s=0,r=()=>{let n=this.#c.now();if(this.ttlResolution>0){s=n;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref()}return n};this.getRemainingTTL=n=>{let a=this.#l.get(n);if(a===void 0)return 0;let o=t[a],h=i[a];if(!o||!h)return 1/0;let c=(s||r())-h;return o-c},this.#C=n=>{let a=i[n],o=t[n];return!!o&&!!a&&(s||r())-a>o}}#T=()=>{};#_=()=>{};#j=()=>{};#C=()=>!1;#B(){let t=new Xt(this.#t);this.#f=0,this.#E=t,this.#L=i=>{this.#f-=t[i],t[i]=0},this.#D=(i,s,r,n)=>{if(this.#u(s))return 0;if(!Ot(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!Ot(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#V=(i,s,r)=>{if(t[i]=s,this.#e){let n=this.#e-t[i];for(;this.#f>n;)this.#F(!0)}this.#f+=t[i],r&&(r.entrySize=s,r.totalCalculatedSize=this.#f)}}#L=t=>{};#V=(t,i,s)=>{};#D=(t,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:t=this.allowStale}={}){if(this.#o)for(let i=this.#m;!(!this.#$(i)||((t||!this.#C(i))&&(yield i),i===this.#b));)i=this.#w[i]}*#N({allowStale:t=this.allowStale}={}){if(this.#o)for(let i=this.#b;!(!this.#$(i)||((t||!this.#C(i))&&(yield i),i===this.#m));)i=this.#d[i]}#$(t){return t!==void 0&&this.#l.get(this.#h[t])===t}*entries(){for(let t of this.#k())this.#i[t]!==void 0&&this.#h[t]!==void 0&&!this.#u(this.#i[t])&&(yield[this.#h[t],this.#i[t]])}*rentries(){for(let t of this.#N())this.#i[t]!==void 0&&this.#h[t]!==void 0&&!this.#u(this.#i[t])&&(yield[this.#h[t],this.#i[t]])}*keys(){for(let t of this.#k()){let i=this.#h[t];i!==void 0&&!this.#u(this.#i[t])&&(yield i)}}*rkeys(){for(let t of this.#N()){let i=this.#h[t];i!==void 0&&!this.#u(this.#i[t])&&(yield i)}}*values(){for(let t of this.#k())this.#i[t]!==void 0&&!this.#u(this.#i[t])&&(yield this.#i[t])}*rvalues(){for(let t of this.#N())this.#i[t]!==void 0&&!this.#u(this.#i[t])&&(yield this.#i[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,i={}){for(let s of this.#k()){let r=this.#i[s],n=this.#u(r)?r.__staleWhileFetching:r;if(n!==void 0&&t(n,this.#h[s],this))return this.get(this.#h[s],i)}}forEach(t,i=this){for(let s of this.#k()){let r=this.#i[s],n=this.#u(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(i,n,this.#h[s],this)}}rforEach(t,i=this){for(let s of this.#N()){let r=this.#i[s],n=this.#u(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(i,n,this.#h[s],this)}}purgeStale(){let t=!1;for(let i of this.#N({allowStale:!0}))this.#C(i)&&(this.#P(this.#h[i],"expire"),t=!0);return t}info(t){let i=this.#l.get(t);if(i===void 0)return;let s=this.#i[i],r=this.#u(s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(this.#x&&this.#A){let a=this.#x[i],o=this.#A[i];if(a&&o){let h=a-(this.#c.now()-o);n.ttl=h,n.start=Date.now()}}return this.#E&&(n.size=this.#E[i]),n}dump(){let t=[];for(let i of this.#k({allowStale:!0})){let s=this.#h[i],r=this.#i[i],n=this.#u(r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let a={value:n};if(this.#x&&this.#A){a.ttl=this.#x[i];let o=this.#c.now()-this.#A[i];a.start=Math.floor(Date.now()-o)}this.#E&&(a.size=this.#E[i]),t.unshift([s,a])}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let r=Date.now()-s.start;s.start=this.#c.now()-r}this.set(i,s.value,s)}}set(t,i,s={}){var p,d,x,m,S,y,E;if(i===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:h}=s,{noUpdateTTL:c=this.noUpdateTTL}=s,l=this.#D(t,i,s.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#P(t,"set"),this;let f=this.#o===0?void 0:this.#l.get(t);if(f===void 0)f=this.#o===0?this.#m:this.#R.length!==0?this.#R.pop():this.#o===this.#t?this.#F(!1):this.#o,this.#h[f]=t,this.#i[f]=i,this.#l.set(t,f),this.#d[this.#m]=f,this.#w[f]=this.#m,this.#m=f,this.#o++,this.#V(f,l,h),h&&(h.set="add"),c=!1,this.#s&&((p=this.#r)==null||p.call(this,i,t,"add"));else{this.#M(f);let b=this.#i[f];if(i!==b){if(this.#I&&this.#u(b)){b.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=b;g!==void 0&&!a&&(this.#S&&((d=this.#n)==null||d.call(this,g,t,"set")),this.#p&&((x=this.#g)==null||x.push([g,t,"set"])))}else a||(this.#S&&((m=this.#n)==null||m.call(this,b,t,"set")),this.#p&&((S=this.#g)==null||S.push([b,t,"set"])));if(this.#L(f),this.#V(f,l,h),this.#i[f]=i,h){h.set="replace";let g=b&&this.#u(b)?b.__staleWhileFetching:b;g!==void 0&&(h.oldValue=g)}}else h&&(h.set="update");this.#s&&((y=this.onInsert)==null||y.call(this,i,t,i===b?"update":"replace"))}if(r!==0&&!this.#x&&this.#O(),this.#x&&(c||this.#j(f,r,n),h&&this.#_(h,f)),!a&&this.#p&&this.#g){let b=this.#g,g;for(;g=b==null?void 0:b.shift();)(E=this.#a)==null||E.call(this,...g)}return this}pop(){var t;try{for(;this.#o;){let i=this.#i[this.#b];if(this.#F(!0),this.#u(i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(this.#p&&this.#g){let i=this.#g,s;for(;s=i==null?void 0:i.shift();)(t=this.#a)==null||t.call(this,...s)}}}#F(t){var n,a;let i=this.#b,s=this.#h[i],r=this.#i[i];return this.#I&&this.#u(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#p)&&(this.#S&&((n=this.#n)==null||n.call(this,r,s,"evict")),this.#p&&((a=this.#g)==null||a.push([r,s,"evict"]))),this.#L(i),t&&(this.#h[i]=void 0,this.#i[i]=void 0,this.#R.push(i)),this.#o===1?(this.#b=this.#m=0,this.#R.length=0):this.#b=this.#d[i],this.#l.delete(s),this.#o--,i}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=this.#l.get(t);if(n!==void 0){let a=this.#i[n];if(this.#u(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#C(n))r&&(r.has="stale",this.#_(r,n));else return s&&this.#T(n),r&&(r.has="hit",this.#_(r,n)),!0}else r&&(r.has="miss");return!1}peek(t,i={}){let{allowStale:s=this.allowStale}=i,r=this.#l.get(t);if(r===void 0||!s&&this.#C(r))return;let n=this.#i[r];return this.#u(n)?n.__staleWhileFetching:n}#W(t,i,s,r){let n=i===void 0?void 0:this.#i[i];if(this.#u(n))return n;let a=new ze,{signal:o}=s;o==null||o.addEventListener("abort",()=>a.abort(o.reason),{signal:a.signal});let h={signal:a.signal,options:s,context:r},c=(m,S=!1)=>{let{aborted:y}=a.signal,E=s.ignoreFetchAbort&&m!==void 0;if(s.status&&(y&&!S?(s.status.fetchAborted=!0,s.status.fetchError=a.signal.reason,E&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),y&&!E&&!S)return f(a.signal.reason);let b=d,g=this.#i[i];return(g===d||E&&S&&g===void 0)&&(m===void 0?b.__staleWhileFetching!==void 0?this.#i[i]=b.__staleWhileFetching:this.#P(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,m,h.options))),m},l=m=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=m),f(m)),f=m=>{let{aborted:S}=a.signal,y=S&&s.allowStaleOnFetchAbort,E=y||s.allowStaleOnFetchRejection,b=E||s.noDeleteOnFetchRejection,g=d;if(this.#i[i]===d&&(!b||g.__staleWhileFetching===void 0?this.#P(t,"fetch"):y||(this.#i[i]=g.__staleWhileFetching)),E)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),g.__staleWhileFetching;if(g.__returned===g)throw m},p=(m,S)=>{var E;let y=(E=this.#v)==null?void 0:E.call(this,t,n,h);y&&y instanceof Promise&&y.then(b=>m(b===void 0?void 0:b),S),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(m(void 0),s.allowStaleOnFetchAbort&&(m=b=>c(b,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(p).then(c,l),x=Object.assign(d,{__abortController:a,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(t,x,{...h.options,status:void 0}),i=this.#l.get(t)):this.#i[i]=x,x}#u(t){if(!this.#I)return!1;let i=t;return!!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof ze}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:h=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:x=this.allowStaleOnFetchAbort,context:m,forceRefresh:S=!1,status:y,signal:E}=i;if(!this.#I)return y&&(y.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:y});let b={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:a,noDisposeOnSet:o,size:h,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:x,ignoreFetchAbort:d,status:y,signal:E},g=this.#l.get(t);if(g===void 0){y&&(y.fetch="miss");let _=this.#W(t,g,b,m);return _.__returned=_}else{let _=this.#i[g];if(this.#u(_)){let k=s&&_.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",k&&(y.returnedStale=!0)),k?_.__staleWhileFetching:_.__returned=_}let L=this.#C(g);if(!S&&!L)return y&&(y.fetch="hit"),this.#M(g),r&&this.#T(g),y&&this.#_(y,g),_;let I=this.#W(t,g,b,m),M=I.__staleWhileFetching!==void 0&&s;return y&&(y.fetch=L?"stale":"refresh",M&&L&&(y.returnedStale=!0)),M?I.__staleWhileFetching:I.__returned=I}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=this.#y;if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...a}=i,o=this.get(t,a);if(!n&&o!==void 0)return o;let h=s(t,o,{options:a,context:r});return this.set(t,h,a),h}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:a}=i,o=this.#l.get(t);if(o!==void 0){let h=this.#i[o],c=this.#u(h);return a&&this.#_(a,o),this.#C(o)?(a&&(a.get="stale"),c?(a&&s&&h.__staleWhileFetching!==void 0&&(a.returnedStale=!0),s?h.__staleWhileFetching:void 0):(n||this.#P(t,"expire"),a&&s&&(a.returnedStale=!0),s?h:void 0)):(a&&(a.get="hit"),c?h.__staleWhileFetching:(this.#M(o),r&&this.#T(o),h))}else a&&(a.get="miss")}#G(t,i){this.#w[i]=t,this.#d[t]=i}#M(t){t!==this.#m&&(t===this.#b?this.#b=this.#d[t]:this.#G(this.#w[t],this.#d[t]),this.#G(this.#m,t),this.#m=t)}delete(t){return this.#P(t,"delete")}#P(t,i){var r,n,a,o;let s=!1;if(this.#o!==0){let h=this.#l.get(t);if(h!==void 0)if(s=!0,this.#o===1)this.#U(i);else{this.#L(h);let c=this.#i[h];if(this.#u(c)?c.__abortController.abort(new Error("deleted")):(this.#S||this.#p)&&(this.#S&&((r=this.#n)==null||r.call(this,c,t,i)),this.#p&&((n=this.#g)==null||n.push([c,t,i]))),this.#l.delete(t),this.#h[h]=void 0,this.#i[h]=void 0,h===this.#m)this.#m=this.#w[h];else if(h===this.#b)this.#b=this.#d[h];else{let l=this.#w[h];this.#d[l]=this.#d[h];let f=this.#d[h];this.#w[f]=this.#w[h]}this.#o--,this.#R.push(h)}}if(this.#p&&((a=this.#g)!=null&&a.length)){let h=this.#g,c;for(;c=h==null?void 0:h.shift();)(o=this.#a)==null||o.call(this,...c)}return s}clear(){return this.#U("delete")}#U(t){var i,s,r;for(let n of this.#N({allowStale:!0})){let a=this.#i[n];if(this.#u(a))a.__abortController.abort(new Error("deleted"));else{let o=this.#h[n];this.#S&&((i=this.#n)==null||i.call(this,a,o,t)),this.#p&&((s=this.#g)==null||s.push([a,o,t]))}}if(this.#l.clear(),this.#i.fill(void 0),this.#h.fill(void 0),this.#x&&this.#A&&(this.#x.fill(0),this.#A.fill(0)),this.#E&&this.#E.fill(0),this.#b=0,this.#m=0,this.#R.length=0,this.#f=0,this.#o=0,this.#p&&this.#g){let n=this.#g,a;for(;a=n==null?void 0:n.shift();)(r=this.#a)==null||r.call(this,...a)}}};import{posix as $h,win32 as as}from"node:path";import{fileURLToPath as Wh}from"node:url";import{lstatSync as Gh,readdir as zh,readdirSync as Hh,readlinkSync as qh,realpathSync as Kh}from"fs";import*as Qh from"node:fs";import{lstat as Xh,readdir as Zh,readlink as Jh,realpath as tu}from"node:fs/promises";import{EventEmitter as ss}from"node:events";import on from"node:stream";import{StringDecoder as Nh}from"node:string_decoder";var sn=typeof process=="object"&&process?process:{stdout:null,stderr:null},Oh=e=>!!e&&typeof e=="object"&&(e instanceof Dt||e instanceof on||Lh(e)||Dh(e)),Lh=e=>!!e&&typeof e=="object"&&e instanceof ss&&typeof e.pipe=="function"&&e.pipe!==on.Writable.prototype.pipe,Dh=e=>!!e&&typeof e=="object"&&e instanceof ss&&typeof e.write=="function"&&typeof e.end=="function",At=Symbol("EOF"),It=Symbol("maybeEmitEnd"),Lt=Symbol("emittedEnd"),He=Symbol("emittingEnd"),ge=Symbol("emittedError"),qe=Symbol("closed"),rn=Symbol("read"),Ke=Symbol("flush"),nn=Symbol("flushChunk"),mt=Symbol("encoding"),Zt=Symbol("decoder"),U=Symbol("flowing"),xe=Symbol("paused"),Jt=Symbol("resume"),j=Symbol("buffer"),X=Symbol("pipes"),$=Symbol("bufferLength"),Xi=Symbol("bufferPush"),Qe=Symbol("bufferShift"),z=Symbol("objectMode"),F=Symbol("destroyed"),Zi=Symbol("error"),Ji=Symbol("emitData"),an=Symbol("emitEnd"),ts=Symbol("emitEnd2"),wt=Symbol("async"),es=Symbol("abort"),Ye=Symbol("aborted"),ye=Symbol("signal"),Ut=Symbol("dataListeners"),it=Symbol("discarded"),be=e=>Promise.resolve().then(e),Fh=e=>e(),Mh=e=>e==="end"||e==="finish"||e==="prefinish",Bh=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Vh=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),Xe=class{src;dest;opts;ondrain;constructor(t,i,s){this.src=t,this.dest=i,this.opts=s,this.ondrain=()=>t[Jt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},is=class extends Xe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,i,s){super(t,i,s),this.proxyErrors=r=>i.emit("error",r),t.on("error",this.proxyErrors)}},Uh=e=>!!e.objectMode,jh=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Dt=class extends ss{[U]=!1;[xe]=!1;[X]=[];[j]=[];[z];[mt];[wt];[Zt];[At]=!1;[Lt]=!1;[He]=!1;[qe]=!1;[ge]=null;[$]=0;[F]=!1;[ye];[Ye]=!1;[Ut]=0;[it]=!1;writable=!0;readable=!0;constructor(...t){let i=t[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Uh(i)?(this[z]=!0,this[mt]=null):jh(i)?(this[mt]=i.encoding,this[z]=!1):(this[z]=!1,this[mt]=null),this[wt]=!!i.async,this[Zt]=this[mt]?new Nh(this[mt]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[j]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[X]});let{signal:s}=i;s&&(this[ye]=s,s.aborted?this[es]():s.addEventListener("abort",()=>this[es]()))}get bufferLength(){return this[$]}get encoding(){return this[mt]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[z]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[wt]}set async(t){this[wt]=this[wt]||!!t}[es](){var t,i;this[Ye]=!0,this.emit("abort",(t=this[ye])==null?void 0:t.reason),this.destroy((i=this[ye])==null?void 0:i.reason)}get aborted(){return this[Ye]}set aborted(t){}write(t,i,s){var n;if(this[Ye])return!1;if(this[At])throw new Error("write after end");if(this[F])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(s=i,i="utf8"),i||(i="utf8");let r=this[wt]?be:Fh;if(!this[z]&&!Buffer.isBuffer(t)){if(Vh(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Bh(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[z]?(this[U]&&this[$]!==0&&this[Ke](!0),this[U]?this.emit("data",t):this[Xi](t),this[$]!==0&&this.emit("readable"),s&&r(s),this[U]):t.length?(typeof t=="string"&&!(i===this[mt]&&!((n=this[Zt])!=null&&n.lastNeed))&&(t=Buffer.from(t,i)),Buffer.isBuffer(t)&&this[mt]&&(t=this[Zt].write(t)),this[U]&&this[$]!==0&&this[Ke](!0),this[U]?this.emit("data",t):this[Xi](t),this[$]!==0&&this.emit("readable"),s&&r(s),this[U]):(this[$]!==0&&this.emit("readable"),s&&r(s),this[U])}read(t){if(this[F])return null;if(this[it]=!1,this[$]===0||t===0||t&&t>this[$])return this[It](),null;this[z]&&(t=null),this[j].length>1&&!this[z]&&(this[j]=[this[mt]?this[j].join(""):Buffer.concat(this[j],this[$])]);let i=this[rn](t||null,this[j][0]);return this[It](),i}[rn](t,i){if(this[z])this[Qe]();else{let s=i;t===s.length||t===null?this[Qe]():typeof s=="string"?(this[j][0]=s.slice(t),i=s.slice(0,t),this[$]-=t):(this[j][0]=s.subarray(t),i=s.subarray(0,t),this[$]-=t)}return this.emit("data",i),!this[j].length&&!this[At]&&this.emit("drain"),i}end(t,i,s){return typeof t=="function"&&(s=t,t=void 0),typeof i=="function"&&(s=i,i="utf8"),t!==void 0&&this.write(t,i),s&&this.once("end",s),this[At]=!0,this.writable=!1,(this[U]||!this[xe])&&this[It](),this}[Jt](){this[F]||(!this[Ut]&&!this[X].length&&(this[it]=!0),this[xe]=!1,this[U]=!0,this.emit("resume"),this[j].length?this[Ke]():this[At]?this[It]():this.emit("drain"))}resume(){return this[Jt]()}pause(){this[U]=!1,this[xe]=!0,this[it]=!1}get destroyed(){return this[F]}get flowing(){return this[U]}get paused(){return this[xe]}[Xi](t){this[z]?this[$]+=1:this[$]+=t.length,this[j].push(t)}[Qe](){return this[z]?this[$]-=1:this[$]-=this[j][0].length,this[j].shift()}[Ke](t=!1){do;while(this[nn](this[Qe]())&&this[j].length);!t&&!this[j].length&&!this[At]&&this.emit("drain")}[nn](t){return this.emit("data",t),this[U]}pipe(t,i){if(this[F])return t;this[it]=!1;let s=this[Lt];return i=i||{},t===sn.stdout||t===sn.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,s?i.end&&t.end():(this[X].push(i.proxyErrors?new is(this,t,i):new Xe(this,t,i)),this[wt]?be(()=>this[Jt]()):this[Jt]()),t}unpipe(t){let i=this[X].find(s=>s.dest===t);i&&(this[X].length===1?(this[U]&&this[Ut]===0&&(this[U]=!1),this[X]=[]):this[X].splice(this[X].indexOf(i),1),i.unpipe())}addListener(t,i){return this.on(t,i)}on(t,i){let s=super.on(t,i);if(t==="data")this[it]=!1,this[Ut]++,!this[X].length&&!this[U]&&this[Jt]();else if(t==="readable"&&this[$]!==0)super.emit("readable");else if(Mh(t)&&this[Lt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[ge]){let r=i;this[wt]?be(()=>r.call(this,this[ge])):r.call(this,this[ge])}return s}removeListener(t,i){return this.off(t,i)}off(t,i){let s=super.off(t,i);return t==="data"&&(this[Ut]=this.listeners("data").length,this[Ut]===0&&!this[it]&&!this[X].length&&(this[U]=!1)),s}removeAllListeners(t){let i=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[Ut]=0,!this[it]&&!this[X].length&&(this[U]=!1)),i}get emittedEnd(){return this[Lt]}[It](){!this[He]&&!this[Lt]&&!this[F]&&this[j].length===0&&this[At]&&(this[He]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[qe]&&this.emit("close"),this[He]=!1)}emit(t,...i){let s=i[0];if(t!=="error"&&t!=="close"&&t!==F&&this[F])return!1;if(t==="data")return!this[z]&&!s?!1:this[wt]?(be(()=>this[Ji](s)),!0):this[Ji](s);if(t==="end")return this[an]();if(t==="close"){if(this[qe]=!0,!this[Lt]&&!this[F])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[ge]=s,super.emit(Zi,s);let n=!this[ye]||this.listeners("error").length?super.emit("error",s):!1;return this[It](),n}else if(t==="resume"){let n=super.emit("resume");return this[It](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...i);return this[It](),r}[Ji](t){for(let s of this[X])s.dest.write(t)===!1&&this.pause();let i=this[it]?!1:super.emit("data",t);return this[It](),i}[an](){return this[Lt]?!1:(this[Lt]=!0,this.readable=!1,this[wt]?(be(()=>this[ts]()),!0):this[ts]())}[ts](){if(this[Zt]){let i=this[Zt].end();if(i){for(let s of this[X])s.dest.write(i);this[it]||super.emit("data",i)}}for(let i of this[X])i.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[z]||(t.dataLength=0);let i=this.promise();return this.on("data",s=>{t.push(s),this[z]||(t.dataLength+=s.length)}),await i,t}async concat(){if(this[z])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[mt]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,i)=>{this.on(F,()=>i(new Error("stream destroyed"))),this.on("error",s=>i(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[it]=!1;let t=!1,i=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[At])return i();let n,a,o=f=>{this.off("data",h),this.off("end",c),this.off(F,l),i(),a(f)},h=f=>{this.off("error",o),this.off("end",c),this.off(F,l),this.pause(),n({value:f,done:!!this[At]})},c=()=>{this.off("error",o),this.off("data",h),this.off(F,l),i(),n({done:!0,value:void 0})},l=()=>o(new Error("stream destroyed"));return new Promise((f,p)=>{a=p,n=f,this.once(F,l),this.once("error",o),this.once("end",c),this.once("data",h)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[it]=!1;let t=!1,i=()=>(this.pause(),this.off(Zi,i),this.off(F,i),this.off("end",i),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Zi,i),this.once(F,i),{next:s,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(t){if(this[F])return t?this.emit("error",t):this.emit(F),this;this[F]=!0,this[it]=!0,this[j].length=0,this[$]=0;let i=this;return typeof i.close=="function"&&!this[qe]&&i.close(),t?this.emit("error",t):this.emit(F),this}static get isStream(){return Oh}};var Yh=Kh.native,we={lstatSync:Gh,readdir:zh,readdirSync:Hh,readlinkSync:qh,realpathSync:Yh,promises:{lstat:Xh,readdir:Zh,readlink:Jh,realpath:tu}},fn=e=>!e||e===we||e===Qh?we:{...we,...e,promises:{...we.promises,...e.promises||{}}},pn=/^\\\\\?\\([a-z]:)\\?$/i,eu=e=>e.replace(/\//g,"\\").replace(pn,"$1\\"),iu=/[\\\/]/,ct=0,dn=1,mn=2,St=4,gn=6,xn=8,jt=10,yn=12,ut=15,ve=~ut,rs=16,hn=32,Se=64,gt=128,Ze=256,ti=512,un=Se|gt|ti,su=1023,ns=e=>e.isFile()?xn:e.isDirectory()?St:e.isSymbolicLink()?jt:e.isCharacterDevice()?mn:e.isBlockDevice()?gn:e.isSocket()?yn:e.isFIFO()?dn:ct,cn=new Map,Ee=e=>{let t=cn.get(e);if(t)return t;let i=e.normalize("NFKD");return cn.set(e,i),i},ln=new Map,Je=e=>{let t=ln.get(e);if(t)return t;let i=Ee(e.toLowerCase());return ln.set(e,i),i},ei=class extends me{constructor(){super({max:256})}},os=class extends me{constructor(t=16*1024){super({maxSize:t,sizeCalculation:i=>i.length+1})}},bn=Symbol("PathScurry setAsCwd"),H=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#a;get uid(){return this.#a}#v;get gid(){return this.#v}#y;get rdev(){return this.#y}#c;get blksize(){return this.#c}#o;get ino(){return this.#o}#f;get size(){return this.#f}#l;get blocks(){return this.#l}#h;get atimeMs(){return this.#h}#i;get mtimeMs(){return this.#i}#d;get ctimeMs(){return this.#d}#w;get birthtimeMs(){return this.#w}#b;get atime(){return this.#b}#m;get mtime(){return this.#m}#R;get ctime(){return this.#R}#g;get birthtime(){return this.#g}#E;#A;#x;#S;#I;#p;#s;#O;#T;#_;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,i=ct,s,r,n,a,o){this.name=t,this.#E=n?Je(t):Ee(t),this.#s=i&su,this.nocase=n,this.roots=r,this.root=s||this,this.#O=a,this.#x=o.fullpath,this.#I=o.relative,this.#p=o.relativePosix,this.parent=o.parent,this.parent?this.#t=this.parent.#t:this.#t=fn(o.fs)}depth(){return this.#A!==void 0?this.#A:this.parent?this.#A=this.parent.depth()+1:this.#A=0}childrenCache(){return this.#O}resolve(t){if(!t)return this;let i=this.getRootString(t),r=t.substring(i.length).split(this.splitSep);return i?this.getRoot(i).#j(r):this.#j(r)}#j(t){let i=this;for(let s of t)i=i.child(s);return i}children(){let t=this.#O.get(this);if(t)return t;let i=Object.assign([],{provisional:0});return this.#O.set(this,i),this.#s&=~rs,i}child(t,i){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),r=this.nocase?Je(t):Ee(t);for(let h of s)if(h.#E===r)return h;let n=this.parent?this.sep:"",a=this.#x?this.#x+n+t:void 0,o=this.newChild(t,ct,{...i,parent:this,fullpath:a});return this.canReaddir()||(o.#s|=gt),s.push(o),o}relative(){if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let t=this.name,i=this.parent;if(!i)return this.#I=this.name;let s=i.relative();return s+(!s||!i.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#p!==void 0)return this.#p;let t=this.name,i=this.parent;if(!i)return this.#p=this.fullpathPosix();let s=i.relativePosix();return s+(!s||!i.parent?"":"/")+t}fullpath(){if(this.#x!==void 0)return this.#x;let t=this.name,i=this.parent;if(!i)return this.#x=this.name;let r=i.fullpath()+(i.parent?this.sep:"")+t;return this.#x=r}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let r=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(r)?this.#S=`//?/${r}`:this.#S=r}let t=this.parent,i=t.fullpathPosix(),s=i+(!i||!t.parent?"":"/")+this.name;return this.#S=s}isUnknown(){return(this.#s&ut)===ct}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&ut)===xn}isDirectory(){return(this.#s&ut)===St}isCharacterDevice(){return(this.#s&ut)===mn}isBlockDevice(){return(this.#s&ut)===gn}isFIFO(){return(this.#s&ut)===dn}isSocket(){return(this.#s&ut)===yn}isSymbolicLink(){return(this.#s&jt)===jt}lstatCached(){return this.#s&hn?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#_}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let t=this.#s&ut;return!(t!==ct&&t!==jt||this.#s&Ze||this.#s>)}calledReaddir(){return!!(this.#s&rs)}isENOENT(){return!!(this.#s>)}isNamed(t){return this.nocase?this.#E===Je(t):this.#E===Ee(t)}async readlink(){var i;let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await this.#t.promises.readlink(this.fullpath()),r=(i=await this.parent.realpath())==null?void 0:i.resolve(s);if(r)return this.#T=r}catch(s){this.#$(s.code);return}}readlinkSync(){var i;let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let s=this.#t.readlinkSync(this.fullpath()),r=(i=this.parent.realpathSync())==null?void 0:i.resolve(s);if(r)return this.#T=r}catch(s){this.#$(s.code);return}}#C(t){this.#s|=rs;for(let i=t.provisional;i<t.length;i++){let s=t[i];s&&s.#B()}}#B(){this.#s>||(this.#s=(this.#s|gt)&ve,this.#L())}#L(){let t=this.children();t.provisional=0;for(let i of t)i.#B()}#V(){this.#s|=ti,this.#D()}#D(){if(this.#s&Se)return;let t=this.#s;(t&ut)===St&&(t&=ve),this.#s=t|Se,this.#L()}#k(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#B():this.children().provisional=0}#N(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#B()}#$(t=""){let i=this.#s;i|=Ze,t==="ENOENT"&&(i|=gt),(t==="EINVAL"||t==="UNKNOWN")&&(i&=ve),this.#s=i,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#F(t,i){return this.#u(t,i)||this.#W(t,i)}#W(t,i){let s=ns(t),r=this.newChild(t.name,s,{parent:this}),n=r.#s&ut;return n!==St&&n!==jt&&n!==ct&&(r.#s|=Se),i.unshift(r),i.provisional++,r}#u(t,i){for(let s=i.provisional;s<i.length;s++){let r=i[s];if((this.nocase?Je(t.name):Ee(t.name))===r.#E)return this.#G(t,r,s,i)}}#G(t,i,s,r){let n=i.name;return i.#s=i.#s&ve|ns(t),n!==t.name&&(i.name=t.name),s!==r.provisional&&(s===r.length-1?r.pop():r.splice(s,1),r.unshift(i)),r.provisional++,i}async lstat(){if((this.#s>)===0)try{return this.#M(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#N(t.code)}}lstatSync(){if((this.#s>)===0)try{return this.#M(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#N(t.code)}}#M(t){let{atime:i,atimeMs:s,birthtime:r,birthtimeMs:n,blksize:a,blocks:o,ctime:h,ctimeMs:c,dev:l,gid:f,ino:p,mode:d,mtime:x,mtimeMs:m,nlink:S,rdev:y,size:E,uid:b}=t;this.#b=i,this.#h=s,this.#g=r,this.#w=n,this.#c=a,this.#l=o,this.#R=h,this.#d=c,this.#e=l,this.#v=f,this.#o=p,this.#n=d,this.#m=x,this.#i=m,this.#r=S,this.#y=y,this.#f=E,this.#a=b;let g=ns(t);this.#s=this.#s&ve|g|hn,g!==ct&&g!==St&&g!==jt&&(this.#s|=Se)}#P=[];#U=!1;#H(t){this.#U=!1;let i=this.#P.slice();this.#P.length=0,i.forEach(s=>s(null,t))}readdirCB(t,i=!1){if(!this.canReaddir()){i?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let n=s.slice(0,s.provisional);i?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#P.push(t),this.#U)return;this.#U=!0;let r=this.fullpath();this.#t.readdir(r,{withFileTypes:!0},(n,a)=>{if(n)this.#k(n.code),s.provisional=0;else{for(let o of a)this.#F(o,s);this.#C(s)}this.#H(s.slice(0,s.provisional))})}#z;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let i=this.fullpath();if(this.#z)await this.#z;else{let s=()=>{};this.#z=new Promise(r=>s=r);try{for(let r of await this.#t.promises.readdir(i,{withFileTypes:!0}))this.#F(r,t);this.#C(t)}catch(r){this.#k(r.code),t.provisional=0}this.#z=void 0,s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let i=this.fullpath();try{for(let s of this.#t.readdirSync(i,{withFileTypes:!0}))this.#F(s,t);this.#C(t)}catch(s){this.#k(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#s&un)return!1;let t=ut&this.#s;return t===ct||t===St||t===jt}shouldWalk(t,i){return(this.#s&St)===St&&!(this.#s&un)&&!t.has(this)&&(!i||i(this))}async realpath(){if(this.#_)return this.#_;if(!((ti|Ze|gt)&this.#s))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#_=this.resolve(t)}catch{this.#V()}}realpathSync(){if(this.#_)return this.#_;if(!((ti|Ze|gt)&this.#s))try{let t=this.#t.realpathSync(this.fullpath());return this.#_=this.resolve(t)}catch{this.#V()}}[bn](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let i=new Set([]),s=[],r=this;for(;r&&r.parent;)i.add(r),r.#I=s.join(this.sep),r.#p=s.join("/"),r=r.parent,s.push("..");for(r=t;r&&r.parent&&!i.has(r);)r.#I=void 0,r.#p=void 0,r=r.parent}},ii=class e extends H{sep="\\";splitSep=iu;constructor(t,i=ct,s,r,n,a,o){super(t,i,s,r,n,a,o)}newChild(t,i=ct,s={}){return new e(t,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return as.parse(t).root}getRoot(t){if(t=eu(t.toUpperCase()),t===this.root.name)return this.root;for(let[i,s]of Object.entries(this.roots))if(this.sameRoot(t,i))return this.roots[t]=s;return this.roots[t]=new te(t,this).root}sameRoot(t,i=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(pn,"$1\\"),t===i}},si=class e extends H{splitSep="/";sep="/";constructor(t,i=ct,s,r,n,a,o){super(t,i,s,r,n,a,o)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,i=ct,s={}){return new e(t,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ri=class{root;rootPath;roots;cwd;#t;#e;#n;nocase;#r;constructor(t=process.cwd(),i,s,{nocase:r,childrenCacheSize:n=16*1024,fs:a=we}={}){this.#r=fn(a),(t instanceof URL||t.startsWith("file://"))&&(t=Wh(t));let o=i.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#t=new ei,this.#e=new ei,this.#n=new os(n);let h=o.substring(this.rootPath.length).split(s);if(h.length===1&&!h[0]&&h.pop(),r===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=h.length-1,f=i.sep,p=this.rootPath,d=!1;for(let x of h){let m=l--;c=c.child(x,{relative:new Array(m).fill("..").join(f),relativePosix:new Array(m).fill("..").join("/"),fullpath:p+=(d?"":f)+x}),d=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let i="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(i=i?`${a}/${i}`:a,this.isAbsolute(a)))break}let s=this.#t.get(i);if(s!==void 0)return s;let r=this.cwd.resolve(i).fullpath();return this.#t.set(i,r),r}resolvePosix(...t){let i="";for(let n=t.length-1;n>=0;n--){let a=t[n];if(!(!a||a===".")&&(i=i?`${a}/${i}`:a,this.isAbsolute(a)))break}let s=this.#e.get(i);if(s!==void 0)return s;let r=this.cwd.resolve(i).fullpathPosix();return this.#e.set(i,r),r}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,i={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s}=i;if(t.canReaddir()){let r=await t.readdir();return s?r:r.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,i={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0}=i;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(r=>r.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=await t.readlink();return i?s:s==null?void 0:s.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return i?s:s==null?void 0:s.fullpath()}async realpath(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=await t.realpath();return i?s:s==null?void 0:s.fullpath()}realpathSync(t=this.cwd,{withFileTypes:i}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return i?s:s==null?void 0:s.fullpath()}async walk(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=[];(!n||n(t))&&o.push(s?t:t.fullpath());let h=new Set,c=(f,p)=>{h.add(f),f.readdirCB((d,x)=>{if(d)return p(d);let m=x.length;if(!m)return p();let S=()=>{--m===0&&p()};for(let y of x)(!n||n(y))&&o.push(s?y:y.fullpath()),r&&y.isSymbolicLink()?y.realpath().then(E=>E!=null&&E.isUnknown()?E.lstat():E).then(E=>E!=null&&E.shouldWalk(h,a)?c(E,S):S()):y.shouldWalk(h,a)?c(y,S):S()},!0)},l=t;return new Promise((f,p)=>{c(l,d=>{if(d)return p(d);f(o)})})}walkSync(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=[];(!n||n(t))&&o.push(s?t:t.fullpath());let h=new Set([t]);for(let c of h){let l=c.readdirSync();for(let f of l){(!n||n(f))&&o.push(s?f:f.fullpath());let p=f;if(f.isSymbolicLink()){if(!(r&&(p=f.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(h,a)&&h.add(p)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,i={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd),this.stream(t,i)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i;(!n||n(t))&&(yield s?t:t.fullpath());let o=new Set([t]);for(let h of o){let c=h.readdirSync();for(let l of c){(!n||n(l))&&(yield s?l:l.fullpath());let f=l;if(l.isSymbolicLink()){if(!(r&&(f=l.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(o,a)&&o.add(f)}}}stream(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=new Dt({objectMode:!0});(!n||n(t))&&o.write(s?t:t.fullpath());let h=new Set,c=[t],l=0,f=()=>{let p=!1;for(;!p;){let d=c.shift();if(!d){l===0&&o.end();return}l++,h.add(d);let x=(S,y,E=!1)=>{if(S)return o.emit("error",S);if(r&&!E){let b=[];for(let g of y)g.isSymbolicLink()&&b.push(g.realpath().then(_=>_!=null&&_.isUnknown()?_.lstat():_));if(b.length){Promise.all(b).then(()=>x(null,y,!0));return}}for(let b of y)b&&(!n||n(b))&&(o.write(s?b:b.fullpath())||(p=!0));l--;for(let b of y){let g=b.realpathCached()||b;g.shouldWalk(h,a)&&c.push(g)}p&&!o.flowing?o.once("drain",f):m||f()},m=!0;d.readdirCB(x,!0),m=!1}};return f(),o}streamSync(t=this.cwd,i={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof H||(i=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:a}=i,o=new Dt({objectMode:!0}),h=new Set;(!n||n(t))&&o.write(s?t:t.fullpath());let c=[t],l=0,f=()=>{let p=!1;for(;!p;){let d=c.shift();if(!d){l===0&&o.end();return}l++,h.add(d);let x=d.readdirSync();for(let m of x)(!n||n(m))&&(o.write(s?m:m.fullpath())||(p=!0));l--;for(let m of x){let S=m;if(m.isSymbolicLink()){if(!(r&&(S=m.realpathSync())))continue;S.isUnknown()&&S.lstatSync()}S.shouldWalk(h,a)&&c.push(S)}}p&&!o.flowing&&o.once("drain",f)};return f(),o}chdir(t=this.cwd){let i=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[bn](i)}},te=class extends ri{sep="\\";constructor(t=process.cwd(),i={}){let{nocase:s=!0}=i;super(t,as,"\\",{...i,nocase:s}),this.nocase=s;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(t){return as.parse(t).root.toUpperCase()}newRoot(t){return new ii(this.rootPath,St,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},ee=class extends ri{sep="/";constructor(t=process.cwd(),i={}){let{nocase:s=!1}=i;super(t,$h,"/",{...i,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new si(this.rootPath,St,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},_e=class extends ee{constructor(t=process.cwd(),i={}){let{nocase:s=!0}=i;super(t,{...i,nocase:s})}},Jc=process.platform==="win32"?ii:si,vn=process.platform==="win32"?te:process.platform==="darwin"?_e:ee;var ru=e=>e.length>=1,nu=e=>e.length>=1,ie=class e{#t;#e;#n;length;#r;#a;#v;#y;#c;#o;#f=!0;constructor(t,i,s,r){if(!ru(t))throw new TypeError("empty pattern list");if(!nu(i))throw new TypeError("empty glob list");if(i.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#e=i,this.#n=s,this.#r=r,this.#n===0){if(this.isUNC()){let[n,a,o,h,...c]=this.#t,[l,f,p,d,...x]=this.#e;c[0]===""&&(c.shift(),x.shift());let m=[n,a,o,h,""].join("/"),S=[l,f,p,d,""].join("/");this.#t=[m,...c],this.#e=[S,...x],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...a]=this.#t,[o,...h]=this.#e;a[0]===""&&(a.shift(),h.shift());let c=n+"/",l=o+"/";this.#t=[c,...a],this.#e=[l,...h],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===W}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#v=this.#v||(this.#n===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#a!==void 0?this.#a:this.hasMore()?(this.#a=new e(this.#t,this.#e,this.#n+1,this.#r),this.#a.#o=this.#o,this.#a.#c=this.#c,this.#a.#y=this.#y,this.#a):this.#a=null}isUNC(){let t=this.#t;return this.#c!==void 0?this.#c:this.#c=this.#r==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#y!==void 0?this.#y:this.#y=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#o!==void 0?this.#o:this.#o=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}};var au=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",se=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:i,nocase:s,noext:r,noglobstar:n,platform:a=au}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:i,nocase:s,noext:r,noglobstar:n,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let o of t)this.add(o)}add(t){let i=new et(t,this.mmopts);for(let s=0;s<i.set.length;s++){let r=i.set[s],n=i.globParts[s];if(!r||!n)throw new Error("invalid pattern object");for(;r[0]==="."&&n[0]===".";)r.shift(),n.shift();let a=new ie(r,n,0,this.platform),o=new et(a.globString(),this.mmopts),h=n[n.length-1]==="**",c=a.isAbsolute();c?this.absolute.push(o):this.relative.push(o),h&&(c?this.absoluteChildren.push(o):this.relativeChildren.push(o))}}ignored(t){let i=t.fullpath(),s=`${i}/`,r=t.relative()||".",n=`${r}/`;for(let a of this.relative)if(a.match(r)||a.match(n))return!0;for(let a of this.absolute)if(a.match(i)||a.match(s))return!0;return!1}childrenIgnored(t){let i=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let r of this.relativeChildren)if(r.match(s))return!0;for(let r of this.absoluteChildren)if(r.match(i))return!0;return!1}};var hs=class e{store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,i){var s;return(s=this.store.get(t.fullpath()))==null?void 0:s.has(i.globString())}storeWalked(t,i){let s=t.fullpath(),r=this.store.get(s);r?r.add(i.globString()):this.store.set(s,new Set([i.globString()]))}},us=class{store=new Map;add(t,i,s){let r=(i?2:0)|(s?1:0),n=this.store.get(t);this.store.set(t,n===void 0?r:r&n)}entries(){return[...this.store.entries()].map(([t,i])=>[t,!!(i&2),!!(i&1)])}},cs=class{store=new Map;add(t,i){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(r=>r.globString()===i.globString())||s.push(i):this.store.set(t,[i])}get(t){let i=this.store.get(t);if(!i)throw new Error("attempting to walk unknown path");return i}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},Ce=class e{hasWalkedCache;matches=new us;subwalks=new cs;patterns;follow;dot;opts;constructor(t,i){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=i?i.copy():new hs}processPatterns(t,i){this.patterns=i;let s=i.map(r=>[t,r]);for(let[r,n]of s){this.hasWalkedCache.storeWalked(r,n);let a=n.root(),o=n.isAbsolute()&&this.opts.absolute!==!1;if(a){r=r.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let f=n.rest();if(f)n=f;else{this.matches.add(r,!0,!1);continue}}if(r.isENOENT())continue;let h,c,l=!1;for(;typeof(h=n.pattern())=="string"&&(c=n.rest());)r=r.resolve(h),n=c,l=!0;if(h=n.pattern(),c=n.rest(),l){if(this.hasWalkedCache.hasWalked(r,n))continue;this.hasWalkedCache.storeWalked(r,n)}if(typeof h=="string"){let f=h===".."||h===""||h===".";this.matches.add(r.resolve(h),o,f);continue}else if(h===W){(!r.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(r,n);let f=c==null?void 0:c.pattern(),p=c==null?void 0:c.rest();if(!c||(f===""||f===".")&&!p)this.matches.add(r,o,f===""||f===".");else if(f===".."){let d=r.parent||r;p?this.hasWalkedCache.hasWalked(d,p)||this.subwalks.add(d,p):this.matches.add(d,o,!0)}}else h instanceof RegExp&&this.subwalks.add(r,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,i){let s=this.subwalks.get(t),r=this.child();for(let n of i)for(let a of s){let o=a.isAbsolute(),h=a.pattern(),c=a.rest();h===W?r.testGlobstar(n,a,c,o):h instanceof RegExp?r.testRegExp(n,h,c,o):r.testString(n,h,c,o)}return r}testGlobstar(t,i,s,r){if((this.dot||!t.name.startsWith("."))&&(i.hasMore()||this.matches.add(t,r,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,i):t.isSymbolicLink()&&(s&&i.checkFollowGlobstar()?this.subwalks.add(t,s):i.markFollowGlobstar()&&this.subwalks.add(t,i)))),s){let n=s.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,s.rest(),r);else if(n===".."){let a=t.parent||t;this.subwalks.add(a,s)}else n instanceof RegExp&&this.testRegExp(t,n,s.rest(),r)}}testRegExp(t,i,s,r){i.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}testString(t,i,s,r){t.isNamed(i)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}};var ou=(e,t)=>typeof e=="string"?new se([e],t):Array.isArray(e)?new se(e,t):e,ni=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#n;signal;maxDepth;includeChildMatches;constructor(t,i,s){if(this.patterns=t,this.path=i,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#e=ou(s.ignore??[],s),!this.includeChildMatches&&typeof this.#e.add!="function")){let r="cannot ignore child matches, ignore lacks add() method.";throw new Error(r)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#r(t){var i,s;return this.seen.has(t)||!!((s=(i=this.#e)==null?void 0:i.ignored)!=null&&s.call(i,t))}#a(t){var i,s;return!!((s=(i=this.#e)==null?void 0:i.childrenIgnored)!=null&&s.call(i,t))}pause(){this.paused=!0}resume(){var i;if((i=this.signal)!=null&&i.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){var i;(i=this.signal)!=null&&i.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,i){if(i&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let a=await n.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(n,i)}matchCheckTest(t,i){var s;return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!i||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!((s=t.realpathCached())!=null&&s.isDirectory()))&&!this.#r(t)?t:void 0}matchCheckSync(t,i){if(i&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&(n!=null&&n.isSymbolicLink())){let a=n.realpathSync();a&&(a!=null&&a.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(n,i)}matchFinish(t,i){var n;if(this.#r(t))return;if(!this.includeChildMatches&&((n=this.#e)!=null&&n.add)){let a=`${t.relativePosix()}/**`;this.#e.add(a)}let s=this.opts.absolute===void 0?i:this.opts.absolute;this.seen.add(t);let r=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let a=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(a+r)}else{let a=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!a.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(a?o+a+r:"."+r)}}async match(t,i,s){let r=await this.matchCheck(t,s);r&&this.matchFinish(r,i)}matchSync(t,i,s){let r=this.matchCheckSync(t,s);r&&this.matchFinish(r,i)}walkCB(t,i,s){var r;(r=this.signal)!=null&&r.aborted&&s(),this.walkCB2(t,i,new Ce(this.opts),s)}walkCB2(t,i,s,r){var o;if(this.#a(t))return r();if((o=this.signal)!=null&&o.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(t,i,s,r));return}s.processPatterns(t,i);let n=1,a=()=>{--n===0&&r()};for(let[h,c,l]of s.matches.entries())this.#r(h)||(n++,this.match(h,c,l).then(()=>a()));for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirCached();h.calledReaddir()?this.walkCB3(h,c,s,a):h.readdirCB((l,f)=>this.walkCB3(h,f,s,a),!0)}a()}walkCB3(t,i,s,r){s=s.filterEntries(t,i);let n=1,a=()=>{--n===0&&r()};for(let[o,h,c]of s.matches.entries())this.#r(o)||(n++,this.match(o,h,c).then(()=>a()));for(let[o,h]of s.subwalks.entries())n++,this.walkCB2(o,h,s.child(),a);a()}walkCBSync(t,i,s){var r;(r=this.signal)!=null&&r.aborted&&s(),this.walkCB2Sync(t,i,new Ce(this.opts),s)}walkCB2Sync(t,i,s,r){var o;if(this.#a(t))return r();if((o=this.signal)!=null&&o.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(t,i,s,r));return}s.processPatterns(t,i);let n=1,a=()=>{--n===0&&r()};for(let[h,c,l]of s.matches.entries())this.#r(h)||this.matchSync(h,c,l);for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let c=h.readdirSync();this.walkCB3Sync(h,c,s,a)}a()}walkCB3Sync(t,i,s,r){s=s.filterEntries(t,i);let n=1,a=()=>{--n===0&&r()};for(let[o,h,c]of s.matches.entries())this.#r(o)||this.matchSync(o,h,c);for(let[o,h]of s.subwalks.entries())n++,this.walkCB2Sync(o,h,s.child(),a);a()}},Ae=class extends ni{matches=new Set;constructor(t,i,s){super(t,i,s)}matchEmit(t){this.matches.add(t)}async walk(){var t;if((t=this.signal)!=null&&t.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((i,s)=>{this.walkCB(this.path,this.patterns,()=>{var r;(r=this.signal)!=null&&r.aborted?s(this.signal.reason):i(this.matches)})}),this.matches}walkSync(){var t;if((t=this.signal)!=null&&t.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{var i;if((i=this.signal)!=null&&i.aborted)throw this.signal.reason}),this.matches}},Ie=class extends ni{results;constructor(t,i,s){super(t,i,s),this.results=new Dt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var uu=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",xt=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,i){if(!i)throw new TypeError("glob options required");if(this.withFileTypes=!!i.withFileTypes,this.signal=i.signal,this.follow=!!i.follow,this.dot=!!i.dot,this.dotRelative=!!i.dotRelative,this.nodir=!!i.nodir,this.mark=!!i.mark,i.cwd?(i.cwd instanceof URL||i.cwd.startsWith("file://"))&&(i.cwd=hu(i.cwd)):this.cwd="",this.cwd=i.cwd||"",this.root=i.root,this.magicalBraces=!!i.magicalBraces,this.nobrace=!!i.nobrace,this.noext=!!i.noext,this.realpath=!!i.realpath,this.absolute=i.absolute,this.includeChildMatches=i.includeChildMatches!==!1,this.noglobstar=!!i.noglobstar,this.matchBase=!!i.matchBase,this.maxDepth=typeof i.maxDepth=="number"?i.maxDepth:1/0,this.stat=!!i.stat,this.ignore=i.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!i.windowsPathsNoEscape||i.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(i.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=i.platform||uu,this.opts={...i,platform:this.platform},i.scurry){if(this.scurry=i.scurry,i.nocase!==void 0&&i.nocase!==i.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let h=i.platform==="win32"?te:i.platform==="darwin"?_e:i.platform?ee:vn;this.scurry=new h(this.cwd,{nocase:i.nocase,fs:i.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",r={...i,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new et(h,r)),[a,o]=n.reduce((h,c)=>(h[0].push(...c.set),h[1].push(...c.globParts),h),[[],[]]);this.patterns=a.map((h,c)=>{let l=o[c];if(!l)throw new Error("invalid pattern object");return new ie(h,l,0,this.platform)})}async walk(){return[...await new Ae(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Ae(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Ie(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Ie(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var ls=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let i of e)if(new et(i,t).hasMagic())return!0;return!1};function ai(e,t={}){return new xt(e,t).streamSync()}function En(e,t={}){return new xt(e,t).stream()}function oi(e,t={}){return new xt(e,t).walkSync()}async function wn(e,t={}){return new xt(e,t).walk()}function hi(e,t={}){return new xt(e,t).iterateSync()}function _n(e,t={}){return new xt(e,t).iterate()}var cu=ai,lu=Object.assign(En,{sync:ai}),fu=hi,pu=Object.assign(_n,{sync:hi}),du=Object.assign(oi,{stream:ai,iterate:hi}),Sn=Object.assign(wn,{glob:wn,globSync:oi,sync:du,globStream:En,stream:lu,globStreamSync:ai,streamSync:cu,globIterate:_n,iterate:pu,globIterateSync:hi,iterateSync:fu,Glob:xt,hasMagic:ls,escape:Yt,unescape:dt});Sn.glob=Sn;var Rt=class e{static get useFileContent(){var t,i;return((i=(t=tt.config.config)==null?void 0:t.idempotency)==null?void 0:i.useFileContent)??!1}static get location(){var t,i;return((i=(t=tt.config.config)==null?void 0:t.idempotency)==null?void 0:i.location)??"./node_modules/.cache/bsm/idempotency"}static updateHashForFile(t,i){try{if(this.useFileContent){let s=$t.readFileSync(i);t.update(s)}else{let s=$t.lstatSync(i);t.update(s.ctimeMs.toString()),t.update(s.mtimeMs.toString())}}catch{}}static updateHashForDir(t,i){try{$t.readdirSync(i,{withFileTypes:!0,recursive:!0}).forEach(s=>{if(s.name==null)return;let r=Cn.join(s.parentPath??s.path??i,s.name).replace(/\\/g,"/");t.update(r),s.isFile()&&this.updateHashForFile(t,r)})}catch{}}static updateHashForGlob(t,i){try{let s=oi(i,{withFileTypes:!0});for(let r of s){let n=Cn.relative(process.cwd(),r.fullpath());r.isFile()?this.updateHashForFile(t,n):this.updateHashForDir(t,n)}}catch{}}static getIdempotencyKeys(t){return typeof t=="string"?[t]:typeof t=="object"?Object.values(t).flatMap(e.getIdempotencyKeys):(A.error(`\x1B[31m[Idempotency] Invalid idempotency config (type: \x1B[4m${typeof t}\x1B[0m\x1B[31m not supported)\x1B[0m`),[])}static calculateIdempotencyHash(t,i){var n;let s=e.getIdempotencyKeys(t),r=mu("sha256");for(let a of s){let o=a.split(":")[0],h=a.substring(o.length+1);switch(o){case"static":r.update(h);break;case"env":r.update(h),r.update(((n=i==null?void 0:i.env)==null?void 0:n[h])??process.env[h]??Buffer.of());break;case"file":this.updateHashForFile(r,h);break;case"dir":this.updateHashForDir(r,h);break;case"glob":this.updateHashForGlob(r,h);break;default:A.log(`\x1B[33m[Idempotency]\x1B[0m Unknown type: ${o}, using value as static`),r.update(a)}}return r.digest("hex")}static getFileName(t){let i=t.join(".");return`${this.location}/${i}.hash`.replaceAll("*","__all__")}static saveIdempotencyHash(t,i){$t.mkdirSync(this.location,{recursive:!0}),$t.writeFileSync(this.getFileName(i),t)}static getSavedIdempotencyHash(t){let i=this.getFileName(t);if($t.existsSync(i))return $t.readFileSync(i,"utf-8")}static checkIdempotency(t,i,s){let r=t.$idempotency,n=this.calculateIdempotencyHash(r,s);return this.getSavedIdempotencyHash(i)===n}static saveIdempotency(t,i){let s=t.$idempotency,r=this.calculateIdempotencyHash(s);this.saveIdempotencyHash(r,i)}static hasIdempotencyEnabled(t){return process.env.BSM_DISABLE_IDEMPOTENCY==="true"||!Object.hasOwn(t,"$idempotency")?!1:Object.hasOwn(t,"$idempotencyEnabled")?!!t.$idempotencyEnabled:!0}};var Ft=class extends Error{constructor(i,s){super();this.code=i;this.script=s}},re=class extends Ft{constructor(i,s){super(1,s);this.func=i;this.script=s}};var Mt=class e{static async run(t){let i=tt.config;await e.runScript(i.scripts,t.split("."),[],{})}static async runScript(t,i,s,r){typeof t=="function"?await e.executeFunction(t,i,s,r):typeof t=="string"?await e.executeString(t,i,s,r):typeof t=="object"?Array.isArray(t)?await e.executeArray(t,i,s,r):await e.executeObject(t,i,s,r):await e.notFound(s,r)}static async notFound(t,i,s){var r;if(!i.ignoreNotFound){if(s){let n=t[t.length-1],a=t.slice(0,-1);if(a.length===0?A.error(`\x1B[31mScript '${n}' does not exist\x1B[0m`):A.error(`\x1B[31mScript '${a.join(".")}' does not have a '${n}' script\x1B[0m`),((r=tt.config.config)==null?void 0:r.defaultHelpBehavior)==="interactive"){let o=await Wt.selectScript(tt.config,{_:[t.join(".")]});await this.run(o[0]),process.exit(0)}else A.log(),Object.hasOwn(s,"$description")&&(lt.printCommand(s,a),A.log()),A.log("\x1B[1mTry one of the following:\x1B[0m"),lt.printCommands(s,a,!1)}else A.error(`\x1B[31mScript '${t.join(".")}' not found\x1B[0m`);process.exit(127)}}static async executeFunction(t,i,s,r){var o;A.log(`> \x1B[93mExecuting JavaScript function\x1B[0m \x1B[90m(${[...s].join(".")})\x1B[0m`);let n,a=process.env;try{process.env={...process.env,...r.env},n=await t.call(null,process.argv)}catch(h){throw h instanceof Error&&(h.stack=(o=h.stack)==null?void 0:o.split(" at executeFunction")[0]),new re(h,s.join("."))}finally{process.env=a}if(n==null){i.length>0&&await e.notFound([...s,...i],r);return}await e.runScript(n,i,s,{...r,excludeArgs:!0})}static async executeString(t,i,s,r){if(i.length>0){await e.notFound([...s,...i],r);return}!r.excludeArgs&&process.argv.length&&(t+=" "+process.argv.join(" ")),A.log(`> ${t} \x1B[90m(${s.join(".")})\x1B[0m`),process.env.BSM_LOG_FILE&&fs.appendFileSync(process.env.BSM_LOG_FILE,`${new Date().toISOString()} ${t} ${s.join(".")} ${process.cwd()}
|
|
17
|
+
`),t!==""&&(t=t.replace(/bsm ~/g,"bsm \\~"),await new Promise((n,a)=>{gu.spawn(t,[],{stdio:"inherit",shell:!0,env:{...process.env,...r.env,BSM_PATH:s.slice(0,-1).join("."),BSM_SCRIPT:s.join(".")}}).on("close",h=>{h===0?n():a(new Ft(h,s.join(".")))})}))}static async executeArray(t,i,s,r){if(i.length===0||i[0]==="*")for(let n=0;n<t.length;n++)await e.runScript(t[n],i.slice(1),[...s,n.toString()],{...r,ignoreNotFound:i[0]==="*"?!0:r.ignoreNotFound});else{let n=i[0],a=e.subscript(t,n);if(a)await e.runScript(a[1],i.slice(1),[...s,a[0]],r);else{await e.notFound([...s,n],r,t);return}}}static shouldRun(t,i,s,r){return Rt.hasIdempotencyEnabled(t)&&Rt.checkIdempotency(t,[...s,...i],r)?(A.log(`\x1B[90mNot running ${[...s,...i].join(".")} because the idempotency hash is the same\x1B[0m`),!1):!0}static getObjectRunnerScriptName(t){for(let i of e.objectScripts)if(Object.hasOwn(t,i))return i}static async executeObject(t,i,s,r){try{if(Object.hasOwn(t,"$env")&&(r.env={...r.env,...e.getEnv(t.$env)}),i.length===0){let n=e.getObjectRunnerScriptName(t);if(n)i=[n];else{await e.notFound([...s,"_default"],r,t);return}}if(!e.shouldRun(t,i,s,r))return;if(await e.executeHook(t,"_pre",i,s,r),i[0]==="*")for(let n in t)n.startsWith("_")||n.startsWith("$")||Object.hasOwn(t,n)&&await e.runScript(t[n],i.slice(1),[...s,n],{...r,ignoreNotFound:!0});else{let n=i[0],a=e.subscript(t,n);if(a)await e.runScript(a[1],i.slice(1),[...s,a[0]],r);else{await e.notFound([...s,n],r,t);return}}await e.executeHook(t,"_post",i,s,r),Rt.hasIdempotencyEnabled(t)&&Rt.saveIdempotency(t,[...s,...i])}catch(n){if(n instanceof Ft?process.env.BSM_ERROR=n.code.toString():process.env.BSM_ERROR="1",await e.executeHook(t,"_onError",i,s,r),!await e.executeHook(t,"_catch",i,s,r))throw n;Rt.hasIdempotencyEnabled(t)&&Rt.saveIdempotency(t,[...s,...i])}finally{await e.executeHook(t,"_finally",i,s,r)}}static subscript(t,i,s=!0){if(typeof t=="object"&&(Object.hasOwn(t,i)||(i=(function(){var n;if((n=tt.config.config)!=null&&n.caseInsensitive){let a=Object.keys(t).find(o=>o.toLowerCase()===i.toLowerCase());if(a)return a}if(s){let a=e.resolveAlias(t,i);if(a)return a}})()??i),!!Object.hasOwn(t,i)))if(Array.isArray(t)){let r=parseInt(i);return[i,t[r]]}else return[i,t[i]]}static resolveAlias(t,i){var s;for(let[r,n]of Object.entries(t)){if(typeof n!="object"||Array.isArray(n)||!Object.hasOwn(n,"$alias"))continue;let a=e.getAliases(n.$alias);if(a.includes(i)||(s=tt.config.config)!=null&&s.caseInsensitive&&a.map(o=>o.toLowerCase()).includes(i.toLowerCase()))return r}}static getAliases(t){return typeof t=="string"?[t]:Array.isArray(t)?t.flatMap(e.getAliases):(A.error(`\x1B[31mAlias with type ${typeof t} is not supported\x1B[0m`),[])}static getEnv(t){if(typeof t=="string"){if(t==="")return{};if(t.startsWith("file:")){let i=xu.join(process.cwd(),t.slice(5));if(!fs.existsSync(i))return A.error(`\x1B[31mFile '${i}' does not exist\x1B[0m
|
|
18
18
|
\x1B[1mRunning script without these environment variables\x1B[0m
|
|
19
19
|
`),{};let r=fs.readFileSync(i,"utf-8").replaceAll("\r","").split(`
|
|
20
20
|
`).filter(a=>!a.startsWith("#")&&a.trim()!==""),n={};for(let a of r){let h=/^([^=]+)=(['"])?(.+)\2$/g.exec(a);if(h){let c=h[3];h[2]==='"'&&(c=c.replaceAll(/(?<=(?<!\\)(\\\\)*)\\n/g,`
|
|
21
21
|
`).replaceAll(/(?<=(?<!\\)(\\\\)*)\\t/g," ").replaceAll(/(?<=(?<!\\)(\\\\)*)\\r/g,"\r").replaceAll(/(?<=(?<!\\)(\\\\)*)\\\\/g,"\\")),n[h[1]]=c}}return n}else return A.error(`\x1B[31mCurrently only 'file:' is supported for environment variables\x1B[0m
|
|
22
|
-
`),{}}else if(typeof t=="object")if(Array.isArray(t)){let i={};for(let s of t)i={...i,...e.getEnv(s)};return i}else return t;else{let i=t.call(null,process.argv);return i===void 0?{}:e.getEnv(i)}}static async executeHook(t,i,s,r){
|
|
22
|
+
`),{}}else if(typeof t=="object")if(Array.isArray(t)){let i={};for(let s of t)i={...i,...e.getEnv(s)};return i}else return t;else{let i=t.call(null,process.argv);return i===void 0?{}:e.getEnv(i)}}static getHookName(t,i){return i.length===0?[t]:[`${t}_${i[0]}`,t]}static async executeHook(t,i,s,r,n){let a=e.getHookName(i,s);for(let o of a)if(Object.hasOwn(t,o))return await e.runScript(t[o],[],[...r,o],{...n,excludeArgs:!0}),!0;return!1}static get _isCI(){return An.isCI}static get objectScripts(){let[t,i,s]=process.versions.node.split("."),r=[`_${process.platform}`,`_${process.arch}`,`_node${t}_${i}_${s}`,`_node${t}_${i}`,`_node${t}`,"_default"];return e._isCI&&r.unshift("_ci"),r}static async runObject(t,i,s){for(let r of e.objectScripts)if(Object.hasOwn(t,r)){await e.runScript(t[r],[],[...i,r],s);return}await e.notFound([...i,"_default"],s,t)}static isExecutable(t){if(typeof t=="function"||typeof t=="string")return!0;if(typeof t!="object")return!1;if(Array.isArray(t))return!0;for(let i of e.objectScripts)if(Object.hasOwn(t,i))return!0;return!1}};var Wt=class{static async selectScript(t,i){var o;let r=(((o=i._[0])==null?void 0:o.replace(/^~/,process.env.BSM_PATH??"~"))??"").split("."),n=[],a=t.scripts;for(let h of r){let c;if(Array.isArray(a)?c=a[Number.parseInt(h)]:c=a[h],typeof c!="object")break;n.push([h,a]),a=c}return yu((h,c)=>{let[l,f]=ui(n),[p,d]=ui(a),x=vu(()=>typeof p=="string"||typeof p=="function"?[]:Object.entries(p).map(k=>[k[0],k[1],lt.getCommandHelp(k[1],[k[0]])]).filter(k=>k[2]!==void 0),[p,l]),[m,S]=ui(0),[y,E]=ui(!1),b=x.length,g=x[m][0],_=x[m][1],L=[...l.map(k=>k[0]),g].join("."),I=`
|
|
23
23
|
\x1B[1mRun command \xBB \x1B[90m${L}\x1B[0m`;if(y)return c([L]),I;function q(){typeof _=="object"&&(S(0),f([...l,[g,p]]),d(_))}bu(k=>{if(k.name==="up")S((m-1+b)%b);else if(k.name==="down")S((m+1)%b);else if(k.name==="left"){if(l.length===0)return;let Re=l.slice(0,-1),li=l[l.length-1];S(Object.keys(li[1]).indexOf(li[0])),f(Re),d(li[1])}else k.name==="right"?q():k.name==="return"&&(Mt.isExecutable(_)?E(!0):q())});let M=x.map((k,Re)=>`${Re===m?"\x1B[32m\x1B[1m> \x1B[4m":" "}${k[2]}`).join(`
|
|
24
24
|
`);return`${I}
|
|
25
25
|
${M}\x1B[?25l`})({message:"test"}).catch(()=>process.exit(1))}};import In from"path";function Rn(e){return Array.isArray(e)?e:Object.entries(e).filter(([t])=>!t.startsWith("$")).map(([,t])=>t)}function wu(e,t){if(!t)return;let i=process.platform==="win32"?";":":",s=t.join(i);!process.env.Path||process.env.Path.includes(s)||(e.Path=`${process.env.Path}${i}${s}`)}function Su(){let e=[],t=process.cwd();do e.push(In.join(t,"node_modules/.bin"));while(t!==(t=In.join(t,"../")));return e}function Tn(e,t){if(t.length===0)return e;if(typeof e!="object")return;let i=t[0],s=Mt.subscript(e,i,!1);if(s)return Tn(s[1],t.slice(1))}var ci=class{constructor(t){this.argv=t}config;async run(){this.argv.silent&&A.silence(),this.argv.version&<.printVersion(),this.config=await tt.load(this.argv),this.handleDebug(),this.argv.help&<.printHelp(this.config,this.argv),this.argv.interactive&&(this.argv._=await Wt.selectScript(this.config,this.argv)),this.argv.force&&(process.env.BSM_DISABLE_IDEMPOTENCY="true"),await this.handleNoArgs(),wu(process.env,Su());for(let t of this.argv._){if(t=t.replace(/^\\~/g,"~"),t.startsWith("~")&&process.env.BSM_PATH){let i=process.env.BSM_PATH.split("."),s=Tn(this.config.scripts,i);if(s){await Mt.runScript(s,t.split(".").splice(1),i,{});continue}}await Mt.run(t)}}handleDebug(){if(this.argv.debug)switch(this.argv.debug){case"extends":{let t=this.config.extends;if(t)for(let i of t)typeof i=="string"?A.log(i):A.log(i[0]);return process.exit(0)}case"scripts":{let t=[...Rn(this.config.scripts)],i=[];for(;t.length>0;){let s=t.shift();s&&(typeof s=="string"?i.push(s):typeof s=="object"&&t.push(...Rn(s)))}return A.log(i.join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@under_koen/bsm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "BSM (Basic Script Manager) is a useful tool that enables you to create clear and concise scripts without cluttering your `package.json` file.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Koen van Staveren <koen@underkoen.nl>",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/sinon": "^17.0.4",
|
|
48
48
|
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
|
49
49
|
"@typescript-eslint/parser": "^8.26.0",
|
|
50
|
-
"@under_koen/bsm": "^1.
|
|
50
|
+
"@under_koen/bsm": "^1.10.1",
|
|
51
51
|
"c8": "^10.1.3",
|
|
52
52
|
"ci-info": "^4.1.0",
|
|
53
53
|
"cpy-cli": "^6.0.0",
|