@turbo/gen 2.10.6 → 2.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3 -3
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -119,7 +119,7 @@ ${e.format(t)}
|
|
|
119
119
|
`;function n(e,i){var a=[],s=``;typeof i==`string`?i={section:i,whitespace:!1}:(i||={},i.whitespace=i.whitespace===!0);var c=i.whitespace?` = `:`=`;return Object.keys(e).forEach(function(n,r,i){var l=e[n];l&&Array.isArray(l)?l.forEach(function(e){s+=o(n+`[]`)+c+o(e)+`
|
|
120
120
|
`}):l&&typeof l==`object`?a.push(n):s+=o(n)+c+o(l)+t}),i.section&&s.length&&(s=`[`+o(i.section)+`]`+t+s),a.forEach(function(a,o,c){var l=r(a).join(`\\.`),u=(i.section?i.section+`.`:``)+l,d=n(e[a],{section:u,whitespace:i.whitespace});s.length&&d.length&&(s+=t),s+=d}),s}function r(e){return e.replace(/\1/g,`LITERAL\\1LITERAL`).replace(/\\\./g,``).split(/\./).map(function(e){return e.replace(/\1/g,`\\.`).replace(/\2LITERAL\\1LITERAL\2/g,``)})}function i(e){var t={},n=t,i=null,a=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g);return o.forEach(function(e,r,o){if(!(!e||e.match(/^\s*[;#]/))){var c=e.match(a);if(c){if(c[1]!==void 0){if(i=s(c[1]),i===`__proto__`){n={};return}n=t[i]=t[i]||{};return}var l=s(c[2]);if(l!==`__proto__`){var u=c[3]?s(c[4]):!0;switch(u){case`true`:case`false`:case`null`:u=JSON.parse(u)}if(l.length>2&&l.slice(-2)===`[]`){if(l=l.substring(0,l.length-2),l===`__proto__`)return;n[l]?Array.isArray(n[l])||(n[l]=[n[l]]):n[l]=[]}Array.isArray(n[l])?n[l].push(u):n[l]=u}}}}),Object.keys(t).filter(function(e,n,i){if(!t[e]||typeof t[e]!=`object`||Array.isArray(t[e]))return!1;var a=r(e),o=t,s=a.pop(),c=s.replace(/\\\./g,`.`);return a.forEach(function(e,t,n){e!==`__proto__`&&((!o[e]||typeof o[e]!=`object`)&&(o[e]={}),o=o[e])}),o===t&&c===s?!1:(o[c]=t[e],!0)}).forEach(function(e,n,r){delete t[e]}),t}function a(e){return e.charAt(0)===`"`&&e.slice(-1)===`"`||e.charAt(0)===`'`&&e.slice(-1)===`'`}function o(e){return typeof e!=`string`||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&a(e)||e!==e.trim()?JSON.stringify(e):e.replace(/;/g,`\\;`).replace(/#/g,`\\#`)}function s(e,t){if(e=(e||``).trim(),a(e)){e.charAt(0)===`'`&&(e=e.substr(1,e.length-2));try{e=JSON.parse(e)}catch{}}else{for(var n=!1,r=``,i=0,o=e.length;i<o;i++){var s=e.charAt(i);if(n)`\\;#`.indexOf(s)===-1?r+=`\\`+s:r+=s,n=!1;else if(`;#`.indexOf(s)!==-1)break;else s===`\\`?n=!0:r+=s}return n&&(r+=`\\`),r.trim()}return e}}),Sh=e.__commonJSMin((exports,t)=>{var n=1,r=2;function i(){return``}function a(e,t,n){return e.slice(t,n).replace(/\S/g,` `)}t.exports=function(e,t){t||={};for(var o,s,c=!1,l=!1,u=0,d=``,f=t.whitespace===!1?i:a,p=0;p<e.length;p++){if(o=e[p],s=e[p+1],!l&&o===`"`){var m=e[p-1]===`\\`&&e[p-2]!==`\\`;m||(c=!c)}if(!c){if(!l&&o+s===`//`)d+=e.slice(u,p),u=p,l=n,p++;else if(l===n&&o+s===`\r
|
|
121
121
|
`){p++,l=!1,d+=f(e,u,p),u=p;continue}else if(l===n&&o===`
|
|
122
|
-
`)l=!1,d+=f(e,u,p),u=p;else if(!l&&o+s===`/*`){d+=e.slice(u,p),u=p,l=r,p++;continue}else if(l===r&&o+s===`*/`){p++,l=!1,d+=f(e,u,p+1),u=p+1;continue}}}return d+(l?f(e.substr(u)):e.substr(u))}}),Ch=e.__commonJSMin(exports=>{var t=require(`fs`),n=xh(),r=require(`path`),i=Sh(),a=exports.parse=function(e){return/^\s*{/.test(e)?JSON.parse(i(e)):n.parse(e)},o=exports.file=function(){var e=[].slice.call(arguments).filter(function(e){return e!=null});for(var n in e)if(typeof e[n]!=`string`)return;var i=r.join.apply(null,e),a;try{return t.readFileSync(i,`utf-8`)}catch{return}},s=exports.json=function(){var e=o.apply(null,arguments);return e?a(e):null},c=exports.env=function(e,t){t||=process.env;var n={},r=e.length;for(var i in t)if(i.toLowerCase().indexOf(e.toLowerCase())===0){for(var a=i.substring(r).split(`__`),o;(o=a.indexOf(``))>-1;)a.splice(o,1);var s=n;a.forEach(function(e,n){!e||typeof s!=`object`||(n===a.length-1&&(s[e]=t[i]),s[e]===void 0&&(s[e]={}),s=s[e])})}return n},l=exports.find=function(){var e=r.join.apply(null,[].slice.call(arguments));function n(e,i){var a=r.join(e,i);try{return t.statSync(a),a}catch{if(r.dirname(e)!==e)return n(r.dirname(e),i)}}return n(process.cwd(),e)}}),wh=e.__commonJSMin((exports,t)=>{function n(e){return e instanceof Buffer||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof Buffer){var t=Buffer.alloc?Buffer.alloc(e.length):new Buffer(e.length);return e.copy(t),t}else if(e instanceof Date)return new Date(e.getTime());else if(e instanceof RegExp)return new RegExp(e);else throw Error(`Unexpected situation`)}function i(e){var t=[];return e.forEach(function(e,a){typeof e==`object`&&e?Array.isArray(e)?t[a]=i(e):n(e)?t[a]=r(e):t[a]=o({},e):t[a]=e}),t}function a(e,t){return t===`__proto__`?void 0:e[t]}var o=t.exports=function(){if(arguments.length<1||typeof arguments[0]!=`object`)return!1;if(arguments.length<2)return arguments[0];var e=arguments[0],t=Array.prototype.slice.call(arguments,1),s,c,l;return t.forEach(function(t){typeof t!=`object`||!t||Array.isArray(t)||Object.keys(t).forEach(function(l){if(c=a(e,l),s=a(t,l),s!==e)if(typeof s!=`object`||!s){e[l]=s;return}else if(Array.isArray(s)){e[l]=i(s);return}else if(n(s)){e[l]=r(s);return}else if(typeof c!=`object`||!c||Array.isArray(c)){e[l]=o({},s);return}else{e[l]=o(c,s);return}})}),e}}),Th=e.__commonJSMin((exports,t)=>{function n(e,t){var n=e;t.slice(0,-1).forEach(function(e){n=n[e]||{}});var r=t[t.length-1];return r in n}function r(e){return typeof e==`number`||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function i(e,t){return t===`constructor`&&typeof e[t]==`function`||t===`__proto__`}t.exports=function(e,t){t||={};var a={bools:{},strings:{},unknownFn:null};typeof t.unknown==`function`&&(a.unknownFn=t.unknown),typeof t.boolean==`boolean`&&t.boolean?a.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(e){a.bools[e]=!0});var o={};function s(e){return o[e].some(function(e){return a.bools[e]})}Object.keys(t.alias||{}).forEach(function(e){o[e]=[].concat(t.alias[e]),o[e].forEach(function(t){o[t]=[e].concat(o[e].filter(function(e){return t!==e}))})}),[].concat(t.string).filter(Boolean).forEach(function(e){a.strings[e]=!0,o[e]&&[].concat(o[e]).forEach(function(e){a.strings[e]=!0})});var c=t.default||{},l={_:[]};function u(e,t){return a.allBools&&/^--[^=]+$/.test(t)||a.strings[e]||a.bools[e]||o[e]}function d(e,t,n){for(var r=e,o=0;o<t.length-1;o++){var s=t[o];if(i(r,s))return;r[s]===void 0&&(r[s]={}),(r[s]===Object.prototype||r[s]===Number.prototype||r[s]===String.prototype)&&(r[s]={}),r[s]===Array.prototype&&(r[s]=[]),r=r[s]}var c=t[t.length-1];i(r,c)||((r===Object.prototype||r===Number.prototype||r===String.prototype)&&(r={}),r===Array.prototype&&(r=[]),r[c]===void 0||a.bools[c]||typeof r[c]==`boolean`?r[c]=n:Array.isArray(r[c])?r[c].push(n):r[c]=[r[c],n])}function f(e,t,n){if(!(n&&a.unknownFn&&!u(e,n)&&a.unknownFn(n)===!1)){var i=!a.strings[e]&&r(t)?Number(t):t;d(l,e.split(`.`),i),(o[e]||[]).forEach(function(e){d(l,e.split(`.`),i)})}}Object.keys(a.bools).forEach(function(e){f(e,c[e]===void 0?!1:c[e])});var p=[];e.indexOf(`--`)!==-1&&(p=e.slice(e.indexOf(`--`)+1),e=e.slice(0,e.indexOf(`--`)));for(var m=0;m<e.length;m++){var h=e[m],g,_;if(/^--.+=/.test(h)){var v=h.match(/^--([^=]+)=([\s\S]*)$/);g=v[1];var y=v[2];a.bools[g]&&(y=y!==`false`),f(g,y,h)}else if(/^--no-.+/.test(h))g=h.match(/^--no-(.+)/)[1],f(g,!1,h);else if(/^--.+/.test(h))g=h.match(/^--(.+)/)[1],_=e[m+1],_!==void 0&&!/^(-|--)[^-]/.test(_)&&!a.bools[g]&&!a.allBools&&(!o[g]||!s(g))?(f(g,_,h),m+=1):/^(true|false)$/.test(_)?(f(g,_===`true`,h),m+=1):f(g,a.strings[g]?``:!0,h);else if(/^-[^-]+/.test(h)){for(var b=h.slice(1,-1).split(``),x=!1,S=0;S<b.length;S++){if(_=h.slice(S+2),_===`-`){f(b[S],_,h);continue}if(/[A-Za-z]/.test(b[S])&&_[0]===`=`){f(b[S],_.slice(1),h),x=!0;break}if(/[A-Za-z]/.test(b[S])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(_)){f(b[S],_,h),x=!0;break}if(b[S+1]&&b[S+1].match(/\W/)){f(b[S],h.slice(S+2),h),x=!0;break}else f(b[S],a.strings[b[S]]?``:!0,h)}g=h.slice(-1)[0],!x&&g!==`-`&&(e[m+1]&&!/^(-|--)[^-]/.test(e[m+1])&&!a.bools[g]&&(!o[g]||!s(g))?(f(g,e[m+1],h),m+=1):e[m+1]&&/^(true|false)$/.test(e[m+1])?(f(g,e[m+1]===`true`,h),m+=1):f(g,a.strings[g]?``:!0,h))}else if((!a.unknownFn||a.unknownFn(h)!==!1)&&l._.push(a.strings._||!r(h)?h:Number(h)),t.stopEarly){l._.push.apply(l._,e.slice(m+1));break}}return Object.keys(c).forEach(function(e){n(l,e.split(`.`))||(d(l,e.split(`.`),c[e]),(o[e]||[]).forEach(function(t){d(l,t.split(`.`),c[e])}))}),t[`--`]?l[`--`]=p.slice():p.forEach(function(e){l._.push(e)}),l}}),Eh=e.__commonJSMin((exports,t)=>{var n=Ch(),r=require(`path`).join,i=wh(),a=`/etc`,o=process.platform===`win32`,s=o?process.env.USERPROFILE:process.env.HOME;t.exports=function(e,t,c,l){if(typeof e!=`string`)throw Error(`rc(name): name *must* be string`);c||=Th()(process.argv.slice(2)),t=(typeof t==`string`?n.json(t):t)||{},l||=n.parse;var u=n.env(e+`_`),d=[t],f=[];function p(e){if(!(f.indexOf(e)>=0)){var t=n.file(e);t&&(d.push(l(t)),f.push(e))}}return o||[r(a,e,`config`),r(a,e+`rc`)].forEach(p),s&&[r(s,`.config`,e,`config`),r(s,`.config`,e),r(s,`.`+e,`config`),r(s,`.`+e+`rc`)].forEach(p),p(n.find(`.`+e+`rc`)),u.config&&p(u.config),c.config&&p(c.config),i.apply(null,d.concat([u,c,f.length?{configs:f,config:f[f.length-1]}:void 0]))}}),Dh=e.__commonJSMin((exports,t)=>{t.exports=function(e){var t=Eh()(`npm`,{registry:`https://registry.npmjs.org/`}),n=t[e+`:registry`]||t.registry;return n.slice(-1)===`/`?n:n+`/`}}),Oh=e.__commonJSMin((exports,t)=>{var n=require(`buffer`),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,exports),exports.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}}),kh=e.__commonJSMin((exports,t)=>{let n=Oh().Buffer;function r(e){return n.from(e,`base64`).toString(`utf8`)}function i(e){return n.from(e,`utf8`).toString(`base64`)}t.exports={decodeBase64:r,encodeBase64:i}}),Ah=e.__commonJSMin((exports,t)=>{var n=require(`url`),r=kh(),i=r.decodeBase64,a=r.encodeBase64,o=`:_authToken`,s=`:username`,c=`:_password`;t.exports=function(){var e,t;return arguments.length>=2?(e=arguments[0],t=arguments[1]):typeof arguments[0]==`string`?e=arguments[0]:t=arguments[0],t||={},t.npmrc=t.npmrc||Eh()(`npm`,{registry:`https://registry.npmjs.org/`}),e||=t.npmrc.registry,l(e,t)||u(t.npmrc)};function l(e,t){for(var r=n.parse(e,!1,!0),i;i!==`/`&&r.pathname!==i;){i=r.pathname||`/`;var a=`//`+r.host+i.replace(/\/$/,``),o=f(a,t.npmrc);if(o)return o;if(!t.recursive)return/\/$/.test(e)?void 0:l(n.resolve(e,`.`),t);r.pathname=n.resolve(d(i),`..`)||`/`}}function u(e){if(e._auth)return{token:e._auth,type:`Basic`}}function d(e){return e[e.length-1]===`/`?e:e+`/`}function f(e,t){var n=p(t[e+o]||t[e+`/`+o]);if(n)return n;var r=t[e+s]||t[e+`/`+s],i=t[e+c]||t[e+`/`+c],a=m(r,i);if(a)return a}function p(e){if(e){var t=e.replace(/^\$\{?([^}]*)\}?$/,function(e,t){return process.env[t]});return{token:t,type:`Bearer`}}}function m(e,t){if(!(!e||!t)){var n=i(t.replace(/^\$\{?([^}]*)\}?$/,function(e,t){return process.env[t]})),r=a(e+`:`+n);return{token:r,type:`Basic`,password:n,username:e}}}}),jh=e.__commonJSMin((exports,t)=>{let{URL:n}=require(`url`),{join:r}=require(`path`),i=require(`fs`),{promisify:a}=require(`util`),{tmpdir:o}=require(`os`),s=Dh(),c=a(i.writeFile),l=a(i.mkdir),u=a(i.readFile),d=(e,t)=>e.localeCompare(t,`en-US`,{numeric:!0}),f=e=>encodeURIComponent(e).replace(/^%40/,`@`),p=async(e,t)=>{let n=o(),a=r(n,`update-check`);i.existsSync(a)||await l(a);let s=`${e.name}-${t}.json`;return e.scope&&(s=`${e.scope}-${s}`),r(a,s)},m=async(e,t,n)=>{if(i.existsSync(e)){let r=await u(e,`utf8`),{lastUpdate:i,latest:a}=JSON.parse(r),o=i+n;if(o>t)return{shouldCheck:!1,latest:a}}return{shouldCheck:!0,latest:null}},h=async(e,t,n)=>{let r=JSON.stringify({latest:t,lastUpdate:n});await c(e,r,`utf8`)},g=(e,t)=>new Promise((n,r)=>{let i={host:e.hostname,path:e.pathname,port:e.port,headers:{accept:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`},timeout:2e3};t&&(i.headers.authorization=`${t.type} ${t.token}`);let{get:a}=e.protocol===`https:`?require(`https`):require(`http`);a(i,e=>{let{statusCode:t}=e;if(t!==200){let n=Error(`Request failed with code ${t}`);n.code=t,r(n),e.resume();return}let i=``;e.setEncoding(`utf8`),e.on(`data`,e=>{i+=e}),e.on(`end`,()=>{try{let e=JSON.parse(i);n(e)}catch(e){r(e)}})}).on(`error`,r).on(`timeout`,r)}),_=async({full:e,scope:t},r)=>{let i=s(t),a=new n(e,i),o=null;try{o=await g(a)}catch(e){if(e.code&&String(e.code).startsWith(4)){let e=Ah(),t=e(i,{recursive:!0});o=await g(a,t)}else throw e}let c=o[`dist-tags`][r];if(!c)throw Error(`Distribution tag ${r} is not available`);return c},v={interval:36e5,distTag:`latest`},y=e=>{let t={full:f(e)};if(e.includes(`/`)){let n=e.split(`/`);t.scope=n[0],t.name=n[1]}else t.scope=null,t.name=e;return t};t.exports=async(e,t)=>{if(typeof e!=`object`)throw Error(`The first parameter should be your package.json file content`);let n=y(e.name),r=Date.now(),{distTag:i,interval:a}=Object.assign({},v,t),o=await p(n,i),s=null,c=!0;({shouldCheck:c,latest:s}=await m(o,r,a)),c&&(s=await _(n,i),await h(o,s,r));let l=d(e.version,s);return l===-1?{latest:s,fromCache:!c}:null}}),Mh=e.__toESM(M()),Nh=e.__toESM(jh());function Ph(e){let{packageInfo:t,upgradeCommand:n}=e,r=(0,Nh.default)(t).catch(()=>null);return async function(e=0){try{let i=await r;if(i?.latest){Ji(),Ji(Mh.default.yellow(Mh.default.bold(`A new version of \`${t.name}\` is available!`)));let e=typeof n==`function`?await n():n;e&&Ji(`You can update by running: ${Mh.default.cyan(e)}`),Ji()}process.exit(e)}catch(t){process.env.DEBUG&&Xi(`Update check failed:`,t),process.exit(e)}}}const Fh=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,Ih=typeof AbortController==`function`,Lh=Ih?AbortController:class{constructor(){this.signal=new Bh}abort(e=Error(`This operation was aborted`)){this.signal.reason=this.signal.reason||e,this.signal.aborted=!0,this.signal.dispatchEvent({type:`abort`,target:this.signal})}},Rh=typeof AbortSignal==`function`,zh=typeof Lh.AbortSignal==`function`,Bh=Rh?AbortSignal:zh?Lh.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(e){e.type===`abort`&&(this.aborted=!0,this.onabort(e),this._listeners.forEach(t=>t(e),this))}onabort(){}addEventListener(e,t){e===`abort`&&this._listeners.push(t)}removeEventListener(e,t){e===`abort`&&(this._listeners=this._listeners.filter(e=>e!==t))}},Vh=new Set,Hh=(e,t)=>{let n=`LRU_CACHE_OPTION_${e}`;Kh(n)&&qh(n,`${e} option`,`options.${t}`,Qh)},Uh=(e,t)=>{let n=`LRU_CACHE_METHOD_${e}`;if(Kh(n)){let{prototype:r}=Qh,{get:i}=Object.getOwnPropertyDescriptor(r,e);qh(n,`${e} method`,`cache.${t}()`,i)}},Wh=(e,t)=>{let n=`LRU_CACHE_PROPERTY_${e}`;if(Kh(n)){let{prototype:r}=Qh,{get:i}=Object.getOwnPropertyDescriptor(r,e);qh(n,`${e} property`,`cache.${t}`,i)}},Gh=(...e)=>{typeof process==`object`&&process&&typeof process.emitWarning==`function`?process.emitWarning(...e):console.error(...e)},Kh=e=>!Vh.has(e),qh=(e,t,n,r)=>{Vh.add(e);let i=`The ${t} is deprecated. Please use ${n} instead.`;Gh(i,`DeprecationWarning`,e,r)},Jh=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Yh=e=>Jh(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Xh:null:null;var Xh=class extends Array{constructor(e){super(e),this.fill(0)}},Zh=class{constructor(e){if(e===0)return[];let t=Yh(e);this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Qh=class e{constructor(t={}){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:p=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:g,fetchContext:_,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:x,ignoreFetchAbort:S}=t,{length:C,maxAge:w,stale:T}=t instanceof e?{}:t;if(n!==0&&!Jh(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?Yh(n):Array;if(!E)throw Error(`invalid max value: `+n);if(this.max=n,this.maxSize=p,this.maxEntrySize=m||this.maxSize,this.sizeCalculation=h||C,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(this.fetchMethod=g||null,this.fetchMethod&&typeof this.fetchMethod!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.fetchContext=_,!this.fetchMethod&&_!==void 0)throw TypeError(`cannot set fetchContext without fetchMethod`);if(this.keyMap=new Map,this.keyList=Array(n).fill(null),this.valList=Array(n).fill(null),this.next=new E(n),this.prev=new E(n),this.head=0,this.tail=0,this.free=new Zh(n),this.initialFill=1,this.size=0,typeof l==`function`&&(this.dispose=l),typeof u==`function`?(this.disposeAfter=u,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!b,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.maxSize!==0&&!Jh(this.maxSize))throw TypeError(`maxSize must be a positive integer if specified`);if(!Jh(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.initializeSizeTracking()}if(this.allowStale=!!c||!!T,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=Jh(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||w||0,this.ttl){if(!Jh(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let t=`LRU_CACHE_UNBOUNDED`;if(Kh(t)){Vh.add(t);let n=`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`;Gh(n,`UnboundedCacheWarning`,t,e)}}T&&Hh(`stale`,`allowStale`),w&&Hh(`maxAge`,`ttl`),C&&Hh(`length`,`sizeCalculation`)}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Xh(this.max),this.starts=new Xh(this.max),this.setItemTTL=(e,t,n=Fh.now())=>{if(this.starts[e]=t===0?0:n,this.ttls[e]=t,t!==0&&this.ttlAutopurge){let n=setTimeout(()=>{this.isStale(e)&&this.delete(this.keyList[e])},t+1);n.unref&&n.unref()}},this.updateItemAge=e=>{this.starts[e]=this.ttls[e]===0?0:Fh.now()},this.statusTTL=(n,r)=>{n&&(n.ttl=this.ttls[r],n.start=this.starts[r],n.now=e||t(),n.remainingTTL=n.now+n.ttl-n.start)};let e=0,t=()=>{let t=Fh.now();if(this.ttlResolution>0){e=t;let n=setTimeout(()=>e=0,this.ttlResolution);n.unref&&n.unref()}return t};this.getRemainingTTL=n=>{let r=this.keyMap.get(n);return r===void 0?0:this.ttls[r]===0||this.starts[r]===0?1/0:this.starts[r]+this.ttls[r]-(e||t())},this.isStale=n=>this.ttls[n]!==0&&this.starts[n]!==0&&(e||t())-this.starts[n]>this.ttls[n]}updateItemAge(e){}statusTTL(e,t){}setItemTTL(e,t,n){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Xh(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,t,n,r)=>{if(this.isBackgroundFetch(t))return 0;if(!Jh(n))if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!Jh(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`);return n},this.addItemSize=(e,t,n)=>{if(this.sizes[e]=t,this.maxSize){let t=this.maxSize-this.sizes[e];for(;this.calculatedSize>t;)this.evict(!0)}this.calculatedSize+=this.sizes[e],n&&(n.entrySize=t,n.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,t){}requireSize(e,t,n,r){if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`)}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.tail;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.head));)t=this.prev[t]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.head;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.tail));)t=this.next[t]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(let e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(let e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(let e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(let e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(let e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(let e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,t){for(let n of this.indexes()){let r=this.valList[n],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;if(e(i,this.keyList[n],this))return this.get(this.keyList[n],t)}}forEach(e,t=this){for(let n of this.indexes()){let r=this.valList[n],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;e.call(t,i,this.keyList[n],this)}}rforEach(e,t=this){for(let n of this.rindexes()){let r=this.valList[n],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;e.call(t,i,this.keyList[n],this)}}get prune(){return Uh(`prune`,`purgeStale`),this.purgeStale}purgeStale(){let e=!1;for(let t of this.rindexes({allowStale:!0}))this.isStale(t)&&(this.delete(this.keyList[t]),e=!0);return e}dump(){let e=[];for(let t of this.indexes({allowStale:!0})){let n=this.keyList[t],r=this.valList[t],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;let a={value:i};if(this.ttls){a.ttl=this.ttls[t];let e=Fh.now()-this.starts[t];a.start=Math.floor(Date.now()-e)}this.sizes&&(a.size=this.sizes[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=Fh.now()-e}this.set(t,n.value,n)}}dispose(e,t,n){}set(e,t,{ttl:n=this.ttl,start:r,noDisposeOnSet:i=this.noDisposeOnSet,size:a=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:s=this.noUpdateTTL,status:c}={}){if(a=this.requireSize(e,t,a,o),this.maxEntrySize&&a>this.maxEntrySize)return c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this.delete(e),this;let l=this.size===0?void 0:this.keyMap.get(e);if(l===void 0)l=this.newIndex(),this.keyList[l]=e,this.valList[l]=t,this.keyMap.set(e,l),this.next[this.tail]=l,this.prev[l]=this.tail,this.tail=l,this.size++,this.addItemSize(l,a,c),c&&(c.set=`add`),s=!1;else{this.moveToTail(l);let n=this.valList[l];if(t!==n){if(this.isBackgroundFetch(n)?n.__abortController.abort(Error(`replaced`)):i||(this.dispose(n,e,`set`),this.disposeAfter&&this.disposed.push([n,e,`set`])),this.removeItemSize(l),this.valList[l]=t,this.addItemSize(l,a,c),c){c.set=`replace`;let e=n&&this.isBackgroundFetch(n)?n.__staleWhileFetching:n;e!==void 0&&(c.oldValue=e)}}else c&&(c.set=`update`)}if(n!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),s||this.setItemTTL(l,n,r),this.statusTTL(c,l),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length===0?this.initialFill++:this.free.pop()}pop(){if(this.size){let e=this.valList[this.head];return this.evict(!0),e}}evict(e){let t=this.head,n=this.keyList[t],r=this.valList[t];return this.isBackgroundFetch(r)?r.__abortController.abort(Error(`evicted`)):(this.dispose(r,n,`evict`),this.disposeAfter&&this.disposed.push([r,n,`evict`])),this.removeItemSize(t),e&&(this.keyList[t]=null,this.valList[t]=null,this.free.push(t)),this.head=this.next[t],this.keyMap.delete(n),this.size--,t}has(e,{updateAgeOnHas:t=this.updateAgeOnHas,status:n}={}){let r=this.keyMap.get(e);if(r!==void 0)if(this.isStale(r))n&&(n.has=`stale`,this.statusTTL(n,r));else return t&&this.updateItemAge(r),n&&(n.has=`hit`),this.statusTTL(n,r),!0;else n&&(n.has=`miss`);return!1}peek(e,{allowStale:t=this.allowStale}={}){let n=this.keyMap.get(e);if(n!==void 0&&(t||!this.isStale(n))){let e=this.valList[n];return this.isBackgroundFetch(e)?e.__staleWhileFetching:e}}backgroundFetch(e,t,n,r){let i=t===void 0?void 0:this.valList[t];if(this.isBackgroundFetch(i))return i;let a=new Lh;n.signal&&n.signal.addEventListener(`abort`,()=>a.abort(n.signal.reason));let o={signal:a.signal,options:n,context:r},s=(r,i=!1)=>{let{aborted:s}=a.signal,c=n.ignoreFetchAbort&&r!==void 0;return n.status&&(s&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),s&&!c&&!i?l(a.signal.reason):(this.valList[t]===d&&(r===void 0?d.__staleWhileFetching?this.valList[t]=d.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,o.options))),r)},c=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),l(e)),l=r=>{let{aborted:i}=a.signal,o=i&&n.allowStaleOnFetchAbort,s=o||n.allowStaleOnFetchRejection,c=s||n.noDeleteOnFetchRejection;if(this.valList[t]===d){let n=!c||d.__staleWhileFetching===void 0;n?this.delete(e):o||(this.valList[t]=d.__staleWhileFetching)}if(s)return n.status&&d.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw r},u=(t,r)=>{this.fetchMethod(e,i,o).then(e=>t(e),r),a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(),n.allowStaleOnFetchAbort&&(t=e=>s(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let d=new Promise(u).then(s,c);return d.__abortController=a,d.__staleWhileFetching=i,d.__returned=null,t===void 0?(this.set(e,d,{...o.options,status:void 0}),t=this.keyMap.get(e)):this.valList[t]=d,d}isBackgroundFetch(e){return e&&typeof e==`object`&&typeof e.then==`function`&&Object.prototype.hasOwnProperty.call(e,`__staleWhileFetching`)&&Object.prototype.hasOwnProperty.call(e,`__returned`)&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:s=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,fetchContext:p=this.fetchContext,forceRefresh:m=!1,status:h,signal:g}={}){if(!this.fetchMethod)return h&&(h.fetch=`get`),this.get(e,{allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:h});let _={allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:i,noDisposeOnSet:a,size:o,sizeCalculation:s,noUpdateTTL:c,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:f,ignoreFetchAbort:d,status:h,signal:g},v=this.keyMap.get(e);if(v===void 0){h&&(h.fetch=`miss`);let t=this.backgroundFetch(e,v,_,p);return t.__returned=t}else{let r=this.valList[v];if(this.isBackgroundFetch(r)){let e=t&&r.__staleWhileFetching!==void 0;return h&&(h.fetch=`inflight`,e&&(h.returnedStale=!0)),e?r.__staleWhileFetching:r.__returned=r}let i=this.isStale(v);if(!m&&!i)return h&&(h.fetch=`hit`),this.moveToTail(v),n&&this.updateItemAge(v),this.statusTTL(h,v),r;let a=this.backgroundFetch(e,v,_,p),o=a.__staleWhileFetching!==void 0,s=o&&t;return h&&(h.fetch=o&&i?`stale`:`refresh`,s&&i&&(h.returnedStale=!0)),s?a.__staleWhileFetching:a.__returned=a}}get(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:i}={}){let a=this.keyMap.get(e);if(a!==void 0){let o=this.valList[a],s=this.isBackgroundFetch(o);return this.statusTTL(i,a),this.isStale(a)?(i&&(i.get=`stale`),s?(i&&(i.returnedStale=t&&o.__staleWhileFetching!==void 0),t?o.__staleWhileFetching:void 0):(r||this.delete(e),i&&(i.returnedStale=t),t?o:void 0)):(i&&(i.get=`hit`),s?o.__staleWhileFetching:(this.moveToTail(a),n&&this.updateItemAge(a),o))}else i&&(i.get=`miss`)}connect(e,t){this.prev[t]=e,this.next[e]=t}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return Uh(`del`,`delete`),this.delete}delete(e){let t=!1;if(this.size!==0){let n=this.keyMap.get(e);if(n!==void 0)if(t=!0,this.size===1)this.clear();else{this.removeItemSize(n);let t=this.valList[n];this.isBackgroundFetch(t)?t.__abortController.abort(Error(`deleted`)):(this.dispose(t,e,`delete`),this.disposeAfter&&this.disposed.push([t,e,`delete`])),this.keyMap.delete(e),this.keyList[n]=null,this.valList[n]=null,n===this.tail?this.tail=this.prev[n]:n===this.head?this.head=this.next[n]:(this.next[this.prev[n]]=this.next[n],this.prev[this.next[n]]=this.prev[n]),this.size--,this.free.push(n)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return t}clear(){for(let e of this.rindexes({allowStale:!0})){let t=this.valList[e];if(this.isBackgroundFetch(t))t.__abortController.abort(Error(`deleted`));else{let n=this.keyList[e];this.dispose(t,n,`delete`),this.disposeAfter&&this.disposed.push([t,n,`delete`])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Uh(`reset`,`clear`),this.clear}get length(){return Wh(`length`,`size`),this.size}static get AbortController(){return Lh}static get AbortSignal(){return Bh}},$h=Qh,eg={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function tg(e){try{return new URL(e)}catch{return null}}function ng(e){var t=(typeof e==`string`?tg(e):e)||{},n=t.protocol,r=t.host,i=t.port;if(typeof r!=`string`||!r||typeof n!=`string`||(n=n.split(`:`,1)[0],r=r.replace(/:\d*$/,``),i=parseInt(i)||eg[n]||0,!rg(r,i)))return``;var a=ig(n+`_proxy`)||ig(`all_proxy`);return a&&a.indexOf(`://`)===-1&&(a=n+`://`+a),a}function rg(e,t){var n=ig(`no_proxy`).toLowerCase();return n?n===`*`?!1:n.split(/[,\s]/).every(function(n){if(!n)return!0;var r=n.match(/^(.+):(\d+)$/),i=r?r[1]:n,a=r?parseInt(r[2]):0;return a&&a!==t?!0:/^[.*]/.test(i)?(i.charAt(0)===`*`&&(i=i.slice(1)),!e.endsWith(i)):e!==i}):!0}function ig(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||``}var ag=e.__toESM(e.require_src(),1);const og=(0,ag.default)(`proxy-agent`),sg={http:async()=>(await Promise.resolve().then(function(){return require(`./dist-P1p1wUPd.js`)})).HttpProxyAgent,https:async()=>(await Promise.resolve().then(function(){return require(`./dist-CqU63zlG.js`)})).HttpsProxyAgent,socks:async()=>(await Promise.resolve().then(function(){return require(`./dist-TKIODOC0.js`)})).SocksProxyAgent,pac:async()=>(await Promise.resolve().then(function(){return require(`./dist-nw78g_9w.js`)})).PacProxyAgent},cg={http:[sg.http,sg.https],https:[sg.http,sg.https],socks:[sg.socks,sg.socks],socks4:[sg.socks,sg.socks],socks4a:[sg.socks,sg.socks],socks5:[sg.socks,sg.socks],socks5h:[sg.socks,sg.socks],"pac+data":[sg.pac,sg.pac],"pac+file":[sg.pac,sg.pac],"pac+ftp":[sg.pac,sg.pac],"pac+http":[sg.pac,sg.pac],"pac+https":[sg.pac,sg.pac]};function lg(e){return Object.keys(cg).includes(e)}var ug=class extends e.Agent{constructor(e){super(e),this.cache=new $h({max:20,dispose:e=>e.destroy()}),og(`Creating new ProxyAgent instance: %o`,e),this.connectOpts=e,this.httpAgent=e?.httpAgent||new T.Agent(e),this.httpsAgent=e?.httpsAgent||new w.Agent(e),this.getProxyForUrl=e?.getProxyForUrl||ng}async connect(e,t){let{secureEndpoint:n}=t,r=e.getHeader(`upgrade`)===`websocket`,i=n?r?`wss:`:`https:`:r?`ws:`:`http:`,a=e.getHeader(`host`),o=new C.URL(e.path,`${i}//${a}`).href,s=await this.getProxyForUrl(o,e);if(!s)return og(`Proxy not enabled for URL: %o`,o),n?this.httpsAgent:this.httpAgent;og(`Request URL: %o`,o),og(`Proxy URL: %o`,s);let c=`${i}+${s}`,l=this.cache.get(c);if(l)og(`Cache hit for proxy URL: %o`,s);else{let e=new C.URL(s),t=e.protocol.replace(`:`,``);if(!lg(t))throw Error(`Unsupported protocol for proxy URL: ${s}`);let i=await cg[t][n||r?1:0]();l=new i(s,this.connectOpts),this.cache.set(c,l)}return l}destroy(){for(let e of this.cache.values())e.destroy();super.destroy()}},dg=`@turbo/gen`,fg=`2.10.6`,pg=`Extend a Turborepo`,mg=`https://turborepo.dev`,hg={url:`https://github.com/vercel/turborepo/issues`},gg=`MIT`,_g={type:`git`,url:`git+https://github.com/vercel/turborepo.git`,directory:`packages/turbo-gen`},vg=`dist/cli.js`,yg=[`dist`],bg=`dist/types.d.ts`,xg={access:`public`},Sg={build:`tsdown && tsc -p tsconfig.build.json`,"build:embed":`node scripts/embed-templates.mjs`,test:`jest`,"check-types":`tsc --noEmit`},Cg={"@inquirer/prompts":`^7.10.1`,esbuild:`^0.28.1`},wg={"@arethetypeswrong/cli":`0.18.2`,"@jest/globals":`30.3.0`,"@turbo/test-utils":`workspace:*`,"@turbo/tsconfig":`workspace:*`,"@turbo/utils":`workspace:*`,"@turbo/workspaces":`workspace:*`,"@types/fs-extra":`9.0.13`,"@types/node":`18.17.4`,"@types/validate-npm-package-name":`4.0.0`,"brace-expansion":`5.0.7`,commander:`10.0.0`,"fs-extra":`10.1.0`,handlebars:`4.7.9`,jest:`30.3.0`,minimatch:`9.0.7`,"node-plop":`0.32.3`,picocolors:`1.0.1`,"proxy-agent":`8.0.2`,tsdown:`0.12.0`,typescript:`npm:@typescript/typescript6@^6.0.1`,"typescript-7":`npm:typescript@7.0.1-rc`,"update-check":`1.5.4`,"validate-npm-package-name":`5.0.0`},Tg={name:dg,version:fg,description:pg,homepage:mg,bugs:hg,license:gg,repository:_g,bin:vg,files:yg,types:bg,publishConfig:xg,scripts:Sg,dependencies:Cg,devDependencies:wg},Eg=e.__commonJSMin((exports,t)=>{function n(e){return e==null}function r(e){return typeof e==`object`&&!!e}function i(e){return Array.isArray(e)?e:n(e)?[]:[e]}function a(e,t){if(t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=n[r];e[i]=t[i]}}return e}function o(e,t){let n=``;for(let r=0;r<t;r+=1)n+=e;return n}function s(e){return e===0&&1/e==-1/0}t.exports.isNothing=n,t.exports.isObject=r,t.exports.toArray=i,t.exports.repeat=o,t.exports.isNegativeZero=s,t.exports.extend=a}),Dg=e.__commonJSMin((exports,t)=>{function n(e,t){let n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
122
|
+
`)l=!1,d+=f(e,u,p),u=p;else if(!l&&o+s===`/*`){d+=e.slice(u,p),u=p,l=r,p++;continue}else if(l===r&&o+s===`*/`){p++,l=!1,d+=f(e,u,p+1),u=p+1;continue}}}return d+(l?f(e.substr(u)):e.substr(u))}}),Ch=e.__commonJSMin(exports=>{var t=require(`fs`),n=xh(),r=require(`path`),i=Sh(),a=exports.parse=function(e){return/^\s*{/.test(e)?JSON.parse(i(e)):n.parse(e)},o=exports.file=function(){var e=[].slice.call(arguments).filter(function(e){return e!=null});for(var n in e)if(typeof e[n]!=`string`)return;var i=r.join.apply(null,e),a;try{return t.readFileSync(i,`utf-8`)}catch{return}},s=exports.json=function(){var e=o.apply(null,arguments);return e?a(e):null},c=exports.env=function(e,t){t||=process.env;var n={},r=e.length;for(var i in t)if(i.toLowerCase().indexOf(e.toLowerCase())===0){for(var a=i.substring(r).split(`__`),o;(o=a.indexOf(``))>-1;)a.splice(o,1);var s=n;a.forEach(function(e,n){!e||typeof s!=`object`||(n===a.length-1&&(s[e]=t[i]),s[e]===void 0&&(s[e]={}),s=s[e])})}return n},l=exports.find=function(){var e=r.join.apply(null,[].slice.call(arguments));function n(e,i){var a=r.join(e,i);try{return t.statSync(a),a}catch{if(r.dirname(e)!==e)return n(r.dirname(e),i)}}return n(process.cwd(),e)}}),wh=e.__commonJSMin((exports,t)=>{function n(e){return e instanceof Buffer||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof Buffer){var t=Buffer.alloc?Buffer.alloc(e.length):new Buffer(e.length);return e.copy(t),t}else if(e instanceof Date)return new Date(e.getTime());else if(e instanceof RegExp)return new RegExp(e);else throw Error(`Unexpected situation`)}function i(e){var t=[];return e.forEach(function(e,a){typeof e==`object`&&e?Array.isArray(e)?t[a]=i(e):n(e)?t[a]=r(e):t[a]=o({},e):t[a]=e}),t}function a(e,t){return t===`__proto__`?void 0:e[t]}var o=t.exports=function(){if(arguments.length<1||typeof arguments[0]!=`object`)return!1;if(arguments.length<2)return arguments[0];var e=arguments[0],t=Array.prototype.slice.call(arguments,1),s,c,l;return t.forEach(function(t){typeof t!=`object`||!t||Array.isArray(t)||Object.keys(t).forEach(function(l){if(c=a(e,l),s=a(t,l),s!==e)if(typeof s!=`object`||!s){e[l]=s;return}else if(Array.isArray(s)){e[l]=i(s);return}else if(n(s)){e[l]=r(s);return}else if(typeof c!=`object`||!c||Array.isArray(c)){e[l]=o({},s);return}else{e[l]=o(c,s);return}})}),e}}),Th=e.__commonJSMin((exports,t)=>{function n(e,t){var n=e;t.slice(0,-1).forEach(function(e){n=n[e]||{}});var r=t[t.length-1];return r in n}function r(e){return typeof e==`number`||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function i(e,t){return t===`constructor`&&typeof e[t]==`function`||t===`__proto__`}t.exports=function(e,t){t||={};var a={bools:{},strings:{},unknownFn:null};typeof t.unknown==`function`&&(a.unknownFn=t.unknown),typeof t.boolean==`boolean`&&t.boolean?a.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(e){a.bools[e]=!0});var o={};function s(e){return o[e].some(function(e){return a.bools[e]})}Object.keys(t.alias||{}).forEach(function(e){o[e]=[].concat(t.alias[e]),o[e].forEach(function(t){o[t]=[e].concat(o[e].filter(function(e){return t!==e}))})}),[].concat(t.string).filter(Boolean).forEach(function(e){a.strings[e]=!0,o[e]&&[].concat(o[e]).forEach(function(e){a.strings[e]=!0})});var c=t.default||{},l={_:[]};function u(e,t){return a.allBools&&/^--[^=]+$/.test(t)||a.strings[e]||a.bools[e]||o[e]}function d(e,t,n){for(var r=e,o=0;o<t.length-1;o++){var s=t[o];if(i(r,s))return;r[s]===void 0&&(r[s]={}),(r[s]===Object.prototype||r[s]===Number.prototype||r[s]===String.prototype)&&(r[s]={}),r[s]===Array.prototype&&(r[s]=[]),r=r[s]}var c=t[t.length-1];i(r,c)||((r===Object.prototype||r===Number.prototype||r===String.prototype)&&(r={}),r===Array.prototype&&(r=[]),r[c]===void 0||a.bools[c]||typeof r[c]==`boolean`?r[c]=n:Array.isArray(r[c])?r[c].push(n):r[c]=[r[c],n])}function f(e,t,n){if(!(n&&a.unknownFn&&!u(e,n)&&a.unknownFn(n)===!1)){var i=!a.strings[e]&&r(t)?Number(t):t;d(l,e.split(`.`),i),(o[e]||[]).forEach(function(e){d(l,e.split(`.`),i)})}}Object.keys(a.bools).forEach(function(e){f(e,c[e]===void 0?!1:c[e])});var p=[];e.indexOf(`--`)!==-1&&(p=e.slice(e.indexOf(`--`)+1),e=e.slice(0,e.indexOf(`--`)));for(var m=0;m<e.length;m++){var h=e[m],g,_;if(/^--.+=/.test(h)){var v=h.match(/^--([^=]+)=([\s\S]*)$/);g=v[1];var y=v[2];a.bools[g]&&(y=y!==`false`),f(g,y,h)}else if(/^--no-.+/.test(h))g=h.match(/^--no-(.+)/)[1],f(g,!1,h);else if(/^--.+/.test(h))g=h.match(/^--(.+)/)[1],_=e[m+1],_!==void 0&&!/^(-|--)[^-]/.test(_)&&!a.bools[g]&&!a.allBools&&(!o[g]||!s(g))?(f(g,_,h),m+=1):/^(true|false)$/.test(_)?(f(g,_===`true`,h),m+=1):f(g,a.strings[g]?``:!0,h);else if(/^-[^-]+/.test(h)){for(var b=h.slice(1,-1).split(``),x=!1,S=0;S<b.length;S++){if(_=h.slice(S+2),_===`-`){f(b[S],_,h);continue}if(/[A-Za-z]/.test(b[S])&&_[0]===`=`){f(b[S],_.slice(1),h),x=!0;break}if(/[A-Za-z]/.test(b[S])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(_)){f(b[S],_,h),x=!0;break}if(b[S+1]&&b[S+1].match(/\W/)){f(b[S],h.slice(S+2),h),x=!0;break}else f(b[S],a.strings[b[S]]?``:!0,h)}g=h.slice(-1)[0],!x&&g!==`-`&&(e[m+1]&&!/^(-|--)[^-]/.test(e[m+1])&&!a.bools[g]&&(!o[g]||!s(g))?(f(g,e[m+1],h),m+=1):e[m+1]&&/^(true|false)$/.test(e[m+1])?(f(g,e[m+1]===`true`,h),m+=1):f(g,a.strings[g]?``:!0,h))}else if((!a.unknownFn||a.unknownFn(h)!==!1)&&l._.push(a.strings._||!r(h)?h:Number(h)),t.stopEarly){l._.push.apply(l._,e.slice(m+1));break}}return Object.keys(c).forEach(function(e){n(l,e.split(`.`))||(d(l,e.split(`.`),c[e]),(o[e]||[]).forEach(function(t){d(l,t.split(`.`),c[e])}))}),t[`--`]?l[`--`]=p.slice():p.forEach(function(e){l._.push(e)}),l}}),Eh=e.__commonJSMin((exports,t)=>{var n=Ch(),r=require(`path`).join,i=wh(),a=`/etc`,o=process.platform===`win32`,s=o?process.env.USERPROFILE:process.env.HOME;t.exports=function(e,t,c,l){if(typeof e!=`string`)throw Error(`rc(name): name *must* be string`);c||=Th()(process.argv.slice(2)),t=(typeof t==`string`?n.json(t):t)||{},l||=n.parse;var u=n.env(e+`_`),d=[t],f=[];function p(e){if(!(f.indexOf(e)>=0)){var t=n.file(e);t&&(d.push(l(t)),f.push(e))}}return o||[r(a,e,`config`),r(a,e+`rc`)].forEach(p),s&&[r(s,`.config`,e,`config`),r(s,`.config`,e),r(s,`.`+e,`config`),r(s,`.`+e+`rc`)].forEach(p),p(n.find(`.`+e+`rc`)),u.config&&p(u.config),c.config&&p(c.config),i.apply(null,d.concat([u,c,f.length?{configs:f,config:f[f.length-1]}:void 0]))}}),Dh=e.__commonJSMin((exports,t)=>{t.exports=function(e){var t=Eh()(`npm`,{registry:`https://registry.npmjs.org/`}),n=t[e+`:registry`]||t.registry;return n.slice(-1)===`/`?n:n+`/`}}),Oh=e.__commonJSMin((exports,t)=>{var n=require(`buffer`),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,exports),exports.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}}),kh=e.__commonJSMin((exports,t)=>{let n=Oh().Buffer;function r(e){return n.from(e,`base64`).toString(`utf8`)}function i(e){return n.from(e,`utf8`).toString(`base64`)}t.exports={decodeBase64:r,encodeBase64:i}}),Ah=e.__commonJSMin((exports,t)=>{var n=require(`url`),r=kh(),i=r.decodeBase64,a=r.encodeBase64,o=`:_authToken`,s=`:username`,c=`:_password`;t.exports=function(){var e,t;return arguments.length>=2?(e=arguments[0],t=arguments[1]):typeof arguments[0]==`string`?e=arguments[0]:t=arguments[0],t||={},t.npmrc=t.npmrc||Eh()(`npm`,{registry:`https://registry.npmjs.org/`}),e||=t.npmrc.registry,l(e,t)||u(t.npmrc)};function l(e,t){for(var r=n.parse(e,!1,!0),i;i!==`/`&&r.pathname!==i;){i=r.pathname||`/`;var a=`//`+r.host+i.replace(/\/$/,``),o=f(a,t.npmrc);if(o)return o;if(!t.recursive)return/\/$/.test(e)?void 0:l(n.resolve(e,`.`),t);r.pathname=n.resolve(d(i),`..`)||`/`}}function u(e){if(e._auth)return{token:e._auth,type:`Basic`}}function d(e){return e[e.length-1]===`/`?e:e+`/`}function f(e,t){var n=p(t[e+o]||t[e+`/`+o]);if(n)return n;var r=t[e+s]||t[e+`/`+s],i=t[e+c]||t[e+`/`+c],a=m(r,i);if(a)return a}function p(e){if(e){var t=e.replace(/^\$\{?([^}]*)\}?$/,function(e,t){return process.env[t]});return{token:t,type:`Bearer`}}}function m(e,t){if(!(!e||!t)){var n=i(t.replace(/^\$\{?([^}]*)\}?$/,function(e,t){return process.env[t]})),r=a(e+`:`+n);return{token:r,type:`Basic`,password:n,username:e}}}}),jh=e.__commonJSMin((exports,t)=>{let{URL:n}=require(`url`),{join:r}=require(`path`),i=require(`fs`),{promisify:a}=require(`util`),{tmpdir:o}=require(`os`),s=Dh(),c=a(i.writeFile),l=a(i.mkdir),u=a(i.readFile),d=(e,t)=>e.localeCompare(t,`en-US`,{numeric:!0}),f=e=>encodeURIComponent(e).replace(/^%40/,`@`),p=async(e,t)=>{let n=o(),a=r(n,`update-check`);i.existsSync(a)||await l(a);let s=`${e.name}-${t}.json`;return e.scope&&(s=`${e.scope}-${s}`),r(a,s)},m=async(e,t,n)=>{if(i.existsSync(e)){let r=await u(e,`utf8`),{lastUpdate:i,latest:a}=JSON.parse(r),o=i+n;if(o>t)return{shouldCheck:!1,latest:a}}return{shouldCheck:!0,latest:null}},h=async(e,t,n)=>{let r=JSON.stringify({latest:t,lastUpdate:n});await c(e,r,`utf8`)},g=(e,t)=>new Promise((n,r)=>{let i={host:e.hostname,path:e.pathname,port:e.port,headers:{accept:`application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`},timeout:2e3};t&&(i.headers.authorization=`${t.type} ${t.token}`);let{get:a}=e.protocol===`https:`?require(`https`):require(`http`);a(i,e=>{let{statusCode:t}=e;if(t!==200){let n=Error(`Request failed with code ${t}`);n.code=t,r(n),e.resume();return}let i=``;e.setEncoding(`utf8`),e.on(`data`,e=>{i+=e}),e.on(`end`,()=>{try{let e=JSON.parse(i);n(e)}catch(e){r(e)}})}).on(`error`,r).on(`timeout`,r)}),_=async({full:e,scope:t},r)=>{let i=s(t),a=new n(e,i),o=null;try{o=await g(a)}catch(e){if(e.code&&String(e.code).startsWith(4)){let e=Ah(),t=e(i,{recursive:!0});o=await g(a,t)}else throw e}let c=o[`dist-tags`][r];if(!c)throw Error(`Distribution tag ${r} is not available`);return c},v={interval:36e5,distTag:`latest`},y=e=>{let t={full:f(e)};if(e.includes(`/`)){let n=e.split(`/`);t.scope=n[0],t.name=n[1]}else t.scope=null,t.name=e;return t};t.exports=async(e,t)=>{if(typeof e!=`object`)throw Error(`The first parameter should be your package.json file content`);let n=y(e.name),r=Date.now(),{distTag:i,interval:a}=Object.assign({},v,t),o=await p(n,i),s=null,c=!0;({shouldCheck:c,latest:s}=await m(o,r,a)),c&&(s=await _(n,i),await h(o,s,r));let l=d(e.version,s);return l===-1?{latest:s,fromCache:!c}:null}}),Mh=e.__toESM(M()),Nh=e.__toESM(jh());function Ph(e){let{packageInfo:t,upgradeCommand:n}=e,r=(0,Nh.default)(t).catch(()=>null);return async function(e=0){try{let i=await r;if(i?.latest){Ji(),Ji(Mh.default.yellow(Mh.default.bold(`A new version of \`${t.name}\` is available!`)));let e=typeof n==`function`?await n():n;e&&Ji(`You can update by running: ${Mh.default.cyan(e)}`),Ji()}process.exit(e)}catch(t){process.env.DEBUG&&Xi(`Update check failed:`,t),process.exit(e)}}}const Fh=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,Ih=typeof AbortController==`function`,Lh=Ih?AbortController:class{constructor(){this.signal=new Bh}abort(e=Error(`This operation was aborted`)){this.signal.reason=this.signal.reason||e,this.signal.aborted=!0,this.signal.dispatchEvent({type:`abort`,target:this.signal})}},Rh=typeof AbortSignal==`function`,zh=typeof Lh.AbortSignal==`function`,Bh=Rh?AbortSignal:zh?Lh.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(e){e.type===`abort`&&(this.aborted=!0,this.onabort(e),this._listeners.forEach(t=>t(e),this))}onabort(){}addEventListener(e,t){e===`abort`&&this._listeners.push(t)}removeEventListener(e,t){e===`abort`&&(this._listeners=this._listeners.filter(e=>e!==t))}},Vh=new Set,Hh=(e,t)=>{let n=`LRU_CACHE_OPTION_${e}`;Kh(n)&&qh(n,`${e} option`,`options.${t}`,Qh)},Uh=(e,t)=>{let n=`LRU_CACHE_METHOD_${e}`;if(Kh(n)){let{prototype:r}=Qh,{get:i}=Object.getOwnPropertyDescriptor(r,e);qh(n,`${e} method`,`cache.${t}()`,i)}},Wh=(e,t)=>{let n=`LRU_CACHE_PROPERTY_${e}`;if(Kh(n)){let{prototype:r}=Qh,{get:i}=Object.getOwnPropertyDescriptor(r,e);qh(n,`${e} property`,`cache.${t}`,i)}},Gh=(...e)=>{typeof process==`object`&&process&&typeof process.emitWarning==`function`?process.emitWarning(...e):console.error(...e)},Kh=e=>!Vh.has(e),qh=(e,t,n,r)=>{Vh.add(e);let i=`The ${t} is deprecated. Please use ${n} instead.`;Gh(i,`DeprecationWarning`,e,r)},Jh=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),Yh=e=>Jh(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Xh:null:null;var Xh=class extends Array{constructor(e){super(e),this.fill(0)}},Zh=class{constructor(e){if(e===0)return[];let t=Yh(e);this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Qh=class e{constructor(t={}){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:p=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:g,fetchContext:_,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:x,ignoreFetchAbort:S}=t,{length:C,maxAge:w,stale:T}=t instanceof e?{}:t;if(n!==0&&!Jh(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?Yh(n):Array;if(!E)throw Error(`invalid max value: `+n);if(this.max=n,this.maxSize=p,this.maxEntrySize=m||this.maxSize,this.sizeCalculation=h||C,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(this.fetchMethod=g||null,this.fetchMethod&&typeof this.fetchMethod!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.fetchContext=_,!this.fetchMethod&&_!==void 0)throw TypeError(`cannot set fetchContext without fetchMethod`);if(this.keyMap=new Map,this.keyList=Array(n).fill(null),this.valList=Array(n).fill(null),this.next=new E(n),this.prev=new E(n),this.head=0,this.tail=0,this.free=new Zh(n),this.initialFill=1,this.size=0,typeof l==`function`&&(this.dispose=l),typeof u==`function`?(this.disposeAfter=u,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!b,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.maxSize!==0&&!Jh(this.maxSize))throw TypeError(`maxSize must be a positive integer if specified`);if(!Jh(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.initializeSizeTracking()}if(this.allowStale=!!c||!!T,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=Jh(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||w||0,this.ttl){if(!Jh(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.max&&!this.maxSize){let t=`LRU_CACHE_UNBOUNDED`;if(Kh(t)){Vh.add(t);let n=`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`;Gh(n,`UnboundedCacheWarning`,t,e)}}T&&Hh(`stale`,`allowStale`),w&&Hh(`maxAge`,`ttl`),C&&Hh(`length`,`sizeCalculation`)}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Xh(this.max),this.starts=new Xh(this.max),this.setItemTTL=(e,t,n=Fh.now())=>{if(this.starts[e]=t===0?0:n,this.ttls[e]=t,t!==0&&this.ttlAutopurge){let n=setTimeout(()=>{this.isStale(e)&&this.delete(this.keyList[e])},t+1);n.unref&&n.unref()}},this.updateItemAge=e=>{this.starts[e]=this.ttls[e]===0?0:Fh.now()},this.statusTTL=(n,r)=>{n&&(n.ttl=this.ttls[r],n.start=this.starts[r],n.now=e||t(),n.remainingTTL=n.now+n.ttl-n.start)};let e=0,t=()=>{let t=Fh.now();if(this.ttlResolution>0){e=t;let n=setTimeout(()=>e=0,this.ttlResolution);n.unref&&n.unref()}return t};this.getRemainingTTL=n=>{let r=this.keyMap.get(n);return r===void 0?0:this.ttls[r]===0||this.starts[r]===0?1/0:this.starts[r]+this.ttls[r]-(e||t())},this.isStale=n=>this.ttls[n]!==0&&this.starts[n]!==0&&(e||t())-this.starts[n]>this.ttls[n]}updateItemAge(e){}statusTTL(e,t){}setItemTTL(e,t,n){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Xh(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,t,n,r)=>{if(this.isBackgroundFetch(t))return 0;if(!Jh(n))if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!Jh(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`);return n},this.addItemSize=(e,t,n)=>{if(this.sizes[e]=t,this.maxSize){let t=this.maxSize-this.sizes[e];for(;this.calculatedSize>t;)this.evict(!0)}this.calculatedSize+=this.sizes[e],n&&(n.entrySize=t,n.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,t){}requireSize(e,t,n,r){if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`)}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.tail;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.head));)t=this.prev[t]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.head;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.tail));)t=this.next[t]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(let e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(let e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(let e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(let e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(let e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(let e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,t){for(let n of this.indexes()){let r=this.valList[n],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;if(e(i,this.keyList[n],this))return this.get(this.keyList[n],t)}}forEach(e,t=this){for(let n of this.indexes()){let r=this.valList[n],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;e.call(t,i,this.keyList[n],this)}}rforEach(e,t=this){for(let n of this.rindexes()){let r=this.valList[n],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;e.call(t,i,this.keyList[n],this)}}get prune(){return Uh(`prune`,`purgeStale`),this.purgeStale}purgeStale(){let e=!1;for(let t of this.rindexes({allowStale:!0}))this.isStale(t)&&(this.delete(this.keyList[t]),e=!0);return e}dump(){let e=[];for(let t of this.indexes({allowStale:!0})){let n=this.keyList[t],r=this.valList[t],i=this.isBackgroundFetch(r)?r.__staleWhileFetching:r;if(i===void 0)continue;let a={value:i};if(this.ttls){a.ttl=this.ttls[t];let e=Fh.now()-this.starts[t];a.start=Math.floor(Date.now()-e)}this.sizes&&(a.size=this.sizes[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=Fh.now()-e}this.set(t,n.value,n)}}dispose(e,t,n){}set(e,t,{ttl:n=this.ttl,start:r,noDisposeOnSet:i=this.noDisposeOnSet,size:a=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:s=this.noUpdateTTL,status:c}={}){if(a=this.requireSize(e,t,a,o),this.maxEntrySize&&a>this.maxEntrySize)return c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this.delete(e),this;let l=this.size===0?void 0:this.keyMap.get(e);if(l===void 0)l=this.newIndex(),this.keyList[l]=e,this.valList[l]=t,this.keyMap.set(e,l),this.next[this.tail]=l,this.prev[l]=this.tail,this.tail=l,this.size++,this.addItemSize(l,a,c),c&&(c.set=`add`),s=!1;else{this.moveToTail(l);let n=this.valList[l];if(t!==n){if(this.isBackgroundFetch(n)?n.__abortController.abort(Error(`replaced`)):i||(this.dispose(n,e,`set`),this.disposeAfter&&this.disposed.push([n,e,`set`])),this.removeItemSize(l),this.valList[l]=t,this.addItemSize(l,a,c),c){c.set=`replace`;let e=n&&this.isBackgroundFetch(n)?n.__staleWhileFetching:n;e!==void 0&&(c.oldValue=e)}}else c&&(c.set=`update`)}if(n!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),s||this.setItemTTL(l,n,r),this.statusTTL(c,l),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length===0?this.initialFill++:this.free.pop()}pop(){if(this.size){let e=this.valList[this.head];return this.evict(!0),e}}evict(e){let t=this.head,n=this.keyList[t],r=this.valList[t];return this.isBackgroundFetch(r)?r.__abortController.abort(Error(`evicted`)):(this.dispose(r,n,`evict`),this.disposeAfter&&this.disposed.push([r,n,`evict`])),this.removeItemSize(t),e&&(this.keyList[t]=null,this.valList[t]=null,this.free.push(t)),this.head=this.next[t],this.keyMap.delete(n),this.size--,t}has(e,{updateAgeOnHas:t=this.updateAgeOnHas,status:n}={}){let r=this.keyMap.get(e);if(r!==void 0)if(this.isStale(r))n&&(n.has=`stale`,this.statusTTL(n,r));else return t&&this.updateItemAge(r),n&&(n.has=`hit`),this.statusTTL(n,r),!0;else n&&(n.has=`miss`);return!1}peek(e,{allowStale:t=this.allowStale}={}){let n=this.keyMap.get(e);if(n!==void 0&&(t||!this.isStale(n))){let e=this.valList[n];return this.isBackgroundFetch(e)?e.__staleWhileFetching:e}}backgroundFetch(e,t,n,r){let i=t===void 0?void 0:this.valList[t];if(this.isBackgroundFetch(i))return i;let a=new Lh;n.signal&&n.signal.addEventListener(`abort`,()=>a.abort(n.signal.reason));let o={signal:a.signal,options:n,context:r},s=(r,i=!1)=>{let{aborted:s}=a.signal,c=n.ignoreFetchAbort&&r!==void 0;return n.status&&(s&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),s&&!c&&!i?l(a.signal.reason):(this.valList[t]===d&&(r===void 0?d.__staleWhileFetching?this.valList[t]=d.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,o.options))),r)},c=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),l(e)),l=r=>{let{aborted:i}=a.signal,o=i&&n.allowStaleOnFetchAbort,s=o||n.allowStaleOnFetchRejection,c=s||n.noDeleteOnFetchRejection;if(this.valList[t]===d){let n=!c||d.__staleWhileFetching===void 0;n?this.delete(e):o||(this.valList[t]=d.__staleWhileFetching)}if(s)return n.status&&d.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw r},u=(t,r)=>{this.fetchMethod(e,i,o).then(e=>t(e),r),a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(),n.allowStaleOnFetchAbort&&(t=e=>s(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let d=new Promise(u).then(s,c);return d.__abortController=a,d.__staleWhileFetching=i,d.__returned=null,t===void 0?(this.set(e,d,{...o.options,status:void 0}),t=this.keyMap.get(e)):this.valList[t]=d,d}isBackgroundFetch(e){return e&&typeof e==`object`&&typeof e.then==`function`&&Object.prototype.hasOwnProperty.call(e,`__staleWhileFetching`)&&Object.prototype.hasOwnProperty.call(e,`__returned`)&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:s=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,fetchContext:p=this.fetchContext,forceRefresh:m=!1,status:h,signal:g}={}){if(!this.fetchMethod)return h&&(h.fetch=`get`),this.get(e,{allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:h});let _={allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:i,noDisposeOnSet:a,size:o,sizeCalculation:s,noUpdateTTL:c,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:f,ignoreFetchAbort:d,status:h,signal:g},v=this.keyMap.get(e);if(v===void 0){h&&(h.fetch=`miss`);let t=this.backgroundFetch(e,v,_,p);return t.__returned=t}else{let r=this.valList[v];if(this.isBackgroundFetch(r)){let e=t&&r.__staleWhileFetching!==void 0;return h&&(h.fetch=`inflight`,e&&(h.returnedStale=!0)),e?r.__staleWhileFetching:r.__returned=r}let i=this.isStale(v);if(!m&&!i)return h&&(h.fetch=`hit`),this.moveToTail(v),n&&this.updateItemAge(v),this.statusTTL(h,v),r;let a=this.backgroundFetch(e,v,_,p),o=a.__staleWhileFetching!==void 0,s=o&&t;return h&&(h.fetch=o&&i?`stale`:`refresh`,s&&i&&(h.returnedStale=!0)),s?a.__staleWhileFetching:a.__returned=a}}get(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:i}={}){let a=this.keyMap.get(e);if(a!==void 0){let o=this.valList[a],s=this.isBackgroundFetch(o);return this.statusTTL(i,a),this.isStale(a)?(i&&(i.get=`stale`),s?(i&&(i.returnedStale=t&&o.__staleWhileFetching!==void 0),t?o.__staleWhileFetching:void 0):(r||this.delete(e),i&&(i.returnedStale=t),t?o:void 0)):(i&&(i.get=`hit`),s?o.__staleWhileFetching:(this.moveToTail(a),n&&this.updateItemAge(a),o))}else i&&(i.get=`miss`)}connect(e,t){this.prev[t]=e,this.next[e]=t}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return Uh(`del`,`delete`),this.delete}delete(e){let t=!1;if(this.size!==0){let n=this.keyMap.get(e);if(n!==void 0)if(t=!0,this.size===1)this.clear();else{this.removeItemSize(n);let t=this.valList[n];this.isBackgroundFetch(t)?t.__abortController.abort(Error(`deleted`)):(this.dispose(t,e,`delete`),this.disposeAfter&&this.disposed.push([t,e,`delete`])),this.keyMap.delete(e),this.keyList[n]=null,this.valList[n]=null,n===this.tail?this.tail=this.prev[n]:n===this.head?this.head=this.next[n]:(this.next[this.prev[n]]=this.next[n],this.prev[this.next[n]]=this.prev[n]),this.size--,this.free.push(n)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return t}clear(){for(let e of this.rindexes({allowStale:!0})){let t=this.valList[e];if(this.isBackgroundFetch(t))t.__abortController.abort(Error(`deleted`));else{let n=this.keyList[e];this.dispose(t,n,`delete`),this.disposeAfter&&this.disposed.push([t,n,`delete`])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Uh(`reset`,`clear`),this.clear}get length(){return Wh(`length`,`size`),this.size}static get AbortController(){return Lh}static get AbortSignal(){return Bh}},$h=Qh,eg={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function tg(e){try{return new URL(e)}catch{return null}}function ng(e){var t=(typeof e==`string`?tg(e):e)||{},n=t.protocol,r=t.host,i=t.port;if(typeof r!=`string`||!r||typeof n!=`string`||(n=n.split(`:`,1)[0],r=r.replace(/:\d*$/,``),i=parseInt(i)||eg[n]||0,!rg(r,i)))return``;var a=ig(n+`_proxy`)||ig(`all_proxy`);return a&&a.indexOf(`://`)===-1&&(a=n+`://`+a),a}function rg(e,t){var n=ig(`no_proxy`).toLowerCase();return n?n===`*`?!1:n.split(/[,\s]/).every(function(n){if(!n)return!0;var r=n.match(/^(.+):(\d+)$/),i=r?r[1]:n,a=r?parseInt(r[2]):0;return a&&a!==t?!0:/^[.*]/.test(i)?(i.charAt(0)===`*`&&(i=i.slice(1)),!e.endsWith(i)):e!==i}):!0}function ig(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||``}var ag=e.__toESM(e.require_src(),1);const og=(0,ag.default)(`proxy-agent`),sg={http:async()=>(await Promise.resolve().then(function(){return require(`./dist-P1p1wUPd.js`)})).HttpProxyAgent,https:async()=>(await Promise.resolve().then(function(){return require(`./dist-CqU63zlG.js`)})).HttpsProxyAgent,socks:async()=>(await Promise.resolve().then(function(){return require(`./dist-TKIODOC0.js`)})).SocksProxyAgent,pac:async()=>(await Promise.resolve().then(function(){return require(`./dist-nw78g_9w.js`)})).PacProxyAgent},cg={http:[sg.http,sg.https],https:[sg.http,sg.https],socks:[sg.socks,sg.socks],socks4:[sg.socks,sg.socks],socks4a:[sg.socks,sg.socks],socks5:[sg.socks,sg.socks],socks5h:[sg.socks,sg.socks],"pac+data":[sg.pac,sg.pac],"pac+file":[sg.pac,sg.pac],"pac+ftp":[sg.pac,sg.pac],"pac+http":[sg.pac,sg.pac],"pac+https":[sg.pac,sg.pac]};function lg(e){return Object.keys(cg).includes(e)}var ug=class extends e.Agent{constructor(e){super(e),this.cache=new $h({max:20,dispose:e=>e.destroy()}),og(`Creating new ProxyAgent instance: %o`,e),this.connectOpts=e,this.httpAgent=e?.httpAgent||new T.Agent(e),this.httpsAgent=e?.httpsAgent||new w.Agent(e),this.getProxyForUrl=e?.getProxyForUrl||ng}async connect(e,t){let{secureEndpoint:n}=t,r=e.getHeader(`upgrade`)===`websocket`,i=n?r?`wss:`:`https:`:r?`ws:`:`http:`,a=e.getHeader(`host`),o=new C.URL(e.path,`${i}//${a}`).href,s=await this.getProxyForUrl(o,e);if(!s)return og(`Proxy not enabled for URL: %o`,o),n?this.httpsAgent:this.httpAgent;og(`Request URL: %o`,o),og(`Proxy URL: %o`,s);let c=`${i}+${s}`,l=this.cache.get(c);if(l)og(`Cache hit for proxy URL: %o`,s);else{let e=new C.URL(s),t=e.protocol.replace(`:`,``);if(!lg(t))throw Error(`Unsupported protocol for proxy URL: ${s}`);let i=await cg[t][n||r?1:0]();l=new i(s,this.connectOpts),this.cache.set(c,l)}return l}destroy(){for(let e of this.cache.values())e.destroy();super.destroy()}},dg=`@turbo/gen`,fg=`2.10.7`,pg=`Extend a Turborepo`,mg=`https://turborepo.dev`,hg={url:`https://github.com/vercel/turborepo/issues`},gg=`MIT`,_g={type:`git`,url:`git+https://github.com/vercel/turborepo.git`,directory:`packages/turbo-gen`},vg=`dist/cli.js`,yg=[`dist`],bg=`dist/types.d.ts`,xg={access:`public`},Sg={build:`tsdown && tsc -p tsconfig.build.json`,"build:embed":`node scripts/embed-templates.mjs`,test:`jest`,"check-types":`tsc --noEmit`},Cg={"@inquirer/prompts":`^7.10.1`,esbuild:`^0.28.1`},wg={"@arethetypeswrong/cli":`0.18.2`,"@jest/globals":`30.3.0`,"@turbo/test-utils":`workspace:*`,"@turbo/tsconfig":`workspace:*`,"@turbo/utils":`workspace:*`,"@turbo/workspaces":`workspace:*`,"@types/fs-extra":`9.0.13`,"@types/node":`18.17.4`,"@types/validate-npm-package-name":`4.0.0`,"brace-expansion":`5.0.8`,commander:`10.0.0`,"fs-extra":`10.1.0`,handlebars:`4.7.9`,jest:`30.3.0`,minimatch:`9.0.7`,"node-plop":`0.32.3`,picocolors:`1.0.1`,"proxy-agent":`8.0.2`,tsdown:`0.12.0`,typescript:`npm:@typescript/typescript6@^6.0.1`,"typescript-7":`npm:typescript@7.0.1-rc`,"update-check":`1.5.4`,"validate-npm-package-name":`5.0.0`},Tg={name:dg,version:fg,description:pg,homepage:mg,bugs:hg,license:gg,repository:_g,bin:vg,files:yg,types:bg,publishConfig:xg,scripts:Sg,dependencies:Cg,devDependencies:wg},Eg=e.__commonJSMin((exports,t)=>{function n(e){return e==null}function r(e){return typeof e==`object`&&!!e}function i(e){return Array.isArray(e)?e:n(e)?[]:[e]}function a(e,t){if(t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=n[r];e[i]=t[i]}}return e}function o(e,t){let n=``;for(let r=0;r<t;r+=1)n+=e;return n}function s(e){return e===0&&1/e==-1/0}t.exports.isNothing=n,t.exports.isObject=r,t.exports.toArray=i,t.exports.repeat=o,t.exports.isNegativeZero=s,t.exports.extend=a}),Dg=e.__commonJSMin((exports,t)=>{function n(e,t){let n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
123
123
|
|
|
124
124
|
`+e.mark.snippet),r+` `+n):r}function r(e,t){Error.call(this),this.name=`YAMLException`,this.reason=e,this.mark=t,this.message=n(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||``}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){return this.name+`: `+n(this,e)},t.exports=r}),Og=e.__commonJSMin((exports,t)=>{let n=Eg();function r(e,t,n,r,i){let a=``,o=``,s=Math.floor(i/2)-1;return r-t>s&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function i(e,t){return n.repeat(` `,t-e.length)+e}function a(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||=79,typeof t.indent!=`number`&&(t.indent=1),typeof t.linesBefore!=`number`&&(t.linesBefore=3),typeof t.linesAfter!=`number`&&(t.linesAfter=2);let a=/\r?\n|\r|\0/g,o=[0],s=[],c,l=-1;for(;c=a.exec(e.buffer);)s.push(c.index),o.push(c.index+c[0].length),e.position<=c.index&&l<0&&(l=o.length-2);l<0&&(l=o.length-1);let u=``,d=Math.min(e.line+t.linesAfter,s.length).toString().length,f=t.maxLength-(t.indent+d+3);for(let a=1;a<=t.linesBefore&&!(l-a<0);a++){let c=r(e.buffer,o[l-a],s[l-a],e.position-(o[l]-o[l-a]),f);u=n.repeat(` `,t.indent)+i((e.line-a+1).toString(),d)+` | `+c.str+`
|
|
125
125
|
`+u}let p=r(e.buffer,o[l],s[l],e.position,f);u+=n.repeat(` `,t.indent)+i((e.line+1).toString(),d)+` | `+p.str+`
|
|
@@ -369,10 +369,10 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
|
|
|
369
369
|
### Created with Turborepo Generators
|
|
370
370
|
|
|
371
371
|
Read the docs at [turborepo.dev](https://turborepo.dev/docs/guides/generating-code).
|
|
372
|
-
`}]}};var mA=e.__toESM(yv());async function hA({project:e,template:t}){let n=l.default.join(e.paths.root,`turbo`,`generators`),r=`simple-${t}`,i=pA[r];if(!i)throw new Uk(`Unknown template "${r}"`,{type:`config_directory_already_exists`});if(await mA.default.pathExists(n))throw new Uk(`Generator config directory already exists at ${n}`,{type:`config_directory_already_exists`});for(let e of i.files){let t=l.default.join(n,e.relativePath);await mA.default.outputFile(t,e.content)}}async function gA({generator:e,project:t,opts:n}){let r=!1,i=await Zk({project:t,configPath:n.config});if(!i.length){Xi(`No generators found.`),Ji();let{answer:e}=await fA({message:`Would you like to add a config with a sample custom generator to ${t.name}?`});if(e){r=!0;let{answer:e}=await dA();try{await hA({project:t,template:e})}catch(e){throw e instanceof Uk||Xi(`Failed to create generator config`),e}if(Ji(),Wi(`Generator config successfully created!`),Wi(`Loading generator config...`),Ji(),i=await Zk({project:t,configPath:n.config}),!i.length){Xi(`Error loading generator`);return}}else{Ji(),Ki(`Learn more about custom Turborepo generators - https://turborepo.dev/docs/guides/generating-code#custom-generators`);return}}let{selectedGenerator:a}=await uA({generators:i,generator:e});try{await cA({project:t,generator:a,bypassArgs:n.args,configPath:n.config})}catch(e){if(e instanceof Uk)throw e;let t=`Failed to run generator`;throw e instanceof Error&&(t=e.message),new Uk(t,{type:`plop_error_running_generator`})}finally{r&&(Ji(),Wi(`Congrats! You just ran your first Turborepo generator`),Ki(`Learn more about custom Turborepo generators - https://turborepo.dev/docs/guides/generating-code#custom-generators`))}Ji(),Gi(zi(`>>> Success!`))}const _A=(e,t,n)=>{let r=e instanceof RegExp?vA(e,n):e,i=t instanceof RegExp?vA(t,n):t,a=r!==null&&i!=null&&yA(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},vA=(e,t)=>{let n=t.match(e);return n?n[0]:null},yA=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},bA=`\0SLASH`+Math.random()+`\0`,xA=`\0OPEN`+Math.random()+`\0`,SA=`\0CLOSE`+Math.random()+`\0`,CA=`\0COMMA`+Math.random()+`\0`,wA=`\0PERIOD`+Math.random()+`\0`,TA=new RegExp(bA,`g`),EA=new RegExp(xA,`g`),DA=new RegExp(SA,`g`),OA=new RegExp(CA,`g`),kA=new RegExp(wA,`g`),AA=/\\\\/g,jA=/\\{/g,MA=/\\}/g,NA=/\\,/g,PA=/\\\./g,FA=1e5;function IA(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function LA(e){return e.replace(AA,bA).replace(jA,xA).replace(MA,SA).replace(NA,CA).replace(PA,wA)}function RA(e){return e.replace(TA,`\\`).replace(EA,`{`).replace(DA,`}`).replace(OA,`,`).replace(kA,`.`)}function zA(e){if(!e)return[``];let t=[],n=_A(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=zA(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function BA(e,t={}){if(!e)return[];let{max:n=FA}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),GA(LA(e),n,!0).map(RA)}function VA(e){return`{`+e+`}`}function HA(e){return/^-?0\d/.test(e)}function UA(e,t){return e<=t}function WA(e,t){return e>=t}function GA(e,t,n){let r=[];for(;;){let i=_A(`{`,`}`,e);if(!i)return[e];let a=i.pre;if(/\$$/.test(i.pre)){let e=i.post.length?GA(i.post,t,!1):[``];for(let n=0;n<e.length&&n<t;n++){let t=a+`{`+i.body+`}`+e[n];r.push(t)}return r}let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=o||s,l=i.body.indexOf(`,`)>=0;if(!c&&!l){if(i.post.match(/,(?!,).*\}/)){e=i.pre+`{`+i.body+SA+i.post,n=!0;continue}return[e]}let u=i.post.length?GA(i.post,t,!1):[``],d;if(c)d=i.body.split(/\.\./);else if(d=zA(i.body),d.length===1&&d[0]!==void 0&&(d=GA(d[0],t,!1).map(VA),d.length===1))return u.map(e=>i.pre+d[0]+e);let f;if(c&&d[0]!==void 0&&d[1]!==void 0){let e=IA(d[0]),n=IA(d[1]),r=Math.max(d[0].length,d[1].length),i=d.length===3&&d[2]!==void 0?Math.max(Math.abs(IA(d[2])),1):1,a=UA,o=n<e;o&&(i*=-1,a=WA);let c=d.some(HA);f=[];for(let o=e;a(o,n)&&f.length<t;o+=i){let e;if(s)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),c){let t=r-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,GA(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<u.length&&r.length<t;i++){let t=a+f[e]+u[i];(!n||c||t)&&r.push(t)}return r}}const KA=1024*64,qA=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>KA)throw TypeError(`pattern is too long`)},JA={"[: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]},YA=e=>e.replace(/[[\]\\-]/g,`\\$&`),XA=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),ZA=e=>e.join(``),QA=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(JA))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(YA(d)+`-`+YA(t)):t===d&&r.push(YA(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(YA(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(YA(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let e=r[0].length===2?r[0].slice(-1):r[0];return[XA(e),!1,u-n,!1]}let f=`[`+(l?`^`:``)+ZA(r)+`]`,p=`[`+(l?``:`^`)+ZA(i)+`]`,m=r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p;return[m,s,u-n,!0]},$A=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`);var ej;const tj=new Set([`!`,`?`,`+`,`*`,`@`]),nj=e=>tj.has(e),rj=e=>nj(e.type),ij=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),aj=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),oj=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),sj=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),cj=`(?!(?:^|/)\\.\\.?(?:$|/))`,lj=`(?!\\.)`,uj=new Set([`[`,`.`]),dj=new Set([`..`,`.`]),fj=new Set(`().*{}+?[]^$\\!`),pj=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),mj=`[^/]`,hj=mj+`*?`,gj=mj+`+?`;var _j=class{type;#root;#hasMagic;#uflag=!1;#parts=[];#parent;#parentIndex;#negs;#filledNegs=!1;#options;#toString;#emptyExt=!1;constructor(e,t,n={}){this.type=e,e&&(this.#hasMagic=!0),this.#parent=t,this.#root=this.#parent?this.#parent.#root:this,this.#options=this.#root===this?n:this.#root.#options,this.#negs=this.#root===this?[]:this.#root.#negs,e===`!`&&!this.#root.#filledNegs&&this.#negs.push(this),this.#parentIndex=this.#parent?this.#parent.#parts.length:0}get hasMagic(){if(this.#hasMagic!==void 0)return this.#hasMagic;for(let e of this.#parts){if(typeof e==`string`)continue;if(e.type||e.hasMagic)return this.#hasMagic=!0}return this.#hasMagic}toString(){return this.#toString===void 0?this.type?this.#toString=this.type+`(`+this.#parts.map(e=>String(e)).join(`|`)+`)`:this.#toString=this.#parts.map(e=>String(e)).join(``):this.#toString}#fillNegs(){if(this!==this.#root)throw Error(`should only call on root`);if(this.#filledNegs)return this;this.toString(),this.#filledNegs=!0;let e;for(;e=this.#negs.pop();){if(e.type!==`!`)continue;let t=e,n=t.#parent;for(;n;){for(let r=t.#parentIndex+1;!n.type&&r<n.#parts.length;r++)for(let t of e.#parts){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#parts[r])}t=n,n=t.#parent}}return this}push(...e){for(let t of e){if(t===``)continue;if(typeof t!=`string`&&!(t instanceof ej&&t.#parent===this))throw Error(`invalid part: `+t);this.#parts.push(t)}}toJSON(){let e=this.type===null?this.#parts.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#parts.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#root||this.#root.#filledNegs&&this.#parent?.type===`!`)&&e.push({}),e}isStart(){if(this.#root===this)return!0;if(!this.#parent?.isStart())return!1;if(this.#parentIndex===0)return!0;let e=this.#parent;for(let t=0;t<this.#parentIndex;t++){let n=e.#parts[t];if(!(n instanceof ej&&n.type===`!`))return!1}return!0}isEnd(){if(this.#root===this||this.#parent?.type===`!`)return!0;if(!this.#parent?.isEnd())return!1;if(!this.type)return this.#parent?.isEnd();let e=this.#parent?this.#parent.#parts.length:0;return this.#parentIndex===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new ej(this.type,e);for(let e of this.#parts)t.copyIn(e);return t}static#parseAST(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}let f=!r.noext&&nj(n)&&e.charAt(u)===`(`&&i<=a;if(f){t.push(d),d=``;let a=new ej(n,t);u=ej.#parseAST(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new ej(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}let m=nj(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#canAdoptType(n));if(m){let a=t&&t.#canAdoptType(n)?0:1;d.push(p),p=``;let o=new ej(n,d);d.push(o),u=ej.#parseAST(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new ej(null,t);continue}if(n===`)`)return p===``&&t.#parts.length===0&&(t.#emptyExt=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#hasMagic=void 0,t.#parts=[e.substring(n-1)],u}#canAdoptWithSpace(e){return this.#canAdopt(e,aj)}#canAdopt(e,t=ij){if(!e||typeof e!=`object`||e.type!==null||e.#parts.length!==1||this.type===null)return!1;let n=e.#parts[0];return!n||typeof n!=`object`||n.type===null?!1:this.#canAdoptType(n.type,t)}#canAdoptType(e,t=oj){return!!t.get(this.type)?.includes(e)}#adoptWithSpace(e,t){let n=e.#parts[0],r=new ej(null,n,this.options);r.#parts.push(``),n.push(r),this.#adopt(e,t)}#adopt(e,t){let n=e.#parts[0];this.#parts.splice(t,1,...n.#parts);for(let e of n.#parts)typeof e==`object`&&(e.#parent=this);this.#toString=void 0}#canUsurpType(e){let t=sj.get(this.type);return!!t?.has(e)}#canUsurp(e){if(!e||typeof e!=`object`||e.type!==null||e.#parts.length!==1||this.type===null||this.#parts.length!==1)return!1;let t=e.#parts[0];return!t||typeof t!=`object`||t.type===null?!1:this.#canUsurpType(t.type)}#usurp(e){let t=sj.get(this.type),n=e.#parts[0],r=t?.get(n.type);if(!r)return!1;this.#parts=n.#parts;for(let e of this.#parts)typeof e==`object`&&(e.#parent=this);this.type=r,this.#toString=void 0,this.#emptyExt=!1}#flatten(){if(rj(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#parts.length;e++){let n=this.#parts[e];typeof n==`object`&&(n.#flatten(),this.#canAdopt(n)?(t=!1,this.#adopt(n,e)):this.#canAdoptWithSpace(n)?(t=!1,this.#adoptWithSpace(n,e)):this.#canUsurp(n)&&(t=!1,this.#usurp(n)))}}while(!t&&++e<10)}else for(let e of this.#parts)typeof e==`object`&&e.#flatten();this.#toString=void 0}static fromGlob(e,t={}){let n=new ej(null,void 0,t);return ej.#parseAST(e,n,0,t,0),n}toMMPattern(){if(this!==this.#root)return this.#root.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource(),a=r||this.#hasMagic||this.#options.nocase&&!this.#options.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase();if(!a)return n;let o=(this.#options.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,o),{_src:t,_glob:e})}get options(){return this.#options}toRegExpSource(e){let t=e??!!this.#options.dot;if(this.#root===this&&(this.#flatten(),this.#fillNegs()),!rj(this)){let n=this.isStart()&&this.isEnd(),r=this.#parts.map(t=>{let[r,i,a,o]=typeof t==`string`?ej.#parseGlob(t,this.#hasMagic,n):t.toRegExpSource(e);return this.#hasMagic=this.#hasMagic||a,this.#uflag=this.#uflag||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#parts[0]==`string`){let n=this.#parts.length===1&&dj.has(this.#parts[0]);if(!n){let n=uj,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?cj:o?lj:``}}let a=``;this.isEnd()&&this.#root.#filledNegs&&this.#parent?.type===`!`&&(a=`(?:$|\\/)`);let o=i+r+a;return[o,$A(r),this.#hasMagic=!!this.#hasMagic,this.#uflag]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#partsToRegExp(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#parts=[e],t.type=null,t.#hasMagic=void 0,[e,$A(this.toString()),!1,!1]}let a=!n||e||t||!lj?``:this.#partsToRegExp(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#emptyExt)o=(this.isStart()&&!t?lj:``)+gj;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?lj:``)+hj+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,$A(i),this.#hasMagic=!!this.#hasMagic,this.#uflag]}#partsToRegExp(e){return this.#parts.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#uflag=this.#uflag||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#parseGlob(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(fj.has(c)?`\\`:``)+c,o=!1;continue}if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,c,l]=QA(e,s);if(c){i+=n,a||=r,s+=c-1,t||=l,o=!1;continue}}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?gj:hj,t=!0;continue}else o=!1;if(c===`?`){i+=mj,t=!0;continue}i+=pj(c)}return[i,$A(e),!!t,a]}};ej=_j;const vj=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),yj=(e,t,n={})=>(qA(t),!n.nocomment&&t.charAt(0)===`#`?!1:new nM(t,n).match(e)),bj=/^\*+([^+@!?\*\[\(]*)$/,xj=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Sj=e=>t=>t.endsWith(e),Cj=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),wj=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Tj=/^\*+\.\*+$/,Ej=e=>!e.startsWith(`.`)&&e.includes(`.`),Dj=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Oj=/^\.\*+$/,kj=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Aj=/^\*+$/,jj=e=>e.length!==0&&!e.startsWith(`.`),Mj=e=>e.length!==0&&e!==`.`&&e!==`..`,Nj=/^\?+([^+@!?\*\[\(]*)?$/,Pj=([e,t=``])=>{let n=Rj([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Fj=([e,t=``])=>{let n=zj([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Ij=([e,t=``])=>{let n=zj([e]);return t?e=>n(e)&&e.endsWith(t):n},Lj=([e,t=``])=>{let n=Rj([e]);return t?e=>n(e)&&e.endsWith(t):n},Rj=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},zj=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},Bj=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,Vj={win32:{sep:`\\`},posix:{sep:`/`}},Hj=Bj===`win32`?Vj.win32.sep:Vj.posix.sep;yj.sep=Hj;const Uj=Symbol(`globstar **`);yj.GLOBSTAR=Uj;const Wj=`[^/]`,Gj=Wj+`*?`,Kj=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,qj=`(?:(?!(?:\\/|^)\\.).)*?`,Jj=(e,t={})=>n=>yj(n,e,t);yj.filter=Jj;const Yj=(e,t={})=>Object.assign({},e,t),Xj=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return yj;let t=yj,n=(n,r,i={})=>t(n,r,Yj(e,i));return Object.assign(n,{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,Yj(e,n))}static defaults(n){return t.defaults(Yj(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,Yj(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,Yj(e,r))}},unescape:(n,r={})=>t.unescape(n,Yj(e,r)),escape:(n,r={})=>t.escape(n,Yj(e,r)),filter:(n,r={})=>t.filter(n,Yj(e,r)),defaults:n=>t.defaults(Yj(e,n)),makeRe:(n,r={})=>t.makeRe(n,Yj(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,Yj(e,r)),match:(n,r,i={})=>t.match(n,r,Yj(e,i)),sep:t.sep,GLOBSTAR:Uj})};yj.defaults=Xj;const Zj=(e,t={})=>(qA(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:BA(e));yj.braceExpand=Zj;const Qj=(e,t={})=>new nM(e,t).makeRe();yj.makeRe=Qj;const $j=(e,t,n={})=>{let r=new nM(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};yj.match=$j;const eM=/[?*]|[+@!]\(.*?\)|\[|\]/,tM=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var nM=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){qA(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Bj,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!eM.test(e[2]))&&!eM.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`,r=e?[`.`]:[];n.splice(i-1,2,...r),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Uj)?this.#matchGlobstar(e,t,n,r,i):this.#matchOne(e,t,n,r,i)}#matchGlobstar(e,t,n,r,i){let a=t.indexOf(Uj,i),o=t.lastIndexOf(Uj),[s,c,l]=[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#matchOne(t,s,n,0,0))return!1;r+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#matchOne(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#matchOne(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===Uj?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#matchGlobStarBodySections(e,d,r,0,n,0,!!u)}#matchGlobStarBodySections(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){let s=this.#matchOne(e.slice(0,n+c.length),c,i,n,0);if(s&&a<this.maxGlobstarRecursion){let s=this.#matchGlobStarBodySections(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let l=e[n];if(l===`.`||l===`..`||!this.options.dot&&l.startsWith(`.`))return!1;n++}return null}#matchOne(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===Uj)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return Zj(this.pattern,this.options)}parse(e){qA(e);let t=this.options;if(e===`**`)return Uj;if(e===``)return``;let n,r=null;(n=e.match(Aj))?r=t.dot?Mj:jj:(n=e.match(bj))?r=(t.nocase?t.dot?wj:Cj:t.dot?Sj:xj)(n[1]):(n=e.match(Nj))?r=(t.nocase?t.dot?Fj:Pj:t.dot?Ij:Lj)(n):(n=e.match(Tj))?r=t.dot?Dj:Ej:(n=e.match(Oj))&&(r=kj);let i=_j.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Gj:t.dot?Kj:qj,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?tM(e):e===Uj?Uj:e._src});return t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==Uj||a===Uj||(a===void 0?i!==void 0&&i!==Uj?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|`+n+`)?`:i!==Uj&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=Uj))}),t.filter(e=>e!==Uj).join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;n.matchBase&&o.length===1&&(s=[a]);let c=this.matchOne(s,o,t);if(c)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return yj.defaults(e).Minimatch}};yj.AST=_j,yj.Minimatch=nM,yj.escape=vj,yj.unescape=$A;var rM=e.__commonJSMin((exports,t)=>{var n=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){let n=this.delete(e);if(!n&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}};t.exports=n}),iM=e.__commonJSMin((exports,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({}),i=e=>e?typeof e==`object`?e:n:r;t.exports=i}),aM=e.__commonJSMin((exports,t)=>{let n=`2.0.0`,r=256,i=2**53-1||9007199254740991,a=16,o=r-6,s=[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`];t.exports={MAX_LENGTH:r,MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:i,RELEASE_TYPES:s,SEMVER_SPEC_VERSION:n,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}),oM=e.__commonJSMin((exports,t)=>{let n=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{};t.exports=n}),sM=e.__commonJSMin((exports,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=aM(),a=oM();exports=t.exports={};let o=exports.re=[],s=exports.safeRe=[],c=exports.src=[],l=exports.safeSrc=[],u=exports.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),exports.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),exports.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),exports.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)}),cM=e.__commonJSMin((exports,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1},i=(e,t)=>r(t,e);t.exports={compareIdentifiers:r,rcompareIdentifiers:i}}),lM=e.__commonJSMin((exports,t)=>{let n=oM(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=aM(),{safeRe:a,t:o}=sM(),s=iM(),{compareIdentifiers:c}=cM();var l=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}};t.exports=l}),uM=e.__commonJSMin((exports,t)=>{let n=lM(),r=(e,t,r)=>new n(e,r).compare(new n(t,r));t.exports=r}),dM=e.__commonJSMin((exports,t)=>{let n=uM(),r=(e,t,r)=>n(e,t,r)===0;t.exports=r}),fM=e.__commonJSMin((exports,t)=>{let n=uM(),r=(e,t,r)=>n(e,t,r)!==0;t.exports=r}),pM=e.__commonJSMin((exports,t)=>{let n=uM(),r=(e,t,r)=>n(e,t,r)>0;t.exports=r}),mM=e.__commonJSMin((exports,t)=>{let n=uM(),r=(e,t,r)=>n(e,t,r)>=0;t.exports=r}),hM=e.__commonJSMin((exports,t)=>{let n=uM(),r=(e,t,r)=>n(e,t,r)<0;t.exports=r}),gM=e.__commonJSMin((exports,t)=>{let n=uM(),r=(e,t,r)=>n(e,t,r)<=0;t.exports=r}),_M=e.__commonJSMin((exports,t)=>{let n=dM(),r=fM(),i=pM(),a=mM(),o=hM(),s=gM(),c=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}};t.exports=c}),vM=e.__commonJSMin((exports,t)=>{let n=Symbol(`SemVer ANY`);var r=class e{static get ANY(){return n}constructor(t,r){if(r=i(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),c(`comparator`,t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,c(`comp`,this)}parse(e){let t=this.options.loose?a[o.COMPARATORLOOSE]:a[o.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new l(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(c(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new l(e,this.options)}catch{return!1}return s(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new u(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new u(this.value,n).test(t.semver):(n=i(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||s(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||s(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};t.exports=r;let i=iM(),{safeRe:a,t:o}=sM(),s=_M(),c=oM(),l=lM(),u=yM()}),yM=e.__commonJSMin((exports,t)=>{let n=/\s+/g;var r=class e{constructor(t,r){if(r=o(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof s)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!_(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=(this.options.includePrerelease&&h)|(this.options.loose&&g),n=t+`:`+e,r=a.get(n);if(r)return r;let i=this.options.loose,o=i?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];e=e.replace(o,A(this.options.includePrerelease)),c(`hyphen replace`,e),e=e.replace(u[d.COMPARATORTRIM],f),c(`comparator trim`,e),e=e.replace(u[d.TILDETRIM],p),c(`tilde trim`,e),e=e.replace(u[d.CARETTRIM],m),c(`caret trim`,e);let l=e.split(` `).map(e=>b(e,this.options)).join(` `).split(/\s+/).map(e=>k(e,this.options));i&&(l=l.filter(e=>(c(`loose invalid filter`,e,this.options),!!e.match(u[d.COMPARATORLOOSE])))),c(`range list`,l);let v=new Map,y=l.map(e=>new s(e,this.options));for(let e of y){if(_(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let x=[...v.values()];return a.set(n,x),x}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>y(e,n)&&t.set.some(t=>y(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new l(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(j(this.set[t],e,this.options))return!0;return!1}};t.exports=r;let i=rM(),a=new i,o=iM(),s=vM(),c=oM(),l=lM(),{safeRe:u,t:d,comparatorTrimReplace:f,tildeTrimReplace:p,caretTrimReplace:m}=sM(),{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:g}=aM(),_=e=>e.value===`<0.0.0-0`,v=e=>e.value===``,y=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},b=(e,t)=>(e=e.replace(u[d.BUILD],``),c(`comp`,e,t),e=w(e,t),c(`caret`,e),e=S(e,t),c(`tildes`,e),e=E(e,t),c(`xrange`,e),e=O(e,t),c(`stars`,e),e),x=e=>!e||e.toLowerCase()===`x`||e===`*`,S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{let n=t.loose?u[d.TILDELOOSE]:u[d.TILDE];return e.replace(n,(t,n,r,i,a)=>{c(`tilde`,e,t,n,r,i,a);let o;return x(n)?o=``:x(r)?o=`>=${n}.0.0 <${+n+1}.0.0-0`:x(i)?o=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(c(`replaceTilde pr`,a),o=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):o=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,c(`tilde return`,o),o})},w=(e,t)=>e.trim().split(/\s+/).map(e=>T(e,t)).join(` `),T=(e,t)=>{c(`caret`,e,t);let n=t.loose?u[d.CARETLOOSE]:u[d.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,o)=>{c(`caret`,e,t,n,i,a,o);let s;return x(n)?s=``:x(i)?s=`>=${n}.0.0${r} <${+n+1}.0.0-0`:x(a)?s=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:o?(c(`replaceCaret pr`,o),s=n===`0`?i===`0`?`>=${n}.${i}.${a}-${o} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${o} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${o} <${+n+1}.0.0-0`):(c(`no pr`),s=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),c(`caret return`,s),s})},E=(e,t)=>(c(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>D(e,t)).join(` `)),D=(e,t)=>{e=e.trim();let n=t.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return e.replace(n,(n,r,i,a,o,s)=>{c(`xRange`,e,n,r,i,a,o,s);let l=x(i),u=l||x(a),d=u||x(o),f=d;return r===`=`&&f&&(r=``),s=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),o=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(s=`-0`),n=`${r+i}.${a}.${o}${s}`):u?n=`>=${i}.0.0${s} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),c(`xRange return`,n),n})},O=(e,t)=>(c(`replaceStars`,e,t),e.trim().replace(u[d.STAR],``)),k=(e,t)=>(c(`replaceGTE0`,e,t),e.trim().replace(u[t.includePrerelease?d.GTE0PRE:d.GTE0],``)),A=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=x(r)?``:x(i)?`>=${r}.0.0${e?`-0`:``}`:x(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=x(l)?``:x(u)?`<${+l+1}.0.0-0`:x(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),j=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(c(e[n].semver),e[n].semver!==s.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}}),bM=e.__commonJSMin((exports,t)=>{let n=yM(),r=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)};t.exports=r}),xM=e.__commonJSMin((exports,t)=>{let n=bM(),r=`assert.buffer.child_process.cluster.console.constants.crypto.dgram.dns.domain.events.fs.http.https.module.net.os.path.punycode.querystring.readline.repl.stream.string_decoder.sys.timers.tls.tty.url.util.vm.zlib`.split(`.`),i={freelist:`<6.0.0`,v8:`>=1.0.0`,process:`>=1.1.0`,inspector:`>=8.0.0`,async_hooks:`>=8.1.0`,http2:`>=8.4.0`,perf_hooks:`>=8.5.0`,trace_events:`>=10.0.0`,worker_threads:`>=12.0.0`,"node:test":`>=18.0.0`},a={worker_threads:`>=10.5.0`,wasi:`>=12.16.0`,diagnostics_channel:`^14.17.0 || >=15.1.0`};t.exports=({version:e=process.version,experimental:t=!1}={})=>{let o=[...r];for(let[t,r]of Object.entries(i))(e===`*`||n(e,r))&&o.push(t);if(t)for(let[t,r]of Object.entries(a))!o.includes(t)&&(e===`*`||n(e,r))&&o.push(t);return o}}),SM=e.__commonJSMin((exports,t)=>{var n=RegExp(`^(?:@([^/]+?)[/])?([^/]+?)$`),r=xM(),i=[`node_modules`,`favicon.ico`];function a(e){var t=[],a=[];if(e===null)return a.push(`name cannot be null`),o(t,a);if(e===void 0)return a.push(`name cannot be undefined`),o(t,a);if(typeof e!=`string`)return a.push(`name must be a string`),o(t,a);if(e.length||a.push(`name length must be greater than zero`),e.match(/^\./)&&a.push(`name cannot start with a period`),e.match(/^_/)&&a.push(`name cannot start with an underscore`),e.trim()!==e&&a.push(`name cannot contain leading or trailing spaces`),i.forEach(function(t){e.toLowerCase()===t&&a.push(t+` is a blacklisted name`)}),r({version:`*`}).forEach(function(n){e.toLowerCase()===n&&t.push(n+` is a core module name`)}),e.length>214&&t.push(`name can no longer contain more than 214 characters`),e.toLowerCase()!==e&&t.push(`name can no longer contain capital letters`),/[~'!()*]/.test(e.split(`/`).slice(-1)[0])&&t.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(e)!==e){var s=e.match(n);if(s){var c=s[1],l=s[2];if(encodeURIComponent(c)===c&&encodeURIComponent(l)===l)return o(t,a)}a.push(`name can only contain URL-friendly characters`)}return o(t,a)}var o=function(e,t){var n={validForNewPackages:t.length===0&&e.length===0,validForOldPackages:t.length===0,warnings:e,errors:t};return n.warnings.length||delete n.warnings,n.errors.length||delete n.errors,n};t.exports=a});function CM({project:e}){let t=e.workspaceData.workspaces,n=t.map(t=>l.default.relative(e.paths.root,t.paths.root)),r=new Set;for(let t of e.workspaceData.globs)if(!n.includes(t)&&!t.startsWith(`!`)){let e=t.split(`/`),n=e[0];r.add(n)}return Array.from(r)}function wM({project:e,workspace:t}){return l.default.relative(e.paths.root,t.paths.root).split(l.default.sep)[0]}function TM({project:e}){let t=CM({project:e}),n=t.includes(`apps`),r=t.includes(`packages`),i={},a=[];for(let t of e.workspaceData.workspaces){let n=wM({project:e,workspace:t});n!==`apps`&&a.push(t),n in i||(i[n]=[]),i[n].push(t)}return{hasRootApps:n,hasRootPackages:r,workspacesByGroup:i,nonAppWorkspaces:a}}function EM({project:e,type:t,showAllDependencies:n}){let r=TM({project:e}),i=[],a=e.workspaceData.workspaces;n||(t===`app`&&r.hasRootApps?a=r.workspacesByGroup.apps:t===`package`&&r.nonAppWorkspaces.length>0&&(a=r.nonAppWorkspaces));let o;for(let t of a){let n=wM({project:e,workspace:t});n!==o&&i.push(new A.Separator(n)),o=n,i.push(t)}return i}var DM=e.__toESM(yv()),OM=e.__toESM(SM());async function kM({override:e,suggestion:t,workspaceType:n}){let{validForNewPackages:r}=(0,OM.default)(e||``);if(e&&r)return{answer:e};let i=await(0,A.input)({message:`What is the name of the ${n}?`,default:t,validate:e=>{let{validForNewPackages:t}=(0,OM.default)(e);return t||`Invalid ${n} name`}});return{answer:i}}async function AM({override:e,message:t}){if(e)return{answer:e};let n=await(0,A.select)({message:t??`What type of workspace should be added?`,choices:[{name:`app`,value:`app`},{name:`package`,value:`package`}]});return{answer:n}}async function jM({workspaceType:e,workspaceName:t,destination:n,project:r}){let i=t.includes(`/`)?t.split(`/`)[1]:t;if(n){let{valid:e,root:t}=Eo(n);if(e)return{absolute:t,relative:l.default.relative(r.paths.root,t)}}let a,o=TM({project:r});e===`app`&&o.hasRootApps?a=`${r.paths.root}/apps/${i}`:e===`package`&&o.hasRootPackages&&(a=`${r.paths.root}/packages/${i}`);let s=await(0,A.input)({message:`Where should "${t}" be added?`,default:a?l.default.relative(r.paths.root,a):void 0,validate:e=>{let t=l.default.join(r.paths.root,e),{valid:n,error:i}=Eo(t),a=r.workspaceData.globs.some(t=>yj(e,t));return n&&a?!0:a?i??`Invalid directory`:`${e} is not a valid workspace location`}});return{absolute:l.default.join(r.paths.root,s),relative:s}}async function MM({override:e,workspaces:t,workspaceName:n}){if(e){let n=t.find(t=>t instanceof A.Separator?!1:t.name===e);if(n)return{answer:n};Yi(`Workspace "${e}" not found`),Ji()}let r=await(0,A.select)({message:`Which workspace should "${n}" start from?`,loop:!1,pageSize:25,choices:t.map(e=>e instanceof A.Separator?e:{name:` ${e.name}`,value:e})});return{answer:r}}async function NM({workspaceName:e,project:t,workspaceSource:n,showAllDependencies:r}){let i={dependencies:{},devDependencies:{},peerDependencies:{},optionalDependencies:{}},{answer:a}=await PM({message:`Add workspace dependencies to "${e}"?`});if(!a)return i;let o=await(0,A.checkbox)({message:`Select all dependencies types to modify for "${e}"`,loop:!1,choices:[{name:`dependencies`,value:`dependencies`},{name:`devDependencies`,value:`devDependencies`},{name:`peerDependencies`,value:`peerDependencies`},{name:`optionalDependencies`,value:`optionalDependencies`}]}),s=EM({project:t,type:`package`,showAllDependencies:r}),c=n?DM.default.readJsonSync(n.paths.packageJson):void 0;for(let n of o){let r=await(0,A.checkbox)({message:`Which packages should be added as ${n} to "${e}?`,pageSize:15,loop:!1,choices:s.map(e=>e instanceof A.Separator?e:{name:` ${e.name}`,value:e.name})}),a=c?.[n]||{};if(Object.keys(a).length){let e=new Set(Object.keys(a));for(let n of r)e.has(n)||(a[n]=t.packageManager===`pnpm`?`workspace:*`:`*`);i[n]=a}else i[n]=r.reduce((e,n)=>({...e,[n]:t.packageManager===`pnpm`?`workspace:*`:`*`}),{})}return i}async function PM({message:e}){let t=await(0,A.confirm)({message:e});return{answer:t}}async function FM({project:e,opts:t}){let n,r=t.method===`copy`&&t.copy.type===`external`?t.examplePath?.split(`/`).pop()||t.copy.source.split(`/`).pop():void 0,{answer:i}=await AM({override:t.type,message:t.method===`copy`&&t.copy.source===`external`&&r?`What type of workspace should "${r}" be created as?`:void 0}),{answer:a}=await kM({override:t.name,workspaceType:i,suggestion:r});if(t.method===`copy`&&t.copy.type===`internal`){let{answer:r}=await MM({override:t.copy.source,workspaces:EM({project:e,type:i}),workspaceName:a});n=r}let o=await jM({workspaceType:i,workspaceName:a,project:e,destination:t.destination}),s=await NM({workspaceName:a,project:e,workspaceSource:n,showAllDependencies:t.showAllDependencies});return{type:i,name:a,location:o,source:n,dependencies:s}}var IM=e.__toESM(yv()),LM=e.__toESM(M());async function RM({project:e,opts:t}){let{name:n,location:r,dependencies:i}=await FM({project:e,opts:t}),a={name:n,version:`0.0.0`,private:!0,scripts:{dev:`echo 'Add dev script here'`,build:`echo 'Add build script here'`,test:`echo 'Add test script here'`,lint:`echo 'Add lint script here'`}};for(let e of Object.keys(i)){let t=i[e];t&&Object.keys(t).length>0&&(a[e]={...a[e],...t})}IM.default.mkdirSync(r.absolute,{recursive:!0}),IM.default.writeFileSync(l.default.join(r.absolute,`package.json`),JSON.stringify(a,null,2)),IM.default.writeFileSync(l.default.join(r.absolute,`README.md`),`# \`${n}\``),Ji(),Ji(`${LM.default.bold(zi(`>>> Success!`))} Created ${n} at "${r.relative}"`)}var zM=e.__toESM(yv()),BM=e.__toESM(M());async function VM({project:e,opts:t}){let{name:n,type:r,location:i,source:a,dependencies:o}=await FM({project:e,opts:t}),s=l.default.join(i.absolute,`package.json`);if(t.copy.type===`external`){Ji(),Yi(`Some manual modifications may be required.`),Ki(`This ${r} may require local dependencies or a different package manager than what is available in this repo`),await yh({appPath:i.absolute,example:t.copy.source,examplePath:t.examplePath});try{if(zM.default.existsSync(s)){let e=await zM.default.readJSON(s);if(e.workspaces)throw Error(`New workspace root detected - unexpected 'workspaces' field in package.json`)}else throw Error(`New workspace is missing a package.json file`);if(zM.default.existsSync(l.default.join(i.absolute,`pnpm-workspace.yaml`)))throw Error(`New workspace root detected - unexpected pnpm-workspace.yaml`)}catch(e){let t=`UNKNOWN_ERROR`;e instanceof Error&&(t=e.message),Xi(t),await zM.default.rm(i.absolute,{recursive:!0,force:!0});return}}else if(a){let e=async e=>!e.includes(`node_modules`),t=Ui(`Creating "${n}" from "${a.name}"...`);t.start(),await zM.default.copy(a.paths.root,i.absolute,{filter:e}),t.stop()}let c=await zM.default.readJSON(s);c.name=n;for(let e of Object.keys(o)){let t=o[e];t&&Object.keys(t).length>0&&(c[e]={...c[e],...t})}await zM.default.writeJSON(s,c,{spaces:2}),Ji(),Ji(`${BM.default.bold(zi(`>>> Success!`))} Created ${n} at "${i.relative}"`)}function HM(e){let{copy:t,...n}=e,r=t===!0||typeof t==`string`?`copy`:`empty`,i=typeof t==`string`?t:``,a=typeof t==`string`&&t.startsWith(`https://`)?`external`:`internal`;return{method:r,copy:{type:a,source:i},...n}}async function UM(e){let t=await G_(e),n=HM(e);Ji();let r={project:t,opts:n};n.method===`copy`?(n.copy.type===`external`?Wi(`Copy a remote workspace from ${n.copy.source}`):Wi(`Copy an existing workspace from "${t.name}"`),Ji(),await VM(r)):(Wi(`Add an empty workspace to "${t.name}"`),Ji(),await RM(r))}async function WM(e,t){let n=await G_(t);Ji(),Wi(`Modify "${n.name}" using custom generators`),Ji(),await gA({generator:e,project:n,opts:t})}function GM(e){try{let t=JSON.parse(e),n={};for(let e in t){let r=bh(e,{to:`camel`});n[r]=t[e]}return n}catch(e){Xi(`Error parsing arguments`,e),process.exit(1)}}async function KM(e,t){if(e===`workspace`){let e=GM(t.json);e.showAllDependencies=e.showAllDependencies??!1;let n=!1,r=e.empty||!0;e.copy===``||e.copy===!0?(n=!0,r=!1):e.copy&&e.copy.length>0&&(n=e.copy,r=!1),e.copy=n,e.empty=r,await UM(e)}else if(e===`run`){let e=GM(t.json),{generatorName:n,...r}=e;await WM(n,r)}else Xi(`Received unknown command - "${e}" (must be one of "workspace" | "run")`),process.exit(1)}var qM=e.__toESM(M());const JM=Ph({packageInfo:Tg}),YM=new ug;n.default.globalAgent=YM,r.default.globalAgent=YM;const XM=new ee;XM.name(qM.default.bold(zi(`@turbo/gen`))).description(`Extend your Turborepo`).version(Tg.version,`-v, --version`,`Output the current version`).helpOption(`-h, --help`,`Display help for command`).showHelpAfterError(!1),XM.command(`run`,{isDefault:!0}).alias(`r`).description(`Run custom generators`).addArgument(new J(`[generator-name]`,`The name of the generator to run`)).addOption(new Y(`-c, --config <config>`,`Generator configuration file (default: turbo/generators/config.js`)).addOption(new Y(`-r, --root <dir>`,`The root of your repository (default: directory with root turbo.json)`)).addOption(new Y(`-a, --args <args...>`,`Arguments passed directly to generator`).default([])).action(WM),XM.command(`workspace`).aliases([`w`]).description(`Add a new package or app to your project`).addOption(new Y(`-n, --name <workspace-name>`,`Name for the new workspace`)).addOption(new Y(`-b, --empty`,`Generate an empty workspace`).conflicts(`copy`).default(!0)).addOption(new Y(`-c, --copy [source]`,`Generate a workspace using an existing workspace as a template. Can be the name of a local workspace
|
|
372
|
+
`}]}};var mA=e.__toESM(yv());async function hA({project:e,template:t}){let n=l.default.join(e.paths.root,`turbo`,`generators`),r=`simple-${t}`,i=pA[r];if(!i)throw new Uk(`Unknown template "${r}"`,{type:`config_directory_already_exists`});if(await mA.default.pathExists(n))throw new Uk(`Generator config directory already exists at ${n}`,{type:`config_directory_already_exists`});for(let e of i.files){let t=l.default.join(n,e.relativePath);await mA.default.outputFile(t,e.content)}}async function gA({generator:e,project:t,opts:n}){let r=!1,i=await Zk({project:t,configPath:n.config});if(!i.length){Xi(`No generators found.`),Ji();let{answer:e}=await fA({message:`Would you like to add a config with a sample custom generator to ${t.name}?`});if(e){r=!0;let{answer:e}=await dA();try{await hA({project:t,template:e})}catch(e){throw e instanceof Uk||Xi(`Failed to create generator config`),e}if(Ji(),Wi(`Generator config successfully created!`),Wi(`Loading generator config...`),Ji(),i=await Zk({project:t,configPath:n.config}),!i.length){Xi(`Error loading generator`);return}}else{Ji(),Ki(`Learn more about custom Turborepo generators - https://turborepo.dev/docs/guides/generating-code#custom-generators`);return}}let{selectedGenerator:a}=await uA({generators:i,generator:e});try{await cA({project:t,generator:a,bypassArgs:n.args,configPath:n.config})}catch(e){if(e instanceof Uk)throw e;let t=`Failed to run generator`;throw e instanceof Error&&(t=e.message),new Uk(t,{type:`plop_error_running_generator`})}finally{r&&(Ji(),Wi(`Congrats! You just ran your first Turborepo generator`),Ki(`Learn more about custom Turborepo generators - https://turborepo.dev/docs/guides/generating-code#custom-generators`))}Ji(),Gi(zi(`>>> Success!`))}const _A=(e,t,n)=>{let r=e instanceof RegExp?vA(e,n):e,i=t instanceof RegExp?vA(t,n):t,a=r!==null&&i!=null&&yA(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},vA=(e,t)=>{let n=t.match(e);return n?n[0]:null},yA=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},bA=`\0SLASH`+Math.random()+`\0`,xA=`\0OPEN`+Math.random()+`\0`,SA=`\0CLOSE`+Math.random()+`\0`,CA=`\0COMMA`+Math.random()+`\0`,wA=`\0PERIOD`+Math.random()+`\0`,TA=new RegExp(bA,`g`),EA=new RegExp(xA,`g`),DA=new RegExp(SA,`g`),OA=new RegExp(CA,`g`),kA=new RegExp(wA,`g`),AA=/\\\\/g,jA=/\\{/g,MA=/\\}/g,NA=/\\,/g,PA=/\\\./g,FA=1e5,IA=4e6;function LA(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function RA(e){return e.replace(AA,bA).replace(jA,xA).replace(MA,SA).replace(NA,CA).replace(PA,wA)}function zA(e){return e.replace(TA,`\\`).replace(EA,`{`).replace(DA,`}`).replace(OA,`,`).replace(kA,`.`)}function BA(e){if(!e)return[``];let t=[],n=_A(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=BA(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function VA(e,t={}){if(!e)return[];let{max:n=FA,maxLength:r=IA}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),JA(RA(e),n,r,!0).map(zA)}function HA(e){return`{`+e+`}`}function UA(e){return/^-?0\d/.test(e)}function WA(e,t){return e<=t}function GA(e,t){return e>=t}function KA(e,t,n,r,i,a){let o=[],s=0;for(let c=0;c<e.length;c++)for(let l=0;l<n.length;l++){if(o.length>=r)return o;let u=e[c]+t+n[l];if(!(a&&!u)){if(s+u.length>i)return o;o.push(u),s+=u.length}}return o}function qA(e,t,n){let r=e.split(/\.\./),i=[];if(r[0]===void 0||r[1]===void 0)return i;let a=LA(r[0]),o=LA(r[1]),s=Math.max(r[0].length,r[1].length),c=r.length===3&&r[2]!==void 0?Math.max(Math.abs(LA(r[2])),1):1,l=WA,u=o<a;u&&(c*=-1,l=GA);let d=r.some(UA);for(let e=a;l(e,o)&&i.length<n;e+=c){let n;if(t)n=String.fromCharCode(e),n===`\\`&&(n=``);else if(n=String(e),d){let t=s-n.length;if(t>0){let r=Array(t+1).join(`0`);n=e<0?`-`+r+n.slice(1):r+n}}i.push(n)}return i}function JA(e,t,n,r){let i=[``],a=!1,o=!0;for(;;){let s=_A(`{`,`}`,e);if(!s)return KA(i,e,[``],t,n,a);let c=s.pre;if(/\$$/.test(c)){if(i=KA(i,c+`{`+s.body+`}`,[``],t,n,a&&!s.post.length),o=!1,!s.post.length)break;e=s.post;continue}let l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),d=l||u,f=s.body.indexOf(`,`)>=0;if(!d&&!f){if(s.post.match(/,(?!,).*\}/)){e=s.pre+`{`+s.body+SA+s.post,r=!0;continue}return KA(i,c+`{`+s.body+`}`+s.post,[``],t,n,a)}o&&(a=r&&!d,o=!1);let p;if(d)p=qA(s.body,u,t);else{let r=BA(s.body);if(r.length===1&&r[0]!==void 0&&(r=JA(r[0],t,n,!1).map(HA),r.length===1)){if(i=KA(i,c+r[0],[``],t,n,a&&!s.post.length),!s.post.length)break;e=s.post;continue}p=[];for(let e=0;e<r.length;e++)p.push.apply(p,JA(r[e],t,n,!1))}if(i=KA(i,c,p,t,n,a&&!s.post.length),!s.post.length)break;e=s.post}return i}const YA=1024*64,XA=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>YA)throw TypeError(`pattern is too long`)},ZA={"[: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]},QA=e=>e.replace(/[[\]\\-]/g,`\\$&`),$A=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),ej=e=>e.join(``),tj=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(ZA))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(QA(d)+`-`+QA(t)):t===d&&r.push(QA(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(QA(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(QA(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let e=r[0].length===2?r[0].slice(-1):r[0];return[$A(e),!1,u-n,!1]}let f=`[`+(l?`^`:``)+ej(r)+`]`,p=`[`+(l?``:`^`)+ej(i)+`]`,m=r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p;return[m,s,u-n,!0]},nj=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`);var rj;const ij=new Set([`!`,`?`,`+`,`*`,`@`]),aj=e=>ij.has(e),oj=e=>aj(e.type),sj=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),cj=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),lj=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),uj=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),dj=`(?!(?:^|/)\\.\\.?(?:$|/))`,fj=`(?!\\.)`,pj=new Set([`[`,`.`]),mj=new Set([`..`,`.`]),hj=new Set(`().*{}+?[]^$\\!`),gj=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),_j=`[^/]`,vj=_j+`*?`,yj=_j+`+?`;var bj=class{type;#root;#hasMagic;#uflag=!1;#parts=[];#parent;#parentIndex;#negs;#filledNegs=!1;#options;#toString;#emptyExt=!1;constructor(e,t,n={}){this.type=e,e&&(this.#hasMagic=!0),this.#parent=t,this.#root=this.#parent?this.#parent.#root:this,this.#options=this.#root===this?n:this.#root.#options,this.#negs=this.#root===this?[]:this.#root.#negs,e===`!`&&!this.#root.#filledNegs&&this.#negs.push(this),this.#parentIndex=this.#parent?this.#parent.#parts.length:0}get hasMagic(){if(this.#hasMagic!==void 0)return this.#hasMagic;for(let e of this.#parts){if(typeof e==`string`)continue;if(e.type||e.hasMagic)return this.#hasMagic=!0}return this.#hasMagic}toString(){return this.#toString===void 0?this.type?this.#toString=this.type+`(`+this.#parts.map(e=>String(e)).join(`|`)+`)`:this.#toString=this.#parts.map(e=>String(e)).join(``):this.#toString}#fillNegs(){if(this!==this.#root)throw Error(`should only call on root`);if(this.#filledNegs)return this;this.toString(),this.#filledNegs=!0;let e;for(;e=this.#negs.pop();){if(e.type!==`!`)continue;let t=e,n=t.#parent;for(;n;){for(let r=t.#parentIndex+1;!n.type&&r<n.#parts.length;r++)for(let t of e.#parts){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#parts[r])}t=n,n=t.#parent}}return this}push(...e){for(let t of e){if(t===``)continue;if(typeof t!=`string`&&!(t instanceof rj&&t.#parent===this))throw Error(`invalid part: `+t);this.#parts.push(t)}}toJSON(){let e=this.type===null?this.#parts.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#parts.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#root||this.#root.#filledNegs&&this.#parent?.type===`!`)&&e.push({}),e}isStart(){if(this.#root===this)return!0;if(!this.#parent?.isStart())return!1;if(this.#parentIndex===0)return!0;let e=this.#parent;for(let t=0;t<this.#parentIndex;t++){let n=e.#parts[t];if(!(n instanceof rj&&n.type===`!`))return!1}return!0}isEnd(){if(this.#root===this||this.#parent?.type===`!`)return!0;if(!this.#parent?.isEnd())return!1;if(!this.type)return this.#parent?.isEnd();let e=this.#parent?this.#parent.#parts.length:0;return this.#parentIndex===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new rj(this.type,e);for(let e of this.#parts)t.copyIn(e);return t}static#parseAST(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}let f=!r.noext&&aj(n)&&e.charAt(u)===`(`&&i<=a;if(f){t.push(d),d=``;let a=new rj(n,t);u=rj.#parseAST(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new rj(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}let m=aj(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#canAdoptType(n));if(m){let a=t&&t.#canAdoptType(n)?0:1;d.push(p),p=``;let o=new rj(n,d);d.push(o),u=rj.#parseAST(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new rj(null,t);continue}if(n===`)`)return p===``&&t.#parts.length===0&&(t.#emptyExt=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#hasMagic=void 0,t.#parts=[e.substring(n-1)],u}#canAdoptWithSpace(e){return this.#canAdopt(e,cj)}#canAdopt(e,t=sj){if(!e||typeof e!=`object`||e.type!==null||e.#parts.length!==1||this.type===null)return!1;let n=e.#parts[0];return!n||typeof n!=`object`||n.type===null?!1:this.#canAdoptType(n.type,t)}#canAdoptType(e,t=lj){return!!t.get(this.type)?.includes(e)}#adoptWithSpace(e,t){let n=e.#parts[0],r=new rj(null,n,this.options);r.#parts.push(``),n.push(r),this.#adopt(e,t)}#adopt(e,t){let n=e.#parts[0];this.#parts.splice(t,1,...n.#parts);for(let e of n.#parts)typeof e==`object`&&(e.#parent=this);this.#toString=void 0}#canUsurpType(e){let t=uj.get(this.type);return!!t?.has(e)}#canUsurp(e){if(!e||typeof e!=`object`||e.type!==null||e.#parts.length!==1||this.type===null||this.#parts.length!==1)return!1;let t=e.#parts[0];return!t||typeof t!=`object`||t.type===null?!1:this.#canUsurpType(t.type)}#usurp(e){let t=uj.get(this.type),n=e.#parts[0],r=t?.get(n.type);if(!r)return!1;this.#parts=n.#parts;for(let e of this.#parts)typeof e==`object`&&(e.#parent=this);this.type=r,this.#toString=void 0,this.#emptyExt=!1}#flatten(){if(oj(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#parts.length;e++){let n=this.#parts[e];typeof n==`object`&&(n.#flatten(),this.#canAdopt(n)?(t=!1,this.#adopt(n,e)):this.#canAdoptWithSpace(n)?(t=!1,this.#adoptWithSpace(n,e)):this.#canUsurp(n)&&(t=!1,this.#usurp(n)))}}while(!t&&++e<10)}else for(let e of this.#parts)typeof e==`object`&&e.#flatten();this.#toString=void 0}static fromGlob(e,t={}){let n=new rj(null,void 0,t);return rj.#parseAST(e,n,0,t,0),n}toMMPattern(){if(this!==this.#root)return this.#root.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource(),a=r||this.#hasMagic||this.#options.nocase&&!this.#options.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase();if(!a)return n;let o=(this.#options.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,o),{_src:t,_glob:e})}get options(){return this.#options}toRegExpSource(e){let t=e??!!this.#options.dot;if(this.#root===this&&(this.#flatten(),this.#fillNegs()),!oj(this)){let n=this.isStart()&&this.isEnd(),r=this.#parts.map(t=>{let[r,i,a,o]=typeof t==`string`?rj.#parseGlob(t,this.#hasMagic,n):t.toRegExpSource(e);return this.#hasMagic=this.#hasMagic||a,this.#uflag=this.#uflag||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#parts[0]==`string`){let n=this.#parts.length===1&&mj.has(this.#parts[0]);if(!n){let n=pj,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?dj:o?fj:``}}let a=``;this.isEnd()&&this.#root.#filledNegs&&this.#parent?.type===`!`&&(a=`(?:$|\\/)`);let o=i+r+a;return[o,nj(r),this.#hasMagic=!!this.#hasMagic,this.#uflag]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#partsToRegExp(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#parts=[e],t.type=null,t.#hasMagic=void 0,[e,nj(this.toString()),!1,!1]}let a=!n||e||t||!fj?``:this.#partsToRegExp(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#emptyExt)o=(this.isStart()&&!t?fj:``)+yj;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?fj:``)+vj+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,nj(i),this.#hasMagic=!!this.#hasMagic,this.#uflag]}#partsToRegExp(e){return this.#parts.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#uflag=this.#uflag||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#parseGlob(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(hj.has(c)?`\\`:``)+c,o=!1;continue}if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,c,l]=tj(e,s);if(c){i+=n,a||=r,s+=c-1,t||=l,o=!1;continue}}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?yj:vj,t=!0;continue}else o=!1;if(c===`?`){i+=_j,t=!0;continue}i+=gj(c)}return[i,nj(e),!!t,a]}};rj=bj;const xj=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),Sj=(e,t,n={})=>(XA(t),!n.nocomment&&t.charAt(0)===`#`?!1:new aM(t,n).match(e)),Cj=/^\*+([^+@!?\*\[\(]*)$/,wj=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Tj=e=>t=>t.endsWith(e),Ej=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Dj=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Oj=/^\*+\.\*+$/,kj=e=>!e.startsWith(`.`)&&e.includes(`.`),Aj=e=>e!==`.`&&e!==`..`&&e.includes(`.`),jj=/^\.\*+$/,Mj=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Nj=/^\*+$/,Pj=e=>e.length!==0&&!e.startsWith(`.`),Fj=e=>e.length!==0&&e!==`.`&&e!==`..`,Ij=/^\?+([^+@!?\*\[\(]*)?$/,Lj=([e,t=``])=>{let n=Vj([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Rj=([e,t=``])=>{let n=Hj([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},zj=([e,t=``])=>{let n=Hj([e]);return t?e=>n(e)&&e.endsWith(t):n},Bj=([e,t=``])=>{let n=Vj([e]);return t?e=>n(e)&&e.endsWith(t):n},Vj=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},Hj=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},Uj=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,Wj={win32:{sep:`\\`},posix:{sep:`/`}},Gj=Uj===`win32`?Wj.win32.sep:Wj.posix.sep;Sj.sep=Gj;const Kj=Symbol(`globstar **`);Sj.GLOBSTAR=Kj;const qj=`[^/]`,Jj=qj+`*?`,Yj=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,Xj=`(?:(?!(?:\\/|^)\\.).)*?`,Zj=(e,t={})=>n=>Sj(n,e,t);Sj.filter=Zj;const Qj=(e,t={})=>Object.assign({},e,t),$j=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return Sj;let t=Sj,n=(n,r,i={})=>t(n,r,Qj(e,i));return Object.assign(n,{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,Qj(e,n))}static defaults(n){return t.defaults(Qj(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,Qj(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,Qj(e,r))}},unescape:(n,r={})=>t.unescape(n,Qj(e,r)),escape:(n,r={})=>t.escape(n,Qj(e,r)),filter:(n,r={})=>t.filter(n,Qj(e,r)),defaults:n=>t.defaults(Qj(e,n)),makeRe:(n,r={})=>t.makeRe(n,Qj(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,Qj(e,r)),match:(n,r,i={})=>t.match(n,r,Qj(e,i)),sep:t.sep,GLOBSTAR:Kj})};Sj.defaults=$j;const eM=(e,t={})=>(XA(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:VA(e));Sj.braceExpand=eM;const tM=(e,t={})=>new aM(e,t).makeRe();Sj.makeRe=tM;const nM=(e,t,n={})=>{let r=new aM(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};Sj.match=nM;const rM=/[?*]|[+@!]\(.*?\)|\[|\]/,iM=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var aM=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){XA(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Uj,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!rM.test(e[2]))&&!rM.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`,r=e?[`.`]:[];n.splice(i-1,2,...r),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(Kj)?this.#matchGlobstar(e,t,n,r,i):this.#matchOne(e,t,n,r,i)}#matchGlobstar(e,t,n,r,i){let a=t.indexOf(Kj,i),o=t.lastIndexOf(Kj),[s,c,l]=[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#matchOne(t,s,n,0,0))return!1;r+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#matchOne(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#matchOne(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===Kj?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#matchGlobStarBodySections(e,d,r,0,n,0,!!u)}#matchGlobStarBodySections(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){let s=this.#matchOne(e.slice(0,n+c.length),c,i,n,0);if(s&&a<this.maxGlobstarRecursion){let s=this.#matchGlobStarBodySections(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let l=e[n];if(l===`.`||l===`..`||!this.options.dot&&l.startsWith(`.`))return!1;n++}return null}#matchOne(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===Kj)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return eM(this.pattern,this.options)}parse(e){XA(e);let t=this.options;if(e===`**`)return Kj;if(e===``)return``;let n,r=null;(n=e.match(Nj))?r=t.dot?Fj:Pj:(n=e.match(Cj))?r=(t.nocase?t.dot?Dj:Ej:t.dot?Tj:wj)(n[1]):(n=e.match(Ij))?r=(t.nocase?t.dot?Rj:Lj:t.dot?zj:Bj)(n):(n=e.match(Oj))?r=t.dot?Aj:kj:(n=e.match(jj))&&(r=Mj);let i=bj.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Jj:t.dot?Yj:Xj,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?iM(e):e===Kj?Kj:e._src});return t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==Kj||a===Kj||(a===void 0?i!==void 0&&i!==Kj?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|`+n+`)?`:i!==Kj&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=Kj))}),t.filter(e=>e!==Kj).join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;n.matchBase&&o.length===1&&(s=[a]);let c=this.matchOne(s,o,t);if(c)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Sj.defaults(e).Minimatch}};Sj.AST=bj,Sj.Minimatch=aM,Sj.escape=xj,Sj.unescape=nj;var oM=e.__commonJSMin((exports,t)=>{var n=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){let n=this.delete(e);if(!n&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}};t.exports=n}),sM=e.__commonJSMin((exports,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({}),i=e=>e?typeof e==`object`?e:n:r;t.exports=i}),cM=e.__commonJSMin((exports,t)=>{let n=`2.0.0`,r=256,i=2**53-1||9007199254740991,a=16,o=r-6,s=[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`];t.exports={MAX_LENGTH:r,MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:i,RELEASE_TYPES:s,SEMVER_SPEC_VERSION:n,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}),lM=e.__commonJSMin((exports,t)=>{let n=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{};t.exports=n}),uM=e.__commonJSMin((exports,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=cM(),a=lM();exports=t.exports={};let o=exports.re=[],s=exports.safeRe=[],c=exports.src=[],l=exports.safeSrc=[],u=exports.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),exports.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),exports.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),exports.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)}),dM=e.__commonJSMin((exports,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1},i=(e,t)=>r(t,e);t.exports={compareIdentifiers:r,rcompareIdentifiers:i}}),fM=e.__commonJSMin((exports,t)=>{let n=lM(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=cM(),{safeRe:a,t:o}=uM(),s=sM(),{compareIdentifiers:c}=dM();var l=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}};t.exports=l}),pM=e.__commonJSMin((exports,t)=>{let n=fM(),r=(e,t,r)=>new n(e,r).compare(new n(t,r));t.exports=r}),mM=e.__commonJSMin((exports,t)=>{let n=pM(),r=(e,t,r)=>n(e,t,r)===0;t.exports=r}),hM=e.__commonJSMin((exports,t)=>{let n=pM(),r=(e,t,r)=>n(e,t,r)!==0;t.exports=r}),gM=e.__commonJSMin((exports,t)=>{let n=pM(),r=(e,t,r)=>n(e,t,r)>0;t.exports=r}),_M=e.__commonJSMin((exports,t)=>{let n=pM(),r=(e,t,r)=>n(e,t,r)>=0;t.exports=r}),vM=e.__commonJSMin((exports,t)=>{let n=pM(),r=(e,t,r)=>n(e,t,r)<0;t.exports=r}),yM=e.__commonJSMin((exports,t)=>{let n=pM(),r=(e,t,r)=>n(e,t,r)<=0;t.exports=r}),bM=e.__commonJSMin((exports,t)=>{let n=mM(),r=hM(),i=gM(),a=_M(),o=vM(),s=yM(),c=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}};t.exports=c}),xM=e.__commonJSMin((exports,t)=>{let n=Symbol(`SemVer ANY`);var r=class e{static get ANY(){return n}constructor(t,r){if(r=i(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),c(`comparator`,t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,c(`comp`,this)}parse(e){let t=this.options.loose?a[o.COMPARATORLOOSE]:a[o.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new l(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(c(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new l(e,this.options)}catch{return!1}return s(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new u(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new u(this.value,n).test(t.semver):(n=i(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||s(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||s(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};t.exports=r;let i=sM(),{safeRe:a,t:o}=uM(),s=bM(),c=lM(),l=fM(),u=SM()}),SM=e.__commonJSMin((exports,t)=>{let n=/\s+/g;var r=class e{constructor(t,r){if(r=o(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof s)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!_(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=(this.options.includePrerelease&&h)|(this.options.loose&&g),n=t+`:`+e,r=a.get(n);if(r)return r;let i=this.options.loose,o=i?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];e=e.replace(o,A(this.options.includePrerelease)),c(`hyphen replace`,e),e=e.replace(u[d.COMPARATORTRIM],f),c(`comparator trim`,e),e=e.replace(u[d.TILDETRIM],p),c(`tilde trim`,e),e=e.replace(u[d.CARETTRIM],m),c(`caret trim`,e);let l=e.split(` `).map(e=>b(e,this.options)).join(` `).split(/\s+/).map(e=>k(e,this.options));i&&(l=l.filter(e=>(c(`loose invalid filter`,e,this.options),!!e.match(u[d.COMPARATORLOOSE])))),c(`range list`,l);let v=new Map,y=l.map(e=>new s(e,this.options));for(let e of y){if(_(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let x=[...v.values()];return a.set(n,x),x}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>y(e,n)&&t.set.some(t=>y(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new l(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(j(this.set[t],e,this.options))return!0;return!1}};t.exports=r;let i=oM(),a=new i,o=sM(),s=xM(),c=lM(),l=fM(),{safeRe:u,t:d,comparatorTrimReplace:f,tildeTrimReplace:p,caretTrimReplace:m}=uM(),{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:g}=cM(),_=e=>e.value===`<0.0.0-0`,v=e=>e.value===``,y=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},b=(e,t)=>(e=e.replace(u[d.BUILD],``),c(`comp`,e,t),e=w(e,t),c(`caret`,e),e=S(e,t),c(`tildes`,e),e=E(e,t),c(`xrange`,e),e=O(e,t),c(`stars`,e),e),x=e=>!e||e.toLowerCase()===`x`||e===`*`,S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{let n=t.loose?u[d.TILDELOOSE]:u[d.TILDE];return e.replace(n,(t,n,r,i,a)=>{c(`tilde`,e,t,n,r,i,a);let o;return x(n)?o=``:x(r)?o=`>=${n}.0.0 <${+n+1}.0.0-0`:x(i)?o=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(c(`replaceTilde pr`,a),o=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):o=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,c(`tilde return`,o),o})},w=(e,t)=>e.trim().split(/\s+/).map(e=>T(e,t)).join(` `),T=(e,t)=>{c(`caret`,e,t);let n=t.loose?u[d.CARETLOOSE]:u[d.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,o)=>{c(`caret`,e,t,n,i,a,o);let s;return x(n)?s=``:x(i)?s=`>=${n}.0.0${r} <${+n+1}.0.0-0`:x(a)?s=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:o?(c(`replaceCaret pr`,o),s=n===`0`?i===`0`?`>=${n}.${i}.${a}-${o} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${o} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${o} <${+n+1}.0.0-0`):(c(`no pr`),s=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),c(`caret return`,s),s})},E=(e,t)=>(c(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>D(e,t)).join(` `)),D=(e,t)=>{e=e.trim();let n=t.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return e.replace(n,(n,r,i,a,o,s)=>{c(`xRange`,e,n,r,i,a,o,s);let l=x(i),u=l||x(a),d=u||x(o),f=d;return r===`=`&&f&&(r=``),s=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),o=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(s=`-0`),n=`${r+i}.${a}.${o}${s}`):u?n=`>=${i}.0.0${s} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),c(`xRange return`,n),n})},O=(e,t)=>(c(`replaceStars`,e,t),e.trim().replace(u[d.STAR],``)),k=(e,t)=>(c(`replaceGTE0`,e,t),e.trim().replace(u[t.includePrerelease?d.GTE0PRE:d.GTE0],``)),A=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=x(r)?``:x(i)?`>=${r}.0.0${e?`-0`:``}`:x(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=x(l)?``:x(u)?`<${+l+1}.0.0-0`:x(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),j=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(c(e[n].semver),e[n].semver!==s.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}}),CM=e.__commonJSMin((exports,t)=>{let n=SM(),r=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)};t.exports=r}),wM=e.__commonJSMin((exports,t)=>{let n=CM(),r=`assert.buffer.child_process.cluster.console.constants.crypto.dgram.dns.domain.events.fs.http.https.module.net.os.path.punycode.querystring.readline.repl.stream.string_decoder.sys.timers.tls.tty.url.util.vm.zlib`.split(`.`),i={freelist:`<6.0.0`,v8:`>=1.0.0`,process:`>=1.1.0`,inspector:`>=8.0.0`,async_hooks:`>=8.1.0`,http2:`>=8.4.0`,perf_hooks:`>=8.5.0`,trace_events:`>=10.0.0`,worker_threads:`>=12.0.0`,"node:test":`>=18.0.0`},a={worker_threads:`>=10.5.0`,wasi:`>=12.16.0`,diagnostics_channel:`^14.17.0 || >=15.1.0`};t.exports=({version:e=process.version,experimental:t=!1}={})=>{let o=[...r];for(let[t,r]of Object.entries(i))(e===`*`||n(e,r))&&o.push(t);if(t)for(let[t,r]of Object.entries(a))!o.includes(t)&&(e===`*`||n(e,r))&&o.push(t);return o}}),TM=e.__commonJSMin((exports,t)=>{var n=RegExp(`^(?:@([^/]+?)[/])?([^/]+?)$`),r=wM(),i=[`node_modules`,`favicon.ico`];function a(e){var t=[],a=[];if(e===null)return a.push(`name cannot be null`),o(t,a);if(e===void 0)return a.push(`name cannot be undefined`),o(t,a);if(typeof e!=`string`)return a.push(`name must be a string`),o(t,a);if(e.length||a.push(`name length must be greater than zero`),e.match(/^\./)&&a.push(`name cannot start with a period`),e.match(/^_/)&&a.push(`name cannot start with an underscore`),e.trim()!==e&&a.push(`name cannot contain leading or trailing spaces`),i.forEach(function(t){e.toLowerCase()===t&&a.push(t+` is a blacklisted name`)}),r({version:`*`}).forEach(function(n){e.toLowerCase()===n&&t.push(n+` is a core module name`)}),e.length>214&&t.push(`name can no longer contain more than 214 characters`),e.toLowerCase()!==e&&t.push(`name can no longer contain capital letters`),/[~'!()*]/.test(e.split(`/`).slice(-1)[0])&&t.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(e)!==e){var s=e.match(n);if(s){var c=s[1],l=s[2];if(encodeURIComponent(c)===c&&encodeURIComponent(l)===l)return o(t,a)}a.push(`name can only contain URL-friendly characters`)}return o(t,a)}var o=function(e,t){var n={validForNewPackages:t.length===0&&e.length===0,validForOldPackages:t.length===0,warnings:e,errors:t};return n.warnings.length||delete n.warnings,n.errors.length||delete n.errors,n};t.exports=a});function EM({project:e}){let t=e.workspaceData.workspaces,n=t.map(t=>l.default.relative(e.paths.root,t.paths.root)),r=new Set;for(let t of e.workspaceData.globs)if(!n.includes(t)&&!t.startsWith(`!`)){let e=t.split(`/`),n=e[0];r.add(n)}return Array.from(r)}function DM({project:e,workspace:t}){return l.default.relative(e.paths.root,t.paths.root).split(l.default.sep)[0]}function OM({project:e}){let t=EM({project:e}),n=t.includes(`apps`),r=t.includes(`packages`),i={},a=[];for(let t of e.workspaceData.workspaces){let n=DM({project:e,workspace:t});n!==`apps`&&a.push(t),n in i||(i[n]=[]),i[n].push(t)}return{hasRootApps:n,hasRootPackages:r,workspacesByGroup:i,nonAppWorkspaces:a}}function kM({project:e,type:t,showAllDependencies:n}){let r=OM({project:e}),i=[],a=e.workspaceData.workspaces;n||(t===`app`&&r.hasRootApps?a=r.workspacesByGroup.apps:t===`package`&&r.nonAppWorkspaces.length>0&&(a=r.nonAppWorkspaces));let o;for(let t of a){let n=DM({project:e,workspace:t});n!==o&&i.push(new A.Separator(n)),o=n,i.push(t)}return i}var AM=e.__toESM(yv()),jM=e.__toESM(TM());async function MM({override:e,suggestion:t,workspaceType:n}){let{validForNewPackages:r}=(0,jM.default)(e||``);if(e&&r)return{answer:e};let i=await(0,A.input)({message:`What is the name of the ${n}?`,default:t,validate:e=>{let{validForNewPackages:t}=(0,jM.default)(e);return t||`Invalid ${n} name`}});return{answer:i}}async function NM({override:e,message:t}){if(e)return{answer:e};let n=await(0,A.select)({message:t??`What type of workspace should be added?`,choices:[{name:`app`,value:`app`},{name:`package`,value:`package`}]});return{answer:n}}async function PM({workspaceType:e,workspaceName:t,destination:n,project:r}){let i=t.includes(`/`)?t.split(`/`)[1]:t;if(n){let{valid:e,root:t}=Eo(n);if(e)return{absolute:t,relative:l.default.relative(r.paths.root,t)}}let a,o=OM({project:r});e===`app`&&o.hasRootApps?a=`${r.paths.root}/apps/${i}`:e===`package`&&o.hasRootPackages&&(a=`${r.paths.root}/packages/${i}`);let s=await(0,A.input)({message:`Where should "${t}" be added?`,default:a?l.default.relative(r.paths.root,a):void 0,validate:e=>{let t=l.default.join(r.paths.root,e),{valid:n,error:i}=Eo(t),a=r.workspaceData.globs.some(t=>Sj(e,t));return n&&a?!0:a?i??`Invalid directory`:`${e} is not a valid workspace location`}});return{absolute:l.default.join(r.paths.root,s),relative:s}}async function FM({override:e,workspaces:t,workspaceName:n}){if(e){let n=t.find(t=>t instanceof A.Separator?!1:t.name===e);if(n)return{answer:n};Yi(`Workspace "${e}" not found`),Ji()}let r=await(0,A.select)({message:`Which workspace should "${n}" start from?`,loop:!1,pageSize:25,choices:t.map(e=>e instanceof A.Separator?e:{name:` ${e.name}`,value:e})});return{answer:r}}async function IM({workspaceName:e,project:t,workspaceSource:n,showAllDependencies:r}){let i={dependencies:{},devDependencies:{},peerDependencies:{},optionalDependencies:{}},{answer:a}=await LM({message:`Add workspace dependencies to "${e}"?`});if(!a)return i;let o=await(0,A.checkbox)({message:`Select all dependencies types to modify for "${e}"`,loop:!1,choices:[{name:`dependencies`,value:`dependencies`},{name:`devDependencies`,value:`devDependencies`},{name:`peerDependencies`,value:`peerDependencies`},{name:`optionalDependencies`,value:`optionalDependencies`}]}),s=kM({project:t,type:`package`,showAllDependencies:r}),c=n?AM.default.readJsonSync(n.paths.packageJson):void 0;for(let n of o){let r=await(0,A.checkbox)({message:`Which packages should be added as ${n} to "${e}?`,pageSize:15,loop:!1,choices:s.map(e=>e instanceof A.Separator?e:{name:` ${e.name}`,value:e.name})}),a=c?.[n]||{};if(Object.keys(a).length){let e=new Set(Object.keys(a));for(let n of r)e.has(n)||(a[n]=t.packageManager===`pnpm`?`workspace:*`:`*`);i[n]=a}else i[n]=r.reduce((e,n)=>({...e,[n]:t.packageManager===`pnpm`?`workspace:*`:`*`}),{})}return i}async function LM({message:e}){let t=await(0,A.confirm)({message:e});return{answer:t}}async function RM({project:e,opts:t}){let n,r=t.method===`copy`&&t.copy.type===`external`?t.examplePath?.split(`/`).pop()||t.copy.source.split(`/`).pop():void 0,{answer:i}=await NM({override:t.type,message:t.method===`copy`&&t.copy.source===`external`&&r?`What type of workspace should "${r}" be created as?`:void 0}),{answer:a}=await MM({override:t.name,workspaceType:i,suggestion:r});if(t.method===`copy`&&t.copy.type===`internal`){let{answer:r}=await FM({override:t.copy.source,workspaces:kM({project:e,type:i}),workspaceName:a});n=r}let o=await PM({workspaceType:i,workspaceName:a,project:e,destination:t.destination}),s=await IM({workspaceName:a,project:e,workspaceSource:n,showAllDependencies:t.showAllDependencies});return{type:i,name:a,location:o,source:n,dependencies:s}}var zM=e.__toESM(yv()),BM=e.__toESM(M());async function VM({project:e,opts:t}){let{name:n,location:r,dependencies:i}=await RM({project:e,opts:t}),a={name:n,version:`0.0.0`,private:!0,scripts:{dev:`echo 'Add dev script here'`,build:`echo 'Add build script here'`,test:`echo 'Add test script here'`,lint:`echo 'Add lint script here'`}};for(let e of Object.keys(i)){let t=i[e];t&&Object.keys(t).length>0&&(a[e]={...a[e],...t})}zM.default.mkdirSync(r.absolute,{recursive:!0}),zM.default.writeFileSync(l.default.join(r.absolute,`package.json`),JSON.stringify(a,null,2)),zM.default.writeFileSync(l.default.join(r.absolute,`README.md`),`# \`${n}\``),Ji(),Ji(`${BM.default.bold(zi(`>>> Success!`))} Created ${n} at "${r.relative}"`)}var HM=e.__toESM(yv()),UM=e.__toESM(M());async function WM({project:e,opts:t}){let{name:n,type:r,location:i,source:a,dependencies:o}=await RM({project:e,opts:t}),s=l.default.join(i.absolute,`package.json`);if(t.copy.type===`external`){Ji(),Yi(`Some manual modifications may be required.`),Ki(`This ${r} may require local dependencies or a different package manager than what is available in this repo`),await yh({appPath:i.absolute,example:t.copy.source,examplePath:t.examplePath});try{if(HM.default.existsSync(s)){let e=await HM.default.readJSON(s);if(e.workspaces)throw Error(`New workspace root detected - unexpected 'workspaces' field in package.json`)}else throw Error(`New workspace is missing a package.json file`);if(HM.default.existsSync(l.default.join(i.absolute,`pnpm-workspace.yaml`)))throw Error(`New workspace root detected - unexpected pnpm-workspace.yaml`)}catch(e){let t=`UNKNOWN_ERROR`;e instanceof Error&&(t=e.message),Xi(t),await HM.default.rm(i.absolute,{recursive:!0,force:!0});return}}else if(a){let e=async e=>!e.includes(`node_modules`),t=Ui(`Creating "${n}" from "${a.name}"...`);t.start(),await HM.default.copy(a.paths.root,i.absolute,{filter:e}),t.stop()}let c=await HM.default.readJSON(s);c.name=n;for(let e of Object.keys(o)){let t=o[e];t&&Object.keys(t).length>0&&(c[e]={...c[e],...t})}await HM.default.writeJSON(s,c,{spaces:2}),Ji(),Ji(`${UM.default.bold(zi(`>>> Success!`))} Created ${n} at "${i.relative}"`)}function GM(e){let{copy:t,...n}=e,r=t===!0||typeof t==`string`?`copy`:`empty`,i=typeof t==`string`?t:``,a=typeof t==`string`&&t.startsWith(`https://`)?`external`:`internal`;return{method:r,copy:{type:a,source:i},...n}}async function KM(e){let t=await G_(e),n=GM(e);Ji();let r={project:t,opts:n};n.method===`copy`?(n.copy.type===`external`?Wi(`Copy a remote workspace from ${n.copy.source}`):Wi(`Copy an existing workspace from "${t.name}"`),Ji(),await WM(r)):(Wi(`Add an empty workspace to "${t.name}"`),Ji(),await VM(r))}async function qM(e,t){let n=await G_(t);Ji(),Wi(`Modify "${n.name}" using custom generators`),Ji(),await gA({generator:e,project:n,opts:t})}function JM(e){try{let t=JSON.parse(e),n={};for(let e in t){let r=bh(e,{to:`camel`});n[r]=t[e]}return n}catch(e){Xi(`Error parsing arguments`,e),process.exit(1)}}async function YM(e,t){if(e===`workspace`){let e=JM(t.json);e.showAllDependencies=e.showAllDependencies??!1;let n=!1,r=e.empty||!0;e.copy===``||e.copy===!0?(n=!0,r=!1):e.copy&&e.copy.length>0&&(n=e.copy,r=!1),e.copy=n,e.empty=r,await KM(e)}else if(e===`run`){let e=JM(t.json),{generatorName:n,...r}=e;await qM(n,r)}else Xi(`Received unknown command - "${e}" (must be one of "workspace" | "run")`),process.exit(1)}var XM=e.__toESM(M());const ZM=Ph({packageInfo:Tg}),QM=new ug;n.default.globalAgent=QM,r.default.globalAgent=QM;const $M=new ee;$M.name(XM.default.bold(zi(`@turbo/gen`))).description(`Extend your Turborepo`).version(Tg.version,`-v, --version`,`Output the current version`).helpOption(`-h, --help`,`Display help for command`).showHelpAfterError(!1),$M.command(`run`,{isDefault:!0}).alias(`r`).description(`Run custom generators`).addArgument(new J(`[generator-name]`,`The name of the generator to run`)).addOption(new Y(`-c, --config <config>`,`Generator configuration file (default: turbo/generators/config.js`)).addOption(new Y(`-r, --root <dir>`,`The root of your repository (default: directory with root turbo.json)`)).addOption(new Y(`-a, --args <args...>`,`Arguments passed directly to generator`).default([])).action(qM),$M.command(`workspace`).aliases([`w`]).description(`Add a new package or app to your project`).addOption(new Y(`-n, --name <workspace-name>`,`Name for the new workspace`)).addOption(new Y(`-b, --empty`,`Generate an empty workspace`).conflicts(`copy`).default(!0)).addOption(new Y(`-c, --copy [source]`,`Generate a workspace using an existing workspace as a template. Can be the name of a local workspace
|
|
373
373
|
within your monorepo, or a fully qualified GitHub URL with any branch and/or subdirectory.
|
|
374
374
|
`).conflicts(`empty`)).addOption(new Y(`-d, --destination <dir>`,`Where the new workspace should be created`)).addOption(new Y(`-t, --type <type>`,`The type of workspace to create`).choices([`app`,`package`])).addOption(new Y(`-r, --root <dir>`,`The root of your repository (default: directory with root turbo.json)`)).addOption(new Y(`-p, --example-path <path-to-example>`,`In a rare case, your GitHub URL might contain a branch name with
|
|
375
375
|
a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).
|
|
376
376
|
In this case, you must specify the path to the example separately:
|
|
377
377
|
--example-path foo/bar
|
|
378
|
-
`).implies({copy:!0})).addOption(new Y(`--show-all-dependencies`,`Do not filter available dependencies by the workspace type`).default(!1)).action(
|
|
378
|
+
`).implies({copy:!0})).addOption(new Y(`--show-all-dependencies`,`Do not filter available dependencies by the workspace type`).default(!1)).action(KM),$M.command(`raw`,{hidden:!0}).argument(`<type>`,`The type of generator to run`).addOption(new Y(`--json <arguments>`,`Arguments as raw JSON`)).action(YM),$M.parseAsync().then(()=>ZM()).catch(async e=>{e?.name===`ExitPromptError`&&process.exit(0),Ji(),e instanceof Uk?Xi(e.message):(Xi(`Unexpected error. Please report it as a bug:`),Ji(e)),Ji(),await ZM(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turbo/gen",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.7",
|
|
4
4
|
"description": "Extend a Turborepo",
|
|
5
5
|
"homepage": "https://turborepo.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/fs-extra": "9.0.13",
|
|
31
31
|
"@types/node": "18.17.4",
|
|
32
32
|
"@types/validate-npm-package-name": "4.0.0",
|
|
33
|
-
"brace-expansion": "5.0.
|
|
33
|
+
"brace-expansion": "5.0.8",
|
|
34
34
|
"commander": "10.0.0",
|
|
35
35
|
"fs-extra": "10.1.0",
|
|
36
36
|
"handlebars": "4.7.9",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"typescript-7": "npm:typescript@7.0.1-rc",
|
|
45
45
|
"update-check": "1.5.4",
|
|
46
46
|
"validate-npm-package-name": "5.0.0",
|
|
47
|
+
"@turbo/utils": "0.0.0",
|
|
47
48
|
"@turbo/test-utils": "0.0.0",
|
|
48
|
-
"@turbo/
|
|
49
|
-
"@turbo/
|
|
50
|
-
"@turbo/utils": "0.0.0"
|
|
49
|
+
"@turbo/workspaces": "2.10.7",
|
|
50
|
+
"@turbo/tsconfig": "0.0.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsdown && tsc -p tsconfig.build.json",
|