@crossdelta/platform-sdk 0.13.4 → 0.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cli.js +103 -103
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var kd=Object.create;var Zs=Object.defineProperty;var Ed=Object.getOwnPropertyDescriptor;var Sd=Object.getOwnPropertyNames;var Fd=Object.getPrototypeOf,Td=Object.prototype.hasOwnProperty;var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ad=(e,t)=>{for(var r in t)Zs(e,r,{get:t[r],enumerable:!0})},Pd=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Sd(t))!Td.call(e,s)&&s!==r&&Zs(e,s,{get:()=>t[s],enumerable:!(n=Ed(t,s))||n.enumerable});return e};var b=(e,t,r)=>(r=e!=null?kd(Fd(e)):{},Pd(t||!e||!e.__esModule?Zs(r,"default",{value:e,enumerable:!0}):r,e));var Qs=P((Eb,da)=>{"use strict";da.exports=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return n!==-1&&(s===-1||n<s)}});var ga=P((Sb,ma)=>{"use strict";var ch=require("os"),ha=require("tty"),ht=Qs(),{env:L}=process,se;ht("no-color")||ht("no-colors")||ht("color=false")||ht("color=never")?se=0:(ht("color")||ht("colors")||ht("color=true")||ht("color=always"))&&(se=1);"FORCE_COLOR"in L&&(L.FORCE_COLOR==="true"?se=1:L.FORCE_COLOR==="false"?se=0:se=L.FORCE_COLOR.length===0?1:Math.min(parseInt(L.FORCE_COLOR,10),3));function to(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function eo(e,t){if(se===0)return 0;if(ht("color=16m")||ht("color=full")||ht("color=truecolor"))return 3;if(ht("color=256"))return 2;if(e&&!t&&se===void 0)return 0;let r=se||0;if(L.TERM==="dumb")return r;if(process.platform==="win32"){let n=ch.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in L)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in L)||L.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in L)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(L.TEAMCITY_VERSION)?1:0;if(L.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in L){let n=parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(L.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(L.TERM)||"COLORTERM"in L?1:r}function lh(e){let t=eo(e,e&&e.isTTY);return to(t)}ma.exports={supportsColor:lh,stdout:to(eo(!0,ha.isatty(1))),stderr:to(eo(!0,ha.isatty(2)))}});var wa=P((Fb,ya)=>{"use strict";var uh=ga(),Me=Qs();function Da(e){if(/^\d{3,4}$/.test(e)){let r=/(\d{1,2})(\d{2})/.exec(e)||[];return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let t=(e||"").split(".").map(r=>parseInt(r,10));return{major:t[0],minor:t[1],patch:t[2]}}function ro(e){let{CI:t,FORCE_HYPERLINK:r,NETLIFY:n,TEAMCITY_VERSION:s,TERM_PROGRAM:o,TERM_PROGRAM_VERSION:i,VTE_VERSION:a,TERM:c}=process.env;if(r)return!(r.length>0&&parseInt(r,10)===0);if(Me("no-hyperlink")||Me("no-hyperlinks")||Me("hyperlink=false")||Me("hyperlink=never"))return!1;if(Me("hyperlink=true")||Me("hyperlink=always")||n)return!0;if(!uh.supportsColor(e)||e&&!e.isTTY)return!1;if("WT_SESSION"in process.env)return!0;if(process.platform==="win32"||t||s)return!1;if(o){let l=Da(i||"");switch(o){case"iTerm.app":return l.major===3?l.minor>=1:l.major>3;case"WezTerm":return l.major>=20200620;case"vscode":return l.major>1||l.major===1&&l.minor>=72;case"ghostty":return!0}}if(a){if(a==="0.50.0")return!1;let l=Da(a);return l.major>0||l.minor>=50}switch(c){case"alacritty":return!0}return!1}ya.exports={supportsHyperlink:ro,stdout:ro(process.stdout),stderr:ro(process.stderr)}});var sl=P((ak,Eg)=>{Eg.exports={name:"dotenv",version:"17.2.3",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var ul=P((ck,Vt)=>{var Lo=require("fs"),cs=require("path"),Sg=require("os"),Fg=require("crypto"),Tg=sl(),Wo=Tg.version,ol=["\u{1F510} encrypt with Dotenvx: https://dotenvx.com","\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit","\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild","\u{1F4E1} add observability to secrets: https://dotenvx.com/ops","\u{1F465} sync secrets across teammates & machines: https://dotenvx.com/ops","\u{1F5C2}\uFE0F backup and recover secrets: https://dotenvx.com/ops","\u2705 audit secrets and track compliance: https://dotenvx.com/ops","\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops","\u{1F511} add access controls to secrets: https://dotenvx.com/ops","\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`","\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }","\u2699\uFE0F enable debug logging with { debug: true }","\u2699\uFE0F override existing env vars with { override: true }","\u2699\uFE0F suppress all logs with { quiet: true }","\u2699\uFE0F write to custom object with { processEnv: myObject }","\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"];function Ag(){return ol[Math.floor(Math.random()*ol.length)]}function tr(e){return typeof e=="string"?!["false","0","no","off",""].includes(e.toLowerCase()):!!e}function Pg(){return process.stdout.isTTY}function Rg(e){return Pg()?`\x1B[2m${e}\x1B[0m`:e}var Ig=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Ng(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
3
- `);let n;for(;(n=Ig.exec(r))!=null;){let s=n[1],o=n[2]||"";o=o.trim();let i=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(o=o.replace(/\\n/g,`
4
- `),o=o.replace(/\\r/g,"\r")),t[s]=o}return t}function Og(e){e=e||{};let t=ll(e);e.path=t;let r=_.configDotenv(e);if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw i.code="MISSING_DATA",i}let n=cl(e).split(","),s=n.length,o;for(let i=0;i<s;i++)try{let a=n[i].trim(),c=$g(r,a);o=_.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=s)throw a}return _.parse(o)}function Mg(e){console.error(`[dotenv@${Wo}][WARN] ${e}`)}function en(e){console.log(`[dotenv@${Wo}][DEBUG] ${e}`)}function al(e){console.log(`[dotenv@${Wo}] ${e}`)}function cl(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function $g(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let s=r.searchParams.get("environment");if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${s.toUpperCase()}`,i=e.parsed[o];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:n}}function ll(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)Lo.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=cs.resolve(process.cwd(),".env.vault");return Lo.existsSync(t)?t:null}function il(e){return e[0]==="~"?cs.join(Sg.homedir(),e.slice(1)):e}function Bg(e){let t=tr(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),r=tr(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!r)&&al("Loading env from encrypted .env.vault");let n=_._parseVault(e),s=process.env;return e&&e.processEnv!=null&&(s=e.processEnv),_.populate(s,n,e),{parsed:n}}function jg(e){let t=cs.resolve(process.cwd(),".env"),r="utf8",n=process.env;e&&e.processEnv!=null&&(n=e.processEnv);let s=tr(n.DOTENV_CONFIG_DEBUG||e&&e.debug),o=tr(n.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?r=e.encoding:s&&en("No encoding is specified. UTF-8 is used by default");let i=[t];if(e&&e.path)if(!Array.isArray(e.path))i=[il(e.path)];else{i=[];for(let u of e.path)i.push(il(u))}let a,c={};for(let u of i)try{let p=_.parse(Lo.readFileSync(u,{encoding:r}));_.populate(c,p,e)}catch(p){s&&en(`Failed to load ${u} ${p.message}`),a=p}let l=_.populate(n,c,e);if(s=tr(n.DOTENV_CONFIG_DEBUG||s),o=tr(n.DOTENV_CONFIG_QUIET||o),s||!o){let u=Object.keys(l).length,p=[];for(let d of i)try{let f=cs.relative(process.cwd(),d);p.push(f)}catch(f){s&&en(`Failed to load ${d} ${f.message}`),a=f}al(`injecting env (${u}) from ${p.join(",")} ${Rg(`-- tip: ${Ag()}`)}`)}return a?{parsed:c,error:a}:{parsed:c}}function _g(e){if(cl(e).length===0)return _.configDotenv(e);let t=ll(e);return t?_._configVault(e):(Mg(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),_.configDotenv(e))}function Lg(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),s=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let i=Fg.createDecipheriv("aes-256-gcm",r,s);return i.setAuthTag(o),`${i.update(n)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",l=i.message==="Unsupported state or unable to authenticate data";if(a||c){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(l){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw i}}function Wg(e,t,r={}){let n=!!(r&&r.debug),s=!!(r&&r.override),o={};if(typeof t!="object"){let i=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw i.code="OBJECT_REQUIRED",i}for(let i of Object.keys(t))Object.prototype.hasOwnProperty.call(e,i)?(s===!0&&(e[i]=t[i],o[i]=t[i]),n&&en(s===!0?`"${i}" is already defined and WAS overwritten`:`"${i}" is already defined and was NOT overwritten`)):(e[i]=t[i],o[i]=t[i]);return o}var _={configDotenv:jg,_configVault:Bg,_parseVault:Og,config:_g,decrypt:Lg,parse:Ng,populate:Wg};Vt.exports.configDotenv=_.configDotenv;Vt.exports._configVault=_._configVault;Vt.exports._parseVault=_._parseVault;Vt.exports.config=_.config;Vt.exports.decrypt=_.decrypt;Vt.exports.parse=_.parse;Vt.exports.populate=_.populate;Vt.exports=_});var Ps=P((t0,Ju)=>{var ki=[],Ku=0,Y=(e,t)=>{Ku>=t&&ki.push(e)};Y.WARN=1;Y.INFO=2;Y.DEBUG=3;Y.reset=()=>{ki=[]};Y.setDebugLevel=e=>{Ku=e};Y.warn=e=>Y(e,Y.WARN);Y.info=e=>Y(e,Y.INFO);Y.debug=e=>Y(e,Y.DEBUG);Y.debugMessages=()=>ki;Ju.exports=Y});var Vu=P((e0,qu)=>{"use strict";qu.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var Zu=P((r0,Yu)=>{"use strict";var zy=Vu();Yu.exports=e=>typeof e=="string"?e.replace(zy(),""):e});var Qu=P((n0,Ei)=>{"use strict";var Xu=e=>Number.isNaN(e)?!1:e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141);Ei.exports=Xu;Ei.exports.default=Xu});var ep=P((s0,tp)=>{"use strict";tp.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var np=P((o0,Si)=>{"use strict";var Ky=Zu(),Jy=Qu(),qy=ep(),rp=e=>{if(typeof e!="string"||e.length===0||(e=Ky(e),e.length===0))return 0;e=e.replace(qy()," ");let t=0;for(let r=0;r<e.length;r++){let n=e.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,t+=Jy(n)?2:1)}return t};Si.exports=rp;Si.exports.default=rp});var Fi=P((i0,ap)=>{var sp=np();function Rs(e){return e?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function _t(e){let t=Rs();return(""+e).replace(t,"").split(`
5
- `).reduce(function(s,o){return sp(o)>s?sp(o):s},0)}function gn(e,t){return Array(t+1).join(e)}function Vy(e,t,r,n){let s=_t(e);if(t+1>=s){let o=t-s;switch(n){case"right":{e=gn(r,o)+e;break}case"center":{let i=Math.ceil(o/2),a=o-i;e=gn(r,a)+e+gn(r,i);break}default:{e=e+gn(r,o);break}}}return e}var dr={};function Dn(e,t,r){t="\x1B["+t+"m",r="\x1B["+r+"m",dr[t]={set:e,to:!0},dr[r]={set:e,to:!1},dr[e]={on:t,off:r}}Dn("bold",1,22);Dn("italics",3,23);Dn("underline",4,24);Dn("inverse",7,27);Dn("strikethrough",9,29);function op(e,t){let r=t[1]?parseInt(t[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){e.lastForegroundAdded=t[0];return}if(r>=40&&r<=49||r>=100&&r<=107){e.lastBackgroundAdded=t[0];return}if(r===0){for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&delete e[s];return}let n=dr[t[0]];n&&(e[n.set]=n.to)}function Yy(e){let t=Rs(!0),r=t.exec(e),n={};for(;r!==null;)op(n,r),r=t.exec(e);return n}function ip(e,t){let r=e.lastBackgroundAdded,n=e.lastForegroundAdded;return delete e.lastBackgroundAdded,delete e.lastForegroundAdded,Object.keys(e).forEach(function(s){e[s]&&(t+=dr[s].off)}),r&&r!="\x1B[49m"&&(t+="\x1B[49m"),n&&n!="\x1B[39m"&&(t+="\x1B[39m"),t}function Zy(e,t){let r=e.lastBackgroundAdded,n=e.lastForegroundAdded;return delete e.lastBackgroundAdded,delete e.lastForegroundAdded,Object.keys(e).forEach(function(s){e[s]&&(t=dr[s].on+t)}),r&&r!="\x1B[49m"&&(t=r+t),n&&n!="\x1B[39m"&&(t=n+t),t}function Xy(e,t){if(e.length===_t(e))return e.substr(0,t);for(;_t(e)>t;)e=e.slice(0,-1);return e}function Qy(e,t){let r=Rs(!0),n=e.split(Rs()),s=0,o=0,i="",a,c={};for(;o<t;){a=r.exec(e);let l=n[s];if(s++,o+_t(l)>t&&(l=Xy(l,t-o)),i+=l,o+=_t(l),o<t){if(!a)break;i+=a[0],op(c,a)}}return ip(c,i)}function tw(e,t,r){if(r=r||"\u2026",_t(e)<=t)return e;t-=_t(r);let s=Qy(e,t);s+=r;let o="\x1B]8;;\x07";return e.includes(o)&&!s.includes(o)&&(s+=o),s}function ew(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function rw(e,t){e=e||{},t=t||ew();let r=Object.assign({},t,e);return r.chars=Object.assign({},t.chars,e.chars),r.style=Object.assign({},t.style,e.style),r}function nw(e,t){let r=[],n=t.split(/(\s+)/g),s=[],o=0,i;for(let a=0;a<n.length;a+=2){let c=n[a],l=o+_t(c);o>0&&i&&(l+=i.length),l>e?(o!==0&&r.push(s.join("")),s=[c],o=_t(c)):(s.push(i||"",c),o=l),i=n[a+1]}return o&&r.push(s.join("")),r}function sw(e,t){let r=[],n="";function s(i,a){for(n.length&&a&&(n+=a),n+=i;n.length>e;)r.push(n.slice(0,e)),n=n.slice(e)}let o=t.split(/(\s+)/g);for(let i=0;i<o.length;i+=2)s(o[i],i&&o[i-1]);return n.length&&r.push(n),r}function ow(e,t,r=!0){let n=[];t=t.split(`
6
- `);let s=r?nw:sw;for(let o=0;o<t.length;o++)n.push.apply(n,s(e,t[o]));return n}function iw(e){let t={},r=[];for(let n=0;n<e.length;n++){let s=Zy(t,e[n]);t=Yy(s);let o=Object.assign({},t);r.push(ip(o,s))}return r}function aw(e,t){return["\x1B]","8",";",";",e||t,"\x07",t,"\x1B]","8",";",";","\x07"].join("")}ap.exports={strlen:_t,repeat:gn,pad:Vy,truncate:tw,mergeOptions:rw,wordWrap:ow,colorizeLines:iw,hyperlink:aw}});var pp=P((a0,up)=>{var lp={};up.exports=lp;var cp={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(cp).forEach(function(e){var t=cp[e],r=lp[e]=[];r.open="\x1B["+t[0]+"m",r.close="\x1B["+t[1]+"m"})});var dp=P((c0,fp)=>{"use strict";fp.exports=function(e,t){t=t||process.argv;var r=t.indexOf("--"),n=/^-{1,2}/.test(e)?"":"--",s=t.indexOf(n+e);return s!==-1&&(r===-1?!0:s<r)}});var mp=P((l0,hp)=>{"use strict";var cw=require("os"),Tt=dp(),nt=process.env,hr=void 0;Tt("no-color")||Tt("no-colors")||Tt("color=false")?hr=!1:(Tt("color")||Tt("colors")||Tt("color=true")||Tt("color=always"))&&(hr=!0);"FORCE_COLOR"in nt&&(hr=nt.FORCE_COLOR.length===0||parseInt(nt.FORCE_COLOR,10)!==0);function lw(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function uw(e){if(hr===!1)return 0;if(Tt("color=16m")||Tt("color=full")||Tt("color=truecolor"))return 3;if(Tt("color=256"))return 2;if(e&&!e.isTTY&&hr!==!0)return 0;var t=hr?1:0;if(process.platform==="win32"){var r=cw.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in nt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(s){return s in nt})||nt.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(nt.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in nt){var n=parseInt((nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(nt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(nt.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(nt.TERM)||"COLORTERM"in nt?1:(nt.TERM==="dumb",t)}function Ti(e){var t=uw(e);return lw(t)}hp.exports={supportsColor:Ti,stdout:Ti(process.stdout),stderr:Ti(process.stderr)}});var Dp=P((u0,gp)=>{gp.exports=function(t,r){var n="";t=t||"Run the trap, drop the bass",t=t.split("");var s={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return t.forEach(function(o){o=o.toLowerCase();var i=s[o]||[" "],a=Math.floor(Math.random()*i.length);typeof s[o]<"u"?n+=s[o][a]:n+=o}),n}});var wp=P((p0,yp)=>{yp.exports=function(t,r){t=t||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},s=[].concat(n.up,n.down,n.mid);function o(c){var l=Math.floor(Math.random()*c);return l}function i(c){var l=!1;return s.filter(function(u){l=u===c}),l}function a(c,l){var u="",p,d;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",c=c.split("");for(d in c)if(!i(d)){switch(u=u+c[d],p={up:0,down:0,mid:0},l.size){case"mini":p.up=o(8),p.mid=o(2),p.down=o(8);break;case"maxi":p.up=o(16)+3,p.mid=o(4)+1,p.down=o(64)+3;break;default:p.up=o(8)+1,p.mid=o(6)/2,p.down=o(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var h=f[m],D=0;D<=p[h];D++)l[h]&&(u=u+n[h][o(n[h].length)])}return u}return a(t,r)}});var bp=P((f0,Cp)=>{Cp.exports=function(e){return function(t,r,n){if(t===" ")return t;switch(r%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}});var vp=P((d0,xp)=>{xp.exports=function(e){return function(t,r,n){return r%2===0?t:e.inverse(t)}}});var Ep=P((h0,kp)=>{kp.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(r,n,s){return r===" "?r:e[t[n++%t.length]](r)}}});var Fp=P((m0,Sp)=>{Sp.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,s){return r===" "?r:e[t[Math.round(Math.random()*(t.length-2))]](r)}}});var Np=P((D0,Ip)=>{var v={};Ip.exports=v;v.themes={};var pw=require("util"),Fe=v.styles=pp(),Ap=Object.defineProperties,fw=new RegExp(/[\r\n]+/g);v.supportsColor=mp().supportsColor;typeof v.enabled>"u"&&(v.enabled=v.supportsColor()!==!1);v.enable=function(){v.enabled=!0};v.disable=function(){v.enabled=!1};v.stripColors=v.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")};var g0=v.stylize=function(t,r){if(!v.enabled)return t+"";var n=Fe[r];return!n&&r in v?v[r](t):n.open+t+n.close},dw=/[|\\{}()[\]^$+*?.]/g,hw=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(dw,"\\$&")};function Pp(e){var t=function r(){return gw.apply(r,arguments)};return t._styles=e,t.__proto__=mw,t}var Rp=(function(){var e={};return Fe.grey=Fe.gray,Object.keys(Fe).forEach(function(t){Fe[t].closeRe=new RegExp(hw(Fe[t].close),"g"),e[t]={get:function(){return Pp(this._styles.concat(t))}}}),e})(),mw=Ap(function(){},Rp);function gw(){var e=Array.prototype.slice.call(arguments),t=e.map(function(i){return i!=null&&i.constructor===String?i:pw.inspect(i)}).join(" ");if(!v.enabled||!t)return t;for(var r=t.indexOf(`
7
- `)!=-1,n=this._styles,s=n.length;s--;){var o=Fe[n[s]];t=o.open+t.replace(o.closeRe,o.open)+o.close,r&&(t=t.replace(fw,function(i){return o.close+i+o.open}))}return t}v.setTheme=function(e){if(typeof e=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var t in e)(function(r){v[r]=function(n){if(typeof e[r]=="object"){var s=n;for(var o in e[r])s=v[e[r][o]](s);return s}return v[e[r]](n)}})(t)};function Dw(){var e={};return Object.keys(Rp).forEach(function(t){e[t]={get:function(){return Pp([t])}}}),e}var yw=function(t,r){var n=r.split("");return n=n.map(t),n.join("")};v.trap=Dp();v.zalgo=wp();v.maps={};v.maps.america=bp()(v);v.maps.zebra=vp()(v);v.maps.rainbow=Ep()(v);v.maps.random=Fp()(v);for(Tp in v.maps)(function(e){v[e]=function(t){return yw(v.maps[e],t)}})(Tp);var Tp;Ap(v,Dw())});var Mp=P((y0,Op)=>{var ww=Np();Op.exports=ww});var _p=P((w0,Is)=>{var{info:Cw,debug:jp}=Ps(),ut=Fi(),Pi=class e{constructor(t){this.setOptions(t),this.x=null,this.y=null}setOptions(t){["boolean","number","bigint","string"].indexOf(typeof t)!==-1&&(t={content:""+t}),t=t||{},this.options=t;let r=t.content;if(["boolean","number","bigint","string"].indexOf(typeof r)!==-1)this.content=String(r);else if(!r)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof r);this.colSpan=t.colSpan||1,this.rowSpan=t.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(t,r){this.cells=r;let n=this.options.chars||{},s=t.chars,o=this.chars={};xw.forEach(function(c){Ai(n,s,c,o)}),this.truncate=this.options.truncate||t.truncate;let i=this.options.style=this.options.style||{},a=t.style;Ai(i,a,"padding-left",this),Ai(i,a,"padding-right",this),this.head=i.head||a.head,this.border=i.border||a.border,this.fixedWidth=t.colWidths[this.x],this.lines=this.computeLines(t),this.desiredWidth=ut.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(t){let r=t.wordWrap||t.textWrap,{wordWrap:n=r}=this.options;if(this.fixedWidth&&n){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let i=1;for(;i<this.colSpan;)this.fixedWidth+=t.colWidths[this.x+i],i++}let{wrapOnWordBoundary:s=!0}=t,{wrapOnWordBoundary:o=s}=this.options;return this.wrapLines(ut.wordWrap(this.fixedWidth,this.content,o))}return this.wrapLines(this.content.split(`
8
- `))}wrapLines(t){let r=ut.colorizeLines(t);return this.href?r.map(n=>ut.hyperlink(this.href,n)):r}init(t){let r=this.x,n=this.y;this.widths=t.colWidths.slice(r,r+this.colSpan),this.heights=t.rowHeights.slice(n,n+this.rowSpan),this.width=this.widths.reduce(Bp,-1),this.height=this.heights.reduce(Bp,-1),this.hAlign=this.options.hAlign||t.colAligns[r],this.vAlign=this.options.vAlign||t.rowAligns[n],this.drawRight=r+this.colSpan==t.colWidths.length}draw(t,r){if(t=="top")return this.drawTop(this.drawRight);if(t=="bottom")return this.drawBottom(this.drawRight);let n=ut.truncate(this.content,10,this.truncate);t||Cw(`${this.y}-${this.x}: ${this.rowSpan-t}x${this.colSpan} Cell ${n}`);let s=Math.max(this.height-this.lines.length,0),o;switch(this.vAlign){case"center":o=Math.ceil(s/2);break;case"bottom":o=s;break;default:o=0}if(t<o||t>=o+this.lines.length)return this.drawEmpty(this.drawRight,r);let i=this.lines.length>this.height&&t+1>=this.height;return this.drawLine(t-o,this.drawRight,i,r)}drawTop(t){let r=[];return this.cells?this.widths.forEach(function(n,s){r.push(this._topLeftChar(s)),r.push(ut.repeat(this.chars[this.y==0?"top":"mid"],n))},this):(r.push(this._topLeftChar(0)),r.push(ut.repeat(this.chars[this.y==0?"top":"mid"],this.width))),t&&r.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",r.join(""))}_topLeftChar(t){let r=this.x+t,n;if(this.y==0)n=r==0?"topLeft":t==0?"topMid":"top";else if(r==0)n="leftMid";else if(n=t==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][r]instanceof e.ColSpanCell&&(n=t==0?"topMid":"mid"),t==0)){let o=1;for(;this.cells[this.y][r-o]instanceof e.ColSpanCell;)o++;this.cells[this.y][r-o]instanceof e.RowSpanCell&&(n="leftMid")}return this.chars[n]}wrapWithStyleColors(t,r){if(this[t]&&this[t].length)try{let n=Mp();for(let s=this[t].length-1;s>=0;s--)n=n[this[t][s]];return n(r)}catch{return r}else return r}drawLine(t,r,n,s){let o=this.chars[this.x==0?"left":"middle"];if(this.x&&s&&this.cells){let d=this.cells[this.y+s][this.x-1];for(;d instanceof yn;)d=this.cells[d.y][d.x-1];d instanceof wn||(o=this.chars.rightMid)}let i=ut.repeat(" ",this.paddingLeft),a=r?this.chars.right:"",c=ut.repeat(" ",this.paddingRight),l=this.lines[t],u=this.width-(this.paddingLeft+this.paddingRight);n&&(l+=this.truncate||"\u2026");let p=ut.truncate(l,u,this.truncate);return p=ut.pad(p,u," ",this.hAlign),p=i+p+c,this.stylizeLine(o,p,a)}stylizeLine(t,r,n){return t=this.wrapWithStyleColors("border",t),n=this.wrapWithStyleColors("border",n),this.y===0&&(r=this.wrapWithStyleColors("head",r)),t+r+n}drawBottom(t){let r=this.chars[this.x==0?"bottomLeft":"bottomMid"],n=ut.repeat(this.chars.bottom,this.width),s=t?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",r+n+s)}drawEmpty(t,r){let n=this.chars[this.x==0?"left":"middle"];if(this.x&&r&&this.cells){let i=this.cells[this.y+r][this.x-1];for(;i instanceof yn;)i=this.cells[i.y][i.x-1];i instanceof wn||(n=this.chars.rightMid)}let s=t?this.chars.right:"",o=ut.repeat(" ",this.width);return this.stylizeLine(n,o,s)}},yn=class{constructor(){}draw(t){return typeof t=="number"&&jp(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},wn=class{constructor(t){this.originalCell=t}init(t){let r=this.y,n=this.originalCell.y;this.cellOffset=r-n,this.offset=bw(t.rowHeights,n,this.cellOffset)}draw(t){return t=="top"?this.originalCell.draw(this.offset,this.cellOffset):t=="bottom"?this.originalCell.draw("bottom"):(jp(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+t))}mergeTableOptions(){}};function $p(...e){return e.filter(t=>t!=null).shift()}function Ai(e,t,r,n){let s=r.split("-");s.length>1?(s[1]=s[1].charAt(0).toUpperCase()+s[1].substr(1),s=s.join(""),n[s]=$p(e[s],e[r],t[s],t[r])):n[r]=$p(e[r],t[r])}function bw(e,t,r){let n=e[t];for(let s=1;s<r;s++)n+=1+e[t+s];return n}function Bp(e,t){return e+t+1}var xw=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];Is.exports=Pi;Is.exports.ColSpanCell=yn;Is.exports.RowSpanCell=wn});var Gp=P((C0,Wp)=>{var{warn:vw,debug:kw}=Ps(),Ri=_p(),{ColSpanCell:Ew,RowSpanCell:Sw}=Ri;(function(){function e(f,m){return f[m]>0?e(f,m+1):m}function t(f){let m={};f.forEach(function(h,D){let g=0;h.forEach(function(y){y.y=D,y.x=D?e(m,g):g;let x=y.rowSpan||1,C=y.colSpan||1;if(x>1)for(let A=0;A<C;A++)m[y.x+A]=x;g=y.x+C}),Object.keys(m).forEach(y=>{m[y]--,m[y]<1&&delete m[y]})})}function r(f){let m=0;return f.forEach(function(h){h.forEach(function(D){m=Math.max(m,D.x+(D.colSpan||1))})}),m}function n(f){return f.length}function s(f,m){let h=f.y,D=f.y-1+(f.rowSpan||1),g=m.y,y=m.y-1+(m.rowSpan||1),x=!(h>y||g>D),C=f.x,A=f.x-1+(f.colSpan||1),dt=m.x,ne=m.x-1+(m.colSpan||1),Ae=!(C>ne||dt>A);return x&&Ae}function o(f,m,h){let D=Math.min(f.length-1,h),g={x:m,y:h};for(let y=0;y<=D;y++){let x=f[y];for(let C=0;C<x.length;C++)if(s(g,x[C]))return!0}return!1}function i(f,m,h,D){for(let g=h;g<D;g++)if(o(f,g,m))return!1;return!0}function a(f){f.forEach(function(m,h){m.forEach(function(D){for(let g=1;g<D.rowSpan;g++){let y=new Sw(D);y.x=D.x,y.y=D.y+g,y.colSpan=D.colSpan,l(y,f[h+g])}})})}function c(f){for(let m=f.length-1;m>=0;m--){let h=f[m];for(let D=0;D<h.length;D++){let g=h[D];for(let y=1;y<g.colSpan;y++){let x=new Ew;x.x=g.x+y,x.y=g.y,h.splice(D+1,0,x)}}}}function l(f,m){let h=0;for(;h<m.length&&m[h].x<f.x;)h++;m.splice(h,0,f)}function u(f){let m=n(f),h=r(f);kw(`Max rows: ${m}; Max cols: ${h}`);for(let D=0;D<m;D++)for(let g=0;g<h;g++)if(!o(f,g,D)){let y={x:g,y:D,colSpan:1,rowSpan:1};for(g++;g<h&&!o(f,g,D);)y.colSpan++,g++;let x=D+1;for(;x<m&&i(f,x,y.x,y.x+y.colSpan);)y.rowSpan++,x++;let C=new Ri(y);C.x=y.x,C.y=y.y,vw(`Missing cell at ${C.y}-${C.x}.`),l(C,f[D])}}function p(f){return f.map(function(m){if(!Array.isArray(m)){let h=Object.keys(m)[0];m=m[h],Array.isArray(m)?(m=m.slice(),m.unshift(h)):m=[h,m]}return m.map(function(h){return new Ri(h)})})}function d(f){let m=p(f);return t(m),u(m),a(m),c(m),m}Wp.exports={makeTableLayout:d,layoutTable:t,addRowSpanCells:a,maxWidth:r,fillInTable:u,computeWidths:Lp("colSpan","desiredWidth","x",1),computeHeights:Lp("rowSpan","desiredHeight","y",1)}})();function Lp(e,t,r,n){return function(s,o){let i=[],a=[],c={};o.forEach(function(l){l.forEach(function(u){(u[e]||1)>1?a.push(u):i[u[r]]=Math.max(i[u[r]]||0,u[t]||0,n)})}),s.forEach(function(l,u){typeof l=="number"&&(i[u]=l)});for(let l=a.length-1;l>=0;l--){let u=a[l],p=u[e],d=u[r],f=i[d],m=typeof s[d]=="number"?0:1;if(typeof f=="number")for(let h=1;h<p;h++)f+=1+i[d+h],typeof s[d+h]!="number"&&m++;else f=t==="desiredWidth"?u.desiredWidth-1:1,(!c[d]||c[d]<f)&&(c[d]=f);if(u[t]>f){let h=0;for(;m>0&&u[t]>f;){if(typeof s[d+h]!="number"){let D=Math.round((u[t]-f)/m);f+=D,i[d+h]+=D,m--}h++}}}Object.assign(s,i,c);for(let l=0;l<s.length;l++)s[l]=Math.max(n,s[l]||0)}}});var Up=P((b0,Hp)=>{var Qt=Ps(),Fw=Fi(),Ii=Gp(),Ns=class extends Array{constructor(t){super();let r=Fw.mergeOptions(t);if(Object.defineProperty(this,"options",{value:r,enumerable:r.debug}),r.debug){switch(typeof r.debug){case"boolean":Qt.setDebugLevel(Qt.WARN);break;case"number":Qt.setDebugLevel(r.debug);break;case"string":Qt.setDebugLevel(parseInt(r.debug,10));break;default:Qt.setDebugLevel(Qt.WARN),Qt.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof r.debug}`)}Object.defineProperty(this,"messages",{get(){return Qt.debugMessages()}})}}toString(){let t=this,r=this.options.head&&this.options.head.length;r?(t=[this.options.head],this.length&&t.push.apply(t,this)):this.options.style.head=[];let n=Ii.makeTableLayout(t);n.forEach(function(o){o.forEach(function(i){i.mergeTableOptions(this.options,n)},this)},this),Ii.computeWidths(this.options.colWidths,n),Ii.computeHeights(this.options.rowHeights,n),n.forEach(function(o){o.forEach(function(i){i.init(this.options)},this)},this);let s=[];for(let o=0;o<n.length;o++){let i=n[o],a=this.options.rowHeights[o];(o===0||!this.options.style.compact||o==1&&r)&&Ni(i,"top",s);for(let c=0;c<a;c++)Ni(i,c,s);o+1==n.length&&Ni(i,"bottom",s)}return s.join(`
2
+ "use strict";var Td=Object.create;var Qs=Object.defineProperty;var Ad=Object.getOwnPropertyDescriptor;var Pd=Object.getOwnPropertyNames;var Rd=Object.getPrototypeOf,Id=Object.prototype.hasOwnProperty;var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Nd=(e,t)=>{for(var r in t)Qs(e,r,{get:t[r],enumerable:!0})},Od=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pd(t))!Id.call(e,s)&&s!==r&&Qs(e,s,{get:()=>t[s],enumerable:!(n=Ad(t,s))||n.enumerable});return e};var b=(e,t,r)=>(r=e!=null?Td(Rd(e)):{},Od(t||!e||!e.__esModule?Qs(r,"default",{value:e,enumerable:!0}):r,e));var eo=P((Ab,ma)=>{"use strict";ma.exports=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return n!==-1&&(s===-1||n<s)}});var ya=P((Pb,Da)=>{"use strict";var fh=require("os"),ga=require("tty"),ht=eo(),{env:L}=process,se;ht("no-color")||ht("no-colors")||ht("color=false")||ht("color=never")?se=0:(ht("color")||ht("colors")||ht("color=true")||ht("color=always"))&&(se=1);"FORCE_COLOR"in L&&(L.FORCE_COLOR==="true"?se=1:L.FORCE_COLOR==="false"?se=0:se=L.FORCE_COLOR.length===0?1:Math.min(parseInt(L.FORCE_COLOR,10),3));function ro(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function no(e,t){if(se===0)return 0;if(ht("color=16m")||ht("color=full")||ht("color=truecolor"))return 3;if(ht("color=256"))return 2;if(e&&!t&&se===void 0)return 0;let r=se||0;if(L.TERM==="dumb")return r;if(process.platform==="win32"){let n=fh.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in L)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in L)||L.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in L)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(L.TEAMCITY_VERSION)?1:0;if(L.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in L){let n=parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(L.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(L.TERM)||"COLORTERM"in L?1:r}function dh(e){let t=no(e,e&&e.isTTY);return ro(t)}Da.exports={supportsColor:dh,stdout:ro(no(!0,ga.isatty(1))),stderr:ro(no(!0,ga.isatty(2)))}});var ba=P((Rb,Ca)=>{"use strict";var hh=ya(),Me=eo();function wa(e){if(/^\d{3,4}$/.test(e)){let r=/(\d{1,2})(\d{2})/.exec(e)||[];return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let t=(e||"").split(".").map(r=>parseInt(r,10));return{major:t[0],minor:t[1],patch:t[2]}}function so(e){let{CI:t,FORCE_HYPERLINK:r,NETLIFY:n,TEAMCITY_VERSION:s,TERM_PROGRAM:o,TERM_PROGRAM_VERSION:i,VTE_VERSION:a,TERM:c}=process.env;if(r)return!(r.length>0&&parseInt(r,10)===0);if(Me("no-hyperlink")||Me("no-hyperlinks")||Me("hyperlink=false")||Me("hyperlink=never"))return!1;if(Me("hyperlink=true")||Me("hyperlink=always")||n)return!0;if(!hh.supportsColor(e)||e&&!e.isTTY)return!1;if("WT_SESSION"in process.env)return!0;if(process.platform==="win32"||t||s)return!1;if(o){let l=wa(i||"");switch(o){case"iTerm.app":return l.major===3?l.minor>=1:l.major>3;case"WezTerm":return l.major>=20200620;case"vscode":return l.major>1||l.major===1&&l.minor>=72;case"ghostty":return!0}}if(a){if(a==="0.50.0")return!1;let l=wa(a);return l.major>0||l.minor>=50}switch(c){case"alacritty":return!0}return!1}Ca.exports={supportsHyperlink:so,stdout:so(process.stdout),stderr:so(process.stderr)}});var il=P((pk,Ag)=>{Ag.exports={name:"dotenv",version:"17.2.3",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var fl=P((fk,Vt)=>{var Go=require("fs"),us=require("path"),Pg=require("os"),Rg=require("crypto"),Ig=il(),Ho=Ig.version,al=["\u{1F510} encrypt with Dotenvx: https://dotenvx.com","\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit","\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild","\u{1F4E1} add observability to secrets: https://dotenvx.com/ops","\u{1F465} sync secrets across teammates & machines: https://dotenvx.com/ops","\u{1F5C2}\uFE0F backup and recover secrets: https://dotenvx.com/ops","\u2705 audit secrets and track compliance: https://dotenvx.com/ops","\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops","\u{1F511} add access controls to secrets: https://dotenvx.com/ops","\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`","\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }","\u2699\uFE0F enable debug logging with { debug: true }","\u2699\uFE0F override existing env vars with { override: true }","\u2699\uFE0F suppress all logs with { quiet: true }","\u2699\uFE0F write to custom object with { processEnv: myObject }","\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"];function Ng(){return al[Math.floor(Math.random()*al.length)]}function tr(e){return typeof e=="string"?!["false","0","no","off",""].includes(e.toLowerCase()):!!e}function Og(){return process.stdout.isTTY}function Mg(e){return Og()?`\x1B[2m${e}\x1B[0m`:e}var $g=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Bg(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
3
+ `);let n;for(;(n=$g.exec(r))!=null;){let s=n[1],o=n[2]||"";o=o.trim();let i=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(o=o.replace(/\\n/g,`
4
+ `),o=o.replace(/\\r/g,"\r")),t[s]=o}return t}function jg(e){e=e||{};let t=pl(e);e.path=t;let r=_.configDotenv(e);if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw i.code="MISSING_DATA",i}let n=ul(e).split(","),s=n.length,o;for(let i=0;i<s;i++)try{let a=n[i].trim(),c=Lg(r,a);o=_.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=s)throw a}return _.parse(o)}function _g(e){console.error(`[dotenv@${Ho}][WARN] ${e}`)}function en(e){console.log(`[dotenv@${Ho}][DEBUG] ${e}`)}function ll(e){console.log(`[dotenv@${Ho}] ${e}`)}function ul(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Lg(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let s=r.searchParams.get("environment");if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${s.toUpperCase()}`,i=e.parsed[o];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:n}}function pl(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)Go.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=us.resolve(process.cwd(),".env.vault");return Go.existsSync(t)?t:null}function cl(e){return e[0]==="~"?us.join(Pg.homedir(),e.slice(1)):e}function Wg(e){let t=tr(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),r=tr(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!r)&&ll("Loading env from encrypted .env.vault");let n=_._parseVault(e),s=process.env;return e&&e.processEnv!=null&&(s=e.processEnv),_.populate(s,n,e),{parsed:n}}function Gg(e){let t=us.resolve(process.cwd(),".env"),r="utf8",n=process.env;e&&e.processEnv!=null&&(n=e.processEnv);let s=tr(n.DOTENV_CONFIG_DEBUG||e&&e.debug),o=tr(n.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?r=e.encoding:s&&en("No encoding is specified. UTF-8 is used by default");let i=[t];if(e&&e.path)if(!Array.isArray(e.path))i=[cl(e.path)];else{i=[];for(let u of e.path)i.push(cl(u))}let a,c={};for(let u of i)try{let p=_.parse(Go.readFileSync(u,{encoding:r}));_.populate(c,p,e)}catch(p){s&&en(`Failed to load ${u} ${p.message}`),a=p}let l=_.populate(n,c,e);if(s=tr(n.DOTENV_CONFIG_DEBUG||s),o=tr(n.DOTENV_CONFIG_QUIET||o),s||!o){let u=Object.keys(l).length,p=[];for(let d of i)try{let f=us.relative(process.cwd(),d);p.push(f)}catch(f){s&&en(`Failed to load ${d} ${f.message}`),a=f}ll(`injecting env (${u}) from ${p.join(",")} ${Mg(`-- tip: ${Ng()}`)}`)}return a?{parsed:c,error:a}:{parsed:c}}function Hg(e){if(ul(e).length===0)return _.configDotenv(e);let t=pl(e);return t?_._configVault(e):(_g(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),_.configDotenv(e))}function Ug(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),s=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let i=Rg.createDecipheriv("aes-256-gcm",r,s);return i.setAuthTag(o),`${i.update(n)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",l=i.message==="Unsupported state or unable to authenticate data";if(a||c){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(l){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw i}}function zg(e,t,r={}){let n=!!(r&&r.debug),s=!!(r&&r.override),o={};if(typeof t!="object"){let i=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw i.code="OBJECT_REQUIRED",i}for(let i of Object.keys(t))Object.prototype.hasOwnProperty.call(e,i)?(s===!0&&(e[i]=t[i],o[i]=t[i]),n&&en(s===!0?`"${i}" is already defined and WAS overwritten`:`"${i}" is already defined and was NOT overwritten`)):(e[i]=t[i],o[i]=t[i]);return o}var _={configDotenv:Gg,_configVault:Wg,_parseVault:jg,config:Hg,decrypt:Ug,parse:Bg,populate:zg};Vt.exports.configDotenv=_.configDotenv;Vt.exports._configVault=_._configVault;Vt.exports._parseVault=_._parseVault;Vt.exports.config=_.config;Vt.exports.decrypt=_.decrypt;Vt.exports.parse=_.parse;Vt.exports.populate=_.populate;Vt.exports=_});var Ns=P((i0,Yu)=>{var Fi=[],Vu=0,Y=(e,t)=>{Vu>=t&&Fi.push(e)};Y.WARN=1;Y.INFO=2;Y.DEBUG=3;Y.reset=()=>{Fi=[]};Y.setDebugLevel=e=>{Vu=e};Y.warn=e=>Y(e,Y.WARN);Y.info=e=>Y(e,Y.INFO);Y.debug=e=>Y(e,Y.DEBUG);Y.debugMessages=()=>Fi;Yu.exports=Y});var Xu=P((a0,Zu)=>{"use strict";Zu.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var tp=P((c0,Qu)=>{"use strict";var Vy=Xu();Qu.exports=e=>typeof e=="string"?e.replace(Vy(),""):e});var rp=P((l0,Ti)=>{"use strict";var ep=e=>Number.isNaN(e)?!1:e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141);Ti.exports=ep;Ti.exports.default=ep});var sp=P((u0,np)=>{"use strict";np.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var ip=P((p0,Ai)=>{"use strict";var Yy=tp(),Zy=rp(),Xy=sp(),op=e=>{if(typeof e!="string"||e.length===0||(e=Yy(e),e.length===0))return 0;e=e.replace(Xy()," ");let t=0;for(let r=0;r<e.length;r++){let n=e.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,t+=Zy(n)?2:1)}return t};Ai.exports=op;Ai.exports.default=op});var Pi=P((f0,up)=>{var ap=ip();function Os(e){return e?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function _t(e){let t=Os();return(""+e).replace(t,"").split(`
5
+ `).reduce(function(s,o){return ap(o)>s?ap(o):s},0)}function Dn(e,t){return Array(t+1).join(e)}function Qy(e,t,r,n){let s=_t(e);if(t+1>=s){let o=t-s;switch(n){case"right":{e=Dn(r,o)+e;break}case"center":{let i=Math.ceil(o/2),a=o-i;e=Dn(r,a)+e+Dn(r,i);break}default:{e=e+Dn(r,o);break}}}return e}var dr={};function yn(e,t,r){t="\x1B["+t+"m",r="\x1B["+r+"m",dr[t]={set:e,to:!0},dr[r]={set:e,to:!1},dr[e]={on:t,off:r}}yn("bold",1,22);yn("italics",3,23);yn("underline",4,24);yn("inverse",7,27);yn("strikethrough",9,29);function cp(e,t){let r=t[1]?parseInt(t[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){e.lastForegroundAdded=t[0];return}if(r>=40&&r<=49||r>=100&&r<=107){e.lastBackgroundAdded=t[0];return}if(r===0){for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&delete e[s];return}let n=dr[t[0]];n&&(e[n.set]=n.to)}function tw(e){let t=Os(!0),r=t.exec(e),n={};for(;r!==null;)cp(n,r),r=t.exec(e);return n}function lp(e,t){let r=e.lastBackgroundAdded,n=e.lastForegroundAdded;return delete e.lastBackgroundAdded,delete e.lastForegroundAdded,Object.keys(e).forEach(function(s){e[s]&&(t+=dr[s].off)}),r&&r!="\x1B[49m"&&(t+="\x1B[49m"),n&&n!="\x1B[39m"&&(t+="\x1B[39m"),t}function ew(e,t){let r=e.lastBackgroundAdded,n=e.lastForegroundAdded;return delete e.lastBackgroundAdded,delete e.lastForegroundAdded,Object.keys(e).forEach(function(s){e[s]&&(t=dr[s].on+t)}),r&&r!="\x1B[49m"&&(t=r+t),n&&n!="\x1B[39m"&&(t=n+t),t}function rw(e,t){if(e.length===_t(e))return e.substr(0,t);for(;_t(e)>t;)e=e.slice(0,-1);return e}function nw(e,t){let r=Os(!0),n=e.split(Os()),s=0,o=0,i="",a,c={};for(;o<t;){a=r.exec(e);let l=n[s];if(s++,o+_t(l)>t&&(l=rw(l,t-o)),i+=l,o+=_t(l),o<t){if(!a)break;i+=a[0],cp(c,a)}}return lp(c,i)}function sw(e,t,r){if(r=r||"\u2026",_t(e)<=t)return e;t-=_t(r);let s=nw(e,t);s+=r;let o="\x1B]8;;\x07";return e.includes(o)&&!s.includes(o)&&(s+=o),s}function ow(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function iw(e,t){e=e||{},t=t||ow();let r=Object.assign({},t,e);return r.chars=Object.assign({},t.chars,e.chars),r.style=Object.assign({},t.style,e.style),r}function aw(e,t){let r=[],n=t.split(/(\s+)/g),s=[],o=0,i;for(let a=0;a<n.length;a+=2){let c=n[a],l=o+_t(c);o>0&&i&&(l+=i.length),l>e?(o!==0&&r.push(s.join("")),s=[c],o=_t(c)):(s.push(i||"",c),o=l),i=n[a+1]}return o&&r.push(s.join("")),r}function cw(e,t){let r=[],n="";function s(i,a){for(n.length&&a&&(n+=a),n+=i;n.length>e;)r.push(n.slice(0,e)),n=n.slice(e)}let o=t.split(/(\s+)/g);for(let i=0;i<o.length;i+=2)s(o[i],i&&o[i-1]);return n.length&&r.push(n),r}function lw(e,t,r=!0){let n=[];t=t.split(`
6
+ `);let s=r?aw:cw;for(let o=0;o<t.length;o++)n.push.apply(n,s(e,t[o]));return n}function uw(e){let t={},r=[];for(let n=0;n<e.length;n++){let s=ew(t,e[n]);t=tw(s);let o=Object.assign({},t);r.push(lp(o,s))}return r}function pw(e,t){return["\x1B]","8",";",";",e||t,"\x07",t,"\x1B]","8",";",";","\x07"].join("")}up.exports={strlen:_t,repeat:Dn,pad:Qy,truncate:sw,mergeOptions:iw,wordWrap:lw,colorizeLines:uw,hyperlink:pw}});var hp=P((d0,dp)=>{var fp={};dp.exports=fp;var pp={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(pp).forEach(function(e){var t=pp[e],r=fp[e]=[];r.open="\x1B["+t[0]+"m",r.close="\x1B["+t[1]+"m"})});var gp=P((h0,mp)=>{"use strict";mp.exports=function(e,t){t=t||process.argv;var r=t.indexOf("--"),n=/^-{1,2}/.test(e)?"":"--",s=t.indexOf(n+e);return s!==-1&&(r===-1?!0:s<r)}});var yp=P((m0,Dp)=>{"use strict";var fw=require("os"),Tt=gp(),nt=process.env,hr=void 0;Tt("no-color")||Tt("no-colors")||Tt("color=false")?hr=!1:(Tt("color")||Tt("colors")||Tt("color=true")||Tt("color=always"))&&(hr=!0);"FORCE_COLOR"in nt&&(hr=nt.FORCE_COLOR.length===0||parseInt(nt.FORCE_COLOR,10)!==0);function dw(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function hw(e){if(hr===!1)return 0;if(Tt("color=16m")||Tt("color=full")||Tt("color=truecolor"))return 3;if(Tt("color=256"))return 2;if(e&&!e.isTTY&&hr!==!0)return 0;var t=hr?1:0;if(process.platform==="win32"){var r=fw.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in nt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(s){return s in nt})||nt.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(nt.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in nt){var n=parseInt((nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(nt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(nt.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(nt.TERM)||"COLORTERM"in nt?1:(nt.TERM==="dumb",t)}function Ri(e){var t=hw(e);return dw(t)}Dp.exports={supportsColor:Ri,stdout:Ri(process.stdout),stderr:Ri(process.stderr)}});var Cp=P((g0,wp)=>{wp.exports=function(t,r){var n="";t=t||"Run the trap, drop the bass",t=t.split("");var s={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return t.forEach(function(o){o=o.toLowerCase();var i=s[o]||[" "],a=Math.floor(Math.random()*i.length);typeof s[o]<"u"?n+=s[o][a]:n+=o}),n}});var xp=P((D0,bp)=>{bp.exports=function(t,r){t=t||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},s=[].concat(n.up,n.down,n.mid);function o(c){var l=Math.floor(Math.random()*c);return l}function i(c){var l=!1;return s.filter(function(u){l=u===c}),l}function a(c,l){var u="",p,d;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",c=c.split("");for(d in c)if(!i(d)){switch(u=u+c[d],p={up:0,down:0,mid:0},l.size){case"mini":p.up=o(8),p.mid=o(2),p.down=o(8);break;case"maxi":p.up=o(16)+3,p.mid=o(4)+1,p.down=o(64)+3;break;default:p.up=o(8)+1,p.mid=o(6)/2,p.down=o(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var h=f[m],D=0;D<=p[h];D++)l[h]&&(u=u+n[h][o(n[h].length)])}return u}return a(t,r)}});var kp=P((y0,vp)=>{vp.exports=function(e){return function(t,r,n){if(t===" ")return t;switch(r%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}});var Sp=P((w0,Ep)=>{Ep.exports=function(e){return function(t,r,n){return r%2===0?t:e.inverse(t)}}});var Tp=P((C0,Fp)=>{Fp.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(r,n,s){return r===" "?r:e[t[n++%t.length]](r)}}});var Pp=P((b0,Ap)=>{Ap.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,s){return r===" "?r:e[t[Math.round(Math.random()*(t.length-2))]](r)}}});var $p=P((v0,Mp)=>{var v={};Mp.exports=v;v.themes={};var mw=require("util"),Fe=v.styles=hp(),Ip=Object.defineProperties,gw=new RegExp(/[\r\n]+/g);v.supportsColor=yp().supportsColor;typeof v.enabled>"u"&&(v.enabled=v.supportsColor()!==!1);v.enable=function(){v.enabled=!0};v.disable=function(){v.enabled=!1};v.stripColors=v.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")};var x0=v.stylize=function(t,r){if(!v.enabled)return t+"";var n=Fe[r];return!n&&r in v?v[r](t):n.open+t+n.close},Dw=/[|\\{}()[\]^$+*?.]/g,yw=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(Dw,"\\$&")};function Np(e){var t=function r(){return Cw.apply(r,arguments)};return t._styles=e,t.__proto__=ww,t}var Op=(function(){var e={};return Fe.grey=Fe.gray,Object.keys(Fe).forEach(function(t){Fe[t].closeRe=new RegExp(yw(Fe[t].close),"g"),e[t]={get:function(){return Np(this._styles.concat(t))}}}),e})(),ww=Ip(function(){},Op);function Cw(){var e=Array.prototype.slice.call(arguments),t=e.map(function(i){return i!=null&&i.constructor===String?i:mw.inspect(i)}).join(" ");if(!v.enabled||!t)return t;for(var r=t.indexOf(`
7
+ `)!=-1,n=this._styles,s=n.length;s--;){var o=Fe[n[s]];t=o.open+t.replace(o.closeRe,o.open)+o.close,r&&(t=t.replace(gw,function(i){return o.close+i+o.open}))}return t}v.setTheme=function(e){if(typeof e=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var t in e)(function(r){v[r]=function(n){if(typeof e[r]=="object"){var s=n;for(var o in e[r])s=v[e[r][o]](s);return s}return v[e[r]](n)}})(t)};function bw(){var e={};return Object.keys(Op).forEach(function(t){e[t]={get:function(){return Np([t])}}}),e}var xw=function(t,r){var n=r.split("");return n=n.map(t),n.join("")};v.trap=Cp();v.zalgo=xp();v.maps={};v.maps.america=kp()(v);v.maps.zebra=Sp()(v);v.maps.rainbow=Tp()(v);v.maps.random=Pp()(v);for(Rp in v.maps)(function(e){v[e]=function(t){return xw(v.maps[e],t)}})(Rp);var Rp;Ip(v,bw())});var jp=P((k0,Bp)=>{var vw=$p();Bp.exports=vw});var Gp=P((E0,Ms)=>{var{info:kw,debug:Wp}=Ns(),ut=Pi(),Ni=class e{constructor(t){this.setOptions(t),this.x=null,this.y=null}setOptions(t){["boolean","number","bigint","string"].indexOf(typeof t)!==-1&&(t={content:""+t}),t=t||{},this.options=t;let r=t.content;if(["boolean","number","bigint","string"].indexOf(typeof r)!==-1)this.content=String(r);else if(!r)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof r);this.colSpan=t.colSpan||1,this.rowSpan=t.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(t,r){this.cells=r;let n=this.options.chars||{},s=t.chars,o=this.chars={};Sw.forEach(function(c){Ii(n,s,c,o)}),this.truncate=this.options.truncate||t.truncate;let i=this.options.style=this.options.style||{},a=t.style;Ii(i,a,"padding-left",this),Ii(i,a,"padding-right",this),this.head=i.head||a.head,this.border=i.border||a.border,this.fixedWidth=t.colWidths[this.x],this.lines=this.computeLines(t),this.desiredWidth=ut.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(t){let r=t.wordWrap||t.textWrap,{wordWrap:n=r}=this.options;if(this.fixedWidth&&n){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let i=1;for(;i<this.colSpan;)this.fixedWidth+=t.colWidths[this.x+i],i++}let{wrapOnWordBoundary:s=!0}=t,{wrapOnWordBoundary:o=s}=this.options;return this.wrapLines(ut.wordWrap(this.fixedWidth,this.content,o))}return this.wrapLines(this.content.split(`
8
+ `))}wrapLines(t){let r=ut.colorizeLines(t);return this.href?r.map(n=>ut.hyperlink(this.href,n)):r}init(t){let r=this.x,n=this.y;this.widths=t.colWidths.slice(r,r+this.colSpan),this.heights=t.rowHeights.slice(n,n+this.rowSpan),this.width=this.widths.reduce(Lp,-1),this.height=this.heights.reduce(Lp,-1),this.hAlign=this.options.hAlign||t.colAligns[r],this.vAlign=this.options.vAlign||t.rowAligns[n],this.drawRight=r+this.colSpan==t.colWidths.length}draw(t,r){if(t=="top")return this.drawTop(this.drawRight);if(t=="bottom")return this.drawBottom(this.drawRight);let n=ut.truncate(this.content,10,this.truncate);t||kw(`${this.y}-${this.x}: ${this.rowSpan-t}x${this.colSpan} Cell ${n}`);let s=Math.max(this.height-this.lines.length,0),o;switch(this.vAlign){case"center":o=Math.ceil(s/2);break;case"bottom":o=s;break;default:o=0}if(t<o||t>=o+this.lines.length)return this.drawEmpty(this.drawRight,r);let i=this.lines.length>this.height&&t+1>=this.height;return this.drawLine(t-o,this.drawRight,i,r)}drawTop(t){let r=[];return this.cells?this.widths.forEach(function(n,s){r.push(this._topLeftChar(s)),r.push(ut.repeat(this.chars[this.y==0?"top":"mid"],n))},this):(r.push(this._topLeftChar(0)),r.push(ut.repeat(this.chars[this.y==0?"top":"mid"],this.width))),t&&r.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",r.join(""))}_topLeftChar(t){let r=this.x+t,n;if(this.y==0)n=r==0?"topLeft":t==0?"topMid":"top";else if(r==0)n="leftMid";else if(n=t==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][r]instanceof e.ColSpanCell&&(n=t==0?"topMid":"mid"),t==0)){let o=1;for(;this.cells[this.y][r-o]instanceof e.ColSpanCell;)o++;this.cells[this.y][r-o]instanceof e.RowSpanCell&&(n="leftMid")}return this.chars[n]}wrapWithStyleColors(t,r){if(this[t]&&this[t].length)try{let n=jp();for(let s=this[t].length-1;s>=0;s--)n=n[this[t][s]];return n(r)}catch{return r}else return r}drawLine(t,r,n,s){let o=this.chars[this.x==0?"left":"middle"];if(this.x&&s&&this.cells){let d=this.cells[this.y+s][this.x-1];for(;d instanceof wn;)d=this.cells[d.y][d.x-1];d instanceof Cn||(o=this.chars.rightMid)}let i=ut.repeat(" ",this.paddingLeft),a=r?this.chars.right:"",c=ut.repeat(" ",this.paddingRight),l=this.lines[t],u=this.width-(this.paddingLeft+this.paddingRight);n&&(l+=this.truncate||"\u2026");let p=ut.truncate(l,u,this.truncate);return p=ut.pad(p,u," ",this.hAlign),p=i+p+c,this.stylizeLine(o,p,a)}stylizeLine(t,r,n){return t=this.wrapWithStyleColors("border",t),n=this.wrapWithStyleColors("border",n),this.y===0&&(r=this.wrapWithStyleColors("head",r)),t+r+n}drawBottom(t){let r=this.chars[this.x==0?"bottomLeft":"bottomMid"],n=ut.repeat(this.chars.bottom,this.width),s=t?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",r+n+s)}drawEmpty(t,r){let n=this.chars[this.x==0?"left":"middle"];if(this.x&&r&&this.cells){let i=this.cells[this.y+r][this.x-1];for(;i instanceof wn;)i=this.cells[i.y][i.x-1];i instanceof Cn||(n=this.chars.rightMid)}let s=t?this.chars.right:"",o=ut.repeat(" ",this.width);return this.stylizeLine(n,o,s)}},wn=class{constructor(){}draw(t){return typeof t=="number"&&Wp(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},Cn=class{constructor(t){this.originalCell=t}init(t){let r=this.y,n=this.originalCell.y;this.cellOffset=r-n,this.offset=Ew(t.rowHeights,n,this.cellOffset)}draw(t){return t=="top"?this.originalCell.draw(this.offset,this.cellOffset):t=="bottom"?this.originalCell.draw("bottom"):(Wp(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+t))}mergeTableOptions(){}};function _p(...e){return e.filter(t=>t!=null).shift()}function Ii(e,t,r,n){let s=r.split("-");s.length>1?(s[1]=s[1].charAt(0).toUpperCase()+s[1].substr(1),s=s.join(""),n[s]=_p(e[s],e[r],t[s],t[r])):n[r]=_p(e[r],t[r])}function Ew(e,t,r){let n=e[t];for(let s=1;s<r;s++)n+=1+e[t+s];return n}function Lp(e,t){return e+t+1}var Sw=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];Ms.exports=Ni;Ms.exports.ColSpanCell=wn;Ms.exports.RowSpanCell=Cn});var zp=P((S0,Up)=>{var{warn:Fw,debug:Tw}=Ns(),Oi=Gp(),{ColSpanCell:Aw,RowSpanCell:Pw}=Oi;(function(){function e(f,m){return f[m]>0?e(f,m+1):m}function t(f){let m={};f.forEach(function(h,D){let g=0;h.forEach(function(y){y.y=D,y.x=D?e(m,g):g;let x=y.rowSpan||1,C=y.colSpan||1;if(x>1)for(let A=0;A<C;A++)m[y.x+A]=x;g=y.x+C}),Object.keys(m).forEach(y=>{m[y]--,m[y]<1&&delete m[y]})})}function r(f){let m=0;return f.forEach(function(h){h.forEach(function(D){m=Math.max(m,D.x+(D.colSpan||1))})}),m}function n(f){return f.length}function s(f,m){let h=f.y,D=f.y-1+(f.rowSpan||1),g=m.y,y=m.y-1+(m.rowSpan||1),x=!(h>y||g>D),C=f.x,A=f.x-1+(f.colSpan||1),dt=m.x,ne=m.x-1+(m.colSpan||1),Ae=!(C>ne||dt>A);return x&&Ae}function o(f,m,h){let D=Math.min(f.length-1,h),g={x:m,y:h};for(let y=0;y<=D;y++){let x=f[y];for(let C=0;C<x.length;C++)if(s(g,x[C]))return!0}return!1}function i(f,m,h,D){for(let g=h;g<D;g++)if(o(f,g,m))return!1;return!0}function a(f){f.forEach(function(m,h){m.forEach(function(D){for(let g=1;g<D.rowSpan;g++){let y=new Pw(D);y.x=D.x,y.y=D.y+g,y.colSpan=D.colSpan,l(y,f[h+g])}})})}function c(f){for(let m=f.length-1;m>=0;m--){let h=f[m];for(let D=0;D<h.length;D++){let g=h[D];for(let y=1;y<g.colSpan;y++){let x=new Aw;x.x=g.x+y,x.y=g.y,h.splice(D+1,0,x)}}}}function l(f,m){let h=0;for(;h<m.length&&m[h].x<f.x;)h++;m.splice(h,0,f)}function u(f){let m=n(f),h=r(f);Tw(`Max rows: ${m}; Max cols: ${h}`);for(let D=0;D<m;D++)for(let g=0;g<h;g++)if(!o(f,g,D)){let y={x:g,y:D,colSpan:1,rowSpan:1};for(g++;g<h&&!o(f,g,D);)y.colSpan++,g++;let x=D+1;for(;x<m&&i(f,x,y.x,y.x+y.colSpan);)y.rowSpan++,x++;let C=new Oi(y);C.x=y.x,C.y=y.y,Fw(`Missing cell at ${C.y}-${C.x}.`),l(C,f[D])}}function p(f){return f.map(function(m){if(!Array.isArray(m)){let h=Object.keys(m)[0];m=m[h],Array.isArray(m)?(m=m.slice(),m.unshift(h)):m=[h,m]}return m.map(function(h){return new Oi(h)})})}function d(f){let m=p(f);return t(m),u(m),a(m),c(m),m}Up.exports={makeTableLayout:d,layoutTable:t,addRowSpanCells:a,maxWidth:r,fillInTable:u,computeWidths:Hp("colSpan","desiredWidth","x",1),computeHeights:Hp("rowSpan","desiredHeight","y",1)}})();function Hp(e,t,r,n){return function(s,o){let i=[],a=[],c={};o.forEach(function(l){l.forEach(function(u){(u[e]||1)>1?a.push(u):i[u[r]]=Math.max(i[u[r]]||0,u[t]||0,n)})}),s.forEach(function(l,u){typeof l=="number"&&(i[u]=l)});for(let l=a.length-1;l>=0;l--){let u=a[l],p=u[e],d=u[r],f=i[d],m=typeof s[d]=="number"?0:1;if(typeof f=="number")for(let h=1;h<p;h++)f+=1+i[d+h],typeof s[d+h]!="number"&&m++;else f=t==="desiredWidth"?u.desiredWidth-1:1,(!c[d]||c[d]<f)&&(c[d]=f);if(u[t]>f){let h=0;for(;m>0&&u[t]>f;){if(typeof s[d+h]!="number"){let D=Math.round((u[t]-f)/m);f+=D,i[d+h]+=D,m--}h++}}}Object.assign(s,i,c);for(let l=0;l<s.length;l++)s[l]=Math.max(n,s[l]||0)}}});var Jp=P((F0,Kp)=>{var Qt=Ns(),Rw=Pi(),Mi=zp(),$s=class extends Array{constructor(t){super();let r=Rw.mergeOptions(t);if(Object.defineProperty(this,"options",{value:r,enumerable:r.debug}),r.debug){switch(typeof r.debug){case"boolean":Qt.setDebugLevel(Qt.WARN);break;case"number":Qt.setDebugLevel(r.debug);break;case"string":Qt.setDebugLevel(parseInt(r.debug,10));break;default:Qt.setDebugLevel(Qt.WARN),Qt.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof r.debug}`)}Object.defineProperty(this,"messages",{get(){return Qt.debugMessages()}})}}toString(){let t=this,r=this.options.head&&this.options.head.length;r?(t=[this.options.head],this.length&&t.push.apply(t,this)):this.options.style.head=[];let n=Mi.makeTableLayout(t);n.forEach(function(o){o.forEach(function(i){i.mergeTableOptions(this.options,n)},this)},this),Mi.computeWidths(this.options.colWidths,n),Mi.computeHeights(this.options.rowHeights,n),n.forEach(function(o){o.forEach(function(i){i.init(this.options)},this)},this);let s=[];for(let o=0;o<n.length;o++){let i=n[o],a=this.options.rowHeights[o];(o===0||!this.options.style.compact||o==1&&r)&&$i(i,"top",s);for(let c=0;c<a;c++)$i(i,c,s);o+1==n.length&&$i(i,"bottom",s)}return s.join(`
9
9
  `)}get width(){return this.toString().split(`
10
- `)[0].length}};Ns.reset=()=>Qt.reset();function Ni(e,t,r){let n=[];e.forEach(function(o){n.push(o.draw(t))});let s=n.join("");s.length&&r.push(s)}Hp.exports=Ns});var Oi=P((x0,zp)=>{zp.exports=Up()});var wd=require("node:process"),Te=b(require("chalk")),Cd=require("commander");var Sn={};Ad(Sn,{ConEmu:()=>fa,beep:()=>sh,clearScreen:()=>Xd,clearTerminal:()=>eh,clearViewport:()=>Qd,cursorBackward:()=>Bd,cursorDown:()=>Md,cursorForward:()=>$d,cursorGetPosition:()=>Ld,cursorHide:()=>Hd,cursorLeft:()=>la,cursorMove:()=>Od,cursorNextLine:()=>Wd,cursorPrevLine:()=>Gd,cursorRestorePosition:()=>_d,cursorSavePosition:()=>jd,cursorShow:()=>Ud,cursorTo:()=>Nd,cursorUp:()=>ca,enterAlternativeScreen:()=>rh,eraseDown:()=>qd,eraseEndLine:()=>Kd,eraseLine:()=>ua,eraseLines:()=>zd,eraseScreen:()=>En,eraseStartLine:()=>Jd,eraseUp:()=>Vd,exitAlternativeScreen:()=>nh,iTerm:()=>pa,image:()=>ih,link:()=>oh,scrollDown:()=>Zd,scrollUp:()=>Yd,setCwd:()=>ah});var De=b(require("node:process"),1),ia=b(require("node:os"),1);var Ie=globalThis.window?.document!==void 0,ab=globalThis.process?.versions?.node!==void 0,cb=globalThis.process?.versions?.bun!==void 0,lb=globalThis.Deno?.version?.deno!==void 0,ub=globalThis.process?.versions?.electron!==void 0,pb=globalThis.navigator?.userAgent?.includes("jsdom")===!0,fb=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,db=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,hb=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,mb=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Ar=globalThis.navigator?.userAgentData?.platform,gb=Ar==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Db=Ar==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",yb=Ar==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",wb=Ar==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Cb=Ar==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var E="\x1B[",Ne="\x1B]",ye="\x07",Pr=";",aa=!Ie&&De.default.env.TERM_PROGRAM==="Apple_Terminal",Rd=!Ie&&De.default.platform==="win32",Id=!Ie&&(De.default.env.TERM?.startsWith("screen")||De.default.env.TERM?.startsWith("tmux")||De.default.env.TMUX!==void 0),Xs=Ie?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:De.default.cwd,Oe=e=>Id?"\x1BPtmux;"+e.replaceAll("\x1B","\x1B\x1B")+"\x1B\\":e,Nd=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof t!="number"?E+(e+1)+"G":E+(t+1)+Pr+(e+1)+"H"},Od=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let r="";return e<0?r+=E+-e+"D":e>0&&(r+=E+e+"C"),t<0?r+=E+-t+"A":t>0&&(r+=E+t+"B"),r},ca=(e=1)=>E+e+"A",Md=(e=1)=>E+e+"B",$d=(e=1)=>E+e+"C",Bd=(e=1)=>E+e+"D",la=E+"G",jd=aa?"\x1B7":E+"s",_d=aa?"\x1B8":E+"u",Ld=E+"6n",Wd=E+"E",Gd=E+"F",Hd=E+"?25l",Ud=E+"?25h",zd=e=>{let t="";for(let r=0;r<e;r++)t+=ua+(r<e-1?ca():"");return e&&(t+=la),t},Kd=E+"K",Jd=E+"1K",ua=E+"2K",qd=E+"J",Vd=E+"1J",En=E+"2J",Yd=E+"S",Zd=E+"T",Xd="\x1Bc",Qd=`${En}${E}H`,th=()=>{if(Ie||!Rd)return!1;let e=ia.default.release().split("."),t=Number(e[0]),r=Number(e[2]??0);return t<10||t===10&&r<10586},eh=th()?`${En}${E}0f`:`${En}${E}3J${E}H`,rh=E+"?1049h",nh=E+"?1049l",sh=ye,oh=(e,t)=>{let r=Oe(`${Ne}8${Pr}${Pr}${t}${ye}`),n=Oe(`${Ne}8${Pr}${Pr}${ye}`);return r+e+n},ih=(e,t={})=>{let r=`${Ne}1337;File=inline=1`;t.width&&(r+=`;width=${t.width}`),t.height&&(r+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0");let n=Buffer.from(e);return Oe(r+`;size=${n.byteLength}:`+n.toString("base64")+ye)},pa={setCwd:(e=Xs())=>Oe(`${Ne}50;CurrentDir=${e}${ye}`),annotation(e,t={}){let r=`${Ne}1337;`,n=t.x!==void 0,s=t.y!==void 0;if((n||s)&&!(n&&s&&t.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replaceAll("|",""),r+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0?r+=(n?[e,t.length,t.x,t.y]:[t.length,e]).join("|"):r+=e,Oe(r+ye)}},fa={setCwd:(e=Xs())=>Oe(`${Ne}9;9;${e}${ye}`)},ah=(e=Xs())=>pa.setCwd(e)+fa.setCwd(e);var Fn=b(wa(),1);function zt(e,t,{target:r="stdout",...n}={}){return Fn.default[r]?Sn.link(e,t):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,t):`${e} (\u200B${t}\u200B)`}zt.isSupported=Fn.default.stdout;zt.stderr=(e,t,r={})=>zt(e,t,{target:"stderr",...r});zt.stderr.isSupported=Fn.default.stderr;var Fl=b(require("chalk")),Tl=require("commander");var vt=require("node:fs"),ot=require("node:path"),ve=require("fs-extra");var Ca=["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml"],no="start:dev";var Rr=b(require("chalk"));function so(e,t){if(e.length===0)return"No entries to display.";let r=t?.title||"Benchmark Results",n=t?.footer||"",s=t?.maxBarWidth||50,o=t?.unit||"",i=Math.max(...e.map(c=>c.value)),a=[];a.push(""),a.push(r),a.push("");for(let c of e){let l=ph(c.barColor??t?.barColor),u=fh(c,i,s,l,o,t?.labelColor);a.push(u)}return n&&(a.push(""),a.push(n)),a.join(`
11
- `)}function ph(e){return e?Rr.default[e]("\u2587"):"\u2587"}function fh(e,t,r,n,s,o){let i=Math.round(e.value/t*r),a=e.barColor?Rr.default[e.barColor](n.repeat(i)):n.repeat(i),c=e.color??o;return`${Rr.default.bold(c?Rr.default[c](e.label.padEnd(12)):e.label.padEnd(12))} ${a} ${e.value.toLocaleString()}${s?` ${s}`:""}`}var oo=b(require("chalk")),xa=require("commander"),io=require("listr2");var Ir=b(require("chalk")),w={logs:[],breakLine:()=>(console.log(),w),success:(e,...t)=>(console.log(Ir.default.green(`\u2714 ${e}`),...t),w),info:(e,...t)=>(console.log(Ir.default.cyan(`\u{1F6C8} ${e}`),...t),w),warn:(e,...t)=>(console.warn(Ir.default.yellow(`\u26A0\uFE0E ${e}`),...t),w),error:(e,...t)=>(console.error(Ir.default.red(`\u2716 ${e}`),...t),w),log:(e,...t)=>(console.log(e,...t),w.logs.push({message:e,context:t.join()}),w),getStoredLogs:e=>e?w.logs.filter(t=>t.context?.includes(e)):w.logs,storeLog:(e,t)=>w.logs.push({message:e,context:t})};function oe(e){let t=new xa.Command(e.name).description(e.description).showHelpAfterError();return e.arguments?.map(([r,n])=>t.argument(r,n)),e.options?.map(([r,n])=>t.option(r,n)),e.exampleUsage&&t.addHelpText("after",()=>`${oo.default.cyan.bold(`
10
+ `)[0].length}};$s.reset=()=>Qt.reset();function $i(e,t,r){let n=[];e.forEach(function(o){n.push(o.draw(t))});let s=n.join("");s.length&&r.push(s)}Kp.exports=$s});var Bi=P((T0,qp)=>{qp.exports=Jp()});var vd=require("node:process"),Te=b(require("chalk")),kd=require("commander");var Tn={};Nd(Tn,{ConEmu:()=>ha,beep:()=>ch,clearScreen:()=>rh,clearTerminal:()=>oh,clearViewport:()=>nh,cursorBackward:()=>Wd,cursorDown:()=>_d,cursorForward:()=>Ld,cursorGetPosition:()=>Ud,cursorHide:()=>Jd,cursorLeft:()=>pa,cursorMove:()=>jd,cursorNextLine:()=>zd,cursorPrevLine:()=>Kd,cursorRestorePosition:()=>Hd,cursorSavePosition:()=>Gd,cursorShow:()=>qd,cursorTo:()=>Bd,cursorUp:()=>ua,enterAlternativeScreen:()=>ih,eraseDown:()=>Xd,eraseEndLine:()=>Yd,eraseLine:()=>fa,eraseLines:()=>Vd,eraseScreen:()=>Fn,eraseStartLine:()=>Zd,eraseUp:()=>Qd,exitAlternativeScreen:()=>ah,iTerm:()=>da,image:()=>uh,link:()=>lh,scrollDown:()=>eh,scrollUp:()=>th,setCwd:()=>ph});var De=b(require("node:process"),1),ca=b(require("node:os"),1);var Ie=globalThis.window?.document!==void 0,pb=globalThis.process?.versions?.node!==void 0,fb=globalThis.process?.versions?.bun!==void 0,db=globalThis.Deno?.version?.deno!==void 0,hb=globalThis.process?.versions?.electron!==void 0,mb=globalThis.navigator?.userAgent?.includes("jsdom")===!0,gb=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Db=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,yb=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,wb=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Ar=globalThis.navigator?.userAgentData?.platform,Cb=Ar==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",bb=Ar==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",xb=Ar==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",vb=Ar==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),kb=Ar==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var E="\x1B[",Ne="\x1B]",ye="\x07",Pr=";",la=!Ie&&De.default.env.TERM_PROGRAM==="Apple_Terminal",Md=!Ie&&De.default.platform==="win32",$d=!Ie&&(De.default.env.TERM?.startsWith("screen")||De.default.env.TERM?.startsWith("tmux")||De.default.env.TMUX!==void 0),to=Ie?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:De.default.cwd,Oe=e=>$d?"\x1BPtmux;"+e.replaceAll("\x1B","\x1B\x1B")+"\x1B\\":e,Bd=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof t!="number"?E+(e+1)+"G":E+(t+1)+Pr+(e+1)+"H"},jd=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let r="";return e<0?r+=E+-e+"D":e>0&&(r+=E+e+"C"),t<0?r+=E+-t+"A":t>0&&(r+=E+t+"B"),r},ua=(e=1)=>E+e+"A",_d=(e=1)=>E+e+"B",Ld=(e=1)=>E+e+"C",Wd=(e=1)=>E+e+"D",pa=E+"G",Gd=la?"\x1B7":E+"s",Hd=la?"\x1B8":E+"u",Ud=E+"6n",zd=E+"E",Kd=E+"F",Jd=E+"?25l",qd=E+"?25h",Vd=e=>{let t="";for(let r=0;r<e;r++)t+=fa+(r<e-1?ua():"");return e&&(t+=pa),t},Yd=E+"K",Zd=E+"1K",fa=E+"2K",Xd=E+"J",Qd=E+"1J",Fn=E+"2J",th=E+"S",eh=E+"T",rh="\x1Bc",nh=`${Fn}${E}H`,sh=()=>{if(Ie||!Md)return!1;let e=ca.default.release().split("."),t=Number(e[0]),r=Number(e[2]??0);return t<10||t===10&&r<10586},oh=sh()?`${Fn}${E}0f`:`${Fn}${E}3J${E}H`,ih=E+"?1049h",ah=E+"?1049l",ch=ye,lh=(e,t)=>{let r=Oe(`${Ne}8${Pr}${Pr}${t}${ye}`),n=Oe(`${Ne}8${Pr}${Pr}${ye}`);return r+e+n},uh=(e,t={})=>{let r=`${Ne}1337;File=inline=1`;t.width&&(r+=`;width=${t.width}`),t.height&&(r+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0");let n=Buffer.from(e);return Oe(r+`;size=${n.byteLength}:`+n.toString("base64")+ye)},da={setCwd:(e=to())=>Oe(`${Ne}50;CurrentDir=${e}${ye}`),annotation(e,t={}){let r=`${Ne}1337;`,n=t.x!==void 0,s=t.y!==void 0;if((n||s)&&!(n&&s&&t.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replaceAll("|",""),r+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0?r+=(n?[e,t.length,t.x,t.y]:[t.length,e]).join("|"):r+=e,Oe(r+ye)}},ha={setCwd:(e=to())=>Oe(`${Ne}9;9;${e}${ye}`)},ph=(e=to())=>da.setCwd(e)+ha.setCwd(e);var An=b(ba(),1);function zt(e,t,{target:r="stdout",...n}={}){return An.default[r]?Tn.link(e,t):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,t):`${e} (\u200B${t}\u200B)`}zt.isSupported=An.default.stdout;zt.stderr=(e,t,r={})=>zt(e,t,{target:"stderr",...r});zt.stderr.isSupported=An.default.stderr;var Al=b(require("chalk")),Pl=require("commander");var vt=require("node:fs"),ot=require("node:path"),ve=require("fs-extra");var xa=["bun.lock","bun.lockb","package-lock.json","yarn.lock","pnpm-lock.yaml"],oo="start:dev";var Rr=b(require("chalk"));function io(e,t){if(e.length===0)return"No entries to display.";let r=t?.title||"Benchmark Results",n=t?.footer||"",s=t?.maxBarWidth||50,o=t?.unit||"",i=Math.max(...e.map(c=>c.value)),a=[];a.push(""),a.push(r),a.push("");for(let c of e){let l=mh(c.barColor??t?.barColor),u=gh(c,i,s,l,o,t?.labelColor);a.push(u)}return n&&(a.push(""),a.push(n)),a.join(`
11
+ `)}function mh(e){return e?Rr.default[e]("\u2587"):"\u2587"}function gh(e,t,r,n,s,o){let i=Math.round(e.value/t*r),a=e.barColor?Rr.default[e.barColor](n.repeat(i)):n.repeat(i),c=e.color??o;return`${Rr.default.bold(c?Rr.default[c](e.label.padEnd(12)):e.label.padEnd(12))} ${a} ${e.value.toLocaleString()}${s?` ${s}`:""}`}var ao=b(require("chalk")),ka=require("commander"),co=require("listr2");var Ir=b(require("chalk")),w={logs:[],breakLine:()=>(console.log(),w),success:(e,...t)=>(console.log(Ir.default.green(`\u2714 ${e}`),...t),w),info:(e,...t)=>(console.log(Ir.default.cyan(`\u{1F6C8} ${e}`),...t),w),warn:(e,...t)=>(console.warn(Ir.default.yellow(`\u26A0\uFE0E ${e}`),...t),w),error:(e,...t)=>(console.error(Ir.default.red(`\u2716 ${e}`),...t),w),log:(e,...t)=>(console.log(e,...t),w.logs.push({message:e,context:t.join()}),w),getStoredLogs:e=>e?w.logs.filter(t=>t.context?.includes(e)):w.logs,storeLog:(e,t)=>w.logs.push({message:e,context:t})};function oe(e){let t=new ka.Command(e.name).description(e.description).showHelpAfterError();return e.arguments?.map(([r,n])=>t.argument(r,n)),e.options?.map(([r,n])=>t.option(r,n)),e.exampleUsage&&t.addHelpText("after",()=>`${ao.default.cyan.bold(`
12
12
  Example:`)}
13
- ${oo.default.bold(e.exampleUsage)}
14
- `),e.additionalInfo&&t.addHelpText("after",()=>(typeof e.additionalInfo=="function"?e.additionalInfo():e.additionalInfo)??""),t.action(async(...r)=>{try{let n=r.at(-1),s=n.args,o=n.opts(),i=dh(e.arguments??[],s);if(e.shouldSkipWorkflow?.(i,o)){await e.onSkipWorkflow?.(i,o);return}let a=await e.buildContext(i,o);e.prompts?.length&&await new io.Listr(ba(e.prompts,a),{rendererOptions:{lazy:!0,showErrorMessage:!1}}).run(a),await new io.Listr(ba(e.actions,a),{rendererOptions:{lazy:!1,showErrorMessage:!1,clearOutput:!0}}).run(a),await e.onComplete?.(a)}catch(n){let s=n;w.error(s.message)}}),t}function dh(e,t){let r={};return e.forEach(([n],s)=>{let o=n.replace(/[<>[\]]/g,"");r[o]=t[s]}),r}function ba(e,t){return e.map(r=>typeof r=="function"?r(t):r)}function Tn(e,t,r){let n=t.split("."),s=e;for(;n.length>1;){let o=n.shift();o in s||(s[o]={}),s=s[o]}s[n[0]]=r}var va=require("execa");function Nr(e){try{return(0,va.execaSync)(e,["--version"]),!0}catch{return!1}}var Xe=require("node:path"),Qc=require("fs-extra");var Aa=b(require("node:process"),1);var Ea=b(require("node:process"),1);var Sa=require("node:url"),Fa=b(require("node:fs"),1),we=b(require("node:path"),1),ka=e=>e instanceof URL?(0,Sa.fileURLToPath)(e):e;function Ta(e,{cwd:t=Ea.default.cwd(),type:r="file",stopAt:n}={}){let s=we.default.resolve(ka(t)??""),{root:o}=we.default.parse(s);n=we.default.resolve(s,ka(n)??o);let i=we.default.isAbsolute(e);for(;s;){let a=i?e:we.default.join(s,e);try{let c=Fa.default.statSync(a,{throwIfNoEntry:!1});if(r==="file"&&c?.isFile()||r==="directory"&&c?.isDirectory())return a}catch{}if(s===n||s===o)break;s=we.default.dirname(s)}}function Pa({cwd:e=Aa.default.cwd()}={}){return Ta("package.json",{cwd:e})}var ao=(e,t,r)=>{let n=e instanceof RegExp?Ra(e,r):e,s=t instanceof RegExp?Ra(t,r):t,o=n!==null&&s!=null&&hh(n,s,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+s.length)}},Ra=(e,t)=>{let r=t.match(e);return r?r[0]:null},hh=(e,t,r)=>{let n,s,o,i,a,c=r.indexOf(e),l=r.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(n=[],o=r.length;u>=0&&!a;){if(u===c)n.push(u),c=r.indexOf(e,u+1);else if(n.length===1){let p=n.pop();p!==void 0&&(a=[p,l])}else s=n.pop(),s!==void 0&&s<o&&(o=s,i=l),l=r.indexOf(t,u+1);u=c<l&&c>=0?c:l}n.length&&i!==void 0&&(a=[o,i])}return a};var Ia="\0SLASH"+Math.random()+"\0",Na="\0OPEN"+Math.random()+"\0",lo="\0CLOSE"+Math.random()+"\0",Oa="\0COMMA"+Math.random()+"\0",Ma="\0PERIOD"+Math.random()+"\0",mh=new RegExp(Ia,"g"),gh=new RegExp(Na,"g"),Dh=new RegExp(lo,"g"),yh=new RegExp(Oa,"g"),wh=new RegExp(Ma,"g"),Ch=/\\\\/g,bh=/\\{/g,xh=/\\}/g,vh=/\\,/g,kh=/\\./g;function co(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Eh(e){return e.replace(Ch,Ia).replace(bh,Na).replace(xh,lo).replace(vh,Oa).replace(kh,Ma)}function Sh(e){return e.replace(mh,"\\").replace(gh,"{").replace(Dh,"}").replace(yh,",").replace(wh,".")}function $a(e){if(!e)return[""];let t=[],r=ao("{","}",e);if(!r)return e.split(",");let{pre:n,body:s,post:o}=r,i=n.split(",");i[i.length-1]+="{"+s+"}";let a=$a(o);return o.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),t.push.apply(t,i),t}function Ba(e){return e?(e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Or(Eh(e),!0).map(Sh)):[]}function Fh(e){return"{"+e+"}"}function Th(e){return/^-?0\d/.test(e)}function Ah(e,t){return e<=t}function Ph(e,t){return e>=t}function Or(e,t){let r=[],n=ao("{","}",e);if(!n)return[e];let s=n.pre,o=n.post.length?Or(n.post,!1):[""];if(/\$$/.test(n.pre))for(let i=0;i<o.length;i++){let a=s+"{"+n.body+"}"+o[i];r.push(a)}else{let i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=i||a,l=n.body.indexOf(",")>=0;if(!c&&!l)return n.post.match(/,(?!,).*\}/)?(e=n.pre+"{"+n.body+lo+n.post,Or(e)):[e];let u;if(c)u=n.body.split(/\.\./);else if(u=$a(n.body),u.length===1&&u[0]!==void 0&&(u=Or(u[0],!1).map(Fh),u.length===1))return o.map(d=>n.pre+u[0]+d);let p;if(c&&u[0]!==void 0&&u[1]!==void 0){let d=co(u[0]),f=co(u[1]),m=Math.max(u[0].length,u[1].length),h=u.length===3&&u[2]!==void 0?Math.abs(co(u[2])):1,D=Ah;f<d&&(h*=-1,D=Ph);let y=u.some(Th);p=[];for(let x=d;D(x,f);x+=h){let C;if(a)C=String.fromCharCode(x),C==="\\"&&(C="");else if(C=String(x),y){let A=m-C.length;if(A>0){let dt=new Array(A+1).join("0");x<0?C="-"+dt+C.slice(1):C=dt+C}}p.push(C)}}else{p=[];for(let d=0;d<u.length;d++)p.push.apply(p,Or(u[d],!1))}for(let d=0;d<p.length;d++)for(let f=0;f<o.length;f++){let m=s+p[d]+o[f];(!t||c||m)&&r.push(m)}}return r}var Mr=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var Rh={"[: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]},$r=e=>e.replace(/[[\]\\-]/g,"\\$&"),Ih=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ja=e=>e.join(""),_a=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],s=[],o=r+1,i=!1,a=!1,c=!1,l=!1,u=r,p="";t:for(;o<e.length;){let h=e.charAt(o);if((h==="!"||h==="^")&&o===r+1){l=!0,o++;continue}if(h==="]"&&i&&!c){u=o+1;break}if(i=!0,h==="\\"&&!c){c=!0,o++;continue}if(h==="["&&!c){for(let[D,[g,y,x]]of Object.entries(Rh))if(e.startsWith(D,o)){if(p)return["$.",!1,e.length-r,!0];o+=D.length,x?s.push(g):n.push(g),a=a||y;continue t}}if(c=!1,p){h>p?n.push($r(p)+"-"+$r(h)):h===p&&n.push($r(h)),p="",o++;continue}if(e.startsWith("-]",o+1)){n.push($r(h+"-")),o+=2;continue}if(e.startsWith("-",o+1)){p=h,o+=2;continue}n.push($r(h)),o++}if(u<o)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,e.length-r,!0];if(s.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let h=n[0].length===2?n[0].slice(-1):n[0];return[Ih(h),!1,u-r,!1]}let d="["+(l?"^":"")+ja(n)+"]",f="["+(l?"":"^")+ja(s)+"]";return[n.length&&s.length?"("+d+"|"+f+")":n.length?d:f,a,u-r,!0]};var wt=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?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 Nh=new Set(["!","?","+","*","@"]),La=e=>Nh.has(e),Oh="(?!(?:^|/)\\.\\.?(?:$|/))",An="(?!\\.)",Mh=new Set(["[","."]),$h=new Set(["..","."]),Bh=new Set("().*{}+?[]^$\\!"),jh=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),uo="[^/]",Wa=uo+"*?",Ga=uo+"+?",$e=class e{type;#t;#r;#o=!1;#s=[];#i;#C;#D;#u=!1;#a;#f;#p=!1;constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#i=r,this.#t=this.#i?this.#i.#t:this,this.#a=this.#t===this?n:this.#t.#a,this.#D=this.#t===this?[]:this.#t.#D,t==="!"&&!this.#t.#u&&this.#D.push(this),this.#C=this.#i?this.#i.#s.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#s)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#s.map(t=>String(t)).join("|")+")":this.#f=this.#s.map(t=>String(t)).join("")}#c(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#D.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let s=r.#C+1;!n.type&&s<n.#s.length;s++)for(let o of t.#s){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#s[s])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof e&&r.#i===this))throw new Error("invalid part: "+r);this.#s.push(r)}}toJSON(){let t=this.type===null?this.#s.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#s.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(this.#C===0)return!0;let t=this.#i;for(let r=0;r<this.#C;r++){let n=t.#s[r];if(!(n instanceof e&&n.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#s.length:0;return this.#C===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new e(this.type,t);for(let n of this.#s)r.copyIn(n);return r}static#n(t,r,n,s){let o=!1,i=!1,a=-1,c=!1;if(r.type===null){let f=n,m="";for(;f<t.length;){let h=t.charAt(f++);if(o||h==="\\"){o=!o,m+=h;continue}if(i){f===a+1?(h==="^"||h==="!")&&(c=!0):h==="]"&&!(f===a+2&&c)&&(i=!1),m+=h;continue}else if(h==="["){i=!0,a=f,c=!1,m+=h;continue}if(!s.noext&&La(h)&&t.charAt(f)==="("){r.push(m),m="";let D=new e(h,r);f=e.#n(t,D,f,s),r.push(D);continue}m+=h}return r.push(m),f}let l=n+1,u=new e(null,r),p=[],d="";for(;l<t.length;){let f=t.charAt(l++);if(o||f==="\\"){o=!o,d+=f;continue}if(i){l===a+1?(f==="^"||f==="!")&&(c=!0):f==="]"&&!(l===a+2&&c)&&(i=!1),d+=f;continue}else if(f==="["){i=!0,a=l,c=!1,d+=f;continue}if(La(f)&&t.charAt(l)==="("){u.push(d),d="";let m=new e(f,u);u.push(m),l=e.#n(t,m,l,s);continue}if(f==="|"){u.push(d),d="",p.push(u),u=new e(null,r);continue}if(f===")")return d===""&&r.#s.length===0&&(r.#p=!0),u.push(d),d="",r.push(...p,u),l;d+=f}return r.type=null,r.#r=void 0,r.#s=[t.substring(n-1)],l}static fromGlob(t,r={}){let n=new e(null,void 0,r);return e.#n(t,n,0,r),n}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[r,n,s,o]=this.toRegExpSource();if(!(s||this.#r||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#a}toRegExpSource(t){let r=t??!!this.#a.dot;if(this.#t===this&&this.#c(),!this.type){let c=this.isStart()&&this.isEnd()&&!this.#s.some(f=>typeof f!="string"),l=this.#s.map(f=>{let[m,h,D,g]=typeof f=="string"?e.#b(f,this.#r,c):f.toRegExpSource(t);return this.#r=this.#r||D,this.#o=this.#o||g,m}).join(""),u="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&$h.has(this.#s[0]))){let m=Mh,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),D=!r&&!t&&m.has(l.charAt(0));u=h?Oh:D?An:""}let p="";return this.isEnd()&&this.#t.#u&&this.#i?.type==="!"&&(p="(?:$|\\/)"),[u+l+p,wt(l),this.#r=!!this.#r,this.#o]}let n=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#d(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let c=this.toString();return this.#s=[c],this.type=null,this.#r=void 0,[c,wt(this.toString()),!1,!1]}let i=!n||t||r||!An?"":this.#d(!0);i===o&&(i=""),i&&(o=`(?:${o})(?:${i})*?`);let a="";if(this.type==="!"&&this.#p)a=(this.isStart()&&!r?An:"")+Ga;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!t?An:"")+Wa+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=s+o+c}return[a,wt(o),this.#r=!!this.#r,this.#o]}#d(t){return this.#s.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,s,o,i]=r.toRegExpSource(t);return this.#o=this.#o||i,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#b(t,r,n=!1){let s=!1,o="",i=!1;for(let a=0;a<t.length;a++){let c=t.charAt(a);if(s){s=!1,o+=(Bh.has(c)?"\\":"")+c;continue}if(c==="\\"){a===t.length-1?o+="\\\\":s=!0;continue}if(c==="["){let[l,u,p,d]=_a(t,a);if(p){o+=l,i=i||u,a+=p-1,r=r||d;continue}}if(c==="*"){o+=n&&t==="*"?Ga:Wa,r=!0;continue}if(c==="?"){o+=uo,r=!0;continue}o+=jh(c)}return[o,wt(t),!!r,i]}};var Be=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var Z=(e,t,r={})=>(Mr(t),!r.nocomment&&t.charAt(0)==="#"?!1:new at(t,r).match(e)),_h=/^\*+([^+@!?\*\[\(]*)$/,Lh=e=>t=>!t.startsWith(".")&&t.endsWith(e),Wh=e=>t=>t.endsWith(e),Gh=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Hh=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Uh=/^\*+\.\*+$/,zh=e=>!e.startsWith(".")&&e.includes("."),Kh=e=>e!=="."&&e!==".."&&e.includes("."),Jh=/^\.\*+$/,qh=e=>e!=="."&&e!==".."&&e.startsWith("."),Vh=/^\*+$/,Yh=e=>e.length!==0&&!e.startsWith("."),Zh=e=>e.length!==0&&e!=="."&&e!=="..",Xh=/^\?+([^+@!?\*\[\(]*)?$/,Qh=([e,t=""])=>{let r=za([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},tm=([e,t=""])=>{let r=Ka([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},em=([e,t=""])=>{let r=Ka([e]);return t?n=>r(n)&&n.endsWith(t):r},rm=([e,t=""])=>{let r=za([e]);return t?n=>r(n)&&n.endsWith(t):r},za=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},Ka=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},Ja=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Ha={win32:{sep:"\\"},posix:{sep:"/"}},nm=Ja==="win32"?Ha.win32.sep:Ha.posix.sep;Z.sep=nm;var U=Symbol("globstar **");Z.GLOBSTAR=U;var sm="[^/]",om=sm+"*?",im="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",am="(?:(?!(?:\\/|^)\\.).)*?",cm=(e,t={})=>r=>Z(r,e,t);Z.filter=cm;var mt=(e,t={})=>Object.assign({},e,t),lm=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Z;let t=Z;return Object.assign((n,s,o={})=>t(n,s,mt(e,o)),{Minimatch:class extends t.Minimatch{constructor(s,o={}){super(s,mt(e,o))}static defaults(s){return t.defaults(mt(e,s)).Minimatch}},AST:class extends t.AST{constructor(s,o,i={}){super(s,o,mt(e,i))}static fromGlob(s,o={}){return t.AST.fromGlob(s,mt(e,o))}},unescape:(n,s={})=>t.unescape(n,mt(e,s)),escape:(n,s={})=>t.escape(n,mt(e,s)),filter:(n,s={})=>t.filter(n,mt(e,s)),defaults:n=>t.defaults(mt(e,n)),makeRe:(n,s={})=>t.makeRe(n,mt(e,s)),braceExpand:(n,s={})=>t.braceExpand(n,mt(e,s)),match:(n,s,o={})=>t.match(n,s,mt(e,o)),sep:t.sep,GLOBSTAR:U})};Z.defaults=lm;var qa=(e,t={})=>(Mr(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Ba(e));Z.braceExpand=qa;var um=(e,t={})=>new at(e,t).makeRe();Z.makeRe=um;var pm=(e,t,r={})=>{let n=new at(t,r);return e=e.filter(s=>n.match(s)),n.options.nonull&&!e.length&&e.push(t),e};Z.match=pm;var Ua=/[?*]|[+@!]\(.*?\)|\[|\]/,fm=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),at=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,r={}){Mr(t),r=r||{},this.options=r,this.pattern=t,this.platform=r.platform||Ja,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.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 r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let s=this.globParts.map((o,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=o[0]===""&&o[1]===""&&(o[2]==="?"||!Ua.test(o[2]))&&!Ua.test(o[3]),l=/^[a-z]:/i.test(o[0]);if(c)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(l)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(c=>this.parse(c))});if(this.debug(this.pattern,s),this.set=s.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let i=this.set[o];i[0]===""&&i[1]===""&&this.globParts[o][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n=0;n<t.length;n++)for(let s=0;s<t[n].length;s++)t[n][s]==="**"&&(t[n][s]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let s=n;for(;r[s+1]==="**";)s++;s!==n&&r.splice(n,s-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,s)=>{let o=n[n.length-1];return s==="**"&&o==="**"?n:s===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(s),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let o=t[s];s===1&&o===""&&t[0]===""||(o==="."||o==="")&&(r=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let s=t[n-1];s&&s!=="."&&s!==".."&&s!=="**"&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let s=-1;for(;(s=n.indexOf("**",s+1))!==-1;){let i=s;for(;n[i+1]==="**";)i++;i>s&&n.splice(s+1,i-s);let a=n[s+1],c=n[s+2],l=n[s+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;r=!0,n.splice(s,1);let u=n.slice(0);u[s]="**",t.push(u),s--}if(!this.preserveMultipleSlashes){for(let i=1;i<n.length-1;i++){let a=n[i];i===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(i,1),i--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let i=n[o-1];if(i&&i!=="."&&i!==".."&&i!=="**"){r=!0;let c=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...c),n.length===0&&n.push(""),o-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let s=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(s){t[r]=[],t[n]=s;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let s=0,o=0,i=[],a="";for(;s<t.length&&o<r.length;)if(t[s]===r[o])i.push(a==="b"?r[o]:t[s]),s++,o++;else if(n&&t[s]==="**"&&r[o]===t[s+1])i.push(t[s]),s++;else if(n&&r[o]==="**"&&t[s]===r[o+1])i.push(r[o]),o++;else if(t[s]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",i.push(t[s]),s++,o++}else if(r[o]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(a==="a")return!1;a="b",i.push(r[o]),s++,o++}else return!1;return t.length===r.length&&i}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let s=this.options;if(this.isWindows){let h=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),D=!h&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),g=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),y=!g&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),x=D?3:h?0:void 0,C=y?3:g?0:void 0;if(typeof x=="number"&&typeof C=="number"){let[A,dt]=[t[x],r[C]];A.toLowerCase()===dt.toLowerCase()&&(r[C]=A,C>x?r=r.slice(C):x>C&&(t=t.slice(x)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var i=0,a=0,c=t.length,l=r.length;i<c&&a<l;i++,a++){this.debug("matchOne loop");var u=r[a],p=t[i];if(this.debug(r,u,p),u===!1)return!1;if(u===U){this.debug("GLOBSTAR",[r,u,p]);var d=i,f=a+1;if(f===l){for(this.debug("** at the end");i<c;i++)if(t[i]==="."||t[i]===".."||!s.dot&&t[i].charAt(0)===".")return!1;return!0}for(;d<c;){var m=t[d];if(this.debug(`
13
+ ${ao.default.bold(e.exampleUsage)}
14
+ `),e.additionalInfo&&t.addHelpText("after",()=>(typeof e.additionalInfo=="function"?e.additionalInfo():e.additionalInfo)??""),t.action(async(...r)=>{try{let n=r.at(-1),s=n.args,o=n.opts(),i=Dh(e.arguments??[],s);if(e.shouldSkipWorkflow?.(i,o)){await e.onSkipWorkflow?.(i,o);return}let a=await e.buildContext(i,o);e.prompts?.length&&await new co.Listr(va(e.prompts,a),{rendererOptions:{lazy:!0,showErrorMessage:!1}}).run(a),await new co.Listr(va(e.actions,a),{rendererOptions:{lazy:!1,showErrorMessage:!1,clearOutput:!0}}).run(a),await e.onComplete?.(a)}catch(n){let s=n;w.error(s.message)}}),t}function Dh(e,t){let r={};return e.forEach(([n],s)=>{let o=n.replace(/[<>[\]]/g,"");r[o]=t[s]}),r}function va(e,t){return e.map(r=>typeof r=="function"?r(t):r)}function Pn(e,t,r){let n=t.split("."),s=e;for(;n.length>1;){let o=n.shift();o in s||(s[o]={}),s=s[o]}s[n[0]]=r}var Ea=require("execa");function Nr(e){try{return(0,Ea.execaSync)(e,["--version"]),!0}catch{return!1}}var Xe=require("node:path"),el=require("fs-extra");var Ra=b(require("node:process"),1);var Fa=b(require("node:process"),1);var Ta=require("node:url"),Aa=b(require("node:fs"),1),we=b(require("node:path"),1),Sa=e=>e instanceof URL?(0,Ta.fileURLToPath)(e):e;function Pa(e,{cwd:t=Fa.default.cwd(),type:r="file",stopAt:n}={}){let s=we.default.resolve(Sa(t)??""),{root:o}=we.default.parse(s);n=we.default.resolve(s,Sa(n)??o);let i=we.default.isAbsolute(e);for(;s;){let a=i?e:we.default.join(s,e);try{let c=Aa.default.statSync(a,{throwIfNoEntry:!1});if(r==="file"&&c?.isFile()||r==="directory"&&c?.isDirectory())return a}catch{}if(s===n||s===o)break;s=we.default.dirname(s)}}function Ia({cwd:e=Ra.default.cwd()}={}){return Pa("package.json",{cwd:e})}var lo=(e,t,r)=>{let n=e instanceof RegExp?Na(e,r):e,s=t instanceof RegExp?Na(t,r):t,o=n!==null&&s!=null&&yh(n,s,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+s.length)}},Na=(e,t)=>{let r=t.match(e);return r?r[0]:null},yh=(e,t,r)=>{let n,s,o,i,a,c=r.indexOf(e),l=r.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(n=[],o=r.length;u>=0&&!a;){if(u===c)n.push(u),c=r.indexOf(e,u+1);else if(n.length===1){let p=n.pop();p!==void 0&&(a=[p,l])}else s=n.pop(),s!==void 0&&s<o&&(o=s,i=l),l=r.indexOf(t,u+1);u=c<l&&c>=0?c:l}n.length&&i!==void 0&&(a=[o,i])}return a};var Oa="\0SLASH"+Math.random()+"\0",Ma="\0OPEN"+Math.random()+"\0",po="\0CLOSE"+Math.random()+"\0",$a="\0COMMA"+Math.random()+"\0",Ba="\0PERIOD"+Math.random()+"\0",wh=new RegExp(Oa,"g"),Ch=new RegExp(Ma,"g"),bh=new RegExp(po,"g"),xh=new RegExp($a,"g"),vh=new RegExp(Ba,"g"),kh=/\\\\/g,Eh=/\\{/g,Sh=/\\}/g,Fh=/\\,/g,Th=/\\./g;function uo(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Ah(e){return e.replace(kh,Oa).replace(Eh,Ma).replace(Sh,po).replace(Fh,$a).replace(Th,Ba)}function Ph(e){return e.replace(wh,"\\").replace(Ch,"{").replace(bh,"}").replace(xh,",").replace(vh,".")}function ja(e){if(!e)return[""];let t=[],r=lo("{","}",e);if(!r)return e.split(",");let{pre:n,body:s,post:o}=r,i=n.split(",");i[i.length-1]+="{"+s+"}";let a=ja(o);return o.length&&(i[i.length-1]+=a.shift(),i.push.apply(i,a)),t.push.apply(t,i),t}function _a(e){return e?(e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Or(Ah(e),!0).map(Ph)):[]}function Rh(e){return"{"+e+"}"}function Ih(e){return/^-?0\d/.test(e)}function Nh(e,t){return e<=t}function Oh(e,t){return e>=t}function Or(e,t){let r=[],n=lo("{","}",e);if(!n)return[e];let s=n.pre,o=n.post.length?Or(n.post,!1):[""];if(/\$$/.test(n.pre))for(let i=0;i<o.length;i++){let a=s+"{"+n.body+"}"+o[i];r.push(a)}else{let i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=i||a,l=n.body.indexOf(",")>=0;if(!c&&!l)return n.post.match(/,(?!,).*\}/)?(e=n.pre+"{"+n.body+po+n.post,Or(e)):[e];let u;if(c)u=n.body.split(/\.\./);else if(u=ja(n.body),u.length===1&&u[0]!==void 0&&(u=Or(u[0],!1).map(Rh),u.length===1))return o.map(d=>n.pre+u[0]+d);let p;if(c&&u[0]!==void 0&&u[1]!==void 0){let d=uo(u[0]),f=uo(u[1]),m=Math.max(u[0].length,u[1].length),h=u.length===3&&u[2]!==void 0?Math.abs(uo(u[2])):1,D=Nh;f<d&&(h*=-1,D=Oh);let y=u.some(Ih);p=[];for(let x=d;D(x,f);x+=h){let C;if(a)C=String.fromCharCode(x),C==="\\"&&(C="");else if(C=String(x),y){let A=m-C.length;if(A>0){let dt=new Array(A+1).join("0");x<0?C="-"+dt+C.slice(1):C=dt+C}}p.push(C)}}else{p=[];for(let d=0;d<u.length;d++)p.push.apply(p,Or(u[d],!1))}for(let d=0;d<p.length;d++)for(let f=0;f<o.length;f++){let m=s+p[d]+o[f];(!t||c||m)&&r.push(m)}}return r}var Mr=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var Mh={"[: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]},$r=e=>e.replace(/[[\]\\-]/g,"\\$&"),$h=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),La=e=>e.join(""),Wa=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],s=[],o=r+1,i=!1,a=!1,c=!1,l=!1,u=r,p="";t:for(;o<e.length;){let h=e.charAt(o);if((h==="!"||h==="^")&&o===r+1){l=!0,o++;continue}if(h==="]"&&i&&!c){u=o+1;break}if(i=!0,h==="\\"&&!c){c=!0,o++;continue}if(h==="["&&!c){for(let[D,[g,y,x]]of Object.entries(Mh))if(e.startsWith(D,o)){if(p)return["$.",!1,e.length-r,!0];o+=D.length,x?s.push(g):n.push(g),a=a||y;continue t}}if(c=!1,p){h>p?n.push($r(p)+"-"+$r(h)):h===p&&n.push($r(h)),p="",o++;continue}if(e.startsWith("-]",o+1)){n.push($r(h+"-")),o+=2;continue}if(e.startsWith("-",o+1)){p=h,o+=2;continue}n.push($r(h)),o++}if(u<o)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,e.length-r,!0];if(s.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let h=n[0].length===2?n[0].slice(-1):n[0];return[$h(h),!1,u-r,!1]}let d="["+(l?"^":"")+La(n)+"]",f="["+(l?"":"^")+La(s)+"]";return[n.length&&s.length?"("+d+"|"+f+")":n.length?d:f,a,u-r,!0]};var wt=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?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 Bh=new Set(["!","?","+","*","@"]),Ga=e=>Bh.has(e),jh="(?!(?:^|/)\\.\\.?(?:$|/))",Rn="(?!\\.)",_h=new Set(["[","."]),Lh=new Set(["..","."]),Wh=new Set("().*{}+?[]^$\\!"),Gh=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),fo="[^/]",Ha=fo+"*?",Ua=fo+"+?",$e=class e{type;#t;#r;#o=!1;#s=[];#i;#C;#D;#u=!1;#a;#f;#p=!1;constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#i=r,this.#t=this.#i?this.#i.#t:this,this.#a=this.#t===this?n:this.#t.#a,this.#D=this.#t===this?[]:this.#t.#D,t==="!"&&!this.#t.#u&&this.#D.push(this),this.#C=this.#i?this.#i.#s.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#s)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#f!==void 0?this.#f:this.type?this.#f=this.type+"("+this.#s.map(t=>String(t)).join("|")+")":this.#f=this.#s.map(t=>String(t)).join("")}#c(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#D.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let s=r.#C+1;!n.type&&s<n.#s.length;s++)for(let o of t.#s){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#s[s])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof e&&r.#i===this))throw new Error("invalid part: "+r);this.#s.push(r)}}toJSON(){let t=this.type===null?this.#s.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#s.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#i?.isStart())return!1;if(this.#C===0)return!0;let t=this.#i;for(let r=0;r<this.#C;r++){let n=t.#s[r];if(!(n instanceof e&&n.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#s.length:0;return this.#C===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new e(this.type,t);for(let n of this.#s)r.copyIn(n);return r}static#n(t,r,n,s){let o=!1,i=!1,a=-1,c=!1;if(r.type===null){let f=n,m="";for(;f<t.length;){let h=t.charAt(f++);if(o||h==="\\"){o=!o,m+=h;continue}if(i){f===a+1?(h==="^"||h==="!")&&(c=!0):h==="]"&&!(f===a+2&&c)&&(i=!1),m+=h;continue}else if(h==="["){i=!0,a=f,c=!1,m+=h;continue}if(!s.noext&&Ga(h)&&t.charAt(f)==="("){r.push(m),m="";let D=new e(h,r);f=e.#n(t,D,f,s),r.push(D);continue}m+=h}return r.push(m),f}let l=n+1,u=new e(null,r),p=[],d="";for(;l<t.length;){let f=t.charAt(l++);if(o||f==="\\"){o=!o,d+=f;continue}if(i){l===a+1?(f==="^"||f==="!")&&(c=!0):f==="]"&&!(l===a+2&&c)&&(i=!1),d+=f;continue}else if(f==="["){i=!0,a=l,c=!1,d+=f;continue}if(Ga(f)&&t.charAt(l)==="("){u.push(d),d="";let m=new e(f,u);u.push(m),l=e.#n(t,m,l,s);continue}if(f==="|"){u.push(d),d="",p.push(u),u=new e(null,r);continue}if(f===")")return d===""&&r.#s.length===0&&(r.#p=!0),u.push(d),d="",r.push(...p,u),l;d+=f}return r.type=null,r.#r=void 0,r.#s=[t.substring(n-1)],l}static fromGlob(t,r={}){let n=new e(null,void 0,r);return e.#n(t,n,0,r),n}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[r,n,s,o]=this.toRegExpSource();if(!(s||this.#r||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#a}toRegExpSource(t){let r=t??!!this.#a.dot;if(this.#t===this&&this.#c(),!this.type){let c=this.isStart()&&this.isEnd()&&!this.#s.some(f=>typeof f!="string"),l=this.#s.map(f=>{let[m,h,D,g]=typeof f=="string"?e.#b(f,this.#r,c):f.toRegExpSource(t);return this.#r=this.#r||D,this.#o=this.#o||g,m}).join(""),u="";if(this.isStart()&&typeof this.#s[0]=="string"&&!(this.#s.length===1&&Lh.has(this.#s[0]))){let m=_h,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),D=!r&&!t&&m.has(l.charAt(0));u=h?jh:D?Rn:""}let p="";return this.isEnd()&&this.#t.#u&&this.#i?.type==="!"&&(p="(?:$|\\/)"),[u+l+p,wt(l),this.#r=!!this.#r,this.#o]}let n=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#d(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let c=this.toString();return this.#s=[c],this.type=null,this.#r=void 0,[c,wt(this.toString()),!1,!1]}let i=!n||t||r||!Rn?"":this.#d(!0);i===o&&(i=""),i&&(o=`(?:${o})(?:${i})*?`);let a="";if(this.type==="!"&&this.#p)a=(this.isStart()&&!r?Rn:"")+Ua;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Rn:"")+Ha+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;a=s+o+c}return[a,wt(o),this.#r=!!this.#r,this.#o]}#d(t){return this.#s.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,s,o,i]=r.toRegExpSource(t);return this.#o=this.#o||i,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#b(t,r,n=!1){let s=!1,o="",i=!1;for(let a=0;a<t.length;a++){let c=t.charAt(a);if(s){s=!1,o+=(Wh.has(c)?"\\":"")+c;continue}if(c==="\\"){a===t.length-1?o+="\\\\":s=!0;continue}if(c==="["){let[l,u,p,d]=Wa(t,a);if(p){o+=l,i=i||u,a+=p-1,r=r||d;continue}}if(c==="*"){o+=n&&t==="*"?Ua:Ha,r=!0;continue}if(c==="?"){o+=fo,r=!0;continue}o+=Gh(c)}return[o,wt(t),!!r,i]}};var Be=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var Z=(e,t,r={})=>(Mr(t),!r.nocomment&&t.charAt(0)==="#"?!1:new at(t,r).match(e)),Hh=/^\*+([^+@!?\*\[\(]*)$/,Uh=e=>t=>!t.startsWith(".")&&t.endsWith(e),zh=e=>t=>t.endsWith(e),Kh=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Jh=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),qh=/^\*+\.\*+$/,Vh=e=>!e.startsWith(".")&&e.includes("."),Yh=e=>e!=="."&&e!==".."&&e.includes("."),Zh=/^\.\*+$/,Xh=e=>e!=="."&&e!==".."&&e.startsWith("."),Qh=/^\*+$/,tm=e=>e.length!==0&&!e.startsWith("."),em=e=>e.length!==0&&e!=="."&&e!=="..",rm=/^\?+([^+@!?\*\[\(]*)?$/,nm=([e,t=""])=>{let r=Ja([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},sm=([e,t=""])=>{let r=qa([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},om=([e,t=""])=>{let r=qa([e]);return t?n=>r(n)&&n.endsWith(t):r},im=([e,t=""])=>{let r=Ja([e]);return t?n=>r(n)&&n.endsWith(t):r},Ja=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},qa=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},Va=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",za={win32:{sep:"\\"},posix:{sep:"/"}},am=Va==="win32"?za.win32.sep:za.posix.sep;Z.sep=am;var U=Symbol("globstar **");Z.GLOBSTAR=U;var cm="[^/]",lm=cm+"*?",um="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",pm="(?:(?!(?:\\/|^)\\.).)*?",fm=(e,t={})=>r=>Z(r,e,t);Z.filter=fm;var mt=(e,t={})=>Object.assign({},e,t),dm=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Z;let t=Z;return Object.assign((n,s,o={})=>t(n,s,mt(e,o)),{Minimatch:class extends t.Minimatch{constructor(s,o={}){super(s,mt(e,o))}static defaults(s){return t.defaults(mt(e,s)).Minimatch}},AST:class extends t.AST{constructor(s,o,i={}){super(s,o,mt(e,i))}static fromGlob(s,o={}){return t.AST.fromGlob(s,mt(e,o))}},unescape:(n,s={})=>t.unescape(n,mt(e,s)),escape:(n,s={})=>t.escape(n,mt(e,s)),filter:(n,s={})=>t.filter(n,mt(e,s)),defaults:n=>t.defaults(mt(e,n)),makeRe:(n,s={})=>t.makeRe(n,mt(e,s)),braceExpand:(n,s={})=>t.braceExpand(n,mt(e,s)),match:(n,s,o={})=>t.match(n,s,mt(e,o)),sep:t.sep,GLOBSTAR:U})};Z.defaults=dm;var Ya=(e,t={})=>(Mr(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:_a(e));Z.braceExpand=Ya;var hm=(e,t={})=>new at(e,t).makeRe();Z.makeRe=hm;var mm=(e,t,r={})=>{let n=new at(t,r);return e=e.filter(s=>n.match(s)),n.options.nonull&&!e.length&&e.push(t),e};Z.match=mm;var Ka=/[?*]|[+@!]\(.*?\)|\[|\]/,gm=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),at=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,r={}){Mr(t),r=r||{},this.options=r,this.pattern=t,this.platform=r.platform||Va,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.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 r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let s=this.globParts.map((o,i,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=o[0]===""&&o[1]===""&&(o[2]==="?"||!Ka.test(o[2]))&&!Ka.test(o[3]),l=/^[a-z]:/i.test(o[0]);if(c)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(l)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(c=>this.parse(c))});if(this.debug(this.pattern,s),this.set=s.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let i=this.set[o];i[0]===""&&i[1]===""&&this.globParts[o][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n=0;n<t.length;n++)for(let s=0;s<t[n].length;s++)t[n][s]==="**"&&(t[n][s]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let s=n;for(;r[s+1]==="**";)s++;s!==n&&r.splice(n,s-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,s)=>{let o=n[n.length-1];return s==="**"&&o==="**"?n:s===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(s),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let o=t[s];s===1&&o===""&&t[0]===""||(o==="."||o==="")&&(r=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let s=t[n-1];s&&s!=="."&&s!==".."&&s!=="**"&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let s=-1;for(;(s=n.indexOf("**",s+1))!==-1;){let i=s;for(;n[i+1]==="**";)i++;i>s&&n.splice(s+1,i-s);let a=n[s+1],c=n[s+2],l=n[s+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;r=!0,n.splice(s,1);let u=n.slice(0);u[s]="**",t.push(u),s--}if(!this.preserveMultipleSlashes){for(let i=1;i<n.length-1;i++){let a=n[i];i===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(i,1),i--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let i=n[o-1];if(i&&i!=="."&&i!==".."&&i!=="**"){r=!0;let c=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...c),n.length===0&&n.push(""),o-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let s=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(s){t[r]=[],t[n]=s;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let s=0,o=0,i=[],a="";for(;s<t.length&&o<r.length;)if(t[s]===r[o])i.push(a==="b"?r[o]:t[s]),s++,o++;else if(n&&t[s]==="**"&&r[o]===t[s+1])i.push(t[s]),s++;else if(n&&r[o]==="**"&&t[s]===r[o+1])i.push(r[o]),o++;else if(t[s]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",i.push(t[s]),s++,o++}else if(r[o]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(a==="a")return!1;a="b",i.push(r[o]),s++,o++}else return!1;return t.length===r.length&&i}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let s=this.options;if(this.isWindows){let h=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),D=!h&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),g=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),y=!g&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),x=D?3:h?0:void 0,C=y?3:g?0:void 0;if(typeof x=="number"&&typeof C=="number"){let[A,dt]=[t[x],r[C]];A.toLowerCase()===dt.toLowerCase()&&(r[C]=A,C>x?r=r.slice(C):x>C&&(t=t.slice(x)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var i=0,a=0,c=t.length,l=r.length;i<c&&a<l;i++,a++){this.debug("matchOne loop");var u=r[a],p=t[i];if(this.debug(r,u,p),u===!1)return!1;if(u===U){this.debug("GLOBSTAR",[r,u,p]);var d=i,f=a+1;if(f===l){for(this.debug("** at the end");i<c;i++)if(t[i]==="."||t[i]===".."||!s.dot&&t[i].charAt(0)===".")return!1;return!0}for(;d<c;){var m=t[d];if(this.debug(`
15
15
  globstar while`,t,d,r,f,m),this.matchOne(t.slice(d),r.slice(f),n))return this.debug("globstar found match!",d,c,m),!0;if(m==="."||m===".."||!s.dot&&m.charAt(0)==="."){this.debug("dot detected!",t,d,r,f);break}this.debug("globstar swallow a segment, and continue"),d++}return!!(n&&(this.debug(`
16
- >>> no match, partial?`,t,d,r,f),d===c))}let h;if(typeof u=="string"?(h=p===u,this.debug("string match",u,p,h)):(h=u.test(p),this.debug("pattern match",u,p,h)),!h)return!1}if(i===c&&a===l)return!0;if(i===c)return n;if(a===l)return i===c-1&&t[i]==="";throw new Error("wtf?")}braceExpand(){return qa(this.pattern,this.options)}parse(t){Mr(t);let r=this.options;if(t==="**")return U;if(t==="")return"";let n,s=null;(n=t.match(Vh))?s=r.dot?Zh:Yh:(n=t.match(_h))?s=(r.nocase?r.dot?Hh:Gh:r.dot?Wh:Lh)(n[1]):(n=t.match(Xh))?s=(r.nocase?r.dot?tm:Qh:r.dot?em:rm)(n):(n=t.match(Uh))?s=r.dot?Kh:zh:(n=t.match(Jh))&&(s=qh);let o=$e.fromGlob(t,this.options).toMMPattern();return s&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:s}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?om:r.dot?im:am,s=new Set(r.nocase?["i"]:[]),o=t.map(c=>{let l=c.map(p=>{if(p instanceof RegExp)for(let d of p.flags.split(""))s.add(d);return typeof p=="string"?fm(p):p===U?U:p._src});l.forEach((p,d)=>{let f=l[d+1],m=l[d-1];p!==U||m===U||(m===void 0?f!==void 0&&f!==U?l[d+1]="(?:\\/|"+n+"\\/)?"+f:l[d]=n:f===void 0?l[d-1]=m+"(?:\\/|\\/"+n+")?":f!==U&&(l[d-1]=m+"(?:\\/|\\/"+n+"\\/)"+f,l[d+1]=U))});let u=l.filter(p=>p!==U);if(this.partial&&u.length>=1){let p=[];for(let d=1;d<=u.length;d++)p.push(u.slice(0,d).join("/"));return"(?:"+p.join("|")+")"}return u.join("/")}).join("|"),[i,a]=t.length>1?["(?:",")"]:["",""];o="^"+i+o+a+"$",this.partial&&(o="^(?:\\/|"+i+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].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,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let i=s[s.length-1];if(!i)for(let a=s.length-2;!i&&a>=0;a--)i=s[a];for(let a=0;a<o.length;a++){let c=o[a],l=s;if(n.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Z.defaults(t).Minimatch}};Z.AST=$e;Z.Minimatch=at;Z.escape=Be;Z.unescape=wt;var yc=require("node:url");var dm=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ya=new Set,po=typeof process=="object"&&process?process:{},Za=(e,t,r,n)=>{typeof po.emitWarning=="function"?po.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},Pn=globalThis.AbortController,Va=globalThis.AbortSignal;if(typeof Pn>"u"){Va=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,s){this._onabort.push(s)}},Pn=class{constructor(){t()}signal=new Va;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n)}}};let e=po.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,Za("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 hm=e=>!Ya.has(e),fx=Symbol("type"),ie=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Xa=e=>ie(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?je:null:null,je=class extends Array{constructor(t){super(t),this.fill(0)}},fo=class e{heap;length;static#t=!1;static create(t){let r=Xa(t);if(!r)return[];e.#t=!0;let n=new e(t,r);return e.#t=!1,n}constructor(t,r){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Ce=class e{#t;#r;#o;#s;#i;#C;#D;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#f;#p;#c;#n;#d;#b;#w;#h;#T;#m;#k;#E;#g;#y;#x;#S;#e;#O;static unsafeExposeInternals(t){return{starts:t.#E,ttls:t.#g,autopurgeTimers:t.#y,sizes:t.#k,keyMap:t.#p,keyList:t.#c,valList:t.#n,next:t.#d,prev:t.#b,get head(){return t.#w},get tail(){return t.#h},free:t.#T,isBackgroundFetch:r=>t.#l(r),backgroundFetch:(r,n,s,o)=>t.#G(r,n,s,o),moveToTail:r=>t.#$(r),indexes:r=>t.#P(r),rindexes:r=>t.#R(r),isStale:r=>t.#v(r)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#f}get size(){return this.#a}get fetchMethod(){return this.#C}get memoMethod(){return this.#D}get dispose(){return this.#o}get onInsert(){return this.#s}get disposeAfter(){return this.#i}constructor(t){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:i,updateAgeOnHas:a,allowStale:c,dispose:l,onInsert:u,disposeAfter:p,noDisposeOnSet:d,noUpdateTTL:f,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:D,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:dt,ignoreFetchAbort:ne,perf:Ae}=t;if(Ae!==void 0&&typeof Ae?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=Ae??dm,r!==0&&!ie(r))throw new TypeError("max option must be a nonnegative integer");let Pe=r?Xa(r):Array;if(!Pe)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=m,this.maxEntrySize=h||this.#r,this.sizeCalculation=D,this.sizeCalculation){if(!this.#r&&!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(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#D=y,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#C=g,this.#S=!!g,this.#p=new Map,this.#c=new Array(r).fill(void 0),this.#n=new Array(r).fill(void 0),this.#d=new Pe(r),this.#b=new Pe(r),this.#w=0,this.#h=0,this.#T=fo.create(r),this.#a=0,this.#f=0,typeof l=="function"&&(this.#o=l),typeof u=="function"&&(this.#s=u),typeof p=="function"?(this.#i=p,this.#m=[]):(this.#i=void 0,this.#m=void 0),this.#x=!!this.#o,this.#O=!!this.#s,this.#e=!!this.#i,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!dt,this.ignoreFetchAbort=!!ne,this.maxEntrySize!==0){if(this.#r!==0&&!ie(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!ie(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#U()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!a,this.ttlResolution=ie(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!ie(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let Re="LRU_CACHE_UNBOUNDED";hm(Re)&&(Ya.add(Re),Za("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Re,e))}}getRemainingTTL(t){return this.#p.has(t)?1/0:0}#I(){let t=new je(this.#t),r=new je(this.#t);this.#g=t,this.#E=r;let n=this.ttlAutopurge?new Array(this.#t):void 0;this.#y=n,this.#j=(i,a,c=this.#u.now())=>{if(r[i]=a!==0?c:0,t[i]=a,n?.[i]&&(clearTimeout(n[i]),n[i]=void 0),a!==0&&n){let l=setTimeout(()=>{this.#v(i)&&this.#A(this.#c[i],"expire")},a+1);l.unref&&l.unref(),n[i]=l}},this.#F=i=>{r[i]=t[i]!==0?this.#u.now():0},this.#N=(i,a)=>{if(t[a]){let c=t[a],l=r[a];if(!c||!l)return;i.ttl=c,i.start=l,i.now=s||o();let u=i.now-l;i.remainingTTL=c-u}};let s=0,o=()=>{let i=this.#u.now();if(this.ttlResolution>0){s=i;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref()}return i};this.getRemainingTTL=i=>{let a=this.#p.get(i);if(a===void 0)return 0;let c=t[a],l=r[a];if(!c||!l)return 1/0;let u=(s||o())-l;return c-u},this.#v=i=>{let a=r[i],c=t[i];return!!c&&!!a&&(s||o())-a>c}}#F=()=>{};#N=()=>{};#j=()=>{};#v=()=>!1;#U(){let t=new je(this.#t);this.#f=0,this.#k=t,this.#B=r=>{this.#f-=t[r],t[r]=0},this.#_=(r,n,s,o)=>{if(this.#l(n))return 0;if(!ie(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(n,r),!ie(s))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 s},this.#M=(r,n,s)=>{if(t[r]=n,this.#r){let o=this.#r-t[r];for(;this.#f>o;)this.#W(!0)}this.#f+=t[r],s&&(s.entrySize=n,s.totalCalculatedSize=this.#f)}}#B=t=>{};#M=(t,r,n)=>{};#_=(t,r,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#P({allowStale:t=this.allowStale}={}){if(this.#a)for(let r=this.#h;!(!this.#L(r)||((t||!this.#v(r))&&(yield r),r===this.#w));)r=this.#b[r]}*#R({allowStale:t=this.allowStale}={}){if(this.#a)for(let r=this.#w;!(!this.#L(r)||((t||!this.#v(r))&&(yield r),r===this.#h));)r=this.#d[r]}#L(t){return t!==void 0&&this.#p.get(this.#c[t])===t}*entries(){for(let t of this.#P())this.#n[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#n[t])&&(yield[this.#c[t],this.#n[t]])}*rentries(){for(let t of this.#R())this.#n[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#n[t])&&(yield[this.#c[t],this.#n[t]])}*keys(){for(let t of this.#P()){let r=this.#c[t];r!==void 0&&!this.#l(this.#n[t])&&(yield r)}}*rkeys(){for(let t of this.#R()){let r=this.#c[t];r!==void 0&&!this.#l(this.#n[t])&&(yield r)}}*values(){for(let t of this.#P())this.#n[t]!==void 0&&!this.#l(this.#n[t])&&(yield this.#n[t])}*rvalues(){for(let t of this.#R())this.#n[t]!==void 0&&!this.#l(this.#n[t])&&(yield this.#n[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let n of this.#P()){let s=this.#n[n],o=this.#l(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#c[n],this))return this.get(this.#c[n],r)}}forEach(t,r=this){for(let n of this.#P()){let s=this.#n[n],o=this.#l(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#c[n],this)}}rforEach(t,r=this){for(let n of this.#R()){let s=this.#n[n],o=this.#l(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#c[n],this)}}purgeStale(){let t=!1;for(let r of this.#R({allowStale:!0}))this.#v(r)&&(this.#A(this.#c[r],"expire"),t=!0);return t}info(t){let r=this.#p.get(t);if(r===void 0)return;let n=this.#n[r],s=this.#l(n)?n.__staleWhileFetching:n;if(s===void 0)return;let o={value:s};if(this.#g&&this.#E){let i=this.#g[r],a=this.#E[r];if(i&&a){let c=i-(this.#u.now()-a);o.ttl=c,o.start=Date.now()}}return this.#k&&(o.size=this.#k[r]),o}dump(){let t=[];for(let r of this.#P({allowStale:!0})){let n=this.#c[r],s=this.#n[r],o=this.#l(s)?s.__staleWhileFetching:s;if(o===void 0||n===void 0)continue;let i={value:o};if(this.#g&&this.#E){i.ttl=this.#g[r];let a=this.#u.now()-this.#E[r];i.start=Math.floor(Date.now()-a)}this.#k&&(i.size=this.#k[r]),t.unshift([n,i])}return t}load(t){this.clear();for(let[r,n]of t){if(n.start){let s=Date.now()-n.start;n.start=this.#u.now()-s}this.set(r,n.value,n)}}set(t,r,n={}){if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,u=this.#_(t,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(t,"set"),this;let p=this.#a===0?void 0:this.#p.get(t);if(p===void 0)p=this.#a===0?this.#h:this.#T.length!==0?this.#T.pop():this.#a===this.#t?this.#W(!1):this.#a,this.#c[p]=t,this.#n[p]=r,this.#p.set(t,p),this.#d[this.#h]=p,this.#b[p]=this.#h,this.#h=p,this.#a++,this.#M(p,u,c),c&&(c.set="add"),l=!1,this.#O&&this.#s?.(r,t,"add");else{this.#$(p);let d=this.#n[p];if(r!==d){if(this.#S&&this.#l(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=d;f!==void 0&&!i&&(this.#x&&this.#o?.(f,t,"set"),this.#e&&this.#m?.push([f,t,"set"]))}else i||(this.#x&&this.#o?.(d,t,"set"),this.#e&&this.#m?.push([d,t,"set"]));if(this.#B(p),this.#M(p,u,c),this.#n[p]=r,c){c.set="replace";let f=d&&this.#l(d)?d.__staleWhileFetching:d;f!==void 0&&(c.oldValue=f)}}else c&&(c.set="update");this.#O&&this.onInsert?.(r,t,r===d?"update":"replace")}if(s!==0&&!this.#g&&this.#I(),this.#g&&(l||this.#j(p,s,o),c&&this.#N(c,p)),!i&&this.#e&&this.#m){let d=this.#m,f;for(;f=d?.shift();)this.#i?.(...f)}return this}pop(){try{for(;this.#a;){let t=this.#n[this.#w];if(this.#W(!0),this.#l(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#e&&this.#m){let t=this.#m,r;for(;r=t?.shift();)this.#i?.(...r)}}}#W(t){let r=this.#w,n=this.#c[r],s=this.#n[r];return this.#S&&this.#l(s)?s.__abortController.abort(new Error("evicted")):(this.#x||this.#e)&&(this.#x&&this.#o?.(s,n,"evict"),this.#e&&this.#m?.push([s,n,"evict"])),this.#B(r),this.#y?.[r]&&(clearTimeout(this.#y[r]),this.#y[r]=void 0),t&&(this.#c[r]=void 0,this.#n[r]=void 0,this.#T.push(r)),this.#a===1?(this.#w=this.#h=0,this.#T.length=0):this.#w=this.#d[r],this.#p.delete(n),this.#a--,r}has(t,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=r,o=this.#p.get(t);if(o!==void 0){let i=this.#n[o];if(this.#l(i)&&i.__staleWhileFetching===void 0)return!1;if(this.#v(o))s&&(s.has="stale",this.#N(s,o));else return n&&this.#F(o),s&&(s.has="hit",this.#N(s,o)),!0}else s&&(s.has="miss");return!1}peek(t,r={}){let{allowStale:n=this.allowStale}=r,s=this.#p.get(t);if(s===void 0||!n&&this.#v(s))return;let o=this.#n[s];return this.#l(o)?o.__staleWhileFetching:o}#G(t,r,n,s){let o=r===void 0?void 0:this.#n[r];if(this.#l(o))return o;let i=new Pn,{signal:a}=n;a?.addEventListener("abort",()=>i.abort(a.reason),{signal:i.signal});let c={signal:i.signal,options:n,context:s},l=(h,D=!1)=>{let{aborted:g}=i.signal,y=n.ignoreFetchAbort&&h!==void 0;if(n.status&&(g&&!D?(n.status.fetchAborted=!0,n.status.fetchError=i.signal.reason,y&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),g&&!y&&!D)return p(i.signal.reason);let x=f,C=this.#n[r];return(C===f||y&&D&&C===void 0)&&(h===void 0?x.__staleWhileFetching!==void 0?this.#n[r]=x.__staleWhileFetching:this.#A(t,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(t,h,c.options))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),p(h)),p=h=>{let{aborted:D}=i.signal,g=D&&n.allowStaleOnFetchAbort,y=g||n.allowStaleOnFetchRejection,x=y||n.noDeleteOnFetchRejection,C=f;if(this.#n[r]===f&&(!x||C.__staleWhileFetching===void 0?this.#A(t,"fetch"):g||(this.#n[r]=C.__staleWhileFetching)),y)return n.status&&C.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),C.__staleWhileFetching;if(C.__returned===C)throw h},d=(h,D)=>{let g=this.#C?.(t,o,c);g&&g instanceof Promise&&g.then(y=>h(y===void 0?void 0:y),D),i.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=y=>l(y,!0)))})};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(l,u),m=Object.assign(f,{__abortController:i,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(t,m,{...c.options,status:void 0}),r=this.#p.get(t)):this.#n[r]=m,m}#l(t){if(!this.#S)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Pn}async fetch(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:D=!1,status:g,signal:y}=r;if(!this.#S)return g&&(g.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:g});let x={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:i,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:g,signal:y},C=this.#p.get(t);if(C===void 0){g&&(g.fetch="miss");let A=this.#G(t,C,x,h);return A.__returned=A}else{let A=this.#n[C];if(this.#l(A)){let Re=n&&A.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",Re&&(g.returnedStale=!0)),Re?A.__staleWhileFetching:A.__returned=A}let dt=this.#v(C);if(!D&&!dt)return g&&(g.fetch="hit"),this.#$(C),s&&this.#F(C),g&&this.#N(g,C),A;let ne=this.#G(t,C,x,h),Pe=ne.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=dt?"stale":"refresh",Pe&&dt&&(g.returnedStale=!0)),Pe?ne.__staleWhileFetching:ne.__returned=ne}}async forceFetch(t,r={}){let n=await this.fetch(t,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,r={}){let n=this.#D;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...i}=r,a=this.get(t,i);if(!o&&a!==void 0)return a;let c=n(t,a,{options:i,context:s});return this.set(t,c,i),c}get(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:i}=r,a=this.#p.get(t);if(a!==void 0){let c=this.#n[a],l=this.#l(c);return i&&this.#N(i,a),this.#v(a)?(i&&(i.get="stale"),l?(i&&n&&c.__staleWhileFetching!==void 0&&(i.returnedStale=!0),n?c.__staleWhileFetching:void 0):(o||this.#A(t,"expire"),i&&n&&(i.returnedStale=!0),n?c:void 0)):(i&&(i.get="hit"),l?c.__staleWhileFetching:(this.#$(a),s&&this.#F(a),c))}else i&&(i.get="miss")}#H(t,r){this.#b[r]=t,this.#d[t]=r}#$(t){t!==this.#h&&(t===this.#w?this.#w=this.#d[t]:this.#H(this.#b[t],this.#d[t]),this.#H(this.#h,t),this.#h=t)}delete(t){return this.#A(t,"delete")}#A(t,r){let n=!1;if(this.#a!==0){let s=this.#p.get(t);if(s!==void 0)if(this.#y?.[s]&&(clearTimeout(this.#y?.[s]),this.#y[s]=void 0),n=!0,this.#a===1)this.#z(r);else{this.#B(s);let o=this.#n[s];if(this.#l(o)?o.__abortController.abort(new Error("deleted")):(this.#x||this.#e)&&(this.#x&&this.#o?.(o,t,r),this.#e&&this.#m?.push([o,t,r])),this.#p.delete(t),this.#c[s]=void 0,this.#n[s]=void 0,s===this.#h)this.#h=this.#b[s];else if(s===this.#w)this.#w=this.#d[s];else{let i=this.#b[s];this.#d[i]=this.#d[s];let a=this.#d[s];this.#b[a]=this.#b[s]}this.#a--,this.#T.push(s)}}if(this.#e&&this.#m?.length){let s=this.#m,o;for(;o=s?.shift();)this.#i?.(...o)}return n}clear(){return this.#z("delete")}#z(t){for(let r of this.#R({allowStale:!0})){let n=this.#n[r];if(this.#l(n))n.__abortController.abort(new Error("deleted"));else{let s=this.#c[r];this.#x&&this.#o?.(n,s,t),this.#e&&this.#m?.push([n,s,t])}}if(this.#p.clear(),this.#n.fill(void 0),this.#c.fill(void 0),this.#g&&this.#E){this.#g.fill(0),this.#E.fill(0);for(let r of this.#y??[])r!==void 0&&clearTimeout(r);this.#y?.fill(void 0)}if(this.#k&&this.#k.fill(0),this.#w=0,this.#h=0,this.#T.length=0,this.#f=0,this.#a=0,this.#e&&this.#m){let r=this.#m,n;for(;n=r?.shift();)this.#i?.(...n)}}};var We=require("node:path"),cc=require("node:url"),It=require("fs"),km=b(require("node:fs"),1),le=require("node:fs/promises");var Bn=require("node:events"),Co=b(require("node:stream"),1),nc=require("node:string_decoder"),Qa=typeof process=="object"&&process?process:{stdout:null,stderr:null},mm=e=>!!e&&typeof e=="object"&&(e instanceof ce||e instanceof Co.default||gm(e)||Dm(e)),gm=e=>!!e&&typeof e=="object"&&e instanceof Bn.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==Co.default.Writable.prototype.pipe,Dm=e=>!!e&&typeof e=="object"&&e instanceof Bn.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",Kt=Symbol("EOF"),Jt=Symbol("maybeEmitEnd"),ae=Symbol("emittedEnd"),Rn=Symbol("emittingEnd"),Br=Symbol("emittedError"),In=Symbol("closed"),tc=Symbol("read"),Nn=Symbol("flush"),ec=Symbol("flushChunk"),Ct=Symbol("encoding"),_e=Symbol("decoder"),W=Symbol("flowing"),jr=Symbol("paused"),Le=Symbol("resume"),G=Symbol("buffer"),X=Symbol("pipes"),H=Symbol("bufferLength"),ho=Symbol("bufferPush"),On=Symbol("bufferShift"),K=Symbol("objectMode"),M=Symbol("destroyed"),mo=Symbol("error"),go=Symbol("emitData"),rc=Symbol("emitEnd"),Do=Symbol("emitEnd2"),Pt=Symbol("async"),yo=Symbol("abort"),Mn=Symbol("aborted"),_r=Symbol("signal"),be=Symbol("dataListeners"),ct=Symbol("discarded"),Lr=e=>Promise.resolve().then(e),ym=e=>e(),wm=e=>e==="end"||e==="finish"||e==="prefinish",Cm=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,bm=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),$n=class{src;dest;opts;ondrain;constructor(t,r,n){this.src=t,this.dest=r,this.opts=n,this.ondrain=()=>t[Le](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},wo=class extends $n{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,r,n){super(t,r,n),this.proxyErrors=s=>r.emit("error",s),t.on("error",this.proxyErrors)}},xm=e=>!!e.objectMode,vm=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",ce=class extends Bn.EventEmitter{[W]=!1;[jr]=!1;[X]=[];[G]=[];[K];[Ct];[Pt];[_e];[Kt]=!1;[ae]=!1;[Rn]=!1;[In]=!1;[Br]=null;[H]=0;[M]=!1;[_r];[Mn]=!1;[be]=0;[ct]=!1;writable=!0;readable=!0;constructor(...t){let r=t[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");xm(r)?(this[K]=!0,this[Ct]=null):vm(r)?(this[Ct]=r.encoding,this[K]=!1):(this[K]=!1,this[Ct]=null),this[Pt]=!!r.async,this[_e]=this[Ct]?new nc.StringDecoder(this[Ct]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[G]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[X]});let{signal:n}=r;n&&(this[_r]=n,n.aborted?this[yo]():n.addEventListener("abort",()=>this[yo]()))}get bufferLength(){return this[H]}get encoding(){return this[Ct]}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[K]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Pt]}set async(t){this[Pt]=this[Pt]||!!t}[yo](){this[Mn]=!0,this.emit("abort",this[_r]?.reason),this.destroy(this[_r]?.reason)}get aborted(){return this[Mn]}set aborted(t){}write(t,r,n){if(this[Mn])return!1;if(this[Kt])throw new Error("write after end");if(this[M])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let s=this[Pt]?Lr:ym;if(!this[K]&&!Buffer.isBuffer(t)){if(bm(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Cm(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[K]?(this[W]&&this[H]!==0&&this[Nn](!0),this[W]?this.emit("data",t):this[ho](t),this[H]!==0&&this.emit("readable"),n&&s(n),this[W]):t.length?(typeof t=="string"&&!(r===this[Ct]&&!this[_e]?.lastNeed)&&(t=Buffer.from(t,r)),Buffer.isBuffer(t)&&this[Ct]&&(t=this[_e].write(t)),this[W]&&this[H]!==0&&this[Nn](!0),this[W]?this.emit("data",t):this[ho](t),this[H]!==0&&this.emit("readable"),n&&s(n),this[W]):(this[H]!==0&&this.emit("readable"),n&&s(n),this[W])}read(t){if(this[M])return null;if(this[ct]=!1,this[H]===0||t===0||t&&t>this[H])return this[Jt](),null;this[K]&&(t=null),this[G].length>1&&!this[K]&&(this[G]=[this[Ct]?this[G].join(""):Buffer.concat(this[G],this[H])]);let r=this[tc](t||null,this[G][0]);return this[Jt](),r}[tc](t,r){if(this[K])this[On]();else{let n=r;t===n.length||t===null?this[On]():typeof n=="string"?(this[G][0]=n.slice(t),r=n.slice(0,t),this[H]-=t):(this[G][0]=n.subarray(t),r=n.subarray(0,t),this[H]-=t)}return this.emit("data",r),!this[G].length&&!this[Kt]&&this.emit("drain"),r}end(t,r,n){return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r="utf8"),t!==void 0&&this.write(t,r),n&&this.once("end",n),this[Kt]=!0,this.writable=!1,(this[W]||!this[jr])&&this[Jt](),this}[Le](){this[M]||(!this[be]&&!this[X].length&&(this[ct]=!0),this[jr]=!1,this[W]=!0,this.emit("resume"),this[G].length?this[Nn]():this[Kt]?this[Jt]():this.emit("drain"))}resume(){return this[Le]()}pause(){this[W]=!1,this[jr]=!0,this[ct]=!1}get destroyed(){return this[M]}get flowing(){return this[W]}get paused(){return this[jr]}[ho](t){this[K]?this[H]+=1:this[H]+=t.length,this[G].push(t)}[On](){return this[K]?this[H]-=1:this[H]-=this[G][0].length,this[G].shift()}[Nn](t=!1){do;while(this[ec](this[On]())&&this[G].length);!t&&!this[G].length&&!this[Kt]&&this.emit("drain")}[ec](t){return this.emit("data",t),this[W]}pipe(t,r){if(this[M])return t;this[ct]=!1;let n=this[ae];return r=r||{},t===Qa.stdout||t===Qa.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&t.end():(this[X].push(r.proxyErrors?new wo(this,t,r):new $n(this,t,r)),this[Pt]?Lr(()=>this[Le]()):this[Le]()),t}unpipe(t){let r=this[X].find(n=>n.dest===t);r&&(this[X].length===1?(this[W]&&this[be]===0&&(this[W]=!1),this[X]=[]):this[X].splice(this[X].indexOf(r),1),r.unpipe())}addListener(t,r){return this.on(t,r)}on(t,r){let n=super.on(t,r);if(t==="data")this[ct]=!1,this[be]++,!this[X].length&&!this[W]&&this[Le]();else if(t==="readable"&&this[H]!==0)super.emit("readable");else if(wm(t)&&this[ae])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Br]){let s=r;this[Pt]?Lr(()=>s.call(this,this[Br])):s.call(this,this[Br])}return n}removeListener(t,r){return this.off(t,r)}off(t,r){let n=super.off(t,r);return t==="data"&&(this[be]=this.listeners("data").length,this[be]===0&&!this[ct]&&!this[X].length&&(this[W]=!1)),n}removeAllListeners(t){let r=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[be]=0,!this[ct]&&!this[X].length&&(this[W]=!1)),r}get emittedEnd(){return this[ae]}[Jt](){!this[Rn]&&!this[ae]&&!this[M]&&this[G].length===0&&this[Kt]&&(this[Rn]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[In]&&this.emit("close"),this[Rn]=!1)}emit(t,...r){let n=r[0];if(t!=="error"&&t!=="close"&&t!==M&&this[M])return!1;if(t==="data")return!this[K]&&!n?!1:this[Pt]?(Lr(()=>this[go](n)),!0):this[go](n);if(t==="end")return this[rc]();if(t==="close"){if(this[In]=!0,!this[ae]&&!this[M])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[Br]=n,super.emit(mo,n);let o=!this[_r]||this.listeners("error").length?super.emit("error",n):!1;return this[Jt](),o}else if(t==="resume"){let o=super.emit("resume");return this[Jt](),o}else if(t==="finish"||t==="prefinish"){let o=super.emit(t);return this.removeAllListeners(t),o}let s=super.emit(t,...r);return this[Jt](),s}[go](t){for(let n of this[X])n.dest.write(t)===!1&&this.pause();let r=this[ct]?!1:super.emit("data",t);return this[Jt](),r}[rc](){return this[ae]?!1:(this[ae]=!0,this.readable=!1,this[Pt]?(Lr(()=>this[Do]()),!0):this[Do]())}[Do](){if(this[_e]){let r=this[_e].end();if(r){for(let n of this[X])n.dest.write(r);this[ct]||super.emit("data",r)}}for(let r of this[X])r.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[K]||(t.dataLength=0);let r=this.promise();return this.on("data",n=>{t.push(n),this[K]||(t.dataLength+=n.length)}),await r,t}async concat(){if(this[K])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Ct]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,r)=>{this.on(M,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[ct]=!1;let t=!1,r=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return r();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[Kt])return r();let o,i,a=p=>{this.off("data",c),this.off("end",l),this.off(M,u),r(),i(p)},c=p=>{this.off("error",a),this.off("end",l),this.off(M,u),this.pause(),o({value:p,done:!!this[Kt]})},l=()=>{this.off("error",a),this.off("data",c),this.off(M,u),r(),o({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((p,d)=>{i=d,o=p,this.once(M,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ct]=!1;let t=!1,r=()=>(this.pause(),this.off(mo,r),this.off(M,r),this.off("end",r),t=!0,{done:!0,value:void 0}),n=()=>{if(t)return r();let s=this.read();return s===null?r():{done:!1,value:s}};return this.once("end",r),this.once(mo,r),this.once(M,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(t){if(this[M])return t?this.emit("error",t):this.emit(M),this;this[M]=!0,this[ct]=!0,this[G].length=0,this[H]=0;let r=this;return typeof r.close=="function"&&!this[In]&&r.close(),t?this.emit("error",t):this.emit(M),this}static get isStream(){return mm}};var Em=It.realpathSync.native,Gr={lstatSync:It.lstatSync,readdir:It.readdir,readdirSync:It.readdirSync,readlinkSync:It.readlinkSync,realpathSync:Em,promises:{lstat:le.lstat,readdir:le.readdir,readlink:le.readlink,realpath:le.realpath}},lc=e=>!e||e===Gr||e===km?Gr:{...Gr,...e,promises:{...Gr.promises,...e.promises||{}}},uc=/^\\\\\?\\([a-z]:)\\?$/i,Sm=e=>e.replace(/\//g,"\\").replace(uc,"$1\\"),Fm=/[\\\/]/,Dt=0,pc=1,fc=2,Rt=4,dc=6,hc=8,xe=10,mc=12,gt=15,Wr=~gt,bo=16,sc=32,Hr=64,bt=128,jn=256,Ln=512,oc=Hr|bt|Ln,Tm=1023,xo=e=>e.isFile()?hc:e.isDirectory()?Rt:e.isSymbolicLink()?xe:e.isCharacterDevice()?fc:e.isBlockDevice()?dc:e.isSocket()?mc:e.isFIFO()?pc:Dt,ic=new Ce({max:2**12}),Ur=e=>{let t=ic.get(e);if(t)return t;let r=e.normalize("NFKD");return ic.set(e,r),r},ac=new Ce({max:2**12}),_n=e=>{let t=ac.get(e);if(t)return t;let r=Ur(e.toLowerCase());return ac.set(e,r),r},Wn=class extends Ce{constructor(){super({max:256})}},vo=class extends Ce{constructor(t=16*1024){super({maxSize:t,sizeCalculation:r=>r.length+1})}},gc=Symbol("PathScurry setAsCwd"),J=class{name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#o;get mode(){return this.#o}#s;get nlink(){return this.#s}#i;get uid(){return this.#i}#C;get gid(){return this.#C}#D;get rdev(){return this.#D}#u;get blksize(){return this.#u}#a;get ino(){return this.#a}#f;get size(){return this.#f}#p;get blocks(){return this.#p}#c;get atimeMs(){return this.#c}#n;get mtimeMs(){return this.#n}#d;get ctimeMs(){return this.#d}#b;get birthtimeMs(){return this.#b}#w;get atime(){return this.#w}#h;get mtime(){return this.#h}#T;get ctime(){return this.#T}#m;get birthtime(){return this.#m}#k;#E;#g;#y;#x;#S;#e;#O;#I;#F;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,r=Dt,n,s,o,i,a){this.name=t,this.#k=o?_n(t):Ur(t),this.#e=r&Tm,this.nocase=o,this.roots=s,this.root=n||this,this.#O=i,this.#g=a.fullpath,this.#x=a.relative,this.#S=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=lc(a.fs)}depth(){return this.#E!==void 0?this.#E:this.parent?this.#E=this.parent.depth()+1:this.#E=0}childrenCache(){return this.#O}resolve(t){if(!t)return this;let r=this.getRootString(t),s=t.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#N(s):this.#N(s)}#N(t){let r=this;for(let n of t)r=r.child(n);return r}children(){let t=this.#O.get(this);if(t)return t;let r=Object.assign([],{provisional:0});return this.#O.set(this,r),this.#e&=~bo,r}child(t,r){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let n=this.children(),s=this.nocase?_n(t):Ur(t);for(let c of n)if(c.#k===s)return c;let o=this.parent?this.sep:"",i=this.#g?this.#g+o+t:void 0,a=this.newChild(t,Dt,{...r,parent:this,fullpath:i});return this.canReaddir()||(a.#e|=bt),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#x!==void 0)return this.#x;let t=this.name,r=this.parent;if(!r)return this.#x=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let t=this.name,r=this.parent;if(!r)return this.#S=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+t}fullpath(){if(this.#g!==void 0)return this.#g;let t=this.name,r=this.parent;if(!r)return this.#g=this.name;let s=r.fullpath()+(r.parent?this.sep:"")+t;return this.#g=s}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#y=`//?/${s}`:this.#y=s}let t=this.parent,r=t.fullpathPosix(),n=r+(!r||!t.parent?"":"/")+this.name;return this.#y=n}isUnknown(){return(this.#e&gt)===Dt}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.#e&gt)===hc}isDirectory(){return(this.#e&gt)===Rt}isCharacterDevice(){return(this.#e&gt)===fc}isBlockDevice(){return(this.#e&gt)===dc}isFIFO(){return(this.#e&gt)===pc}isSocket(){return(this.#e&gt)===mc}isSymbolicLink(){return(this.#e&xe)===xe}lstatCached(){return this.#e&sc?this:void 0}readlinkCached(){return this.#I}realpathCached(){return this.#F}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#I)return!0;if(!this.parent)return!1;let t=this.#e&gt;return!(t!==Dt&&t!==xe||this.#e&jn||this.#e&bt)}calledReaddir(){return!!(this.#e&bo)}isENOENT(){return!!(this.#e&bt)}isNamed(t){return this.nocase?this.#k===_n(t):this.#k===Ur(t)}async readlink(){let t=this.#I;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#I=n}catch(r){this.#R(r.code);return}}readlinkSync(){let t=this.#I;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#I=n}catch(r){this.#R(r.code);return}}#j(t){this.#e|=bo;for(let r=t.provisional;r<t.length;r++){let n=t[r];n&&n.#v()}}#v(){this.#e&bt||(this.#e=(this.#e|bt)&Wr,this.#U())}#U(){let t=this.children();t.provisional=0;for(let r of t)r.#v()}#B(){this.#e|=Ln,this.#M()}#M(){if(this.#e&Hr)return;let t=this.#e;(t&gt)===Rt&&(t&=Wr),this.#e=t|Hr,this.#U()}#_(t=""){t==="ENOTDIR"||t==="EPERM"?this.#M():t==="ENOENT"?this.#v():this.children().provisional=0}#P(t=""){t==="ENOTDIR"?this.parent.#M():t==="ENOENT"&&this.#v()}#R(t=""){let r=this.#e;r|=jn,t==="ENOENT"&&(r|=bt),(t==="EINVAL"||t==="UNKNOWN")&&(r&=Wr),this.#e=r,t==="ENOTDIR"&&this.parent&&this.parent.#M()}#L(t,r){return this.#G(t,r)||this.#W(t,r)}#W(t,r){let n=xo(t),s=this.newChild(t.name,n,{parent:this}),o=s.#e&gt;return o!==Rt&&o!==xe&&o!==Dt&&(s.#e|=Hr),r.unshift(s),r.provisional++,s}#G(t,r){for(let n=r.provisional;n<r.length;n++){let s=r[n];if((this.nocase?_n(t.name):Ur(t.name))===s.#k)return this.#l(t,s,n,r)}}#l(t,r,n,s){let o=r.name;return r.#e=r.#e&Wr|xo(t),o!==t.name&&(r.name=t.name),n!==s.provisional&&(n===s.length-1?s.pop():s.splice(n,1),s.unshift(r)),s.provisional++,r}async lstat(){if((this.#e&bt)===0)try{return this.#H(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#P(t.code)}}lstatSync(){if((this.#e&bt)===0)try{return this.#H(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#P(t.code)}}#H(t){let{atime:r,atimeMs:n,birthtime:s,birthtimeMs:o,blksize:i,blocks:a,ctime:c,ctimeMs:l,dev:u,gid:p,ino:d,mode:f,mtime:m,mtimeMs:h,nlink:D,rdev:g,size:y,uid:x}=t;this.#w=r,this.#c=n,this.#m=s,this.#b=o,this.#u=i,this.#p=a,this.#T=c,this.#d=l,this.#r=u,this.#C=p,this.#a=d,this.#o=f,this.#h=m,this.#n=h,this.#s=D,this.#D=g,this.#f=y,this.#i=x;let C=xo(t);this.#e=this.#e&Wr|C|sc,C!==Dt&&C!==Rt&&C!==xe&&(this.#e|=Hr)}#$=[];#A=!1;#z(t){this.#A=!1;let r=this.#$.slice();this.#$.length=0,r.forEach(n=>n(null,t))}readdirCB(t,r=!1){if(!this.canReaddir()){r?t(null,[]):queueMicrotask(()=>t(null,[]));return}let n=this.children();if(this.calledReaddir()){let o=n.slice(0,n.provisional);r?t(null,o):queueMicrotask(()=>t(null,o));return}if(this.#$.push(t),this.#A)return;this.#A=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(o,i)=>{if(o)this.#_(o.code),n.provisional=0;else{for(let a of i)this.#L(a,n);this.#j(n)}this.#z(n.slice(0,n.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();if(this.#K)await this.#K;else{let n=()=>{};this.#K=new Promise(s=>n=s);try{for(let s of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#L(s,t);this.#j(t)}catch(s){this.#_(s.code),t.provisional=0}this.#K=void 0,n()}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 r=this.fullpath();try{for(let n of this.#t.readdirSync(r,{withFileTypes:!0}))this.#L(n,t);this.#j(t)}catch(n){this.#_(n.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#e&oc)return!1;let t=gt&this.#e;return t===Dt||t===Rt||t===xe}shouldWalk(t,r){return(this.#e&Rt)===Rt&&!(this.#e&oc)&&!t.has(this)&&(!r||r(this))}async realpath(){if(this.#F)return this.#F;if(!((Ln|jn|bt)&this.#e))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#F=this.resolve(t)}catch{this.#B()}}realpathSync(){if(this.#F)return this.#F;if(!((Ln|jn|bt)&this.#e))try{let t=this.#t.realpathSync(this.fullpath());return this.#F=this.resolve(t)}catch{this.#B()}}[gc](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],s=this;for(;s&&s.parent;)r.add(s),s.#x=n.join(this.sep),s.#S=n.join("/"),s=s.parent,n.push("..");for(s=t;s&&s.parent&&!r.has(s);)s.#x=void 0,s.#S=void 0,s=s.parent}},Gn=class e extends J{sep="\\";splitSep=Fm;constructor(t,r=Dt,n,s,o,i,a){super(t,r,n,s,o,i,a)}newChild(t,r=Dt,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(t){return We.win32.parse(t).root}getRoot(t){if(t=Sm(t.toUpperCase()),t===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(t,r))return this.roots[t]=n;return this.roots[t]=new Ge(t,this).root}sameRoot(t,r=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(uc,"$1\\"),t===r}},Hn=class e extends J{splitSep="/";sep="/";constructor(t,r=Dt,n,s,o,i,a){super(t,r,n,s,o,i,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,r=Dt,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Un=class{root;rootPath;roots;cwd;#t;#r;#o;nocase;#s;constructor(t=process.cwd(),r,n,{nocase:s,childrenCacheSize:o=16*1024,fs:i=Gr}={}){this.#s=lc(i),(t instanceof URL||t.startsWith("file://"))&&(t=(0,cc.fileURLToPath)(t));let a=r.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new Wn,this.#r=new Wn,this.#o=new vo(o);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#s),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,p=r.sep,d=this.rootPath,f=!1;for(let m of c){let h=u--;l=l.child(m,{relative:new Array(h).fill("..").join(p),relativePosix:new Array(h).fill("..").join("/"),fullpath:d+=(f?"":p)+m}),f=!0}this.cwd=l}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#o}resolve(...t){let r="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(!(!i||i===".")&&(r=r?`${i}/${r}`:i,this.isAbsolute(i)))break}let n=this.#t.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpath();return this.#t.set(r,s),s}resolvePosix(...t){let r="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(!(!i||i===".")&&(r=r?`${i}/${r}`:i,this.isAbsolute(i)))break}let n=this.#r.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,s),s}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,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n}=r;if(t.canReaddir()){let s=await t.readdir();return n?s:s.map(o=>o.name)}else return[]}readdirSync(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0}=r;return t.canReaddir()?n?t.readdirSync():t.readdirSync().map(s=>s.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:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=await t.readlink();return r?n:n?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=t.readlinkSync();return r?n:n?.fullpath()}async realpath(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=await t.realpath();return r?n:n?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=t.realpathSync();return r?n:n?.fullpath()}async walk(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=[];(!o||o(t))&&a.push(n?t:t.fullpath());let c=new Set,l=(p,d)=>{c.add(p),p.readdirCB((f,m)=>{if(f)return d(f);let h=m.length;if(!h)return d();let D=()=>{--h===0&&d()};for(let g of m)(!o||o(g))&&a.push(n?g:g.fullpath()),s&&g.isSymbolicLink()?g.realpath().then(y=>y?.isUnknown()?y.lstat():y).then(y=>y?.shouldWalk(c,i)?l(y,D):D()):g.shouldWalk(c,i)?l(g,D):D()},!0)},u=t;return new Promise((p,d)=>{l(u,f=>{if(f)return d(f);p(a)})})}walkSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=[];(!o||o(t))&&a.push(n?t:t.fullpath());let c=new Set([t]);for(let l of c){let u=l.readdirSync();for(let p of u){(!o||o(p))&&a.push(n?p:p.fullpath());let d=p;if(p.isSymbolicLink()){if(!(s&&(d=p.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,i)&&c.add(d)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,r={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd),this.stream(t,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r;(!o||o(t))&&(yield n?t:t.fullpath());let a=new Set([t]);for(let c of a){let l=c.readdirSync();for(let u of l){(!o||o(u))&&(yield n?u:u.fullpath());let p=u;if(u.isSymbolicLink()){if(!(s&&(p=u.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(a,i)&&a.add(p)}}}stream(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=new ce({objectMode:!0});(!o||o(t))&&a.write(n?t:t.fullpath());let c=new Set,l=[t],u=0,p=()=>{let d=!1;for(;!d;){let f=l.shift();if(!f){u===0&&a.end();return}u++,c.add(f);let m=(D,g,y=!1)=>{if(D)return a.emit("error",D);if(s&&!y){let x=[];for(let C of g)C.isSymbolicLink()&&x.push(C.realpath().then(A=>A?.isUnknown()?A.lstat():A));if(x.length){Promise.all(x).then(()=>m(null,g,!0));return}}for(let x of g)x&&(!o||o(x))&&(a.write(n?x:x.fullpath())||(d=!0));u--;for(let x of g){let C=x.realpathCached()||x;C.shouldWalk(c,i)&&l.push(C)}d&&!a.flowing?a.once("drain",p):h||p()},h=!0;f.readdirCB(m,!0),h=!1}};return p(),a}streamSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=new ce({objectMode:!0}),c=new Set;(!o||o(t))&&a.write(n?t:t.fullpath());let l=[t],u=0,p=()=>{let d=!1;for(;!d;){let f=l.shift();if(!f){u===0&&a.end();return}u++,c.add(f);let m=f.readdirSync();for(let h of m)(!o||o(h))&&(a.write(n?h:h.fullpath())||(d=!0));u--;for(let h of m){let D=h;if(h.isSymbolicLink()){if(!(s&&(D=h.realpathSync())))continue;D.isUnknown()&&D.lstatSync()}D.shouldWalk(c,i)&&l.push(D)}}d&&!a.flowing&&a.once("drain",p)};return p(),a}chdir(t=this.cwd){let r=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[gc](r)}},Ge=class extends Un{sep="\\";constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,We.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(t){return We.win32.parse(t).root.toUpperCase()}newRoot(t){return new Gn(this.rootPath,Rt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},He=class extends Un{sep="/";constructor(t=process.cwd(),r={}){let{nocase:n=!1}=r;super(t,We.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(t){return"/"}newRoot(t){return new Hn(this.rootPath,Rt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},zr=class extends He{constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,{...r,nocase:n})}},Dx=process.platform==="win32"?Gn:Hn,Dc=process.platform==="win32"?Ge:process.platform==="darwin"?zr:He;var Am=e=>e.length>=1,Pm=e=>e.length>=1,Ue=class e{#t;#r;#o;length;#s;#i;#C;#D;#u;#a;#f=!0;constructor(t,r,n,s){if(!Am(t))throw new TypeError("empty pattern list");if(!Pm(r))throw new TypeError("empty glob list");if(r.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#r=r,this.#o=n,this.#s=s,this.#o===0){if(this.isUNC()){let[o,i,a,c,...l]=this.#t,[u,p,d,f,...m]=this.#r;l[0]===""&&(l.shift(),m.shift());let h=[o,i,a,c,""].join("/"),D=[u,p,d,f,""].join("/");this.#t=[h,...l],this.#r=[D,...m],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[o,...i]=this.#t,[a,...c]=this.#r;i[0]===""&&(i.shift(),c.shift());let l=o+"/",u=a+"/";this.#t=[l,...i],this.#r=[u,...c],this.length=this.#t.length}}}pattern(){return this.#t[this.#o]}isString(){return typeof this.#t[this.#o]=="string"}isGlobstar(){return this.#t[this.#o]===U}isRegExp(){return this.#t[this.#o]instanceof RegExp}globString(){return this.#C=this.#C||(this.#o===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#o).join("/"))}hasMore(){return this.length>this.#o+1}rest(){return this.#i!==void 0?this.#i:this.hasMore()?(this.#i=new e(this.#t,this.#r,this.#o+1,this.#s),this.#i.#a=this.#a,this.#i.#u=this.#u,this.#i.#D=this.#D,this.#i):this.#i=null}isUNC(){let t=this.#t;return this.#u!==void 0?this.#u:this.#u=this.#s==="win32"&&this.#o===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#D!==void 0?this.#D:this.#D=this.#s==="win32"&&this.#o===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#a!==void 0?this.#a:this.#a=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#o===0?t:""}checkFollowGlobstar(){return!(this.#o===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#o===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}};var Rm=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ze=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:r,nocase:n,noext:s,noglobstar:o,platform:i=Rm}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=i,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:s,noglobstar:o,optimizationLevel:2,platform:i,nocomment:!0,nonegate:!0};for(let a of t)this.add(a)}add(t){let r=new at(t,this.mmopts);for(let n=0;n<r.set.length;n++){let s=r.set[n],o=r.globParts[n];if(!s||!o)throw new Error("invalid pattern object");for(;s[0]==="."&&o[0]===".";)s.shift(),o.shift();let i=new Ue(s,o,0,this.platform),a=new at(i.globString(),this.mmopts),c=o[o.length-1]==="**",l=i.isAbsolute();l?this.absolute.push(a):this.relative.push(a),c&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(t){let r=t.fullpath(),n=`${r}/`,s=t.relative()||".",o=`${s}/`;for(let i of this.relative)if(i.match(s)||i.match(o))return!0;for(let i of this.absolute)if(i.match(r)||i.match(n))return!0;return!1}childrenIgnored(t){let r=t.fullpath()+"/",n=(t.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(n))return!0;for(let s of this.absoluteChildren)if(s.match(r))return!0;return!1}};var ko=class e{store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,r){return this.store.get(t.fullpath())?.has(r.globString())}storeWalked(t,r){let n=t.fullpath(),s=this.store.get(n);s?s.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},Eo=class{store=new Map;add(t,r,n){let s=(r?2:0)|(n?1:0),o=this.store.get(t);this.store.set(t,o===void 0?s:s&o)}entries(){return[...this.store.entries()].map(([t,r])=>[t,!!(r&2),!!(r&1)])}},So=class{store=new Map;add(t,r){if(!t.canReaddir())return;let n=this.store.get(t);n?n.find(s=>s.globString()===r.globString())||n.push(r):this.store.set(t,[r])}get(t){let r=this.store.get(t);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},Kr=class e{hasWalkedCache;matches=new Eo;subwalks=new So;patterns;follow;dot;opts;constructor(t,r){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=r?r.copy():new ko}processPatterns(t,r){this.patterns=r;let n=r.map(s=>[t,s]);for(let[s,o]of n){this.hasWalkedCache.storeWalked(s,o);let i=o.root(),a=o.isAbsolute()&&this.opts.absolute!==!1;if(i){s=s.resolve(i==="/"&&this.opts.root!==void 0?this.opts.root:i);let p=o.rest();if(p)o=p;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let c,l,u=!1;for(;typeof(c=o.pattern())=="string"&&(l=o.rest());)s=s.resolve(c),o=l,u=!0;if(c=o.pattern(),l=o.rest(),u){if(this.hasWalkedCache.hasWalked(s,o))continue;this.hasWalkedCache.storeWalked(s,o)}if(typeof c=="string"){let p=c===".."||c===""||c===".";this.matches.add(s.resolve(c),a,p);continue}else if(c===U){(!s.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(s,o);let p=l?.pattern(),d=l?.rest();if(!l||(p===""||p===".")&&!d)this.matches.add(s,a,p===""||p===".");else if(p===".."){let f=s.parent||s;d?this.hasWalkedCache.hasWalked(f,d)||this.subwalks.add(f,d):this.matches.add(f,a,!0)}}else c instanceof RegExp&&this.subwalks.add(s,o)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,r){let n=this.subwalks.get(t),s=this.child();for(let o of r)for(let i of n){let a=i.isAbsolute(),c=i.pattern(),l=i.rest();c===U?s.testGlobstar(o,i,l,a):c instanceof RegExp?s.testRegExp(o,c,l,a):s.testString(o,c,l,a)}return s}testGlobstar(t,r,n,s){if((this.dot||!t.name.startsWith("."))&&(r.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,r):t.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(t,n):r.markFollowGlobstar()&&this.subwalks.add(t,r)))),n){let o=n.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,n.rest(),s);else if(o===".."){let i=t.parent||t;this.subwalks.add(i,n)}else o instanceof RegExp&&this.testRegExp(t,o,n.rest(),s)}}testRegExp(t,r,n,s){r.test(t.name)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}testString(t,r,n,s){t.isNamed(r)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}};var Im=(e,t)=>typeof e=="string"?new ze([e],t):Array.isArray(e)?new ze(e,t):e,zn=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#o;signal;maxDepth;includeChildMatches;constructor(t,r,n){if(this.patterns=t,this.path=r,this.opts=n,this.#o=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=Im(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#s(t){return this.seen.has(t)||!!this.#r?.ignored?.(t)}#i(t){return!!this.#r?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||await t.realpath(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let i=await o.realpath();i&&(i.isUnknown()||this.opts.stat)&&await i.lstat()}return this.matchCheckTest(o,r)}matchCheckTest(t,r){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!r||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#s(t)?t:void 0}matchCheckSync(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||t.realpathSync(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let i=o.realpathSync();i&&(i?.isUnknown()||this.opts.stat)&&i.lstatSync()}return this.matchCheckTest(o,r)}matchFinish(t,r){if(this.#s(t))return;if(!this.includeChildMatches&&this.#r?.add){let o=`${t.relativePosix()}/**`;this.#r.add(o)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#o:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(n){let o=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(o+s)}else{let o=this.opts.posix?t.relativePosix():t.relative(),i=this.opts.dotRelative&&!o.startsWith(".."+this.#o)?"."+this.#o:"";this.matchEmit(o?i+o+s:"."+s)}}async match(t,r,n){let s=await this.matchCheck(t,n);s&&this.matchFinish(s,r)}matchSync(t,r,n){let s=this.matchCheckSync(t,n);s&&this.matchFinish(s,r)}walkCB(t,r,n){this.signal?.aborted&&n(),this.walkCB2(t,r,new Kr(this.opts),n)}walkCB2(t,r,n,s){if(this.#i(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(t,r,n,s));return}n.processPatterns(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||(o++,this.match(a,c,l).then(()=>i()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;o++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,i):a.readdirCB((l,u)=>this.walkCB3(a,u,n,i),!0)}i()}walkCB3(t,r,n,s){n=n.filterEntries(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||(o++,this.match(a,c,l).then(()=>i()));for(let[a,c]of n.subwalks.entries())o++,this.walkCB2(a,c,n.child(),i);i()}walkCBSync(t,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(t,r,new Kr(this.opts),n)}walkCB2Sync(t,r,n,s){if(this.#i(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(t,r,n,s));return}n.processPatterns(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;o++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,i)}i()}walkCB3Sync(t,r,n,s){n=n.filterEntries(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())o++,this.walkCB2Sync(a,c,n.child(),i);i()}},Jr=class extends zn{matches=new Set;constructor(t,r,n){super(t,r,n)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},qr=class extends zn{results;constructor(t,r,n){super(t,r,n),this.results=new ce({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 Nm=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,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,yc.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=t,this.platform=r.platform||Nm,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=r.platform==="win32"?Ge:r.platform==="darwin"?zr:r.platform?He:Dc;this.scurry=new c(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",s={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},o=this.pattern.map(c=>new at(c,s)),[i,a]=o.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=i.map((c,l)=>{let u=a[l];if(!u)throw new Error("invalid pattern object");return new Ue(c,u,0,this.platform)})}async walk(){return[...await new Jr(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 Jr(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 qr(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 qr(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 Fo=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let r of e)if(new at(r,t).hasMagic())return!0;return!1};function Jn(e,t={}){return new xt(e,t).streamSync()}function Cc(e,t={}){return new xt(e,t).stream()}function qn(e,t={}){return new xt(e,t).walkSync()}async function wc(e,t={}){return new xt(e,t).walk()}function Vn(e,t={}){return new xt(e,t).iterateSync()}function bc(e,t={}){return new xt(e,t).iterate()}var Om=Jn,Mm=Object.assign(Cc,{sync:Jn}),$m=Vn,Bm=Object.assign(bc,{sync:Vn}),jm=Object.assign(qn,{stream:Jn,iterate:Vn}),Kn=Object.assign(wc,{glob:wc,globSync:qn,sync:jm,globStream:Cc,stream:Mm,globStreamSync:Jn,streamSync:Om,globIterate:bc,iterate:Bm,globIterateSync:Vn,iterateSync:$m,Glob:xt,hasMagic:Fo,escape:Be,unescape:wt});Kn.glob=Kn;var ue=(e,t)=>typeof e>"u"||typeof e===t,xc=e=>!!e&&typeof e=="object"&&ue(e.preserveRoot,"boolean")&&ue(e.tmp,"string")&&ue(e.maxRetries,"number")&&ue(e.retryDelay,"number")&&ue(e.backoff,"number")&&ue(e.maxBackoff,"number")&&(ue(e.glob,"boolean")||e.glob&&typeof e.glob=="object")&&ue(e.filter,"function"),vc=e=>{if(!xc(e))throw new Error("invalid rimraf options")},kc=e=>{vc(e);let{glob:t,...r}=e;if(!t)return r;let n=t===!0?e.signal?{signal:e.signal}:{}:e.signal?{signal:e.signal,...t}:t;return{...r,glob:{...n,absolute:!0,withFileTypes:!1}}},Ec=(e={})=>kc(e),Sc=(e={})=>kc(e);var Vr=require("path"),Fc=require("util"),_m=(e,t={})=>{let r=typeof e;if(r!=="string"){let s=e&&r==="object"&&e.constructor,i=`The "path" argument must be of type string. Received ${s&&s.name?`an instance of ${s.name}`:r==="object"?(0,Fc.inspect)(e):`type ${r} ${e}`}`;throw Object.assign(new TypeError(i),{path:e,code:"ERR_INVALID_ARG_TYPE"})}if(/\0/.test(e)){let s="path must be a string without null bytes";throw Object.assign(new TypeError(s),{path:e,code:"ERR_INVALID_ARG_VALUE"})}e=(0,Vr.resolve)(e);let{root:n}=(0,Vr.parse)(e);if(e===n&&t.preserveRoot!==!1){let s="refusing to remove root directory without preserveRoot:false";throw Object.assign(new Error(s),{path:e,code:"ERR_PRESERVE_ROOT"})}if(process.platform==="win32"){let s=/[*|"<>?:]/,{root:o}=(0,Vr.parse)(e);if(s.test(e.substring(o.length)))throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}return e},Yr=_m;var Tc=require("fs"),Nt=b(require("fs/promises"),1),k=require("fs"),Ac=e=>(0,Tc.readdirSync)(e,{withFileTypes:!0}),st={chmod:Nt.default.chmod,mkdir:Nt.default.mkdir,readdir:e=>Nt.default.readdir(e,{withFileTypes:!0}),rename:Nt.default.rename,rm:Nt.default.rm,rmdir:Nt.default.rmdir,stat:Nt.default.stat,lstat:Nt.default.lstat,unlink:Nt.default.unlink};var qe=require("path");var{readdir:Lm}=st,Ke=e=>Lm(e).catch(t=>t),Je=e=>{try{return Ac(e)}catch(t){return t}};var Pc=e=>!!e&&typeof e=="object",To=(e,t)=>t in e&&typeof e[t]=="string",Ao=e=>Pc(e)&&To(e,"code")&&To(e,"path"),I=e=>Pc(e)&&To(e,"code")?e.code:null;var Q=async(e,t)=>e.catch(r=>{if(I(r)!=="ENOENT")throw t??r}),tt=(e,t)=>{try{return e()}catch(r){if(I(r)==="ENOENT")return;throw t??r}};var{lstat:Wm,rmdir:Gm,unlink:Hm}=st,Yn=async(e,t)=>(t?.signal?.throwIfAborted(),await Q(Wm(e).then(r=>Rc(e,t,r)))??!0),Zn=(e,t)=>(t?.signal?.throwIfAborted(),tt(()=>Ic(e,t,(0,k.lstatSync)(e)))??!0),Rc=async(e,t,r)=>{t?.signal?.throwIfAborted();let n=r.isDirectory()?await Ke(e):null;if(!Array.isArray(n)){if(n){if(I(n)==="ENOENT")return!0;if(I(n)!=="ENOTDIR")throw n}return t.filter&&!await t.filter(e,r)?!1:(await Q(Hm(e)),!0)}return!(await Promise.all(n.map(o=>Rc((0,qe.resolve)(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===(0,qe.parse)(e).root||t.filter&&!await t.filter(e,r)?!1:(await Q(Gm(e)),!0)},Ic=(e,t,r)=>{t?.signal?.throwIfAborted();let n=r.isDirectory()?Je(e):null;if(!Array.isArray(n)){if(n){if(I(n)==="ENOENT")return!0;if(I(n)!=="ENOTDIR")throw n}return t.filter&&!t.filter(e,r)?!1:(tt(()=>(0,k.unlinkSync)(e)),!0)}let s=!0;for(let o of n){let i=(0,qe.resolve)(e,o.name);s=Ic(i,t,o)&&s}return t.preserveRoot===!1&&e===(0,qe.parse)(e).root||!s||t.filter&&!t.filter(e,r)?!1:(tt(()=>(0,k.rmdirSync)(e)),!0)};var Ve=require("path");var{chmod:Um}=st,Zr=e=>async t=>{try{return void await Q(e(t))}catch(r){if(I(r)==="EPERM")return await Q(Um(t,438).then(()=>!0),r)?void await e(t):void 0;throw r}},Xr=e=>t=>{try{return void tt(()=>e(t))}catch(r){if(I(r)==="EPERM")return tt(()=>((0,k.chmodSync)(t,438),!0),r)?void e(t):void 0;throw r}};var Nc=require("timers/promises");var zm=200,Km=1.2,Oc=10,Mc=new Set(["EMFILE","ENFILE","EBUSY"]),Po=e=>{let t=async(r,n,s=1,o=0)=>{let i=n.maxBackoff||zm,a=n.backoff||Km,c=n.maxRetries||Oc,l=0;for(;;)try{return await e(r)}catch(u){if(Ao(u)&&u.path===r&&Mc.has(u.code)){if(s=Math.ceil(s*a),o=s+o,o<i)return await(0,Nc.setTimeout)(s),t(r,n,s,o);if(l<c){l++;continue}}throw u}};return t},Ro=e=>(r,n)=>{let s=n.maxRetries||Oc,o=0;for(;;)try{return e(r)}catch(i){if(Ao(i)&&i.path===r&&Mc.has(i.code)&&o<s){o++;continue}throw i}};var yt=require("path");var Qr=require("os"),pe=require("path");var{stat:Jm}=st,qm=e=>{try{return(0,k.statSync)(e).isDirectory()}catch{return!1}},Vm=e=>Jm(e).then(t=>t.isDirectory(),()=>!1),Ym=async e=>{let{root:t}=(0,pe.parse)(e),r=(0,Qr.tmpdir)(),{root:n}=(0,pe.parse)(r);if(t.toLowerCase()===n.toLowerCase())return r;let s=(0,pe.resolve)(t,"/temp");return await Vm(s)?s:t},Zm=e=>{let{root:t}=(0,pe.parse)(e),r=(0,Qr.tmpdir)(),{root:n}=(0,pe.parse)(r);if(t.toLowerCase()===n.toLowerCase())return r;let s=(0,pe.resolve)(t,"/temp");return qm(s)?s:t},Xm=async()=>(0,Qr.tmpdir)(),Qm=()=>(0,Qr.tmpdir)(),$c=process.platform==="win32"?Ym:Xm,Bc=process.platform==="win32"?Zm:Qm;var{lstat:tg,rename:eg,unlink:rg,rmdir:ng}=st,Lc=e=>`.${(0,yt.basename)(e)}.${Math.random()}`,sg=Zr(rg),og=Xr(k.unlinkSync),Xn=async(e,t)=>(t?.signal?.throwIfAborted(),await Q(tg(e).then(r=>Io(e,t,r)))??!0),Io=async(e,t,r)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return Io(e,{...t,tmp:await $c(e)},r);if(e===t.tmp&&(0,yt.parse)(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let n=r.isDirectory()?await Ke(e):null;if(!Array.isArray(n)){if(n){if(I(n)==="ENOENT")return!0;if(I(n)!=="ENOTDIR")throw n}return t.filter&&!await t.filter(e,r)?!1:(await Q(jc(e,t.tmp,sg)),!0)}return!(await Promise.all(n.map(o=>Io((0,yt.resolve)(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===(0,yt.parse)(e).root||t.filter&&!await t.filter(e,r)?!1:(await Q(jc(e,t.tmp,ng)),!0)},jc=async(e,t,r)=>{let n=(0,yt.resolve)(t,Lc(e));return await eg(e,n),await r(n)},Qn=(e,t)=>(t?.signal?.throwIfAborted(),tt(()=>No(e,t,(0,k.lstatSync)(e)))??!0),No=(e,t,r)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return No(e,{...t,tmp:Bc(e)},r);let n=t.tmp;if(e===t.tmp&&(0,yt.parse)(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let s=r.isDirectory()?Je(e):null;if(!Array.isArray(s)){if(s){if(I(s)==="ENOENT")return!0;if(I(s)!=="ENOTDIR")throw s}return t.filter&&!t.filter(e,r)?!1:(tt(()=>_c(e,n,og)),!0)}let o=!0;for(let i of s){let a=(0,yt.resolve)(e,i.name);o=No(a,t,i)&&o}return!o||t.preserveRoot===!1&&e===(0,yt.parse)(e).root||t.filter&&!t.filter(e,r)?!1:(tt(()=>_c(e,n,k.rmdirSync)),!0)},_c=(e,t,r)=>{let n=(0,yt.resolve)(t,Lc(e));return(0,k.renameSync)(e,n),r(n)};var{unlink:ig,rmdir:ag,lstat:cg}=st,lg=Po(Zr(ig)),ug=Ro(Xr(k.unlinkSync)),pg=Po(Zr(ag)),fg=Ro(Xr(k.rmdirSync)),dg=async(e,{filter:t,...r})=>{r?.signal?.throwIfAborted();try{return await pg(e,r),!0}catch(n){if(I(n)==="ENOTEMPTY")return Xn(e,r);throw n}},hg=(e,{filter:t,...r})=>{r?.signal?.throwIfAborted();try{return fg(e,r),!0}catch(n){if(I(n)==="ENOTEMPTY")return Qn(e,r);throw n}},fe=Symbol("start"),Wc=Symbol("child"),ts=Symbol("finish"),es=async(e,t)=>(t?.signal?.throwIfAborted(),await Q(cg(e).then(r=>Oo(e,t,r,fe)))??!0),rs=(e,t)=>(t?.signal?.throwIfAborted(),tt(()=>Mo(e,t,(0,k.lstatSync)(e),fe))??!0),Oo=async(e,t,r,n=fe)=>{t?.signal?.throwIfAborted();let s=r.isDirectory()?await Ke(e):null;if(!Array.isArray(s)){if(s){if(I(s)==="ENOENT")return!0;if(I(s)!=="ENOTDIR")throw s}return t.filter&&!await t.filter(e,r)?!1:(await Q(lg(e,t)),!0)}let o=n===fe?Wc:n,i=(await Promise.all(s.map(a=>Oo((0,Ve.resolve)(e,a.name),t,a,o)))).every(a=>a===!0);if(n===fe)return Oo(e,t,r,ts);if(n===ts){if(t.preserveRoot===!1&&e===(0,Ve.parse)(e).root||!i||t.filter&&!await t.filter(e,r))return!1;await Q(dg(e,t))}return!0},Mo=(e,t,r,n=fe)=>{let s=r.isDirectory()?Je(e):null;if(!Array.isArray(s)){if(s){if(I(s)==="ENOENT")return!0;if(I(s)!=="ENOTDIR")throw s}return t.filter&&!t.filter(e,r)?!1:(tt(()=>ug(e,t)),!0)}let o=!0;for(let i of s){let a=n===fe?Wc:n,c=(0,Ve.resolve)(e,i.name);o=Mo(c,t,i,a)&&o}if(n===fe)return Mo(e,t,r,ts);if(n===ts){if(t.preserveRoot===!1&&e===(0,Ve.parse)(e).root||!o||t.filter&&!t.filter(e,r))return!1;tt(()=>hg(e,t))}return!0};var $o=process.platform==="win32"?es:Yn,Bo=process.platform==="win32"?rs:Zn;var{rm:mg}=st,jo=async(e,t)=>(await mg(e,{...t,force:!0,recursive:!0}),!0),_o=(e,t)=>((0,k.rmSync)(e,{...t,force:!0,recursive:!0}),!0);var[Gc=0,gg=0]=process.version.replace(/^v/,"").split(".").map(e=>parseInt(e,10)),Hc=Gc>14||Gc===14&&gg>=14,Uc=!Hc||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter,zc=!Hc||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter;var Ye=e=>async(t,r)=>{let n=Ec(r);return n.glob&&(t=await Kn(t,n.glob)),Array.isArray(t)?!!(await Promise.all(t.map(s=>e(Yr(s,n),n)))).reduce((s,o)=>s&&o,!0):!!await e(Yr(t,n),n)},Ze=e=>(t,r)=>{let n=Sc(r);return n.glob&&(t=qn(t,n.glob)),Array.isArray(t)?!!t.map(s=>e(Yr(s,n),n)).reduce((s,o)=>s&&o,!0):!!e(Yr(t,n),n)},qc=Ze(_o),Dg=Object.assign(Ye(jo),{sync:qc}),Vc=Ze(Bo),yg=Object.assign(Ye($o),{sync:Vc}),Yc=Ze(rs),wg=Object.assign(Ye(es),{sync:Yc}),Zc=Ze(Zn),Cg=Object.assign(Ye(Yn),{sync:Zc}),Xc=Ze(Qn),bg=Object.assign(Ye(Xn),{sync:Xc}),Kc=Ze((e,t)=>zc(t)?_o(e,t):Bo(e,t));var Jc=Ye((e,t)=>Uc(t)?jo(e,t):$o(e,t)),ns=Object.assign(Jc,{rimraf:Jc,sync:Kc,rimrafSync:Kc,manual:yg,manualSync:Vc,native:Dg,nativeSync:qc,posix:Cg,posixSync:Zc,windows:wg,windowsSync:Yc,moveRemove:bg,moveRemoveSync:Xc});ns.rimraf=ns;var S=e=>(0,Xe.join)(process.cwd(),e),ss=e=>{try{return(0,Qc.readdirSync)(e).length===0}catch{return!0}};function tl(){let e=Pa({cwd:(0,Xe.dirname)(__filename)});if(!e)throw new Error("Could not find package.json");return(0,Xe.dirname)(e)}var el=e=>ns(e);var rl=b(require("chalk"));async function q(e,t){let r=Date.now(),n=e.title,s=()=>Math.floor((Date.now()-r)/1e3),o=setInterval(()=>{s()>1&&(e.title=`${n} (${s()}s)`)},1e3);try{return await t(s)}finally{clearInterval(o)}}async function os(e,t,r){for(let n=0;n<t.length;n++){let s=t[n];e.output=rl.default.dim(`[${n+1}/${t.length}] ${s.title}`),await s.fn(r??{},e)}}var Qe=e=>{let t=e??O(),r=(0,ot.join)(t,"package.json");if(!(0,vt.existsSync)(r))return null;try{return JSON.parse((0,vt.readFileSync)(r,"utf-8"))}catch{return null}},kt=e=>{let t={services:"services",apps:"apps",packages:"packages",contracts:"packages/contracts"},r=Qe(e);if(!r)return t;let n=r.pf?.paths;return{services:(typeof n?.services=="object"?n.services.path:n?.services)??t.services,apps:(typeof n?.apps=="object"?n.apps.path:n?.apps)??t.apps,packages:(typeof n?.packages=="object"?n.packages.path:n?.packages)??t.packages,contracts:(typeof n?.contracts=="object"?n.contracts.path:n?.contracts)??t.contracts}},$=e=>{let t=e??O(),r=kt(t);return{packagePath:(0,ot.join)(t,r.contracts),eventsPath:(0,ot.join)(t,r.contracts,"src","events"),indexPath:(0,ot.join)(t,r.contracts,"src","index.ts"),relativePath:r.contracts}},xg=e=>{let t=(0,ot.join)(e,"package.json");if(!(0,vt.existsSync)(t))return!1;try{let r=JSON.parse((0,vt.readFileSync)(t,"utf-8"));if(!r.workspaces)return!1;if(r.pf||(0,vt.existsSync)((0,ot.join)(e,"turbo.json")))return!0;let n=Ca.some(o=>(0,vt.existsSync)((0,ot.join)(e,o))),s=(0,vt.existsSync)((0,ot.join)(e,"infra"));return!!(n&&s)}catch{return!1}};function O(){let e=process.cwd();for(;!xg(e);){let t=e.slice(0,e.lastIndexOf("/"));if(t===e)throw new Error(`
16
+ >>> no match, partial?`,t,d,r,f),d===c))}let h;if(typeof u=="string"?(h=p===u,this.debug("string match",u,p,h)):(h=u.test(p),this.debug("pattern match",u,p,h)),!h)return!1}if(i===c&&a===l)return!0;if(i===c)return n;if(a===l)return i===c-1&&t[i]==="";throw new Error("wtf?")}braceExpand(){return Ya(this.pattern,this.options)}parse(t){Mr(t);let r=this.options;if(t==="**")return U;if(t==="")return"";let n,s=null;(n=t.match(Qh))?s=r.dot?em:tm:(n=t.match(Hh))?s=(r.nocase?r.dot?Jh:Kh:r.dot?zh:Uh)(n[1]):(n=t.match(rm))?s=(r.nocase?r.dot?sm:nm:r.dot?om:im)(n):(n=t.match(qh))?s=r.dot?Yh:Vh:(n=t.match(Zh))&&(s=Xh);let o=$e.fromGlob(t,this.options).toMMPattern();return s&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:s}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?lm:r.dot?um:pm,s=new Set(r.nocase?["i"]:[]),o=t.map(c=>{let l=c.map(p=>{if(p instanceof RegExp)for(let d of p.flags.split(""))s.add(d);return typeof p=="string"?gm(p):p===U?U:p._src});l.forEach((p,d)=>{let f=l[d+1],m=l[d-1];p!==U||m===U||(m===void 0?f!==void 0&&f!==U?l[d+1]="(?:\\/|"+n+"\\/)?"+f:l[d]=n:f===void 0?l[d-1]=m+"(?:\\/|\\/"+n+")?":f!==U&&(l[d-1]=m+"(?:\\/|\\/"+n+"\\/)"+f,l[d+1]=U))});let u=l.filter(p=>p!==U);if(this.partial&&u.length>=1){let p=[];for(let d=1;d<=u.length;d++)p.push(u.slice(0,d).join("/"));return"(?:"+p.join("|")+")"}return u.join("/")}).join("|"),[i,a]=t.length>1?["(?:",")"]:["",""];o="^"+i+o+a+"$",this.partial&&(o="^(?:\\/|"+i+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].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,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let i=s[s.length-1];if(!i)for(let a=s.length-2;!i&&a>=0;a--)i=s[a];for(let a=0;a<o.length;a++){let c=o[a],l=s;if(n.matchBase&&c.length===1&&(l=[i]),this.matchOne(l,c,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Z.defaults(t).Minimatch}};Z.AST=$e;Z.Minimatch=at;Z.escape=Be;Z.unescape=wt;var Cc=require("node:url");var Dm=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xa=new Set,ho=typeof process=="object"&&process?process:{},Qa=(e,t,r,n)=>{typeof ho.emitWarning=="function"?ho.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)},In=globalThis.AbortController,Za=globalThis.AbortSignal;if(typeof In>"u"){Za=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,s){this._onabort.push(s)}},In=class{constructor(){t()}signal=new Za;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n)}}};let e=ho.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,Qa("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 ym=e=>!Xa.has(e),gx=Symbol("type"),ie=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),tc=e=>ie(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?je:null:null,je=class extends Array{constructor(t){super(t),this.fill(0)}},mo=class e{heap;length;static#t=!1;static create(t){let r=tc(t);if(!r)return[];e.#t=!0;let n=new e(t,r);return e.#t=!1,n}constructor(t,r){if(!e.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Ce=class e{#t;#r;#o;#s;#i;#C;#D;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#f;#p;#c;#n;#d;#b;#w;#h;#T;#m;#k;#E;#g;#y;#x;#S;#e;#O;static unsafeExposeInternals(t){return{starts:t.#E,ttls:t.#g,autopurgeTimers:t.#y,sizes:t.#k,keyMap:t.#p,keyList:t.#c,valList:t.#n,next:t.#d,prev:t.#b,get head(){return t.#w},get tail(){return t.#h},free:t.#T,isBackgroundFetch:r=>t.#l(r),backgroundFetch:(r,n,s,o)=>t.#G(r,n,s,o),moveToTail:r=>t.#$(r),indexes:r=>t.#P(r),rindexes:r=>t.#R(r),isStale:r=>t.#v(r)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#f}get size(){return this.#a}get fetchMethod(){return this.#C}get memoMethod(){return this.#D}get dispose(){return this.#o}get onInsert(){return this.#s}get disposeAfter(){return this.#i}constructor(t){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:i,updateAgeOnHas:a,allowStale:c,dispose:l,onInsert:u,disposeAfter:p,noDisposeOnSet:d,noUpdateTTL:f,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:D,fetchMethod:g,memoMethod:y,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:dt,ignoreFetchAbort:ne,perf:Ae}=t;if(Ae!==void 0&&typeof Ae?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=Ae??Dm,r!==0&&!ie(r))throw new TypeError("max option must be a nonnegative integer");let Pe=r?tc(r):Array;if(!Pe)throw new Error("invalid max value: "+r);if(this.#t=r,this.#r=m,this.maxEntrySize=h||this.#r,this.sizeCalculation=D,this.sizeCalculation){if(!this.#r&&!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(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#D=y,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#C=g,this.#S=!!g,this.#p=new Map,this.#c=new Array(r).fill(void 0),this.#n=new Array(r).fill(void 0),this.#d=new Pe(r),this.#b=new Pe(r),this.#w=0,this.#h=0,this.#T=mo.create(r),this.#a=0,this.#f=0,typeof l=="function"&&(this.#o=l),typeof u=="function"&&(this.#s=u),typeof p=="function"?(this.#i=p,this.#m=[]):(this.#i=void 0,this.#m=void 0),this.#x=!!this.#o,this.#O=!!this.#s,this.#e=!!this.#i,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!dt,this.ignoreFetchAbort=!!ne,this.maxEntrySize!==0){if(this.#r!==0&&!ie(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!ie(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#U()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!a,this.ttlResolution=ie(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!ie(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}if(this.#t===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){let Re="LRU_CACHE_UNBOUNDED";ym(Re)&&(Xa.add(Re),Qa("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Re,e))}}getRemainingTTL(t){return this.#p.has(t)?1/0:0}#I(){let t=new je(this.#t),r=new je(this.#t);this.#g=t,this.#E=r;let n=this.ttlAutopurge?new Array(this.#t):void 0;this.#y=n,this.#j=(i,a,c=this.#u.now())=>{if(r[i]=a!==0?c:0,t[i]=a,n?.[i]&&(clearTimeout(n[i]),n[i]=void 0),a!==0&&n){let l=setTimeout(()=>{this.#v(i)&&this.#A(this.#c[i],"expire")},a+1);l.unref&&l.unref(),n[i]=l}},this.#F=i=>{r[i]=t[i]!==0?this.#u.now():0},this.#N=(i,a)=>{if(t[a]){let c=t[a],l=r[a];if(!c||!l)return;i.ttl=c,i.start=l,i.now=s||o();let u=i.now-l;i.remainingTTL=c-u}};let s=0,o=()=>{let i=this.#u.now();if(this.ttlResolution>0){s=i;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref()}return i};this.getRemainingTTL=i=>{let a=this.#p.get(i);if(a===void 0)return 0;let c=t[a],l=r[a];if(!c||!l)return 1/0;let u=(s||o())-l;return c-u},this.#v=i=>{let a=r[i],c=t[i];return!!c&&!!a&&(s||o())-a>c}}#F=()=>{};#N=()=>{};#j=()=>{};#v=()=>!1;#U(){let t=new je(this.#t);this.#f=0,this.#k=t,this.#B=r=>{this.#f-=t[r],t[r]=0},this.#_=(r,n,s,o)=>{if(this.#l(n))return 0;if(!ie(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(n,r),!ie(s))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 s},this.#M=(r,n,s)=>{if(t[r]=n,this.#r){let o=this.#r-t[r];for(;this.#f>o;)this.#W(!0)}this.#f+=t[r],s&&(s.entrySize=n,s.totalCalculatedSize=this.#f)}}#B=t=>{};#M=(t,r,n)=>{};#_=(t,r,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#P({allowStale:t=this.allowStale}={}){if(this.#a)for(let r=this.#h;!(!this.#L(r)||((t||!this.#v(r))&&(yield r),r===this.#w));)r=this.#b[r]}*#R({allowStale:t=this.allowStale}={}){if(this.#a)for(let r=this.#w;!(!this.#L(r)||((t||!this.#v(r))&&(yield r),r===this.#h));)r=this.#d[r]}#L(t){return t!==void 0&&this.#p.get(this.#c[t])===t}*entries(){for(let t of this.#P())this.#n[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#n[t])&&(yield[this.#c[t],this.#n[t]])}*rentries(){for(let t of this.#R())this.#n[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#n[t])&&(yield[this.#c[t],this.#n[t]])}*keys(){for(let t of this.#P()){let r=this.#c[t];r!==void 0&&!this.#l(this.#n[t])&&(yield r)}}*rkeys(){for(let t of this.#R()){let r=this.#c[t];r!==void 0&&!this.#l(this.#n[t])&&(yield r)}}*values(){for(let t of this.#P())this.#n[t]!==void 0&&!this.#l(this.#n[t])&&(yield this.#n[t])}*rvalues(){for(let t of this.#R())this.#n[t]!==void 0&&!this.#l(this.#n[t])&&(yield this.#n[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,r={}){for(let n of this.#P()){let s=this.#n[n],o=this.#l(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#c[n],this))return this.get(this.#c[n],r)}}forEach(t,r=this){for(let n of this.#P()){let s=this.#n[n],o=this.#l(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#c[n],this)}}rforEach(t,r=this){for(let n of this.#R()){let s=this.#n[n],o=this.#l(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,this.#c[n],this)}}purgeStale(){let t=!1;for(let r of this.#R({allowStale:!0}))this.#v(r)&&(this.#A(this.#c[r],"expire"),t=!0);return t}info(t){let r=this.#p.get(t);if(r===void 0)return;let n=this.#n[r],s=this.#l(n)?n.__staleWhileFetching:n;if(s===void 0)return;let o={value:s};if(this.#g&&this.#E){let i=this.#g[r],a=this.#E[r];if(i&&a){let c=i-(this.#u.now()-a);o.ttl=c,o.start=Date.now()}}return this.#k&&(o.size=this.#k[r]),o}dump(){let t=[];for(let r of this.#P({allowStale:!0})){let n=this.#c[r],s=this.#n[r],o=this.#l(s)?s.__staleWhileFetching:s;if(o===void 0||n===void 0)continue;let i={value:o};if(this.#g&&this.#E){i.ttl=this.#g[r];let a=this.#u.now()-this.#E[r];i.start=Math.floor(Date.now()-a)}this.#k&&(i.size=this.#k[r]),t.unshift([n,i])}return t}load(t){this.clear();for(let[r,n]of t){if(n.start){let s=Date.now()-n.start;n.start=this.#u.now()-s}this.set(r,n.value,n)}}set(t,r,n={}){if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,u=this.#_(t,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(t,"set"),this;let p=this.#a===0?void 0:this.#p.get(t);if(p===void 0)p=this.#a===0?this.#h:this.#T.length!==0?this.#T.pop():this.#a===this.#t?this.#W(!1):this.#a,this.#c[p]=t,this.#n[p]=r,this.#p.set(t,p),this.#d[this.#h]=p,this.#b[p]=this.#h,this.#h=p,this.#a++,this.#M(p,u,c),c&&(c.set="add"),l=!1,this.#O&&this.#s?.(r,t,"add");else{this.#$(p);let d=this.#n[p];if(r!==d){if(this.#S&&this.#l(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=d;f!==void 0&&!i&&(this.#x&&this.#o?.(f,t,"set"),this.#e&&this.#m?.push([f,t,"set"]))}else i||(this.#x&&this.#o?.(d,t,"set"),this.#e&&this.#m?.push([d,t,"set"]));if(this.#B(p),this.#M(p,u,c),this.#n[p]=r,c){c.set="replace";let f=d&&this.#l(d)?d.__staleWhileFetching:d;f!==void 0&&(c.oldValue=f)}}else c&&(c.set="update");this.#O&&this.onInsert?.(r,t,r===d?"update":"replace")}if(s!==0&&!this.#g&&this.#I(),this.#g&&(l||this.#j(p,s,o),c&&this.#N(c,p)),!i&&this.#e&&this.#m){let d=this.#m,f;for(;f=d?.shift();)this.#i?.(...f)}return this}pop(){try{for(;this.#a;){let t=this.#n[this.#w];if(this.#W(!0),this.#l(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#e&&this.#m){let t=this.#m,r;for(;r=t?.shift();)this.#i?.(...r)}}}#W(t){let r=this.#w,n=this.#c[r],s=this.#n[r];return this.#S&&this.#l(s)?s.__abortController.abort(new Error("evicted")):(this.#x||this.#e)&&(this.#x&&this.#o?.(s,n,"evict"),this.#e&&this.#m?.push([s,n,"evict"])),this.#B(r),this.#y?.[r]&&(clearTimeout(this.#y[r]),this.#y[r]=void 0),t&&(this.#c[r]=void 0,this.#n[r]=void 0,this.#T.push(r)),this.#a===1?(this.#w=this.#h=0,this.#T.length=0):this.#w=this.#d[r],this.#p.delete(n),this.#a--,r}has(t,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=r,o=this.#p.get(t);if(o!==void 0){let i=this.#n[o];if(this.#l(i)&&i.__staleWhileFetching===void 0)return!1;if(this.#v(o))s&&(s.has="stale",this.#N(s,o));else return n&&this.#F(o),s&&(s.has="hit",this.#N(s,o)),!0}else s&&(s.has="miss");return!1}peek(t,r={}){let{allowStale:n=this.allowStale}=r,s=this.#p.get(t);if(s===void 0||!n&&this.#v(s))return;let o=this.#n[s];return this.#l(o)?o.__staleWhileFetching:o}#G(t,r,n,s){let o=r===void 0?void 0:this.#n[r];if(this.#l(o))return o;let i=new In,{signal:a}=n;a?.addEventListener("abort",()=>i.abort(a.reason),{signal:i.signal});let c={signal:i.signal,options:n,context:s},l=(h,D=!1)=>{let{aborted:g}=i.signal,y=n.ignoreFetchAbort&&h!==void 0;if(n.status&&(g&&!D?(n.status.fetchAborted=!0,n.status.fetchError=i.signal.reason,y&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),g&&!y&&!D)return p(i.signal.reason);let x=f,C=this.#n[r];return(C===f||y&&D&&C===void 0)&&(h===void 0?x.__staleWhileFetching!==void 0?this.#n[r]=x.__staleWhileFetching:this.#A(t,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(t,h,c.options))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),p(h)),p=h=>{let{aborted:D}=i.signal,g=D&&n.allowStaleOnFetchAbort,y=g||n.allowStaleOnFetchRejection,x=y||n.noDeleteOnFetchRejection,C=f;if(this.#n[r]===f&&(!x||C.__staleWhileFetching===void 0?this.#A(t,"fetch"):g||(this.#n[r]=C.__staleWhileFetching)),y)return n.status&&C.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),C.__staleWhileFetching;if(C.__returned===C)throw h},d=(h,D)=>{let g=this.#C?.(t,o,c);g&&g instanceof Promise&&g.then(y=>h(y===void 0?void 0:y),D),i.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=y=>l(y,!0)))})};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(l,u),m=Object.assign(f,{__abortController:i,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(t,m,{...c.options,status:void 0}),r=this.#p.get(t)):this.#n[r]=m,m}#l(t){if(!this.#S)return!1;let r=t;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof In}async fetch(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:D=!1,status:g,signal:y}=r;if(!this.#S)return g&&(g.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:g});let x={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:i,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:m,ignoreFetchAbort:f,status:g,signal:y},C=this.#p.get(t);if(C===void 0){g&&(g.fetch="miss");let A=this.#G(t,C,x,h);return A.__returned=A}else{let A=this.#n[C];if(this.#l(A)){let Re=n&&A.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",Re&&(g.returnedStale=!0)),Re?A.__staleWhileFetching:A.__returned=A}let dt=this.#v(C);if(!D&&!dt)return g&&(g.fetch="hit"),this.#$(C),s&&this.#F(C),g&&this.#N(g,C),A;let ne=this.#G(t,C,x,h),Pe=ne.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=dt?"stale":"refresh",Pe&&dt&&(g.returnedStale=!0)),Pe?ne.__staleWhileFetching:ne.__returned=ne}}async forceFetch(t,r={}){let n=await this.fetch(t,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,r={}){let n=this.#D;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...i}=r,a=this.get(t,i);if(!o&&a!==void 0)return a;let c=n(t,a,{options:i,context:s});return this.set(t,c,i),c}get(t,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:i}=r,a=this.#p.get(t);if(a!==void 0){let c=this.#n[a],l=this.#l(c);return i&&this.#N(i,a),this.#v(a)?(i&&(i.get="stale"),l?(i&&n&&c.__staleWhileFetching!==void 0&&(i.returnedStale=!0),n?c.__staleWhileFetching:void 0):(o||this.#A(t,"expire"),i&&n&&(i.returnedStale=!0),n?c:void 0)):(i&&(i.get="hit"),l?c.__staleWhileFetching:(this.#$(a),s&&this.#F(a),c))}else i&&(i.get="miss")}#H(t,r){this.#b[r]=t,this.#d[t]=r}#$(t){t!==this.#h&&(t===this.#w?this.#w=this.#d[t]:this.#H(this.#b[t],this.#d[t]),this.#H(this.#h,t),this.#h=t)}delete(t){return this.#A(t,"delete")}#A(t,r){let n=!1;if(this.#a!==0){let s=this.#p.get(t);if(s!==void 0)if(this.#y?.[s]&&(clearTimeout(this.#y?.[s]),this.#y[s]=void 0),n=!0,this.#a===1)this.#z(r);else{this.#B(s);let o=this.#n[s];if(this.#l(o)?o.__abortController.abort(new Error("deleted")):(this.#x||this.#e)&&(this.#x&&this.#o?.(o,t,r),this.#e&&this.#m?.push([o,t,r])),this.#p.delete(t),this.#c[s]=void 0,this.#n[s]=void 0,s===this.#h)this.#h=this.#b[s];else if(s===this.#w)this.#w=this.#d[s];else{let i=this.#b[s];this.#d[i]=this.#d[s];let a=this.#d[s];this.#b[a]=this.#b[s]}this.#a--,this.#T.push(s)}}if(this.#e&&this.#m?.length){let s=this.#m,o;for(;o=s?.shift();)this.#i?.(...o)}return n}clear(){return this.#z("delete")}#z(t){for(let r of this.#R({allowStale:!0})){let n=this.#n[r];if(this.#l(n))n.__abortController.abort(new Error("deleted"));else{let s=this.#c[r];this.#x&&this.#o?.(n,s,t),this.#e&&this.#m?.push([n,s,t])}}if(this.#p.clear(),this.#n.fill(void 0),this.#c.fill(void 0),this.#g&&this.#E){this.#g.fill(0),this.#E.fill(0);for(let r of this.#y??[])r!==void 0&&clearTimeout(r);this.#y?.fill(void 0)}if(this.#k&&this.#k.fill(0),this.#w=0,this.#h=0,this.#T.length=0,this.#f=0,this.#a=0,this.#e&&this.#m){let r=this.#m,n;for(;n=r?.shift();)this.#i?.(...n)}}};var We=require("node:path"),uc=require("node:url"),It=require("fs"),Tm=b(require("node:fs"),1),le=require("node:fs/promises");var _n=require("node:events"),xo=b(require("node:stream"),1),oc=require("node:string_decoder"),ec=typeof process=="object"&&process?process:{stdout:null,stderr:null},wm=e=>!!e&&typeof e=="object"&&(e instanceof ce||e instanceof xo.default||Cm(e)||bm(e)),Cm=e=>!!e&&typeof e=="object"&&e instanceof _n.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==xo.default.Writable.prototype.pipe,bm=e=>!!e&&typeof e=="object"&&e instanceof _n.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",Kt=Symbol("EOF"),Jt=Symbol("maybeEmitEnd"),ae=Symbol("emittedEnd"),Nn=Symbol("emittingEnd"),Br=Symbol("emittedError"),On=Symbol("closed"),rc=Symbol("read"),Mn=Symbol("flush"),nc=Symbol("flushChunk"),Ct=Symbol("encoding"),_e=Symbol("decoder"),W=Symbol("flowing"),jr=Symbol("paused"),Le=Symbol("resume"),G=Symbol("buffer"),X=Symbol("pipes"),H=Symbol("bufferLength"),go=Symbol("bufferPush"),$n=Symbol("bufferShift"),K=Symbol("objectMode"),M=Symbol("destroyed"),Do=Symbol("error"),yo=Symbol("emitData"),sc=Symbol("emitEnd"),wo=Symbol("emitEnd2"),Pt=Symbol("async"),Co=Symbol("abort"),Bn=Symbol("aborted"),_r=Symbol("signal"),be=Symbol("dataListeners"),ct=Symbol("discarded"),Lr=e=>Promise.resolve().then(e),xm=e=>e(),vm=e=>e==="end"||e==="finish"||e==="prefinish",km=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Em=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),jn=class{src;dest;opts;ondrain;constructor(t,r,n){this.src=t,this.dest=r,this.opts=n,this.ondrain=()=>t[Le](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},bo=class extends jn{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,r,n){super(t,r,n),this.proxyErrors=s=>r.emit("error",s),t.on("error",this.proxyErrors)}},Sm=e=>!!e.objectMode,Fm=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",ce=class extends _n.EventEmitter{[W]=!1;[jr]=!1;[X]=[];[G]=[];[K];[Ct];[Pt];[_e];[Kt]=!1;[ae]=!1;[Nn]=!1;[On]=!1;[Br]=null;[H]=0;[M]=!1;[_r];[Bn]=!1;[be]=0;[ct]=!1;writable=!0;readable=!0;constructor(...t){let r=t[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Sm(r)?(this[K]=!0,this[Ct]=null):Fm(r)?(this[Ct]=r.encoding,this[K]=!1):(this[K]=!1,this[Ct]=null),this[Pt]=!!r.async,this[_e]=this[Ct]?new oc.StringDecoder(this[Ct]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[G]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[X]});let{signal:n}=r;n&&(this[_r]=n,n.aborted?this[Co]():n.addEventListener("abort",()=>this[Co]()))}get bufferLength(){return this[H]}get encoding(){return this[Ct]}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[K]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Pt]}set async(t){this[Pt]=this[Pt]||!!t}[Co](){this[Bn]=!0,this.emit("abort",this[_r]?.reason),this.destroy(this[_r]?.reason)}get aborted(){return this[Bn]}set aborted(t){}write(t,r,n){if(this[Bn])return!1;if(this[Kt])throw new Error("write after end");if(this[M])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let s=this[Pt]?Lr:xm;if(!this[K]&&!Buffer.isBuffer(t)){if(Em(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(km(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[K]?(this[W]&&this[H]!==0&&this[Mn](!0),this[W]?this.emit("data",t):this[go](t),this[H]!==0&&this.emit("readable"),n&&s(n),this[W]):t.length?(typeof t=="string"&&!(r===this[Ct]&&!this[_e]?.lastNeed)&&(t=Buffer.from(t,r)),Buffer.isBuffer(t)&&this[Ct]&&(t=this[_e].write(t)),this[W]&&this[H]!==0&&this[Mn](!0),this[W]?this.emit("data",t):this[go](t),this[H]!==0&&this.emit("readable"),n&&s(n),this[W]):(this[H]!==0&&this.emit("readable"),n&&s(n),this[W])}read(t){if(this[M])return null;if(this[ct]=!1,this[H]===0||t===0||t&&t>this[H])return this[Jt](),null;this[K]&&(t=null),this[G].length>1&&!this[K]&&(this[G]=[this[Ct]?this[G].join(""):Buffer.concat(this[G],this[H])]);let r=this[rc](t||null,this[G][0]);return this[Jt](),r}[rc](t,r){if(this[K])this[$n]();else{let n=r;t===n.length||t===null?this[$n]():typeof n=="string"?(this[G][0]=n.slice(t),r=n.slice(0,t),this[H]-=t):(this[G][0]=n.subarray(t),r=n.subarray(0,t),this[H]-=t)}return this.emit("data",r),!this[G].length&&!this[Kt]&&this.emit("drain"),r}end(t,r,n){return typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r="utf8"),t!==void 0&&this.write(t,r),n&&this.once("end",n),this[Kt]=!0,this.writable=!1,(this[W]||!this[jr])&&this[Jt](),this}[Le](){this[M]||(!this[be]&&!this[X].length&&(this[ct]=!0),this[jr]=!1,this[W]=!0,this.emit("resume"),this[G].length?this[Mn]():this[Kt]?this[Jt]():this.emit("drain"))}resume(){return this[Le]()}pause(){this[W]=!1,this[jr]=!0,this[ct]=!1}get destroyed(){return this[M]}get flowing(){return this[W]}get paused(){return this[jr]}[go](t){this[K]?this[H]+=1:this[H]+=t.length,this[G].push(t)}[$n](){return this[K]?this[H]-=1:this[H]-=this[G][0].length,this[G].shift()}[Mn](t=!1){do;while(this[nc](this[$n]())&&this[G].length);!t&&!this[G].length&&!this[Kt]&&this.emit("drain")}[nc](t){return this.emit("data",t),this[W]}pipe(t,r){if(this[M])return t;this[ct]=!1;let n=this[ae];return r=r||{},t===ec.stdout||t===ec.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&t.end():(this[X].push(r.proxyErrors?new bo(this,t,r):new jn(this,t,r)),this[Pt]?Lr(()=>this[Le]()):this[Le]()),t}unpipe(t){let r=this[X].find(n=>n.dest===t);r&&(this[X].length===1?(this[W]&&this[be]===0&&(this[W]=!1),this[X]=[]):this[X].splice(this[X].indexOf(r),1),r.unpipe())}addListener(t,r){return this.on(t,r)}on(t,r){let n=super.on(t,r);if(t==="data")this[ct]=!1,this[be]++,!this[X].length&&!this[W]&&this[Le]();else if(t==="readable"&&this[H]!==0)super.emit("readable");else if(vm(t)&&this[ae])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Br]){let s=r;this[Pt]?Lr(()=>s.call(this,this[Br])):s.call(this,this[Br])}return n}removeListener(t,r){return this.off(t,r)}off(t,r){let n=super.off(t,r);return t==="data"&&(this[be]=this.listeners("data").length,this[be]===0&&!this[ct]&&!this[X].length&&(this[W]=!1)),n}removeAllListeners(t){let r=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[be]=0,!this[ct]&&!this[X].length&&(this[W]=!1)),r}get emittedEnd(){return this[ae]}[Jt](){!this[Nn]&&!this[ae]&&!this[M]&&this[G].length===0&&this[Kt]&&(this[Nn]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[On]&&this.emit("close"),this[Nn]=!1)}emit(t,...r){let n=r[0];if(t!=="error"&&t!=="close"&&t!==M&&this[M])return!1;if(t==="data")return!this[K]&&!n?!1:this[Pt]?(Lr(()=>this[yo](n)),!0):this[yo](n);if(t==="end")return this[sc]();if(t==="close"){if(this[On]=!0,!this[ae]&&!this[M])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(t==="error"){this[Br]=n,super.emit(Do,n);let o=!this[_r]||this.listeners("error").length?super.emit("error",n):!1;return this[Jt](),o}else if(t==="resume"){let o=super.emit("resume");return this[Jt](),o}else if(t==="finish"||t==="prefinish"){let o=super.emit(t);return this.removeAllListeners(t),o}let s=super.emit(t,...r);return this[Jt](),s}[yo](t){for(let n of this[X])n.dest.write(t)===!1&&this.pause();let r=this[ct]?!1:super.emit("data",t);return this[Jt](),r}[sc](){return this[ae]?!1:(this[ae]=!0,this.readable=!1,this[Pt]?(Lr(()=>this[wo]()),!0):this[wo]())}[wo](){if(this[_e]){let r=this[_e].end();if(r){for(let n of this[X])n.dest.write(r);this[ct]||super.emit("data",r)}}for(let r of this[X])r.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[K]||(t.dataLength=0);let r=this.promise();return this.on("data",n=>{t.push(n),this[K]||(t.dataLength+=n.length)}),await r,t}async concat(){if(this[K])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Ct]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,r)=>{this.on(M,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[ct]=!1;let t=!1,r=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return r();let s=this.read();if(s!==null)return Promise.resolve({done:!1,value:s});if(this[Kt])return r();let o,i,a=p=>{this.off("data",c),this.off("end",l),this.off(M,u),r(),i(p)},c=p=>{this.off("error",a),this.off("end",l),this.off(M,u),this.pause(),o({value:p,done:!!this[Kt]})},l=()=>{this.off("error",a),this.off("data",c),this.off(M,u),r(),o({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((p,d)=>{i=d,o=p,this.once(M,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ct]=!1;let t=!1,r=()=>(this.pause(),this.off(Do,r),this.off(M,r),this.off("end",r),t=!0,{done:!0,value:void 0}),n=()=>{if(t)return r();let s=this.read();return s===null?r():{done:!1,value:s}};return this.once("end",r),this.once(Do,r),this.once(M,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(t){if(this[M])return t?this.emit("error",t):this.emit(M),this;this[M]=!0,this[ct]=!0,this[G].length=0,this[H]=0;let r=this;return typeof r.close=="function"&&!this[On]&&r.close(),t?this.emit("error",t):this.emit(M),this}static get isStream(){return wm}};var Am=It.realpathSync.native,Gr={lstatSync:It.lstatSync,readdir:It.readdir,readdirSync:It.readdirSync,readlinkSync:It.readlinkSync,realpathSync:Am,promises:{lstat:le.lstat,readdir:le.readdir,readlink:le.readlink,realpath:le.realpath}},pc=e=>!e||e===Gr||e===Tm?Gr:{...Gr,...e,promises:{...Gr.promises,...e.promises||{}}},fc=/^\\\\\?\\([a-z]:)\\?$/i,Pm=e=>e.replace(/\//g,"\\").replace(fc,"$1\\"),Rm=/[\\\/]/,Dt=0,dc=1,hc=2,Rt=4,mc=6,gc=8,xe=10,Dc=12,gt=15,Wr=~gt,vo=16,ic=32,Hr=64,bt=128,Ln=256,Gn=512,ac=Hr|bt|Gn,Im=1023,ko=e=>e.isFile()?gc:e.isDirectory()?Rt:e.isSymbolicLink()?xe:e.isCharacterDevice()?hc:e.isBlockDevice()?mc:e.isSocket()?Dc:e.isFIFO()?dc:Dt,cc=new Ce({max:2**12}),Ur=e=>{let t=cc.get(e);if(t)return t;let r=e.normalize("NFKD");return cc.set(e,r),r},lc=new Ce({max:2**12}),Wn=e=>{let t=lc.get(e);if(t)return t;let r=Ur(e.toLowerCase());return lc.set(e,r),r},Hn=class extends Ce{constructor(){super({max:256})}},Eo=class extends Ce{constructor(t=16*1024){super({maxSize:t,sizeCalculation:r=>r.length+1})}},yc=Symbol("PathScurry setAsCwd"),J=class{name;root;roots;parent;nocase;isCWD=!1;#t;#r;get dev(){return this.#r}#o;get mode(){return this.#o}#s;get nlink(){return this.#s}#i;get uid(){return this.#i}#C;get gid(){return this.#C}#D;get rdev(){return this.#D}#u;get blksize(){return this.#u}#a;get ino(){return this.#a}#f;get size(){return this.#f}#p;get blocks(){return this.#p}#c;get atimeMs(){return this.#c}#n;get mtimeMs(){return this.#n}#d;get ctimeMs(){return this.#d}#b;get birthtimeMs(){return this.#b}#w;get atime(){return this.#w}#h;get mtime(){return this.#h}#T;get ctime(){return this.#T}#m;get birthtime(){return this.#m}#k;#E;#g;#y;#x;#S;#e;#O;#I;#F;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,r=Dt,n,s,o,i,a){this.name=t,this.#k=o?Wn(t):Ur(t),this.#e=r&Im,this.nocase=o,this.roots=s,this.root=n||this,this.#O=i,this.#g=a.fullpath,this.#x=a.relative,this.#S=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=pc(a.fs)}depth(){return this.#E!==void 0?this.#E:this.parent?this.#E=this.parent.depth()+1:this.#E=0}childrenCache(){return this.#O}resolve(t){if(!t)return this;let r=this.getRootString(t),s=t.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#N(s):this.#N(s)}#N(t){let r=this;for(let n of t)r=r.child(n);return r}children(){let t=this.#O.get(this);if(t)return t;let r=Object.assign([],{provisional:0});return this.#O.set(this,r),this.#e&=~vo,r}child(t,r){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let n=this.children(),s=this.nocase?Wn(t):Ur(t);for(let c of n)if(c.#k===s)return c;let o=this.parent?this.sep:"",i=this.#g?this.#g+o+t:void 0,a=this.newChild(t,Dt,{...r,parent:this,fullpath:i});return this.canReaddir()||(a.#e|=bt),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#x!==void 0)return this.#x;let t=this.name,r=this.parent;if(!r)return this.#x=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let t=this.name,r=this.parent;if(!r)return this.#S=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+t}fullpath(){if(this.#g!==void 0)return this.#g;let t=this.name,r=this.parent;if(!r)return this.#g=this.name;let s=r.fullpath()+(r.parent?this.sep:"")+t;return this.#g=s}fullpathPosix(){if(this.#y!==void 0)return this.#y;if(this.sep==="/")return this.#y=this.fullpath();if(!this.parent){let s=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(s)?this.#y=`//?/${s}`:this.#y=s}let t=this.parent,r=t.fullpathPosix(),n=r+(!r||!t.parent?"":"/")+this.name;return this.#y=n}isUnknown(){return(this.#e&gt)===Dt}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.#e&gt)===gc}isDirectory(){return(this.#e&gt)===Rt}isCharacterDevice(){return(this.#e&gt)===hc}isBlockDevice(){return(this.#e&gt)===mc}isFIFO(){return(this.#e&gt)===dc}isSocket(){return(this.#e&gt)===Dc}isSymbolicLink(){return(this.#e&xe)===xe}lstatCached(){return this.#e&ic?this:void 0}readlinkCached(){return this.#I}realpathCached(){return this.#F}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#I)return!0;if(!this.parent)return!1;let t=this.#e&gt;return!(t!==Dt&&t!==xe||this.#e&Ln||this.#e&bt)}calledReaddir(){return!!(this.#e&vo)}isENOENT(){return!!(this.#e&bt)}isNamed(t){return this.nocase?this.#k===Wn(t):this.#k===Ur(t)}async readlink(){let t=this.#I;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=await this.#t.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#I=n}catch(r){this.#R(r.code);return}}readlinkSync(){let t=this.#I;if(t)return t;if(this.canReadlink()&&this.parent)try{let r=this.#t.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#I=n}catch(r){this.#R(r.code);return}}#j(t){this.#e|=vo;for(let r=t.provisional;r<t.length;r++){let n=t[r];n&&n.#v()}}#v(){this.#e&bt||(this.#e=(this.#e|bt)&Wr,this.#U())}#U(){let t=this.children();t.provisional=0;for(let r of t)r.#v()}#B(){this.#e|=Gn,this.#M()}#M(){if(this.#e&Hr)return;let t=this.#e;(t&gt)===Rt&&(t&=Wr),this.#e=t|Hr,this.#U()}#_(t=""){t==="ENOTDIR"||t==="EPERM"?this.#M():t==="ENOENT"?this.#v():this.children().provisional=0}#P(t=""){t==="ENOTDIR"?this.parent.#M():t==="ENOENT"&&this.#v()}#R(t=""){let r=this.#e;r|=Ln,t==="ENOENT"&&(r|=bt),(t==="EINVAL"||t==="UNKNOWN")&&(r&=Wr),this.#e=r,t==="ENOTDIR"&&this.parent&&this.parent.#M()}#L(t,r){return this.#G(t,r)||this.#W(t,r)}#W(t,r){let n=ko(t),s=this.newChild(t.name,n,{parent:this}),o=s.#e&gt;return o!==Rt&&o!==xe&&o!==Dt&&(s.#e|=Hr),r.unshift(s),r.provisional++,s}#G(t,r){for(let n=r.provisional;n<r.length;n++){let s=r[n];if((this.nocase?Wn(t.name):Ur(t.name))===s.#k)return this.#l(t,s,n,r)}}#l(t,r,n,s){let o=r.name;return r.#e=r.#e&Wr|ko(t),o!==t.name&&(r.name=t.name),n!==s.provisional&&(n===s.length-1?s.pop():s.splice(n,1),s.unshift(r)),s.provisional++,r}async lstat(){if((this.#e&bt)===0)try{return this.#H(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#P(t.code)}}lstatSync(){if((this.#e&bt)===0)try{return this.#H(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#P(t.code)}}#H(t){let{atime:r,atimeMs:n,birthtime:s,birthtimeMs:o,blksize:i,blocks:a,ctime:c,ctimeMs:l,dev:u,gid:p,ino:d,mode:f,mtime:m,mtimeMs:h,nlink:D,rdev:g,size:y,uid:x}=t;this.#w=r,this.#c=n,this.#m=s,this.#b=o,this.#u=i,this.#p=a,this.#T=c,this.#d=l,this.#r=u,this.#C=p,this.#a=d,this.#o=f,this.#h=m,this.#n=h,this.#s=D,this.#D=g,this.#f=y,this.#i=x;let C=ko(t);this.#e=this.#e&Wr|C|ic,C!==Dt&&C!==Rt&&C!==xe&&(this.#e|=Hr)}#$=[];#A=!1;#z(t){this.#A=!1;let r=this.#$.slice();this.#$.length=0,r.forEach(n=>n(null,t))}readdirCB(t,r=!1){if(!this.canReaddir()){r?t(null,[]):queueMicrotask(()=>t(null,[]));return}let n=this.children();if(this.calledReaddir()){let o=n.slice(0,n.provisional);r?t(null,o):queueMicrotask(()=>t(null,o));return}if(this.#$.push(t),this.#A)return;this.#A=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(o,i)=>{if(o)this.#_(o.code),n.provisional=0;else{for(let a of i)this.#L(a,n);this.#j(n)}this.#z(n.slice(0,n.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let r=this.fullpath();if(this.#K)await this.#K;else{let n=()=>{};this.#K=new Promise(s=>n=s);try{for(let s of await this.#t.promises.readdir(r,{withFileTypes:!0}))this.#L(s,t);this.#j(t)}catch(s){this.#_(s.code),t.provisional=0}this.#K=void 0,n()}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 r=this.fullpath();try{for(let n of this.#t.readdirSync(r,{withFileTypes:!0}))this.#L(n,t);this.#j(t)}catch(n){this.#_(n.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#e&ac)return!1;let t=gt&this.#e;return t===Dt||t===Rt||t===xe}shouldWalk(t,r){return(this.#e&Rt)===Rt&&!(this.#e&ac)&&!t.has(this)&&(!r||r(this))}async realpath(){if(this.#F)return this.#F;if(!((Gn|Ln|bt)&this.#e))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#F=this.resolve(t)}catch{this.#B()}}realpathSync(){if(this.#F)return this.#F;if(!((Gn|Ln|bt)&this.#e))try{let t=this.#t.realpathSync(this.fullpath());return this.#F=this.resolve(t)}catch{this.#B()}}[yc](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],s=this;for(;s&&s.parent;)r.add(s),s.#x=n.join(this.sep),s.#S=n.join("/"),s=s.parent,n.push("..");for(s=t;s&&s.parent&&!r.has(s);)s.#x=void 0,s.#S=void 0,s=s.parent}},Un=class e extends J{sep="\\";splitSep=Rm;constructor(t,r=Dt,n,s,o,i,a){super(t,r,n,s,o,i,a)}newChild(t,r=Dt,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(t){return We.win32.parse(t).root}getRoot(t){if(t=Pm(t.toUpperCase()),t===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(t,r))return this.roots[t]=n;return this.roots[t]=new Ge(t,this).root}sameRoot(t,r=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(fc,"$1\\"),t===r}},zn=class e extends J{splitSep="/";sep="/";constructor(t,r=Dt,n,s,o,i,a){super(t,r,n,s,o,i,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,r=Dt,n={}){return new e(t,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},Kn=class{root;rootPath;roots;cwd;#t;#r;#o;nocase;#s;constructor(t=process.cwd(),r,n,{nocase:s,childrenCacheSize:o=16*1024,fs:i=Gr}={}){this.#s=pc(i),(t instanceof URL||t.startsWith("file://"))&&(t=(0,uc.fileURLToPath)(t));let a=r.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new Hn,this.#r=new Hn,this.#o=new Eo(o);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),s===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=s,this.root=this.newRoot(this.#s),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,p=r.sep,d=this.rootPath,f=!1;for(let m of c){let h=u--;l=l.child(m,{relative:new Array(h).fill("..").join(p),relativePosix:new Array(h).fill("..").join("/"),fullpath:d+=(f?"":p)+m}),f=!0}this.cwd=l}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#o}resolve(...t){let r="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(!(!i||i===".")&&(r=r?`${i}/${r}`:i,this.isAbsolute(i)))break}let n=this.#t.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpath();return this.#t.set(r,s),s}resolvePosix(...t){let r="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(!(!i||i===".")&&(r=r?`${i}/${r}`:i,this.isAbsolute(i)))break}let n=this.#r.get(r);if(n!==void 0)return n;let s=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,s),s}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,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n}=r;if(t.canReaddir()){let s=await t.readdir();return n?s:s.map(o=>o.name)}else return[]}readdirSync(t=this.cwd,r={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0}=r;return t.canReaddir()?n?t.readdirSync():t.readdirSync().map(s=>s.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:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=await t.readlink();return r?n:n?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=t.readlinkSync();return r?n:n?.fullpath()}async realpath(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=await t.realpath();return r?n:n?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t.withFileTypes,t=this.cwd);let n=t.realpathSync();return r?n:n?.fullpath()}async walk(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=[];(!o||o(t))&&a.push(n?t:t.fullpath());let c=new Set,l=(p,d)=>{c.add(p),p.readdirCB((f,m)=>{if(f)return d(f);let h=m.length;if(!h)return d();let D=()=>{--h===0&&d()};for(let g of m)(!o||o(g))&&a.push(n?g:g.fullpath()),s&&g.isSymbolicLink()?g.realpath().then(y=>y?.isUnknown()?y.lstat():y).then(y=>y?.shouldWalk(c,i)?l(y,D):D()):g.shouldWalk(c,i)?l(g,D):D()},!0)},u=t;return new Promise((p,d)=>{l(u,f=>{if(f)return d(f);p(a)})})}walkSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=[];(!o||o(t))&&a.push(n?t:t.fullpath());let c=new Set([t]);for(let l of c){let u=l.readdirSync();for(let p of u){(!o||o(p))&&a.push(n?p:p.fullpath());let d=p;if(p.isSymbolicLink()){if(!(s&&(d=p.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,i)&&c.add(d)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,r={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd),this.stream(t,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r;(!o||o(t))&&(yield n?t:t.fullpath());let a=new Set([t]);for(let c of a){let l=c.readdirSync();for(let u of l){(!o||o(u))&&(yield n?u:u.fullpath());let p=u;if(u.isSymbolicLink()){if(!(s&&(p=u.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(a,i)&&a.add(p)}}}stream(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=new ce({objectMode:!0});(!o||o(t))&&a.write(n?t:t.fullpath());let c=new Set,l=[t],u=0,p=()=>{let d=!1;for(;!d;){let f=l.shift();if(!f){u===0&&a.end();return}u++,c.add(f);let m=(D,g,y=!1)=>{if(D)return a.emit("error",D);if(s&&!y){let x=[];for(let C of g)C.isSymbolicLink()&&x.push(C.realpath().then(A=>A?.isUnknown()?A.lstat():A));if(x.length){Promise.all(x).then(()=>m(null,g,!0));return}}for(let x of g)x&&(!o||o(x))&&(a.write(n?x:x.fullpath())||(d=!0));u--;for(let x of g){let C=x.realpathCached()||x;C.shouldWalk(c,i)&&l.push(C)}d&&!a.flowing?a.once("drain",p):h||p()},h=!0;f.readdirCB(m,!0),h=!1}};return p(),a}streamSync(t=this.cwd,r={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof J||(r=t,t=this.cwd);let{withFileTypes:n=!0,follow:s=!1,filter:o,walkFilter:i}=r,a=new ce({objectMode:!0}),c=new Set;(!o||o(t))&&a.write(n?t:t.fullpath());let l=[t],u=0,p=()=>{let d=!1;for(;!d;){let f=l.shift();if(!f){u===0&&a.end();return}u++,c.add(f);let m=f.readdirSync();for(let h of m)(!o||o(h))&&(a.write(n?h:h.fullpath())||(d=!0));u--;for(let h of m){let D=h;if(h.isSymbolicLink()){if(!(s&&(D=h.realpathSync())))continue;D.isUnknown()&&D.lstatSync()}D.shouldWalk(c,i)&&l.push(D)}}d&&!a.flowing&&a.once("drain",p)};return p(),a}chdir(t=this.cwd){let r=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[yc](r)}},Ge=class extends Kn{sep="\\";constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,We.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let s=this.cwd;s;s=s.parent)s.nocase=this.nocase}parseRootPath(t){return We.win32.parse(t).root.toUpperCase()}newRoot(t){return new Un(this.rootPath,Rt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},He=class extends Kn{sep="/";constructor(t=process.cwd(),r={}){let{nocase:n=!1}=r;super(t,We.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(t){return"/"}newRoot(t){return new zn(this.rootPath,Rt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},zr=class extends He{constructor(t=process.cwd(),r={}){let{nocase:n=!0}=r;super(t,{...r,nocase:n})}},bx=process.platform==="win32"?Un:zn,wc=process.platform==="win32"?Ge:process.platform==="darwin"?zr:He;var Nm=e=>e.length>=1,Om=e=>e.length>=1,Ue=class e{#t;#r;#o;length;#s;#i;#C;#D;#u;#a;#f=!0;constructor(t,r,n,s){if(!Nm(t))throw new TypeError("empty pattern list");if(!Om(r))throw new TypeError("empty glob list");if(r.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#r=r,this.#o=n,this.#s=s,this.#o===0){if(this.isUNC()){let[o,i,a,c,...l]=this.#t,[u,p,d,f,...m]=this.#r;l[0]===""&&(l.shift(),m.shift());let h=[o,i,a,c,""].join("/"),D=[u,p,d,f,""].join("/");this.#t=[h,...l],this.#r=[D,...m],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[o,...i]=this.#t,[a,...c]=this.#r;i[0]===""&&(i.shift(),c.shift());let l=o+"/",u=a+"/";this.#t=[l,...i],this.#r=[u,...c],this.length=this.#t.length}}}pattern(){return this.#t[this.#o]}isString(){return typeof this.#t[this.#o]=="string"}isGlobstar(){return this.#t[this.#o]===U}isRegExp(){return this.#t[this.#o]instanceof RegExp}globString(){return this.#C=this.#C||(this.#o===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#o).join("/"))}hasMore(){return this.length>this.#o+1}rest(){return this.#i!==void 0?this.#i:this.hasMore()?(this.#i=new e(this.#t,this.#r,this.#o+1,this.#s),this.#i.#a=this.#a,this.#i.#u=this.#u,this.#i.#D=this.#D,this.#i):this.#i=null}isUNC(){let t=this.#t;return this.#u!==void 0?this.#u:this.#u=this.#s==="win32"&&this.#o===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#D!==void 0?this.#D:this.#D=this.#s==="win32"&&this.#o===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#a!==void 0?this.#a:this.#a=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#o===0?t:""}checkFollowGlobstar(){return!(this.#o===0||!this.isGlobstar()||!this.#f)}markFollowGlobstar(){return this.#o===0||!this.isGlobstar()||!this.#f?!1:(this.#f=!1,!0)}};var Mm=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ze=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:r,nocase:n,noext:s,noglobstar:o,platform:i=Mm}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=i,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:s,noglobstar:o,optimizationLevel:2,platform:i,nocomment:!0,nonegate:!0};for(let a of t)this.add(a)}add(t){let r=new at(t,this.mmopts);for(let n=0;n<r.set.length;n++){let s=r.set[n],o=r.globParts[n];if(!s||!o)throw new Error("invalid pattern object");for(;s[0]==="."&&o[0]===".";)s.shift(),o.shift();let i=new Ue(s,o,0,this.platform),a=new at(i.globString(),this.mmopts),c=o[o.length-1]==="**",l=i.isAbsolute();l?this.absolute.push(a):this.relative.push(a),c&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(t){let r=t.fullpath(),n=`${r}/`,s=t.relative()||".",o=`${s}/`;for(let i of this.relative)if(i.match(s)||i.match(o))return!0;for(let i of this.absolute)if(i.match(r)||i.match(n))return!0;return!1}childrenIgnored(t){let r=t.fullpath()+"/",n=(t.relative()||".")+"/";for(let s of this.relativeChildren)if(s.match(n))return!0;for(let s of this.absoluteChildren)if(s.match(r))return!0;return!1}};var So=class e{store;constructor(t=new Map){this.store=t}copy(){return new e(new Map(this.store))}hasWalked(t,r){return this.store.get(t.fullpath())?.has(r.globString())}storeWalked(t,r){let n=t.fullpath(),s=this.store.get(n);s?s.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},Fo=class{store=new Map;add(t,r,n){let s=(r?2:0)|(n?1:0),o=this.store.get(t);this.store.set(t,o===void 0?s:s&o)}entries(){return[...this.store.entries()].map(([t,r])=>[t,!!(r&2),!!(r&1)])}},To=class{store=new Map;add(t,r){if(!t.canReaddir())return;let n=this.store.get(t);n?n.find(s=>s.globString()===r.globString())||n.push(r):this.store.set(t,[r])}get(t){let r=this.store.get(t);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},Kr=class e{hasWalkedCache;matches=new Fo;subwalks=new To;patterns;follow;dot;opts;constructor(t,r){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=r?r.copy():new So}processPatterns(t,r){this.patterns=r;let n=r.map(s=>[t,s]);for(let[s,o]of n){this.hasWalkedCache.storeWalked(s,o);let i=o.root(),a=o.isAbsolute()&&this.opts.absolute!==!1;if(i){s=s.resolve(i==="/"&&this.opts.root!==void 0?this.opts.root:i);let p=o.rest();if(p)o=p;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let c,l,u=!1;for(;typeof(c=o.pattern())=="string"&&(l=o.rest());)s=s.resolve(c),o=l,u=!0;if(c=o.pattern(),l=o.rest(),u){if(this.hasWalkedCache.hasWalked(s,o))continue;this.hasWalkedCache.storeWalked(s,o)}if(typeof c=="string"){let p=c===".."||c===""||c===".";this.matches.add(s.resolve(c),a,p);continue}else if(c===U){(!s.isSymbolicLink()||this.follow||o.checkFollowGlobstar())&&this.subwalks.add(s,o);let p=l?.pattern(),d=l?.rest();if(!l||(p===""||p===".")&&!d)this.matches.add(s,a,p===""||p===".");else if(p===".."){let f=s.parent||s;d?this.hasWalkedCache.hasWalked(f,d)||this.subwalks.add(f,d):this.matches.add(f,a,!0)}}else c instanceof RegExp&&this.subwalks.add(s,o)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(t,r){let n=this.subwalks.get(t),s=this.child();for(let o of r)for(let i of n){let a=i.isAbsolute(),c=i.pattern(),l=i.rest();c===U?s.testGlobstar(o,i,l,a):c instanceof RegExp?s.testRegExp(o,c,l,a):s.testString(o,c,l,a)}return s}testGlobstar(t,r,n,s){if((this.dot||!t.name.startsWith("."))&&(r.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,r):t.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(t,n):r.markFollowGlobstar()&&this.subwalks.add(t,r)))),n){let o=n.pattern();if(typeof o=="string"&&o!==".."&&o!==""&&o!==".")this.testString(t,o,n.rest(),s);else if(o===".."){let i=t.parent||t;this.subwalks.add(i,n)}else o instanceof RegExp&&this.testRegExp(t,o,n.rest(),s)}}testRegExp(t,r,n,s){r.test(t.name)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}testString(t,r,n,s){t.isNamed(r)&&(n?this.subwalks.add(t,n):this.matches.add(t,s,!1))}};var $m=(e,t)=>typeof e=="string"?new ze([e],t):Array.isArray(e)?new ze(e,t):e,Jn=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#r;#o;signal;maxDepth;includeChildMatches;constructor(t,r,n){if(this.patterns=t,this.path=r,this.opts=n,this.#o=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#r=$m(n.ignore??[],n),!this.includeChildMatches&&typeof this.#r.add!="function")){let s="cannot ignore child matches, ignore lacks add() method.";throw new Error(s)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#s(t){return this.seen.has(t)||!!this.#r?.ignored?.(t)}#i(t){return!!this.#r?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||await t.realpath(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let i=await o.realpath();i&&(i.isUnknown()||this.opts.stat)&&await i.lstat()}return this.matchCheckTest(o,r)}matchCheckTest(t,r){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!r||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#s(t)?t:void 0}matchCheckSync(t,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=t.realpathCached()||t.realpathSync(),!n)return;t=n}let o=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let i=o.realpathSync();i&&(i?.isUnknown()||this.opts.stat)&&i.lstatSync()}return this.matchCheckTest(o,r)}matchFinish(t,r){if(this.#s(t))return;if(!this.includeChildMatches&&this.#r?.add){let o=`${t.relativePosix()}/**`;this.#r.add(o)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#o:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(n){let o=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(o+s)}else{let o=this.opts.posix?t.relativePosix():t.relative(),i=this.opts.dotRelative&&!o.startsWith(".."+this.#o)?"."+this.#o:"";this.matchEmit(o?i+o+s:"."+s)}}async match(t,r,n){let s=await this.matchCheck(t,n);s&&this.matchFinish(s,r)}matchSync(t,r,n){let s=this.matchCheckSync(t,n);s&&this.matchFinish(s,r)}walkCB(t,r,n){this.signal?.aborted&&n(),this.walkCB2(t,r,new Kr(this.opts),n)}walkCB2(t,r,n,s){if(this.#i(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2(t,r,n,s));return}n.processPatterns(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||(o++,this.match(a,c,l).then(()=>i()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;o++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,i):a.readdirCB((l,u)=>this.walkCB3(a,u,n,i),!0)}i()}walkCB3(t,r,n,s){n=n.filterEntries(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||(o++,this.match(a,c,l).then(()=>i()));for(let[a,c]of n.subwalks.entries())o++,this.walkCB2(a,c,n.child(),i);i()}walkCBSync(t,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(t,r,new Kr(this.opts),n)}walkCB2Sync(t,r,n,s){if(this.#i(t))return s();if(this.signal?.aborted&&s(),this.paused){this.onResume(()=>this.walkCB2Sync(t,r,n,s));return}n.processPatterns(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;o++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,i)}i()}walkCB3Sync(t,r,n,s){n=n.filterEntries(t,r);let o=1,i=()=>{--o===0&&s()};for(let[a,c,l]of n.matches.entries())this.#s(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())o++,this.walkCB2Sync(a,c,n.child(),i);i()}},Jr=class extends Jn{matches=new Set;constructor(t,r,n){super(t,r,n)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},qr=class extends Jn{results;constructor(t,r,n){super(t,r,n),this.results=new ce({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 Bm=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,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,Cc.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=t,this.platform=r.platform||Bm,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=r.platform==="win32"?Ge:r.platform==="darwin"?zr:r.platform?He:wc;this.scurry=new c(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",s={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},o=this.pattern.map(c=>new at(c,s)),[i,a]=o.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=i.map((c,l)=>{let u=a[l];if(!u)throw new Error("invalid pattern object");return new Ue(c,u,0,this.platform)})}async walk(){return[...await new Jr(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 Jr(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 qr(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 qr(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 Ao=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let r of e)if(new at(r,t).hasMagic())return!0;return!1};function Vn(e,t={}){return new xt(e,t).streamSync()}function xc(e,t={}){return new xt(e,t).stream()}function Yn(e,t={}){return new xt(e,t).walkSync()}async function bc(e,t={}){return new xt(e,t).walk()}function Zn(e,t={}){return new xt(e,t).iterateSync()}function vc(e,t={}){return new xt(e,t).iterate()}var jm=Vn,_m=Object.assign(xc,{sync:Vn}),Lm=Zn,Wm=Object.assign(vc,{sync:Zn}),Gm=Object.assign(Yn,{stream:Vn,iterate:Zn}),qn=Object.assign(bc,{glob:bc,globSync:Yn,sync:Gm,globStream:xc,stream:_m,globStreamSync:Vn,streamSync:jm,globIterate:vc,iterate:Wm,globIterateSync:Zn,iterateSync:Lm,Glob:xt,hasMagic:Ao,escape:Be,unescape:wt});qn.glob=qn;var ue=(e,t)=>typeof e>"u"||typeof e===t,kc=e=>!!e&&typeof e=="object"&&ue(e.preserveRoot,"boolean")&&ue(e.tmp,"string")&&ue(e.maxRetries,"number")&&ue(e.retryDelay,"number")&&ue(e.backoff,"number")&&ue(e.maxBackoff,"number")&&(ue(e.glob,"boolean")||e.glob&&typeof e.glob=="object")&&ue(e.filter,"function"),Ec=e=>{if(!kc(e))throw new Error("invalid rimraf options")},Sc=e=>{Ec(e);let{glob:t,...r}=e;if(!t)return r;let n=t===!0?e.signal?{signal:e.signal}:{}:e.signal?{signal:e.signal,...t}:t;return{...r,glob:{...n,absolute:!0,withFileTypes:!1}}},Fc=(e={})=>Sc(e),Tc=(e={})=>Sc(e);var Vr=require("path"),Ac=require("util"),Hm=(e,t={})=>{let r=typeof e;if(r!=="string"){let s=e&&r==="object"&&e.constructor,i=`The "path" argument must be of type string. Received ${s&&s.name?`an instance of ${s.name}`:r==="object"?(0,Ac.inspect)(e):`type ${r} ${e}`}`;throw Object.assign(new TypeError(i),{path:e,code:"ERR_INVALID_ARG_TYPE"})}if(/\0/.test(e)){let s="path must be a string without null bytes";throw Object.assign(new TypeError(s),{path:e,code:"ERR_INVALID_ARG_VALUE"})}e=(0,Vr.resolve)(e);let{root:n}=(0,Vr.parse)(e);if(e===n&&t.preserveRoot!==!1){let s="refusing to remove root directory without preserveRoot:false";throw Object.assign(new Error(s),{path:e,code:"ERR_PRESERVE_ROOT"})}if(process.platform==="win32"){let s=/[*|"<>?:]/,{root:o}=(0,Vr.parse)(e);if(s.test(e.substring(o.length)))throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}return e},Yr=Hm;var Pc=require("fs"),Nt=b(require("fs/promises"),1),k=require("fs"),Rc=e=>(0,Pc.readdirSync)(e,{withFileTypes:!0}),st={chmod:Nt.default.chmod,mkdir:Nt.default.mkdir,readdir:e=>Nt.default.readdir(e,{withFileTypes:!0}),rename:Nt.default.rename,rm:Nt.default.rm,rmdir:Nt.default.rmdir,stat:Nt.default.stat,lstat:Nt.default.lstat,unlink:Nt.default.unlink};var qe=require("path");var{readdir:Um}=st,Ke=e=>Um(e).catch(t=>t),Je=e=>{try{return Rc(e)}catch(t){return t}};var Ic=e=>!!e&&typeof e=="object",Po=(e,t)=>t in e&&typeof e[t]=="string",Ro=e=>Ic(e)&&Po(e,"code")&&Po(e,"path"),I=e=>Ic(e)&&Po(e,"code")?e.code:null;var Q=async(e,t)=>e.catch(r=>{if(I(r)!=="ENOENT")throw t??r}),tt=(e,t)=>{try{return e()}catch(r){if(I(r)==="ENOENT")return;throw t??r}};var{lstat:zm,rmdir:Km,unlink:Jm}=st,Xn=async(e,t)=>(t?.signal?.throwIfAborted(),await Q(zm(e).then(r=>Nc(e,t,r)))??!0),Qn=(e,t)=>(t?.signal?.throwIfAborted(),tt(()=>Oc(e,t,(0,k.lstatSync)(e)))??!0),Nc=async(e,t,r)=>{t?.signal?.throwIfAborted();let n=r.isDirectory()?await Ke(e):null;if(!Array.isArray(n)){if(n){if(I(n)==="ENOENT")return!0;if(I(n)!=="ENOTDIR")throw n}return t.filter&&!await t.filter(e,r)?!1:(await Q(Jm(e)),!0)}return!(await Promise.all(n.map(o=>Nc((0,qe.resolve)(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===(0,qe.parse)(e).root||t.filter&&!await t.filter(e,r)?!1:(await Q(Km(e)),!0)},Oc=(e,t,r)=>{t?.signal?.throwIfAborted();let n=r.isDirectory()?Je(e):null;if(!Array.isArray(n)){if(n){if(I(n)==="ENOENT")return!0;if(I(n)!=="ENOTDIR")throw n}return t.filter&&!t.filter(e,r)?!1:(tt(()=>(0,k.unlinkSync)(e)),!0)}let s=!0;for(let o of n){let i=(0,qe.resolve)(e,o.name);s=Oc(i,t,o)&&s}return t.preserveRoot===!1&&e===(0,qe.parse)(e).root||!s||t.filter&&!t.filter(e,r)?!1:(tt(()=>(0,k.rmdirSync)(e)),!0)};var Ve=require("path");var{chmod:qm}=st,Zr=e=>async t=>{try{return void await Q(e(t))}catch(r){if(I(r)==="EPERM")return await Q(qm(t,438).then(()=>!0),r)?void await e(t):void 0;throw r}},Xr=e=>t=>{try{return void tt(()=>e(t))}catch(r){if(I(r)==="EPERM")return tt(()=>((0,k.chmodSync)(t,438),!0),r)?void e(t):void 0;throw r}};var Mc=require("timers/promises");var Vm=200,Ym=1.2,$c=10,Bc=new Set(["EMFILE","ENFILE","EBUSY"]),Io=e=>{let t=async(r,n,s=1,o=0)=>{let i=n.maxBackoff||Vm,a=n.backoff||Ym,c=n.maxRetries||$c,l=0;for(;;)try{return await e(r)}catch(u){if(Ro(u)&&u.path===r&&Bc.has(u.code)){if(s=Math.ceil(s*a),o=s+o,o<i)return await(0,Mc.setTimeout)(s),t(r,n,s,o);if(l<c){l++;continue}}throw u}};return t},No=e=>(r,n)=>{let s=n.maxRetries||$c,o=0;for(;;)try{return e(r)}catch(i){if(Ro(i)&&i.path===r&&Bc.has(i.code)&&o<s){o++;continue}throw i}};var yt=require("path");var Qr=require("os"),pe=require("path");var{stat:Zm}=st,Xm=e=>{try{return(0,k.statSync)(e).isDirectory()}catch{return!1}},Qm=e=>Zm(e).then(t=>t.isDirectory(),()=>!1),tg=async e=>{let{root:t}=(0,pe.parse)(e),r=(0,Qr.tmpdir)(),{root:n}=(0,pe.parse)(r);if(t.toLowerCase()===n.toLowerCase())return r;let s=(0,pe.resolve)(t,"/temp");return await Qm(s)?s:t},eg=e=>{let{root:t}=(0,pe.parse)(e),r=(0,Qr.tmpdir)(),{root:n}=(0,pe.parse)(r);if(t.toLowerCase()===n.toLowerCase())return r;let s=(0,pe.resolve)(t,"/temp");return Xm(s)?s:t},rg=async()=>(0,Qr.tmpdir)(),ng=()=>(0,Qr.tmpdir)(),jc=process.platform==="win32"?tg:rg,_c=process.platform==="win32"?eg:ng;var{lstat:sg,rename:og,unlink:ig,rmdir:ag}=st,Gc=e=>`.${(0,yt.basename)(e)}.${Math.random()}`,cg=Zr(ig),lg=Xr(k.unlinkSync),ts=async(e,t)=>(t?.signal?.throwIfAborted(),await Q(sg(e).then(r=>Oo(e,t,r)))??!0),Oo=async(e,t,r)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return Oo(e,{...t,tmp:await jc(e)},r);if(e===t.tmp&&(0,yt.parse)(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let n=r.isDirectory()?await Ke(e):null;if(!Array.isArray(n)){if(n){if(I(n)==="ENOENT")return!0;if(I(n)!=="ENOTDIR")throw n}return t.filter&&!await t.filter(e,r)?!1:(await Q(Lc(e,t.tmp,cg)),!0)}return!(await Promise.all(n.map(o=>Oo((0,yt.resolve)(e,o.name),t,o)))).every(o=>o===!0)||t.preserveRoot===!1&&e===(0,yt.parse)(e).root||t.filter&&!await t.filter(e,r)?!1:(await Q(Lc(e,t.tmp,ag)),!0)},Lc=async(e,t,r)=>{let n=(0,yt.resolve)(t,Gc(e));return await og(e,n),await r(n)},es=(e,t)=>(t?.signal?.throwIfAborted(),tt(()=>Mo(e,t,(0,k.lstatSync)(e)))??!0),Mo=(e,t,r)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return Mo(e,{...t,tmp:_c(e)},r);let n=t.tmp;if(e===t.tmp&&(0,yt.parse)(e).root!==e)throw new Error("cannot delete temp directory used for deletion");let s=r.isDirectory()?Je(e):null;if(!Array.isArray(s)){if(s){if(I(s)==="ENOENT")return!0;if(I(s)!=="ENOTDIR")throw s}return t.filter&&!t.filter(e,r)?!1:(tt(()=>Wc(e,n,lg)),!0)}let o=!0;for(let i of s){let a=(0,yt.resolve)(e,i.name);o=Mo(a,t,i)&&o}return!o||t.preserveRoot===!1&&e===(0,yt.parse)(e).root||t.filter&&!t.filter(e,r)?!1:(tt(()=>Wc(e,n,k.rmdirSync)),!0)},Wc=(e,t,r)=>{let n=(0,yt.resolve)(t,Gc(e));return(0,k.renameSync)(e,n),r(n)};var{unlink:ug,rmdir:pg,lstat:fg}=st,dg=Io(Zr(ug)),hg=No(Xr(k.unlinkSync)),mg=Io(Zr(pg)),gg=No(Xr(k.rmdirSync)),Dg=async(e,{filter:t,...r})=>{r?.signal?.throwIfAborted();try{return await mg(e,r),!0}catch(n){if(I(n)==="ENOTEMPTY")return ts(e,r);throw n}},yg=(e,{filter:t,...r})=>{r?.signal?.throwIfAborted();try{return gg(e,r),!0}catch(n){if(I(n)==="ENOTEMPTY")return es(e,r);throw n}},fe=Symbol("start"),Hc=Symbol("child"),rs=Symbol("finish"),ns=async(e,t)=>(t?.signal?.throwIfAborted(),await Q(fg(e).then(r=>$o(e,t,r,fe)))??!0),ss=(e,t)=>(t?.signal?.throwIfAborted(),tt(()=>Bo(e,t,(0,k.lstatSync)(e),fe))??!0),$o=async(e,t,r,n=fe)=>{t?.signal?.throwIfAborted();let s=r.isDirectory()?await Ke(e):null;if(!Array.isArray(s)){if(s){if(I(s)==="ENOENT")return!0;if(I(s)!=="ENOTDIR")throw s}return t.filter&&!await t.filter(e,r)?!1:(await Q(dg(e,t)),!0)}let o=n===fe?Hc:n,i=(await Promise.all(s.map(a=>$o((0,Ve.resolve)(e,a.name),t,a,o)))).every(a=>a===!0);if(n===fe)return $o(e,t,r,rs);if(n===rs){if(t.preserveRoot===!1&&e===(0,Ve.parse)(e).root||!i||t.filter&&!await t.filter(e,r))return!1;await Q(Dg(e,t))}return!0},Bo=(e,t,r,n=fe)=>{let s=r.isDirectory()?Je(e):null;if(!Array.isArray(s)){if(s){if(I(s)==="ENOENT")return!0;if(I(s)!=="ENOTDIR")throw s}return t.filter&&!t.filter(e,r)?!1:(tt(()=>hg(e,t)),!0)}let o=!0;for(let i of s){let a=n===fe?Hc:n,c=(0,Ve.resolve)(e,i.name);o=Bo(c,t,i,a)&&o}if(n===fe)return Bo(e,t,r,rs);if(n===rs){if(t.preserveRoot===!1&&e===(0,Ve.parse)(e).root||!o||t.filter&&!t.filter(e,r))return!1;tt(()=>yg(e,t))}return!0};var jo=process.platform==="win32"?ns:Xn,_o=process.platform==="win32"?ss:Qn;var{rm:wg}=st,Lo=async(e,t)=>(await wg(e,{...t,force:!0,recursive:!0}),!0),Wo=(e,t)=>((0,k.rmSync)(e,{...t,force:!0,recursive:!0}),!0);var[Uc=0,Cg=0]=process.version.replace(/^v/,"").split(".").map(e=>parseInt(e,10)),zc=Uc>14||Uc===14&&Cg>=14,Kc=!zc||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter,Jc=!zc||process.platform==="win32"?()=>!1:e=>!e?.signal&&!e?.filter;var Ye=e=>async(t,r)=>{let n=Fc(r);return n.glob&&(t=await qn(t,n.glob)),Array.isArray(t)?!!(await Promise.all(t.map(s=>e(Yr(s,n),n)))).reduce((s,o)=>s&&o,!0):!!await e(Yr(t,n),n)},Ze=e=>(t,r)=>{let n=Tc(r);return n.glob&&(t=Yn(t,n.glob)),Array.isArray(t)?!!t.map(s=>e(Yr(s,n),n)).reduce((s,o)=>s&&o,!0):!!e(Yr(t,n),n)},Yc=Ze(Wo),bg=Object.assign(Ye(Lo),{sync:Yc}),Zc=Ze(_o),xg=Object.assign(Ye(jo),{sync:Zc}),Xc=Ze(ss),vg=Object.assign(Ye(ns),{sync:Xc}),Qc=Ze(Qn),kg=Object.assign(Ye(Xn),{sync:Qc}),tl=Ze(es),Eg=Object.assign(Ye(ts),{sync:tl}),qc=Ze((e,t)=>Jc(t)?Wo(e,t):_o(e,t));var Vc=Ye((e,t)=>Kc(t)?Lo(e,t):jo(e,t)),os=Object.assign(Vc,{rimraf:Vc,sync:qc,rimrafSync:qc,manual:xg,manualSync:Zc,native:bg,nativeSync:Yc,posix:kg,posixSync:Qc,windows:vg,windowsSync:Xc,moveRemove:Eg,moveRemoveSync:tl});os.rimraf=os;var S=e=>(0,Xe.join)(process.cwd(),e),is=e=>{try{return(0,el.readdirSync)(e).length===0}catch{return!0}};function rl(){let e=Ia({cwd:(0,Xe.dirname)(__filename)});if(!e)throw new Error("Could not find package.json");return(0,Xe.dirname)(e)}var nl=e=>os(e);var sl=b(require("chalk"));async function q(e,t){let r=Date.now(),n=e.title,s=()=>Math.floor((Date.now()-r)/1e3),o=setInterval(()=>{s()>1&&(e.title=`${n} (${s()}s)`)},1e3);try{return await t(s)}finally{clearInterval(o)}}async function as(e,t,r){for(let n=0;n<t.length;n++){let s=t[n];e.output=sl.default.dim(`[${n+1}/${t.length}] ${s.title}`),await s.fn(r??{},e)}}var Qe=e=>{let t=e??O(),r=(0,ot.join)(t,"package.json");if(!(0,vt.existsSync)(r))return null;try{return JSON.parse((0,vt.readFileSync)(r,"utf-8"))}catch{return null}},kt=e=>{let t={services:"services",apps:"apps",packages:"packages",contracts:"packages/contracts"},r=Qe(e);if(!r)return t;let n=r.pf?.paths;return{services:(typeof n?.services=="object"?n.services.path:n?.services)??t.services,apps:(typeof n?.apps=="object"?n.apps.path:n?.apps)??t.apps,packages:(typeof n?.packages=="object"?n.packages.path:n?.packages)??t.packages,contracts:(typeof n?.contracts=="object"?n.contracts.path:n?.contracts)??t.contracts}},$=e=>{let t=e??O(),r=kt(t);return{packagePath:(0,ot.join)(t,r.contracts),eventsPath:(0,ot.join)(t,r.contracts,"src","events"),indexPath:(0,ot.join)(t,r.contracts,"src","index.ts"),relativePath:r.contracts}},Sg=e=>{let t=(0,ot.join)(e,"package.json");if(!(0,vt.existsSync)(t))return!1;try{let r=JSON.parse((0,vt.readFileSync)(t,"utf-8"));if(!r.workspaces)return!1;if(r.pf||(0,vt.existsSync)((0,ot.join)(e,"turbo.json")))return!0;let n=xa.some(o=>(0,vt.existsSync)((0,ot.join)(e,o))),s=(0,vt.existsSync)((0,ot.join)(e,"infra"));return!!(n&&s)}catch{return!1}};function O(){let e=process.cwd();for(;!Sg(e);){let t=e.slice(0,e.lastIndexOf("/"));if(t===e)throw new Error(`
17
17
  \x1B[31m\u2716\x1B[0m Not in a workspace directory
18
18
 
19
19
  Current directory: ${process.cwd()}
@@ -23,17 +23,17 @@ This command must be run from within a workspace created with \x1B[36mpf new wor
23
23
  To create a new workspace, run:
24
24
 
25
25
  \x1B[36mpf new workspace my-platform\x1B[0m
26
- `);e=t}return e}function is(){let e=O(),t=(0,ot.join)(e,"package.json");if(!(0,vt.existsSync)(t))return`@${e.split("/").pop()||"workspace"}`;try{let n=JSON.parse((0,vt.readFileSync)(t,"utf-8")).name;return n?n.startsWith("@")?n.split("/")[0]:`@${n}`:`@${e.split("/").pop()||"workspace"}`}catch{return`@${e.split("/").pop()||"workspace"}`}}function qt(e,t,r=process.cwd()){let n=(0,ot.join)(r,"package.json"),s=(0,ve.readJsonSync)(n);vg(s,e,t),(0,ve.writeJsonSync)(n,s,{spaces:2,EOL:`
27
- `,encoding:"utf-8"})}function nl(e,t=process.cwd()){let r=(0,ot.join)(t,"package.json"),n=(0,ve.readJsonSync)(r),s=e.split("."),o=n;for(let i of s){if(o===null||typeof o!="object"||!(i in o))return;o=o[i]}return o}function vg(e,t,r){let n=t.split("."),s=e;for(let o=0;o<n.length-1;o++){let i=n[o];(!(i in s)||typeof s[i]!="object"||s[i]===null)&&(s[i]={}),s=s[i]}s[n[n.length-1]]=r}var as=e=>{let t=tl();return(0,ve.readJSONSync)((0,ot.resolve)(t,e),{encoding:"utf-8"})},Ot=as("package.json"),kg={docs:{base:["service.md"],frameworks:{}},serviceTypes:{hono:{commandType:"hono-micro",entryPoint:"src/index.ts",skipFiles:[]},nest:{commandType:"nest-micro",entryPoint:"src/main.ts",skipFiles:[]}}},tn=()=>Ot.generatorConfig??kg;var wl=require("node:fs"),Cl=require("node:path"),zo=require("node:process"),bl=require("execa");var Uo=require("node:child_process"),ml=require("node:path"),gl=require("execa");var pl=require("node:fs"),fl=require("node:path"),dl=b(ul()),Go=(e,t)=>{let r=(0,fl.resolve)(t,e);return(0,pl.existsSync)(r)?(0,dl.config)({path:r,processEnv:{}}).parsed||{}:{}},hl=(e,t)=>{let r=Go(e,t),n=[];for(let[s,o]of Object.entries(r))if(s.endsWith("_PORT")&&o){let i=Number.parseInt(o,10);!Number.isNaN(i)&&i>0&&n.push(i)}return n};var Ho={...process.env,NODE_NO_WARNINGS:"1"},Gg=(e,t,r)=>e?"pipe":t||r?["ignore","pipe","pipe"]:"inherit",Hg=(e,t,r)=>e?{...Ho,...e}:t||r?{...Ho,CI:"true"}:{...Ho},Ug=e=>e.includes("EEXIST")||e.includes("failed to link package");async function de(e,t,{cwd:r=process.cwd(),task:n,shell:s,context:o=e,quiet:i=!1,nonInteractive:a=!1,env:c}={}){try{t.length===0&&(t=e.split(" ").slice(1));let l=(0,gl.execa)(e,t,{cwd:r,stdio:Gg(i,n,a),all:n||a?!0:void 0,shell:s??!0,env:Hg(c,n,a)});l.all&&l.all.on("data",u=>{let p=u.toString().trim();n?(n.output=p,p.length&&w.storeLog(p,o)):a&&p.length&&console.log(p)}),await l}catch(l){let u=l instanceof Error?l.message:String(l);if(Ug(u))return;throw new Error(zg(u))}}var zg=e=>{let t=e.match(/error: (.+)/);return t?t[1].trim():e};function Dl(e,t,r={}){let{cwd:n=process.cwd(),envFile:s,detached:o=!0,pipeStdout:i=!1,onStdout:a,onStderr:c,onExit:l}=r,u=s?Go(s,n):{},p=(0,ml.resolve)(n,"node_modules",".bin"),d=process.env.PATH||"",f=`${p}:${d}`,m={...process.env,...u,PATH:f,FORCE_COLOR:"1"},h=(0,Uo.spawn)(e,t,{cwd:n,env:m,stdio:["inherit",i?"pipe":"inherit","pipe"],detached:o});return a&&i&&h.stdout?.on("data",a),c&&h.stderr?.on("data",c),l&&h.on("exit",l),h}function ls(e,t,r={}){let{cwd:n=process.cwd()}=r;(0,Uo.spawn)(e,t,{cwd:n,stdio:"inherit",shell:!0}).on("exit",o=>process.exit(o||0))}async function yl(e){let{execSync:t}=await import("node:child_process");for(let r of e)try{let s=t(`lsof -ti:${r}`,{encoding:"utf8",stdio:"pipe"}).trim().split(`
28
- `).filter(Boolean);for(let o of s)try{process.kill(Number.parseInt(o,10),"SIGKILL")}catch{}}catch{}}var us=e=>Nr(e);function Ko(e=process.cwd()){let t=r=>(0,wl.existsSync)((0,Cl.join)(e,r));if(t("bun.lock")||t("bun.lockb"))return"bun";if(t("pnpm-lock.yaml"))return"pnpm";if(t("yarn.lock"))return"yarn";if(t("package-lock.json"))return"npm"}function B(e){return Ko(e)??Jo()}function Jo(){return us("bun")?"bun":us("pnpm")?"pnpm":us("yarn")?"yarn":"npm"}function xl(){return["bun","pnpm","yarn","npm"].filter(us)}async function Et(e,t){let r=Jg(e,t),{mergedOptions:n,packages:s}=r,{cwd:o=process.cwd(),flags:i=[],task:a,quiet:c}=n,l=n.packageManager??B(),u=[],p=Array.isArray(s)?s:[s];l==="bun"&&(p=p.map(f=>f.replace("git+ssh://",""))),l==="pnpm"&&(u.push("--config.engine-strict=false"),u.push("--no-frozen-lockfile")),["yarn","npm"].includes(l)&&u.push("--ignore-engines");let d=p.length?l==="npm"?["install",...i,...u,...p]:["add",...i,...u,...p]:["install",...i,...u];await de(l,d,{cwd:o,task:a,quiet:c})}async function vl(e){let t=["-g"],r=[...e.flags??[],...t];await Et({...e,flags:r,packageManager:e.packageManager??B()})}function kl(e,t,r){let{args:n,mergedOptions:s}=Sl(t??[],r),o=s.manager??B(),{command:i,args:a}=El(o);console.log(`
26
+ `);e=t}return e}function cs(){let e=O(),t=(0,ot.join)(e,"package.json");if(!(0,vt.existsSync)(t))return`@${e.split("/").pop()||"workspace"}`;try{let n=JSON.parse((0,vt.readFileSync)(t,"utf-8")).name;return n?n.startsWith("@")?n.split("/")[0]:`@${n}`:`@${e.split("/").pop()||"workspace"}`}catch{return`@${e.split("/").pop()||"workspace"}`}}function qt(e,t,r=process.cwd()){let n=(0,ot.join)(r,"package.json"),s=(0,ve.readJsonSync)(n);Fg(s,e,t),(0,ve.writeJsonSync)(n,s,{spaces:2,EOL:`
27
+ `,encoding:"utf-8"})}function ol(e,t=process.cwd()){let r=(0,ot.join)(t,"package.json"),n=(0,ve.readJsonSync)(r),s=e.split("."),o=n;for(let i of s){if(o===null||typeof o!="object"||!(i in o))return;o=o[i]}return o}function Fg(e,t,r){let n=t.split("."),s=e;for(let o=0;o<n.length-1;o++){let i=n[o];(!(i in s)||typeof s[i]!="object"||s[i]===null)&&(s[i]={}),s=s[i]}s[n[n.length-1]]=r}var ls=e=>{let t=rl();return(0,ve.readJSONSync)((0,ot.resolve)(t,e),{encoding:"utf-8"})},Ot=ls("package.json"),Tg={docs:{base:["service.md"],frameworks:{}},serviceTypes:{hono:{commandType:"hono-micro",entryPoint:"src/index.ts",skipFiles:[]},nest:{commandType:"nest-micro",entryPoint:"src/main.ts",skipFiles:[]}}},tn=()=>Ot.generatorConfig??Tg;var bl=require("node:fs"),xl=require("node:path"),Jo=require("node:process"),vl=require("execa");var Ko=require("node:child_process"),Dl=require("node:path"),yl=require("execa");var dl=require("node:fs"),hl=require("node:path"),ml=b(fl()),Uo=(e,t)=>{let r=(0,hl.resolve)(t,e);return(0,dl.existsSync)(r)?(0,ml.config)({path:r,processEnv:{}}).parsed||{}:{}},gl=(e,t)=>{let r=Uo(e,t),n=[];for(let[s,o]of Object.entries(r))if(s.endsWith("_PORT")&&o){let i=Number.parseInt(o,10);!Number.isNaN(i)&&i>0&&n.push(i)}return n};var zo={...process.env,NODE_NO_WARNINGS:"1"},Kg=(e,t,r)=>e?"pipe":t||r?["ignore","pipe","pipe"]:"inherit",Jg=(e,t,r)=>e?{...zo,...e}:t||r?{...zo,CI:"true"}:{...zo},qg=e=>e.includes("EEXIST")||e.includes("failed to link package");async function de(e,t,{cwd:r=process.cwd(),task:n,shell:s,context:o=e,quiet:i=!1,nonInteractive:a=!1,env:c}={}){try{t.length===0&&(t=e.split(" ").slice(1));let l=(0,yl.execa)(e,t,{cwd:r,stdio:Kg(i,n,a),all:n||a?!0:void 0,shell:s??!0,env:Jg(c,n,a)});l.all&&l.all.on("data",u=>{let p=u.toString().trim();n?(n.output=p,p.length&&w.storeLog(p,o)):a&&p.length&&console.log(p)}),await l}catch(l){let u=l instanceof Error?l.message:String(l);if(qg(u))return;throw new Error(Vg(u))}}var Vg=e=>{let t=e.match(/error: (.+)/);return t?t[1].trim():e};function wl(e,t,r={}){let{cwd:n=process.cwd(),envFile:s,detached:o=!0,pipeStdout:i=!1,onStdout:a,onStderr:c,onExit:l}=r,u=s?Uo(s,n):{},p=(0,Dl.resolve)(n,"node_modules",".bin"),d=process.env.PATH||"",f=`${p}:${d}`,m={...process.env,...u,PATH:f,FORCE_COLOR:"1"},h=(0,Ko.spawn)(e,t,{cwd:n,env:m,stdio:["inherit",i?"pipe":"inherit","pipe"],detached:o});return a&&i&&h.stdout?.on("data",a),c&&h.stderr?.on("data",c),l&&h.on("exit",l),h}function ps(e,t,r={}){let{cwd:n=process.cwd()}=r;(0,Ko.spawn)(e,t,{cwd:n,stdio:"inherit",shell:!0}).on("exit",o=>process.exit(o||0))}async function Cl(e){let{execSync:t}=await import("node:child_process");for(let r of e)try{let s=t(`lsof -ti:${r}`,{encoding:"utf8",stdio:"pipe"}).trim().split(`
28
+ `).filter(Boolean);for(let o of s)try{process.kill(Number.parseInt(o,10),"SIGKILL")}catch{}}catch{}}var fs=e=>Nr(e);function qo(e=process.cwd()){let t=r=>(0,bl.existsSync)((0,xl.join)(e,r));if(t("bun.lock")||t("bun.lockb"))return"bun";if(t("pnpm-lock.yaml"))return"pnpm";if(t("yarn.lock"))return"yarn";if(t("package-lock.json"))return"npm"}function B(e){return qo(e)??Vo()}function Vo(){return fs("bun")?"bun":fs("pnpm")?"pnpm":fs("yarn")?"yarn":"npm"}function kl(){return["bun","pnpm","yarn","npm"].filter(fs)}async function Et(e,t){let r=Zg(e,t),{mergedOptions:n,packages:s}=r,{cwd:o=process.cwd(),flags:i=[],task:a,quiet:c}=n,l=n.packageManager??B(),u=[],p=Array.isArray(s)?s:[s];l==="bun"&&(p=p.map(f=>f.replace("git+ssh://",""))),l==="pnpm"&&(u.push("--config.engine-strict=false"),u.push("--no-frozen-lockfile")),["yarn","npm"].includes(l)&&u.push("--ignore-engines");let d=p.length?l==="npm"?["install",...i,...u,...p]:["add",...i,...u,...p]:["install",...i,...u];await de(l,d,{cwd:o,task:a,quiet:c})}async function El(e){let t=["-g"],r=[...e.flags??[],...t];await Et({...e,flags:r,packageManager:e.packageManager??B()})}function Sl(e,t,r){let{args:n,mergedOptions:s}=Tl(t??[],r),o=s.manager??B(),{command:i,args:a}=Fl(o);console.log(`
29
29
  Running command: ${i} ${[...a,e,...n].join(" ")}
30
- `),(0,bl.execaSync)(i,[...a,e,...n],{cwd:s.cwd??(0,zo.cwd)(),stdio:"inherit",preferLocal:!0})}async function Yt(e,t,r){let{args:n,mergedOptions:s}=Sl(t??[],r),o=s.manager??B(),{command:i,args:a}=El(o);await de(i,[...a,e,...n],s)}async function rn(e,t){let{script:r,mergedOptions:n}=qg(e,t),s=n.packageManager??B();await de(s,["run",r,...n.args??[]],{cwd:n.cwd??(0,zo.cwd)(),task:n.task})}function El(e){let r={bun:"bunx",pnpm:"npx",yarn:"npx",npm:"npx"}[e];if(!r)throw new Error(`No executor found for the detected package manager: ${e}`);let[n,...s]=r.split(" ");return{command:n,args:s}}function Jg(e,t){return Array.isArray(e)?{packages:e,mergedOptions:{...t,packages:e}}:{packages:e.packages??[],mergedOptions:e}}function Sl(e,t){return Array.isArray(e)?{args:e,mergedOptions:t??{}}:{args:[],mergedOptions:e}}function qg(e,t){return typeof e=="string"?{script:e,mergedOptions:t??{}}:{script:e.script,mergedOptions:e}}var Vg=e=>e==="yarn"?["npm","audit"]:["audit"],Al=new Tl.Command("audit").description("Run security audit on dependencies").allowUnknownOption(!0).action((e,t)=>{let r=O(),n=B(),s=Vg(n),o=t.args||[];console.log(Fl.default.dim(`Running ${n} ${[...s,...o].join(" ")}`)),ls(n,[...s,...o],{cwd:r})});var Mt=require("listr2"),Yg=Object.defineProperty,Pl=(e,t)=>Yg(e,"name",{value:t,configurable:!0}),R=class extends Mt.ListrPromptAdapter{static{Pl(this,"ListrEnquirerPromptAdapter")}error;prompt;get instance(){return this.prompt}async run(e,t){Array.isArray(e)?e.length===1&&(e=e.map(s=>({...s,name:"default"}))):e=[{...e,name:"default"}],e=e.map(s=>({onCancel:Pl(()=>(this.error=new Mt.PromptError("Cancelled prompt."),!0),"onCancel"),...s,stdout:t?.stdout??this.wrapper.stdout(Mt.ListrTaskEventType.PROMPT)}));let r;if(t?.enquirer)r=t.enquirer;else try{r=await import("enquirer").then(s=>s.default?new s.default:new s)}catch{throw this.reportFailed(),new Mt.PromptError("Enquirer is a optional peer dependency that must be installed separately.")}this.reportStarted(),this.task.on(Mt.ListrTaskEventType.STATE,s=>{s===Mt.ListrTaskState.SKIPPED&&this.prompt&&!this.error&&this.cancel({throw:!1})});let n;try{n=await r.once("prompt",s=>this.prompt=s).prompt(e)}catch(s){throw this.reportFailed(),this.error?this.error:s}return this.reportCompleted(),e.length===1?n.default:n}cancel(e){!this.prompt||this.error||(e?.throw?this.prompt.cancel():this.prompt.submit(),this.reportFailed())}};var re=b(require("chalk"));var rr=require("node:fs"),Bl=require("node:os"),jl=require("node:path");var he=require("node:crypto"),er=require("node:fs"),ke=require("node:os"),Rl=require("node:path"),qo=(0,Rl.join)((0,ke.homedir)(),".platform-sdk-keys"),Il="aes-256-gcm",Nl=()=>{let e=`${(0,ke.hostname)()}:${(0,ke.userInfo)().username}:${(0,ke.homedir)()}`;return(0,he.createHash)("sha256").update(e).digest()},Ol=()=>{if(!(0,er.existsSync)(qo))return{};try{return JSON.parse((0,er.readFileSync)(qo,"utf-8"))}catch{return{}}},Zg=e=>{(0,er.writeFileSync)(qo,JSON.stringify(e,null,2),{mode:384})},Xg=e=>{let t=Nl(),r=(0,he.randomBytes)(16),n=(0,he.createCipheriv)(Il,t,r),s=n.update(e,"utf8","hex");return s+=n.final("hex"),{iv:r.toString("hex"),tag:n.getAuthTag().toString("hex"),data:s}},Qg=e=>{let t=Nl(),r=Buffer.from(e.iv,"hex"),n=Buffer.from(e.tag,"hex"),s=(0,he.createDecipheriv)(Il,t,r);s.setAuthTag(n);let o=s.update(e.data,"hex","utf8");return o+=s.final("utf8"),o};async function Ml(e,t){let r=Ol();r[e]=Xg(t),Zg(r)}async function ps(e){let r=Ol()[e];if(!r)return null;try{return Qg(r)}catch{return null}}var nn={openai:{id:"openai",name:"OpenAI",defaultApiKeyEnvVar:"OPENAI_API_KEY",defaultModel:"gpt-4o-mini",modelsApiUrl:"https://api.openai.com/v1/models",apiKeyUrl:"https://platform.openai.com/api-keys",buildHeaders:e=>({Authorization:`Bearer ${e}`}),parseModelsResponse:e=>e.data??[],modelFilters:[/^gpt-4/,/^gpt-3\.5/,/^o1/,/^o3/]},anthropic:{id:"anthropic",name:"Anthropic (Claude)",defaultApiKeyEnvVar:"ANTHROPIC_API_KEY",defaultModel:"claude-sonnet-4-20250514",modelsApiUrl:"https://api.anthropic.com/v1/models",apiKeyUrl:"https://console.anthropic.com/settings/keys",buildHeaders:e=>({"x-api-key":e,"anthropic-version":"2023-06-01"}),parseModelsResponse:e=>(e.data??[]).map(r=>({id:r.id,created:new Date(r.created_at).getTime()})),modelFilters:[/^claude-/]}};function $l(){return Object.entries(nn).map(([e,t])=>({name:t.name,value:e}))}function sn(e){let t=nn[e];if(!t)throw new Error(`Unknown AI provider: ${e}`);return t}var Ee=(0,jl.join)((0,Bl.homedir)(),".platform-sdk-ai.json"),tD=()=>{let e="anthropic",t=nn[e];return{provider:e,model:t.defaultModel}},Vo=tD();function on(){return(0,rr.existsSync)(Ee)}function fs(){if(!on())throw new Error("AI configuration not found. Please run 'pf ai:setup' to configure your AI provider.");try{let e=(0,rr.readFileSync)(Ee,"utf-8"),t=JSON.parse(e);return{...Vo,...t}}catch{throw new Error(`Failed to load AI configuration from ${Ee}. Please run 'pf setup --ai' again.`)}}function _l(e){let t=JSON.stringify(e,null,2);(0,rr.writeFileSync)(Ee,t,"utf-8")}async function Ll(e,t){await Ml(e,t)}async function Wl(e){let t=await ps(e.provider);if(t)return t;let r=nn[e.provider],n=process.env[r.defaultApiKeyEnvVar];if(n)return n;throw new Error("API key not found. Please run 'pf setup --ai' to configure your API key.")}var eD=async(e,t,r,n)=>{let{createOpenAI:s}=await import("@ai-sdk/openai"),o=s({apiKey:r});if(n.onToken){let{streamText:c}=await import("ai"),l=c({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature}),u="";for await(let p of(await l).textStream)u+=p,n.onToken(p);return u}let{generateText:i}=await import("ai"),{text:a}=await i({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature});return a},rD=async(e,t,r,n)=>{let{createAnthropic:s}=await import("@ai-sdk/anthropic"),o=s({apiKey:r});if(n.onToken){let{streamText:c}=await import("ai"),l=c({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature}),u="";for await(let p of(await l).textStream)u+=p,n.onToken(p);return u}let{generateText:i}=await import("ai"),{text:a}=await i({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature});return a};async function Gl(e,t,r={}){let{system:n,maxTokens:s=4096,temperature:o=.7,onToken:i}=r,a=await Wl(e);switch(e.provider){case"openai":return eD(t,e.model,a,{system:n,maxTokens:s,temperature:o,onToken:i});case"anthropic":return rD(t,e.model,a,{system:n,maxTokens:s,temperature:o,onToken:i});default:throw new Error(`Unsupported AI provider: ${e.provider}`)}}var Xt=require("node:fs"),ur=require("node:path"),ku=require("@inquirer/prompts"),T=b(require("chalk")),Eu=b(require("ora"));var nr=require("node:fs"),an=require("node:path"),ds=b(require("chokidar"));var cn=".pf-generating",nD=e=>(0,nr.existsSync)((0,an.join)(e,cn)),sD=e=>{let t=(0,an.join)(e,cn);(0,nr.existsSync)(t)&&(0,nr.unlinkSync)(t)},oD=e=>e?Object.values(e).filter(t=>typeof t=="object"&&t!==null&&t.watch===!0&&typeof t.path=="string").map(t=>t.path):["services","apps"],Hl=(e,t)=>{sD(e);let r=Qe(e),n=oD(r?.pf?.paths),s=(0,an.join)(e,cn),o=()=>{nD(e)||t()};ds.default.watch(s,{ignoreInitial:!0}).on("unlink",()=>t());for(let i of n){let a=(0,an.join)(e,i);(0,nr.existsSync)(a)&&(ds.default.watch(a,{ignoreInitial:!0,depth:0}).on("addDir",o).on("unlinkDir",o),ds.default.watch(`${a}/*/package.json`,{ignoreInitial:!0}).on("add",o).on("change",o).on("unlink",o))}};var Ds=require("node:fs"),Xl=require("node:path"),Ql=require("ts-morph");var lt=require("node:fs"),ln=require("node:path");var Ul=e=>e.replace(/\./g,"-").toLowerCase(),iD=e=>e.split(/[-.]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(""),aD=e=>({string:"z.string()",number:"z.number()",boolean:"z.boolean()",date:"z.string().datetime()",array:"z.array(z.unknown())",object:"z.record(z.unknown())","string?":"z.string().optional()","number?":"z.number().optional()","boolean?":"z.boolean().optional()"})[e.toLowerCase()]||`z.${e}()`,cD=e=>!e||Object.keys(e).length===0?` id: z.string(),
31
- createdAt: z.string(),`:Object.entries(e).map(([t,r])=>` ${t}: ${aD(r)},`).join(`
32
- `),lD=e=>e.endsWith("s")?e:e.endsWith("y")?`${e.slice(0,-1)}ies`:e.endsWith("ch")||e.endsWith("sh")?`${e}es`:`${e}s`,sr=e=>{let t=Ul(e),r=iD(e),n=e.split(".")[0],s=lD(n).toUpperCase();return{eventName:t,contractName:`${r}Contract`,schemaName:`${r}Schema`,typeName:`${r}Data`,streamName:s}},Yo=e=>{let t=or(e);if((0,lt.existsSync)(t))return!0;let{eventsPath:r}=$(),n=Ul(e),s=(0,ln.join)(r,`${n}.ts`);return(0,lt.existsSync)(s)},Zo=(e,t)=>{let{eventsPath:r}=$(),{contractName:n,schemaName:s,typeName:o,streamName:i}=sr(e),a=`import { createContract } from '@crossdelta/cloudevents'
30
+ `),(0,vl.execaSync)(i,[...a,e,...n],{cwd:s.cwd??(0,Jo.cwd)(),stdio:"inherit",preferLocal:!0})}async function Yt(e,t,r){let{args:n,mergedOptions:s}=Tl(t??[],r),o=s.manager??B(),{command:i,args:a}=Fl(o);await de(i,[...a,e,...n],s)}async function rn(e,t){let{script:r,mergedOptions:n}=Xg(e,t),s=n.packageManager??B();await de(s,["run",r,...n.args??[]],{cwd:n.cwd??(0,Jo.cwd)(),task:n.task})}function Fl(e){let r={bun:"bunx",pnpm:"npx",yarn:"npx",npm:"npx"}[e];if(!r)throw new Error(`No executor found for the detected package manager: ${e}`);let[n,...s]=r.split(" ");return{command:n,args:s}}function Zg(e,t){return Array.isArray(e)?{packages:e,mergedOptions:{...t,packages:e}}:{packages:e.packages??[],mergedOptions:e}}function Tl(e,t){return Array.isArray(e)?{args:e,mergedOptions:t??{}}:{args:[],mergedOptions:e}}function Xg(e,t){return typeof e=="string"?{script:e,mergedOptions:t??{}}:{script:e.script,mergedOptions:e}}var Qg=e=>e==="yarn"?["npm","audit"]:["audit"],Rl=new Pl.Command("audit").description("Run security audit on dependencies").allowUnknownOption(!0).action((e,t)=>{let r=O(),n=B(),s=Qg(n),o=t.args||[];console.log(Al.default.dim(`Running ${n} ${[...s,...o].join(" ")}`)),ps(n,[...s,...o],{cwd:r})});var Mt=require("listr2"),tD=Object.defineProperty,Il=(e,t)=>tD(e,"name",{value:t,configurable:!0}),R=class extends Mt.ListrPromptAdapter{static{Il(this,"ListrEnquirerPromptAdapter")}error;prompt;get instance(){return this.prompt}async run(e,t){Array.isArray(e)?e.length===1&&(e=e.map(s=>({...s,name:"default"}))):e=[{...e,name:"default"}],e=e.map(s=>({onCancel:Il(()=>(this.error=new Mt.PromptError("Cancelled prompt."),!0),"onCancel"),...s,stdout:t?.stdout??this.wrapper.stdout(Mt.ListrTaskEventType.PROMPT)}));let r;if(t?.enquirer)r=t.enquirer;else try{r=await import("enquirer").then(s=>s.default?new s.default:new s)}catch{throw this.reportFailed(),new Mt.PromptError("Enquirer is a optional peer dependency that must be installed separately.")}this.reportStarted(),this.task.on(Mt.ListrTaskEventType.STATE,s=>{s===Mt.ListrTaskState.SKIPPED&&this.prompt&&!this.error&&this.cancel({throw:!1})});let n;try{n=await r.once("prompt",s=>this.prompt=s).prompt(e)}catch(s){throw this.reportFailed(),this.error?this.error:s}return this.reportCompleted(),e.length===1?n.default:n}cancel(e){!this.prompt||this.error||(e?.throw?this.prompt.cancel():this.prompt.submit(),this.reportFailed())}};var re=b(require("chalk"));var rr=require("node:fs"),_l=require("node:os"),Ll=require("node:path");var he=require("node:crypto"),er=require("node:fs"),ke=require("node:os"),Nl=require("node:path"),Yo=(0,Nl.join)((0,ke.homedir)(),".platform-sdk-keys"),Ol="aes-256-gcm",Ml=()=>{let e=`${(0,ke.hostname)()}:${(0,ke.userInfo)().username}:${(0,ke.homedir)()}`;return(0,he.createHash)("sha256").update(e).digest()},$l=()=>{if(!(0,er.existsSync)(Yo))return{};try{return JSON.parse((0,er.readFileSync)(Yo,"utf-8"))}catch{return{}}},eD=e=>{(0,er.writeFileSync)(Yo,JSON.stringify(e,null,2),{mode:384})},rD=e=>{let t=Ml(),r=(0,he.randomBytes)(16),n=(0,he.createCipheriv)(Ol,t,r),s=n.update(e,"utf8","hex");return s+=n.final("hex"),{iv:r.toString("hex"),tag:n.getAuthTag().toString("hex"),data:s}},nD=e=>{let t=Ml(),r=Buffer.from(e.iv,"hex"),n=Buffer.from(e.tag,"hex"),s=(0,he.createDecipheriv)(Ol,t,r);s.setAuthTag(n);let o=s.update(e.data,"hex","utf8");return o+=s.final("utf8"),o};async function Bl(e,t){let r=$l();r[e]=rD(t),eD(r)}async function ds(e){let r=$l()[e];if(!r)return null;try{return nD(r)}catch{return null}}var nn={openai:{id:"openai",name:"OpenAI",defaultApiKeyEnvVar:"OPENAI_API_KEY",defaultModel:"gpt-4o-mini",modelsApiUrl:"https://api.openai.com/v1/models",apiKeyUrl:"https://platform.openai.com/api-keys",buildHeaders:e=>({Authorization:`Bearer ${e}`}),parseModelsResponse:e=>e.data??[],modelFilters:[/^gpt-4/,/^gpt-3\.5/,/^o1/,/^o3/]},anthropic:{id:"anthropic",name:"Anthropic (Claude)",defaultApiKeyEnvVar:"ANTHROPIC_API_KEY",defaultModel:"claude-sonnet-4-20250514",modelsApiUrl:"https://api.anthropic.com/v1/models",apiKeyUrl:"https://console.anthropic.com/settings/keys",buildHeaders:e=>({"x-api-key":e,"anthropic-version":"2023-06-01"}),parseModelsResponse:e=>(e.data??[]).map(r=>({id:r.id,created:new Date(r.created_at).getTime()})),modelFilters:[/^claude-/]}};function jl(){return Object.entries(nn).map(([e,t])=>({name:t.name,value:e}))}function sn(e){let t=nn[e];if(!t)throw new Error(`Unknown AI provider: ${e}`);return t}var Ee=(0,Ll.join)((0,_l.homedir)(),".platform-sdk-ai.json"),sD=()=>{let e="anthropic",t=nn[e];return{provider:e,model:t.defaultModel}},Zo=sD();function on(){return(0,rr.existsSync)(Ee)}function hs(){if(!on())throw new Error("AI configuration not found. Please run 'pf ai:setup' to configure your AI provider.");try{let e=(0,rr.readFileSync)(Ee,"utf-8"),t=JSON.parse(e);return{...Zo,...t}}catch{throw new Error(`Failed to load AI configuration from ${Ee}. Please run 'pf setup --ai' again.`)}}function Wl(e){let t=JSON.stringify(e,null,2);(0,rr.writeFileSync)(Ee,t,"utf-8")}async function Gl(e,t){await Bl(e,t)}async function Hl(e){let t=await ds(e.provider);if(t)return t;let r=nn[e.provider],n=process.env[r.defaultApiKeyEnvVar];if(n)return n;throw new Error("API key not found. Please run 'pf setup --ai' to configure your API key.")}var oD=async(e,t,r,n)=>{let{createOpenAI:s}=await import("@ai-sdk/openai"),o=s({apiKey:r});if(n.onToken){let{streamText:c}=await import("ai"),l=c({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature}),u="";for await(let p of(await l).textStream)u+=p,n.onToken(p);return u}let{generateText:i}=await import("ai"),{text:a}=await i({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature});return a},iD=async(e,t,r,n)=>{let{createAnthropic:s}=await import("@ai-sdk/anthropic"),o=s({apiKey:r});if(n.onToken){let{streamText:c}=await import("ai"),l=c({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature}),u="";for await(let p of(await l).textStream)u+=p,n.onToken(p);return u}let{generateText:i}=await import("ai"),{text:a}=await i({model:o(t),prompt:e,system:n.system,maxOutputTokens:n.maxTokens,temperature:n.temperature});return a};async function Ul(e,t,r={}){let{system:n,maxTokens:s=4096,temperature:o=.7,onToken:i}=r,a=await Hl(e);switch(e.provider){case"openai":return oD(t,e.model,a,{system:n,maxTokens:s,temperature:o,onToken:i});case"anthropic":return iD(t,e.model,a,{system:n,maxTokens:s,temperature:o,onToken:i});default:throw new Error(`Unsupported AI provider: ${e.provider}`)}}var Xt=require("node:fs"),ur=require("node:path"),Fu=require("@inquirer/prompts"),T=b(require("chalk")),Tu=b(require("ora"));var Xo=require("node:fs"),gs=require("node:path");var nr=require("node:fs"),an=require("node:path"),ms=b(require("chokidar"));var cn=".pf-generating",aD=e=>(0,nr.existsSync)((0,an.join)(e,cn)),cD=e=>{let t=(0,an.join)(e,cn);(0,nr.existsSync)(t)&&(0,nr.unlinkSync)(t)},lD=e=>e?Object.values(e).filter(t=>typeof t=="object"&&t!==null&&t.watch===!0&&typeof t.path=="string").map(t=>t.path):["services","apps"],zl=(e,t)=>{cD(e);let r=Qe(e),n=lD(r?.pf?.paths),s=(0,an.join)(e,cn),o=()=>{aD(e)||t()};ms.default.watch(s,{ignoreInitial:!0}).on("unlink",()=>t());for(let i of n){let a=(0,an.join)(e,i);(0,nr.existsSync)(a)&&(ms.default.watch(a,{ignoreInitial:!0,depth:0}).on("addDir",o).on("unlinkDir",o),ms.default.watch(`${a}/*/package.json`,{ignoreInitial:!0}).on("add",o).on("change",o).on("unlink",o))}};var ln=(e=__dirname)=>{let t=n=>(0,Xo.existsSync)((0,gs.join)(n,"package.json")),r=(0,gs.dirname)(e);if(t(e))return e;if(e==="/")throw new Error("Could not find package.json (package root)");return ln(r)},Kl=(e,t)=>{let r=e.find(Xo.existsSync);if(!r)throw new Error(t??`Directory not found. Searched in: ${e.join(", ")}`);return r};var Cs=require("node:fs"),eu=require("node:path"),ru=require("ts-morph");var lt=require("node:fs"),un=require("node:path");var Jl=e=>e.replace(/\./g,"-").toLowerCase(),uD=e=>e.split(/[-.]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(""),pD=e=>({string:"z.string()",number:"z.number()",boolean:"z.boolean()",date:"z.string().datetime()",array:"z.array(z.unknown())",object:"z.record(z.unknown())","string?":"z.string().optional()","number?":"z.number().optional()","boolean?":"z.boolean().optional()"})[e.toLowerCase()]||`z.${e}()`,fD=e=>!e||Object.keys(e).length===0?` id: z.string(),
31
+ createdAt: z.string(),`:Object.entries(e).map(([t,r])=>` ${t}: ${pD(r)},`).join(`
32
+ `),dD=e=>e.endsWith("s")?e:e.endsWith("y")?`${e.slice(0,-1)}ies`:e.endsWith("ch")||e.endsWith("sh")?`${e}es`:`${e}s`,sr=e=>{let t=Jl(e),r=uD(e),n=e.split(".")[0],s=dD(n).toUpperCase();return{eventName:t,contractName:`${r}Contract`,schemaName:`${r}Schema`,typeName:`${r}Data`,streamName:s}},Qo=e=>{let t=or(e);if((0,lt.existsSync)(t))return!0;let{eventsPath:r}=$(),n=Jl(e),s=(0,un.join)(r,`${n}.ts`);return(0,lt.existsSync)(s)},ti=(e,t)=>{let{eventsPath:r}=$(),{contractName:n,schemaName:s,typeName:o,streamName:i}=sr(e),a=`import { createContract } from '@crossdelta/cloudevents'
33
33
  import { z } from 'zod'
34
34
 
35
35
  export const ${s} = z.object({
36
- ${cD(t)}
36
+ ${fD(t)}
37
37
  })
38
38
 
39
39
  export const ${n} = createContract({
@@ -43,24 +43,24 @@ export const ${n} = createContract({
43
43
  })
44
44
 
45
45
  export type ${o} = z.infer<typeof ${n}.schema>
46
- `,c=e.split(".")[0],l=(0,ln.join)(r,c),u=or(e);return(0,lt.existsSync)(l)||(0,lt.mkdirSync)(l,{recursive:!0}),(0,lt.writeFileSync)(u,a,"utf-8"),u},or=e=>{let{eventsPath:t}=$(),r=e.split(".")[0],n=e.split(".").slice(1).join("-");return(0,ln.join)(t,r,`${n}.ts`)},Xo=e=>{let t=or(e);if(!(0,lt.existsSync)(t))return null;let r=(0,lt.readFileSync)(t,"utf-8"),n=r.match(/export const \w+Schema\s*=\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m);if(n)return n[1];let s=r.match(/schema:\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m);return s?s[1]:null},Qo=()=>{let{packagePath:e}=$(),t=(0,ln.join)(e,"package.json");if(!(0,lt.existsSync)(t))return"@my-platform";try{return JSON.parse((0,lt.readFileSync)(t,"utf-8")).name?.split("/")[0]??"@my-platform"}catch{return"@my-platform"}};var ms=require("node:fs"),ri=require("node:path");var et=require("node:fs"),ir=require("node:path");var hs=e=>e.split(".")[0].toUpperCase(),zl=(e,t)=>{let r=(0,ir.join)(e,"src","index.ts");if(!(0,et.existsSync)(r))return!1;let n=(0,et.readFileSync)(r,"utf-8"),s=t.toLowerCase();return new RegExp(`streams:\\s*\\[[^\\]]*['"]${t}['"]`).test(n)||n.includes(`stream: '${t}'`)?!0:new RegExp(`subjects:\\s*\\[.*['"]${s}\\.[*>]`).test(n)},uD=e=>{if(e.includes("@crossdelta/cloudevents"))return e;let t=`import { consumeJetStreams } from '@crossdelta/cloudevents'
46
+ `,c=e.split(".")[0],l=(0,un.join)(r,c),u=or(e);return(0,lt.existsSync)(l)||(0,lt.mkdirSync)(l,{recursive:!0}),(0,lt.writeFileSync)(u,a,"utf-8"),u},or=e=>{let{eventsPath:t}=$(),r=e.split(".")[0],n=e.split(".").slice(1).join("-");return(0,un.join)(t,r,`${n}.ts`)},ei=e=>{let t=or(e);if(!(0,lt.existsSync)(t))return null;let r=(0,lt.readFileSync)(t,"utf-8"),n=r.match(/export const \w+Schema\s*=\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m);if(n)return n[1];let s=r.match(/schema:\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m);return s?s[1]:null},ri=()=>{let{packagePath:e}=$(),t=(0,un.join)(e,"package.json");if(!(0,lt.existsSync)(t))return"@my-platform";try{return JSON.parse((0,lt.readFileSync)(t,"utf-8")).name?.split("/")[0]??"@my-platform"}catch{return"@my-platform"}};var ys=require("node:fs"),oi=require("node:path");var et=require("node:fs"),ir=require("node:path");var Ds=e=>e.split(".")[0].toUpperCase(),ql=(e,t)=>{let r=(0,ir.join)(e,"src","index.ts");if(!(0,et.existsSync)(r))return!1;let n=(0,et.readFileSync)(r,"utf-8"),s=t.toLowerCase();return new RegExp(`streams:\\s*\\[[^\\]]*['"]${t}['"]`).test(n)||n.includes(`stream: '${t}'`)?!0:new RegExp(`subjects:\\s*\\[.*['"]${s}\\.[*>]`).test(n)},hD=e=>{if(e.includes("@crossdelta/cloudevents"))return e;let t=`import { consumeJetStreams } from '@crossdelta/cloudevents'
47
47
  `,r=e.match(/import\s+['"]@crossdelta\/telemetry['"]\s*\n/);if(r){let s=(r.index??0)+r[0].length;return`${e.slice(0,s)}
48
- ${t}${e.slice(s)}`}let n=e.match(/import\s+.*\n/);if(n){let s=(n.index??0)+n[0].length;return e.slice(0,s)+t+e.slice(s)}return e},pD=(e,t,r)=>`
48
+ ${t}${e.slice(s)}`}let n=e.match(/import\s+.*\n/);if(n){let s=(n.index??0)+n[0].length;return e.slice(0,s)+t+e.slice(s)}return e},mD=(e,t,r)=>`
49
49
 
50
50
  // Consume from ${e} stream
51
51
  consumeJetStreams({
52
52
  streams: ['${e}'],
53
53
  consumer: '${r}-service',
54
54
  discover: './src/events/**/*.handler.ts',
55
- })`,ti=(e,t)=>{let r=hs(t),n=t.split(".")[0],s=(0,ir.join)(e,"src","index.ts"),o=(0,ir.join)(e,"src","main.ts");if(!(0,et.existsSync)(s)&&(0,et.existsSync)(o))return{added:!1,streamName:r};if(!(0,et.existsSync)(s))return{added:!1,streamName:r,warning:"Entry point not found (index.ts or main.ts)"};if(zl(e,r))return{added:!1,streamName:r};let i=(0,et.readFileSync)(s,"utf-8"),a=e.split("/").pop()||"unknown";i.includes("consumeJetStreams")||(i=uD(i));let c=pD(r,n,a),l=`${i.trimEnd()+c}
56
- `;return(0,et.writeFileSync)(s,l,"utf-8"),{added:!0,streamName:r}},ei=(e,t)=>{let{eventName:r,contractName:n,typeName:s}=sr(e),o=Qo(),i=(0,ir.join)(t,"src","events"),a=(0,ir.join)(i,`${r}.handler.ts`);if((0,et.existsSync)(a))return null;let c=`import { handleEvent } from '@crossdelta/cloudevents'
55
+ })`,ni=(e,t)=>{let r=Ds(t),n=t.split(".")[0],s=(0,ir.join)(e,"src","index.ts"),o=(0,ir.join)(e,"src","main.ts");if(!(0,et.existsSync)(s)&&(0,et.existsSync)(o))return{added:!1,streamName:r};if(!(0,et.existsSync)(s))return{added:!1,streamName:r,warning:"Entry point not found (index.ts or main.ts)"};if(ql(e,r))return{added:!1,streamName:r};let i=(0,et.readFileSync)(s,"utf-8"),a=e.split("/").pop()||"unknown";i.includes("consumeJetStreams")||(i=hD(i));let c=mD(r,n,a),l=`${i.trimEnd()+c}
56
+ `;return(0,et.writeFileSync)(s,l,"utf-8"),{added:!0,streamName:r}},si=(e,t)=>{let{eventName:r,contractName:n,typeName:s}=sr(e),o=ri(),i=(0,ir.join)(t,"src","events"),a=(0,ir.join)(i,`${r}.handler.ts`);if((0,et.existsSync)(a))return null;let c=`import { handleEvent } from '@crossdelta/cloudevents'
57
57
  import { ${n}, type ${s} } from '${o}/contracts'
58
58
 
59
59
  export default handleEvent(${n}, async (data: ${s}) => {
60
60
  // TODO: Implement event handling logic
61
61
  console.log('Received ${e}:', data)
62
62
  })
63
- `;return(0,et.existsSync)(i)||(0,et.mkdirSync)(i,{recursive:!0}),(0,et.writeFileSync)(a,c,"utf-8"),a};var Kl=e=>{try{return(0,ms.readdirSync)(e,{withFileTypes:!0}).flatMap(r=>{let n=(0,ri.join)(e,r.name);return r.isDirectory()?Kl(n):r.name.endsWith(".handler.ts")?[n]:[]})}catch{return[]}},ni=e=>{let t=(0,ri.join)(e,"src","events");return Kl(t).flatMap(n=>{let s=(0,ms.readFileSync)(n,"utf-8");return fD(n,s)})},fD=(e,t)=>{let r=dD(t);if(!r)return[];let o=(r.replace(/Contract$/,"").match(/[A-Z][a-z]*/g)??[]).map(i=>i.toLowerCase()).join(".");return[{filePath:e,eventType:o,contractName:r}]},dD=e=>{let r=/import\s+{([^}]+)}\s+from\s+['"]@[\w-]+\/contracts['"]/.exec(e);return r?r[1].split(",").map(o=>o.trim()).filter(o=>o.endsWith("Contract")).map(o=>o.replace(/\s+as\s+.+$/,"").trim()).at(0)??null:null},si=e=>{let t=e.reduce((r,n)=>{let s=n.eventType.split(".")[0],o=r.get(s)??[];return r.set(s,[...o,n]),r},new Map);return Array.from(t.entries()).map(([r,n])=>hD(r,n)).sort((r,n)=>r.stream.localeCompare(n.stream))},hD=(e,t)=>{let r=hs(t[0]?.eventType??`${e}.event`),n=`${e}.>`;return{stream:r,subjects:[n],handlers:t}},oi=(e,t)=>e.length===0?"":` // Services NEVER create streams!
63
+ `;return(0,et.existsSync)(i)||(0,et.mkdirSync)(i,{recursive:!0}),(0,et.writeFileSync)(a,c,"utf-8"),a};var Vl=e=>{try{return(0,ys.readdirSync)(e,{withFileTypes:!0}).flatMap(r=>{let n=(0,oi.join)(e,r.name);return r.isDirectory()?Vl(n):r.name.endsWith(".handler.ts")?[n]:[]})}catch{return[]}},ii=e=>{let t=(0,oi.join)(e,"src","events");return Vl(t).flatMap(n=>{let s=(0,ys.readFileSync)(n,"utf-8");return gD(n,s)})},gD=(e,t)=>{let r=DD(t);if(!r)return[];let o=(r.replace(/Contract$/,"").match(/[A-Z][a-z]*/g)??[]).map(i=>i.toLowerCase()).join(".");return[{filePath:e,eventType:o,contractName:r}]},DD=e=>{let r=/import\s+{([^}]+)}\s+from\s+['"]@[\w-]+\/contracts['"]/.exec(e);return r?r[1].split(",").map(o=>o.trim()).filter(o=>o.endsWith("Contract")).map(o=>o.replace(/\s+as\s+.+$/,"").trim()).at(0)??null:null},ai=e=>{let t=e.reduce((r,n)=>{let s=n.eventType.split(".")[0],o=r.get(s)??[];return r.set(s,[...o,n]),r},new Map);return Array.from(t.entries()).map(([r,n])=>yD(r,n)).sort((r,n)=>r.stream.localeCompare(n.stream))},yD=(e,t)=>{let r=Ds(t[0]?.eventType??`${e}.event`),n=`${e}.>`;return{stream:r,subjects:[n],handlers:t}},ci=(e,t)=>e.length===0?"":` // Services NEVER create streams!
64
64
  // - Development: pf dev auto-creates ephemeral streams from contracts
65
65
  // - Production: Pulumi materializes persistent streams
66
66
 
@@ -68,14 +68,14 @@ export default handleEvent(${n}, async (data: ${s}) => {
68
68
  streams: [${e.map(r=>`'${r.stream}'`).join(", ")}],
69
69
  consumer: '${t}',
70
70
  discover: './src/events/**/*.handler.ts',
71
- })`;var j=require("node:fs"),Zt=require("node:path");var mD=(e,t)=>{let r=`export * from './${t}'`;if(!(0,j.existsSync)(e)){let o=(0,Zt.dirname)(e);(0,j.existsSync)(o)||(0,j.mkdirSync)(o,{recursive:!0});let i=`/**
71
+ })`;var j=require("node:fs"),Zt=require("node:path");var wD=(e,t)=>{let r=`export * from './${t}'`;if(!(0,j.existsSync)(e)){let o=(0,Zt.dirname)(e);(0,j.existsSync)(o)||(0,j.mkdirSync)(o,{recursive:!0});let i=`/**
72
72
  * ${(0,Zt.dirname)(e).split("/").pop()} Domain Events
73
73
  */
74
74
 
75
75
  `;return(0,j.writeFileSync)(e,i+r+`
76
76
  `,"utf-8"),!0}let n=(0,j.readFileSync)(e,"utf-8");if(n.includes(`'./${t}'`))return!1;let s=n.trimEnd()+`
77
77
  `+r+`
78
- `;return(0,j.writeFileSync)(e,s,"utf-8"),!0},gD=(e,t)=>{let r=`export * from './${t}'`;if(!(0,j.existsSync)(e))return(0,j.writeFileSync)(e,`/**
78
+ `;return(0,j.writeFileSync)(e,s,"utf-8"),!0},CD=(e,t)=>{let r=`export * from './${t}'`;if(!(0,j.existsSync)(e))return(0,j.writeFileSync)(e,`/**
79
79
  * Event Contracts Index
80
80
  *
81
81
  * Re-exports all event contracts for convenient importing.
@@ -84,14 +84,14 @@ export default handleEvent(${n}, async (data: ${s}) => {
84
84
  `+r+`
85
85
  `,"utf-8"),!0;let s=(0,j.readFileSync)(e,"utf-8").split(`
86
86
  `);if(s.some(i=>i.trim()===r))return!1;let o=s.findLastIndex(i=>i.startsWith("export"));return o>=0?s.splice(o+1,0,r):s.push(r),(0,j.writeFileSync)(e,s.join(`
87
- `),"utf-8"),!0},DD=e=>{if(!(0,j.existsSync)(e))return!1;let t=(0,j.readFileSync)(e,"utf-8"),r=t;return r=r.replace(/\/\/ export \* from '\.\/events'/,"export * from './events'"),r=r.replace(/\/\/ export \* from '\.\/stream-policies'/,"export * from './stream-policies'"),r!==t?((0,j.writeFileSync)(e,r,"utf-8"),!0):!1},ii=e=>{let{packagePath:t}=$(),r=e.split(".")[0],n=e.split(".").slice(1).join("-"),s=(0,Zt.join)(t,"src","events"),o=(0,Zt.join)(s,r),i=(0,Zt.join)(o,"index.ts"),a=(0,Zt.join)(s,"index.ts"),c=(0,Zt.join)(t,"src","index.ts"),l=!1;return mD(i,n)&&(l=!0),gD(a,r)&&(l=!0),DD(c)&&(l=!0),l},ai=(e,t)=>{if(!(0,j.existsSync)(e))return!1;let r=`export * from './events/${t}'`,n=(0,j.readFileSync)(e,"utf-8");if(n.includes(`'./events/${t}'`))return!1;let s=n.split(`
87
+ `),"utf-8"),!0},bD=e=>{if(!(0,j.existsSync)(e))return!1;let t=(0,j.readFileSync)(e,"utf-8"),r=t;return r=r.replace(/\/\/ export \* from '\.\/events'/,"export * from './events'"),r=r.replace(/\/\/ export \* from '\.\/stream-policies'/,"export * from './stream-policies'"),r!==t?((0,j.writeFileSync)(e,r,"utf-8"),!0):!1},li=e=>{let{packagePath:t}=$(),r=e.split(".")[0],n=e.split(".").slice(1).join("-"),s=(0,Zt.join)(t,"src","events"),o=(0,Zt.join)(s,r),i=(0,Zt.join)(o,"index.ts"),a=(0,Zt.join)(s,"index.ts"),c=(0,Zt.join)(t,"src","index.ts"),l=!1;return wD(i,n)&&(l=!0),CD(a,r)&&(l=!0),bD(c)&&(l=!0),l},ui=(e,t)=>{if(!(0,j.existsSync)(e))return!1;let r=`export * from './events/${t}'`,n=(0,j.readFileSync)(e,"utf-8");if(n.includes(`'./events/${t}'`))return!1;let s=n.split(`
88
88
  `),o=s.findLastIndex(i=>i.startsWith("export"));return o>=0?s.splice(o+1,0,r):s.push("",r),(0,j.writeFileSync)(e,s.join(`
89
- `),"utf-8"),!0};var z=require("node:fs"),$t=require("node:path"),F=require("@faker-js/faker");var Jl=[{pattern:"email",generate:()=>F.faker.internet.email(),hint:"email"},{pattern:"id",generate:()=>F.faker.string.uuid(),hint:"uuid"},{pattern:"firstname",generate:()=>F.faker.person.firstName(),hint:"firstName"},{pattern:"lastname",generate:()=>F.faker.person.lastName(),hint:"lastName"},{pattern:"name",generate:()=>F.faker.person.fullName(),hint:"fullName"},{pattern:"phone",generate:()=>F.faker.phone.number(),hint:"phoneNumber"},{pattern:"address",generate:()=>F.faker.location.streetAddress(),hint:"streetAddress"},{pattern:"street",generate:()=>F.faker.location.streetAddress(),hint:"streetAddress"},{pattern:"city",generate:()=>F.faker.location.city(),hint:"city"},{pattern:"country",generate:()=>F.faker.location.country(),hint:"country"},{pattern:"price",generate:()=>F.faker.number.float({min:10,max:1e3,fractionDigits:2}),hint:"price"},{pattern:"amount",generate:()=>F.faker.number.float({min:10,max:1e3,fractionDigits:2}),hint:"price"},{pattern:"total",generate:()=>F.faker.number.float({min:10,max:1e3,fractionDigits:2}),hint:"price"},{pattern:"quantity",generate:()=>F.faker.number.int({min:1,max:10}),hint:"quantity"},{pattern:"date",generate:()=>F.faker.date.recent().toISOString(),hint:"date"},{pattern:"createdat",generate:()=>F.faker.date.recent().toISOString(),hint:"date"},{pattern:"updatedat",generate:()=>F.faker.date.recent().toISOString(),hint:"date"}],ql=e=>({email:()=>F.faker.internet.email(),datetime:()=>F.faker.date.recent().toISOString(),url:()=>F.faker.internet.url(),uuid:()=>F.faker.string.uuid(),date:()=>F.faker.date.recent().toISOString().split("T")[0],time:()=>F.faker.date.recent().toISOString().split("T")[1]?.split(".")[0]})[e]?.()??F.faker.lorem.word(),Vl=e=>{let t=e.toLowerCase(),r=Jl.find(n=>t.includes(n.pattern));return r?{value:r.generate(),hint:r.hint}:null},yD=(e,t)=>{if(e.format)return ql(e.format);let r=Vl(t);if(r)return r.value;switch(e.type){case"string":return F.faker.lorem.word();case"number":return F.faker.number.int({min:1,max:100});case"boolean":return F.faker.datatype.boolean();case"array":return e.element?[ci(e.element)]:[];case"object":return ci(e);default:return null}},ci=e=>{let t={},r=e.shape??(typeof e.def?.shape=="function"?e.def.shape():void 0);if(!r)return t;for(let[n,s]of Object.entries(r))t[n]=yD(s,n);return t},wD=async e=>{try{let{createJiti:t}=await import("jiti"),n=t(process.cwd(),{interopDefault:!0})(e),s=Object.entries(n).find(([o])=>o.endsWith("Schema")||o==="schema");if(s?.[1]){let o=s[1],i=ci(o);if(i&&typeof i=="object"&&Object.keys(i).length>0){let a={};return li(i,a,""),{data:i,faker:a}}}}catch{}return null},li=(e,t,r)=>{if(!(!e||typeof e!="object"))for(let[n,s]of Object.entries(e)){let o=r?`${r}.${n}`:n,i=n.toLowerCase(),a=Jl.find(c=>i.includes(c.pattern));a&&(a.hint!=="uuid"||typeof s=="string")&&(t[o]=a.hint),typeof s=="object"&&s!==null&&!Array.isArray(s)?li(s,t,o):Array.isArray(s)&&s.length>0&&typeof s[0]=="object"&&li(s[0],t,`${o}[0]`)}},CD=e=>({string:()=>F.faker.lorem.word(),number:()=>F.faker.number.int({min:1,max:100}),boolean:()=>F.faker.datatype.boolean()})[e]?.(),bD=(e,t,r)=>{let n=/(\w+):\s*z\.(\w+)\(/g,s=Array.from(e.matchAll(n));for(let[,o,i]of s){if(i==="array"||i==="object")continue;let a=Vl(o);if(a)t[o]=a.value,a.hint&&(r[o]=a.hint);else{let c=CD(i);c!==void 0&&(t[o]=c)}}},xD=(e,t,r)=>{let n=/(\w+):\s*z\.string\(\)\.(datetime|email|url|uuid)\(\)/g,s=Array.from(e.matchAll(n));for(let[,o,i]of s)t[o]=ql(i),r[o]=i==="datetime"?"date":i},Yl=e=>{let t={},r={};return bD(e,t,r),xD(e,t,r),{data:t,faker:r}},gs=async e=>{let{eventsPath:t}=$(),r=or(e);if(!(0,z.existsSync)(r))return null;let s=(0,z.readFileSync)(r,"utf-8").match(/type:\s*['"]([^'"]+)['"]/),o=s?s[1]:e,i=await wD(r);if(!i){let d=Xo(e);d&&(i=Yl(d))}if(!i)return null;let a={eventName:o,description:`Mock data for ${o} event`,data:i.data};Object.keys(i.faker).length>0&&(a.faker=i.faker);let c=e.split(".")[0],l=e.split(".").slice(1).join("-"),u=(0,$t.join)(t,c,`${l}.mock.json`),p=(0,$t.join)(t,c);return(0,z.existsSync)(p)||(0,z.mkdirSync)(p,{recursive:!0}),(0,z.writeFileSync)(u,JSON.stringify(a,null,2),"utf-8"),u};var Zl=e=>{let t=e.match(/import\s+\{[^}]*?(\w+Contract)[^}]*?\}\s+from\s+['"][^'"]+\/contracts['"]/);return t?t[1].replace("Contract","").replace(/([A-Z])/g,(n,s,o)=>(o>0?".":"")+s.toLowerCase()):null},vD=(e,t,r)=>{if(!(0,z.existsSync)(e))return!1;let n=(0,z.readFileSync)(e,"utf-8"),s=n.match(/export const \w+(?:Schema|Data)\s*=\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m)??n.match(/schema:\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m);if(!s)return!1;let o=Yl(s[1]),i={eventName:r,description:`Mock data for ${r} event`,data:o.data};return Object.keys(o.faker).length>0&&(i.faker=o.faker),(0,z.writeFileSync)(t,JSON.stringify(i,null,2)),!0},ui=async(e,t={})=>{let r=(0,$t.join)(e,"src","events");if(!(0,z.existsSync)(r))return{mockPaths:[],skippedHandlers:[]};let n=(0,z.readdirSync)(r).filter(i=>i.endsWith(".event.ts")).map(i=>(0,$t.join)(r,i)),s=[],o=[];for(let i of n){let a=(0,z.readFileSync)(i,"utf-8"),c=Zl(a);if(!c){o.push(`${(0,$t.basename)(i)} (Handler does not use contracts)`);continue}let{eventName:l}=sr(c),u=t.outputDir??$().eventsPath,p=(0,$t.join)(u,`${l}.mock.json`);if((0,z.existsSync)(p)&&!t.overwrite){o.push(`${(0,$t.basename)(i)} (Mock already exists)`);continue}if(t.outputDir){let f=(0,$t.join)(t.outputDir,`${l}.ts`);vD(f,p,c)&&s.push(p);continue}let d=await gs(c);d&&s.push(d)}return{mockPaths:s,skippedHandlers:o}};var tu=e=>{let t=e.split("/").pop()||"service",r=(0,Xl.join)(e,"src","events","events.service.ts");if(!(0,Ds.existsSync)(r))return!1;let n=ni(e);if(n.length===0||(0,Ds.readFileSync)(r,"utf-8").replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").includes("consumeJetStreams"))return!1;let a=si(n),c=oi(a,t);if(!c)return!1;let l=new Ql.Project({skipAddingFilesFromTsConfig:!0,skipFileDependencyResolution:!0}),u=l.addSourceFileAtPath(r),p=!1;for(let d of u.getClasses()){let f=d.getMethod("startConsumers");if(!f)continue;let h=[...c.split(`
89
+ `),"utf-8"),!0};var z=require("node:fs"),$t=require("node:path"),F=require("@faker-js/faker");var Yl=[{pattern:"email",generate:()=>F.faker.internet.email(),hint:"email"},{pattern:"id",generate:()=>F.faker.string.uuid(),hint:"uuid"},{pattern:"firstname",generate:()=>F.faker.person.firstName(),hint:"firstName"},{pattern:"lastname",generate:()=>F.faker.person.lastName(),hint:"lastName"},{pattern:"name",generate:()=>F.faker.person.fullName(),hint:"fullName"},{pattern:"phone",generate:()=>F.faker.phone.number(),hint:"phoneNumber"},{pattern:"address",generate:()=>F.faker.location.streetAddress(),hint:"streetAddress"},{pattern:"street",generate:()=>F.faker.location.streetAddress(),hint:"streetAddress"},{pattern:"city",generate:()=>F.faker.location.city(),hint:"city"},{pattern:"country",generate:()=>F.faker.location.country(),hint:"country"},{pattern:"price",generate:()=>F.faker.number.float({min:10,max:1e3,fractionDigits:2}),hint:"price"},{pattern:"amount",generate:()=>F.faker.number.float({min:10,max:1e3,fractionDigits:2}),hint:"price"},{pattern:"total",generate:()=>F.faker.number.float({min:10,max:1e3,fractionDigits:2}),hint:"price"},{pattern:"quantity",generate:()=>F.faker.number.int({min:1,max:10}),hint:"quantity"},{pattern:"date",generate:()=>F.faker.date.recent().toISOString(),hint:"date"},{pattern:"createdat",generate:()=>F.faker.date.recent().toISOString(),hint:"date"},{pattern:"updatedat",generate:()=>F.faker.date.recent().toISOString(),hint:"date"}],Zl=e=>({email:()=>F.faker.internet.email(),datetime:()=>F.faker.date.recent().toISOString(),url:()=>F.faker.internet.url(),uuid:()=>F.faker.string.uuid(),date:()=>F.faker.date.recent().toISOString().split("T")[0],time:()=>F.faker.date.recent().toISOString().split("T")[1]?.split(".")[0]})[e]?.()??F.faker.lorem.word(),Xl=e=>{let t=e.toLowerCase(),r=Yl.find(n=>t.includes(n.pattern));return r?{value:r.generate(),hint:r.hint}:null},xD=(e,t)=>{if(e.format)return Zl(e.format);let r=Xl(t);if(r)return r.value;switch(e.type){case"string":return F.faker.lorem.word();case"number":return F.faker.number.int({min:1,max:100});case"boolean":return F.faker.datatype.boolean();case"array":return e.element?[pi(e.element)]:[];case"object":return pi(e);default:return null}},pi=e=>{let t={},r=e.shape??(typeof e.def?.shape=="function"?e.def.shape():void 0);if(!r)return t;for(let[n,s]of Object.entries(r))t[n]=xD(s,n);return t},vD=async e=>{try{let{createJiti:t}=await import("jiti"),n=t(process.cwd(),{interopDefault:!0})(e),s=Object.entries(n).find(([o])=>o.endsWith("Schema")||o==="schema");if(s?.[1]){let o=s[1],i=pi(o);if(i&&typeof i=="object"&&Object.keys(i).length>0){let a={};return fi(i,a,""),{data:i,faker:a}}}}catch{}return null},fi=(e,t,r)=>{if(!(!e||typeof e!="object"))for(let[n,s]of Object.entries(e)){let o=r?`${r}.${n}`:n,i=n.toLowerCase(),a=Yl.find(c=>i.includes(c.pattern));a&&(a.hint!=="uuid"||typeof s=="string")&&(t[o]=a.hint),typeof s=="object"&&s!==null&&!Array.isArray(s)?fi(s,t,o):Array.isArray(s)&&s.length>0&&typeof s[0]=="object"&&fi(s[0],t,`${o}[0]`)}},kD=e=>({string:()=>F.faker.lorem.word(),number:()=>F.faker.number.int({min:1,max:100}),boolean:()=>F.faker.datatype.boolean()})[e]?.(),ED=(e,t,r)=>{let n=/(\w+):\s*z\.(\w+)\(/g,s=Array.from(e.matchAll(n));for(let[,o,i]of s){if(i==="array"||i==="object")continue;let a=Xl(o);if(a)t[o]=a.value,a.hint&&(r[o]=a.hint);else{let c=kD(i);c!==void 0&&(t[o]=c)}}},SD=(e,t,r)=>{let n=/(\w+):\s*z\.string\(\)\.(datetime|email|url|uuid)\(\)/g,s=Array.from(e.matchAll(n));for(let[,o,i]of s)t[o]=Zl(i),r[o]=i==="datetime"?"date":i},Ql=e=>{let t={},r={};return ED(e,t,r),SD(e,t,r),{data:t,faker:r}},ws=async e=>{let{eventsPath:t}=$(),r=or(e);if(!(0,z.existsSync)(r))return null;let s=(0,z.readFileSync)(r,"utf-8").match(/type:\s*['"]([^'"]+)['"]/),o=s?s[1]:e,i=await vD(r);if(!i){let d=ei(e);d&&(i=Ql(d))}if(!i)return null;let a={eventName:o,description:`Mock data for ${o} event`,data:i.data};Object.keys(i.faker).length>0&&(a.faker=i.faker);let c=e.split(".")[0],l=e.split(".").slice(1).join("-"),u=(0,$t.join)(t,c,`${l}.mock.json`),p=(0,$t.join)(t,c);return(0,z.existsSync)(p)||(0,z.mkdirSync)(p,{recursive:!0}),(0,z.writeFileSync)(u,JSON.stringify(a,null,2),"utf-8"),u};var tu=e=>{let t=e.match(/import\s+\{[^}]*?(\w+Contract)[^}]*?\}\s+from\s+['"][^'"]+\/contracts['"]/);return t?t[1].replace("Contract","").replace(/([A-Z])/g,(n,s,o)=>(o>0?".":"")+s.toLowerCase()):null},FD=(e,t,r)=>{if(!(0,z.existsSync)(e))return!1;let n=(0,z.readFileSync)(e,"utf-8"),s=n.match(/export const \w+(?:Schema|Data)\s*=\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m)??n.match(/schema:\s*z\.object\(\s*\{([\s\S]*?)\}\s*\)/m);if(!s)return!1;let o=Ql(s[1]),i={eventName:r,description:`Mock data for ${r} event`,data:o.data};return Object.keys(o.faker).length>0&&(i.faker=o.faker),(0,z.writeFileSync)(t,JSON.stringify(i,null,2)),!0},di=async(e,t={})=>{let r=(0,$t.join)(e,"src","events");if(!(0,z.existsSync)(r))return{mockPaths:[],skippedHandlers:[]};let n=(0,z.readdirSync)(r).filter(i=>i.endsWith(".event.ts")).map(i=>(0,$t.join)(r,i)),s=[],o=[];for(let i of n){let a=(0,z.readFileSync)(i,"utf-8"),c=tu(a);if(!c){o.push(`${(0,$t.basename)(i)} (Handler does not use contracts)`);continue}let{eventName:l}=sr(c),u=t.outputDir??$().eventsPath,p=(0,$t.join)(u,`${l}.mock.json`);if((0,z.existsSync)(p)&&!t.overwrite){o.push(`${(0,$t.basename)(i)} (Mock already exists)`);continue}if(t.outputDir){let f=(0,$t.join)(t.outputDir,`${l}.ts`);FD(f,p,c)&&s.push(p);continue}let d=await ws(c);d&&s.push(d)}return{mockPaths:s,skippedHandlers:o}};var nu=e=>{let t=e.split("/").pop()||"service",r=(0,eu.join)(e,"src","events","events.service.ts");if(!(0,Cs.existsSync)(r))return!1;let n=ii(e);if(n.length===0||(0,Cs.readFileSync)(r,"utf-8").replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").includes("consumeJetStreams"))return!1;let a=ai(n),c=ci(a,t);if(!c)return!1;let l=new ru.Project({skipAddingFilesFromTsConfig:!0,skipFileDependencyResolution:!0}),u=l.addSourceFileAtPath(r),p=!1;for(let d of u.getClasses()){let f=d.getMethod("startConsumers");if(!f)continue;let h=[...c.split(`
90
90
  `),""," this.logger.log('Event consumers started successfully')"].join(`
91
- `);f.setBodyText(h),p=!0;break}return p&&l.saveSync(),p};var kD=e=>{let t=e.split(/\s+/),r=t[0],n=t.slice(1);return r==="pf"&&(r=process.argv[1]),{executable:r,args:n}},ED=async(e,t)=>{try{let{executable:r,args:n}=kD(e.command);return await de(r,n,{cwd:t,shell:!1}),{command:e.command,success:!0}}catch(r){return{command:e.command,success:!1,error:r instanceof Error?r.message:String(r)}}},pi=async(e,t)=>{let r=[];for(let n of e){let s=await ED(n,t);if(r.push(s),!s.success)break}return r},fi=e=>{let t=[/^pf\s+/,/^bun\s+pf\s+/,/^npx\s+pf\s+/,/^bunx\s+pf\s+/];return e.filter(r=>t.some(n=>n.test(r.command)))},eu=e=>{for(let t of e){let r=t.command.match(/(?:bun\s+)?pf\s+new\s+\S+\s+(\S+)/);if(r)return r[1]}return null};var un=require("node:fs"),ws=require("node:path"),Bt=b(require("chalk"));var Se=require("node:fs"),ys=require("node:path"),SD=(e,t)=>{let n=e.path.startsWith("packages/")&&t.workspaceRoot?t.workspaceRoot:t.baseDir,s=(0,ys.join)(n,e.path);try{if((0,Se.existsSync)(s)&&!t.overwrite)return{status:"skipped",path:e.path};if(t.dryRun)return{status:"written",path:e.path};let o=(0,ys.dirname)(s);return(0,Se.existsSync)(o)||(0,Se.mkdirSync)(o,{recursive:!0}),(0,Se.writeFileSync)(s,e.content,"utf-8"),{status:"written",path:e.path}}catch(o){return{status:"failed",path:e.path,error:o.message}}},ru=(e,t)=>{let r=e.map(n=>SD(n,t));return{written:r.filter(n=>n.status==="written").map(n=>n.path),skipped:r.filter(n=>n.status==="skipped").map(n=>n.path),failed:r.filter(n=>n.status==="failed").map(n=>({path:n.path,error:n.error}))}};var FD=(e,t)=>{let r=kt(t.workspaceRoot),n=(0,ws.join)(t.workspaceRoot,r.contracts);if(!(0,un.existsSync)(n))return[];let s=/import\s+(?:type\s+)?{([^}]+)}\s+from\s+['"]@\w+\/contracts['"]/g,o=new Set;for(let i of e){let a=i.content.matchAll(s);for(let c of a){let u=c[1].split(",").map(p=>p.trim()).map(p=>p.replace(/^type\s+/,"").replace(/\s+as\s+.+$/,"").trim()).filter(p=>p.endsWith("Contract"));for(let p of u)o.add(p)}}return Array.from(o).sort()},TD=e=>{let t=(0,ws.join)(e,"packages/contracts/src/index.ts");if(!(0,un.existsSync)(t))return new Set;try{let r=(0,un.readFileSync)(t,"utf-8"),n=new Set,s=/export\s+(?:\*|{[^}]*Contract[^}]*})\s+from\s+['"]\.\/events\/([^'"]+)['"]/g,o=r.matchAll(s);for(let i of o){let a=i[0],c=/(\w+Contract)/g,l=a.matchAll(c);for(let u of l)n.add(u[1])}return n}catch{return new Set}},AD=e=>{let t=e.replace(/Contract$/,""),r=t.split(/(?=[A-Z])/).filter(Boolean);if(r.length<2)return t.toLowerCase();let n=r[0].toLowerCase(),s=r.slice(1).join("").toLowerCase();return`${n}.${s}`},PD=(e,t,r)=>{let n=TD(t),s=[],o=[],i=[];for(let a of e)if(n.has(a))s.push(a);else{o.push(a);let c=AD(a),l=r.replace(`${t}/`,"");i.push(`pf event add ${c} --service ${l}`)}return{existing:s,missing:o,suggestedCommands:i}},RD=(e,t)=>{if(e.length!==0){console.log(Bt.default.cyan(`\u{1F4E6} Using existing contracts:
92
- `));for(let r of e)console.log(Bt.default.dim(` ${t}/contracts \u2192 ${r}`));console.log()}},ID=(e,t)=>{let r=/^packages\/contracts\/src\/events\/([^/]+)\.ts$/,n=(0,ws.join)(t,"packages/contracts/src/index.ts");for(let s of e){let o=s.match(r);o&&o[1]!=="index"&&ai(n,o[1])}},nu=async(e,t)=>{t.start("Applying code formatting...");try{await Yt("biome",["check","--fix","--unsafe","."],{cwd:e,quiet:!0}),t.succeed("Code formatted!")}catch{t.warn("Code formatting completed with warnings")}},ND=async(e,t)=>{t.start("Scanning for event handlers...");let{mockPaths:r,skippedHandlers:n}=await ui(e);if(r.length+n.length===0){t.info("No event handlers found");return}if(r.length>0){t.succeed(`Generated ${r.length} event ${r.length===1?"mock":"mocks"}`),console.log();for(let o of r){let i=o.replace(`${e}/`,"");console.log(Bt.default.dim(` ${i}`))}console.log()}else t.succeed("Event handlers found");if(n.length>0){for(let o of n)console.log(Bt.default.dim(` \u2139 Skipped: ${o}`));console.log()}},su=async(e,t,r,n)=>{n.start("Writing generated files...");let s=ru(e,{baseDir:t,workspaceRoot:r.workspaceRoot,overwrite:!0});if(s.written.length>0){n.succeed(`Created ${s.written.length} files`),console.log();for(let l of s.written)console.log(Bt.default.dim(` ${l}`));console.log()}else n.succeed("No files to write");let o=FD(e,r),{existing:i,missing:a,suggestedCommands:c}=PD(o,r.workspaceRoot,t);if(i.length>0&&RD(i,r.scope),a.length>0){console.log(Bt.default.yellow(`\u26A0\uFE0F Missing contracts (not exported from @${r.scope}/contracts):
91
+ `);f.setBodyText(h),p=!0;break}return p&&l.saveSync(),p};var TD=e=>{let t=e.split(/\s+/),r=t[0],n=t.slice(1);return r==="pf"&&(r=process.argv[1]),{executable:r,args:n}},AD=async(e,t)=>{try{let{executable:r,args:n}=TD(e.command);return await de(r,n,{cwd:t,shell:!1}),{command:e.command,success:!0}}catch(r){return{command:e.command,success:!1,error:r instanceof Error?r.message:String(r)}}},hi=async(e,t)=>{let r=[];for(let n of e){let s=await AD(n,t);if(r.push(s),!s.success)break}return r},mi=e=>{let t=[/^pf\s+/,/^bun\s+pf\s+/,/^npx\s+pf\s+/,/^bunx\s+pf\s+/];return e.filter(r=>t.some(n=>n.test(r.command)))},su=e=>{for(let t of e){let r=t.command.match(/(?:bun\s+)?pf\s+new\s+\S+\s+(\S+)/);if(r)return r[1]}return null};var pn=require("node:fs"),xs=require("node:path"),Bt=b(require("chalk"));var Se=require("node:fs"),bs=require("node:path"),PD=(e,t)=>{let n=e.path.startsWith("packages/")&&t.workspaceRoot?t.workspaceRoot:t.baseDir,s=(0,bs.join)(n,e.path);try{if((0,Se.existsSync)(s)&&!t.overwrite)return{status:"skipped",path:e.path};if(t.dryRun)return{status:"written",path:e.path};let o=(0,bs.dirname)(s);return(0,Se.existsSync)(o)||(0,Se.mkdirSync)(o,{recursive:!0}),(0,Se.writeFileSync)(s,e.content,"utf-8"),{status:"written",path:e.path}}catch(o){return{status:"failed",path:e.path,error:o.message}}},ou=(e,t)=>{let r=e.map(n=>PD(n,t));return{written:r.filter(n=>n.status==="written").map(n=>n.path),skipped:r.filter(n=>n.status==="skipped").map(n=>n.path),failed:r.filter(n=>n.status==="failed").map(n=>({path:n.path,error:n.error}))}};var RD=(e,t)=>{let r=kt(t.workspaceRoot),n=(0,xs.join)(t.workspaceRoot,r.contracts);if(!(0,pn.existsSync)(n))return[];let s=/import\s+(?:type\s+)?{([^}]+)}\s+from\s+['"]@\w+\/contracts['"]/g,o=new Set;for(let i of e){let a=i.content.matchAll(s);for(let c of a){let u=c[1].split(",").map(p=>p.trim()).map(p=>p.replace(/^type\s+/,"").replace(/\s+as\s+.+$/,"").trim()).filter(p=>p.endsWith("Contract"));for(let p of u)o.add(p)}}return Array.from(o).sort()},ID=e=>{let t=(0,xs.join)(e,"packages/contracts/src/index.ts");if(!(0,pn.existsSync)(t))return new Set;try{let r=(0,pn.readFileSync)(t,"utf-8"),n=new Set,s=/export\s+(?:\*|{[^}]*Contract[^}]*})\s+from\s+['"]\.\/events\/([^'"]+)['"]/g,o=r.matchAll(s);for(let i of o){let a=i[0],c=/(\w+Contract)/g,l=a.matchAll(c);for(let u of l)n.add(u[1])}return n}catch{return new Set}},ND=e=>{let t=e.replace(/Contract$/,""),r=t.split(/(?=[A-Z])/).filter(Boolean);if(r.length<2)return t.toLowerCase();let n=r[0].toLowerCase(),s=r.slice(1).join("").toLowerCase();return`${n}.${s}`},OD=(e,t,r)=>{let n=ID(t),s=[],o=[],i=[];for(let a of e)if(n.has(a))s.push(a);else{o.push(a);let c=ND(a),l=r.replace(`${t}/`,"");i.push(`pf event add ${c} --service ${l}`)}return{existing:s,missing:o,suggestedCommands:i}},MD=(e,t)=>{if(e.length!==0){console.log(Bt.default.cyan(`\u{1F4E6} Using existing contracts:
92
+ `));for(let r of e)console.log(Bt.default.dim(` ${t}/contracts \u2192 ${r}`));console.log()}},$D=(e,t)=>{let r=/^packages\/contracts\/src\/events\/([^/]+)\.ts$/,n=(0,xs.join)(t,"packages/contracts/src/index.ts");for(let s of e){let o=s.match(r);o&&o[1]!=="index"&&ui(n,o[1])}},iu=async(e,t)=>{t.start("Applying code formatting...");try{await Yt("biome",["check","--fix","--unsafe","."],{cwd:e,quiet:!0}),t.succeed("Code formatted!")}catch{t.warn("Code formatting completed with warnings")}},BD=async(e,t)=>{t.start("Scanning for event handlers...");let{mockPaths:r,skippedHandlers:n}=await di(e);if(r.length+n.length===0){t.info("No event handlers found");return}if(r.length>0){t.succeed(`Generated ${r.length} event ${r.length===1?"mock":"mocks"}`),console.log();for(let o of r){let i=o.replace(`${e}/`,"");console.log(Bt.default.dim(` ${i}`))}console.log()}else t.succeed("Event handlers found");if(n.length>0){for(let o of n)console.log(Bt.default.dim(` \u2139 Skipped: ${o}`));console.log()}},au=async(e,t,r,n)=>{n.start("Writing generated files...");let s=ou(e,{baseDir:t,workspaceRoot:r.workspaceRoot,overwrite:!0});if(s.written.length>0){n.succeed(`Created ${s.written.length} files`),console.log();for(let l of s.written)console.log(Bt.default.dim(` ${l}`));console.log()}else n.succeed("No files to write");let o=RD(e,r),{existing:i,missing:a,suggestedCommands:c}=OD(o,r.workspaceRoot,t);if(i.length>0&&MD(i,r.scope),a.length>0){console.log(Bt.default.yellow(`\u26A0\uFE0F Missing contracts (not exported from @${r.scope}/contracts):
93
93
  `));for(let l of a)console.log(Bt.default.yellow(` ${l}`));console.log(),console.log(Bt.default.cyan(`\u{1F4A1} Run these commands to create the missing contracts:
94
- `));for(let l of c)console.log(Bt.default.dim(` ${l}`));console.log()}return ID(s.written,r.workspaceRoot),s.written.length>0&&await ND(t,n),{missingContractCommands:c}};var Cs=require("node:fs"),cr=require("node:path");var ar=require("node:fs"),ou=require("node:path");var iu=e=>{let{eventsPath:t}=$(e);if(!(0,ar.existsSync)(t))return[];let r=[];try{let n=(0,ar.readdirSync)(t).filter(s=>s.endsWith(".ts")&&!s.endsWith(".mock.json")&&s!=="index.ts");for(let s of n){let o=(0,ou.join)(t,s),i=(0,ar.readFileSync)(o,"utf-8"),a=OD(i,o);a&&r.push(a)}}catch(n){return console.warn("Warning: Could not scan contracts package:",n),[]}return r},OD=(e,t)=>{try{let r=e.match(/export const (\w+Contract) = createContract/);if(!r)return null;let n=r[1],s=e.match(/export type (\w+(?:Data|Event)) = z\.infer/);if(!s)return null;let o=s[1],i=e.match(/type:\s*['"]([^'"]+)['"]/);if(!i)return null;let a=i[1],c=$D(e);return{name:n,typeName:o,eventType:a,fields:c,filePath:t}}catch{return null}},MD={string:"string",number:"number",boolean:"boolean",array:"array",object:"object",date:"date"},$D=e=>{let t=e.match(/z\.object\({([^}]+)\}/);if(!t)return[];let r=t[1],n=/(\w+):\s*z\.(\w+)\([^)]*\)/g,s=[...r.matchAll(n)].map(([,a,c])=>{let l=MD[c]||c;return`${a}: ${l}`});if(!e.includes("z.array("))return s;let o=/(\w+):\s*z\.array\(/g,i=[...e.matchAll(o)].map(([,a])=>a).filter(a=>!s.some(c=>c.startsWith(a))).map(a=>`${a}: array`);return[...s,...i]},au=(e,t)=>{if(e.length===0)return`
94
+ `));for(let l of c)console.log(Bt.default.dim(` ${l}`));console.log()}return $D(s.written,r.workspaceRoot),s.written.length>0&&await BD(t,n),{missingContractCommands:c}};var vs=require("node:fs"),cr=require("node:path");var ar=require("node:fs"),cu=require("node:path");var lu=e=>{let{eventsPath:t}=$(e);if(!(0,ar.existsSync)(t))return[];let r=[];try{let n=(0,ar.readdirSync)(t).filter(s=>s.endsWith(".ts")&&!s.endsWith(".mock.json")&&s!=="index.ts");for(let s of n){let o=(0,cu.join)(t,s),i=(0,ar.readFileSync)(o,"utf-8"),a=jD(i,o);a&&r.push(a)}}catch(n){return console.warn("Warning: Could not scan contracts package:",n),[]}return r},jD=(e,t)=>{try{let r=e.match(/export const (\w+Contract) = createContract/);if(!r)return null;let n=r[1],s=e.match(/export type (\w+(?:Data|Event)) = z\.infer/);if(!s)return null;let o=s[1],i=e.match(/type:\s*['"]([^'"]+)['"]/);if(!i)return null;let a=i[1],c=LD(e);return{name:n,typeName:o,eventType:a,fields:c,filePath:t}}catch{return null}},_D={string:"string",number:"number",boolean:"boolean",array:"array",object:"object",date:"date"},LD=e=>{let t=e.match(/z\.object\({([^}]+)\}/);if(!t)return[];let r=t[1],n=/(\w+):\s*z\.(\w+)\([^)]*\)/g,s=[...r.matchAll(n)].map(([,a,c])=>{let l=_D[c]||c;return`${a}: ${l}`});if(!e.includes("z.array("))return s;let o=/(\w+):\s*z\.array\(/g,i=[...e.matchAll(o)].map(([,a])=>a).filter(a=>!s.some(c=>c.startsWith(a))).map(a=>`${a}: array`);return[...s,...i]},uu=(e,t)=>{if(e.length===0)return`
95
95
  **Available Contracts:**
96
96
 
97
97
  No contracts are currently defined. Use Basic Mode with inline schemas for all events.
@@ -112,15 +112,15 @@ The following event contracts are available in \`${t}/contracts\`:
112
112
  ${r}
113
113
 
114
114
  If the event type your service consumes matches one of these, **you MUST use Advanced Mode**.
115
- `.trim()};var BD=(e,t)=>{let r=(0,cr.join)(__dirname,"docs","generators"),n=tn(),s=[];for(let o of n.docs.base)s.push((0,cr.join)(r,o));if(e&&n.docs.frameworks[e]){let o=n.docs.frameworks[e];if(typeof o=="string")s.push((0,cr.join)(r,o));else{let i=t==="bun"?"bun":"node";o[i]&&s.push((0,cr.join)(r,o[i]))}}return s},cu={copilot:".github/copilot-instructions.md",projectGuidelines:"docs/ai-guidelines.md"},jD=1500,lu=e=>{try{return(0,Cs.existsSync)(e)?(0,Cs.readFileSync)(e,"utf-8"):null}catch{return null}},_D=e=>e.replace(/<!--[\s\S]*?-->/g,"").replace(/^\[.+\]:\s*.+$/gm,"").replace(/\n{3,}/g,`
115
+ `.trim()};var WD=(e,t)=>{let r=(0,cr.join)(__dirname,"docs","generators"),n=tn(),s=[];for(let o of n.docs.base)s.push((0,cr.join)(r,o));if(e&&n.docs.frameworks[e]){let o=n.docs.frameworks[e];if(typeof o=="string")s.push((0,cr.join)(r,o));else{let i=t==="bun"?"bun":"node";o[i]&&s.push((0,cr.join)(r,o[i]))}}return s},pu={copilot:".github/copilot-instructions.md",projectGuidelines:"docs/ai-guidelines.md"},GD=1500,fu=e=>{try{return(0,vs.existsSync)(e)?(0,vs.readFileSync)(e,"utf-8"):null}catch{return null}},HD=e=>e.replace(/<!--[\s\S]*?-->/g,"").replace(/^\[.+\]:\s*.+$/gm,"").replace(/\n{3,}/g,`
116
116
 
117
- `).replace(/[ \t]+$/gm,"").trim(),LD=e=>e.replace(/<!--[\s\S]*?-->/g,"").replace(/^\[.+\]:\s*.+$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]{50,}`/g,"`...`").replace(/\n{3,}/g,`
117
+ `).replace(/[ \t]+$/gm,"").trim(),UD=e=>e.replace(/<!--[\s\S]*?-->/g,"").replace(/^\[.+\]:\s*.+$/gm,"").replace(/```[\s\S]*?```/g,"").replace(/`[^`]{50,}`/g,"`...`").replace(/\n{3,}/g,`
118
118
 
119
- `).replace(/[ \t]+$/gm,"").trim(),WD=e=>Math.ceil(e.length/4),GD=(e,t)=>{let r=e.split(/(?=^## )/m),n="",s=0;for(let o of r){let i=WD(o);if(s+i<=t)n+=o,s+=i;else if(s===0){n=o.slice(0,t*4);break}else break}return n.trim()},HD=(e,t)=>{let{workspaceRoot:r,scope:n}=t,s=iu(r),o=au(s,n);return e.replace(/\{\{scope\}\}/g,n).replace(/\{\{AVAILABLE_CONTRACTS\}\}/g,o)},uu=e=>{let{workspaceRoot:t,scope:r}=e,n=[],s=BD(e.serviceType,e.packageManager);for(let a of s){let c=lu(a);if(c){let l=HD(c,e),u=_D(l);n.push(u)}}let o=[cu.copilot,cu.projectGuidelines],i=Math.floor(jD/o.length);for(let a of o){let c=lu((0,cr.join)(t,a));if(c){let l=LD(c),u=GD(l,i);u.length>50&&n.push(u)}}return n.length===0?(console.warn("\u26A0\uFE0F No instruction files found."),`Use ${r}/contracts for shared types.`):n.join(`
119
+ `).replace(/[ \t]+$/gm,"").trim(),zD=e=>Math.ceil(e.length/4),KD=(e,t)=>{let r=e.split(/(?=^## )/m),n="",s=0;for(let o of r){let i=zD(o);if(s+i<=t)n+=o,s+=i;else if(s===0){n=o.slice(0,t*4);break}else break}return n.trim()},JD=(e,t)=>{let{workspaceRoot:r,scope:n}=t,s=lu(r),o=uu(s,n);return e.replace(/\{\{scope\}\}/g,n).replace(/\{\{AVAILABLE_CONTRACTS\}\}/g,o)},du=e=>{let{workspaceRoot:t,scope:r}=e,n=[],s=WD(e.serviceType,e.packageManager);for(let a of s){let c=fu(a);if(c){let l=JD(c,e),u=HD(l);n.push(u)}}let o=[pu.copilot,pu.projectGuidelines],i=Math.floor(GD/o.length);for(let a of o){let c=fu((0,cr.join)(t,a));if(c){let l=UD(c),u=KD(l,i);u.length>50&&n.push(u)}}return n.length===0?(console.warn("\u26A0\uFE0F No instruction files found."),`Use ${r}/contracts for shared types.`):n.join(`
120
120
 
121
121
  ---
122
122
 
123
- `)};var UD=`You are an expert code generator. Generate clean, production-ready code.
123
+ `)};var qD=`You are an expert code generator. Generate clean, production-ready code.
124
124
 
125
125
  ## Output Format
126
126
 
@@ -134,13 +134,13 @@ Format your code blocks with the file path on the line before the code block:
134
134
  **IMPORTANT:** Always generate:
135
135
  - Source code files (src/**)
136
136
  - Test files (src/**/*.test.ts) for all business logic
137
- - README.md with service documentation`,zD=e=>e.replace(/-/g,"_").toUpperCase(),KD=e=>e.split("/").pop()||"my-service",pu=(e,t,r)=>{let n=uu({...e,serviceType:t,packageManager:r});return`${UD}
137
+ - README.md with service documentation`,VD=e=>e.replace(/-/g,"_").toUpperCase(),YD=e=>e.split("/").pop()||"my-service",hu=(e,t,r)=>{let n=du({...e,serviceType:t,packageManager:r});return`${qD}
138
138
 
139
139
  ## Project Guidelines & Patterns
140
140
 
141
141
  Follow these project-specific conventions and patterns when generating code:
142
142
 
143
- ${n}`},fu=(e,t,r,n)=>{let s=KD(e),o=`${zD(s)}_PORT`;return`Generate source code for a microservice at path "${e}".
143
+ ${n}`},mu=(e,t,r,n)=>{let s=YD(e),o=`${VD(s)}_PORT`;return`Generate source code for a microservice at path "${e}".
144
144
 
145
145
  Use the patterns and conventions from the Project Guidelines above.
146
146
 
@@ -154,54 +154,54 @@ Service purpose: ${t}
154
154
  - BUT you MUST keep the existing port configuration line unchanged!
155
155
 
156
156
  Do NOT include the service path in file headers (use \`src/...\`, NOT \`${e}/src/...\`).
157
- `};var JD=()=>!1,du=(e,t)=>{JD()&&console.log(`[AI Parser] ${e}`,t??"")},bs={commandsBlock:/```commands\n([\s\S]*?)```/gi,postCommandsBlock:/```post-commands\n([\s\S]*?)```/gi,dependenciesBlock:/```dependencies\n([\s\S]*?)```/gi,fileHeader:/^#{1,4}\s+`([^`]+)`\s*$/},hi=(e,t)=>[...e.matchAll(t)].flatMap(n=>n[1].split(`
158
- `).map(s=>s.trim()).filter(s=>s.length>0&&!s.startsWith("#"))),hu=e=>({command:e,isPfCommand:e.startsWith("pf ")||e.includes(" pf ")}),qD=e=>hi(e,bs.commandsBlock).map(hu),VD=e=>hi(e,bs.postCommandsBlock).map(hu),YD=e=>hi(e,bs.dependenciesBlock).filter(t=>!t.startsWith("@crossdelta/")&&t!=="zod"),ZD=e=>{let t={ts:"typescript",js:"javascript",md:"markdown",yml:"yaml"},r=(e||"typescript").toLowerCase();return t[r]||r},XD=e=>{let t=e.split(".").pop()?.toLowerCase();return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",yaml:"yaml",yml:"yaml",md:"markdown"}[t||""]||"plaintext"},QD=e=>e.replace(/^\s*\/\/ \.{3,}.*$/gm,"").replace(/^\s*\/\/ Lines? \d+.*omitted.*$/gim,"").replace(/^\s*\/\* Lines? \d+.*omitted.*\*\/$/gim,"").trim(),ty=e=>{let t=e.split(`
159
- `),r=[],n=0;for(let s of t){let o=bs.fileHeader.exec(s);o&&r.push({path:o[1],index:n}),n+=s.length+1}return r},ey=(e,t)=>{let n=e.slice(t).match(/```(\w+)?\n([\s\S]*?)```/);return n?{language:n[1]?ZD(n[1]):void 0,content:QD(n[2])}:null},ry=e=>ty(e).map(r=>{let n=ey(e,r.index);return!n||n.content.length===0?null:{path:r.path,language:n.language||XD(r.path),content:n.content,startIndex:r.index}}).filter(r=>r!==null),di=e=>e.includes("packages/contracts")||e.includes("contracts/src"),ny=e=>{let t=e.filter(n=>di(n.path)),r=e.filter(n=>!di(n.path));return[...t,...r]},sy=e=>{let t=e.replace(/^\/+/,"").replace(/\/{2,}/g,"/");if(di(t))return t;let r=t.match(/^services\/[^/]+\/(.+)$/);return r?r[1]:t},mu=(e,t)=>{du("Parsing AI response",{length:e.length});let r=qD(e),n=VD(e),s=YD(e),o=ry(e),i=ny(o.map(a=>({path:sy(a.path),content:a.content,language:a.language})));return du("Parsed response",{commands:r.length,postCommands:n.length,dependencies:s.length,files:i.length}),{commands:r,files:i,dependencies:s,postCommands:n}},gu=e=>{let t=e.filter(o=>!o.content||o.content.trim().length===0),r=e.length===0?["No files could be extracted from the AI response"]:t.map(o=>`File ${o.path} is empty`),n=e.some(o=>["src/index.ts","src/main.ts","index.ts"].includes(o.path)),s=e.length>0&&!n?["No entry point file (src/index.ts or src/main.ts) found - assuming it exists from scaffolding"]:[];return{valid:r.length===0,errors:r,warnings:s}};var Du=require("node:fs"),St=b(require("chalk"));var yu=async(e,t,r)=>{if(e.length===0){(0,Du.mkdirSync)(t,{recursive:!0}),console.log(St.default.yellow(`\u26A0 No scaffolding command found - creating empty directory
160
- `));return}let s=(await pi(e,r)).find(o=>!o.success);if(s)throw console.log(St.default.red(`
161
- \u2717 Scaffolding failed: ${s.command}`)),s.error&&console.log(St.default.red(` Error: ${s.error}`)),new Error(`Command failed: ${s.command}${s.error?` - ${s.error}`:""}`)},wu=async(e,t)=>{t.start("Linking workspace dependencies...");try{await Et({cwd:e,quiet:!0}),t.succeed("Workspace dependencies linked")}catch{let r=B();t.warn(`Workspace sync skipped (run ${r} install manually)`)}},Cu=async(e,t,r)=>{if(e.length===0)return;r.stop();let n=e.length===1?"package":"packages";console.log(St.default.cyan(`
157
+ `};var ZD=()=>!1,gu=(e,t)=>{ZD()&&console.log(`[AI Parser] ${e}`,t??"")},ks={commandsBlock:/```commands\n([\s\S]*?)```/gi,postCommandsBlock:/```post-commands\n([\s\S]*?)```/gi,dependenciesBlock:/```dependencies\n([\s\S]*?)```/gi,fileHeader:/^#{1,4}\s+`([^`]+)`\s*$/},Di=(e,t)=>[...e.matchAll(t)].flatMap(n=>n[1].split(`
158
+ `).map(s=>s.trim()).filter(s=>s.length>0&&!s.startsWith("#"))),Du=e=>({command:e,isPfCommand:e.startsWith("pf ")||e.includes(" pf ")}),XD=e=>Di(e,ks.commandsBlock).map(Du),QD=e=>Di(e,ks.postCommandsBlock).map(Du),ty=e=>Di(e,ks.dependenciesBlock).filter(t=>!t.startsWith("@crossdelta/")&&t!=="zod"),ey=e=>{let t={ts:"typescript",js:"javascript",md:"markdown",yml:"yaml"},r=(e||"typescript").toLowerCase();return t[r]||r},ry=e=>{let t=e.split(".").pop()?.toLowerCase();return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",yaml:"yaml",yml:"yaml",md:"markdown"}[t||""]||"plaintext"},ny=e=>e.replace(/^\s*\/\/ \.{3,}.*$/gm,"").replace(/^\s*\/\/ Lines? \d+.*omitted.*$/gim,"").replace(/^\s*\/\* Lines? \d+.*omitted.*\*\/$/gim,"").trim(),sy=e=>{let t=e.split(`
159
+ `),r=[],n=0;for(let s of t){let o=ks.fileHeader.exec(s);o&&r.push({path:o[1],index:n}),n+=s.length+1}return r},oy=(e,t)=>{let n=e.slice(t).match(/```(\w+)?\n([\s\S]*?)```/);return n?{language:n[1]?ey(n[1]):void 0,content:ny(n[2])}:null},iy=e=>sy(e).map(r=>{let n=oy(e,r.index);return!n||n.content.length===0?null:{path:r.path,language:n.language||ry(r.path),content:n.content,startIndex:r.index}}).filter(r=>r!==null),gi=e=>e.includes("packages/contracts")||e.includes("contracts/src"),ay=e=>{let t=e.filter(n=>gi(n.path)),r=e.filter(n=>!gi(n.path));return[...t,...r]},cy=e=>{let t=e.replace(/^\/+/,"").replace(/\/{2,}/g,"/");if(gi(t))return t;let r=t.match(/^services\/[^/]+\/(.+)$/);return r?r[1]:t},yu=(e,t)=>{gu("Parsing AI response",{length:e.length});let r=XD(e),n=QD(e),s=ty(e),o=iy(e),i=ay(o.map(a=>({path:cy(a.path),content:a.content,language:a.language})));return gu("Parsed response",{commands:r.length,postCommands:n.length,dependencies:s.length,files:i.length}),{commands:r,files:i,dependencies:s,postCommands:n}},wu=e=>{let t=e.filter(o=>!o.content||o.content.trim().length===0),r=e.length===0?["No files could be extracted from the AI response"]:t.map(o=>`File ${o.path} is empty`),n=e.some(o=>["src/index.ts","src/main.ts","index.ts"].includes(o.path)),s=e.length>0&&!n?["No entry point file (src/index.ts or src/main.ts) found - assuming it exists from scaffolding"]:[];return{valid:r.length===0,errors:r,warnings:s}};var Cu=require("node:fs"),St=b(require("chalk"));var bu=async(e,t,r)=>{if(e.length===0){(0,Cu.mkdirSync)(t,{recursive:!0}),console.log(St.default.yellow(`\u26A0 No scaffolding command found - creating empty directory
160
+ `));return}let s=(await hi(e,r)).find(o=>!o.success);if(s)throw console.log(St.default.red(`
161
+ \u2717 Scaffolding failed: ${s.command}`)),s.error&&console.log(St.default.red(` Error: ${s.error}`)),new Error(`Command failed: ${s.command}${s.error?` - ${s.error}`:""}`)},xu=async(e,t)=>{t.start("Linking workspace dependencies...");try{await Et({cwd:e,quiet:!0}),t.succeed("Workspace dependencies linked")}catch{let r=B();t.warn(`Workspace sync skipped (run ${r} install manually)`)}},vu=async(e,t,r)=>{if(e.length===0)return;r.stop();let n=e.length===1?"package":"packages";console.log(St.default.cyan(`
162
162
  \u25B6 Installing ${e.length} additional ${n}...
163
163
  `));try{await Et({packages:e,cwd:t,flags:["--silent"]}),console.log(St.default.green(`\u2713 Installed ${e.length} ${n}
164
164
  `))}catch(s){throw console.log(St.default.red(`\u2717 Package installation failed
165
- `)),s}},mi=async(e,t)=>{if(e.length===0)return;console.log(St.default.cyan(`
165
+ `)),s}},yi=async(e,t)=>{if(e.length===0)return;console.log(St.default.cyan(`
166
166
  \u25B6 Running post-generation commands...
167
- `));let n=(await pi(e,t)).find(s=>!s.success);if(n){console.log(St.default.yellow(`
167
+ `));let n=(await hi(e,t)).find(s=>!s.success);if(n){console.log(St.default.yellow(`
168
168
  \u26A0 Post-command failed: ${n.command}`)),n.error&&console.log(St.default.yellow(` Error: ${n.error}`));return}console.log(St.default.green(`\u2713 Post-generation commands complete
169
- `))};var pn=b(require("chalk")),oy=e=>`${pn.default.dim(" \u2022 ")+pn.default.cyan(e)}
170
- `,bu=e=>pn.default.dim(` \u2728 Generated ${pn.default.white.bold(e)} tokens
171
- `),xu=()=>{let e="",t=0,r=Date.now(),n=[],s=()=>{let i=e.match(/####\s+`([^`]+)`/);if(!i)return!1;n.push(i[1]),process.stdout.write(oy(i[1]));let a=e.indexOf(i[0])+i[0].length;return e=e.slice(a),!0},o=i=>{e+=i,t++,s(),e.length>500&&(e=e.slice(-200))};return o.getStats=()=>{let i=((Date.now()-r)/1e3).toFixed(2),a=(t/Number.parseFloat(i)).toFixed(0);return{tokenCount:t,duration:i,tokensPerSec:a}},o.getFiles=()=>n,o};var iy=()=>{let e=O(),t=(0,ur.join)(e,"package.json"),r=(()=>{if(!(0,Xt.existsSync)(t))throw new Error("No package.json found in workspace root. Run from a valid workspace.");try{let s=JSON.parse((0,Xt.readFileSync)(t,"utf-8")).name;if(!s)throw new Error('package.json has no "name" field. Please add a name to your root package.json.');return s.startsWith("@")?s:`@${s}`}catch(n){throw n instanceof SyntaxError?new Error("Invalid JSON in package.json"):n}})();return{workspaceRoot:e,scope:r,cwd:process.cwd()}},ay=async(e,t,r,n,s,o)=>{let i=fu(r,n,s,t.workspaceRoot),a=pu(t,s,o),c=xu(),l=await Gl(e,i,{system:a,maxTokens:16384,temperature:.7,onToken:c}),u=c.getStats();return console.log(bu(u.tokenCount)),console.log(),l},cy=(e,t)=>{let{serviceTypes:r}=tn(),n=r[t]?.commandType;if(!n)return e;let s=Object.values(r).map(o=>o.commandType);return e.map(o=>{for(let i of s)if(i!==n&&o.command.includes(`pf new ${i}`))return{...o,command:o.command.replace(`pf new ${i}`,`pf new ${n}`)};return o})},ly=e=>e.length===0?"":`${[T.default.cyan(`
169
+ `))};var fn=b(require("chalk")),ly=e=>`${fn.default.dim(" \u2022 ")+fn.default.cyan(e)}
170
+ `,ku=e=>fn.default.dim(` \u2728 Generated ${fn.default.white.bold(e)} tokens
171
+ `),Eu=()=>{let e="",t=0,r=Date.now(),n=[],s=()=>{let i=e.match(/####\s+`([^`]+)`/);if(!i)return!1;n.push(i[1]),process.stdout.write(ly(i[1]));let a=e.indexOf(i[0])+i[0].length;return e=e.slice(a),!0},o=i=>{e+=i,t++,s(),e.length>500&&(e=e.slice(-200))};return o.getStats=()=>{let i=((Date.now()-r)/1e3).toFixed(2),a=(t/Number.parseFloat(i)).toFixed(0);return{tokenCount:t,duration:i,tokensPerSec:a}},o.getFiles=()=>n,o};var uy=()=>{let e=O(),t=(0,ur.join)(e,"package.json"),r=(()=>{if(!(0,Xt.existsSync)(t))throw new Error("No package.json found in workspace root. Run from a valid workspace.");try{let s=JSON.parse((0,Xt.readFileSync)(t,"utf-8")).name;if(!s)throw new Error('package.json has no "name" field. Please add a name to your root package.json.');return s.startsWith("@")?s:`@${s}`}catch(n){throw n instanceof SyntaxError?new Error("Invalid JSON in package.json"):n}})();return{workspaceRoot:e,scope:r,cwd:process.cwd()}},py=async(e,t,r,n,s,o)=>{let i=mu(r,n,s,t.workspaceRoot),a=hu(t,s,o),c=Eu(),l=await Ul(e,i,{system:a,maxTokens:16384,temperature:.7,onToken:c}),u=c.getStats();return console.log(ku(u.tokenCount)),console.log(),l},fy=(e,t)=>{let{serviceTypes:r}=tn(),n=r[t]?.commandType;if(!n)return e;let s=Object.values(r).map(o=>o.commandType);return e.map(o=>{for(let i of s)if(i!==n&&o.command.includes(`pf new ${i}`))return{...o,command:o.command.replace(`pf new ${i}`,`pf new ${n}`)};return o})},dy=e=>e.length===0?"":`${[T.default.cyan(`
172
172
  \u{1F4C1} Files to create:`),...e.map(t=>` ${T.default.green("\u2022")} ${T.default.white(t.path)} ${T.default.dim(`(${t.language})`)}`)].join(`
173
173
  `)}
174
- `,vu=(e,t,r)=>e.length===0?"":`${[T.default.cyan(`
174
+ `,Su=(e,t,r)=>e.length===0?"":`${[T.default.cyan(`
175
175
  ${r} ${t}:`),...e.map(n=>` ${T.default.yellow("$")} ${T.default.white(n.command)}`)].join(`
176
176
  `)}
177
- `,uy=e=>e.length===0?"":`${[T.default.cyan(`
177
+ `,hy=e=>e.length===0?"":`${[T.default.cyan(`
178
178
  \u{1F4E6} Dependencies to install:`),...e.map(t=>` ${T.default.magenta("+")} ${T.default.white(t)}`)].join(`
179
179
  `)}
180
- `,py=(e,t)=>`${[T.default.yellow(`
180
+ `,my=(e,t)=>`${[T.default.yellow(`
181
181
  Validation errors:`),...e.map(r=>T.default.yellow(` \u26A0 ${r}`)),T.default.dim(`
182
182
  Response preview:`),T.default.dim(t)].join(`
183
183
  `)}
184
- `,lr=e=>{e&&process.stdout.write(e)},fy=(e,t)=>{let r=mu(e,t),n=fi(r.commands),s=fi(r.postCommands),o=gu(r.files);return o.valid?{files:r.files,commands:n,dependencies:r.dependencies,postCommands:s}:(console.log(`${T.default.yellow("\u26A0")} Could not extract structured files from AI response`),lr(py(o.errors,e.slice(0,500))),null)},dy=e=>{console.log(`${T.default.green("\u2714")} Extracted ${e.files.length} files`),lr(ly(e.files)),lr(vu(e.commands,"Commands to run","\u{1F527}")),lr(vu(e.postCommands,"Post-generation commands","\u{1F4DD}")),lr(uy(e.dependencies)),lr(`
185
- `)},hy=(e,t,r)=>{let n=eu(e);return n&&!n.includes("/")&&!n.startsWith(".")&&(n=`${kt().services}/${n}`),n?(0,ur.resolve)(r,n):(0,ur.resolve)(r,t)},my=(e,t)=>{let{serviceTypes:r}=tn(),n=r[t]?.skipFiles||["package.json","tsconfig.json","Dockerfile"];return e.filter(s=>!n.includes(s.path))},pr=()=>{if(!on())return{valid:!1,error:T.default.red.bold(`\u274C AI configuration not found.
184
+ `,lr=e=>{e&&process.stdout.write(e)},gy=(e,t)=>{let r=yu(e,t),n=mi(r.commands),s=mi(r.postCommands),o=wu(r.files);return o.valid?{files:r.files,commands:n,dependencies:r.dependencies,postCommands:s}:(console.log(`${T.default.yellow("\u26A0")} Could not extract structured files from AI response`),lr(my(o.errors,e.slice(0,500))),null)},Dy=e=>{console.log(`${T.default.green("\u2714")} Extracted ${e.files.length} files`),lr(dy(e.files)),lr(Su(e.commands,"Commands to run","\u{1F527}")),lr(Su(e.postCommands,"Post-generation commands","\u{1F4DD}")),lr(hy(e.dependencies)),lr(`
185
+ `)},yy=(e,t,r)=>{let n=su(e);return n&&!n.includes("/")&&!n.startsWith(".")&&(n=`${kt().services}/${n}`),n?(0,ur.resolve)(r,n):(0,ur.resolve)(r,t)},wy=(e,t)=>{let{serviceTypes:r}=tn(),n=r[t]?.skipFiles||["package.json","tsconfig.json","Dockerfile"];return e.filter(s=>!n.includes(s.path))},pr=()=>{if(!on())return{valid:!1,error:T.default.red.bold(`\u274C AI configuration not found.
186
186
  `)+T.default.yellow("Please run ")+T.default.cyan.bold("pf setup --ai")+T.default.yellow(` first to configure your AI provider.
187
- `)};try{return{valid:!0,config:fs()}}catch(e){return{valid:!1,error:T.default.red.bold(`\u274C ${e.message}
188
- `)}}},xs=async e=>e||(0,ku.input)({message:"\u{1F4DD} Describe what this service should do:",validate:t=>t.trim().length>0||"Please provide a description for the AI to generate code"}),vs=(e,t,r)=>{console.log(T.default.cyan.bold(`
187
+ `)};try{return{valid:!0,config:hs()}}catch(e){return{valid:!1,error:T.default.red.bold(`\u274C ${e.message}
188
+ `)}}},Es=async e=>e||(0,Fu.input)({message:"\u{1F4DD} Describe what this service should do:",validate:t=>t.trim().length>0||"Please provide a description for the AI to generate code"}),Ss=(e,t,r)=>{console.log(T.default.cyan.bold(`
189
189
  \u{1F916} AI-Powered Generation
190
190
  `)),console.log(T.default.dim(`Service: ${e.split("/").pop()}`)),console.log(T.default.dim(`Path: ${e}`)),console.log(T.default.dim(`Model: ${t.model}`)),console.log(T.default.dim(`Description: ${r}
191
- `))},ks=async(e,t)=>{let{servicePath:r,description:n="",serviceType:s,packageManager:o}=e,i=r.split("/").pop()||r,a=iy(),c=(0,ur.join)(a.workspaceRoot,cn);(0,Xt.writeFileSync)(c,`generating:${r}`);let l=()=>{(0,Xt.existsSync)(c)&&(0,Xt.unlinkSync)(c)},u=()=>{l(),process.exit(130)};process.on("SIGINT",u),process.on("SIGTERM",u);try{console.log(T.default.cyan.bold(`
191
+ `))},Fs=async(e,t)=>{let{servicePath:r,description:n="",serviceType:s,packageManager:o}=e,i=r.split("/").pop()||r,a=uy(),c=(0,ur.join)(a.workspaceRoot,cn);(0,Xt.writeFileSync)(c,`generating:${r}`);let l=()=>{(0,Xt.existsSync)(c)&&(0,Xt.unlinkSync)(c)},u=()=>{l(),process.exit(130)};process.on("SIGINT",u),process.on("SIGTERM",u);try{console.log(T.default.cyan.bold(`
192
192
  \u{1F916} AI Generation
193
- `));let p=await ay(t,a,r,n,s,o),d=fy(p,i);if(!d)return!1;dy(d);let f=(0,Eu.default)({text:"Processing files...",color:"cyan"}).start(),m=cy(d.commands,s),h=hy(m,r,a.cwd),D=my(d.files,s);await yu(m,h,a.workspaceRoot);let{missingContractCommands:g}=await su(D,h,a,f);if(d.postCommands.length>0)await mi(d.postCommands,a.workspaceRoot);else if(g.length>0){console.log(T.default.cyan(`\u{1F527} Auto-creating missing contracts...
194
- `));let y=g.map(x=>({command:x,isPfCommand:!0}));await mi(y,a.workspaceRoot)}return tu(h),await Cu(d.dependencies,h,f),await wu(a.workspaceRoot,f),await nu(h,f),!0}finally{process.off("SIGINT",u),process.off("SIGTERM",u),l()}};var Fu=require("node:fs"),fn=require("ts-morph"),Su=new fn.Project({skipAddingFilesFromTsConfig:!0,skipFileDependencyResolution:!0}),gi=e=>{if(!(0,Fu.existsSync)(e))return null;let t=Su.getSourceFile(e);return t||Su.addSourceFileAtPath(e)},Di=e=>{e.saveSync()},yi=(e,t,r)=>{let n=e.getImportDeclaration(t);if(n){let s=n.getNamedImports().map(i=>i.getName()),o=r.filter(i=>!s.includes(i));for(let i of o)n.addNamedImport(i);return}e.addImportDeclaration({moduleSpecifier:t,namedImports:r})},gy=e=>{for(let t of e.getClasses()){let r=t.getDecorator("Module");if(!r)continue;let n=r.getArguments();if(n.length===0)continue;let s=n[0];if(s.getKind()===fn.SyntaxKind.ObjectLiteralExpression)return s}return null},wi=(e,t)=>{let r=gy(e);if(!r)return!1;let n=r.getProperty("imports");if(n){let s=n.getFirstChildByKind(fn.SyntaxKind.ArrayLiteralExpression);return s?(s.getElements().map(i=>i.getText()).includes(t)||s.addElement(t),!0):!1}return r.addPropertyAssignment({name:"imports",initializer:`[${t}]`}),!0};var Es=require("node:fs"),dn=b(require("node:path")),Ci=b(require("chalk"));var Tu=async e=>{await de("bash",["-c",`
193
+ `));let p=await py(t,a,r,n,s,o),d=gy(p,i);if(!d)return!1;Dy(d);let f=(0,Tu.default)({text:"Processing files...",color:"cyan"}).start(),m=fy(d.commands,s),h=yy(m,r,a.cwd),D=wy(d.files,s);await bu(m,h,a.workspaceRoot);let{missingContractCommands:g}=await au(D,h,a,f);if(d.postCommands.length>0)await yi(d.postCommands,a.workspaceRoot);else if(g.length>0){console.log(T.default.cyan(`\u{1F527} Auto-creating missing contracts...
194
+ `));let y=g.map(x=>({command:x,isPfCommand:!0}));await yi(y,a.workspaceRoot)}return nu(h),await vu(d.dependencies,h,f),await xu(a.workspaceRoot,f),await iu(h,f),!0}finally{process.off("SIGINT",u),process.off("SIGTERM",u),l()}};var Pu=require("node:fs"),dn=require("ts-morph"),Au=new dn.Project({skipAddingFilesFromTsConfig:!0,skipFileDependencyResolution:!0}),wi=e=>{if(!(0,Pu.existsSync)(e))return null;let t=Au.getSourceFile(e);return t||Au.addSourceFileAtPath(e)},Ci=e=>{e.saveSync()},bi=(e,t,r)=>{let n=e.getImportDeclaration(t);if(n){let s=n.getNamedImports().map(i=>i.getName()),o=r.filter(i=>!s.includes(i));for(let i of o)n.addNamedImport(i);return}e.addImportDeclaration({moduleSpecifier:t,namedImports:r})},Cy=e=>{for(let t of e.getClasses()){let r=t.getDecorator("Module");if(!r)continue;let n=r.getArguments();if(n.length===0)continue;let s=n[0];if(s.getKind()===dn.SyntaxKind.ObjectLiteralExpression)return s}return null},xi=(e,t)=>{let r=Cy(e);if(!r)return!1;let n=r.getProperty("imports");if(n){let s=n.getFirstChildByKind(dn.SyntaxKind.ArrayLiteralExpression);return s?(s.getElements().map(i=>i.getText()).includes(t)||s.addElement(t),!0):!1}return r.addPropertyAssignment({name:"imports",initializer:`[${t}]`}),!0};var Ts=require("node:fs"),hn=b(require("node:path")),vi=b(require("chalk"));var Ru=async e=>{await de("bash",["-c",`
195
195
  curl -fsSL https://bun.sh/install | bash && if [ -f "$HOME/.bun/bin/bun" ]; then export PATH="$HOME/.bun/bin:$PATH"; fi
196
- `],{task:e,shell:!0}),await Dy()},bi=()=>Nr("bun"),Au=()=>so([{label:"Bun",value:59026,color:"magenta",barColor:"magenta"},{label:"Deno",value:25335},{label:"Node.js",value:19039}],{title:'Express.js "hello world" HTTP requests per second (Linux x64)',barColor:"blackBright"}),Pu=()=>so([{label:"Bun",value:.36,color:"magenta",barColor:"magenta"},{label:"pnpm",value:6.44},{label:"npm",value:10.58},{label:"yarn",value:12.08}],{title:"Bun is an npm-compatible package manager.",unit:"s",footer:Ci.default.blackBright("* Installing dependencies from cache for a Remix app."),barColor:"blackBright"}),Dy=async()=>{let e='export PATH="$HOME/.bun/bin:$PATH"',t=process.env.HOME;if(!t){w.error("Could not detect $HOME environment variable. Cannot update shell config.");return}let r=[dn.default.join(t,".zshrc"),dn.default.join(t,".bashrc"),dn.default.join(t,".bash_profile")];for(let n of r)try{if(await Es.promises.stat(n).then(()=>!0).catch(()=>!1)){(await Es.promises.readFile(n,"utf8")).includes(e)||(await Es.promises.appendFile(n,`
196
+ `],{task:e,shell:!0}),await by()},ki=()=>Nr("bun"),Iu=()=>io([{label:"Bun",value:59026,color:"magenta",barColor:"magenta"},{label:"Deno",value:25335},{label:"Node.js",value:19039}],{title:'Express.js "hello world" HTTP requests per second (Linux x64)',barColor:"blackBright"}),Nu=()=>io([{label:"Bun",value:.36,color:"magenta",barColor:"magenta"},{label:"pnpm",value:6.44},{label:"npm",value:10.58},{label:"yarn",value:12.08}],{title:"Bun is an npm-compatible package manager.",unit:"s",footer:vi.default.blackBright("* Installing dependencies from cache for a Remix app."),barColor:"blackBright"}),by=async()=>{let e='export PATH="$HOME/.bun/bin:$PATH"',t=process.env.HOME;if(!t){w.error("Could not detect $HOME environment variable. Cannot update shell config.");return}let r=[hn.default.join(t,".zshrc"),hn.default.join(t,".bashrc"),hn.default.join(t,".bash_profile")];for(let n of r)try{if(await Ts.promises.stat(n).then(()=>!0).catch(()=>!1)){(await Ts.promises.readFile(n,"utf8")).includes(e)||(await Ts.promises.appendFile(n,`
197
197
  # Added by platform installer
198
198
  ${e}
199
- `),w.log(`Added Bun path to ${dn.default.basename(n)}`));return}}catch(s){w.error(`Failed to update ${n}: ${s.message}`)}w.warn("No shell config file (.zshrc, .bashrc, .bash_profile) found. Please add the following manually:"),w.log(Ci.default.cyan(e))};var rt=b(require("chalk")),Ru=require("execa"),Iu=require("jiti");var hn=async e=>{let{stdout:t}=await(0,Ru.execa)("sh",["-c",e]);return t.trim()},xi="pf-local-nats",yy="2.10-alpine",wy=4222,Cy=8222,by=e=>({clientPort:e.clientPort??wy,monitoringPort:e.monitoringPort??Cy,containerName:e.containerName??xi,version:e.version??yy}),xy=e=>["run","--rm","--detach",`--name=${e.containerName}`,`-p=${e.clientPort}:4222`,`-p=${e.monitoringPort}:8222`,`nats:${e.version}`,"--jetstream","--store_dir=/data","--http_port=8222"],vy=e=>({containerName:e.containerName,clientUrl:`nats://localhost:${e.clientPort}`,monitoringUrl:`http://localhost:${e.monitoringPort}`}),ky=async()=>{try{return await hn("docker info"),!0}catch{return!1}},Nu=async e=>{try{return(await hn(`docker ps -q -f name=${e}`)).length>0}catch{return!1}},Ey=async e=>{try{await hn(`docker stop ${e} 2>/dev/null || true`),await hn(`docker rm ${e} 2>/dev/null || true`)}catch{}},Sy=async e=>{let t=xy(e);try{return await hn(`docker ${t.join(" ")}`),{success:!0,value:vy(e)}}catch{return{success:!1}}},Fy=e=>{console.log(rt.default.green("\u2713 NATS started")),console.log(rt.default.dim(` Client: ${e.clientUrl}`)),console.log(rt.default.dim(` Monitoring: ${e.monitoringUrl}`)),console.log(rt.default.dim(" Streams: ephemeral, auto-created by services")),console.log("")},Ou=async(e={})=>{let t=by(e);if(!await ky())return console.log(rt.default.yellow("\u26A0\uFE0F Docker not available - skipping NATS (services may fail)")),!1;if(await Nu(t.containerName))return console.log(rt.default.dim("\u2713 NATS already running")),!0;console.log(rt.default.cyan("\u{1F680} Starting development infrastructure...")),console.log(rt.default.dim(" NATS with JetStream (ephemeral)"));let r=await Sy(t);return r.success?(Fy(r.value),!0):(console.error(rt.default.red("\u2717 Failed to start NATS")),!1)},Ty=e=>e.map(t=>({stream:t,subjects:[`${t.toLowerCase()}.*`],config:{storage:"memory",retention:"limits",maxAge:36e5}})),Ay=e=>Array.from(new Set(Object.values(e).filter(t=>t!==null&&typeof t=="object"&&"channel"in t).map(t=>t.channel?.stream).filter(t=>!!t))),Mu=async e=>{try{let{ensureJetStreams:t}=await import("@crossdelta/cloudevents"),{indexPath:r}=$(e),s=await(0,Iu.createJiti)(e).import(r,{default:!0}),o=Ay(s);if(o.length===0){console.log(rt.default.dim(" No streams found in contracts"));return}let i=Ty(o);await t({streams:i}),console.log(rt.default.dim(` Created ${o.length} ephemeral stream(s): ${o.join(", ")}`))}catch(t){console.log(rt.default.yellow(` \u26A0\uFE0F Stream creation failed: ${t instanceof Error?t.message:"Unknown error"}`)),console.log(rt.default.dim(" Stream auto-creation will happen on first publish"))}},Py=async(e=xi)=>{await Nu(e)&&(console.log(rt.default.dim("Stopping NATS...")),await Ey(e))},$u=async(e=xi)=>{await Py(e)};var jt=b(require("chalk"));var Ss="integrations-run";var V=require("zod"),Ry=V.z.object({name:V.z.string(),description:V.z.string(),link:V.z.string().url().optional(),install:V.z.union([V.z.string(),V.z.array(V.z.string())]).transform(e=>Array.isArray(e)?e:[e]),installFlags:V.z.array(V.z.string()).optional(),run:V.z.array(V.z.string()).optional(),initial:V.z.boolean().optional(),interactive:V.z.boolean().optional()}),Bu=V.z.array(Ry);var ju=e=>{try{return Bu.parse(e)}catch(t){throw new Error(t.issues.map(r=>` - Path ${r.path.join(". ")} : ${r.message}`).join(`
200
- `))}};var Ft=()=>{try{let e=as("bin/integration.collection.json");return ju(e)}catch(e){throw new Error(`Failed to load integrations!
199
+ `),w.log(`Added Bun path to ${hn.default.basename(n)}`));return}}catch(s){w.error(`Failed to update ${n}: ${s.message}`)}w.warn("No shell config file (.zshrc, .bashrc, .bash_profile) found. Please add the following manually:"),w.log(vi.default.cyan(e))};var rt=b(require("chalk")),Ou=require("execa"),Mu=require("jiti");var mn=async e=>{let{stdout:t}=await(0,Ou.execa)("sh",["-c",e]);return t.trim()},Ei="pf-local-nats",xy="2.10-alpine",vy=4222,ky=8222,Ey=e=>({clientPort:e.clientPort??vy,monitoringPort:e.monitoringPort??ky,containerName:e.containerName??Ei,version:e.version??xy}),Sy=e=>["run","--rm","--detach",`--name=${e.containerName}`,`-p=${e.clientPort}:4222`,`-p=${e.monitoringPort}:8222`,`nats:${e.version}`,"--jetstream","--store_dir=/data","--http_port=8222"],Fy=e=>({containerName:e.containerName,clientUrl:`nats://localhost:${e.clientPort}`,monitoringUrl:`http://localhost:${e.monitoringPort}`}),Ty=async()=>{try{return await mn("docker info"),!0}catch{return!1}},$u=async e=>{try{return(await mn(`docker ps -q -f name=${e}`)).length>0}catch{return!1}},Ay=async e=>{try{await mn(`docker stop ${e} 2>/dev/null || true`),await mn(`docker rm ${e} 2>/dev/null || true`)}catch{}},Py=async e=>{let t=Sy(e);try{return await mn(`docker ${t.join(" ")}`),{success:!0,value:Fy(e)}}catch{return{success:!1}}},Ry=e=>{console.log(rt.default.green("\u2713 NATS started")),console.log(rt.default.dim(` Client: ${e.clientUrl}`)),console.log(rt.default.dim(` Monitoring: ${e.monitoringUrl}`)),console.log(rt.default.dim(" Streams: ephemeral, auto-created by services")),console.log("")},Bu=async(e={})=>{let t=Ey(e);if(!await Ty())return console.log(rt.default.yellow("\u26A0\uFE0F Docker not available - skipping NATS (services may fail)")),!1;if(await $u(t.containerName))return console.log(rt.default.dim("\u2713 NATS already running")),!0;console.log(rt.default.cyan("\u{1F680} Starting development infrastructure...")),console.log(rt.default.dim(" NATS with JetStream (ephemeral)"));let r=await Py(t);return r.success?(Ry(r.value),!0):(console.error(rt.default.red("\u2717 Failed to start NATS")),!1)},Iy=e=>e.map(t=>({stream:t,subjects:[`${t.toLowerCase()}.*`],config:{storage:"memory",retention:"limits",maxAge:36e5}})),Ny=e=>Array.from(new Set(Object.values(e).filter(t=>t!==null&&typeof t=="object"&&"channel"in t).map(t=>t.channel?.stream).filter(t=>!!t))),ju=async e=>{try{let{ensureJetStreams:t}=await import("@crossdelta/cloudevents"),{indexPath:r}=$(e),s=await(0,Mu.createJiti)(e).import(r,{default:!0}),o=Ny(s);if(o.length===0){console.log(rt.default.dim(" No streams found in contracts"));return}let i=Iy(o);await t({streams:i}),console.log(rt.default.dim(` Created ${o.length} ephemeral stream(s): ${o.join(", ")}`))}catch(t){console.log(rt.default.yellow(` \u26A0\uFE0F Stream creation failed: ${t instanceof Error?t.message:"Unknown error"}`)),console.log(rt.default.dim(" Stream auto-creation will happen on first publish"))}},Oy=async(e=Ei)=>{await $u(e)&&(console.log(rt.default.dim("Stopping NATS...")),await Ay(e))},_u=async(e=Ei)=>{await Oy(e)};var jt=b(require("chalk"));var As="integrations-run";var V=require("zod"),My=V.z.object({name:V.z.string(),description:V.z.string(),link:V.z.string().url().optional(),install:V.z.union([V.z.string(),V.z.array(V.z.string())]).transform(e=>Array.isArray(e)?e:[e]),installFlags:V.z.array(V.z.string()).optional(),run:V.z.array(V.z.string()).optional(),initial:V.z.boolean().optional(),interactive:V.z.boolean().optional()}),Lu=V.z.array(My);var Wu=e=>{try{return Lu.parse(e)}catch(t){throw new Error(t.issues.map(r=>` - Path ${r.path.join(". ")} : ${r.message}`).join(`
200
+ `))}};var Ft=()=>{try{let e=ls("bin/integration.collection.json");return Wu(e)}catch(e){throw new Error(`Failed to load integrations!
201
201
  Check your integration.collection.json:
202
- ${e.message}`)}},fr=()=>Ft().reduce((t,r)=>(r.initial&&t.push(r.name),t),[]),Iy=e=>!!e?.name&&!!e?.link&&!!e?.description,Fs=e=>{let t=Ft();if(!t?.length||!e?.length)return;let r=e.map(n=>t.find(s=>s.name===n)).filter(Iy);r.length&&(w.breakLine().log("\u{1F50C} Installed Integrations:"),r.forEach(({name:n,link:s,description:o})=>{let i=w.getStoredLogs(`${Ss}:${n}`);s&&w.log(`${zt(jt.default.cyan(n),s)} - ${o}`),i.length&&w.log(i.map(a=>` \u203A ${jt.default.dim(a.message)}`).join(`
203
- `))}))},Ny=e=>e.toUpperCase().replace(/-/g,"_"),_u=(e,t)=>{let r=Ny(e);w.breakLine().log(jt.default.bold("Environment variables:")).log(jt.default.dim(" Local:")).log(jt.default.cyan(` ${r}_PORT=${t}`)).log(jt.default.cyan(` ${r}_URL=http://localhost:${t}`)).breakLine().log(jt.default.dim(" Production (auto-configured):")).log(jt.default.cyan(` ${r}_PORT=${t}`)).log(jt.default.cyan(` ${r}_URL=http://${e}:${t}`))};var vi=b(require("chalk"));var Oy=e=>{let t=e.match(/^(@?[^@]+)@(.+)$/);return t?{name:t[1],version:t[2]}:{name:e,version:"latest"}},Lu=async e=>{let{selectedIntegrations:t,cwd:r,packageManager:n=B(),task:s}=e;if(!t?.length||!s)return;let o=My(t,r,n,s);await os(s,o)},My=(e,t,r,n)=>{let o=Ft()?.filter(a=>e.includes(a.name))?.flatMap(a=>a.install.map(c=>{let{name:l,version:u}=Oy(c);return{title:vi.default.cyanBright(`Adding ${c} (${a.name})`),fn:async()=>{qt(`dependencies.${l}`,u,t)}}})),i={title:vi.default.cyanBright("Installing packages..."),fn:async()=>{await Et({cwd:t,packageManager:r,task:n})}};return[...o??[],i]};var Wu=b(require("chalk"));var Gu=async e=>{let{selectedIntegrations:t,cwd:r,task:n}=e;if(!t?.length||!n)return;let s=$y(t,r,n,e.packageManager);await os(n,s)},$y=(e,t,r,n)=>Ft().filter(o=>e.includes(o.name)&&o.run?.length).flatMap(o=>(o.run||[]).map(i=>({title:Wu.default.cyanBright(`Running "${i}" for ${o.name}
204
- `),fn:()=>By(o,i,t,r,n)}))),By=async(e,t,r,n,s)=>{let o=`${Ss}:${e.name}`;try{if(e.interactive)return kl(t,[],{cwd:r,context:o,task:n,manager:s});await Yt(t,[],{cwd:r,task:n,context:o})}catch(i){w.error(`Failed to run command "${t}" for ${e.name}: ${i.message}`)}};var Ts=require("node:fs"),mn=require("node:path");var As=(e,t)=>{try{let r=(0,Ts.readFileSync)(e,"utf-8"),n=JSON.parse(r);t(n),(0,Ts.writeFileSync)(e,JSON.stringify(n,null,2),"utf-8")}catch{}},jy=e=>{let t=(0,mn.join)(S(e),"tsconfig.json");As(t,r=>{r.compilerOptions.module="ESNext",r.compilerOptions.moduleResolution="bundler",r.compilerOptions.resolvePackageJsonExports=!0,r.compilerOptions.types=r.compilerOptions.types||[],r.compilerOptions.types.includes("bun-types")||r.compilerOptions.types.push("bun-types"),r.exclude=["node_modules","dist"]})},_y=e=>{let t=(0,mn.join)(S(e),"tsconfig.build.json");As(t,r=>{r.exclude=["node_modules","test","dist","**/*.spec.ts","**/*.test.ts"]})},Ly=e=>{let t=(0,mn.join)(S(e),"nest-cli.json");As(t,r=>{r.compilerOptions=r.compilerOptions||{},r.compilerOptions.tsConfigPath="tsconfig.build.json"})},Wy=e=>{let t=(0,mn.join)(S(e),"package.json");As(t,r=>{delete r.jest})},Hu=e=>{jy(e),_y(e),Ly(e),Wy(e)};var Uu=require("node:path");var Gy=(e,t)=>{let r=gi(e);if(r){for(let{className:n,importPath:s}of t)yi(r,s,[n]),wi(r,n);Di(r)}},zu=e=>{let t=(0,Uu.join)(S(e),"src","app.module.ts");Gy(t,[{className:"EventsModule",importPath:"./events/events.module"}])};var Hy=require("fs-extra");var Tw=b(require("chalk")),Aw=b(Oi());var Os=require("node:fs"),Kp=require("node:path"),Jp=b(require("handlebars")),mr=(e,t)=>{for(let r of e)if((0,Os.existsSync)(r))return r;throw new Error(t??`Templates directory not found. Searched in: ${e.join(", ")}`)},Mi=(e,t={})=>{let r=(0,Os.readFileSync)(e,"utf-8");return Jp.default.compile(r)(t)},Ms=e=>(t,r={})=>{let n=(0,Kp.join)(e,t);return Mi(n,r)};var $s=e=>e.toUpperCase().replace(/-/g,"_");var qp=e=>e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ");function Bs(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}async function Vp(e,t,r={},n=[],s=[]){if(!e){console.error("Subcommand is not defined.");return}let o=n.map(l=>t[l]).filter(l=>l!==void 0),i=s.map(l=>{let u=t[l];if(!(u===!1||u===void 0))return u===!0?`--${Bs(String(l))}`:`--${Bs(String(l))}=${String(u)}`}).filter(l=>l!==void 0),a=Object.entries(r).map(([l,u])=>{if(!(u===!1||u===void 0))return u===!0?`--${Bs(l)}`:`--${Bs(l)}=${String(u)}`}).filter(l=>l!==void 0),c=[...o,...i,...a].map(String);await e.parseAsync(c,{from:"user"})}var ff=require("node:path"),te=b(require("chalk"));var gr={title:"Confirm creation",enabled:e=>!e.userConfirmed,task:async(e,t)=>{if(e.userConfirmed=await t.prompt(R).run({type:"Toggle",initial:!0,message:"\u{1F680} Ready to launch your project?"}),!e.userConfirmed)throw new Error("Project creation was canceled by the user.")}};var Lt=require("node:fs"),Dr=require("node:path");function Yp(e,t){return`import type { K8sServiceConfig } from '@crossdelta/infrastructure'
202
+ ${e.message}`)}},fr=()=>Ft().reduce((t,r)=>(r.initial&&t.push(r.name),t),[]),$y=e=>!!e?.name&&!!e?.link&&!!e?.description,Ps=e=>{let t=Ft();if(!t?.length||!e?.length)return;let r=e.map(n=>t.find(s=>s.name===n)).filter($y);r.length&&(w.breakLine().log("\u{1F50C} Installed Integrations:"),r.forEach(({name:n,link:s,description:o})=>{let i=w.getStoredLogs(`${As}:${n}`);s&&w.log(`${zt(jt.default.cyan(n),s)} - ${o}`),i.length&&w.log(i.map(a=>` \u203A ${jt.default.dim(a.message)}`).join(`
203
+ `))}))},By=e=>e.toUpperCase().replace(/-/g,"_"),Gu=(e,t)=>{let r=By(e);w.breakLine().log(jt.default.bold("Environment variables:")).log(jt.default.dim(" Local:")).log(jt.default.cyan(` ${r}_PORT=${t}`)).log(jt.default.cyan(` ${r}_URL=http://localhost:${t}`)).breakLine().log(jt.default.dim(" Production (auto-configured):")).log(jt.default.cyan(` ${r}_PORT=${t}`)).log(jt.default.cyan(` ${r}_URL=http://${e}:${t}`))};var Si=b(require("chalk"));var jy=e=>{let t=e.match(/^(@?[^@]+)@(.+)$/);return t?{name:t[1],version:t[2]}:{name:e,version:"latest"}},Hu=async e=>{let{selectedIntegrations:t,cwd:r,packageManager:n=B(),task:s}=e;if(!t?.length||!s)return;let o=_y(t,r,n,s);await as(s,o)},_y=(e,t,r,n)=>{let o=Ft()?.filter(a=>e.includes(a.name))?.flatMap(a=>a.install.map(c=>{let{name:l,version:u}=jy(c);return{title:Si.default.cyanBright(`Adding ${c} (${a.name})`),fn:async()=>{qt(`dependencies.${l}`,u,t)}}})),i={title:Si.default.cyanBright("Installing packages..."),fn:async()=>{await Et({cwd:t,packageManager:r,task:n})}};return[...o??[],i]};var Uu=b(require("chalk"));var zu=async e=>{let{selectedIntegrations:t,cwd:r,task:n}=e;if(!t?.length||!n)return;let s=Ly(t,r,n,e.packageManager);await as(n,s)},Ly=(e,t,r,n)=>Ft().filter(o=>e.includes(o.name)&&o.run?.length).flatMap(o=>(o.run||[]).map(i=>({title:Uu.default.cyanBright(`Running "${i}" for ${o.name}
204
+ `),fn:()=>Wy(o,i,t,r,n)}))),Wy=async(e,t,r,n,s)=>{let o=`${As}:${e.name}`;try{if(e.interactive)return Sl(t,[],{cwd:r,context:o,task:n,manager:s});await Yt(t,[],{cwd:r,task:n,context:o})}catch(i){w.error(`Failed to run command "${t}" for ${e.name}: ${i.message}`)}};var Rs=require("node:fs"),gn=require("node:path");var Is=(e,t)=>{try{let r=(0,Rs.readFileSync)(e,"utf-8"),n=JSON.parse(r);t(n),(0,Rs.writeFileSync)(e,JSON.stringify(n,null,2),"utf-8")}catch{}},Gy=e=>{let t=(0,gn.join)(S(e),"tsconfig.json");Is(t,r=>{r.compilerOptions.module="ESNext",r.compilerOptions.moduleResolution="bundler",r.compilerOptions.resolvePackageJsonExports=!0,r.compilerOptions.types=r.compilerOptions.types||[],r.compilerOptions.types.includes("bun-types")||r.compilerOptions.types.push("bun-types"),r.exclude=["node_modules","dist"]})},Hy=e=>{let t=(0,gn.join)(S(e),"tsconfig.build.json");Is(t,r=>{r.exclude=["node_modules","test","dist","**/*.spec.ts","**/*.test.ts"]})},Uy=e=>{let t=(0,gn.join)(S(e),"nest-cli.json");Is(t,r=>{r.compilerOptions=r.compilerOptions||{},r.compilerOptions.tsConfigPath="tsconfig.build.json"})},zy=e=>{let t=(0,gn.join)(S(e),"package.json");Is(t,r=>{delete r.jest})},Ku=e=>{Gy(e),Hy(e),Uy(e),zy(e)};var Ju=require("node:path");var Ky=(e,t)=>{let r=wi(e);if(r){for(let{className:n,importPath:s}of t)bi(r,s,[n]),xi(r,n);Ci(r)}},qu=e=>{let t=(0,Ju.join)(S(e),"src","app.module.ts");Ky(t,[{className:"EventsModule",importPath:"./events/events.module"}])};var Jy=require("fs-extra");var Iw=b(require("chalk")),Nw=b(Bi());var Vp=require("node:fs"),Yp=require("node:path"),Zp=b(require("handlebars"));var mr=(e,t)=>Kl(e,t??`Templates directory not found. Searched in: ${e.join(", ")}`),ji=(e,t={})=>{let r=(0,Vp.readFileSync)(e,"utf-8");return Zp.default.compile(r)(t)},Bs=e=>(t,r={})=>{let n=(0,Yp.join)(e,t);return ji(n,r)};var js=e=>e.toUpperCase().replace(/-/g,"_");var Xp=e=>e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ");function _s(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}async function Qp(e,t,r={},n=[],s=[]){if(!e){console.error("Subcommand is not defined.");return}let o=n.map(l=>t[l]).filter(l=>l!==void 0),i=s.map(l=>{let u=t[l];if(!(u===!1||u===void 0))return u===!0?`--${_s(String(l))}`:`--${_s(String(l))}=${String(u)}`}).filter(l=>l!==void 0),a=Object.entries(r).map(([l,u])=>{if(!(u===!1||u===void 0))return u===!0?`--${_s(l)}`:`--${_s(l)}=${String(u)}`}).filter(l=>l!==void 0),c=[...o,...i,...a].map(String);await e.parseAsync(c,{from:"user"})}var gf=require("node:path"),te=b(require("chalk"));var gr={title:"Confirm creation",enabled:e=>!e.userConfirmed,task:async(e,t)=>{if(e.userConfirmed=await t.prompt(R).run({type:"Toggle",initial:!0,message:"\u{1F680} Ready to launch your project?"}),!e.userConfirmed)throw new Error("Project creation was canceled by the user.")}};var Lt=require("node:fs"),Dr=require("node:path");function tf(e,t){return`import type { K8sServiceConfig } from '@crossdelta/infrastructure'
205
205
  import { ports } from '@crossdelta/infrastructure'
206
206
 
207
207
  /**
@@ -222,7 +222,7 @@ const config: K8sServiceConfig = {
222
222
  }
223
223
 
224
224
  export default config
225
- `}function Zp(e,t){return`import type { K8sServiceConfig } from '@crossdelta/infrastructure'
225
+ `}function ef(e,t){return`import type { K8sServiceConfig } from '@crossdelta/infrastructure'
226
226
  import { ports } from '@crossdelta/infrastructure'
227
227
 
228
228
  /**
@@ -243,70 +243,70 @@ const config: K8sServiceConfig = {
243
243
  }
244
244
 
245
245
  export default config
246
- `}var Pw=4001,Rw=4e3;function Iw(e){let t=[],r=e.matchAll(/ports\(\)\.(?:http|https|grpc|primary)\((\d+)\)/g);for(let c of r)t.push(Number(c[1]));let n=e.matchAll(/\.add(?:Http|Grpc)?\((\d+)/g);for(let c of n)t.push(Number(c[1]));let s=e.match(/containerPort\s*:\s*(\d+)/);s&&t.push(Number(s[1]));let o=e.match(/internalPorts\s*:\s*\[([^\]]+)\]/);if(o){let c=o[1].match(/\d+/g);c&&t.push(...c.map(Number))}let i=e.match(/httpPort\s*:\s*(\d+)/);i&&t.push(Number(i[1]));let a=e.matchAll(/const\s+\w*[pP]ort\w*\s*=\s*(\d+)/g);for(let c of a)t.push(Number(c[1]));return t}function Nw(e,t){let r=t?Pw:Rw,n=new Set;if(!(0,Lt.existsSync)(e))return r;let s=(0,Lt.readdirSync)(e).filter(i=>i.endsWith(".ts"));for(let i of s){let a=(0,Dr.join)(e,i);try{let c=(0,Lt.readFileSync)(a,"utf-8"),l=Iw(c);for(let u of l)n.add(u)}catch{}}let o=r;for(;n.has(o);)o++;return o}function Ow(e){return(0,Dr.basename)(e)}var js={title:"Creating infrastructure service config",task:async(e,t)=>{let r=Ow(e.projectName),n=O(),s=(0,Dr.join)(n,"infra","services");if(!(0,Lt.existsSync)(s)){t.title="Skipping infra config (no infra/services directory found)";return}let o=(0,Dr.join)(s,`${r}.ts`);if((0,Lt.existsSync)(o)){t.title=`Service config already exists: infra/services/${r}.ts`;return}let i=Nw(s,!0);e.assignedPort=i;let a=e.serviceType==="hono"?Yp(r,i):Zp(r,i);(0,Lt.writeFileSync)(o,a),t.title=`Created infra/services/${r}.ts (port: ${i})`}};var Cn=require("node:child_process"),Xp=require("node:fs"),Qp=require("node:path"),Mw=()=>{try{return(0,Cn.execSync)("git --version",{stdio:"ignore"}),!0}catch{return!1}},$w=e=>(0,Xp.existsSync)((0,Qp.join)(e,".git")),tf={title:"Initializing git repository",enabled:()=>Mw(),skip:e=>$w(e.cwd)?"Already a git repository":!1,task:async(e,t)=>{try{(0,Cn.execSync)("git init",{cwd:e.cwd,stdio:"ignore"}),(0,Cn.execSync)("git add -A",{cwd:e.cwd,stdio:"ignore"}),(0,Cn.execSync)('git commit -m "chore: initial commit"',{cwd:e.cwd,stdio:"ignore",env:{...process.env,GIT_AUTHOR_NAME:process.env.GIT_AUTHOR_NAME||"Platform SDK",GIT_AUTHOR_EMAIL:process.env.GIT_AUTHOR_EMAIL||"platform-sdk@localhost",GIT_COMMITTER_NAME:process.env.GIT_COMMITTER_NAME||"Platform SDK",GIT_COMMITTER_EMAIL:process.env.GIT_COMMITTER_EMAIL||"platform-sdk@localhost"}}),t.title="Git repository initialized with initial commit"}catch{t.title="Git initialization skipped (git error)"}}};var $i=b(require("chalk"));var yr={title:"Installing Bun",enabled:e=>!!e.shouldInstallBun&&!bi(),task:async(e,t)=>q(t,async r=>{await Tu(t),e.elapsedTime+=r(),t.title=`Bun installed successfully. (${e.elapsedTime}s)`})},wr={enabled:e=>!bi()&&!e.shouldInstallBun&&!e.packageManager,task:async(e,t)=>{e.shouldInstallBun=await t.prompt(R).run({type:"Toggle",message:"Would you like to use Bun? (recommended)",initial:!0,footer:["",`${$i.default.magenta.bold("Bun")} is a fast JavaScript runtime, package manager, bundler, and test runner: ${$i.default.underline("https://bun.sh")}`,Au(),Pu()].join(`
247
- `)}),e.shouldInstallBun&&(e.packageManager="bun")}};var Bi=b(require("chalk"));var _s={title:"Install integrations",enabled:e=>e.selectedIntegrations.length>0,task:async(e,t)=>q(t,async r=>{let{selectedIntegrations:n,cwd:s,packageManager:o}=e;await Lu({selectedIntegrations:n,packageManager:o,cwd:s,task:t}),e.elapsedTime+=r()}),rendererOptions:{outputBar:1e3}},Ls={title:"Select integrations",enabled:e=>e.selectedIntegrations.length===0,task:async(e,t)=>{e.selectedIntegrations=await t.prompt(R).run({type:"MultiSelect",hint:`
248
- Press <space> to select/deselect, <enter> to confirm, <i> to invert selection`,message:"Which integrations would you like to include?",initial:fr().map((r,n)=>n),choices:e.availableIntegrations.map(({name:r,description:n})=>({name:r,message:[Bi.default.bold(r),n].join(" - "),value:r}))}),!e.selectedIntegrations||e.selectedIntegrations.length===0?t.title="No integrations selected.":t.title=["Selected integrations:",...e.selectedIntegrations.map(r=>Bi.default.bold(`\u2022 ${r}`))].join(`
249
- `)}};var ef={title:"Install Nest CLI",task:async(e,t)=>q(t,async r=>{await vl({packages:["@nestjs/cli"],task:t,cwd:e.cwd}),e.elapsedTime+=r()}),rendererOptions:{outputBar:1e3}};var Ws={title:"Install dependencies",task:async(e,t)=>q(t,async r=>{await Et({cwd:e.cwd,task:t,packageManager:e.packageManager}),e.elapsedTime+=r()})};var rf=b(require("chalk"));var Cr={enabled:e=>!e.removeDir&&!ss(e.cwd),task:async(e,t)=>{if(e.removeDir=await t.prompt(R).run({type:"Toggle",message:rf.default.bold("\u26A0\uFE0F Overwrite existing directory?"),initial:!1}),!e.removeDir)throw new Error("Project creation was canceled by the user.")}},br={enabled:e=>!!e.removeDir,task:async e=>el(e.cwd)};var Gs={title:"Run integration commands",enabled:e=>e.selectedIntegrations.length>0,task:async(e,t)=>q(t,async r=>{let{selectedIntegrations:n,cwd:s}=e;await Gu({selectedIntegrations:n,cwd:s,task:t,packageManager:e.packageManager}),e.elapsedTime+=r()}),rendererOptions:{outputBar:1}};var Bw=["services/my-hono-service","services/my-nest-service","my-platform"],xr={enabled:e=>e.skipInputPrompts||e.userConfirmed?!1:e.projectName?Bw.includes(e.projectName):!0,task:async(e,t)=>{e.projectName=await t.prompt(R).run({type:"Input",initial:e.projectName,message:"Enter project name",validate:r=>r?!0:"Project name is required."}),e.cwd&&(e.cwd=S(e.projectName))}};var ji=b(require("chalk"));var vr={title:"Select Package manager",task:async(e,t)=>{if(e.packageManager??=Ko(),e.packageManager){t.title=`Using ${ji.default.bold(e.packageManager)} as package manager.`;return}e.packageManager=await t.prompt(R).run({type:"Select",message:"Which package manager would you like to use?",initial:Jo(),choices:xl}),t.title=`Using ${ji.default.bold(e.packageManager)} as package manager.`}};var bn=b(require("chalk")),nf={title:"GitHub repository owner",task:async(e,t)=>{if(e.githubOwner){t.title=`GitHub owner: ${bn.default.bold(e.githubOwner)}`;return}e.githubOwner=await t.prompt(R).run({type:"Input",message:"Enter GitHub organization or username",initial:"my-org",validate:r=>r?.trim()?!0:"GitHub owner is required."}),t.title=`GitHub owner: ${bn.default.bold(e.githubOwner)}`}},sf={title:"Include GitHub CI/CD",task:async(e,t)=>{if(e.includeGitHubCI!==void 0){t.title=e.includeGitHubCI?"Including GitHub CI/CD workflows":"Skipping GitHub CI/CD";return}e.includeGitHubCI=await t.prompt(R).run({type:"Toggle",message:"Include GitHub Actions workflows and CI/CD?",initial:!0,enabled:"Yes",disabled:"No"}),t.title=e.includeGitHubCI?"Including GitHub CI/CD workflows":"Skipping GitHub CI/CD"}};var of={title:"Pulumi stack name",task:async(e,t)=>{if(e.pulumiStackBase){t.title=`Pulumi stack: ${bn.default.bold(e.pulumiStackBase)}`;return}let r=e.githubOwner||"myorg",n=e.projectName?.replace(/[^a-zA-Z0-9-]/g,"-")||"myproject",s=`${r}/${n}`;e.pulumiStackBase=await t.prompt(R).run({type:"Input",message:"Enter Pulumi stack base name (org/project)",initial:s,validate:o=>o?.trim()?o.includes("/")?!0:"Format should be org/project (e.g., myorg/myproject)":"Pulumi stack name is required."}),t.title=`Pulumi stack: ${bn.default.bold(e.pulumiStackBase)}`}};var me=require("node:fs"),Wt=require("node:path");var Li=require("node:path");var jw=()=>mr([(0,Li.join)(__dirname,"templates","hono-microservice"),(0,Li.join)(__dirname,"..","hono-microservice","templates")],"Hono templates directory not found."),Hs=(e,t={})=>Ms(jw())(e,t);function af(){return Hs("tsconfig.json.hbs")}function cf(e="1.2.23"){return Hs("Dockerfile.hbs",{bunVersion:e})}function lf(){return Hs("biome.json.hbs")}function uf(e){return Hs("src/index.ts.hbs",{envKey:$s(e)})}var _w=async({projectName:e,packageManager:t},r)=>{let n=t==="bun"?"bun":"nodejs";try{await Yt("create-hono@latest",[e,"--pm",t,"--template",n,"--install"],{task:r})}catch(o){let i=(0,Wt.join)(S(e),"package.json");if(!(0,me.existsSync)(i))throw new Error(`Failed to scaffold: ${o instanceof Error?o.message:String(o)}`)}let s=(0,Wt.join)(S(e),"package.json");if(!(0,me.existsSync)(s))throw new Error("Failed to scaffold Hono app structure - package.json not created")},Lw=({projectName:e,packageManager:t})=>{let r=(0,Wt.basename)(e),n=is(),s=t==="npm"?"*":"workspace:*",o=S(e),i=nl("scripts.dev",o);i&&qt("scripts.start:dev",i,e),[{field:"name",value:`${n}/${r}`},{field:"scripts.test",value:"bun test"},{field:"scripts.lint",value:"biome lint --write ./src"},{field:`dependencies.${n}/contracts`,value:s},{field:"dependencies.@crossdelta/telemetry",value:"*"},{field:"devDependencies.bun-types",value:"latest",condition:t!=="bun"},{field:"devDependencies.@biomejs/biome",value:"latest"}].filter(({condition:c})=>c??!0).map(({field:c,value:l})=>qt(c,l,e))},Ww=({projectName:e})=>{let t=(0,Wt.basename)(e),r=(0,Wt.join)(S(e),"src","index.ts"),n=uf(t);(0,me.writeFileSync)(r,n)},Gw=({projectName:e})=>{let t=S(e),r=(0,Wt.join)(t,"tsconfig.json");(0,me.writeFileSync)(r,af());let n=(0,Wt.join)(t,"Dockerfile");(0,me.writeFileSync)(n,cf());let s=(0,Wt.join)(t,"biome.json");(0,me.writeFileSync)(s,lf())},pf={title:"Create Hono app structure",rendererOptions:{outputBar:1e3},task:async(e,t)=>q(t,async r=>{await _w(e,t),Lw(e),Ww(e),Gw(e),e.elapsedTime+=r()})};var Hw=e=>{let t=(e||"my-hono-service").trim();return t.includes("/")||t.startsWith(".")?t:`${kt().services}/${t}`},Uw=async(e,t)=>{let{valid:r,config:n,error:s}=pr();if(!r||!n){console.log(s);return}let o=Hw(e.name),i=t.packageManager||B(),a=await xs(t.description);if(vs(o,n,a),await ks({servicePath:o,description:a,serviceType:"hono",packageManager:i},n))console.log(te.default.green.bold(`
246
+ `}var Ow=4001,Mw=4e3;function $w(e){let t=[],r=e.matchAll(/ports\(\)\.(?:http|https|grpc|primary)\((\d+)\)/g);for(let c of r)t.push(Number(c[1]));let n=e.matchAll(/\.add(?:Http|Grpc)?\((\d+)/g);for(let c of n)t.push(Number(c[1]));let s=e.match(/containerPort\s*:\s*(\d+)/);s&&t.push(Number(s[1]));let o=e.match(/internalPorts\s*:\s*\[([^\]]+)\]/);if(o){let c=o[1].match(/\d+/g);c&&t.push(...c.map(Number))}let i=e.match(/httpPort\s*:\s*(\d+)/);i&&t.push(Number(i[1]));let a=e.matchAll(/const\s+\w*[pP]ort\w*\s*=\s*(\d+)/g);for(let c of a)t.push(Number(c[1]));return t}function Bw(e,t){let r=t?Ow:Mw,n=new Set;if(!(0,Lt.existsSync)(e))return r;let s=(0,Lt.readdirSync)(e).filter(i=>i.endsWith(".ts"));for(let i of s){let a=(0,Dr.join)(e,i);try{let c=(0,Lt.readFileSync)(a,"utf-8"),l=$w(c);for(let u of l)n.add(u)}catch{}}let o=r;for(;n.has(o);)o++;return o}function jw(e){return(0,Dr.basename)(e)}var Ls={title:"Creating infrastructure service config",task:async(e,t)=>{let r=jw(e.projectName),n=O(),s=(0,Dr.join)(n,"infra","services");if(!(0,Lt.existsSync)(s)){t.title="Skipping infra config (no infra/services directory found)";return}let o=(0,Dr.join)(s,`${r}.ts`);if((0,Lt.existsSync)(o)){t.title=`Service config already exists: infra/services/${r}.ts`;return}let i=Bw(s,!0);e.assignedPort=i;let a=e.serviceType==="hono"?tf(r,i):ef(r,i);(0,Lt.writeFileSync)(o,a),t.title=`Created infra/services/${r}.ts (port: ${i})`}};var bn=require("node:child_process"),rf=require("node:fs"),nf=require("node:path"),_w=()=>{try{return(0,bn.execSync)("git --version",{stdio:"ignore"}),!0}catch{return!1}},Lw=e=>(0,rf.existsSync)((0,nf.join)(e,".git")),sf={title:"Initializing git repository",enabled:()=>_w(),skip:e=>Lw(e.cwd)?"Already a git repository":!1,task:async(e,t)=>{try{(0,bn.execSync)("git init",{cwd:e.cwd,stdio:"ignore"}),(0,bn.execSync)("git add -A",{cwd:e.cwd,stdio:"ignore"}),(0,bn.execSync)('git commit -m "chore: initial commit"',{cwd:e.cwd,stdio:"ignore",env:{...process.env,GIT_AUTHOR_NAME:process.env.GIT_AUTHOR_NAME||"Platform SDK",GIT_AUTHOR_EMAIL:process.env.GIT_AUTHOR_EMAIL||"platform-sdk@localhost",GIT_COMMITTER_NAME:process.env.GIT_COMMITTER_NAME||"Platform SDK",GIT_COMMITTER_EMAIL:process.env.GIT_COMMITTER_EMAIL||"platform-sdk@localhost"}}),t.title="Git repository initialized with initial commit"}catch{t.title="Git initialization skipped (git error)"}}};var _i=b(require("chalk"));var yr={title:"Installing Bun",enabled:e=>!!e.shouldInstallBun&&!ki(),task:async(e,t)=>q(t,async r=>{await Ru(t),e.elapsedTime+=r(),t.title=`Bun installed successfully. (${e.elapsedTime}s)`})},wr={enabled:e=>!ki()&&!e.shouldInstallBun&&!e.packageManager,task:async(e,t)=>{e.shouldInstallBun=await t.prompt(R).run({type:"Toggle",message:"Would you like to use Bun? (recommended)",initial:!0,footer:["",`${_i.default.magenta.bold("Bun")} is a fast JavaScript runtime, package manager, bundler, and test runner: ${_i.default.underline("https://bun.sh")}`,Iu(),Nu()].join(`
247
+ `)}),e.shouldInstallBun&&(e.packageManager="bun")}};var Li=b(require("chalk"));var Ws={title:"Install integrations",enabled:e=>e.selectedIntegrations.length>0,task:async(e,t)=>q(t,async r=>{let{selectedIntegrations:n,cwd:s,packageManager:o}=e;await Hu({selectedIntegrations:n,packageManager:o,cwd:s,task:t}),e.elapsedTime+=r()}),rendererOptions:{outputBar:1e3}},Gs={title:"Select integrations",enabled:e=>e.selectedIntegrations.length===0,task:async(e,t)=>{e.selectedIntegrations=await t.prompt(R).run({type:"MultiSelect",hint:`
248
+ Press <space> to select/deselect, <enter> to confirm, <i> to invert selection`,message:"Which integrations would you like to include?",initial:fr().map((r,n)=>n),choices:e.availableIntegrations.map(({name:r,description:n})=>({name:r,message:[Li.default.bold(r),n].join(" - "),value:r}))}),!e.selectedIntegrations||e.selectedIntegrations.length===0?t.title="No integrations selected.":t.title=["Selected integrations:",...e.selectedIntegrations.map(r=>Li.default.bold(`\u2022 ${r}`))].join(`
249
+ `)}};var of={title:"Install Nest CLI",task:async(e,t)=>q(t,async r=>{await El({packages:["@nestjs/cli"],task:t,cwd:e.cwd}),e.elapsedTime+=r()}),rendererOptions:{outputBar:1e3}};var Hs={title:"Install dependencies",task:async(e,t)=>q(t,async r=>{await Et({cwd:e.cwd,task:t,packageManager:e.packageManager}),e.elapsedTime+=r()})};var af=b(require("chalk"));var Cr={enabled:e=>!e.removeDir&&!is(e.cwd),task:async(e,t)=>{if(e.removeDir=await t.prompt(R).run({type:"Toggle",message:af.default.bold("\u26A0\uFE0F Overwrite existing directory?"),initial:!1}),!e.removeDir)throw new Error("Project creation was canceled by the user.")}},br={enabled:e=>!!e.removeDir,task:async e=>nl(e.cwd)};var Us={title:"Run integration commands",enabled:e=>e.selectedIntegrations.length>0,task:async(e,t)=>q(t,async r=>{let{selectedIntegrations:n,cwd:s}=e;await zu({selectedIntegrations:n,cwd:s,task:t,packageManager:e.packageManager}),e.elapsedTime+=r()}),rendererOptions:{outputBar:1}};var Ww=["services/my-hono-service","services/my-nest-service","my-platform"],xr={enabled:e=>e.skipInputPrompts||e.userConfirmed?!1:e.projectName?Ww.includes(e.projectName):!0,task:async(e,t)=>{e.projectName=await t.prompt(R).run({type:"Input",initial:e.projectName,message:"Enter project name",validate:r=>r?!0:"Project name is required."}),e.cwd&&(e.cwd=S(e.projectName))}};var Wi=b(require("chalk"));var vr={title:"Select Package manager",task:async(e,t)=>{if(e.packageManager??=qo(),e.packageManager){t.title=`Using ${Wi.default.bold(e.packageManager)} as package manager.`;return}e.packageManager=await t.prompt(R).run({type:"Select",message:"Which package manager would you like to use?",initial:Vo(),choices:kl}),t.title=`Using ${Wi.default.bold(e.packageManager)} as package manager.`}};var xn=b(require("chalk")),cf={title:"GitHub repository owner",task:async(e,t)=>{if(e.githubOwner){t.title=`GitHub owner: ${xn.default.bold(e.githubOwner)}`;return}e.githubOwner=await t.prompt(R).run({type:"Input",message:"Enter GitHub organization or username",initial:"my-org",validate:r=>r?.trim()?!0:"GitHub owner is required."}),t.title=`GitHub owner: ${xn.default.bold(e.githubOwner)}`}},lf={title:"Include GitHub CI/CD",task:async(e,t)=>{if(e.includeGitHubCI!==void 0){t.title=e.includeGitHubCI?"Including GitHub CI/CD workflows":"Skipping GitHub CI/CD";return}e.includeGitHubCI=await t.prompt(R).run({type:"Toggle",message:"Include GitHub Actions workflows and CI/CD?",initial:!0,enabled:"Yes",disabled:"No"}),t.title=e.includeGitHubCI?"Including GitHub CI/CD workflows":"Skipping GitHub CI/CD"}};var uf={title:"Pulumi stack name",task:async(e,t)=>{if(e.pulumiStackBase){t.title=`Pulumi stack: ${xn.default.bold(e.pulumiStackBase)}`;return}let r=e.githubOwner||"myorg",n=e.projectName?.replace(/[^a-zA-Z0-9-]/g,"-")||"myproject",s=`${r}/${n}`;e.pulumiStackBase=await t.prompt(R).run({type:"Input",message:"Enter Pulumi stack base name (org/project)",initial:s,validate:o=>o?.trim()?o.includes("/")?!0:"Format should be org/project (e.g., myorg/myproject)":"Pulumi stack name is required."}),t.title=`Pulumi stack: ${xn.default.bold(e.pulumiStackBase)}`}};var me=require("node:fs"),Wt=require("node:path");var zs=require("node:path");var Gw=()=>{let e=ln();return mr([(0,zs.join)(__dirname,"templates","hono-microservice"),(0,zs.join)(__dirname,"..","hono-microservice","templates"),(0,zs.join)(e,"bin","templates","hono-microservice")],"Hono templates directory not found.")},Ks=(e,t={})=>Bs(Gw())(e,t);function pf(){return Ks("tsconfig.json.hbs")}function ff(e="1.2.23"){return Ks("Dockerfile.hbs",{bunVersion:e})}function df(){return Ks("biome.json.hbs")}function hf(e){return Ks("src/index.ts.hbs",{envKey:js(e)})}var Hw=async({projectName:e,packageManager:t},r)=>{let n=t==="bun"?"bun":"nodejs";try{await Yt("create-hono@latest",[e,"--pm",t,"--template",n,"--install"],{task:r})}catch(o){let i=(0,Wt.join)(S(e),"package.json");if(!(0,me.existsSync)(i))throw new Error(`Failed to scaffold: ${o instanceof Error?o.message:String(o)}`)}let s=(0,Wt.join)(S(e),"package.json");if(!(0,me.existsSync)(s))throw new Error("Failed to scaffold Hono app structure - package.json not created")},Uw=({projectName:e,packageManager:t})=>{let r=(0,Wt.basename)(e),n=cs(),s=t==="npm"?"*":"workspace:*",o=S(e),i=ol("scripts.dev",o);i&&qt("scripts.start:dev",i,e),[{field:"name",value:`${n}/${r}`},{field:"scripts.test",value:"bun test"},{field:"scripts.lint",value:"biome lint --write ./src"},{field:`dependencies.${n}/contracts`,value:s},{field:"dependencies.@crossdelta/telemetry",value:"*"},{field:"devDependencies.bun-types",value:"latest",condition:t!=="bun"},{field:"devDependencies.@biomejs/biome",value:"latest"}].filter(({condition:c})=>c??!0).map(({field:c,value:l})=>qt(c,l,e))},zw=({projectName:e})=>{let t=(0,Wt.basename)(e),r=(0,Wt.join)(S(e),"src","index.ts"),n=hf(t);(0,me.writeFileSync)(r,n)},Kw=({projectName:e})=>{let t=S(e),r=(0,Wt.join)(t,"tsconfig.json");(0,me.writeFileSync)(r,pf());let n=(0,Wt.join)(t,"Dockerfile");(0,me.writeFileSync)(n,ff());let s=(0,Wt.join)(t,"biome.json");(0,me.writeFileSync)(s,df())},mf={title:"Create Hono app structure",rendererOptions:{outputBar:1e3},task:async(e,t)=>q(t,async r=>{await Hw(e,t),Uw(e),zw(e),Kw(e),e.elapsedTime+=r()})};var Jw=e=>{let t=(e||"my-hono-service").trim();return t.includes("/")||t.startsWith(".")?t:`${kt().services}/${t}`},qw=async(e,t)=>{let{valid:r,config:n,error:s}=pr();if(!r||!n){console.log(s);return}let o=Jw(e.name),i=t.packageManager||B(),a=await Es(t.description);if(Ss(o,n,a),await Fs({servicePath:o,description:a,serviceType:"hono",packageManager:i},n))console.log(te.default.green.bold(`
250
250
  \u2705 Service generated successfully!
251
- `)),console.log(te.default.dim("Next steps:")),console.log(te.default.dim(` ${te.default.cyan("pf dev")} - Start all services`)),console.log(te.default.dim(` ${te.default.cyan(`cd ${o} && bun dev`)} - Start this service only`)),console.log();else throw new Error("Service generation failed")},df=oe({name:"hono-micro",description:"Create a new Hono microservice with the Crossdelta setup. Use --ai for AI-powered generation.",arguments:[["[name]","Name or path of the service"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["--ai","Use AI to generate service code based on a description"],["-d, --description <description>","Service description for AI generation (requires --ai)"],["--remove-dir","Remove existing directory before creating (used internally)"]],exampleUsage:'platform new hono-micro my-service --ai -d "Payment processing service"',shouldSkipWorkflow:(e,t)=>!!t.ai,onSkipWorkflow:Uw,buildContext:async(e,t)=>{let r=(e.name??"my-hono-service").trim();!r.includes("/")&&!r.startsWith(".")&&(r=`${kt().services}/${r}`);let n=S(r),s=t.packageManager??(t.yes&&B()),o=Ft(),i=t.yes?fr():[],a=t.packageManager==="bun",c=!!t.yes||!!e.name&&e.name!=="my-hono-service";return{cwd:n,projectName:r,packageManager:s,shouldInstallBun:a,availableIntegrations:o,selectedIntegrations:i,serviceType:"hono",elapsedTime:0,userConfirmed:!!t.yes,skipInputPrompts:c,removeDir:!!t.removeDir||!!t.yes}},prompts:[xr,Cr,wr,vr,Ls,gr],actions:[br,yr,pf,js,_s,Gs],onComplete:({projectName:e,packageManager:t,selectedIntegrations:r,assignedPort:n})=>{w.breakLine().log(te.default.bold.green("Hono Microservice created successfully!")),Fs(r),_u((0,ff.basename)(e),n??8080);let s=t??B();w.breakLine().log(`To start the project, run:
252
- ${te.default.bold(`cd ${e} && ${s} run dev`)}`).breakLine().log("Happy shipping with Hono! \u26A1\uFE0F").breakLine()}});var ee=b(require("chalk"));var At=require("node:fs"),pt=require("node:path");var Wi=require("node:path");var zw=()=>mr([(0,Wi.join)(__dirname,"templates","nest-microservice"),(0,Wi.join)(__dirname,"..","nest-microservice","templates")],"NestJS templates directory not found."),kr=(e,t={})=>Ms(zw())(e,t);function Us(e,t=3e3){return kr("src/main.ts.hbs",{serviceName:e,envKey:$s(e),displayName:qp(e),defaultPort:t})}function hf(){return kr("src/app.context.ts.hbs",{})}function mf(){return kr("src/events/events.module.ts.hbs",{})}function gf(e){return kr("src/events/events.service.ts.hbs",{serviceName:e})}function Df(e="24",t="1.2.23"){return kr("Dockerfile.hbs",{nodeVersion:e,bunVersion:t})}function yf(){return kr("biome.json.hbs",{})}var Kw=async(e,t)=>{await Yt("@nestjs/cli",["new",e.projectName,"--skip-install","--skip-git","--package-manager",e.packageManager],{task:t})},Jw=({projectName:e,packageManager:t})=>{let r=(0,pt.basename)(e),n=is(),s=t==="npm"?"*":"workspace:*";[{field:"name",value:`${n}/${r}`},{field:"type",value:"module"},{field:"scripts.start",value:"bun src/main.ts"},{field:"scripts.start:dev",value:"bun --hot src/main.ts"},{field:"scripts.start:prod",value:"node dist/main.js"},{field:"scripts.test",value:"bun test"},{field:"scripts.lint",value:"biome lint --write ./src"},{field:`dependencies.${n}/contracts`,value:s},{field:"dependencies.@crossdelta/telemetry",value:"*"},{field:"dependencies.@nestjs/config",value:"^4"},{field:"devDependencies.bun-types",value:"latest"},{field:"devDependencies.@biomejs/biome",value:"latest"}].map(({field:a,value:c})=>qt(a,c,e)),["jest","@types/jest","ts-jest","@nestjs/testing","supertest","@types/supertest","ts-node","tsconfig-paths","@nestjs/schematics","@nestjs/cli"].map(a=>qt(`devDependencies.${a}`,void 0,e))},qw=({projectName:e})=>{let t=["eslint.config.mjs","src/app.controller.spec.ts"];for(let r of t)try{(0,At.unlinkSync)((0,pt.join)(S(e),r))}catch{}},Vw=({projectName:e})=>{let t=S(e),r=(0,pt.join)(t,"Dockerfile");(0,At.writeFileSync)(r,Df());let n=(0,pt.join)(t,"biome.json");(0,At.writeFileSync)(n,yf())},Yw=({projectName:e})=>{let t=(0,pt.join)(S(e),"src","app.context.ts");(0,At.writeFileSync)(t,hf())},Zw=({projectName:e})=>{let t=(0,pt.basename)(e),r=(0,pt.join)(S(e),"src","events");(0,At.mkdirSync)(r,{recursive:!0}),(0,At.writeFileSync)((0,pt.join)(r,"events.module.ts"),mf()),(0,At.writeFileSync)((0,pt.join)(r,"events.service.ts"),gf(t)),zu(e)},Xw=({projectName:e})=>{let t=(0,pt.basename)(e),r=(0,pt.join)(S(e),"src","main.ts");(0,At.writeFileSync)(r,Us(t))},wf={title:"Create NestJS app structure",rendererOptions:{outputBar:1e3},task:async(e,t)=>q(t,async r=>{await Kw(e,t),Jw(e),Hu(e.projectName),qw(e),Vw(e),Yw(e),Zw(e),Xw(e),e.elapsedTime+=r()})};var Cf=require("node:fs"),zs=require("node:path");var bf={title:"Patch main.ts with PORT pattern",task:async(e,t)=>q(t,async r=>{let n=(0,zs.basename)(e.projectName),s=e.assignedPort??3e3,o=(0,zs.join)(S(e.projectName),"src","main.ts");(0,Cf.writeFileSync)(o,Us(n,s)),t.title=`Patched main.ts with PORT || ${n.toUpperCase().replace(/-/g,"_")}_PORT`,e.elapsedTime+=r()})};var Qw=e=>{let t=(e||"my-nest-service").trim();return t.includes("/")||t.startsWith(".")?t:`${kt().services}/${t}`},tC=async(e,t)=>{let{valid:r,config:n,error:s}=pr();if(!r||!n){console.log(s);return}let o=Qw(e.name),i=t.packageManager||B(),a=await xs(t.description);if(vs(o,n,a),await ks({servicePath:o,description:a,serviceType:"nest",packageManager:i},n))console.log(ee.default.green.bold(`
251
+ `)),console.log(te.default.dim("Next steps:")),console.log(te.default.dim(` ${te.default.cyan("pf dev")} - Start all services`)),console.log(te.default.dim(` ${te.default.cyan(`cd ${o} && bun dev`)} - Start this service only`)),console.log();else throw new Error("Service generation failed")},Df=oe({name:"hono-micro",description:"Create a new Hono microservice with the Crossdelta setup. Use --ai for AI-powered generation.",arguments:[["[name]","Name or path of the service"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["--ai","Use AI to generate service code based on a description"],["-d, --description <description>","Service description for AI generation (requires --ai)"],["--remove-dir","Remove existing directory before creating (used internally)"]],exampleUsage:'platform new hono-micro my-service --ai -d "Payment processing service"',shouldSkipWorkflow:(e,t)=>!!t.ai,onSkipWorkflow:qw,buildContext:async(e,t)=>{let r=(e.name??"my-hono-service").trim();!r.includes("/")&&!r.startsWith(".")&&(r=`${kt().services}/${r}`);let n=S(r),s=t.packageManager??(t.yes&&B()),o=Ft(),i=t.yes?fr():[],a=t.packageManager==="bun",c=!!t.yes||!!e.name&&e.name!=="my-hono-service";return{cwd:n,projectName:r,packageManager:s,shouldInstallBun:a,availableIntegrations:o,selectedIntegrations:i,serviceType:"hono",elapsedTime:0,userConfirmed:!!t.yes,skipInputPrompts:c,removeDir:!!t.removeDir||!!t.yes}},prompts:[xr,Cr,wr,vr,Gs,gr],actions:[br,yr,mf,Ls,Ws,Us],onComplete:({projectName:e,packageManager:t,selectedIntegrations:r,assignedPort:n})=>{w.breakLine().log(te.default.bold.green("Hono Microservice created successfully!")),Ps(r),Gu((0,gf.basename)(e),n??8080);let s=t??B();w.breakLine().log(`To start the project, run:
252
+ ${te.default.bold(`cd ${e} && ${s} run dev`)}`).breakLine().log("Happy shipping with Hono! \u26A1\uFE0F").breakLine()}});var ee=b(require("chalk"));var At=require("node:fs"),pt=require("node:path");var Hi=require("node:path");var Vw=()=>mr([(0,Hi.join)(__dirname,"templates","nest-microservice"),(0,Hi.join)(__dirname,"..","nest-microservice","templates")],"NestJS templates directory not found."),kr=(e,t={})=>Bs(Vw())(e,t);function Js(e,t=3e3){return kr("src/main.ts.hbs",{serviceName:e,envKey:js(e),displayName:Xp(e),defaultPort:t})}function yf(){return kr("src/app.context.ts.hbs",{})}function wf(){return kr("src/events/events.module.ts.hbs",{})}function Cf(e){return kr("src/events/events.service.ts.hbs",{serviceName:e})}function bf(e="24",t="1.2.23"){return kr("Dockerfile.hbs",{nodeVersion:e,bunVersion:t})}function xf(){return kr("biome.json.hbs",{})}var Yw=async(e,t)=>{await Yt("@nestjs/cli",["new",e.projectName,"--skip-install","--skip-git","--package-manager",e.packageManager],{task:t})},Zw=({projectName:e,packageManager:t})=>{let r=(0,pt.basename)(e),n=cs(),s=t==="npm"?"*":"workspace:*";[{field:"name",value:`${n}/${r}`},{field:"type",value:"module"},{field:"scripts.start",value:"bun src/main.ts"},{field:"scripts.start:dev",value:"bun --hot src/main.ts"},{field:"scripts.start:prod",value:"node dist/main.js"},{field:"scripts.test",value:"bun test"},{field:"scripts.lint",value:"biome lint --write ./src"},{field:`dependencies.${n}/contracts`,value:s},{field:"dependencies.@crossdelta/telemetry",value:"*"},{field:"dependencies.@nestjs/config",value:"^4"},{field:"devDependencies.bun-types",value:"latest"},{field:"devDependencies.@biomejs/biome",value:"latest"}].map(({field:a,value:c})=>qt(a,c,e)),["jest","@types/jest","ts-jest","@nestjs/testing","supertest","@types/supertest","ts-node","tsconfig-paths","@nestjs/schematics","@nestjs/cli"].map(a=>qt(`devDependencies.${a}`,void 0,e))},Xw=({projectName:e})=>{let t=["eslint.config.mjs","src/app.controller.spec.ts"];for(let r of t)try{(0,At.unlinkSync)((0,pt.join)(S(e),r))}catch{}},Qw=({projectName:e})=>{let t=S(e),r=(0,pt.join)(t,"Dockerfile");(0,At.writeFileSync)(r,bf());let n=(0,pt.join)(t,"biome.json");(0,At.writeFileSync)(n,xf())},tC=({projectName:e})=>{let t=(0,pt.join)(S(e),"src","app.context.ts");(0,At.writeFileSync)(t,yf())},eC=({projectName:e})=>{let t=(0,pt.basename)(e),r=(0,pt.join)(S(e),"src","events");(0,At.mkdirSync)(r,{recursive:!0}),(0,At.writeFileSync)((0,pt.join)(r,"events.module.ts"),wf()),(0,At.writeFileSync)((0,pt.join)(r,"events.service.ts"),Cf(t)),qu(e)},rC=({projectName:e})=>{let t=(0,pt.basename)(e),r=(0,pt.join)(S(e),"src","main.ts");(0,At.writeFileSync)(r,Js(t))},vf={title:"Create NestJS app structure",rendererOptions:{outputBar:1e3},task:async(e,t)=>q(t,async r=>{await Yw(e,t),Zw(e),Ku(e.projectName),Xw(e),Qw(e),tC(e),eC(e),rC(e),e.elapsedTime+=r()})};var kf=require("node:fs"),qs=require("node:path");var Ef={title:"Patch main.ts with PORT pattern",task:async(e,t)=>q(t,async r=>{let n=(0,qs.basename)(e.projectName),s=e.assignedPort??3e3,o=(0,qs.join)(S(e.projectName),"src","main.ts");(0,kf.writeFileSync)(o,Js(n,s)),t.title=`Patched main.ts with PORT || ${n.toUpperCase().replace(/-/g,"_")}_PORT`,e.elapsedTime+=r()})};var nC=e=>{let t=(e||"my-nest-service").trim();return t.includes("/")||t.startsWith(".")?t:`${kt().services}/${t}`},sC=async(e,t)=>{let{valid:r,config:n,error:s}=pr();if(!r||!n){console.log(s);return}let o=nC(e.name),i=t.packageManager||B(),a=await Es(t.description);if(Ss(o,n,a),await Fs({servicePath:o,description:a,serviceType:"nest",packageManager:i},n))console.log(ee.default.green.bold(`
253
253
  \u2705 Service generated successfully!
254
- `)),console.log(ee.default.dim("Next steps:")),console.log(ee.default.dim(` ${ee.default.cyan("pf dev")} - Start all services`)),console.log(ee.default.dim(` ${ee.default.cyan(`cd ${o} && bun run start:dev`)} - Start this service only`)),console.log();else throw new Error("Service generation failed")},xf=oe({name:"nest-micro",description:"Create a new NestJS microservice with the Crossdelta setup. Use --ai for AI-powered generation.",arguments:[["[name]","Name or path of the service"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["--ai","Use AI to generate service code based on a description"],["-d, --description <description>","Service description for AI generation (requires --ai)"],["--remove-dir","Remove existing directory before creating (used internally)"]],exampleUsage:'platform new nest-micro my-service --ai -d "User authentication service"',shouldSkipWorkflow:(e,t)=>!!t.ai,onSkipWorkflow:tC,buildContext:async(e,t)=>{let r=(e.name??"my-nest-service").trim();!r.includes("/")&&!r.startsWith(".")&&(r=`${kt().services}/${r}`);let n=S(r),s=t.packageManager??(t.yes&&B()),o=t.packageManager==="bun",i=Ft(),a=t.yes?fr():[],c=!!t.yes||!!e.name;return{cwd:n,projectName:r,shouldInstallBun:o,packageManager:s,availableIntegrations:i,selectedIntegrations:a,serviceType:"nest",elapsedTime:0,userConfirmed:!!t.yes,skipInputPrompts:c,removeDir:!!t.removeDir||!!t.yes}},prompts:[xr,Cr,wr,vr,Ls,gr],actions:[br,yr,wf,js,bf,Ws,ef,_s,Gs],onComplete:({projectName:e,packageManager:t,selectedIntegrations:r})=>{w.breakLine().log(ee.default.bold.green("NestJS Microservice created successfully!")),Fs(r),w.breakLine().log(`To start the project, run:
255
- ${ee.default.bold(`cd ${e} && ${t} run start:dev`)}`).breakLine().log("Happy coding! \u{1F389}").breakLine()}});var ft=b(require("chalk"));var Gt=require("node:fs"),xn=require("node:path");var vf=require("node:fs"),Ks=require("node:path");var Gi=()=>mr([(0,Ks.join)(__dirname,"templates","workspace"),(0,Ks.join)(__dirname,"..","..","..","..","templates","workspace")],"Workspace templates directory not found."),kf=()=>{let e=Gi(),t=(0,Ks.join)(e,"packages","contracts");if(!(0,vf.existsSync)(t))throw new Error(`Contracts templates directory not found at: ${t}`);return t},Js=(e,t)=>Mi(e,t);var eC=()=>{let e=(0,xn.join)(process.cwd(),"package.json");if(!(0,Gt.existsSync)(e))throw new Error("Root package.json not found. Please run this command from the workspace root.");let r=JSON.parse((0,Gt.readFileSync)(e,"utf-8")).name;if(!r)throw new Error('package.json must have a "name" field');return r.startsWith("@")?r:`@${r}`},Ef=()=>{let e=eC(),{relativePath:t,packagePath:r}=$();if((0,Gt.existsSync)(r))throw new Error(`${t} already exists. Remove it first if you want to regenerate.`);console.log(`Creating contracts package with scope: ${e}`);let n=kf(),s={scope:e,workspaceName:e.replace("@","").replace("/","-")};(0,Gt.mkdirSync)(r,{recursive:!0}),(0,Gt.mkdirSync)((0,xn.join)(r,"src","events"),{recursive:!0});let o=[{template:"package.json.hbs",output:"package.json"},{template:"tsconfig.json.hbs",output:"tsconfig.json"},{template:"README.md.hbs",output:"README.md"},{template:"src/index.ts",output:"src/index.ts"},{template:"src/stream-policies.ts.hbs",output:"src/stream-policies.ts"},{template:"src/events/index.ts",output:"src/events/index.ts"}];for(let i of o){let a=(0,xn.join)(n,i.template),c=(0,xn.join)(r,i.output),l=Js(a,s);(0,Gt.writeFileSync)(c,l,"utf-8")}console.log(`\u2705 Created ${e}/contracts at ${t}`),console.log(`
256
- Next steps:`),console.log("1. Run: bun install"),console.log("2. Define your first event schema in src/events/"),console.log('3. Add contracts to services: "@scope/contracts": "workspace:*"')};var Ff=require("node:child_process"),it=require("node:fs"),Er=require("node:path");var Sf=e=>{e.endsWith(".sh")&&(0,it.chmodSync)(e,493)},rC=[{template:"package.json.hbs",output:"package.json"},{template:"pnpm-workspace.yaml.hbs",output:"pnpm-workspace.yaml",forPackageManager:"pnpm"},{template:"biome.json.hbs",output:"biome.json"},{template:"turbo.json.hbs",output:"turbo.json"},{template:"bunfig.toml.hbs",output:"bunfig.toml"},{template:"gitignore.hbs",output:".gitignore"},{template:"editorconfig.hbs",output:".editorconfig"},{template:"npmrc.hbs",output:".npmrc"},{template:".vscode/settings.json",output:".vscode/settings.json",isStatic:!0},{template:".vscode/extensions.json",output:".vscode/extensions.json",isStatic:!0},{template:"infra/package.json.hbs",output:"infra/package.json"},{template:"infra/index.ts.hbs",output:"infra/index.ts"},{template:"infra/tsconfig.json.hbs",output:"infra/tsconfig.json"},{template:"infra/Pulumi.yaml.hbs",output:"infra/Pulumi.yaml"},{template:"infra/Pulumi.dev.yaml.hbs",output:"infra/Pulumi.dev.yaml"},{template:"apps/.gitkeep",output:"apps/.gitkeep",isStatic:!0},{template:"packages/.gitkeep",output:"packages/.gitkeep",isStatic:!0},{template:"docs/.gitkeep",output:"docs/.gitkeep",isStatic:!0},{template:"infra/services/.gitkeep",output:"infra/services/.gitkeep",isStatic:!0},{template:".github/copilot-instructions.md.hbs",output:".github/copilot-instructions.md"},{template:".github/README.md",output:".github/README.md",isStatic:!0,isGitHubCI:!0},{template:".github/dependabot.yml",output:".github/dependabot.yml",isStatic:!0,isGitHubCI:!0},{template:".github/workflows/lint-and-tests.yml.hbs",output:".github/workflows/lint-and-tests.yml",isGitHubCI:!0},{template:".github/workflows/build-and-deploy.yml.hbs",output:".github/workflows/build-and-deploy.yml",isGitHubCI:!0},{template:".github/workflows/publish-packages.yml",output:".github/workflows/publish-packages.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/setup-bun-install/action.yml.hbs",output:".github/actions/setup-bun-install/action.yml",isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/action.yml",output:".github/actions/check-image-tag-exists/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/index.js",output:".github/actions/check-image-tag-exists/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/action.yml",output:".github/actions/check-path-changes/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/index.js",output:".github/actions/check-path-changes/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/detect-skipped-services/action.yml",output:".github/actions/detect-skipped-services/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/action.yml",output:".github/actions/generate-scope-matrix/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/index.js",output:".github/actions/generate-scope-matrix/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/prepare-build-context/action.yml",output:".github/actions/prepare-build-context/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/action.yml",output:".github/actions/resolve-scope-tags/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/index.js",output:".github/actions/resolve-scope-tags/index.js",isStatic:!0,isGitHubCI:!0}],Tf={title:"Creating workspace structure",task:async(e,t)=>{if((0,it.existsSync)(e.cwd)){t.title="Workspace directory already exists, skipping...";return}let r=Gi(),n=e.includeGitHubCI??!0,s=e.packageManager||"bun",o=c=>{try{let p=(0,Ff.spawnSync)(c,["--version"],{encoding:"utf-8",timeout:5e3}).stdout?.trim();if(p&&/^\d+\.\d+/.test(p))return`${c}@${p}`}catch{}return{bun:"bun@1.2.7",npm:"npm@10.9.2",yarn:"yarn@4.6.0",pnpm:"pnpm@9.15.2"}[c]||`${c}@latest`},i={projectName:e.projectName,scope:`@${e.projectName}`,githubOwner:e.githubOwner||"",pulumiStackBase:e.pulumiStackBase||e.projectName,packageManager:s,packageManagerVersion:o(s)},a=rC.filter(c=>!(c.isGitHubCI&&!n||c.forPackageManager&&c.forPackageManager!==s));for(let c of a){let l=(0,Er.join)(e.cwd,c.output),u=(0,Er.dirname)(l);if((0,it.existsSync)(u)||(0,it.mkdirSync)(u,{recursive:!0}),c.isStatic){let p=(0,Er.join)(r,c.template);(0,it.existsSync)(p)?(0,it.writeFileSync)(l,(0,it.readFileSync)(p)):(0,it.writeFileSync)(l,""),Sf(l)}else{let p=(0,Er.join)(r,c.template),d=Js(p,i);(0,it.writeFileSync)(l,d),Sf(l)}}t.title="Workspace structure created"}};var Af=oe({name:"workspace",description:"Create a new workspace with infrastructure setup",arguments:[["[name]","Name or path of the workspace"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["-o, --github-owner <owner>","GitHub organization or username"],["-s, --pulumi-stack <name>","Pulumi stack base name (org/project)"],["--no-github","Skip GitHub CI/CD workflows"],["--remove-dir","Remove existing directory before creating (internal use)"]],exampleUsage:"pf new workspace my-platform -o my-org",buildContext:(e,t)=>{let r=(e.name??"my-platform").trim(),n=S(r),s=!!t.yes,o=t.packageManager??(s?B():void 0),i=t.packageManager==="bun",a=t.githubOwner??(s?"my-org":void 0),c=t.pulumiStack??(s?`${a}/${r}`:void 0),l=t.github===!1?!1:s?!0:void 0,u=!!e.name,p=t.removeDir||s;return{cwd:n,projectName:r,shouldInstallBun:i,packageManager:o,elapsedTime:0,userConfirmed:s,skipInputPrompts:u&&!s,removeDir:p,githubOwner:a,pulumiStackBase:c,includeGitHubCI:l}},prompts:[{enabled:e=>!e.userConfirmed,task:async(e,t)=>{try{let r=O();if(!await t.prompt(R).run({type:"toggle",message:`\u26A0\uFE0F You are inside an existing workspace (${r}). Create a nested workspace anyway?`,enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Workspace creation cancelled - already inside a workspace");t.title=ft.default.yellow("Warning: Creating nested workspace")}catch(r){if(r.message?.includes("cancelled"))throw r;t.title="No existing workspace detected"}}},xr,Cr,nf,sf,of,wr,vr,gr],actions:[br,yr,Tf,{title:"Initializing contracts package",task:(e,t)=>{let r=process.cwd();try{process.chdir(e.cwd),Ef(),t.title="Contracts package initialized"}catch(n){throw t.title=ft.default.red(`Contracts package failed: ${n.message}`),n}finally{process.chdir(r)}}},Ws,tf],onComplete:({projectName:e,includeGitHubCI:t})=>{w.breakLine().log(ft.default.bold.green("Workspace created successfully!")),w.breakLine().log(ft.default.bold("Next steps:")).log(` 1. ${ft.default.cyan(`cd ${e}`)}`).log(` 2. ${ft.default.cyan("bun pulumi login")}`).log(` 3. ${ft.default.cyan("bun pulumi up --stack dev")}`),t&&w.breakLine().log(ft.default.bold("GitHub Setup:")).log(" Configure these secrets in your GitHub repository:").log(` \u2022 ${ft.default.yellow("PULUMI_ACCESS_TOKEN")} - Pulumi Cloud access token`).log(` \u2022 ${ft.default.yellow("DIGITALOCEAN_TOKEN")} - DigitalOcean API token`).log(` \u2022 ${ft.default.yellow("NPM_TOKEN")} - (optional) NPM token for private packages`),w.breakLine().log(ft.default.bold("Structure created:")).log(" apps/ # Frontend applications").log(" services/ # Backend microservices").log(" packages/").log(" \u2514\u2500\u2500 contracts/ # Shared event contracts").log(" infra/").log(" \u251C\u2500\u2500 index.ts # Pulumi entry point").log(" \u251C\u2500\u2500 services/ # Service configs").log(" \u251C\u2500\u2500 Pulumi.yaml # Pulumi project config").log(" \u2514\u2500\u2500 Pulumi.dev.yaml # Dev stack config"),t&&w.log(" .github/").log(" \u251C\u2500\u2500 workflows/ # CI/CD workflows").log(" \u2514\u2500\u2500 actions/ # Custom actions"),w.breakLine().log("Happy coding! \u{1F389}").breakLine()}});var vn=[{name:"Hono Microservice",value:"hono-micro",command:df,supportsAi:!0},{name:"Nest Microservice",value:"nest-micro",command:xf,supportsAi:!0},{name:"Workspace (Infrastructure)",value:"workspace",command:Af,supportsAi:!1}],Pf=()=>{let e=oe({name:"new",description:"Create a new project",arguments:[["[type]","Type of the project (e.g., nest-micro, hono-micro, workspace)"]],exampleUsage:"platform new hono-micro test-service",buildContext:t=>({projectType:t.type??"",useAi:!1,aiDescription:"",elapsedTime:0,cwd:process.cwd()}),prompts:[{enabled:t=>!t.projectType,task:async(t,r)=>{let n=await r.prompt(R).run({type:"select",message:"Select Project type",choices:vn});t.projectType=vn.find(s=>s.name===n)?.value||"",r.title=`Using ${re.default.bold(n)}`}},{enabled:t=>t.projectType!=="workspace"&&t.projectType!=="",task:async(t,r)=>{try{O(),r.title="Workspace detected"}catch{let n=["Not in a workspace directory","",`Current directory: ${process.cwd()}`,"","This command must be run from within a workspace created with pf new workspace","","To create a new workspace, run:",""," pf new workspace my-platform"].join(`
257
- `);throw new Error(n)}}},{enabled:t=>t.projectType==="workspace",task:async(t,r)=>{try{let n=O();if(!await r.prompt(R).run({type:"toggle",message:`\u26A0\uFE0F You are inside an existing workspace (${n}). Create a nested workspace anyway?`,enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Workspace creation cancelled - already inside a workspace");r.title=re.default.yellow("Warning: Creating nested workspace")}catch(n){if(n.message?.includes("cancelled"))throw n;r.title="No existing workspace detected"}}},{enabled:t=>!!t.projectType,task:async(t,r)=>{let s={"hono-micro":"services/my-hono-service","nest-micro":"services/my-nest-service",workspace:"my-platform"}[t.projectType]||"my-project",o=t.projectType==="workspace"?"\u{1F4E6} Workspace name:":"\u{1F4E6} Service path (e.g., services/my-service):",i=await r.prompt(R).run({type:"input",message:o,initial:s});t.servicePath=i.trim(),r.title=`Path: ${re.default.dim(i)}`}},{enabled:t=>!!vn.find(n=>n.value===t.projectType)?.supportsAi&&pr().valid,task:async(t,r)=>{let n=await r.prompt(R).run({type:"toggle",message:"Use AI to generate service code?",enabled:"Yes",disabled:"No",initial:!1});t.useAi=n,r.title=n?re.default.cyan("\u{1F916} AI-powered generation"):"Standard scaffolding"}},{enabled:t=>t.useAi,task:async(t,r)=>{let n=await r.prompt(R).run({type:"input",message:"Describe what this service should do:"});t.aiDescription=n,r.title=`Description: ${re.default.dim(n.slice(0,50))}${n.length>50?"...":""}`}},{enabled:t=>{if(!t.servicePath)return!1;let r=S(t.servicePath);return!ss(r)},task:async(t,r)=>{if(!await r.prompt(R).run({type:"toggle",message:re.default.bold("\u26A0\uFE0F Overwrite existing directory?"),enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Project creation was canceled by the user.");t.shouldRemoveDir=!0,r.title=re.default.yellow("Will overwrite existing directory")}},{title:"Confirm creation",enabled:t=>t.projectType!=="workspace",task:async(t,r)=>{if(!await r.prompt(R).run({type:"Toggle",initial:!0,message:"\u{1F680} Ready to launch your project?"}))throw new Error("Project creation was canceled by the user.")}}],actions:[],onComplete:async t=>{vn.find(o=>o.value===t.projectType)||e.error(re.default.red(`Project type ${t.projectType} is not supported.`));let r=e.commands.find(o=>o.name()===t.projectType),n={};t.projectType!=="workspace"&&(n.yes=!0);let s=[];t.servicePath&&s.push("servicePath"),t.shouldRemoveDir&&(n.removeDir=!0),t.useAi&&(n.ai=!0,n.description=t.aiDescription),await Vp(r,t,n,s)}});for(let t of vn)e.addCommand(t.command);return e};var Nf=require("commander");var qs=b(require("chalk"));var Ui=e=>new Promise(t=>setTimeout(t,e)),Hi=e=>process.stdout.write(`${e}
258
- `),nC=()=>{process.stdout.write("\x1B[?1049l"),process.stdout.write("\x1B[2J"),process.stdout.write("\x1B[3J"),process.stdout.write("\x1B[H"),process.stdout.write("\x1B[?25h"),process.stdout.isTTY&&process.stdout.write("\x1Bc")},Rf=()=>({turboProcess:null,isRestarting:!1,isShuttingDown:!1}),If=async(e,t)=>{let r=hl(".env.local",t);r.length>0&&(await yl(r),await Ui(50)),Hi(qs.default.cyan("\u{1F525} Starting services...")),Hi(qs.default.dim(` Command: turbo run ${no} --continue`)),e.isShuttingDown=!1,e.isRestarting=!1,e.turboProcess=Dl("turbo",["run",no,"--continue","--no-daemon"],{cwd:t,envFile:".env.local",onExit:n=>{!e.isRestarting&&!e.isShuttingDown&&(Hi(`
259
- ${qs.default.red("Turbo exited with code")} ${n}`),process.exit(n??0))}})},zi=async(e,t=!1)=>{let r=e.turboProcess?.pid;if(r){t?e.isRestarting=!0:e.isShuttingDown=!0;try{try{process.kill(-r,"SIGTERM")}catch{e.turboProcess?.kill("SIGTERM")}await Ui(200);try{process.kill(-r,"SIGKILL")}catch{}await Ui(30)}catch{}e.turboProcess=null,nC()}};var sC=300,Of=new Nf.Command("dev").description("Start development mode with auto-reload").action(async()=>{let e=O(),t=Rf(),r=c=>rn("generate-env",{cwd:c}),n=()=>Et({cwd:e,quiet:!0}),s=async()=>{await n(),await r(e),await Ou()&&await Mu(e),await If(t,e)},o=async()=>{if(!(t.isRestarting||t.isShuttingDown)){t.isRestarting=!0;try{await zi(t,!0),await s()}catch{}finally{t.isRestarting=!1}}},i=(()=>{let c=null;return async()=>{t.isRestarting||t.isShuttingDown||(c&&clearTimeout(c),c=setTimeout(()=>o(),sC))}})(),a=async()=>{await zi(t,!1),await $u(),process.exit(0)};await s(),Hl(e,i),process.on("SIGINT",a),process.on("SIGTERM",a)});var Xf=require("commander");var Mf=require("node:fs"),$f=require("node:path"),Ht=b(require("chalk")),Bf=require("commander");var oC=e=>{if(e)try{return JSON.parse(e)}catch{return}},iC=e=>{if(!e)return;let t={},r=e.split(",").map(n=>n.trim()).filter(Boolean);for(let n of r){let[s,o]=n.split(":").map(i=>i.trim());s&&o&&(t[s]=o)}return Object.keys(t).length>0?t:void 0},aC=(e,t)=>{if(!t)return;let r=t.startsWith("/")?t:(0,$f.resolve)(e,t);return(0,Mf.existsSync)(r)?r:void 0},cC=async(e,t)=>{let r=[],n=[],s=[];if(Yo(e)&&!t.force)n.push("Contract (already exists)");else{let i=Zo(e,t.schema);r.push(`Contract: ${i}`)}ii(e)&&r.push("Export: packages/contracts/src/index.ts");let o=await gs(e);if(o&&r.push(`Mock: ${o}`),t.servicePath){let i=ei(e,t.servicePath);i?r.push(`Handler: ${i}`):n.push("Handler (already exists)");let a=ti(t.servicePath,e);a.added?r.push(`Stream: ${a.streamName} added to index.ts`):a.warning&&s.push(a.warning)}return{created:r,skipped:n,warnings:s}},lC=(e,t,r=[])=>{if(e.length>0){console.log(Ht.default.green(`\u2713 Created:
254
+ `)),console.log(ee.default.dim("Next steps:")),console.log(ee.default.dim(` ${ee.default.cyan("pf dev")} - Start all services`)),console.log(ee.default.dim(` ${ee.default.cyan(`cd ${o} && bun run start:dev`)} - Start this service only`)),console.log();else throw new Error("Service generation failed")},Sf=oe({name:"nest-micro",description:"Create a new NestJS microservice with the Crossdelta setup. Use --ai for AI-powered generation.",arguments:[["[name]","Name or path of the service"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["--ai","Use AI to generate service code based on a description"],["-d, --description <description>","Service description for AI generation (requires --ai)"],["--remove-dir","Remove existing directory before creating (used internally)"]],exampleUsage:'platform new nest-micro my-service --ai -d "User authentication service"',shouldSkipWorkflow:(e,t)=>!!t.ai,onSkipWorkflow:sC,buildContext:async(e,t)=>{let r=(e.name??"my-nest-service").trim();!r.includes("/")&&!r.startsWith(".")&&(r=`${kt().services}/${r}`);let n=S(r),s=t.packageManager??(t.yes&&B()),o=t.packageManager==="bun",i=Ft(),a=t.yes?fr():[],c=!!t.yes||!!e.name;return{cwd:n,projectName:r,shouldInstallBun:o,packageManager:s,availableIntegrations:i,selectedIntegrations:a,serviceType:"nest",elapsedTime:0,userConfirmed:!!t.yes,skipInputPrompts:c,removeDir:!!t.removeDir||!!t.yes}},prompts:[xr,Cr,wr,vr,Gs,gr],actions:[br,yr,vf,Ls,Ef,Hs,of,Ws,Us],onComplete:({projectName:e,packageManager:t,selectedIntegrations:r})=>{w.breakLine().log(ee.default.bold.green("NestJS Microservice created successfully!")),Ps(r),w.breakLine().log(`To start the project, run:
255
+ ${ee.default.bold(`cd ${e} && ${t} run start:dev`)}`).breakLine().log("Happy coding! \u{1F389}").breakLine()}});var ft=b(require("chalk"));var Gt=require("node:fs"),kn=require("node:path");var Ff=require("node:fs"),vn=require("node:path");var Ui=()=>{let e=ln();return mr([(0,vn.join)(__dirname,"templates","workspace"),(0,vn.join)(__dirname,"..","..","..","..","templates","workspace"),(0,vn.join)(e,"bin","templates","workspace")],"Workspace templates directory not found.")},Tf=()=>{let e=Ui(),t=(0,vn.join)(e,"packages","contracts");if(!(0,Ff.existsSync)(t))throw new Error(`Contracts templates directory not found at: ${t}`);return t},Vs=(e,t)=>ji(e,t);var oC=()=>{let e=(0,kn.join)(process.cwd(),"package.json");if(!(0,Gt.existsSync)(e))throw new Error("Root package.json not found. Please run this command from the workspace root.");let r=JSON.parse((0,Gt.readFileSync)(e,"utf-8")).name;if(!r)throw new Error('package.json must have a "name" field');return r.startsWith("@")?r:`@${r}`},Af=()=>{let e=oC(),{relativePath:t,packagePath:r}=$();if((0,Gt.existsSync)(r))throw new Error(`${t} already exists. Remove it first if you want to regenerate.`);console.log(`Creating contracts package with scope: ${e}`);let n=Tf(),s={scope:e,workspaceName:e.replace("@","").replace("/","-")};(0,Gt.mkdirSync)(r,{recursive:!0}),(0,Gt.mkdirSync)((0,kn.join)(r,"src","events"),{recursive:!0});let o=[{template:"package.json.hbs",output:"package.json"},{template:"tsconfig.json.hbs",output:"tsconfig.json"},{template:"README.md.hbs",output:"README.md"},{template:"src/index.ts",output:"src/index.ts"},{template:"src/stream-policies.ts.hbs",output:"src/stream-policies.ts"},{template:"src/events/index.ts",output:"src/events/index.ts"}];for(let i of o){let a=(0,kn.join)(n,i.template),c=(0,kn.join)(r,i.output),l=Vs(a,s);(0,Gt.writeFileSync)(c,l,"utf-8")}console.log(`\u2705 Created ${e}/contracts at ${t}`),console.log(`
256
+ Next steps:`),console.log("1. Run: bun install"),console.log("2. Define your first event schema in src/events/"),console.log('3. Add contracts to services: "@scope/contracts": "workspace:*"')};var Rf=require("node:child_process"),it=require("node:fs"),Er=require("node:path");var Pf=e=>{e.endsWith(".sh")&&(0,it.chmodSync)(e,493)},iC=[{template:"package.json.hbs",output:"package.json"},{template:"pnpm-workspace.yaml.hbs",output:"pnpm-workspace.yaml",forPackageManager:"pnpm"},{template:"biome.json.hbs",output:"biome.json"},{template:"turbo.json.hbs",output:"turbo.json"},{template:"bunfig.toml.hbs",output:"bunfig.toml"},{template:"gitignore.hbs",output:".gitignore"},{template:"editorconfig.hbs",output:".editorconfig"},{template:"npmrc.hbs",output:".npmrc"},{template:".vscode/settings.json",output:".vscode/settings.json",isStatic:!0},{template:".vscode/extensions.json",output:".vscode/extensions.json",isStatic:!0},{template:"infra/package.json.hbs",output:"infra/package.json"},{template:"infra/index.ts.hbs",output:"infra/index.ts"},{template:"infra/tsconfig.json.hbs",output:"infra/tsconfig.json"},{template:"infra/Pulumi.yaml.hbs",output:"infra/Pulumi.yaml"},{template:"infra/Pulumi.dev.yaml.hbs",output:"infra/Pulumi.dev.yaml"},{template:"apps/.gitkeep",output:"apps/.gitkeep",isStatic:!0},{template:"packages/.gitkeep",output:"packages/.gitkeep",isStatic:!0},{template:"docs/.gitkeep",output:"docs/.gitkeep",isStatic:!0},{template:"infra/services/.gitkeep",output:"infra/services/.gitkeep",isStatic:!0},{template:".github/copilot-instructions.md.hbs",output:".github/copilot-instructions.md"},{template:".github/README.md",output:".github/README.md",isStatic:!0,isGitHubCI:!0},{template:".github/dependabot.yml",output:".github/dependabot.yml",isStatic:!0,isGitHubCI:!0},{template:".github/workflows/lint-and-tests.yml.hbs",output:".github/workflows/lint-and-tests.yml",isGitHubCI:!0},{template:".github/workflows/build-and-deploy.yml.hbs",output:".github/workflows/build-and-deploy.yml",isGitHubCI:!0},{template:".github/workflows/publish-packages.yml",output:".github/workflows/publish-packages.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/setup-bun-install/action.yml.hbs",output:".github/actions/setup-bun-install/action.yml",isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/action.yml",output:".github/actions/check-image-tag-exists/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/index.js",output:".github/actions/check-image-tag-exists/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/action.yml",output:".github/actions/check-path-changes/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/index.js",output:".github/actions/check-path-changes/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/detect-skipped-services/action.yml",output:".github/actions/detect-skipped-services/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/action.yml",output:".github/actions/generate-scope-matrix/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/index.js",output:".github/actions/generate-scope-matrix/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/prepare-build-context/action.yml",output:".github/actions/prepare-build-context/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/action.yml",output:".github/actions/resolve-scope-tags/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/index.js",output:".github/actions/resolve-scope-tags/index.js",isStatic:!0,isGitHubCI:!0}],If={title:"Creating workspace structure",task:async(e,t)=>{if((0,it.existsSync)(e.cwd)){t.title="Workspace directory already exists, skipping...";return}let r=Ui(),n=e.includeGitHubCI??!0,s=e.packageManager||"bun",o=c=>{try{let p=(0,Rf.spawnSync)(c,["--version"],{encoding:"utf-8",timeout:5e3}).stdout?.trim();if(p&&/^\d+\.\d+/.test(p))return`${c}@${p}`}catch{}return{bun:"bun@1.2.7",npm:"npm@10.9.2",yarn:"yarn@4.6.0",pnpm:"pnpm@9.15.2"}[c]||`${c}@latest`},i={projectName:e.projectName,scope:`@${e.projectName}`,githubOwner:e.githubOwner||"",pulumiStackBase:e.pulumiStackBase||e.projectName,packageManager:s,packageManagerVersion:o(s)},a=iC.filter(c=>!(c.isGitHubCI&&!n||c.forPackageManager&&c.forPackageManager!==s));for(let c of a){let l=(0,Er.join)(e.cwd,c.output),u=(0,Er.dirname)(l);if((0,it.existsSync)(u)||(0,it.mkdirSync)(u,{recursive:!0}),c.isStatic){let p=(0,Er.join)(r,c.template);(0,it.existsSync)(p)?(0,it.writeFileSync)(l,(0,it.readFileSync)(p)):(0,it.writeFileSync)(l,""),Pf(l)}else{let p=(0,Er.join)(r,c.template),d=Vs(p,i);(0,it.writeFileSync)(l,d),Pf(l)}}t.title="Workspace structure created"}};var Nf=oe({name:"workspace",description:"Create a new workspace with infrastructure setup",arguments:[["[name]","Name or path of the workspace"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["-o, --github-owner <owner>","GitHub organization or username"],["-s, --pulumi-stack <name>","Pulumi stack base name (org/project)"],["--no-github","Skip GitHub CI/CD workflows"],["--remove-dir","Remove existing directory before creating (internal use)"]],exampleUsage:"pf new workspace my-platform -o my-org",buildContext:(e,t)=>{let r=(e.name??"my-platform").trim(),n=S(r),s=!!t.yes,o=t.packageManager??(s?B():void 0),i=t.packageManager==="bun",a=t.githubOwner??(s?"my-org":void 0),c=t.pulumiStack??(s?`${a}/${r}`:void 0),l=t.github===!1?!1:s?!0:void 0,u=!!e.name,p=t.removeDir||s;return{cwd:n,projectName:r,shouldInstallBun:i,packageManager:o,elapsedTime:0,userConfirmed:s,skipInputPrompts:u&&!s,removeDir:p,githubOwner:a,pulumiStackBase:c,includeGitHubCI:l}},prompts:[{enabled:e=>!e.userConfirmed,task:async(e,t)=>{try{let r=O();if(!await t.prompt(R).run({type:"toggle",message:`\u26A0\uFE0F You are inside an existing workspace (${r}). Create a nested workspace anyway?`,enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Workspace creation cancelled - already inside a workspace");t.title=ft.default.yellow("Warning: Creating nested workspace")}catch(r){if(r.message?.includes("cancelled"))throw r;t.title="No existing workspace detected"}}},xr,Cr,cf,lf,uf,wr,vr,gr],actions:[br,yr,If,{title:"Initializing contracts package",task:(e,t)=>{let r=process.cwd();try{process.chdir(e.cwd),Af(),t.title="Contracts package initialized"}catch(n){throw t.title=ft.default.red(`Contracts package failed: ${n.message}`),n}finally{process.chdir(r)}}},Hs,sf],onComplete:({projectName:e,includeGitHubCI:t})=>{w.breakLine().log(ft.default.bold.green("Workspace created successfully!")),w.breakLine().log(ft.default.bold("Next steps:")).log(` 1. ${ft.default.cyan(`cd ${e}`)}`).log(` 2. ${ft.default.cyan("bun pulumi login")}`).log(` 3. ${ft.default.cyan("bun pulumi up --stack dev")}`),t&&w.breakLine().log(ft.default.bold("GitHub Setup:")).log(" Configure these secrets in your GitHub repository:").log(` \u2022 ${ft.default.yellow("PULUMI_ACCESS_TOKEN")} - Pulumi Cloud access token`).log(` \u2022 ${ft.default.yellow("DIGITALOCEAN_TOKEN")} - DigitalOcean API token`).log(` \u2022 ${ft.default.yellow("NPM_TOKEN")} - (optional) NPM token for private packages`),w.breakLine().log(ft.default.bold("Structure created:")).log(" apps/ # Frontend applications").log(" services/ # Backend microservices").log(" packages/").log(" \u2514\u2500\u2500 contracts/ # Shared event contracts").log(" infra/").log(" \u251C\u2500\u2500 index.ts # Pulumi entry point").log(" \u251C\u2500\u2500 services/ # Service configs").log(" \u251C\u2500\u2500 Pulumi.yaml # Pulumi project config").log(" \u2514\u2500\u2500 Pulumi.dev.yaml # Dev stack config"),t&&w.log(" .github/").log(" \u251C\u2500\u2500 workflows/ # CI/CD workflows").log(" \u2514\u2500\u2500 actions/ # Custom actions"),w.breakLine().log("Happy coding! \u{1F389}").breakLine()}});var En=[{name:"Hono Microservice",value:"hono-micro",command:Df,supportsAi:!0},{name:"Nest Microservice",value:"nest-micro",command:Sf,supportsAi:!0},{name:"Workspace (Infrastructure)",value:"workspace",command:Nf,supportsAi:!1}],Of=()=>{let e=oe({name:"new",description:"Create a new project",arguments:[["[type]","Type of the project (e.g., nest-micro, hono-micro, workspace)"]],exampleUsage:"platform new hono-micro test-service",buildContext:t=>({projectType:t.type??"",useAi:!1,aiDescription:"",elapsedTime:0,cwd:process.cwd()}),prompts:[{enabled:t=>!t.projectType,task:async(t,r)=>{let n=await r.prompt(R).run({type:"select",message:"Select Project type",choices:En});t.projectType=En.find(s=>s.name===n)?.value||"",r.title=`Using ${re.default.bold(n)}`}},{enabled:t=>t.projectType!=="workspace"&&t.projectType!=="",task:async(t,r)=>{try{O(),r.title="Workspace detected"}catch{let n=["Not in a workspace directory","",`Current directory: ${process.cwd()}`,"","This command must be run from within a workspace created with pf new workspace","","To create a new workspace, run:",""," pf new workspace my-platform"].join(`
257
+ `);throw new Error(n)}}},{enabled:t=>t.projectType==="workspace",task:async(t,r)=>{try{let n=O();if(!await r.prompt(R).run({type:"toggle",message:`\u26A0\uFE0F You are inside an existing workspace (${n}). Create a nested workspace anyway?`,enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Workspace creation cancelled - already inside a workspace");r.title=re.default.yellow("Warning: Creating nested workspace")}catch(n){if(n.message?.includes("cancelled"))throw n;r.title="No existing workspace detected"}}},{enabled:t=>!!t.projectType,task:async(t,r)=>{let s={"hono-micro":"services/my-hono-service","nest-micro":"services/my-nest-service",workspace:"my-platform"}[t.projectType]||"my-project",o=t.projectType==="workspace"?"\u{1F4E6} Workspace name:":"\u{1F4E6} Service path (e.g., services/my-service):",i=await r.prompt(R).run({type:"input",message:o,initial:s});t.servicePath=i.trim(),r.title=`Path: ${re.default.dim(i)}`}},{enabled:t=>!!En.find(n=>n.value===t.projectType)?.supportsAi&&pr().valid,task:async(t,r)=>{let n=await r.prompt(R).run({type:"toggle",message:"Use AI to generate service code?",enabled:"Yes",disabled:"No",initial:!1});t.useAi=n,r.title=n?re.default.cyan("\u{1F916} AI-powered generation"):"Standard scaffolding"}},{enabled:t=>t.useAi,task:async(t,r)=>{let n=await r.prompt(R).run({type:"input",message:"Describe what this service should do:"});t.aiDescription=n,r.title=`Description: ${re.default.dim(n.slice(0,50))}${n.length>50?"...":""}`}},{enabled:t=>{if(!t.servicePath)return!1;let r=S(t.servicePath);return!is(r)},task:async(t,r)=>{if(!await r.prompt(R).run({type:"toggle",message:re.default.bold("\u26A0\uFE0F Overwrite existing directory?"),enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Project creation was canceled by the user.");t.shouldRemoveDir=!0,r.title=re.default.yellow("Will overwrite existing directory")}},{title:"Confirm creation",enabled:t=>t.projectType!=="workspace",task:async(t,r)=>{if(!await r.prompt(R).run({type:"Toggle",initial:!0,message:"\u{1F680} Ready to launch your project?"}))throw new Error("Project creation was canceled by the user.")}}],actions:[],onComplete:async t=>{En.find(o=>o.value===t.projectType)||e.error(re.default.red(`Project type ${t.projectType} is not supported.`));let r=e.commands.find(o=>o.name()===t.projectType),n={};t.projectType!=="workspace"&&(n.yes=!0);let s=[];t.servicePath&&s.push("servicePath"),t.shouldRemoveDir&&(n.removeDir=!0),t.useAi&&(n.ai=!0,n.description=t.aiDescription),await Qp(r,t,n,s)}});for(let t of En)e.addCommand(t.command);return e};var Bf=require("commander");var Ys=b(require("chalk"));var Ki=e=>new Promise(t=>setTimeout(t,e)),zi=e=>process.stdout.write(`${e}
258
+ `),aC=()=>{process.stdout.write("\x1B[?1049l"),process.stdout.write("\x1B[2J"),process.stdout.write("\x1B[3J"),process.stdout.write("\x1B[H"),process.stdout.write("\x1B[?25h"),process.stdout.isTTY&&process.stdout.write("\x1Bc")},Mf=()=>({turboProcess:null,isRestarting:!1,isShuttingDown:!1}),$f=async(e,t)=>{let r=gl(".env.local",t);r.length>0&&(await Cl(r),await Ki(50)),zi(Ys.default.cyan("\u{1F525} Starting services...")),zi(Ys.default.dim(` Command: turbo run ${oo} --continue`)),e.isShuttingDown=!1,e.isRestarting=!1,e.turboProcess=wl("turbo",["run",oo,"--continue","--no-daemon"],{cwd:t,envFile:".env.local",onExit:n=>{!e.isRestarting&&!e.isShuttingDown&&(zi(`
259
+ ${Ys.default.red("Turbo exited with code")} ${n}`),process.exit(n??0))}})},Ji=async(e,t=!1)=>{let r=e.turboProcess?.pid;if(r){t?e.isRestarting=!0:e.isShuttingDown=!0;try{try{process.kill(-r,"SIGTERM")}catch{e.turboProcess?.kill("SIGTERM")}await Ki(200);try{process.kill(-r,"SIGKILL")}catch{}await Ki(30)}catch{}e.turboProcess=null,aC()}};var cC=300,jf=new Bf.Command("dev").description("Start development mode with auto-reload").action(async()=>{let e=O(),t=Mf(),r=c=>rn("generate-env",{cwd:c}),n=()=>Et({cwd:e,quiet:!0}),s=async()=>{await n(),await r(e),await Bu()&&await ju(e),await $f(t,e)},o=async()=>{if(!(t.isRestarting||t.isShuttingDown)){t.isRestarting=!0;try{await Ji(t,!0),await s()}catch{}finally{t.isRestarting=!1}}},i=(()=>{let c=null;return async()=>{t.isRestarting||t.isShuttingDown||(c&&clearTimeout(c),c=setTimeout(()=>o(),cC))}})(),a=async()=>{await Ji(t,!1),await _u(),process.exit(0)};await s(),zl(e,i),process.on("SIGINT",a),process.on("SIGTERM",a)});var rd=require("commander");var _f=require("node:fs"),Lf=require("node:path"),Ht=b(require("chalk")),Wf=require("commander");var lC=e=>{if(e)try{return JSON.parse(e)}catch{return}},uC=e=>{if(!e)return;let t={},r=e.split(",").map(n=>n.trim()).filter(Boolean);for(let n of r){let[s,o]=n.split(":").map(i=>i.trim());s&&o&&(t[s]=o)}return Object.keys(t).length>0?t:void 0},pC=(e,t)=>{if(!t)return;let r=t.startsWith("/")?t:(0,Lf.resolve)(e,t);return(0,_f.existsSync)(r)?r:void 0},fC=async(e,t)=>{let r=[],n=[],s=[];if(Qo(e)&&!t.force)n.push("Contract (already exists)");else{let i=ti(e,t.schema);r.push(`Contract: ${i}`)}li(e)&&r.push("Export: packages/contracts/src/index.ts");let o=await ws(e);if(o&&r.push(`Mock: ${o}`),t.servicePath){let i=si(e,t.servicePath);i?r.push(`Handler: ${i}`):n.push("Handler (already exists)");let a=ni(t.servicePath,e);a.added?r.push(`Stream: ${a.streamName} added to index.ts`):a.warning&&s.push(a.warning)}return{created:r,skipped:n,warnings:s}},dC=(e,t,r=[])=>{if(e.length>0){console.log(Ht.default.green(`\u2713 Created:
260
260
  `));for(let n of e)console.log(Ht.default.dim(` ${n}`))}if(t.length>0){console.log(Ht.default.yellow(`
261
261
  \u2139 Skipped:
262
262
  `));for(let n of t)console.log(Ht.default.dim(` ${n}`))}if(r.length>0){console.log(Ht.default.yellow(`
263
263
  \u26A0 Warning:
264
- `));for(let n of r)console.log(Ht.default.dim(` ${n}`))}},Ki=async(e,t)=>{let r=O();if(!r){w.error("Not in a pf workspace. Run this command from your workspace root.");return}if(!e.includes(".")){w.error("Event type must include a namespace (e.g., orders.created)");return}let n=iC(t.fields)||oC(t.schema);if(t.schema&&!n&&!t.fields){w.error(`Invalid schema JSON. Example: '{"orderId":"string","total":"number"}'`);return}if(t.fields&&!n){w.error("Invalid fields format. Example: orderId:string,total:number");return}let s=aC(r,t.service);if(t.service&&!s){w.error(`Service directory not found: ${t.service}`);return}console.log(Ht.default.cyan(`
264
+ `));for(let n of r)console.log(Ht.default.dim(` ${n}`))}},qi=async(e,t)=>{let r=O();if(!r){w.error("Not in a pf workspace. Run this command from your workspace root.");return}if(!e.includes(".")){w.error("Event type must include a namespace (e.g., orders.created)");return}let n=uC(t.fields)||lC(t.schema);if(t.schema&&!n&&!t.fields){w.error(`Invalid schema JSON. Example: '{"orderId":"string","total":"number"}'`);return}if(t.fields&&!n){w.error("Invalid fields format. Example: orderId:string,total:number");return}let s=pC(r,t.service);if(t.service&&!s){w.error(`Service directory not found: ${t.service}`);return}console.log(Ht.default.cyan(`
265
265
  \u{1F4E6} Adding event: ${e}
266
- `));let{created:o,skipped:i,warnings:a}=await cC(e,{schema:n,servicePath:s,force:t.force});lC(o,i,a),console.log(),t.service||(console.log(Ht.default.yellow(`\u{1F4A1} Tip: Use --service to also create an event handler:
266
+ `));let{created:o,skipped:i,warnings:a}=await fC(e,{schema:n,servicePath:s,force:t.force});dC(o,i,a),console.log(),t.service||(console.log(Ht.default.yellow(`\u{1F4A1} Tip: Use --service to also create an event handler:
267
267
  `)),console.log(Ht.default.dim(` pf event add ${e} --service services/my-service
268
- `)))},VT=new Bf.Command("event:add").description("Add event contract, handler, and mock").argument("<event-type>","Event type (e.g., orders.created)").option("-s, --service <path>","Service path to create handler in (e.g., services/orders)").option("-f, --fields <fields>","Schema fields (e.g., orderId:string,total:number,customerId:string)").option("--schema <json>",`Schema fields as JSON (e.g., '{"orderId":"string","total":"number"}')`).option("--force","Overwrite existing files",!1).action(Ki);var Lf=require("commander");var jf=require("fs-extra"),_f=require("globby"),ge=require("zod");var uC=["**/node_modules/**","**/.nats-data/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**"],pC=ge.z.record(ge.z.string()),fC=ge.z.object({description:ge.z.string().optional(),eventName:ge.z.string(),faker:pC.optional(),data:ge.z.record(ge.z.any())}),Sr=(e=process.cwd())=>(0,_f.globbySync)("**/*.mock.json",{cwd:e,absolute:!0,gitignore:!0,ignore:uC}).map(r=>{try{let n=(0,jf.readJSONSync)(r,{encoding:"utf8"}),s=fC.safeParse(n);return s.success?{eventName:s.data.eventName,path:r,schema:s.data}:(w.warn(`\u26A0\uFE0F Invalid schema in ${r}`),console.log(s.error.format()),null)}catch{return w.warn(`\u26A0\uFE0F Failed to read or parse ${r}`),null}}).filter(r=>r!==null);var Ji=null,Wf=async()=>{if(!Ji){let{faker:e}=await import("@faker-js/faker");Ji=e}return Ji},qi=async(e,t)=>{let r=await Wf(),s=Sr().find(u=>u.eventName===e);if(!s){w.error(`Event "${e}" not found. Use "pf event list" to see available events.`);return}let o=s.schema,i=t.fake?await dC(o):o.data,c={message:{data:Buffer.from(JSON.stringify({...i,type:o.eventName})).toString("base64"),messageId:r.string.uuid(),attributes:{source:"platform-sdk"}}};if(t.print){console.dir(c,{colors:!0});return}let l=await fetch(t.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!l.ok){let u=await l.text();throw new Error(`Request failed: ${l.status} \u2013 ${u}`)}w.success("Event sent successfully.")},eA=new Lf.Command("event:http").description("Send via HTTP Pub/Sub endpoint").argument("<eventName>","The name of the event").option("--endpoint <url>","Target HTTP endpoint","http://localhost:3000").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated Pub/Sub event without sending").action(qi),dC=async e=>{let t=structuredClone(e.data);return e.faker&&await Promise.all(Object.entries(e.faker).map(async([r,n])=>{let s=await hC(n);Tn(t,r,s)})),t},hC=async e=>{let t=await Wf();switch(e){case"uuid":return t.string.uuid();case"email":return t.internet.email();case"string":return t.lorem.word();case"number":return t.number.int();case"boolean":return t.datatype.boolean();case"date":return new Date().toISOString();case"productName":return t.commerce.productName();case"productDescription":return t.commerce.productDescription();case"firstName":return t.person.firstName();case"lastName":return t.person.lastName();case"url":return t.internet.url();case"phoneNumber":return t.phone.number();case"streetAddress":return t.location.streetAddress();case"city":return t.location.city();case"state":return t.location.state();case"country":return t.location.country();case"companyName":return t.company.name();case"zipCode":return t.location.zipCode();case"password":return t.internet.password();default:return null}};var qf=require("commander");var Vi=require("node:fs"),Gf=require("node:path"),Yi=require("globby");var mC=["**/node_modules/**","**/.nats-data/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**"],gC=e=>{let t=e.split("/"),r=t.indexOf("services");return r!==-1&&r+1<t.length?t[r+1]:"unknown"},DC=(e,t)=>{try{let{eventsPath:r}=$(t),s=(0,Yi.globbySync)("**/*.ts",{cwd:r,absolute:!0}).map(i=>({file:i,content:(0,Vi.readFileSync)(i,"utf-8")})).find(({content:i})=>i.includes(`export const ${e}`));if(!s)return null;let o=s.content.match(/type:\s*['"]([^'"]+)['"]/);return o?o[1]:null}catch{return null}},yC=e=>e.replace(/Contract$/,"").replace(/([A-Z])/g,(t,r,n)=>(n>0?".":"")+r.toLowerCase()),wC=(e,t)=>{let r=e.match(/handleEvent\s*\(\s*\{\s*[^}]*type:\s*['"]([^'"]+)['"]/s);if(r)return r[1];let n=e.match(/handleEvent\s*\(\s*['"]([^'"]+)['"]/s);if(n)return n[1];let s=e.match(/import\s+(?:type\s+)?{[^}]*?(\w+Contract)[^}]*?}\s+from/);if(!s)return null;let o=s[1];return DC(o,t)||yC(o)},CC=(e,t)=>{try{let r=(0,Vi.readFileSync)(e,"utf-8"),n=wC(r,t);return n?{serviceName:gC(e),handlerPath:(0,Gf.relative)(t,e),eventType:n}:null}catch{return null}},Hf=(e=process.cwd())=>(0,Yi.globbySync)("services/**/src/events/*.handler.ts",{cwd:e,absolute:!0,gitignore:!0,ignore:mC}).map(r=>CC(r,e)).filter(r=>r!==null),Uf=e=>e.reduce((t,r)=>{let n=t.get(r.eventType)||[];return t.set(r.eventType,[...n,r]),t},new Map);var Kf=b(Oi());var zf=(e,t)=>{let r=t.get(e)||[],n=[...new Set(r.map(s=>s.serviceName))];return n.length>0?n.join(", "):"-"};var Jf=(e,t)=>{let r=new Kf.default({head:["name","description","consumers"],style:{head:["dim","bold"],compact:!0}});for(let{eventName:n,schema:s}of e)r.push([n,s.description||"-",zf(n,t)]);return r.toString()};var Zi=()=>{let e=Sr();if(e.length===0){w.error("No event schemas found.");return}let t=Hf(),r=Uf(t),n=Jf(e,r);console.log(n)},fA=new qf.Command("event:list").description("List all available event mocks").action(Zi);var Vf=require("node:path"),Yf=require("commander");var kC={},Xi=null,Qi=null,Zf=async()=>{if(!Xi){let{faker:e}=await import("@faker-js/faker");Xi=e}return Xi},bC=async()=>{if(!Qi)try{let{createJiti:e}=await import("jiti"),t=e(kC.url),r=O(),n=$(r),s=(0,Vf.join)(n.packagePath,"node_modules","@crossdelta","cloudevents");Qi=(await t.import(s)).publish}catch{throw new Error(`@crossdelta/cloudevents is required for event:publish.
269
- Install it in your contracts package with: cd packages/contracts && bun add @crossdelta/cloudevents`)}return Qi},ta=async(e,t)=>{let r=await Zf(),s=Sr().find(a=>a.eventName===e||a.path.includes(`${e}.mock.json`));if(!s){w.error(`Event "${e}" not found. Use "pf event list" to see available events.`);return}let o=s.schema,i=t.fake?await xC(o):o.data;if(t.print){console.log(`
270
- \u{1F4E6} Event Type:`,o.eventName),console.log("\u{1F4C4} Payload:"),console.dir(i,{colors:!0,depth:null});return}try{let a=await bC();if(!a)throw new Error("Failed to load publish function from cloudevents");await a(o.eventName,i,{source:"platform-sdk-cli",subject:r.string.uuid()}),w.success(`Event "${o.eventName}" published successfully to NATS JetStream.`),await new Promise(c=>setTimeout(c,100)),process.exit(0)}catch(a){w.error(`Failed to publish event: ${a instanceof Error?a.message:String(a)}`),w.info("Make sure NATS is running and NATS_URL is configured."),process.exit(1)}},DA=new Yf.Command("event:publish").description("Publish to NATS JetStream").argument("<eventName>","The name of the event (e.g., order-created)").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated event data without publishing").action(ta),xC=async e=>{let t=structuredClone(e.data);return e.faker&&await Promise.all(Object.entries(e.faker).map(async([r,n])=>{let s=await vC(n);Tn(t,r,s)})),t},vC=async e=>{let t=await Zf();switch(e.toLowerCase()){case"uuid":return t.string.uuid();case"email":return t.internet.email();case"firstname":return t.person.firstName();case"lastname":return t.person.lastName();case"name":return t.person.fullName();case"url":return t.internet.url();case"phone":return t.phone.number();case"date":return t.date.recent().toISOString();case"boolean":return t.datatype.boolean();case"number":return t.number.int({min:1,max:1e3});case"string":return t.lorem.word();case"text":return t.lorem.sentence();default:return e}};var kn=new Xf.Command("event").description("Event management commands");kn.command("add").description("Add event contract, handler, and mock").argument("<event-type>","Event type (e.g., orders.created)").option("-s, --service <path>","Service path to create handler in (e.g., services/orders)").option("--schema <fields>",`Schema fields as JSON (e.g., '{"orderId":"string","total":"number"}')`).option("--force","Overwrite existing files",!1).action(Ki);kn.command("list").description("List all available event mocks").action(Zi);kn.command("publish").description("Publish to NATS JetStream").argument("<eventName>","Event name to publish").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated event data without publishing").action(ta);kn.command("http").description("Send via HTTP Pub/Sub endpoint").argument("<eventName>","Event name to send").option("--endpoint <url>","Target HTTP endpoint","http://localhost:3000").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated Pub/Sub event without sending").action(qi);var Qf=kn;var na=b(require("chalk")),sd=require("commander");var Fr=require("node:fs"),ra=b(require("node:path")),Vs=b(require("chalk")),td=require("commander"),ed=b(require("os"));var{name:EC,publishConfig:SC}=Ot,FC=SC?.registry,TC=EC?.split("/")[0],SA=new td.Command("token:set").description(Vs.default.bold("Set a registry auth token in a .npmrc file")).argument("<token>","Authentication token (e.g. GitHub or npm token)").option("--scope <scope>","Package scope (e.g. @my-workspace)",TC).option("--registry <registry>","Registry URL",FC).option("--local","Write token to a local .npmrc in the current directory",!1).option("--force","Force overwrite existing token if already present",!1).action((e,t)=>rd(e,t.scope||"",t.registry||"",t.local,t.force)).addHelpText("after",()=>`${Vs.default.cyan(`
268
+ `)))},nA=new Wf.Command("event:add").description("Add event contract, handler, and mock").argument("<event-type>","Event type (e.g., orders.created)").option("-s, --service <path>","Service path to create handler in (e.g., services/orders)").option("-f, --fields <fields>","Schema fields (e.g., orderId:string,total:number,customerId:string)").option("--schema <json>",`Schema fields as JSON (e.g., '{"orderId":"string","total":"number"}')`).option("--force","Overwrite existing files",!1).action(qi);var Uf=require("commander");var Gf=require("fs-extra"),Hf=require("globby"),ge=require("zod");var hC=["**/node_modules/**","**/.nats-data/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**"],mC=ge.z.record(ge.z.string()),gC=ge.z.object({description:ge.z.string().optional(),eventName:ge.z.string(),faker:mC.optional(),data:ge.z.record(ge.z.any())}),Sr=(e=process.cwd())=>(0,Hf.globbySync)("**/*.mock.json",{cwd:e,absolute:!0,gitignore:!0,ignore:hC}).map(r=>{try{let n=(0,Gf.readJSONSync)(r,{encoding:"utf8"}),s=gC.safeParse(n);return s.success?{eventName:s.data.eventName,path:r,schema:s.data}:(w.warn(`\u26A0\uFE0F Invalid schema in ${r}`),console.log(s.error.format()),null)}catch{return w.warn(`\u26A0\uFE0F Failed to read or parse ${r}`),null}}).filter(r=>r!==null);var Vi=null,zf=async()=>{if(!Vi){let{faker:e}=await import("@faker-js/faker");Vi=e}return Vi},Yi=async(e,t)=>{let r=await zf(),s=Sr().find(u=>u.eventName===e);if(!s){w.error(`Event "${e}" not found. Use "pf event list" to see available events.`);return}let o=s.schema,i=t.fake?await DC(o):o.data,c={message:{data:Buffer.from(JSON.stringify({...i,type:o.eventName})).toString("base64"),messageId:r.string.uuid(),attributes:{source:"platform-sdk"}}};if(t.print){console.dir(c,{colors:!0});return}let l=await fetch(t.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!l.ok){let u=await l.text();throw new Error(`Request failed: ${l.status} \u2013 ${u}`)}w.success("Event sent successfully.")},lA=new Uf.Command("event:http").description("Send via HTTP Pub/Sub endpoint").argument("<eventName>","The name of the event").option("--endpoint <url>","Target HTTP endpoint","http://localhost:3000").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated Pub/Sub event without sending").action(Yi),DC=async e=>{let t=structuredClone(e.data);return e.faker&&await Promise.all(Object.entries(e.faker).map(async([r,n])=>{let s=await yC(n);Pn(t,r,s)})),t},yC=async e=>{let t=await zf();switch(e){case"uuid":return t.string.uuid();case"email":return t.internet.email();case"string":return t.lorem.word();case"number":return t.number.int();case"boolean":return t.datatype.boolean();case"date":return new Date().toISOString();case"productName":return t.commerce.productName();case"productDescription":return t.commerce.productDescription();case"firstName":return t.person.firstName();case"lastName":return t.person.lastName();case"url":return t.internet.url();case"phoneNumber":return t.phone.number();case"streetAddress":return t.location.streetAddress();case"city":return t.location.city();case"state":return t.location.state();case"country":return t.location.country();case"companyName":return t.company.name();case"zipCode":return t.location.zipCode();case"password":return t.internet.password();default:return null}};var Xf=require("commander");var Zi=require("node:fs"),Kf=require("node:path"),Xi=require("globby");var wC=["**/node_modules/**","**/.nats-data/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**"],CC=e=>{let t=e.split("/"),r=t.indexOf("services");return r!==-1&&r+1<t.length?t[r+1]:"unknown"},bC=(e,t)=>{try{let{eventsPath:r}=$(t),s=(0,Xi.globbySync)("**/*.ts",{cwd:r,absolute:!0}).map(i=>({file:i,content:(0,Zi.readFileSync)(i,"utf-8")})).find(({content:i})=>i.includes(`export const ${e}`));if(!s)return null;let o=s.content.match(/type:\s*['"]([^'"]+)['"]/);return o?o[1]:null}catch{return null}},xC=e=>e.replace(/Contract$/,"").replace(/([A-Z])/g,(t,r,n)=>(n>0?".":"")+r.toLowerCase()),vC=(e,t)=>{let r=e.match(/handleEvent\s*\(\s*\{\s*[^}]*type:\s*['"]([^'"]+)['"]/s);if(r)return r[1];let n=e.match(/handleEvent\s*\(\s*['"]([^'"]+)['"]/s);if(n)return n[1];let s=e.match(/import\s+(?:type\s+)?{[^}]*?(\w+Contract)[^}]*?}\s+from/);if(!s)return null;let o=s[1];return bC(o,t)||xC(o)},kC=(e,t)=>{try{let r=(0,Zi.readFileSync)(e,"utf-8"),n=vC(r,t);return n?{serviceName:CC(e),handlerPath:(0,Kf.relative)(t,e),eventType:n}:null}catch{return null}},Jf=(e=process.cwd())=>(0,Xi.globbySync)("services/**/src/events/*.handler.ts",{cwd:e,absolute:!0,gitignore:!0,ignore:wC}).map(r=>kC(r,e)).filter(r=>r!==null),qf=e=>e.reduce((t,r)=>{let n=t.get(r.eventType)||[];return t.set(r.eventType,[...n,r]),t},new Map);var Yf=b(Bi());var Vf=(e,t)=>{let r=t.get(e)||[],n=[...new Set(r.map(s=>s.serviceName))];return n.length>0?n.join(", "):"-"};var Zf=(e,t)=>{let r=new Yf.default({head:["name","description","consumers"],style:{head:["dim","bold"],compact:!0}});for(let{eventName:n,schema:s}of e)r.push([n,s.description||"-",Vf(n,t)]);return r.toString()};var Qi=()=>{let e=Sr();if(e.length===0){w.error("No event schemas found.");return}let t=Jf(),r=qf(t),n=Zf(e,r);console.log(n)},CA=new Xf.Command("event:list").description("List all available event mocks").action(Qi);var Qf=require("node:path"),td=require("commander");var TC={},ta=null,ea=null,ed=async()=>{if(!ta){let{faker:e}=await import("@faker-js/faker");ta=e}return ta},EC=async()=>{if(!ea)try{let{createJiti:e}=await import("jiti"),t=e(TC.url),r=O(),n=$(r),s=(0,Qf.join)(n.packagePath,"node_modules","@crossdelta","cloudevents");ea=(await t.import(s)).publish}catch{throw new Error(`@crossdelta/cloudevents is required for event:publish.
269
+ Install it in your contracts package with: cd packages/contracts && bun add @crossdelta/cloudevents`)}return ea},ra=async(e,t)=>{let r=await ed(),s=Sr().find(a=>a.eventName===e||a.path.includes(`${e}.mock.json`));if(!s){w.error(`Event "${e}" not found. Use "pf event list" to see available events.`);return}let o=s.schema,i=t.fake?await SC(o):o.data;if(t.print){console.log(`
270
+ \u{1F4E6} Event Type:`,o.eventName),console.log("\u{1F4C4} Payload:"),console.dir(i,{colors:!0,depth:null});return}try{let a=await EC();if(!a)throw new Error("Failed to load publish function from cloudevents");await a(o.eventName,i,{source:"platform-sdk-cli",subject:r.string.uuid()}),w.success(`Event "${o.eventName}" published successfully to NATS JetStream.`),await new Promise(c=>setTimeout(c,100)),process.exit(0)}catch(a){w.error(`Failed to publish event: ${a instanceof Error?a.message:String(a)}`),w.info("Make sure NATS is running and NATS_URL is configured."),process.exit(1)}},EA=new td.Command("event:publish").description("Publish to NATS JetStream").argument("<eventName>","The name of the event (e.g., order-created)").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated event data without publishing").action(ra),SC=async e=>{let t=structuredClone(e.data);return e.faker&&await Promise.all(Object.entries(e.faker).map(async([r,n])=>{let s=await FC(n);Pn(t,r,s)})),t},FC=async e=>{let t=await ed();switch(e.toLowerCase()){case"uuid":return t.string.uuid();case"email":return t.internet.email();case"firstname":return t.person.firstName();case"lastname":return t.person.lastName();case"name":return t.person.fullName();case"url":return t.internet.url();case"phone":return t.phone.number();case"date":return t.date.recent().toISOString();case"boolean":return t.datatype.boolean();case"number":return t.number.int({min:1,max:1e3});case"string":return t.lorem.word();case"text":return t.lorem.sentence();default:return e}};var Sn=new rd.Command("event").description("Event management commands");Sn.command("add").description("Add event contract, handler, and mock").argument("<event-type>","Event type (e.g., orders.created)").option("-s, --service <path>","Service path to create handler in (e.g., services/orders)").option("--schema <fields>",`Schema fields as JSON (e.g., '{"orderId":"string","total":"number"}')`).option("--force","Overwrite existing files",!1).action(qi);Sn.command("list").description("List all available event mocks").action(Qi);Sn.command("publish").description("Publish to NATS JetStream").argument("<eventName>","Event name to publish").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated event data without publishing").action(ra);Sn.command("http").description("Send via HTTP Pub/Sub endpoint").argument("<eventName>","Event name to send").option("--endpoint <url>","Target HTTP endpoint","http://localhost:3000").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated Pub/Sub event without sending").action(Yi);var nd=Sn;var oa=b(require("chalk")),cd=require("commander");var Fr=require("node:fs"),sa=b(require("node:path")),Zs=b(require("chalk")),sd=require("commander"),od=b(require("os"));var{name:AC,publishConfig:PC}=Ot,RC=PC?.registry,IC=AC?.split("/")[0],OA=new sd.Command("token:set").description(Zs.default.bold("Set a registry auth token in a .npmrc file")).argument("<token>","Authentication token (e.g. GitHub or npm token)").option("--scope <scope>","Package scope (e.g. @my-workspace)",IC).option("--registry <registry>","Registry URL",RC).option("--local","Write token to a local .npmrc in the current directory",!1).option("--force","Force overwrite existing token if already present",!1).action((e,t)=>id(e,t.scope||"",t.registry||"",t.local,t.force)).addHelpText("after",()=>`${Zs.default.cyan(`
271
271
  Example:`)}
272
- ${Vs.default.bold("pf token set <token> --scope @my-workspace --registry https://npm.pkg.github.com")}
273
- `),AC=e=>e?ra.default.join(process.cwd(),".npmrc"):ra.default.join(ed.default.homedir(),".npmrc"),PC=(e,t,r)=>{let n=new URL(r).host;return t?`${t}:registry=https://${n}
274
- //${n}/:_authToken=${e}`:`//${n}/:_authToken=${e}`},RC=e=>(0,Fr.existsSync)(e)?(0,Fr.readFileSync)(e,"utf8"):"",ea=(e,t)=>(0,Fr.writeFileSync)(e,t),rd=(e,t,r,n=!1,s=!1)=>{let o=AC(n),i=PC(e,t,r),a=new URL(r).host,c=RC(o),l=new RegExp(`//${a}/:_authToken=\\S+`);if(!c){ea(o,`${i}
275
- `),w.success(`Created new .npmrc and set token for ${a}`);return}if(l.test(c)){if(!s){w.warn(`Token for ${a} already exists in ${o}. Use --force to overwrite.`);return}c=c.replace(l,i),ea(o,c),w.success(`Overwrote existing token for ${a} in ${o}`);return}c+=`
272
+ ${Zs.default.bold("pf token set <token> --scope @my-workspace --registry https://npm.pkg.github.com")}
273
+ `),NC=e=>e?sa.default.join(process.cwd(),".npmrc"):sa.default.join(od.default.homedir(),".npmrc"),OC=(e,t,r)=>{let n=new URL(r).host;return t?`${t}:registry=https://${n}
274
+ //${n}/:_authToken=${e}`:`//${n}/:_authToken=${e}`},MC=e=>(0,Fr.existsSync)(e)?(0,Fr.readFileSync)(e,"utf8"):"",na=(e,t)=>(0,Fr.writeFileSync)(e,t),id=(e,t,r,n=!1,s=!1)=>{let o=NC(n),i=OC(e,t,r),a=new URL(r).host,c=MC(o),l=new RegExp(`//${a}/:_authToken=\\S+`);if(!c){na(o,`${i}
275
+ `),w.success(`Created new .npmrc and set token for ${a}`);return}if(l.test(c)){if(!s){w.warn(`Token for ${a} already exists in ${o}. Use --force to overwrite.`);return}c=c.replace(l,i),na(o,c),w.success(`Overwrote existing token for ${a} in ${o}`);return}c+=`
276
276
  ${i}
277
- `,ea(o,c),w.success(`Appended token for ${a} to ${o}`)},nd=(e,t)=>rd(e,t.scope||"",t.registry||"",t.local,t.force);var{name:IC,publishConfig:NC}=Ot,OC=NC?.registry,MC=IC?.split("/")[0],od=new sd.Command("token").description("Token management commands");od.command("set").description("Set a registry auth token in a .npmrc file").argument("<token>","Authentication token (e.g. GitHub or npm token)").option("--scope <scope>","Package scope (e.g. @my-workspace)",MC).option("--registry <registry>","Registry URL",OC).option("--local","Write token to a local .npmrc in the current directory",!1).option("--force","Force overwrite existing token if already present",!1).action(nd).addHelpText("after",()=>`${na.default.cyan(`
277
+ `,na(o,c),w.success(`Appended token for ${a} to ${o}`)},ad=(e,t)=>id(e,t.scope||"",t.registry||"",t.local,t.force);var{name:$C,publishConfig:BC}=Ot,jC=BC?.registry,_C=$C?.split("/")[0],ld=new cd.Command("token").description("Token management commands");ld.command("set").description("Set a registry auth token in a .npmrc file").argument("<token>","Authentication token (e.g. GitHub or npm token)").option("--scope <scope>","Package scope (e.g. @my-workspace)",_C).option("--registry <registry>","Registry URL",jC).option("--local","Write token to a local .npmrc in the current directory",!1).option("--force","Force overwrite existing token if already present",!1).action(ad).addHelpText("after",()=>`${oa.default.cyan(`
278
278
  Example:`)}
279
- ${na.default.bold("pf token set <token> --scope @my-workspace --registry https://npm.pkg.github.com")}
280
- `);var id=od;var Ut=require("@inquirer/prompts"),N=b(require("chalk")),cd=require("commander");var $C=[/embed/i,/whisper/i,/tts/i,/dall-e/i,/davinci/i,/babbage/i,/curie/i,/ada(?!-)/i,/moderation/i,/realtime/i,/audio/i,/transcription/i,/search/i],BC=async(e,t,r=1e4)=>{let n=new AbortController,s=setTimeout(()=>n.abort(),r);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(s)}},jC=e=>e.replace(/-(\d{8})$/," ($1)").replace(/^claude-/,"Claude ").replace(/^gpt-/,"GPT-").replace(/-/g," ").replace(/(\d)\.(\d)/g,"$1.$2").replace(/\s+/g," ").split(" ").map(t=>/^\d/.test(t)||/^\(\d+\)$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ").trim(),_C=async(e,t)=>{let r=sn(e),n=await BC(r.modelsApiUrl,{headers:r.buildHeaders(t)});if(!n.ok)throw new Error(`${r.name} API error: ${n.status}`);let s=await n.json(),o=r.parseModelsResponse(s);if(!Array.isArray(o)||o.length===0)throw new Error(`No models returned from ${r.name} API`);let i=o.filter(a=>{let c=r.modelFilters.some(u=>u.test(a.id)),l=$C.some(u=>u.test(a.id));return c&&!l}).sort((a,c)=>{let l=typeof a.created=="number"?a.created:new Date(a.created).getTime();return(typeof c.created=="number"?c.created:new Date(c.created).getTime())-l}).map(a=>({name:jC(a.id),value:a.id}));if(i.length===0)throw new Error(`No chat models found from ${r.name} API`);return i};async function ad(e,t){if(!t)throw new Error("API key is required to fetch available models");return{models:await _C(e,t),fromApi:!0}}function LC(){if(!on())return null;try{let e=fs();return console.log(N.default.dim(`Found existing configuration at ${Ee}
279
+ ${oa.default.bold("pf token set <token> --scope @my-workspace --registry https://npm.pkg.github.com")}
280
+ `);var ud=ld;var Ut=require("@inquirer/prompts"),N=b(require("chalk")),fd=require("commander");var LC=[/embed/i,/whisper/i,/tts/i,/dall-e/i,/davinci/i,/babbage/i,/curie/i,/ada(?!-)/i,/moderation/i,/realtime/i,/audio/i,/transcription/i,/search/i],WC=async(e,t,r=1e4)=>{let n=new AbortController,s=setTimeout(()=>n.abort(),r);try{return await fetch(e,{...t,signal:n.signal})}finally{clearTimeout(s)}},GC=e=>e.replace(/-(\d{8})$/," ($1)").replace(/^claude-/,"Claude ").replace(/^gpt-/,"GPT-").replace(/-/g," ").replace(/(\d)\.(\d)/g,"$1.$2").replace(/\s+/g," ").split(" ").map(t=>/^\d/.test(t)||/^\(\d+\)$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ").trim(),HC=async(e,t)=>{let r=sn(e),n=await WC(r.modelsApiUrl,{headers:r.buildHeaders(t)});if(!n.ok)throw new Error(`${r.name} API error: ${n.status}`);let s=await n.json(),o=r.parseModelsResponse(s);if(!Array.isArray(o)||o.length===0)throw new Error(`No models returned from ${r.name} API`);let i=o.filter(a=>{let c=r.modelFilters.some(u=>u.test(a.id)),l=LC.some(u=>u.test(a.id));return c&&!l}).sort((a,c)=>{let l=typeof a.created=="number"?a.created:new Date(a.created).getTime();return(typeof c.created=="number"?c.created:new Date(c.created).getTime())-l}).map(a=>({name:GC(a.id),value:a.id}));if(i.length===0)throw new Error(`No chat models found from ${r.name} API`);return i};async function pd(e,t){if(!t)throw new Error("API key is required to fetch available models");return{models:await HC(e,t),fromApi:!0}}function UC(){if(!on())return null;try{let e=hs();return console.log(N.default.dim(`Found existing configuration at ${Ee}
281
281
  `)),e}catch{return console.log(N.default.yellow(`Found corrupted configuration, starting fresh.
282
- `)),null}}async function WC(e,t){return console.log(N.default.dim(`
282
+ `)),null}}async function zC(e,t){return console.log(N.default.dim(`
283
283
  \u{1F4CB} Get your ${e} API key here:`)),console.log(N.default.cyan(` ${t}
284
- `)),(0,Ut.password)({message:`Enter your ${e} API key:`,mask:"*",validate:r=>r.trim()?r.length<10?"API key seems too short":!0:"API key cannot be empty"})}async function GC(e,t,r){let n=await(0,Ut.select)({message:"Select model:",choices:e,default:t?.provider===r?t.model:void 0});return await(0,Ut.confirm)({message:"Enter a custom model ID instead?",default:!1})?(0,Ut.input)({message:"Enter custom model ID:",default:n,validate:o=>o.trim()?!0:"Model ID cannot be empty"}):n}function ld(e){return e.length<=12?"****":`${e.slice(0,4)}...${e.slice(-4)}`}function HC(e,t){console.log(N.default.green.bold(`
284
+ `)),(0,Ut.password)({message:`Enter your ${e} API key:`,mask:"*",validate:r=>r.trim()?r.length<10?"API key seems too short":!0:"API key cannot be empty"})}async function KC(e,t,r){let n=await(0,Ut.select)({message:"Select model:",choices:e,default:t?.provider===r?t.model:void 0});return await(0,Ut.confirm)({message:"Enter a custom model ID instead?",default:!1})?(0,Ut.input)({message:"Enter custom model ID:",default:n,validate:o=>o.trim()?!0:"Model ID cannot be empty"}):n}function dd(e){return e.length<=12?"****":`${e.slice(0,4)}...${e.slice(-4)}`}function JC(e,t){console.log(N.default.green.bold(`
285
285
  \u2705 AI configuration saved successfully!
286
- `)),console.log(N.default.dim(`Configuration file: ${Ee}`)),console.log(N.default.dim("API Key: Stored securely in system keychain")),console.log(N.default.dim(`Provider: ${e.provider}`)),console.log(N.default.dim(`Model: ${e.model}`)),console.log(N.default.dim(`API Key: ${ld(t)}
286
+ `)),console.log(N.default.dim(`Configuration file: ${Ee}`)),console.log(N.default.dim("API Key: Stored securely in system keychain")),console.log(N.default.dim(`Provider: ${e.provider}`)),console.log(N.default.dim(`Model: ${e.model}`)),console.log(N.default.dim(`API Key: ${dd(t)}
287
287
  `)),console.log(N.default.cyan("You can now use AI-powered service generation:")),console.log(N.default.dim(` pf new hono-micro services/my-service --ai
288
- `))}async function UC(e){let t=await ps(e);if(t)return t;let r=sn(e);return process.env[r.defaultApiKeyEnvVar]??null}async function zC(){console.log(N.default.cyan.bold(`
288
+ `))}async function qC(e){let t=await ds(e);if(t)return t;let r=sn(e);return process.env[r.defaultApiKeyEnvVar]??null}async function VC(){console.log(N.default.cyan.bold(`
289
289
  \u{1F916} AI Configuration Setup
290
- `));let e=LC();try{let t=await(0,Ut.select)({message:"Select AI provider:",choices:$l(),default:e?.provider??Vo.provider}),r=sn(t),n,s=await UC(t);s&&(console.log(N.default.green(`
291
- \u2713 Found existing API key: ${ld(s)}`)),await(0,Ut.confirm)({message:"Use this existing API key?",default:!0})&&(n=s)),n||(n=await WC(r.name,r.apiKeyUrl)),console.log(N.default.dim(`
292
- Fetching available models...`));let o;try{o=(await ad(t,n)).models,console.log(N.default.green(`\u2713 Loaded ${o.length} models from ${r.name} API
290
+ `));let e=UC();try{let t=await(0,Ut.select)({message:"Select AI provider:",choices:jl(),default:e?.provider??Zo.provider}),r=sn(t),n,s=await qC(t);s&&(console.log(N.default.green(`
291
+ \u2713 Found existing API key: ${dd(s)}`)),await(0,Ut.confirm)({message:"Use this existing API key?",default:!0})&&(n=s)),n||(n=await zC(r.name,r.apiKeyUrl)),console.log(N.default.dim(`
292
+ Fetching available models...`));let o;try{o=(await pd(t,n)).models,console.log(N.default.green(`\u2713 Loaded ${o.length} models from ${r.name} API
293
293
  `))}catch(c){console.error(N.default.red(`
294
294
  \u274C Failed to fetch models: ${c.message}`)),console.log(N.default.yellow(`
295
295
  Please check your API key and try again.
296
- `)),process.exit(1)}let i=await GC(o,e,t),a={provider:t,model:i.trim()};_l(a),await Ll(t,n),HC(a,n)}catch(t){throw t.name==="ExitPromptError"&&(console.log(N.default.yellow(`
296
+ `)),process.exit(1)}let i=await KC(o,e,t),a={provider:t,model:i.trim()};Wl(a),await Gl(t,n),JC(a,n)}catch(t){throw t.name==="ExitPromptError"&&(console.log(N.default.yellow(`
297
297
  Setup cancelled.
298
- `)),process.exit(0)),t}}var sa=new cd.Command("setup").description("Configure platform settings").option("--ai","Configure AI provider and API key for code generation").addHelpText("after",`
298
+ `)),process.exit(0)),t}}var ia=new fd.Command("setup").description("Configure platform settings").option("--ai","Configure AI provider and API key for code generation").addHelpText("after",`
299
299
  Examples:
300
300
  # Configure AI provider (OpenAI, Anthropic)
301
301
  $ pf setup --ai
302
- `).action(async e=>{if(e.ai){await zC();return}console.log(N.default.cyan.bold(`
302
+ `).action(async e=>{if(e.ai){await VC();return}console.log(N.default.cyan.bold(`
303
303
  \u2699\uFE0F Platform Setup
304
304
  `)),console.log(`Available setup options:
305
- `),console.log(N.default.dim(" --ai Configure AI provider for code generation")),console.log(),console.log(N.default.dim("Example: pf setup --ai")),console.log()});var ud=require("node:fs"),pd=require("node:path"),Tr=b(require("chalk"));var KC=(e,t)=>t.some(r=>r.name()===e),JC=(e,t)=>t.pf?.commands?.[e]??null,qC=(e,t)=>!!t.scripts?.[e],VC=(e,t)=>t.cwd?(0,pd.join)(e,t.cwd):e,YC=(e,t)=>t.command||e,ZC=(e,t,r,n)=>{let s=VC(n,r),o=YC(e,r);if(r.cwd&&!(0,ud.existsSync)(s))return console.error(Tr.default.red(`
305
+ `),console.log(N.default.dim(" --ai Configure AI provider for code generation")),console.log(),console.log(N.default.dim("Example: pf setup --ai")),console.log()});var hd=require("node:fs"),md=require("node:path"),Tr=b(require("chalk"));var YC=(e,t)=>t.some(r=>r.name()===e),ZC=(e,t)=>t.pf?.commands?.[e]??null,XC=(e,t)=>!!t.scripts?.[e],QC=(e,t)=>t.cwd?(0,md.join)(e,t.cwd):e,tb=(e,t)=>t.command||e,eb=(e,t,r,n)=>{let s=QC(n,r),o=tb(e,r);if(r.cwd&&!(0,hd.existsSync)(s))return console.error(Tr.default.red(`
306
306
  \u2716 Directory not found: ${s}
307
- `)),!0;let i=r.cwd?Tr.default.dim(` in ${r.cwd}/`):"";return console.log(Tr.default.dim(`Running ${o}${i}`)),ls(o,t,{cwd:s}),!0},XC=(e,t,r)=>(console.log(Tr.default.dim(`Running workspace script: ${e}`)),rn(e,{args:t,cwd:r}),!0);async function QC(e,t,r){if(KC(e,r))return!1;let n;try{n=O()}catch{return!1}let s=Qe(n);if(!s)return!1;let o=JC(e,s);return o?ZC(e,t,o,n):qC(e,s)?XC(e,t,n):!1}function tb(){let e;try{e=Qe()}catch{return{configured:[],scripts:[]}}if(!e)return{configured:[],scripts:[]};let t=Object.keys(e.pf?.commands??{}),n=Object.keys(e.scripts??{}).filter(s=>!t.includes(s));return{configured:t,scripts:n}}function fd(){let{configured:e,scripts:t}=tb(),r=[...e,...t];return r.length===0?"":[`
307
+ `)),!0;let i=r.cwd?Tr.default.dim(` in ${r.cwd}/`):"";return console.log(Tr.default.dim(`Running ${o}${i}`)),ps(o,t,{cwd:s}),!0},rb=(e,t,r)=>(console.log(Tr.default.dim(`Running workspace script: ${e}`)),rn(e,{args:t,cwd:r}),!0);async function nb(e,t,r){if(YC(e,r))return!1;let n;try{n=O()}catch{return!1}let s=Qe(n);if(!s)return!1;let o=ZC(e,s);return o?eb(e,t,o,n):XC(e,s)?rb(e,t,n):!1}function sb(){let e;try{e=Qe()}catch{return{configured:[],scripts:[]}}if(!e)return{configured:[],scripts:[]};let t=Object.keys(e.pf?.commands??{}),n=Object.keys(e.scripts??{}).filter(s=>!t.includes(s));return{configured:t,scripts:n}}function gd(){let{configured:e,scripts:t}=sb(),r=[...e,...t];return r.length===0?"":[`
308
308
  Workspace Commands:`,...r.map(n=>Tr.default.cyan(` ${n}`))].join(`
309
- `)}function dd(e,t,r){let n=t.slice(2);if(n.length>0&&!n[0].startsWith("-")){let s=n[0],o=n.slice(1);QC(s,o,r).then(i=>{i||e.parse(t)})}else e.parse(t)}process.on("SIGINT",()=>{process.exit(0)});process.on("unhandledRejection",e=>{throw(e.name==="ExitPromptError"||e.message?.includes("ERR_USE_AFTER_CLOSE")||e.message?.includes("Cancelled prompt"))&&process.exit(0),e});process.on("uncaughtException",e=>{(e.name==="ExitPromptError"||e.message?.includes("ERR_USE_AFTER_CLOSE")||e.message?.includes("Cancelled prompt"))&&process.exit(0),(e.message?.includes("Not in a workspace directory")||e.message?.includes("Could not locate workspace root"))&&(console.error(e.message),process.exit(1)),console.error(Te.default.red(`
310
- \u2716 An unexpected error occurred:`)),console.error(e),process.exit(1)});var Ys=new Cd.Command,hd=Object.keys(Ot.bin||{}),[bd="pf",oa]=hd.length>0?hd:["pf"],{description:md,version:eb,repository:gd,homepage:rb}=Ot,Dd=md?.split(/ —|,|\./)[0]||md||"Platform CLI",xd=gd?.url?`https://${gd.url.replace(/^(git\+|git@)/,"").replace(/\.git$/,"").replace(":","/")}`:null,yd=xd||rb,nb=xd?"GitHub":"README",sb=yd?[Te.default.bold(Dd),`
309
+ `)}function Dd(e,t,r){let n=t.slice(2);if(n.length>0&&!n[0].startsWith("-")){let s=n[0],o=n.slice(1);nb(s,o,r).then(i=>{i||e.parse(t)})}else e.parse(t)}process.on("SIGINT",()=>{process.exit(0)});process.on("unhandledRejection",e=>{throw(e.name==="ExitPromptError"||e.message?.includes("ERR_USE_AFTER_CLOSE")||e.message?.includes("Cancelled prompt"))&&process.exit(0),e});process.on("uncaughtException",e=>{(e.name==="ExitPromptError"||e.message?.includes("ERR_USE_AFTER_CLOSE")||e.message?.includes("Cancelled prompt"))&&process.exit(0),(e.message?.includes("Not in a workspace directory")||e.message?.includes("Could not locate workspace root"))&&(console.error(e.message),process.exit(1)),console.error(Te.default.red(`
310
+ \u2716 An unexpected error occurred:`)),console.error(e),process.exit(1)});var Xs=new kd.Command,yd=Object.keys(Ot.bin||{}),[Ed="pf",aa]=yd.length>0?yd:["pf"],{description:wd,version:ob,repository:Cd,homepage:ib}=Ot,bd=wd?.split(/ —|,|\./)[0]||wd||"Platform CLI",Sd=Cd?.url?`https://${Cd.url.replace(/^(git\+|git@)/,"").replace(/\.git$/,"").replace(":","/")}`:null,xd=Sd||ib,ab=Sd?"GitHub":"README",cb=xd?[Te.default.bold(bd),`
311
311
 
312
- `,Te.default.cyan("See more at: "),Te.default.bold(zt(nb,yd))].join(""):Te.default.bold(Dd),vd=[sa,Pf(),Of,Qf,id,Al];Ys.name(bd).description(sb).version(eb||"0.0.1").helpCommand(!1).configureHelp({subcommandTerm:e=>Te.default.cyan(e.name())}).addHelpText("after",fd);oa&&oa!==bd&&Ys.alias(oa);vd.forEach(e=>{Ys.addCommand(e)});dd(Ys,wd.argv,vd);
312
+ `,Te.default.cyan("See more at: "),Te.default.bold(zt(ab,xd))].join(""):Te.default.bold(bd),Fd=[ia,Of(),jf,nd,ud,Rl];Xs.name(Ed).description(cb).version(ob||"0.0.1").helpCommand(!1).configureHelp({subcommandTerm:e=>Te.default.cyan(e.name())}).addHelpText("after",gd);aa&&aa!==Ed&&Xs.alias(aa);Fd.forEach(e=>{Xs.addCommand(e)});Dd(Xs,vd.argv,Fd);