@holdyourvoice/hyv 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,63 +1,133 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var vr=Object.create;var Ve=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var _r=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty;var Cr=(n,t)=>()=>(n&&(t=n(n=0)),t);var x=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Or=(n,t)=>{for(var e in t)Ve(n,e,{get:t[e],enumerable:!0})},Ar=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _r(t))!Er.call(n,i)&&i!==e&&Ve(n,i,{get:()=>t[i],enumerable:!(s=Sr(t,i))||s.enumerable});return n};var I=(n,t,e)=>(e=n!=null?vr(xr(n)):{},Ar(t||!n||!n.__esModule?Ve(e,"default",{value:n,enumerable:!0}):e,n));var Bt=x(Ue=>{var ae=class extends Error{constructor(t,e,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}},ze=class extends ae{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ue.CommanderError=ae;Ue.InvalidArgumentError=ze});var le=x(qe=>{var{InvalidArgumentError:kr}=Bt(),Ge=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,s)=>{if(!this.argChoices.includes(e))throw new kr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,s):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function $r(n){let t=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+t+">":"["+t+"]"}qe.Argument=Ge;qe.humanReadableArgName=$r});var Ke=x(Ys=>{var{humanReadableArgName:Tr}=le(),Ye=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(t){let e=t.commands.filter(i=>!i._hidden),s=t._getHelpCommand();return s&&!s._hidden&&e.push(s),this.sortSubcommands&&e.sort((i,r)=>i.name().localeCompare(r.name())),e}compareOptions(t,e){let s=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return s(t).localeCompare(s(e))}visibleOptions(t){let e=t.options.filter(i=>!i.hidden),s=t._getHelpOption();if(s&&!s.hidden){let i=s.short&&t._findOption(s.short),r=s.long&&t._findOption(s.long);!i&&!r?e.push(s):s.long&&!r?e.push(t.createOption(s.long,s.description)):s.short&&!i&&e.push(t.createOption(s.short,s.description))}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let s=t.parent;s;s=s.parent){let i=s.options.filter(r=>!r.hidden);e.push(...i)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(e=>e.description)?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(s=>Tr(s)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((s,i)=>Math.max(s,e.subcommandTerm(i).length),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((s,i)=>Math.max(s,e.optionTerm(i).length),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((s,i)=>Math.max(s,e.optionTerm(i).length),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((s,i)=>Math.max(s,e.argumentTerm(i).length),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let s="";for(let i=t.parent;i;i=i.parent)s=i.name()+" "+s;return s+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];return t.argChoices&&e.push(`choices: ${t.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),t.defaultValue!==void 0&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let s=`(${e.join(", ")})`;return t.description?`${t.description} ${s}`:s}return t.description}formatHelp(t,e){let s=e.padWidth(t,e),i=e.helpWidth||80,r=2,o=2;function a(g,p){if(p){let b=`${g.padEnd(s+o)}${p}`;return e.wrap(b,i-r,s+o)}return g}function l(g){return g.join(`
3
- `).replace(/^/gm," ".repeat(r))}let h=[`Usage: ${e.commandUsage(t)}`,""],u=e.commandDescription(t);u.length>0&&(h=h.concat([e.wrap(u,i,0),""]));let c=e.visibleArguments(t).map(g=>a(e.argumentTerm(g),e.argumentDescription(g)));c.length>0&&(h=h.concat(["Arguments:",l(c),""]));let f=e.visibleOptions(t).map(g=>a(e.optionTerm(g),e.optionDescription(g)));if(f.length>0&&(h=h.concat(["Options:",l(f),""])),this.showGlobalOptions){let g=e.visibleGlobalOptions(t).map(p=>a(e.optionTerm(p),e.optionDescription(p)));g.length>0&&(h=h.concat(["Global Options:",l(g),""]))}let d=e.visibleCommands(t).map(g=>a(e.subcommandTerm(g),e.subcommandDescription(g)));return d.length>0&&(h=h.concat(["Commands:",l(d),""])),h.join(`
2
+ "use strict";var Er=Object.create;var Ks=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Or=Object.getOwnPropertyNames;var Ar=Object.getPrototypeOf,kr=Object.prototype.hasOwnProperty;var E=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var $r=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Or(t))!kr.call(n,i)&&i!==e&&Ks(n,i,{get:()=>t[i],enumerable:!(s=Cr(t,i))||s.enumerable});return n};var P=(n,t,e)=>(e=n!=null?Er(Ar(n)):{},$r(t||!n||!n.__esModule?Ks(e,"default",{value:n,enumerable:!0}):e,n));var Ht=E(Ue=>{var ae=class extends Error{constructor(t,e,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}},Ve=class extends ae{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ue.CommanderError=ae;Ue.InvalidArgumentError=Ve});var le=E(Ge=>{var{InvalidArgumentError:Tr}=Ht(),ze=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,s)=>{if(!this.argChoices.includes(e))throw new Tr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,s):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Fr(n){let t=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+t+">":"["+t+"]"}Ge.Argument=ze;Ge.humanReadableArgName=Fr});var Ye=E(Js=>{var{humanReadableArgName:Rr}=le(),qe=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(t){let e=t.commands.filter(i=>!i._hidden),s=t._getHelpCommand();return s&&!s._hidden&&e.push(s),this.sortSubcommands&&e.sort((i,r)=>i.name().localeCompare(r.name())),e}compareOptions(t,e){let s=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return s(t).localeCompare(s(e))}visibleOptions(t){let e=t.options.filter(i=>!i.hidden),s=t._getHelpOption();if(s&&!s.hidden){let i=s.short&&t._findOption(s.short),r=s.long&&t._findOption(s.long);!i&&!r?e.push(s):s.long&&!r?e.push(t.createOption(s.long,s.description)):s.short&&!i&&e.push(t.createOption(s.short,s.description))}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let s=t.parent;s;s=s.parent){let i=s.options.filter(r=>!r.hidden);e.push(...i)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(e=>e.description)?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(s=>Rr(s)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((s,i)=>Math.max(s,e.subcommandTerm(i).length),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((s,i)=>Math.max(s,e.optionTerm(i).length),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((s,i)=>Math.max(s,e.optionTerm(i).length),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((s,i)=>Math.max(s,e.argumentTerm(i).length),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let s="";for(let i=t.parent;i;i=i.parent)s=i.name()+" "+s;return s+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];return t.argChoices&&e.push(`choices: ${t.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),t.defaultValue!==void 0&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let s=`(${e.join(", ")})`;return t.description?`${t.description} ${s}`:s}return t.description}formatHelp(t,e){let s=e.padWidth(t,e),i=e.helpWidth||80,r=2,o=2;function a(g,p){if(p){let b=`${g.padEnd(s+o)}${p}`;return e.wrap(b,i-r,s+o)}return g}function l(g){return g.join(`
3
+ `).replace(/^/gm," ".repeat(r))}let h=[`Usage: ${e.commandUsage(t)}`,""],c=e.commandDescription(t);c.length>0&&(h=h.concat([e.wrap(c,i,0),""]));let u=e.visibleArguments(t).map(g=>a(e.argumentTerm(g),e.argumentDescription(g)));u.length>0&&(h=h.concat(["Arguments:",l(u),""]));let f=e.visibleOptions(t).map(g=>a(e.optionTerm(g),e.optionDescription(g)));if(f.length>0&&(h=h.concat(["Options:",l(f),""])),this.showGlobalOptions){let g=e.visibleGlobalOptions(t).map(p=>a(e.optionTerm(p),e.optionDescription(p)));g.length>0&&(h=h.concat(["Global Options:",l(g),""]))}let d=e.visibleCommands(t).map(g=>a(e.subcommandTerm(g),e.subcommandDescription(g)));return d.length>0&&(h=h.concat(["Commands:",l(d),""])),h.join(`
4
4
  `)}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}wrap(t,e,s,i=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${r}]+`);if(t.match(o))return t;let a=e-s;if(a<i)return t;let l=t.slice(0,s),h=t.slice(s).replace(`\r
5
5
  `,`
6
- `),u=" ".repeat(s),f="\\s\u200B",d=new RegExp(`
6
+ `),c=" ".repeat(s),f="\\s\u200B",d=new RegExp(`
7
7
  |.{1,${a-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),g=h.match(d)||[];return l+g.map((p,b)=>p===`
8
- `?"":(b>0?u:"")+p.trimEnd()).join(`
9
- `)}};Ys.Help=Ye});var Qe=x(Ze=>{var{InvalidArgumentError:Rr}=Bt(),Je=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let s=Fr(t);this.short=s.shortFlag,this.long=s.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return typeof t=="string"&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,s)=>{if(!this.argChoices.includes(e))throw new Rr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,s):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Mr(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Xe=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(t,e){let s=e.attributeName();if(!this.dualOptions.has(s))return!0;let i=this.negativeOptions.get(s).presetArg,r=i!==void 0?i:!1;return e.negate===(r===t)}};function Mr(n){return n.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}function Fr(n){let t,e,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(t=s.shift()),e=s.shift(),!t&&/^-[^-]$/.test(e)&&(t=e,e=void 0),{shortFlag:t,longFlag:e}}Ze.Option=Je;Ze.DualOptions=Xe});var Js=x(Ks=>{function Pr(n,t){if(Math.abs(n.length-t.length)>3)return Math.max(n.length,t.length);let e=[];for(let s=0;s<=n.length;s++)e[s]=[s];for(let s=0;s<=t.length;s++)e[0][s]=s;for(let s=1;s<=t.length;s++)for(let i=1;i<=n.length;i++){let r=1;n[i-1]===t[s-1]?r=0:r=1,e[i][s]=Math.min(e[i-1][s]+1,e[i][s-1]+1,e[i-1][s-1]+r),i>1&&s>1&&n[i-1]===t[s-2]&&n[i-2]===t[s-1]&&(e[i][s]=Math.min(e[i][s],e[i-2][s-2]+1))}return e[n.length][t.length]}function jr(n,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let e=n.startsWith("--");e&&(n=n.slice(2),t=t.map(o=>o.slice(2)));let s=[],i=3,r=.4;return t.forEach(o=>{if(o.length<=1)return;let a=Pr(n,o),l=Math.max(n.length,o.length);(l-a)/l>r&&(a<i?(i=a,s=[o]):a===i&&s.push(o))}),s.sort((o,a)=>o.localeCompare(a)),e&&(s=s.map(o=>`--${o}`)),s.length>1?`
8
+ `?"":(b>0?c:"")+p.trimEnd()).join(`
9
+ `)}};Js.Help=qe});var Ze=E(Xe=>{var{InvalidArgumentError:Mr}=Ht(),Ke=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let s=Pr(t);this.short=s.shortFlag,this.long=s.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return typeof t=="string"&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,s)=>{if(!this.argChoices.includes(e))throw new Mr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,s):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return jr(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Je=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(t,e){let s=e.attributeName();if(!this.dualOptions.has(s))return!0;let i=this.negativeOptions.get(s).presetArg,r=i!==void 0?i:!1;return e.negate===(r===t)}};function jr(n){return n.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}function Pr(n){let t,e,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(t=s.shift()),e=s.shift(),!t&&/^-[^-]$/.test(e)&&(t=e,e=void 0),{shortFlag:t,longFlag:e}}Xe.Option=Ke;Xe.DualOptions=Je});var Zs=E(Xs=>{function Dr(n,t){if(Math.abs(n.length-t.length)>3)return Math.max(n.length,t.length);let e=[];for(let s=0;s<=n.length;s++)e[s]=[s];for(let s=0;s<=t.length;s++)e[0][s]=s;for(let s=1;s<=t.length;s++)for(let i=1;i<=n.length;i++){let r=1;n[i-1]===t[s-1]?r=0:r=1,e[i][s]=Math.min(e[i-1][s]+1,e[i][s-1]+1,e[i-1][s-1]+r),i>1&&s>1&&n[i-1]===t[s-2]&&n[i-2]===t[s-1]&&(e[i][s]=Math.min(e[i][s],e[i-2][s-2]+1))}return e[n.length][t.length]}function Nr(n,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let e=n.startsWith("--");e&&(n=n.slice(2),t=t.map(o=>o.slice(2)));let s=[],i=3,r=.4;return t.forEach(o=>{if(o.length<=1)return;let a=Dr(n,o),l=Math.max(n.length,o.length);(l-a)/l>r&&(a<i?(i=a,s=[o]):a===i&&s.push(o))}),s.sort((o,a)=>o.localeCompare(a)),e&&(s=s.map(o=>`--${o}`)),s.length>1?`
10
10
  (Did you mean one of ${s.join(", ")}?)`:s.length===1?`
11
- (Did you mean ${s[0]}?)`:""}Ks.suggestSimilar=jr});var ei=x(ti=>{var Dr=require("node:events").EventEmitter,ts=require("node:child_process"),nt=require("node:path"),es=require("node:fs"),E=require("node:process"),{Argument:Nr,humanReadableArgName:Ir}=le(),{CommanderError:ss}=Bt(),{Help:Lr}=Ke(),{Option:Xs,DualOptions:Wr}=Qe(),{suggestSimilar:Zs}=Js(),is=class n extends Dr{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>E.stdout.write(e),writeErr:e=>E.stderr.write(e),getOutHelpWidth:()=>E.stdout.isTTY?E.stdout.columns:void 0,getErrHelpWidth:()=>E.stderr.isTTY?E.stderr.columns:void 0,outputError:(e,s)=>s(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,s){let i=e,r=s;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=t.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),r.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(r.noHelp||r.hidden),l._executableFile=r.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(t){return new n(t)}createHelp(){return Object.assign(new Lr,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new Nr(t,e)}argument(t,e,s,i){let r=this.createArgument(t,e);return typeof s=="function"?r.default(i).argParser(s):r.default(s),this.addArgument(r),this}arguments(t){return t.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,s,i]=t.match(/([^ ]+) *(.*)/),r=e??"display help for command",o=this.createCommand(s);return o.helpOption(!1),i&&o.arguments(i),r&&o.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(t,e){return typeof t!="object"?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){let s=["preSubcommand","preAction","postAction"];if(!s.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
13
- Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,s){this._exitCallback&&this._exitCallback(new ss(t,e,s)),E.exit(t)}action(t){let e=s=>{let i=this.registeredArguments.length,r=s.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),t.apply(this,r)};return this._actionHandler=e,this}createOption(t,e){return new Xs(t,e)}_callParseArg(t,e,s,i){try{return t.parseArg(e,s)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let s=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
14
- - already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){let e=i=>[i.name()].concat(i.aliases()),s=e(t).find(i=>this._findCommand(i));if(s){let i=e(this._findCommand(s)).join("|"),r=e(t).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),s=t.attributeName();if(t.negate){let r=t.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(s,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(s,t.defaultValue,"default");let i=(r,o,a)=>{r==null&&t.presetArg!==void 0&&(r=t.presetArg);let l=this.getOptionValue(s);r!==null&&t.parseArg?r=this._callParseArg(t,r,l,o):r!==null&&t.variadic&&(r=t._concatValue(r,l)),r==null&&(t.negate?r=!1:t.isBoolean()||t.optional?r=!0:r=""),this.setOptionValueWithSource(s,r,a)};return this.on("option:"+e,r=>{let o=`error: option '${t.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),t.envVar&&this.on("optionEnv:"+e,r=>{let o=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(t,e,s,i,r){if(typeof e=="object"&&e instanceof Xs)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(e,s);if(o.makeOptionMandatory(!!t.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(l,h)=>{let u=a.exec(l);return u?u[0]:h},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(t,e,s,i){return this._optionEx({},t,e,s,i)}requiredOption(t,e,s,i){return this._optionEx({mandatory:!0},t,e,s,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,s){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=s,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(t)!==void 0&&(e=s.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(e=e||{},t===void 0&&e.from===void 0){E.versions?.electron&&(e.from="electron");let i=E.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(e.from="eval")}t===void 0&&(t=E.argv),this.rawArgs=t.slice();let s;switch(e.from){case void 0:case"node":this._scriptPath=t[1],s=t.slice(2);break;case"electron":E.defaultApp?(this._scriptPath=t[1],s=t.slice(2)):s=t.slice(1);break;case"user":s=t.slice(0);break;case"eval":s=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(t,e){let s=this._prepareUserArgs(t,e);return this._parseCommand([],s),this}async parseAsync(t,e){let s=this._prepareUserArgs(t,e);return await this._parseCommand([],s),this}_executeSubCommand(t,e){e=e.slice();let s=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,c){let f=nt.resolve(u,c);if(es.existsSync(f))return f;if(i.includes(nt.extname(c)))return;let d=i.find(g=>es.existsSync(`${f}${g}`));if(d)return`${f}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=es.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=nt.resolve(nt.dirname(u),a)}if(a){let u=r(a,o);if(!u&&!t._executableFile&&this._scriptPath){let c=nt.basename(this._scriptPath,nt.extname(this._scriptPath));c!==this._name&&(u=r(a,`${c}-${t._name}`))}o=u||o}s=i.includes(nt.extname(o));let l;E.platform!=="win32"?s?(e.unshift(o),e=Qs(E.execArgv).concat(e),l=ts.spawn(E.argv[0],e,{stdio:"inherit"})):l=ts.spawn(o,e,{stdio:"inherit"}):(e.unshift(o),e=Qs(E.execArgv).concat(e),l=ts.spawn(E.execPath,e,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{E.on(c,()=>{l.killed===!1&&l.exitCode===null&&l.kill(c)})});let h=this._exitCallback;l.on("close",u=>{u=u??1,h?h(new ss(u,"commander.executeSubCommandAsync","(close)")):E.exit(u)}),l.on("error",u=>{if(u.code==="ENOENT"){let c=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${o}' does not exist
11
+ (Did you mean ${s[0]}?)`:""}Xs.suggestSimilar=Nr});var ii=E(si=>{var Lr=require("node:events").EventEmitter,Qe=require("node:child_process"),ot=require("node:path"),ts=require("node:fs"),C=require("node:process"),{Argument:Ir,humanReadableArgName:Wr}=le(),{CommanderError:es}=Ht(),{Help:Br}=Ye(),{Option:Qs,DualOptions:Hr}=Ze(),{suggestSimilar:ti}=Zs(),ss=class n extends Lr{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>C.stdout.write(e),writeErr:e=>C.stderr.write(e),getOutHelpWidth:()=>C.stdout.isTTY?C.stdout.columns:void 0,getErrHelpWidth:()=>C.stderr.isTTY?C.stderr.columns:void 0,outputError:(e,s)=>s(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,s){let i=e,r=s;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=t.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),r.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(r.noHelp||r.hidden),l._executableFile=r.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(t){return new n(t)}createHelp(){return Object.assign(new Br,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new Ir(t,e)}argument(t,e,s,i){let r=this.createArgument(t,e);return typeof s=="function"?r.default(i).argParser(s):r.default(s),this.addArgument(r),this}arguments(t){return t.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,s,i]=t.match(/([^ ]+) *(.*)/),r=e??"display help for command",o=this.createCommand(s);return o.helpOption(!1),i&&o.arguments(i),r&&o.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(t,e){return typeof t!="object"?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){let s=["preSubcommand","preAction","postAction"];if(!s.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
13
+ Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,s){this._exitCallback&&this._exitCallback(new es(t,e,s)),C.exit(t)}action(t){let e=s=>{let i=this.registeredArguments.length,r=s.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),t.apply(this,r)};return this._actionHandler=e,this}createOption(t,e){return new Qs(t,e)}_callParseArg(t,e,s,i){try{return t.parseArg(e,s)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let s=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
14
+ - already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){let e=i=>[i.name()].concat(i.aliases()),s=e(t).find(i=>this._findCommand(i));if(s){let i=e(this._findCommand(s)).join("|"),r=e(t).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),s=t.attributeName();if(t.negate){let r=t.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(s,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(s,t.defaultValue,"default");let i=(r,o,a)=>{r==null&&t.presetArg!==void 0&&(r=t.presetArg);let l=this.getOptionValue(s);r!==null&&t.parseArg?r=this._callParseArg(t,r,l,o):r!==null&&t.variadic&&(r=t._concatValue(r,l)),r==null&&(t.negate?r=!1:t.isBoolean()||t.optional?r=!0:r=""),this.setOptionValueWithSource(s,r,a)};return this.on("option:"+e,r=>{let o=`error: option '${t.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),t.envVar&&this.on("optionEnv:"+e,r=>{let o=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(t,e,s,i,r){if(typeof e=="object"&&e instanceof Qs)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(e,s);if(o.makeOptionMandatory(!!t.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(l,h)=>{let c=a.exec(l);return c?c[0]:h},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(t,e,s,i){return this._optionEx({},t,e,s,i)}requiredOption(t,e,s,i){return this._optionEx({mandatory:!0},t,e,s,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,s){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=s,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(t)!==void 0&&(e=s.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(e=e||{},t===void 0&&e.from===void 0){C.versions?.electron&&(e.from="electron");let i=C.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(e.from="eval")}t===void 0&&(t=C.argv),this.rawArgs=t.slice();let s;switch(e.from){case void 0:case"node":this._scriptPath=t[1],s=t.slice(2);break;case"electron":C.defaultApp?(this._scriptPath=t[1],s=t.slice(2)):s=t.slice(1);break;case"user":s=t.slice(0);break;case"eval":s=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(t,e){let s=this._prepareUserArgs(t,e);return this._parseCommand([],s),this}async parseAsync(t,e){let s=this._prepareUserArgs(t,e);return await this._parseCommand([],s),this}_executeSubCommand(t,e){e=e.slice();let s=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(c,u){let f=ot.resolve(c,u);if(ts.existsSync(f))return f;if(i.includes(ot.extname(u)))return;let d=i.find(g=>ts.existsSync(`${f}${g}`));if(d)return`${f}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=ts.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=ot.resolve(ot.dirname(c),a)}if(a){let c=r(a,o);if(!c&&!t._executableFile&&this._scriptPath){let u=ot.basename(this._scriptPath,ot.extname(this._scriptPath));u!==this._name&&(c=r(a,`${u}-${t._name}`))}o=c||o}s=i.includes(ot.extname(o));let l;C.platform!=="win32"?s?(e.unshift(o),e=ei(C.execArgv).concat(e),l=Qe.spawn(C.argv[0],e,{stdio:"inherit"})):l=Qe.spawn(o,e,{stdio:"inherit"}):(e.unshift(o),e=ei(C.execArgv).concat(e),l=Qe.spawn(C.execPath,e,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{C.on(u,()=>{l.killed===!1&&l.exitCode===null&&l.kill(u)})});let h=this._exitCallback;l.on("close",c=>{c=c??1,h?h(new es(c,"commander.executeSubCommandAsync","(close)")):C.exit(c)}),l.on("error",c=>{if(c.code==="ENOENT"){let u=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${o}' does not exist
15
15
  - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${c}`;throw new Error(f)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!h)E.exit(1);else{let c=new ss(1,"commander.executeSubCommandAsync","(error)");c.nestedError=u,h(c)}}),this.runningCommand=l}_dispatchSubcommand(t,e,s){let i=this._findCommand(t);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,e.concat(s));else return i._parseCommand(e,s)}),r}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&this.args[e]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(s,i,r)=>{let o=i;if(i!==null&&s.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${s.name()}'.`;o=this._callParseArg(s,i,r,a)}return o};this._checkNumberOfArguments();let e=[];this.registeredArguments.forEach((s,i)=>{let r=s.defaultValue;s.variadic?i<this.args.length?(r=this.args.slice(i),s.parseArg&&(r=r.reduce((o,a)=>t(s,a,o),s.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],s.parseArg&&(r=t(s,r,s.defaultValue))),e[i]=r}),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&typeof t.then=="function"?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let s=t,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[e]!==void 0).forEach(r=>{r._lifeCycleHooks[e].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),e==="postAction"&&i.reverse(),i.forEach(r=>{s=this._chainOrCall(s,()=>r.callback(r.hookedCommand,this))}),s}_chainOrCallSubCommandHook(t,e,s){let i=t;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(r=>{i=this._chainOrCall(i,()=>r(this,e))}),i}_parseCommand(t,e){let s=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(s.operands),e=s.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,t,e)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&t.getOptionValue(e.attributeName())===void 0&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(s=>{let i=s.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(s=>s.conflictsWith.length>0).forEach(s=>{let i=t.find(r=>s.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(s,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],s=[],i=e,r=t.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;r.length;){let l=r.shift();if(l==="--"){i===s&&i.push(l),i.push(...r);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let h=this._findOption(l);if(h){if(h.required){let u=r.shift();u===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,u)}else if(h.optional){let u=null;r.length>0&&!o(r[0])&&(u=r.shift()),this.emit(`option:${h.name()}`,u)}else this.emit(`option:${h.name()}`);a=h.variadic?h:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let h=this._findOption(`-${l[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,l.slice(2)):(this.emit(`option:${h.name()}`),r.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let h=l.indexOf("="),u=this._findOption(l.slice(0,h));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,l.slice(h+1));continue}}if(o(l)&&(i=s),(this._enablePositionalOptions||this._passThroughOptions)&&e.length===0&&s.length===0){if(this._findCommand(l)){e.push(l),r.length>0&&s.push(...r);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){e.push(l),r.length>0&&e.push(...r);break}else if(this._defaultCommandName){s.push(l),r.length>0&&s.push(...r);break}}if(this._passThroughOptions){i.push(l),r.length>0&&i.push(...r);break}i.push(l)}return{operands:e,unknown:s}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let s=0;s<e;s++){let i=this.options[s].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
17
+ - ${u}`;throw new Error(f)}else if(c.code==="EACCES")throw new Error(`'${o}' not executable`);if(!h)C.exit(1);else{let u=new es(1,"commander.executeSubCommandAsync","(error)");u.nestedError=c,h(u)}}),this.runningCommand=l}_dispatchSubcommand(t,e,s){let i=this._findCommand(t);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,e.concat(s));else return i._parseCommand(e,s)}),r}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&this.args[e]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(s,i,r)=>{let o=i;if(i!==null&&s.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${s.name()}'.`;o=this._callParseArg(s,i,r,a)}return o};this._checkNumberOfArguments();let e=[];this.registeredArguments.forEach((s,i)=>{let r=s.defaultValue;s.variadic?i<this.args.length?(r=this.args.slice(i),s.parseArg&&(r=r.reduce((o,a)=>t(s,a,o),s.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],s.parseArg&&(r=t(s,r,s.defaultValue))),e[i]=r}),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&typeof t.then=="function"?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let s=t,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[e]!==void 0).forEach(r=>{r._lifeCycleHooks[e].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),e==="postAction"&&i.reverse(),i.forEach(r=>{s=this._chainOrCall(s,()=>r.callback(r.hookedCommand,this))}),s}_chainOrCallSubCommandHook(t,e,s){let i=t;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(r=>{i=this._chainOrCall(i,()=>r(this,e))}),i}_parseCommand(t,e){let s=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(s.operands),e=s.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,t,e)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&t.getOptionValue(e.attributeName())===void 0&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(s=>{let i=s.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(s=>s.conflictsWith.length>0).forEach(s=>{let i=t.find(r=>s.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(s,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],s=[],i=e,r=t.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;r.length;){let l=r.shift();if(l==="--"){i===s&&i.push(l),i.push(...r);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let h=this._findOption(l);if(h){if(h.required){let c=r.shift();c===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,c)}else if(h.optional){let c=null;r.length>0&&!o(r[0])&&(c=r.shift()),this.emit(`option:${h.name()}`,c)}else this.emit(`option:${h.name()}`);a=h.variadic?h:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let h=this._findOption(`-${l[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,l.slice(2)):(this.emit(`option:${h.name()}`),r.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let h=l.indexOf("="),c=this._findOption(l.slice(0,h));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,l.slice(h+1));continue}}if(o(l)&&(i=s),(this._enablePositionalOptions||this._passThroughOptions)&&e.length===0&&s.length===0){if(this._findCommand(l)){e.push(l),r.length>0&&s.push(...r);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){e.push(l),r.length>0&&e.push(...r);break}else if(this._defaultCommandName){s.push(l),r.length>0&&s.push(...r);break}}if(this._passThroughOptions){i.push(l),r.length>0&&i.push(...r);break}i.push(l)}return{operands:e,unknown:s}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let s=0;s<e;s++){let i=this.options[s].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:!0}));let s=e||{},i=s.exitCode||1,r=s.code||"commander.error";this._exit(i,r,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in E.env){let e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,E.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Wr(this.options),e=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&e(s.attributeName())&&t.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(i=>!e(i)).forEach(i=>{this.setOptionValueWithSource(i,s.implied[i],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),h=this.options.find(c=>c.negate&&a===c.attributeName()),u=this.options.find(c=>!c.negate&&a===c.attributeName());return h&&(h.presetArg===void 0&&l===!1||h.presetArg!==void 0&&l===h.presetArg)?h:u||o},i=o=>{let a=s(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(t)} cannot be used with ${i(e)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);e=Zs(t,i)}let s=`error: unknown option '${t}'${e}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,s=e===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${s} but got ${t.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),e=Zs(t,i)}let s=`error: unknown command '${t}'${e}`;this.error(s,{code:"commander.unknownCommand"})}version(t,e,s){if(t===void 0)return this._version;this._version=t,e=e||"-V, --version",s=s||"output the version number";let i=this.createOption(e,s);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${t}
21
- `),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(t);if(s){let i=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(s=>Ir(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=nt.basename(t,nt.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp();return e.helpWidth===void 0&&(e.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),e.formatHelp(this,e)}_getHelpContext(t){t=t||{};let e={error:!!t.error},s;return e.error?s=i=>this._outputConfiguration.writeErr(i):s=i=>this._outputConfiguration.writeOut(i),e.write=t.write||s,e.command=this,e}outputHelp(t){let e;typeof t=="function"&&(e=t,t=void 0);let s=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let i=this.helpInformation(s);if(e&&(i=e(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",s))}helpOption(t,e){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",e=e??"display help for command",this._helpOption=this.createOption(t,e),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let e=E.exitCode||0;e===0&&t&&typeof t!="function"&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let s=["beforeAll","before","after","afterAll"];if(!s.includes(t))throw new Error(`Unexpected value for position to addHelpText.
20
+ `),this.outputHelp({error:!0}));let s=e||{},i=s.exitCode||1,r=s.code||"commander.error";this._exit(i,r,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in C.env){let e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,C.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Hr(this.options),e=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&e(s.attributeName())&&t.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(i=>!e(i)).forEach(i=>{this.setOptionValueWithSource(i,s.implied[i],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),h=this.options.find(u=>u.negate&&a===u.attributeName()),c=this.options.find(u=>!u.negate&&a===u.attributeName());return h&&(h.presetArg===void 0&&l===!1||h.presetArg!==void 0&&l===h.presetArg)?h:c||o},i=o=>{let a=s(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},r=`error: ${i(t)} cannot be used with ${i(e)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);e=ti(t,i)}let s=`error: unknown option '${t}'${e}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,s=e===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${s} but got ${t.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),e=ti(t,i)}let s=`error: unknown command '${t}'${e}`;this.error(s,{code:"commander.unknownCommand"})}version(t,e,s){if(t===void 0)return this._version;this._version=t,e=e||"-V, --version",s=s||"output the version number";let i=this.createOption(e,s);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${t}
21
+ `),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(t);if(s){let i=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(s=>Wr(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=ot.basename(t,ot.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp();return e.helpWidth===void 0&&(e.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),e.formatHelp(this,e)}_getHelpContext(t){t=t||{};let e={error:!!t.error},s;return e.error?s=i=>this._outputConfiguration.writeErr(i):s=i=>this._outputConfiguration.writeOut(i),e.write=t.write||s,e.command=this,e}outputHelp(t){let e;typeof t=="function"&&(e=t,t=void 0);let s=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let i=this.helpInformation(s);if(e&&(i=e(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",s))}helpOption(t,e){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",e=e??"display help for command",this._helpOption=this.createOption(t,e),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let e=C.exitCode||0;e===0&&t&&typeof t!="function"&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let s=["beforeAll","before","after","afterAll"];if(!s.includes(t))throw new Error(`Unexpected value for position to addHelpText.
22
22
  Expecting one of '${s.join("', '")}'`);let i=`${t}Help`;return this.on(i,r=>{let o;typeof e=="function"?o=e({error:r.error,command:r.command}):o=e,o&&r.write(`${o}
23
- `)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(i=>e.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Qs(n){return n.map(t=>{if(!t.startsWith("--inspect"))return t;let e,s="127.0.0.1",i="9229",r;return(r=t.match(/^(--inspect(-brk)?)$/))!==null?e=r[1]:(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(e=r[1],/^\d+$/.test(r[3])?i=r[3]:s=r[3]):(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(e=r[1],s=r[3],i=r[4]),e&&i!=="0"?`${e}=${s}:${parseInt(i)+1}`:t})}ti.Command=is});var ri=x(V=>{var{Argument:si}=le(),{Command:ns}=ei(),{CommanderError:Br,InvalidArgumentError:ii}=Bt(),{Help:Hr}=Ke(),{Option:ni}=Qe();V.program=new ns;V.createCommand=n=>new ns(n);V.createOption=(n,t)=>new ni(n,t);V.createArgument=(n,t)=>new si(n,t);V.Command=ns;V.Option=ni;V.Argument=si;V.Help=Hr;V.CommanderError=Br;V.InvalidArgumentError=ii;V.InvalidOptionArgumentError=ii});var os=x((gl,hi)=>{"use strict";var li=require("fs"),rs;function Vr(){try{return li.statSync("/.dockerenv"),!0}catch{return!1}}function zr(){try{return li.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}hi.exports=()=>(rs===void 0&&(rs=Vr()||zr()),rs)});var fi=x((yl,as)=>{"use strict";var Ur=require("os"),Gr=require("fs"),ci=os(),ui=()=>{if(process.platform!=="linux")return!1;if(Ur.release().toLowerCase().includes("microsoft"))return!ci();try{return Gr.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ci():!1}catch{return!1}};process.env.__IS_WSL_TEST__?as.exports=ui:as.exports=ui()});var pi=x((wl,di)=>{"use strict";di.exports=(n,t,e)=>{let s=i=>Object.defineProperty(n,t,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get(){let i=e();return s(i),i},set(i){s(i)}}),n}});var Si=x((bl,vi)=>{var qr=require("path"),Yr=require("child_process"),{promises:ce,constants:bi}=require("fs"),he=fi(),Kr=os(),hs=pi(),mi=qr.join(__dirname,"xdg-open"),{platform:Et,arch:gi}=process,Jr=()=>{try{return ce.statSync("/run/.containerenv"),!0}catch{return!1}},ls;function Xr(){return ls===void 0&&(ls=Jr()||Kr()),ls}var Zr=(()=>{let n="/mnt/",t;return async function(){if(t)return t;let e="/etc/wsl.conf",s=!1;try{await ce.access(e,bi.F_OK),s=!0}catch{}if(!s)return n;let i=await ce.readFile(e,{encoding:"utf8"}),r=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return r?(t=r.groups.mountPoint.trim(),t=t.endsWith("/")?t:`${t}/`,t):n}})(),yi=async(n,t)=>{let e;for(let s of n)try{return await t(s)}catch(i){e=i}throw e},ue=async n=>{if(n={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...n},Array.isArray(n.app))return yi(n.app,a=>ue({...n,app:a}));let{name:t,arguments:e=[]}=n.app||{};if(e=[...e],Array.isArray(t))return yi(t,a=>ue({...n,app:{name:a,arguments:e}}));let s,i=[],r={};if(Et==="darwin")s="open",n.wait&&i.push("--wait-apps"),n.background&&i.push("--background"),n.newInstance&&i.push("--new"),t&&i.push("-a",t);else if(Et==="win32"||he&&!Xr()&&!t){let a=await Zr();s=he?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),he||(r.windowsVerbatimArguments=!0);let l=["Start"];n.wait&&l.push("-Wait"),t?(l.push(`"\`"${t}\`""`,"-ArgumentList"),n.target&&e.unshift(n.target)):n.target&&l.push(`"${n.target}"`),e.length>0&&(e=e.map(h=>`"\`"${h}\`""`),l.push(e.join(","))),n.target=Buffer.from(l.join(" "),"utf16le").toString("base64")}else{if(t)s=t;else{let a=!__dirname||__dirname==="/",l=!1;try{await ce.access(mi,bi.X_OK),l=!0}catch{}s=process.versions.electron||Et==="android"||a||!l?"xdg-open":mi}e.length>0&&i.push(...e),n.wait||(r.stdio="ignore",r.detached=!0)}n.target&&i.push(n.target),Et==="darwin"&&e.length>0&&i.push("--args",...e);let o=Yr.spawn(s,i,r);return n.wait?new Promise((a,l)=>{o.once("error",l),o.once("close",h=>{if(!n.allowNonzeroExitCode&&h>0){l(new Error(`Exited with code ${h}`));return}a(o)})}):(o.unref(),o)},cs=(n,t)=>{if(typeof n!="string")throw new TypeError("Expected a `target`");return ue({...t,target:n})},Qr=(n,t)=>{if(typeof n!="string")throw new TypeError("Expected a `name`");let{arguments:e=[]}=t||{};if(e!=null&&!Array.isArray(e))throw new TypeError("Expected `appArguments` as Array type");return ue({...t,app:{name:n,arguments:e}})};function wi(n){if(typeof n=="string"||Array.isArray(n))return n;let{[gi]:t}=n;if(!t)throw new Error(`${gi} is not supported`);return t}function us({[Et]:n},{wsl:t}){if(t&&he)return wi(t);if(!n)throw new Error(`${Et} is not supported`);return wi(n)}var fe={};hs(fe,"chrome",()=>us({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));hs(fe,"firefox",()=>us({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));hs(fe,"edge",()=>us({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));cs.apps=fe;cs.openApp=Qr;vi.exports=cs});var Ei={};Or(Ei,{HYV_DIR:()=>pe,PROFILES_DIR:()=>de,clearCredentials:()=>to,getCachedProfile:()=>ps,getCredentials:()=>wt,getProjectConfig:()=>Ht,saveCachedProfile:()=>ms,saveCredentials:()=>ds,saveProjectConfig:()=>me});function xi(n){j.existsSync(n)||j.mkdirSync(n,{recursive:!0})}function wt(){try{let n=j.readFileSync(fs,"utf-8"),t=JSON.parse(n);return t.api_key?t:null}catch{return null}}function ds(n){xi(pe),j.writeFileSync(fs,JSON.stringify(n,null,2))}function to(){try{j.unlinkSync(fs)}catch{}}function Ht(){let n=ht.join(process.cwd(),".hyv.yml");if(!j.existsSync(n))return{};try{let t=j.readFileSync(n,"utf-8"),e={};for(let s of t.split(`
24
- `)){let i=s.trim();if(!i||i.startsWith("#"))continue;let r=i.indexOf(":");if(r===-1)continue;let o=i.slice(0,r).trim(),a=i.slice(r+1).trim();o==="profile"?e.profile=a:o==="scan_paths"?e.scan_paths=a.split(",").map(l=>l.trim()):o==="ignore"&&(e.ignore=a.split(",").map(l=>l.trim()))}return e}catch{return{}}}function me(n){let t=ht.join(process.cwd(),".hyv.yml"),e=["# hold your voice \u2014 project config"];n.profile&&e.push(`profile: ${n.profile}`),n.scan_paths?.length&&e.push(`scan_paths: ${n.scan_paths.join(", ")}`),j.writeFileSync(t,e.join(`
25
- `)+`
26
- `)}function ps(n){let t=ht.join(de,`${n}.md`);try{return j.readFileSync(t,"utf-8")}catch{return null}}function ms(n,t){xi(de),j.writeFileSync(ht.join(de,`${n}.md`),t)}var j,ht,_i,pe,fs,de,bt=Cr(()=>{"use strict";j=I(require("fs")),ht=I(require("path")),_i=I(require("os")),pe=ht.join(_i.homedir(),".hyv"),fs=ht.join(pe,"credentials.json"),de=ht.join(pe,"profiles")});var Ai=x((_l,Oi)=>{"use strict";Oi.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var ys=x((xl,$i)=>{var Vt=Ai(),ki={};for(let n of Object.keys(Vt))ki[Vt[n]]=n;var w={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};$i.exports=w;for(let n of Object.keys(w)){if(!("channels"in w[n]))throw new Error("missing channels property: "+n);if(!("labels"in w[n]))throw new Error("missing channel labels property: "+n);if(w[n].labels.length!==w[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:t,labels:e}=w[n];delete w[n].channels,delete w[n].labels,Object.defineProperty(w[n],"channels",{value:t}),Object.defineProperty(w[n],"labels",{value:e})}w.rgb.hsl=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255,i=Math.min(t,e,s),r=Math.max(t,e,s),o=r-i,a,l;r===i?a=0:t===r?a=(e-s)/o:e===r?a=2+(s-t)/o:s===r&&(a=4+(t-e)/o),a=Math.min(a*60,360),a<0&&(a+=360);let h=(i+r)/2;return r===i?l=0:h<=.5?l=o/(r+i):l=o/(2-r-i),[a,l*100,h*100]};w.rgb.hsv=function(n){let t,e,s,i,r,o=n[0]/255,a=n[1]/255,l=n[2]/255,h=Math.max(o,a,l),u=h-Math.min(o,a,l),c=function(f){return(h-f)/6/u+1/2};return u===0?(i=0,r=0):(r=u/h,t=c(o),e=c(a),s=c(l),o===h?i=s-e:a===h?i=1/3+t-s:l===h&&(i=2/3+e-t),i<0?i+=1:i>1&&(i-=1)),[i*360,r*100,h*100]};w.rgb.hwb=function(n){let t=n[0],e=n[1],s=n[2],i=w.rgb.hsl(n)[0],r=1/255*Math.min(t,Math.min(e,s));return s=1-1/255*Math.max(t,Math.max(e,s)),[i,r*100,s*100]};w.rgb.cmyk=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255,i=Math.min(1-t,1-e,1-s),r=(1-t-i)/(1-i)||0,o=(1-e-i)/(1-i)||0,a=(1-s-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function so(n,t){return(n[0]-t[0])**2+(n[1]-t[1])**2+(n[2]-t[2])**2}w.rgb.keyword=function(n){let t=ki[n];if(t)return t;let e=1/0,s;for(let i of Object.keys(Vt)){let r=Vt[i],o=so(n,r);o<e&&(e=o,s=i)}return s};w.keyword.rgb=function(n){return Vt[n]};w.rgb.xyz=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let i=t*.4124+e*.3576+s*.1805,r=t*.2126+e*.7152+s*.0722,o=t*.0193+e*.1192+s*.9505;return[i*100,r*100,o*100]};w.rgb.lab=function(n){let t=w.rgb.xyz(n),e=t[0],s=t[1],i=t[2];e/=95.047,s/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let r=116*s-16,o=500*(e-s),a=200*(s-i);return[r,o,a]};w.hsl.rgb=function(n){let t=n[0]/360,e=n[1]/100,s=n[2]/100,i,r,o;if(e===0)return o=s*255,[o,o,o];s<.5?i=s*(1+e):i=s+e-s*e;let a=2*s-i,l=[0,0,0];for(let h=0;h<3;h++)r=t+1/3*-(h-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(i-a)*6*r:2*r<1?o=i:3*r<2?o=a+(i-a)*(2/3-r)*6:o=a,l[h]=o*255;return l};w.hsl.hsv=function(n){let t=n[0],e=n[1]/100,s=n[2]/100,i=e,r=Math.max(s,.01);s*=2,e*=s<=1?s:2-s,i*=r<=1?r:2-r;let o=(s+e)/2,a=s===0?2*i/(r+i):2*e/(s+e);return[t,a*100,o*100]};w.hsv.rgb=function(n){let t=n[0]/60,e=n[1]/100,s=n[2]/100,i=Math.floor(t)%6,r=t-Math.floor(t),o=255*s*(1-e),a=255*s*(1-e*r),l=255*s*(1-e*(1-r));switch(s*=255,i){case 0:return[s,l,o];case 1:return[a,s,o];case 2:return[o,s,l];case 3:return[o,a,s];case 4:return[l,o,s];case 5:return[s,o,a]}};w.hsv.hsl=function(n){let t=n[0],e=n[1]/100,s=n[2]/100,i=Math.max(s,.01),r,o;o=(2-e)*s;let a=(2-e)*i;return r=e*i,r/=a<=1?a:2-a,r=r||0,o/=2,[t,r*100,o*100]};w.hwb.rgb=function(n){let t=n[0]/360,e=n[1]/100,s=n[2]/100,i=e+s,r;i>1&&(e/=i,s/=i);let o=Math.floor(6*t),a=1-s;r=6*t-o,o&1&&(r=1-r);let l=e+r*(a-e),h,u,c;switch(o){default:case 6:case 0:h=a,u=l,c=e;break;case 1:h=l,u=a,c=e;break;case 2:h=e,u=a,c=l;break;case 3:h=e,u=l,c=a;break;case 4:h=l,u=e,c=a;break;case 5:h=a,u=e,c=l;break}return[h*255,u*255,c*255]};w.cmyk.rgb=function(n){let t=n[0]/100,e=n[1]/100,s=n[2]/100,i=n[3]/100,r=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,e*(1-i)+i),a=1-Math.min(1,s*(1-i)+i);return[r*255,o*255,a*255]};w.xyz.rgb=function(n){let t=n[0]/100,e=n[1]/100,s=n[2]/100,i,r,o;return i=t*3.2406+e*-1.5372+s*-.4986,r=t*-.9689+e*1.8758+s*.0415,o=t*.0557+e*-.204+s*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[i*255,r*255,o*255]};w.xyz.lab=function(n){let t=n[0],e=n[1],s=n[2];t/=95.047,e/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,e=e>.008856?e**(1/3):7.787*e+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let i=116*e-16,r=500*(t-e),o=200*(e-s);return[i,r,o]};w.lab.xyz=function(n){let t=n[0],e=n[1],s=n[2],i,r,o;r=(t+16)/116,i=e/500+r,o=r-s/200;let a=r**3,l=i**3,h=o**3;return r=a>.008856?a:(r-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,o=h>.008856?h:(o-16/116)/7.787,i*=95.047,r*=100,o*=108.883,[i,r,o]};w.lab.lch=function(n){let t=n[0],e=n[1],s=n[2],i;i=Math.atan2(s,e)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(e*e+s*s);return[t,o,i]};w.lch.lab=function(n){let t=n[0],e=n[1],i=n[2]/360*2*Math.PI,r=e*Math.cos(i),o=e*Math.sin(i);return[t,r,o]};w.rgb.ansi16=function(n,t=null){let[e,s,i]=n,r=t===null?w.rgb.hsv(n)[2]:t;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(s/255)<<1|Math.round(e/255));return r===2&&(o+=60),o};w.hsv.ansi16=function(n){return w.rgb.ansi16(w.hsv.rgb(n),n[2])};w.rgb.ansi256=function(n){let t=n[0],e=n[1],s=n[2];return t===e&&e===s?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(s/255*5)};w.ansi16.rgb=function(n){let t=n%10;if(t===0||t===7)return n>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let e=(~~(n>50)+1)*.5,s=(t&1)*e*255,i=(t>>1&1)*e*255,r=(t>>2&1)*e*255;return[s,i,r]};w.ansi256.rgb=function(n){if(n>=232){let r=(n-232)*10+8;return[r,r,r]}n-=16;let t,e=Math.floor(n/36)/5*255,s=Math.floor((t=n%36)/6)/5*255,i=t%6/5*255;return[e,s,i]};w.rgb.hex=function(n){let e=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(e.length)+e};w.hex.rgb=function(n){let t=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let e=t[0];t[0].length===3&&(e=e.split("").map(a=>a+a).join(""));let s=parseInt(e,16),i=s>>16&255,r=s>>8&255,o=s&255;return[i,r,o]};w.rgb.hcg=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255,i=Math.max(Math.max(t,e),s),r=Math.min(Math.min(t,e),s),o=i-r,a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:i===t?l=(e-s)/o%6:i===e?l=2+(s-t)/o:l=4+(t-e)/o,l/=6,l%=1,[l*360,o*100,a*100]};w.hsl.hcg=function(n){let t=n[1]/100,e=n[2]/100,s=e<.5?2*t*e:2*t*(1-e),i=0;return s<1&&(i=(e-.5*s)/(1-s)),[n[0],s*100,i*100]};w.hsv.hcg=function(n){let t=n[1]/100,e=n[2]/100,s=t*e,i=0;return s<1&&(i=(e-s)/(1-s)),[n[0],s*100,i*100]};w.hcg.rgb=function(n){let t=n[0]/360,e=n[1]/100,s=n[2]/100;if(e===0)return[s*255,s*255,s*255];let i=[0,0,0],r=t%1*6,o=r%1,a=1-o,l=0;switch(Math.floor(r)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return l=(1-e)*s,[(e*i[0]+l)*255,(e*i[1]+l)*255,(e*i[2]+l)*255]};w.hcg.hsv=function(n){let t=n[1]/100,e=n[2]/100,s=t+e*(1-t),i=0;return s>0&&(i=t/s),[n[0],i*100,s*100]};w.hcg.hsl=function(n){let t=n[1]/100,s=n[2]/100*(1-t)+.5*t,i=0;return s>0&&s<.5?i=t/(2*s):s>=.5&&s<1&&(i=t/(2*(1-s))),[n[0],i*100,s*100]};w.hcg.hwb=function(n){let t=n[1]/100,e=n[2]/100,s=t+e*(1-t);return[n[0],(s-t)*100,(1-s)*100]};w.hwb.hcg=function(n){let t=n[1]/100,s=1-n[2]/100,i=s-t,r=0;return i<1&&(r=(s-i)/(1-i)),[n[0],i*100,r*100]};w.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};w.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};w.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};w.gray.hsl=function(n){return[0,0,n[0]]};w.gray.hsv=w.gray.hsl;w.gray.hwb=function(n){return[0,100,n[0]]};w.gray.cmyk=function(n){return[0,0,0,n[0]]};w.gray.lab=function(n){return[n[0],0,0]};w.gray.hex=function(n){let t=Math.round(n[0]/100*255)&255,s=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(s.length)+s};w.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var Ri=x((El,Ti)=>{var ge=ys();function io(){let n={},t=Object.keys(ge);for(let e=t.length,s=0;s<e;s++)n[t[s]]={distance:-1,parent:null};return n}function no(n){let t=io(),e=[n];for(t[n].distance=0;e.length;){let s=e.pop(),i=Object.keys(ge[s]);for(let r=i.length,o=0;o<r;o++){let a=i[o],l=t[a];l.distance===-1&&(l.distance=t[s].distance+1,l.parent=s,e.unshift(a))}}return t}function ro(n,t){return function(e){return t(n(e))}}function oo(n,t){let e=[t[n].parent,n],s=ge[t[n].parent][n],i=t[n].parent;for(;t[i].parent;)e.unshift(t[i].parent),s=ro(ge[t[i].parent][i],s),i=t[i].parent;return s.conversion=e,s}Ti.exports=function(n){let t=no(n),e={},s=Object.keys(t);for(let i=s.length,r=0;r<i;r++){let o=s[r];t[o].parent!==null&&(e[o]=oo(o,t))}return e}});var Fi=x((Cl,Mi)=>{var ws=ys(),ao=Ri(),Ct={},lo=Object.keys(ws);function ho(n){let t=function(...e){let s=e[0];return s==null?s:(s.length>1&&(e=s),n(e))};return"conversion"in n&&(t.conversion=n.conversion),t}function co(n){let t=function(...e){let s=e[0];if(s==null)return s;s.length>1&&(e=s);let i=n(e);if(typeof i=="object")for(let r=i.length,o=0;o<r;o++)i[o]=Math.round(i[o]);return i};return"conversion"in n&&(t.conversion=n.conversion),t}lo.forEach(n=>{Ct[n]={},Object.defineProperty(Ct[n],"channels",{value:ws[n].channels}),Object.defineProperty(Ct[n],"labels",{value:ws[n].labels});let t=ao(n);Object.keys(t).forEach(s=>{let i=t[s];Ct[n][s]=co(i),Ct[n][s].raw=ho(i)})});Mi.exports=Ct});var Li=x((Ol,Ii)=>{"use strict";var Pi=(n,t)=>(...e)=>`\x1B[${n(...e)+t}m`,ji=(n,t)=>(...e)=>{let s=n(...e);return`\x1B[${38+t};5;${s}m`},Di=(n,t)=>(...e)=>{let s=n(...e);return`\x1B[${38+t};2;${s[0]};${s[1]};${s[2]}m`},ye=n=>n,Ni=(n,t,e)=>[n,t,e],Ot=(n,t,e)=>{Object.defineProperty(n,t,{get:()=>{let s=e();return Object.defineProperty(n,t,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},bs,At=(n,t,e,s)=>{bs===void 0&&(bs=Fi());let i=s?10:0,r={};for(let[o,a]of Object.entries(bs)){let l=o==="ansi16"?"ansi":o;o===t?r[l]=n(e,i):typeof a=="object"&&(r[l]=n(a[t],i))}return r};function uo(){let n=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[e,s]of Object.entries(t)){for(let[i,r]of Object.entries(s))t[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=t[i],n.set(r[0],r[1]);Object.defineProperty(t,e,{value:s,enumerable:!1})}return Object.defineProperty(t,"codes",{value:n,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",Ot(t.color,"ansi",()=>At(Pi,"ansi16",ye,!1)),Ot(t.color,"ansi256",()=>At(ji,"ansi256",ye,!1)),Ot(t.color,"ansi16m",()=>At(Di,"rgb",Ni,!1)),Ot(t.bgColor,"ansi",()=>At(Pi,"ansi16",ye,!0)),Ot(t.bgColor,"ansi256",()=>At(ji,"ansi256",ye,!0)),Ot(t.bgColor,"ansi16m",()=>At(Di,"rgb",Ni,!0)),t}Object.defineProperty(Ii,"exports",{enumerable:!0,get:uo})});var Bi=x((Al,Wi)=>{"use strict";Wi.exports=(n,t=process.argv)=>{let e=n.startsWith("-")?"":n.length===1?"-":"--",s=t.indexOf(e+n),i=t.indexOf("--");return s!==-1&&(i===-1||s<i)}});var zi=x((kl,Vi)=>{"use strict";var fo=require("os"),Hi=require("tty"),z=Bi(),{env:$}=process,ct;z("no-color")||z("no-colors")||z("color=false")||z("color=never")?ct=0:(z("color")||z("colors")||z("color=true")||z("color=always"))&&(ct=1);"FORCE_COLOR"in $&&($.FORCE_COLOR==="true"?ct=1:$.FORCE_COLOR==="false"?ct=0:ct=$.FORCE_COLOR.length===0?1:Math.min(parseInt($.FORCE_COLOR,10),3));function vs(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function Ss(n,t){if(ct===0)return 0;if(z("color=16m")||z("color=full")||z("color=truecolor"))return 3;if(z("color=256"))return 2;if(n&&!t&&ct===void 0)return 0;let e=ct||0;if($.TERM==="dumb")return e;if(process.platform==="win32"){let s=fo.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in $)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(s=>s in $)||$.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($.TEAMCITY_VERSION)?1:0;if($.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in $){let s=parseInt(($.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($.TERM)||"COLORTERM"in $?1:e}function po(n){let t=Ss(n,n&&n.isTTY);return vs(t)}Vi.exports={supportsColor:po,stdout:vs(Ss(!0,Hi.isatty(1))),stderr:vs(Ss(!0,Hi.isatty(2)))}});var Gi=x(($l,Ui)=>{"use strict";var mo=(n,t,e)=>{let s=n.indexOf(t);if(s===-1)return n;let i=t.length,r=0,o="";do o+=n.substr(r,s-r)+t+e,r=s+i,s=n.indexOf(t,r);while(s!==-1);return o+=n.substr(r),o},go=(n,t,e,s)=>{let i=0,r="";do{let o=n[s-1]==="\r";r+=n.substr(i,(o?s-1:s)-i)+t+(o?`\r
23
+ `)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(i=>e.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ei(n){return n.map(t=>{if(!t.startsWith("--inspect"))return t;let e,s="127.0.0.1",i="9229",r;return(r=t.match(/^(--inspect(-brk)?)$/))!==null?e=r[1]:(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(e=r[1],/^\d+$/.test(r[3])?i=r[3]:s=r[3]):(r=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(e=r[1],s=r[3],i=r[4]),e&&i!=="0"?`${e}=${s}:${parseInt(i)+1}`:t})}si.Command=ss});var ai=E(z=>{var{Argument:ni}=le(),{Command:is}=ii(),{CommanderError:Vr,InvalidArgumentError:ri}=Ht(),{Help:Ur}=Ye(),{Option:oi}=Ze();z.program=new is;z.createCommand=n=>new is(n);z.createOption=(n,t)=>new oi(n,t);z.createArgument=(n,t)=>new ni(n,t);z.Command=is;z.Option=oi;z.Argument=ni;z.Help=Ur;z.CommanderError=Vr;z.InvalidArgumentError=ri;z.InvalidOptionArgumentError=ri});var rs=E((wl,ui)=>{"use strict";var ci=require("fs"),ns;function zr(){try{return ci.statSync("/.dockerenv"),!0}catch{return!1}}function Gr(){try{return ci.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}ui.exports=()=>(ns===void 0&&(ns=zr()||Gr()),ns)});var pi=E((bl,os)=>{"use strict";var qr=require("os"),Yr=require("fs"),fi=rs(),di=()=>{if(process.platform!=="linux")return!1;if(qr.release().toLowerCase().includes("microsoft"))return!fi();try{return Yr.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!fi():!1}catch{return!1}};process.env.__IS_WSL_TEST__?os.exports=di:os.exports=di()});var gi=E((vl,mi)=>{"use strict";mi.exports=(n,t,e)=>{let s=i=>Object.defineProperty(n,t,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get(){let i=e();return s(i),i},set(i){s(i)}}),n}});var _i=E((xl,Si)=>{var Kr=require("path"),Jr=require("child_process"),{promises:ce,constants:xi}=require("fs"),he=pi(),Xr=rs(),ls=gi(),yi=Kr.join(__dirname,"xdg-open"),{platform:Et,arch:wi}=process,Zr=()=>{try{return ce.statSync("/run/.containerenv"),!0}catch{return!1}},as;function Qr(){return as===void 0&&(as=Zr()||Xr()),as}var to=(()=>{let n="/mnt/",t;return async function(){if(t)return t;let e="/etc/wsl.conf",s=!1;try{await ce.access(e,xi.F_OK),s=!0}catch{}if(!s)return n;let i=await ce.readFile(e,{encoding:"utf8"}),r=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return r?(t=r.groups.mountPoint.trim(),t=t.endsWith("/")?t:`${t}/`,t):n}})(),bi=async(n,t)=>{let e;for(let s of n)try{return await t(s)}catch(i){e=i}throw e},ue=async n=>{if(n={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...n},Array.isArray(n.app))return bi(n.app,a=>ue({...n,app:a}));let{name:t,arguments:e=[]}=n.app||{};if(e=[...e],Array.isArray(t))return bi(t,a=>ue({...n,app:{name:a,arguments:e}}));let s,i=[],r={};if(Et==="darwin")s="open",n.wait&&i.push("--wait-apps"),n.background&&i.push("--background"),n.newInstance&&i.push("--new"),t&&i.push("-a",t);else if(Et==="win32"||he&&!Qr()&&!t){let a=await to();s=he?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),he||(r.windowsVerbatimArguments=!0);let l=["Start"];n.wait&&l.push("-Wait"),t?(l.push(`"\`"${t}\`""`,"-ArgumentList"),n.target&&e.unshift(n.target)):n.target&&l.push(`"${n.target}"`),e.length>0&&(e=e.map(h=>`"\`"${h}\`""`),l.push(e.join(","))),n.target=Buffer.from(l.join(" "),"utf16le").toString("base64")}else{if(t)s=t;else{let a=!__dirname||__dirname==="/",l=!1;try{await ce.access(yi,xi.X_OK),l=!0}catch{}s=process.versions.electron||Et==="android"||a||!l?"xdg-open":yi}e.length>0&&i.push(...e),n.wait||(r.stdio="ignore",r.detached=!0)}n.target&&i.push(n.target),Et==="darwin"&&e.length>0&&i.push("--args",...e);let o=Jr.spawn(s,i,r);return n.wait?new Promise((a,l)=>{o.once("error",l),o.once("close",h=>{if(!n.allowNonzeroExitCode&&h>0){l(new Error(`Exited with code ${h}`));return}a(o)})}):(o.unref(),o)},hs=(n,t)=>{if(typeof n!="string")throw new TypeError("Expected a `target`");return ue({...t,target:n})},eo=(n,t)=>{if(typeof n!="string")throw new TypeError("Expected a `name`");let{arguments:e=[]}=t||{};if(e!=null&&!Array.isArray(e))throw new TypeError("Expected `appArguments` as Array type");return ue({...t,app:{name:n,arguments:e}})};function vi(n){if(typeof n=="string"||Array.isArray(n))return n;let{[wi]:t}=n;if(!t)throw new Error(`${wi} is not supported`);return t}function cs({[Et]:n},{wsl:t}){if(t&&he)return vi(t);if(!n)throw new Error(`${Et} is not supported`);return vi(n)}var fe={};ls(fe,"chrome",()=>cs({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));ls(fe,"firefox",()=>cs({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ls(fe,"edge",()=>cs({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));hs.apps=fe;hs.openApp=eo;Si.exports=hs});var Fi=E((Cl,Ti)=>{"use strict";Ti.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var ms=E((Ol,Mi)=>{var Vt=Fi(),Ri={};for(let n of Object.keys(Vt))Ri[Vt[n]]=n;var w={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Mi.exports=w;for(let n of Object.keys(w)){if(!("channels"in w[n]))throw new Error("missing channels property: "+n);if(!("labels"in w[n]))throw new Error("missing channel labels property: "+n);if(w[n].labels.length!==w[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:t,labels:e}=w[n];delete w[n].channels,delete w[n].labels,Object.defineProperty(w[n],"channels",{value:t}),Object.defineProperty(w[n],"labels",{value:e})}w.rgb.hsl=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255,i=Math.min(t,e,s),r=Math.max(t,e,s),o=r-i,a,l;r===i?a=0:t===r?a=(e-s)/o:e===r?a=2+(s-t)/o:s===r&&(a=4+(t-e)/o),a=Math.min(a*60,360),a<0&&(a+=360);let h=(i+r)/2;return r===i?l=0:h<=.5?l=o/(r+i):l=o/(2-r-i),[a,l*100,h*100]};w.rgb.hsv=function(n){let t,e,s,i,r,o=n[0]/255,a=n[1]/255,l=n[2]/255,h=Math.max(o,a,l),c=h-Math.min(o,a,l),u=function(f){return(h-f)/6/c+1/2};return c===0?(i=0,r=0):(r=c/h,t=u(o),e=u(a),s=u(l),o===h?i=s-e:a===h?i=1/3+t-s:l===h&&(i=2/3+e-t),i<0?i+=1:i>1&&(i-=1)),[i*360,r*100,h*100]};w.rgb.hwb=function(n){let t=n[0],e=n[1],s=n[2],i=w.rgb.hsl(n)[0],r=1/255*Math.min(t,Math.min(e,s));return s=1-1/255*Math.max(t,Math.max(e,s)),[i,r*100,s*100]};w.rgb.cmyk=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255,i=Math.min(1-t,1-e,1-s),r=(1-t-i)/(1-i)||0,o=(1-e-i)/(1-i)||0,a=(1-s-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function io(n,t){return(n[0]-t[0])**2+(n[1]-t[1])**2+(n[2]-t[2])**2}w.rgb.keyword=function(n){let t=Ri[n];if(t)return t;let e=1/0,s;for(let i of Object.keys(Vt)){let r=Vt[i],o=io(n,r);o<e&&(e=o,s=i)}return s};w.keyword.rgb=function(n){return Vt[n]};w.rgb.xyz=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let i=t*.4124+e*.3576+s*.1805,r=t*.2126+e*.7152+s*.0722,o=t*.0193+e*.1192+s*.9505;return[i*100,r*100,o*100]};w.rgb.lab=function(n){let t=w.rgb.xyz(n),e=t[0],s=t[1],i=t[2];e/=95.047,s/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let r=116*s-16,o=500*(e-s),a=200*(s-i);return[r,o,a]};w.hsl.rgb=function(n){let t=n[0]/360,e=n[1]/100,s=n[2]/100,i,r,o;if(e===0)return o=s*255,[o,o,o];s<.5?i=s*(1+e):i=s+e-s*e;let a=2*s-i,l=[0,0,0];for(let h=0;h<3;h++)r=t+1/3*-(h-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(i-a)*6*r:2*r<1?o=i:3*r<2?o=a+(i-a)*(2/3-r)*6:o=a,l[h]=o*255;return l};w.hsl.hsv=function(n){let t=n[0],e=n[1]/100,s=n[2]/100,i=e,r=Math.max(s,.01);s*=2,e*=s<=1?s:2-s,i*=r<=1?r:2-r;let o=(s+e)/2,a=s===0?2*i/(r+i):2*e/(s+e);return[t,a*100,o*100]};w.hsv.rgb=function(n){let t=n[0]/60,e=n[1]/100,s=n[2]/100,i=Math.floor(t)%6,r=t-Math.floor(t),o=255*s*(1-e),a=255*s*(1-e*r),l=255*s*(1-e*(1-r));switch(s*=255,i){case 0:return[s,l,o];case 1:return[a,s,o];case 2:return[o,s,l];case 3:return[o,a,s];case 4:return[l,o,s];case 5:return[s,o,a]}};w.hsv.hsl=function(n){let t=n[0],e=n[1]/100,s=n[2]/100,i=Math.max(s,.01),r,o;o=(2-e)*s;let a=(2-e)*i;return r=e*i,r/=a<=1?a:2-a,r=r||0,o/=2,[t,r*100,o*100]};w.hwb.rgb=function(n){let t=n[0]/360,e=n[1]/100,s=n[2]/100,i=e+s,r;i>1&&(e/=i,s/=i);let o=Math.floor(6*t),a=1-s;r=6*t-o,o&1&&(r=1-r);let l=e+r*(a-e),h,c,u;switch(o){default:case 6:case 0:h=a,c=l,u=e;break;case 1:h=l,c=a,u=e;break;case 2:h=e,c=a,u=l;break;case 3:h=e,c=l,u=a;break;case 4:h=l,c=e,u=a;break;case 5:h=a,c=e,u=l;break}return[h*255,c*255,u*255]};w.cmyk.rgb=function(n){let t=n[0]/100,e=n[1]/100,s=n[2]/100,i=n[3]/100,r=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,e*(1-i)+i),a=1-Math.min(1,s*(1-i)+i);return[r*255,o*255,a*255]};w.xyz.rgb=function(n){let t=n[0]/100,e=n[1]/100,s=n[2]/100,i,r,o;return i=t*3.2406+e*-1.5372+s*-.4986,r=t*-.9689+e*1.8758+s*.0415,o=t*.0557+e*-.204+s*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[i*255,r*255,o*255]};w.xyz.lab=function(n){let t=n[0],e=n[1],s=n[2];t/=95.047,e/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,e=e>.008856?e**(1/3):7.787*e+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let i=116*e-16,r=500*(t-e),o=200*(e-s);return[i,r,o]};w.lab.xyz=function(n){let t=n[0],e=n[1],s=n[2],i,r,o;r=(t+16)/116,i=e/500+r,o=r-s/200;let a=r**3,l=i**3,h=o**3;return r=a>.008856?a:(r-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,o=h>.008856?h:(o-16/116)/7.787,i*=95.047,r*=100,o*=108.883,[i,r,o]};w.lab.lch=function(n){let t=n[0],e=n[1],s=n[2],i;i=Math.atan2(s,e)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(e*e+s*s);return[t,o,i]};w.lch.lab=function(n){let t=n[0],e=n[1],i=n[2]/360*2*Math.PI,r=e*Math.cos(i),o=e*Math.sin(i);return[t,r,o]};w.rgb.ansi16=function(n,t=null){let[e,s,i]=n,r=t===null?w.rgb.hsv(n)[2]:t;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(s/255)<<1|Math.round(e/255));return r===2&&(o+=60),o};w.hsv.ansi16=function(n){return w.rgb.ansi16(w.hsv.rgb(n),n[2])};w.rgb.ansi256=function(n){let t=n[0],e=n[1],s=n[2];return t===e&&e===s?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(s/255*5)};w.ansi16.rgb=function(n){let t=n%10;if(t===0||t===7)return n>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let e=(~~(n>50)+1)*.5,s=(t&1)*e*255,i=(t>>1&1)*e*255,r=(t>>2&1)*e*255;return[s,i,r]};w.ansi256.rgb=function(n){if(n>=232){let r=(n-232)*10+8;return[r,r,r]}n-=16;let t,e=Math.floor(n/36)/5*255,s=Math.floor((t=n%36)/6)/5*255,i=t%6/5*255;return[e,s,i]};w.rgb.hex=function(n){let e=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(e.length)+e};w.hex.rgb=function(n){let t=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let e=t[0];t[0].length===3&&(e=e.split("").map(a=>a+a).join(""));let s=parseInt(e,16),i=s>>16&255,r=s>>8&255,o=s&255;return[i,r,o]};w.rgb.hcg=function(n){let t=n[0]/255,e=n[1]/255,s=n[2]/255,i=Math.max(Math.max(t,e),s),r=Math.min(Math.min(t,e),s),o=i-r,a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:i===t?l=(e-s)/o%6:i===e?l=2+(s-t)/o:l=4+(t-e)/o,l/=6,l%=1,[l*360,o*100,a*100]};w.hsl.hcg=function(n){let t=n[1]/100,e=n[2]/100,s=e<.5?2*t*e:2*t*(1-e),i=0;return s<1&&(i=(e-.5*s)/(1-s)),[n[0],s*100,i*100]};w.hsv.hcg=function(n){let t=n[1]/100,e=n[2]/100,s=t*e,i=0;return s<1&&(i=(e-s)/(1-s)),[n[0],s*100,i*100]};w.hcg.rgb=function(n){let t=n[0]/360,e=n[1]/100,s=n[2]/100;if(e===0)return[s*255,s*255,s*255];let i=[0,0,0],r=t%1*6,o=r%1,a=1-o,l=0;switch(Math.floor(r)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return l=(1-e)*s,[(e*i[0]+l)*255,(e*i[1]+l)*255,(e*i[2]+l)*255]};w.hcg.hsv=function(n){let t=n[1]/100,e=n[2]/100,s=t+e*(1-t),i=0;return s>0&&(i=t/s),[n[0],i*100,s*100]};w.hcg.hsl=function(n){let t=n[1]/100,s=n[2]/100*(1-t)+.5*t,i=0;return s>0&&s<.5?i=t/(2*s):s>=.5&&s<1&&(i=t/(2*(1-s))),[n[0],i*100,s*100]};w.hcg.hwb=function(n){let t=n[1]/100,e=n[2]/100,s=t+e*(1-t);return[n[0],(s-t)*100,(1-s)*100]};w.hwb.hcg=function(n){let t=n[1]/100,s=1-n[2]/100,i=s-t,r=0;return i<1&&(r=(s-i)/(1-i)),[n[0],i*100,r*100]};w.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};w.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};w.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};w.gray.hsl=function(n){return[0,0,n[0]]};w.gray.hsv=w.gray.hsl;w.gray.hwb=function(n){return[0,100,n[0]]};w.gray.cmyk=function(n){return[0,0,0,n[0]]};w.gray.lab=function(n){return[n[0],0,0]};w.gray.hex=function(n){let t=Math.round(n[0]/100*255)&255,s=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(s.length)+s};w.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var Pi=E((Al,ji)=>{var me=ms();function no(){let n={},t=Object.keys(me);for(let e=t.length,s=0;s<e;s++)n[t[s]]={distance:-1,parent:null};return n}function ro(n){let t=no(),e=[n];for(t[n].distance=0;e.length;){let s=e.pop(),i=Object.keys(me[s]);for(let r=i.length,o=0;o<r;o++){let a=i[o],l=t[a];l.distance===-1&&(l.distance=t[s].distance+1,l.parent=s,e.unshift(a))}}return t}function oo(n,t){return function(e){return t(n(e))}}function ao(n,t){let e=[t[n].parent,n],s=me[t[n].parent][n],i=t[n].parent;for(;t[i].parent;)e.unshift(t[i].parent),s=oo(me[t[i].parent][i],s),i=t[i].parent;return s.conversion=e,s}ji.exports=function(n){let t=ro(n),e={},s=Object.keys(t);for(let i=s.length,r=0;r<i;r++){let o=s[r];t[o].parent!==null&&(e[o]=ao(o,t))}return e}});var Ni=E((kl,Di)=>{var gs=ms(),lo=Pi(),Ot={},ho=Object.keys(gs);function co(n){let t=function(...e){let s=e[0];return s==null?s:(s.length>1&&(e=s),n(e))};return"conversion"in n&&(t.conversion=n.conversion),t}function uo(n){let t=function(...e){let s=e[0];if(s==null)return s;s.length>1&&(e=s);let i=n(e);if(typeof i=="object")for(let r=i.length,o=0;o<r;o++)i[o]=Math.round(i[o]);return i};return"conversion"in n&&(t.conversion=n.conversion),t}ho.forEach(n=>{Ot[n]={},Object.defineProperty(Ot[n],"channels",{value:gs[n].channels}),Object.defineProperty(Ot[n],"labels",{value:gs[n].labels});let t=lo(n);Object.keys(t).forEach(s=>{let i=t[s];Ot[n][s]=uo(i),Ot[n][s].raw=co(i)})});Di.exports=Ot});var Vi=E(($l,Hi)=>{"use strict";var Li=(n,t)=>(...e)=>`\x1B[${n(...e)+t}m`,Ii=(n,t)=>(...e)=>{let s=n(...e);return`\x1B[${38+t};5;${s}m`},Wi=(n,t)=>(...e)=>{let s=n(...e);return`\x1B[${38+t};2;${s[0]};${s[1]};${s[2]}m`},ge=n=>n,Bi=(n,t,e)=>[n,t,e],At=(n,t,e)=>{Object.defineProperty(n,t,{get:()=>{let s=e();return Object.defineProperty(n,t,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},ys,kt=(n,t,e,s)=>{ys===void 0&&(ys=Ni());let i=s?10:0,r={};for(let[o,a]of Object.entries(ys)){let l=o==="ansi16"?"ansi":o;o===t?r[l]=n(e,i):typeof a=="object"&&(r[l]=n(a[t],i))}return r};function fo(){let n=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[e,s]of Object.entries(t)){for(let[i,r]of Object.entries(s))t[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=t[i],n.set(r[0],r[1]);Object.defineProperty(t,e,{value:s,enumerable:!1})}return Object.defineProperty(t,"codes",{value:n,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",At(t.color,"ansi",()=>kt(Li,"ansi16",ge,!1)),At(t.color,"ansi256",()=>kt(Ii,"ansi256",ge,!1)),At(t.color,"ansi16m",()=>kt(Wi,"rgb",Bi,!1)),At(t.bgColor,"ansi",()=>kt(Li,"ansi16",ge,!0)),At(t.bgColor,"ansi256",()=>kt(Ii,"ansi256",ge,!0)),At(t.bgColor,"ansi16m",()=>kt(Wi,"rgb",Bi,!0)),t}Object.defineProperty(Hi,"exports",{enumerable:!0,get:fo})});var zi=E((Tl,Ui)=>{"use strict";Ui.exports=(n,t=process.argv)=>{let e=n.startsWith("-")?"":n.length===1?"-":"--",s=t.indexOf(e+n),i=t.indexOf("--");return s!==-1&&(i===-1||s<i)}});var Yi=E((Fl,qi)=>{"use strict";var po=require("os"),Gi=require("tty"),G=zi(),{env:T}=process,ft;G("no-color")||G("no-colors")||G("color=false")||G("color=never")?ft=0:(G("color")||G("colors")||G("color=true")||G("color=always"))&&(ft=1);"FORCE_COLOR"in T&&(T.FORCE_COLOR==="true"?ft=1:T.FORCE_COLOR==="false"?ft=0:ft=T.FORCE_COLOR.length===0?1:Math.min(parseInt(T.FORCE_COLOR,10),3));function ws(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function bs(n,t){if(ft===0)return 0;if(G("color=16m")||G("color=full")||G("color=truecolor"))return 3;if(G("color=256"))return 2;if(n&&!t&&ft===void 0)return 0;let e=ft||0;if(T.TERM==="dumb")return e;if(process.platform==="win32"){let s=po.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in T)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(s=>s in T)||T.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in T)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(T.TEAMCITY_VERSION)?1:0;if(T.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in T){let s=parseInt((T.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(T.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(T.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(T.TERM)||"COLORTERM"in T?1:e}function mo(n){let t=bs(n,n&&n.isTTY);return ws(t)}qi.exports={supportsColor:mo,stdout:ws(bs(!0,Gi.isatty(1))),stderr:ws(bs(!0,Gi.isatty(2)))}});var Ji=E((Rl,Ki)=>{"use strict";var go=(n,t,e)=>{let s=n.indexOf(t);if(s===-1)return n;let i=t.length,r=0,o="";do o+=n.substr(r,s-r)+t+e,r=s+i,s=n.indexOf(t,r);while(s!==-1);return o+=n.substr(r),o},yo=(n,t,e,s)=>{let i=0,r="";do{let o=n[s-1]==="\r";r+=n.substr(i,(o?s-1:s)-i)+t+(o?`\r
27
24
  `:`
28
25
  `)+e,i=s+1,s=n.indexOf(`
29
- `,i)}while(s!==-1);return r+=n.substr(i),r};Ui.exports={stringReplaceAll:mo,stringEncaseCRLFWithFirstIndex:go}});var Xi=x((Tl,Ji)=>{"use strict";var yo=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,qi=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,wo=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,bo=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,vo=new Map([["n",`
30
- `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Ki(n){let t=n[0]==="u",e=n[1]==="{";return t&&!e&&n.length===5||n[0]==="x"&&n.length===3?String.fromCharCode(parseInt(n.slice(1),16)):t&&e?String.fromCodePoint(parseInt(n.slice(2,-1),16)):vo.get(n)||n}function So(n,t){let e=[],s=t.trim().split(/\s*,\s*/g),i;for(let r of s){let o=Number(r);if(!Number.isNaN(o))e.push(o);else if(i=r.match(wo))e.push(i[2].replace(bo,(a,l,h)=>l?Ki(l):h));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}return e}function _o(n){qi.lastIndex=0;let t=[],e;for(;(e=qi.exec(n))!==null;){let s=e[1];if(e[2]){let i=So(s,e[2]);t.push([s].concat(i))}else t.push([s])}return t}function Yi(n,t){let e={};for(let i of t)for(let r of i.styles)e[r[0]]=i.inverse?null:r.slice(1);let s=n;for(let[i,r]of Object.entries(e))if(Array.isArray(r)){if(!(i in s))throw new Error(`Unknown Chalk style: ${i}`);s=r.length>0?s[i](...r):s[i]}return s}Ji.exports=(n,t)=>{let e=[],s=[],i=[];if(t.replace(yo,(r,o,a,l,h,u)=>{if(o)i.push(Ki(o));else if(l){let c=i.join("");i=[],s.push(e.length===0?c:Yi(n,e)(c)),e.push({inverse:a,styles:_o(l)})}else if(h){if(e.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(Yi(n,e)(i.join(""))),i=[],e.pop()}else i.push(u)}),s.push(i.join("")),e.length>0){let r=`Chalk template literal is missing ${e.length} closing bracket${e.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return s.join("")}});var rn=x((Rl,nn)=>{"use strict";var zt=Li(),{stdout:xs,stderr:Es}=zi(),{stringReplaceAll:xo,stringEncaseCRLFWithFirstIndex:Eo}=Gi(),{isArray:we}=Array,Qi=["ansi","ansi","ansi256","ansi16m"],kt=Object.create(null),Co=(n,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let e=xs?xs.level:0;n.level=t.level===void 0?e:t.level},Cs=class{constructor(t){return tn(t)}},tn=n=>{let t={};return Co(t,n),t.template=(...e)=>sn(t.template,...e),Object.setPrototypeOf(t,be.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=Cs,t.template};function be(n){return tn(n)}for(let[n,t]of Object.entries(zt))kt[n]={get(){let e=ve(this,Os(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,n,{value:e}),e}};kt.visible={get(){let n=ve(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:n}),n}};var en=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let n of en)kt[n]={get(){let{level:t}=this;return function(...e){let s=Os(zt.color[Qi[t]][n](...e),zt.color.close,this._styler);return ve(this,s,this._isEmpty)}}};for(let n of en){let t="bg"+n[0].toUpperCase()+n.slice(1);kt[t]={get(){let{level:e}=this;return function(...s){let i=Os(zt.bgColor[Qi[e]][n](...s),zt.bgColor.close,this._styler);return ve(this,i,this._isEmpty)}}}}var Oo=Object.defineProperties(()=>{},{...kt,level:{enumerable:!0,get(){return this._generator.level},set(n){this._generator.level=n}}}),Os=(n,t,e)=>{let s,i;return e===void 0?(s=n,i=t):(s=e.openAll+n,i=t+e.closeAll),{open:n,close:t,openAll:s,closeAll:i,parent:e}},ve=(n,t,e)=>{let s=(...i)=>we(i[0])&&we(i[0].raw)?Zi(s,sn(s,...i)):Zi(s,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(s,Oo),s._generator=n,s._styler=t,s._isEmpty=e,s},Zi=(n,t)=>{if(n.level<=0||!t)return n._isEmpty?"":t;let e=n._styler;if(e===void 0)return t;let{openAll:s,closeAll:i}=e;if(t.indexOf("\x1B")!==-1)for(;e!==void 0;)t=xo(t,e.close,e.open),e=e.parent;let r=t.indexOf(`
31
- `);return r!==-1&&(t=Eo(t,i,s,r)),s+t+i},_s,sn=(n,...t)=>{let[e]=t;if(!we(e)||!we(e.raw))return t.join(" ");let s=t.slice(1),i=[e.raw[0]];for(let r=1;r<e.length;r++)i.push(String(s[r-1]).replace(/[{}\\]/g,"\\$&"),String(e.raw[r]));return _s===void 0&&(_s=Xi()),_s(n,i.join(""))};Object.defineProperties(be.prototype,kt);var Se=be();Se.supportsColor=xs;Se.stderr=be({level:Es?Es.level:0});Se.stderr.supportsColor=Es;nn.exports=Se});var mn=x((Nl,pn)=>{"use strict";pn.exports=fn;function fn(n,t,e){n instanceof RegExp&&(n=un(n,e)),t instanceof RegExp&&(t=un(t,e));var s=dn(n,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+n.length,s[1]),post:e.slice(s[1]+t.length)}}function un(n,t){var e=t.match(n);return e?e[0]:null}fn.range=dn;function dn(n,t,e){var s,i,r,o,a,l=e.indexOf(n),h=e.indexOf(t,l+1),u=l;if(l>=0&&h>0){if(n===t)return[l,h];for(s=[],r=e.length;u>=0&&!a;)u==l?(s.push(u),l=e.indexOf(n,u+1)):s.length==1?a=[s.pop(),h]:(i=s.pop(),i<r&&(r=i,o=h),h=e.indexOf(t,u+1)),u=l<h&&l>=0?l:h;s.length&&(a=[r,o])}return a}});var xn=x((Il,_n)=>{var gn=mn();_n.exports=To;var yn="\0SLASH"+Math.random()+"\0",wn="\0OPEN"+Math.random()+"\0",ks="\0CLOSE"+Math.random()+"\0",bn="\0COMMA"+Math.random()+"\0",vn="\0PERIOD"+Math.random()+"\0";function As(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}function ko(n){return n.split("\\\\").join(yn).split("\\{").join(wn).split("\\}").join(ks).split("\\,").join(bn).split("\\.").join(vn)}function $o(n){return n.split(yn).join("\\").split(wn).join("{").split(ks).join("}").split(bn).join(",").split(vn).join(".")}function Sn(n){if(!n)return[""];var t=[],e=gn("{","}",n);if(!e)return n.split(",");var s=e.pre,i=e.body,r=e.post,o=s.split(",");o[o.length-1]+="{"+i+"}";var a=Sn(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}function To(n,t){if(!n)return[];t=t||{};var e=t.max==null?1/0:t.max;return n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Ut(ko(n),e,!0).map($o)}function Ro(n){return"{"+n+"}"}function Mo(n){return/^-?0\d/.test(n)}function Fo(n,t){return n<=t}function Po(n,t){return n>=t}function Ut(n,t,e){var s=[],i=gn("{","}",n);if(!i)return[n];var r=i.pre,o=i.post.length?Ut(i.post,t,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<o.length&&a<t;a++){var l=r+"{"+i.body+"}"+o[a];s.push(l)}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=h||u,f=i.body.indexOf(",")>=0;if(!c&&!f)return i.post.match(/,(?!,).*\}/)?(n=i.pre+"{"+i.body+ks+i.post,Ut(n,t,!0)):[n];var d;if(c)d=i.body.split(/\.\./);else if(d=Sn(i.body),d.length===1&&(d=Ut(d[0],t,!1).map(Ro),d.length===1))return o.map(function(br){return i.pre+d[0]+br});var g;if(c){var p=As(d[0]),b=As(d[1]),y=Math.max(d[0].length,d[1].length),v=d.length==3?Math.max(Math.abs(As(d[2])),1):1,S=Fo,_=b<p;_&&(v*=-1,S=Po);var k=d.some(Mo);g=[];for(var Y=p;S(Y,b)&&g.length<t;Y+=v){var A;if(u)A=String.fromCharCode(Y),A==="\\"&&(A="");else if(A=String(Y),k){var yt=y-A.length;if(yt>0){var xt=new Array(yt+1).join("0");Y<0?A="-"+xt+A.slice(1):A=xt+A}}g.push(A)}}else{g=[];for(var Q=0;Q<d.length;Q++)g.push.apply(g,Ut(d[Q],t,!1))}for(var Q=0;Q<g.length;Q++)for(var a=0;a<o.length&&s.length<t;a++){var l=r+g[Q]+o[a];(!e||c||l)&&s.push(l)}}return s}});var oi=I(ri(),1),{program:rl,createCommand:ol,createArgument:al,createOption:ll,CommanderError:hl,InvalidArgumentError:cl,InvalidOptionArgumentError:ul,Command:ai,Argument:fl,Option:dl,Help:pl}=oi.default;var ln=I(require("http")),hn=I(Si());bt();bt();var eo="https://holdyourvoice.com";async function Ci(n,t,e){let s=wt();if(!s)throw new Error("Not authenticated. Run: hyv init");let i=`${s.base_url||eo}${t}`,r={method:n,headers:{Authorization:`Bearer ${s.api_key}`,"Content-Type":"application/json"}};e&&(r.body=JSON.stringify(e));let o=await fetch(i,r);if(o.status===401)throw new Error("Session expired. Run: hyv init");if(o.status===403)throw new Error("Access denied. Check your subscription at holdyourvoice.com/dashboard");if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`API error (${o.status}): ${a.slice(0,200)}`)}return o.json()}function tt(n){return Ci("GET",n)}function gs(n,t){return Ci("POST",n,t)}var rt=I(rn()),m={dim:n=>rt.default.dim(n),bold:n=>rt.default.bold(n),accent:n=>rt.default.hex("#C4441A")(n),green:n=>rt.default.green(n),red:n=>rt.default.red(n),yellow:n=>rt.default.yellow(n),cyan:n=>rt.default.cyan(n),white:n=>rt.default.white(n)};function W(){return`${m.bold("hold your ")}${m.accent("voice")}`}function on(n){let t=n.severity==="red"?m.red("\u25CF"):m.yellow("\u25CF"),e=m.dim(`${n.file}:${n.line}`),s=m.dim(n.pattern);console.log(` ${t} ${e} ${s}`),console.log(` ${n.excerpt}`)}function an(n){if(console.log(""),console.log(` ${m.bold("scanned")} ${m.cyan(String(n.files))} files, ${m.cyan(String(n.total_lines))} lines`),n.red+n.yellow===0)console.log(` ${m.green("\u2713 clean \u2014 no issues found")}`);else{let t=[];n.red&&t.push(m.red(`${n.red} critical`)),n.yellow&&t.push(m.yellow(`${n.yellow} advisory`)),console.log(` ${t.join(", ")}`)}}var $t=process.env.HYV_BASE_URL||"https://holdyourvoice.com";async function cn(n,t){if(console.log(`
32
- ${W()}
33
- `),t?.key){await Ao(t.key);return}let e=wt();if(e)try{await tt("/cli/heartbeat"),console.log(` ${m.green("\u2713")} already authenticated as ${m.dim(e.user_email||"unknown")}`),n&&(me({profile:n}),console.log(` ${m.green("\u2713")} default profile set to ${m.bold(n)}`));return}catch{console.log(` ${m.dim("credentials expired, re-authenticating...")}`)}let s=ln.createServer(),i=await new Promise(a=>{s.listen(0,"127.0.0.1",()=>{a(s.address().port)})});console.log(" opening browser for authentication..."),console.log(` ${m.dim("if the browser doesn't open, visit the URL manually")}
34
- `);let r=`${$t}/api/cli/auth?port=${i}`,o=new Promise((a,l)=>{let h=setTimeout(()=>{s.close(),l(new Error("Authentication timed out (5 minutes)"))},3e5);s.on("request",(u,c)=>{let f=new URL(u.url||"/",`http://127.0.0.1:${i}`),d=f.searchParams.get("token"),g=f.searchParams.get("email"),p=f.searchParams.get("name"),b=f.searchParams.get("error");if(b){c.writeHead(302,{Location:`${$t}/dashboard?cli_error=${encodeURIComponent(b)}`}),c.end(),clearTimeout(h),s.close(),l(new Error(b));return}if(d){c.writeHead(200,{"Content-Type":"text/html"}),c.end(`<!DOCTYPE html><html><body style="font-family:sans-serif;text-align:center;padding:60px">
26
+ `,i)}while(s!==-1);return r+=n.substr(i),r};Ki.exports={stringReplaceAll:go,stringEncaseCRLFWithFirstIndex:yo}});var en=E((Ml,tn)=>{"use strict";var wo=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Xi=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,bo=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,vo=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,xo=new Map([["n",`
27
+ `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Qi(n){let t=n[0]==="u",e=n[1]==="{";return t&&!e&&n.length===5||n[0]==="x"&&n.length===3?String.fromCharCode(parseInt(n.slice(1),16)):t&&e?String.fromCodePoint(parseInt(n.slice(2,-1),16)):xo.get(n)||n}function So(n,t){let e=[],s=t.trim().split(/\s*,\s*/g),i;for(let r of s){let o=Number(r);if(!Number.isNaN(o))e.push(o);else if(i=r.match(bo))e.push(i[2].replace(vo,(a,l,h)=>l?Qi(l):h));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}return e}function _o(n){Xi.lastIndex=0;let t=[],e;for(;(e=Xi.exec(n))!==null;){let s=e[1];if(e[2]){let i=So(s,e[2]);t.push([s].concat(i))}else t.push([s])}return t}function Zi(n,t){let e={};for(let i of t)for(let r of i.styles)e[r[0]]=i.inverse?null:r.slice(1);let s=n;for(let[i,r]of Object.entries(e))if(Array.isArray(r)){if(!(i in s))throw new Error(`Unknown Chalk style: ${i}`);s=r.length>0?s[i](...r):s[i]}return s}tn.exports=(n,t)=>{let e=[],s=[],i=[];if(t.replace(wo,(r,o,a,l,h,c)=>{if(o)i.push(Qi(o));else if(l){let u=i.join("");i=[],s.push(e.length===0?u:Zi(n,e)(u)),e.push({inverse:a,styles:_o(l)})}else if(h){if(e.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(Zi(n,e)(i.join(""))),i=[],e.pop()}else i.push(c)}),s.push(i.join("")),e.length>0){let r=`Chalk template literal is missing ${e.length} closing bracket${e.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return s.join("")}});var hn=E((jl,ln)=>{"use strict";var Ut=Vi(),{stdout:xs,stderr:Ss}=Yi(),{stringReplaceAll:Eo,stringEncaseCRLFWithFirstIndex:Co}=Ji(),{isArray:ye}=Array,nn=["ansi","ansi","ansi256","ansi16m"],$t=Object.create(null),Oo=(n,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let e=xs?xs.level:0;n.level=t.level===void 0?e:t.level},_s=class{constructor(t){return rn(t)}},rn=n=>{let t={};return Oo(t,n),t.template=(...e)=>an(t.template,...e),Object.setPrototypeOf(t,we.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=_s,t.template};function we(n){return rn(n)}for(let[n,t]of Object.entries(Ut))$t[n]={get(){let e=be(this,Es(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,n,{value:e}),e}};$t.visible={get(){let n=be(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:n}),n}};var on=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let n of on)$t[n]={get(){let{level:t}=this;return function(...e){let s=Es(Ut.color[nn[t]][n](...e),Ut.color.close,this._styler);return be(this,s,this._isEmpty)}}};for(let n of on){let t="bg"+n[0].toUpperCase()+n.slice(1);$t[t]={get(){let{level:e}=this;return function(...s){let i=Es(Ut.bgColor[nn[e]][n](...s),Ut.bgColor.close,this._styler);return be(this,i,this._isEmpty)}}}}var Ao=Object.defineProperties(()=>{},{...$t,level:{enumerable:!0,get(){return this._generator.level},set(n){this._generator.level=n}}}),Es=(n,t,e)=>{let s,i;return e===void 0?(s=n,i=t):(s=e.openAll+n,i=t+e.closeAll),{open:n,close:t,openAll:s,closeAll:i,parent:e}},be=(n,t,e)=>{let s=(...i)=>ye(i[0])&&ye(i[0].raw)?sn(s,an(s,...i)):sn(s,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(s,Ao),s._generator=n,s._styler=t,s._isEmpty=e,s},sn=(n,t)=>{if(n.level<=0||!t)return n._isEmpty?"":t;let e=n._styler;if(e===void 0)return t;let{openAll:s,closeAll:i}=e;if(t.indexOf("\x1B")!==-1)for(;e!==void 0;)t=Eo(t,e.close,e.open),e=e.parent;let r=t.indexOf(`
28
+ `);return r!==-1&&(t=Co(t,i,s,r)),s+t+i},vs,an=(n,...t)=>{let[e]=t;if(!ye(e)||!ye(e.raw))return t.join(" ");let s=t.slice(1),i=[e.raw[0]];for(let r=1;r<e.length;r++)i.push(String(s[r-1]).replace(/[{}\\]/g,"\\$&"),String(e.raw[r]));return vs===void 0&&(vs=en()),vs(n,i.join(""))};Object.defineProperties(we.prototype,$t);var ve=we();ve.supportsColor=xs;ve.stderr=we({level:Ss?Ss.level:0});ve.stderr.supportsColor=Ss;ln.exports=ve});var bn=E((Wl,wn)=>{"use strict";wn.exports=gn;function gn(n,t,e){n instanceof RegExp&&(n=mn(n,e)),t instanceof RegExp&&(t=mn(t,e));var s=yn(n,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+n.length,s[1]),post:e.slice(s[1]+t.length)}}function mn(n,t){var e=t.match(n);return e?e[0]:null}gn.range=yn;function yn(n,t,e){var s,i,r,o,a,l=e.indexOf(n),h=e.indexOf(t,l+1),c=l;if(l>=0&&h>0){if(n===t)return[l,h];for(s=[],r=e.length;c>=0&&!a;)c==l?(s.push(c),l=e.indexOf(n,c+1)):s.length==1?a=[s.pop(),h]:(i=s.pop(),i<r&&(r=i,o=h),h=e.indexOf(t,c+1)),c=l<h&&l>=0?l:h;s.length&&(a=[r,o])}return a}});var An=E((Bl,On)=>{var vn=bn();On.exports=Ro;var xn="\0SLASH"+Math.random()+"\0",Sn="\0OPEN"+Math.random()+"\0",$s="\0CLOSE"+Math.random()+"\0",_n="\0COMMA"+Math.random()+"\0",En="\0PERIOD"+Math.random()+"\0";function ks(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}function To(n){return n.split("\\\\").join(xn).split("\\{").join(Sn).split("\\}").join($s).split("\\,").join(_n).split("\\.").join(En)}function Fo(n){return n.split(xn).join("\\").split(Sn).join("{").split($s).join("}").split(_n).join(",").split(En).join(".")}function Cn(n){if(!n)return[""];var t=[],e=vn("{","}",n);if(!e)return n.split(",");var s=e.pre,i=e.body,r=e.post,o=s.split(",");o[o.length-1]+="{"+i+"}";var a=Cn(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}function Ro(n,t){if(!n)return[];t=t||{};var e=t.max==null?1/0:t.max;return n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),zt(To(n),e,!0).map(Fo)}function Mo(n){return"{"+n+"}"}function jo(n){return/^-?0\d/.test(n)}function Po(n,t){return n<=t}function Do(n,t){return n>=t}function zt(n,t,e){var s=[],i=vn("{","}",n);if(!i)return[n];var r=i.pre,o=i.post.length?zt(i.post,t,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<o.length&&a<t;a++){var l=r+"{"+i.body+"}"+o[a];s.push(l)}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),u=h||c,f=i.body.indexOf(",")>=0;if(!u&&!f)return i.post.match(/,(?!,).*\}/)?(n=i.pre+"{"+i.body+$s+i.post,zt(n,t,!0)):[n];var d;if(u)d=i.body.split(/\.\./);else if(d=Cn(i.body),d.length===1&&(d=zt(d[0],t,!1).map(Mo),d.length===1))return o.map(function(_r){return i.pre+d[0]+_r});var g;if(u){var p=ks(d[0]),b=ks(d[1]),y=Math.max(d[0].length,d[1].length),v=d.length==3?Math.max(Math.abs(ks(d[2])),1):1,x=Po,_=b<p;_&&(v*=-1,x=Do);var $=d.some(jo);g=[];for(var J=p;x(J,b)&&g.length<t;J+=v){var k;if(c)k=String.fromCharCode(J),k==="\\"&&(k="");else if(k=String(J),$){var bt=y-k.length;if(bt>0){var _t=new Array(bt+1).join("0");J<0?k="-"+_t+k.slice(1):k=_t+k}}g.push(k)}}else{g=[];for(var et=0;et<d.length;et++)g.push.apply(g,zt(d[et],t,!1))}for(var et=0;et<g.length;et++)for(var a=0;a<o.length&&s.length<t;a++){var l=r+g[et]+o[a];(!e||u||l)&&s.push(l)}}return s}});var li=P(ai(),1),{program:al,createCommand:ll,createArgument:hl,createOption:cl,CommanderError:ul,InvalidArgumentError:fl,InvalidOptionArgumentError:dl,Command:hi,Argument:pl,Option:ml,Help:gl}=li.default;var fn=P(require("http")),S=P(require("fs")),j=P(require("path")),dn=P(_i());var W=P(require("fs")),ut=P(require("path")),Ei=P(require("os")),fs=ut.join(Ei.homedir(),".hyv"),Ci=ut.join(fs,"credentials.json"),us=ut.join(fs,"profiles");function Oi(n){W.existsSync(n)||W.mkdirSync(n,{recursive:!0})}function Ct(){try{let n=W.readFileSync(Ci,"utf-8"),t=JSON.parse(n);return t.api_key?t:null}catch{return null}}function de(n){Oi(fs),W.writeFileSync(Ci,JSON.stringify(n,null,2))}function pe(){let n=ut.join(process.cwd(),".hyv.yml");if(!W.existsSync(n))return{};try{let t=W.readFileSync(n,"utf-8"),e={};for(let s of t.split(`
29
+ `)){let i=s.trim();if(!i||i.startsWith("#"))continue;let r=i.indexOf(":");if(r===-1)continue;let o=i.slice(0,r).trim(),a=i.slice(r+1).trim();o==="profile"?e.profile=a:o==="scan_paths"?e.scan_paths=a.split(",").map(l=>l.trim()):o==="ignore"&&(e.ignore=a.split(",").map(l=>l.trim()))}return e}catch{return{}}}function ds(n){let t=ut.join(process.cwd(),".hyv.yml"),e=["# hold your voice \u2014 project config"];n.profile&&e.push(`profile: ${n.profile}`),n.scan_paths?.length&&e.push(`scan_paths: ${n.scan_paths.join(", ")}`),W.writeFileSync(t,e.join(`
30
+ `)+`
31
+ `)}function Ai(n){let t=ut.join(us,`${n}.md`);try{return W.readFileSync(t,"utf-8")}catch{return null}}function ki(n,t){Oi(us),W.writeFileSync(ut.join(us,`${n}.md`),t)}var so="https://holdyourvoice.com";async function $i(n,t,e){let s=Ct();if(!s)throw new Error("Not authenticated. Run: hyv init");let i=`${s.base_url||so}${t}`,r={method:n,headers:{Authorization:`Bearer ${s.api_key}`,"Content-Type":"application/json"}};e&&(r.body=JSON.stringify(e));let o=await fetch(i,r);if(o.status===401)throw new Error("Session expired. Run: hyv init");if(o.status===403)throw new Error("Access denied. Check your subscription at holdyourvoice.com/dashboard");if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`API error (${o.status}): ${a.slice(0,200)}`)}return o.json()}function st(n){return $i("GET",n)}function ps(n,t){return $i("POST",n,t)}var at=P(hn()),m={dim:n=>at.default.dim(n),bold:n=>at.default.bold(n),accent:n=>at.default.hex("#C4441A")(n),green:n=>at.default.green(n),red:n=>at.default.red(n),yellow:n=>at.default.yellow(n),cyan:n=>at.default.cyan(n),white:n=>at.default.white(n)};function H(){return`${m.bold("hold your ")}${m.accent("voice")}`}function cn(n){let t=n.severity==="red"?m.red("\u25CF"):m.yellow("\u25CF"),e=m.dim(`${n.file}:${n.line}`),s=m.dim(n.pattern);console.log(` ${t} ${e} ${s}`),console.log(` ${n.excerpt}`)}function un(n){if(console.log(""),console.log(` ${m.bold("scanned")} ${m.cyan(String(n.files))} files, ${m.cyan(String(n.total_lines))} lines`),n.red+n.yellow===0)console.log(` ${m.green("\u2713 clean \u2014 no issues found")}`);else{let t=[];n.red&&t.push(m.red(`${n.red} critical`)),n.yellow&&t.push(m.yellow(`${n.yellow} advisory`)),console.log(` ${t.join(", ")}`)}}var Tt=process.env.HYV_BASE_URL||"https://holdyourvoice.com",Cs=`# Hold Your Voice \u2014 Agent Command
32
+
33
+ When the user mentions "voice", "brand voice", "hyv", "write in my voice", or "rewrite in my voice":
34
+
35
+ ## Inline rewrite (text in conversation)
36
+
37
+ 1. Capture the text the user wants rewritten (previous message, code block, paragraph, etc.)
38
+ 2. Run:
39
+ \`\`\`bash
40
+ hyv rewrite <profile> --text "the captured text"
41
+ \`\`\`
42
+ Or if no profile mentioned, use the default:
43
+ \`\`\`bash
44
+ hyv rewrite --text "the captured text"
45
+ \`\`\`
46
+ 3. Read the structured prompt from stdout
47
+ 4. Execute the rewrite following the prompt's instructions
48
+ 5. Present the rewritten text directly in the conversation
49
+
50
+ ## File rewrite
51
+
52
+ \`\`\`bash
53
+ hyv rewrite <profile> <file.md>
54
+ \`\`\`
55
+
56
+ ## Scan for issues
57
+
58
+ \`\`\`bash
59
+ hyv scan
60
+ \`\`\`
61
+
62
+ ## Rules
63
+
64
+ - The CLI never calls an LLM. It generates prompts. **You** execute the rewrite.
65
+ - Preserve original meaning. Match the voice profile's rhythm, vocabulary, patterns.
66
+ - If no profile specified, check \`.hyv.yml\` or ask the user.
67
+ - If CLI not installed: \`npx @holdyourvoice/hyv init\`
68
+ `,Os=`# Hold Your Voice (HYV)
69
+
70
+ When the user mentions "voice", "brand voice", "hyv", "write in my voice", or "rewrite in my voice":
71
+
72
+ 1. Capture the text the user wants rewritten
73
+ 2. Run: \`hyv rewrite <profile> --text "captured text"\`
74
+ 3. Read the structured prompt from stdout
75
+ 4. Execute the rewrite and present it
76
+
77
+ CLI generates prompts. You execute the rewrite. Preserve meaning. Match the voice profile.
78
+ If no profile: check \`.hyv.yml\` or ask user.
79
+ `,xe=`# Hold Your Voice (HYV)
80
+
81
+ When the user asks to rewrite text "in my voice", "using my brand voice", mentions "hyv", or references a voice profile:
82
+
83
+ 1. Capture the text to rewrite
84
+ 2. Run: \`hyv rewrite <profile> --text "captured text"\`
85
+ 3. Execute the rewrite from the prompt output
86
+ 4. Present the rewritten text
87
+
88
+ CLI never calls an LLM. You execute the rewrite. Match the voice profile.
89
+ `;function ko(){let n=process.cwd(),t=process.env.HOME||"",e=[],s=j.join(n,".claude","commands"),i=j.join(t,".claude","commands"),r="hyv.md";if(S.existsSync(j.join(n,".claude"))&&(S.mkdirSync(s,{recursive:!0}),S.writeFileSync(j.join(s,r),Cs),e.push("claude-code (project)")),S.existsSync(j.join(t,".claude"))){S.mkdirSync(i,{recursive:!0});let g=j.join(i,r);S.existsSync(g)||(S.writeFileSync(g,Cs),e.push("claude-code (global)"))}let o=j.join(n,"AGENTS.md"),a=j.join(t,".codex","AGENTS.md");(S.existsSync(j.join(n,".codex"))||S.existsSync(o))&&(S.existsSync(o)?S.readFileSync(o,"utf-8").includes("# Hold Your Voice (HYV)")||(S.appendFileSync(o,`
90
+
91
+ `+Os),e.push("codex (project)")):(S.writeFileSync(o,Os),e.push("codex (project)"))),S.existsSync(j.join(t,".codex"))&&(S.mkdirSync(j.join(t,".codex"),{recursive:!0}),S.existsSync(a)||(S.writeFileSync(a,Os),e.push("codex (global)")));let l=j.join(n,".cursorrules"),h="# Hold Your Voice (HYV)";S.existsSync(j.join(n,".cursor"))&&(S.existsSync(l)?S.readFileSync(l,"utf-8").includes(h)||(S.appendFileSync(l,`
92
+
93
+ `+xe),e.push("cursor (project)")):(S.writeFileSync(l,xe),e.push("cursor (project)")));let c=j.join(n,".windsurfrules");S.existsSync(j.join(n,".windsurf"))&&(S.existsSync(c)?S.readFileSync(c,"utf-8").includes(h)||(S.appendFileSync(c,`
94
+
95
+ `+xe),e.push("windsurf (project)")):(S.writeFileSync(c,xe),e.push("windsurf (project)")));let u=j.join(n,"CLAUDE.md"),f=`
96
+
97
+ `+Cs;return S.existsSync(u)&&(S.readFileSync(u,"utf-8").includes("Hold Your Voice")||(S.appendFileSync(u,f),e.push("CLAUDE.md (project)"))),e}async function pn(n,t){if(console.log(`
98
+ ${H()}
99
+ `),t?.key){await $o(t.key),As(n);return}let e=Ct();if(e)try{await st("/cli/heartbeat"),console.log(` ${m.green("\u2713")} already authenticated as ${m.dim(e.user_email||"unknown")}`),n&&(ds({profile:n}),console.log(` ${m.green("\u2713")} default profile set to ${m.bold(n)}`)),As(n);return}catch{console.log(` ${m.dim("credentials expired, re-authenticating...")}`)}let s=fn.createServer(),i=await new Promise(a=>{s.listen(0,"127.0.0.1",()=>{a(s.address().port)})});console.log(" opening browser for authentication..."),console.log(` ${m.dim("if the browser doesn't open, visit the URL manually")}
100
+ `);let r=`${Tt}/api/cli/auth?port=${i}`,o=new Promise((a,l)=>{let h=setTimeout(()=>{s.close(),l(new Error("Authentication timed out (5 minutes)"))},3e5);s.on("request",(c,u)=>{let f=new URL(c.url||"/",`http://127.0.0.1:${i}`),d=f.searchParams.get("token"),g=f.searchParams.get("email"),p=f.searchParams.get("name"),b=f.searchParams.get("error");if(b){u.writeHead(302,{Location:`${Tt}/dashboard?cli_error=${encodeURIComponent(b)}`}),u.end(),clearTimeout(h),s.close(),l(new Error(b));return}if(d){u.writeHead(200,{"Content-Type":"text/html"}),u.end(`<!DOCTYPE html><html><body style="font-family:sans-serif;text-align:center;padding:60px">
35
101
  <h2 style="color:#1A7A4A">\u2713 authenticated</h2>
36
102
  <p>you can close this tab and return to your terminal.</p>
37
103
  <script>setTimeout(() => window.close(), 2000)</script>
38
- </body></html>`),clearTimeout(h),s.close(),a({api_key:d,email:g||"",name:p||""});return}c.writeHead(302,{Location:r}),c.end()})});try{await(0,hn.default)(r)}catch{console.log(` ${m.yellow("!")} couldn't open browser. visit:`),console.log(` ${m.cyan(r)}
39
- `)}try{let{api_key:a,email:l,name:h}=await o;ds({api_key:a,base_url:$t,user_email:l,user_name:h}),console.log(` ${m.green("\u2713")} authenticated as ${m.bold(l||h)}`);try{let u=await tt("/cli/heartbeat");u.plan==="none"||u.status==="none"?(console.log(` ${m.yellow("!")} no active subscription`),console.log(` ${m.dim("visit")} ${m.cyan(`${$t}/dashboard`)} ${m.dim("to subscribe")}`)):console.log(` ${m.green("\u2713")} plan: ${m.bold(u.plan)}`)}catch{}n&&(me({profile:n}),console.log(` ${m.green("\u2713")} default profile set to ${m.bold(n)}`))}catch(a){console.log(`
40
- ${m.red("\u2717")} authentication failed: ${a.message}`),process.exit(1)}}async function Ao(n){let{saveCredentials:t}=await Promise.resolve().then(()=>(bt(),Ei));t({api_key:n,base_url:$t});try{let e=await tt("/cli/heartbeat");t({api_key:n,base_url:$t,user_email:e.email,user_name:e.name}),console.log(` ${m.green("\u2713")} authenticated with license key`)}catch(e){console.log(` ${m.red("\u2717")} invalid license key: ${e.message}`),process.exit(1)}}var Wt=I(require("fs")),qs=I(require("path"));var Mn=I(xn(),1);var Gt=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var jo={"[: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]},qt=n=>n.replace(/[[\]\\-]/g,"\\$&"),Do=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),En=n=>n.join(""),Cn=(n,t)=>{let e=t;if(n.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=e+1,o=!1,a=!1,l=!1,h=!1,u=e,c="";t:for(;r<n.length;){let p=n.charAt(r);if((p==="!"||p==="^")&&r===e+1){h=!0,r++;continue}if(p==="]"&&o&&!l){u=r+1;break}if(o=!0,p==="\\"&&!l){l=!0,r++;continue}if(p==="["&&!l){for(let[b,[y,v,S]]of Object.entries(jo))if(n.startsWith(b,r)){if(c)return["$.",!1,n.length-e,!0];r+=b.length,S?i.push(y):s.push(y),a=a||v;continue t}}if(l=!1,c){p>c?s.push(qt(c)+"-"+qt(p)):p===c&&s.push(qt(p)),c="",r++;continue}if(n.startsWith("-]",r+1)){s.push(qt(p+"-")),r+=2;continue}if(n.startsWith("-",r+1)){c=p,r+=2;continue}s.push(qt(p)),r++}if(u<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,n.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!h){let p=s[0].length===2?s[0].slice(-1):s[0];return[Do(p),!1,u-e,!1]}let f="["+(h?"^":"")+En(s)+"]",d="["+(h?"":"^")+En(i)+"]";return[s.length&&i.length?"("+f+"|"+d+")":s.length?f:d,a,u-e,!0]};var K=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var L,No=new Set(["!","?","+","*","@"]),$s=n=>No.has(n),On=n=>$s(n.type),Io=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Lo=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Wo=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),An=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Bo="(?!(?:^|/)\\.\\.?(?:$|/))",_e="(?!\\.)",Ho=new Set(["[","."]),Vo=new Set(["..","."]),zo=new Set("().*{}+?[]^$\\!"),Uo=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ts="[^/]",kn=Ts+"*?",$n=Ts+"+?",vt=class{type;#t;#s;#n=!1;#e=[];#o;#S;#h;#u=!1;#l;#a;#r=!1;constructor(t,e,s={}){this.type=t,t&&(this.#s=!0),this.#o=e,this.#t=this.#o?this.#o.#t:this,this.#l=this.#t===this?s:this.#t.#l,this.#h=this.#t===this?[]:this.#t.#h,t==="!"&&!this.#t.#u&&this.#h.push(this),this.#S=this.#o?this.#o.#e.length:0}get hasMagic(){if(this.#s!==void 0)return this.#s;for(let t of this.#e)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#s=!0;return this.#s}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#e.map(t=>String(t)).join("|")+")":this.#a=this.#e.map(t=>String(t)).join("")}#y(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#h.pop();){if(t.type!=="!")continue;let e=t,s=e.#o;for(;s;){for(let i=e.#S+1;!s.type&&i<s.#e.length;i++)for(let r of t.#e){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#e[i])}e=s,s=e.#o}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof L&&e.#o===this))throw new Error("invalid part: "+e);this.#e.push(e)}}toJSON(){let t=this.type===null?this.#e.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#e.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#S===0)return!0;let t=this.#o;for(let e=0;e<this.#S;e++){let s=t.#e[e];if(!(s instanceof L&&s.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#e.length:0;return this.#S===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new L(this.type,t);for(let s of this.#e)e.copyIn(s);return e}static#w(t,e,s,i,r){let o=i.maxExtglobRecursion??2,a=!1,l=!1,h=-1,u=!1;if(e.type===null){let p=s,b="";for(;p<t.length;){let y=t.charAt(p++);if(a||y==="\\"){a=!a,b+=y;continue}if(l){p===h+1?(y==="^"||y==="!")&&(u=!0):y==="]"&&!(p===h+2&&u)&&(l=!1),b+=y;continue}else if(y==="["){l=!0,h=p,u=!1,b+=y;continue}if(!i.noext&&$s(y)&&t.charAt(p)==="("&&r<=o){e.push(b),b="";let S=new L(y,e);p=L.#w(t,S,p,i,r+1),e.push(S);continue}b+=y}return e.push(b),p}let c=s+1,f=new L(null,e),d=[],g="";for(;c<t.length;){let p=t.charAt(c++);if(a||p==="\\"){a=!a,g+=p;continue}if(l){c===h+1?(p==="^"||p==="!")&&(u=!0):p==="]"&&!(c===h+2&&u)&&(l=!1),g+=p;continue}else if(p==="["){l=!0,h=c,u=!1,g+=p;continue}if($s(p)&&t.charAt(c)==="("&&(r<=o||e&&e.#_(p))){let y=e&&e.#_(p)?0:1;f.push(g),g="";let v=new L(p,f);f.push(v),c=L.#w(t,v,c,i,r+y);continue}if(p==="|"){f.push(g),g="",d.push(f),f=new L(null,e);continue}if(p===")")return g===""&&e.#e.length===0&&(e.#r=!0),f.push(g),g="",e.push(...d,f),c;g+=p}return e.type=null,e.#s=void 0,e.#e=[t.substring(s-1)],c}#m(t){return this.#d(t,Lo)}#d(t,e=Io){if(!t||typeof t!="object"||t.type!==null||t.#e.length!==1||this.type===null)return!1;let s=t.#e[0];return!s||typeof s!="object"||s.type===null?!1:this.#_(s.type,e)}#_(t,e=Wo){return!!e.get(this.type)?.includes(t)}#p(t,e){let s=t.#e[0],i=new L(null,s,this.options);i.#e.push(""),s.push(i),this.#E(t,e)}#E(t,e){let s=t.#e[0];this.#e.splice(e,1,...s.#e);for(let i of s.#e)typeof i=="object"&&(i.#o=this);this.#a=void 0}#C(t){return!!An.get(this.type)?.has(t)}#g(t){if(!t||typeof t!="object"||t.type!==null||t.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let e=t.#e[0];return!e||typeof e!="object"||e.type===null?!1:this.#C(e.type)}#x(t){let e=An.get(this.type),s=t.#e[0],i=e?.get(s.type);if(!i)return!1;this.#e=s.#e;for(let r of this.#e)typeof r=="object"&&(r.#o=this);this.type=i,this.#a=void 0,this.#r=!1}#b(){if(On(this)){let t=0,e=!1;do{e=!0;for(let s=0;s<this.#e.length;s++){let i=this.#e[s];typeof i=="object"&&(i.#b(),this.#d(i)?(e=!1,this.#E(i,s)):this.#m(i)?(e=!1,this.#p(i,s)):this.#g(i)&&(e=!1,this.#x(i)))}}while(!e&&++t<10)}else for(let t of this.#e)typeof t=="object"&&t.#b();this.#a=void 0}static fromGlob(t,e={}){let s=new L(null,void 0,e);return L.#w(t,s,0,e,0),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||this.#s||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let a=(this.#l.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:t})}get options(){return this.#l}toRegExpSource(t){let e=t??!!this.#l.dot;if(this.#t===this&&(this.#b(),this.#y()),!On(this)){let l=this.isStart()&&this.isEnd(),h=this.#e.map(d=>{let[g,p,b,y]=typeof d=="string"?L.#O(d,this.#s,l):d.toRegExpSource(t);return this.#s=this.#s||b,this.#n=this.#n||y,g}).join(""),u="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Vo.has(this.#e[0]))){let g=Ho,p=e&&g.has(h.charAt(0))||h.startsWith("\\.")&&g.has(h.charAt(2))||h.startsWith("\\.\\.")&&g.has(h.charAt(4)),b=!e&&!t&&g.has(h.charAt(0));u=p?Bo:b?_e:""}let c="";return this.isEnd()&&this.#t.#u&&this.#o?.type==="!"&&(c="(?:$|\\/)"),[u+h+c,K(h),this.#s=!!this.#s,this.#n]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#f(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString(),h=this;return h.#e=[l],h.type=null,h.#s=void 0,[l,K(this.toString()),!1,!1]}let o=!s||t||e||!_e?"":this.#f(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#r)a=(this.isStart()&&!e?_e:"")+$n;else{let l=this.type==="!"?"))"+(this.isStart()&&!e&&!t?_e:"")+kn+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+l}return[a,K(r),this.#s=!!this.#s,this.#n]}#f(t){return this.#e.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,r,o]=e.toRegExpSource(t);return this.#n=this.#n||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#O(t,e,s=!1){let i=!1,r="",o=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(i){i=!1,r+=(zo.has(h)?"\\":"")+h,a=!1;continue}if(h==="\\"){l===t.length-1?r+="\\\\":i=!0;continue}if(h==="["){let[u,c,f,d]=Cn(t,l);if(f){r+=u,o=o||c,l+=f-1,e=e||d,a=!1;continue}}if(h==="*"){if(a)continue;a=!0,r+=s&&/^[*]+$/.test(t)?$n:kn,e=!0;continue}else a=!1;if(h==="?"){r+=Ts,e=!0;continue}r+=Uo(h)}return[r,K(t),!!e,o]}};L=vt;var Tt=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var D=(n,t,e={})=>(Gt(t),!e.nocomment&&t.charAt(0)==="#"?!1:new B(t,e).match(n)),Go=/^\*+([^+@!?\*\[\(]*)$/,qo=n=>t=>!t.startsWith(".")&&t.endsWith(n),Yo=n=>t=>t.endsWith(n),Ko=n=>(n=n.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(n)),Jo=n=>(n=n.toLowerCase(),t=>t.toLowerCase().endsWith(n)),Xo=/^\*+\.\*+$/,Zo=n=>!n.startsWith(".")&&n.includes("."),Qo=n=>n!=="."&&n!==".."&&n.includes("."),ta=/^\.\*+$/,ea=n=>n!=="."&&n!==".."&&n.startsWith("."),sa=/^\*+$/,ia=n=>n.length!==0&&!n.startsWith("."),na=n=>n.length!==0&&n!=="."&&n!=="..",ra=/^\?+([^+@!?\*\[\(]*)?$/,oa=([n,t=""])=>{let e=Fn([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},aa=([n,t=""])=>{let e=Pn([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},la=([n,t=""])=>{let e=Pn([n]);return t?s=>e(s)&&s.endsWith(t):e},ha=([n,t=""])=>{let e=Fn([n]);return t?s=>e(s)&&s.endsWith(t):e},Fn=([n])=>{let t=n.length;return e=>e.length===t&&!e.startsWith(".")},Pn=([n])=>{let t=n.length;return e=>e.length===t&&e!=="."&&e!==".."},jn=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Tn={win32:{sep:"\\"},posix:{sep:"/"}},ca=jn==="win32"?Tn.win32.sep:Tn.posix.sep;D.sep=ca;var C=Symbol("globstar **");D.GLOBSTAR=C;var ua="[^/]",fa=ua+"*?",da="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",pa="(?:(?!(?:\\/|^)\\.).)*?",ma=(n,t={})=>e=>D(e,n,t);D.filter=ma;var U=(n,t={})=>Object.assign({},n,t),ga=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return D;let t=D;return Object.assign((s,i,r={})=>t(s,i,U(n,r)),{Minimatch:class extends t.Minimatch{constructor(i,r={}){super(i,U(n,r))}static defaults(i){return t.defaults(U(n,i)).Minimatch}},AST:class extends t.AST{constructor(i,r,o={}){super(i,r,U(n,o))}static fromGlob(i,r={}){return t.AST.fromGlob(i,U(n,r))}},unescape:(s,i={})=>t.unescape(s,U(n,i)),escape:(s,i={})=>t.escape(s,U(n,i)),filter:(s,i={})=>t.filter(s,U(n,i)),defaults:s=>t.defaults(U(n,s)),makeRe:(s,i={})=>t.makeRe(s,U(n,i)),braceExpand:(s,i={})=>t.braceExpand(s,U(n,i)),match:(s,i,r={})=>t.match(s,i,U(n,r)),sep:t.sep,GLOBSTAR:C})};D.defaults=ga;var Dn=(n,t={})=>(Gt(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Mn.default)(n));D.braceExpand=Dn;var ya=(n,t={})=>new B(n,t).makeRe();D.makeRe=ya;var wa=(n,t,e={})=>{let s=new B(t,e);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(t),n};D.match=wa;var Rn=/[?*]|[+@!]\(.*?\)|\[|\]/,ba=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),B=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,e={}){Gt(t),e=e||{},this.options=e,this.maxGlobstarRecursion=e.maxGlobstarRecursion??200,this.pattern=t,this.platform=e.platform||jn,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=r[0]===""&&r[1]===""&&(r[2]==="?"||!Rn.test(r[2]))&&!Rn.test(r[3]),h=/^[a-z]:/i.test(r[0]);if(l)return[...r.slice(0,4),...r.slice(4).map(u=>this.parse(u))];if(h)return[r[0],...r.slice(1).map(u=>this.parse(u))]}return r.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let i=0;i<t[s].length;i++)t[s][i]==="**"&&(t[s][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let r=t[i];i===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let i=t[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let o=i;for(;s[o+1]==="**";)o++;o>i&&s.splice(i+1,o-i);let a=s[i+1],l=s[i+2],h=s[i+3];if(a!==".."||!l||l==="."||l===".."||!h||h==="."||h==="..")continue;e=!0,s.splice(i,1);let u=s.slice(0);u[i]="**",t.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let a=s[o];o===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let l=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...l),s.length===0&&s.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let i=0,r=0,o=[],a="";for(;i<t.length&&r<e.length;)if(t[i]===e[r])o.push(a==="b"?e[r]:t[i]),i++,r++;else if(s&&t[i]==="**"&&e[r]===t[i+1])o.push(t[i]),i++;else if(s&&e[r]==="**"&&t[i]===e[r+1])o.push(e[r]),r++;else if(t[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(a==="b")return!1;a="a",o.push(t[i]),i++,r++}else if(e[r]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",o.push(e[r]),i++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let i=0,r=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),l=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),h=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),u=!h&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),c=l?3:a?0:void 0,f=u?3:h?0:void 0;if(typeof c=="number"&&typeof f=="number"){let[d,g]=[t[c],e[f]];d.toLowerCase()===g.toLowerCase()&&(e[f]=d,r=f,i=c)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),e.includes(C)?this.#t(t,e,s,i,r):this.#n(t,e,s,i,r)}#t(t,e,s,i,r){let o=e.indexOf(C,r),a=e.lastIndexOf(C),[l,h,u]=s?[e.slice(r,o),e.slice(o+1),[]]:[e.slice(r,o),e.slice(o+1,a),e.slice(a+1)];if(l.length){let v=t.slice(i,i+l.length);if(!this.#n(v,l,s,0,0))return!1;i+=l.length}let c=0;if(u.length){if(u.length+i>t.length)return!1;let v=t.length-u.length;if(this.#n(t,u,s,v,0))c=u.length;else{if(t[t.length-1]!==""||i+u.length===t.length||(v--,!this.#n(t,u,s,v,0)))return!1;c=u.length+1}}if(!h.length){let v=!!c;for(let S=i;S<t.length-c;S++){let _=String(t[S]);if(v=!0,_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return s||v}let f=[[[],0]],d=f[0],g=0,p=[0];for(let v of h)v===C?(p.push(g),d=[[],0],f.push(d)):(d[0].push(v),g++);let b=f.length-1,y=t.length-c;for(let v of f)v[1]=y-(p[b--]+v[0].length);return!!this.#s(t,f,i,0,s,0,!!c)}#s(t,e,s,i,r,o,a){let l=e[i];if(!l){for(let c=s;c<t.length;c++){a=!0;let f=t[c];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[h,u]=l;for(;s<=u;){if(this.#n(t.slice(0,s+h.length),h,r,s,0)&&o<this.maxGlobstarRecursion){let d=this.#s(t,e,s+h.length,i+1,r,o+1,a);if(d!==!1)return d}let f=t[s];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;s++}return r||null}#n(t,e,s,i,r){let o,a,l,h;for(o=i,a=r,h=t.length,l=e.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");let u=e[a],c=t[o];if(this.debug(e,u,c),u===!1||u===C)return!1;let f;if(typeof u=="string"?(f=c===u,this.debug("string match",u,c,f)):(f=u.test(c),this.debug("pattern match",u,c,f)),!f)return!1}if(o===h&&a===l)return!0;if(o===h)return s;if(a===l)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Dn(this.pattern,this.options)}parse(t){Gt(t);let e=this.options;if(t==="**")return C;if(t==="")return"";let s,i=null;(s=t.match(sa))?i=e.dot?na:ia:(s=t.match(Go))?i=(e.nocase?e.dot?Jo:Ko:e.dot?Yo:qo)(s[1]):(s=t.match(ra))?i=(e.nocase?e.dot?aa:oa:e.dot?la:ha)(s):(s=t.match(Xo))?i=e.dot?Qo:Zo:(s=t.match(ta))&&(i=ea);let r=vt.fromGlob(t,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?fa:e.dot?da:pa,i=new Set(e.nocase?["i"]:[]),r=t.map(l=>{let h=l.map(u=>{if(u instanceof RegExp)for(let c of u.flags.split(""))i.add(c);return typeof u=="string"?ba(u):u===C?C:u._src});return h.forEach((u,c)=>{let f=h[c+1],d=h[c-1];u!==C||d===C||(d===void 0?f!==void 0&&f!==C?h[c+1]="(?:\\/|"+s+"\\/)?"+f:h[c]=s:f===void 0?h[c-1]=d+"(?:\\/|"+s+")?":f!==C&&(h[c-1]=d+"(?:\\/|\\/"+s+"\\/)"+f,h[c+1]=C))}),h.filter(u=>u!==C).join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<r.length;a++){let l=r[a],h=i;if(s.matchBase&&l.length===1&&(h=[o]),this.matchOne(h,l,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return D.defaults(t).Minimatch}};D.AST=vt;D.Minimatch=B;D.escape=Tt;D.unescape=K;var or=require("node:url");var Rt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,In=new Set,Rs=typeof process=="object"&&process?process:{},Ln=(n,t,e,s)=>{typeof Rs.emitWarning=="function"?Rs.emitWarning(n,t,e,s):console.error(`[${e}] ${t}: ${n}`)},xe=globalThis.AbortController,Nn=globalThis.AbortSignal;if(typeof xe>"u"){Nn=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},xe=class{constructor(){t()}signal=new Nn;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let n=Rs.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{n&&(n=!1,Ln("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var va=n=>!In.has(n),nh=Symbol("type"),ut=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),Wn=n=>ut(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Mt:null:null,Mt=class extends Array{constructor(t){super(t),this.fill(0)}},Ms=class n{heap;length;static#t=!1;static create(t){let e=Wn(t);if(!e)return[];n.#t=!0;let s=new n(t,e);return n.#t=!1,s}constructor(t,e){if(!n.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Yt=class n{#t;#s;#n;#e;#o;#S;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#u;#l;#a;#r;#y;#w;#m;#d;#_;#p;#E;#C;#g;#x;#b;#f;static unsafeExposeInternals(t){return{starts:t.#C,ttls:t.#g,sizes:t.#E,keyMap:t.#l,keyList:t.#a,valList:t.#r,next:t.#y,prev:t.#w,get head(){return t.#m},get tail(){return t.#d},free:t.#_,isBackgroundFetch:e=>t.#c(e),backgroundFetch:(e,s,i,r)=>t.#I(e,s,i,r),moveToTail:e=>t.#W(e),indexes:e=>t.#k(e),rindexes:e=>t.#$(e),isStale:e=>t.#v(e)}}get max(){return this.#t}get maxSize(){return this.#s}get calculatedSize(){return this.#u}get size(){return this.#h}get fetchMethod(){return this.#o}get memoMethod(){return this.#S}get dispose(){return this.#n}get disposeAfter(){return this.#e}constructor(t){let{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:h,disposeAfter:u,noDisposeOnSet:c,noUpdateTTL:f,maxSize:d=0,maxEntrySize:g=0,sizeCalculation:p,fetchMethod:b,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:k,ignoreFetchAbort:Y}=t;if(e!==0&&!ut(e))throw new TypeError("max option must be a nonnegative integer");let A=e?Wn(e):Array;if(!A)throw new Error("invalid max value: "+e);if(this.#t=e,this.#s=d,this.maxEntrySize=g||this.#s,this.sizeCalculation=p,this.sizeCalculation){if(!this.#s&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#S=y,b!==void 0&&typeof b!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=b,this.#b=!!b,this.#l=new Map,this.#a=new Array(e).fill(void 0),this.#r=new Array(e).fill(void 0),this.#y=new A(e),this.#w=new A(e),this.#m=0,this.#d=0,this.#_=Ms.create(e),this.#h=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof u=="function"?(this.#e=u,this.#p=[]):(this.#e=void 0,this.#p=void 0),this.#x=!!this.#n,this.#f=!!this.#e,this.noDisposeOnSet=!!c,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!Y,this.maxEntrySize!==0){if(this.#s!==0&&!ut(this.#s))throw new TypeError("maxSize must be a positive integer if specified");if(!ut(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=ut(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!ut(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#t===0&&this.ttl===0&&this.#s===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#s){let yt="LRU_CACHE_UNBOUNDED";va(yt)&&(In.add(yt),Ln("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",yt,n))}}getRemainingTTL(t){return this.#l.has(t)?1/0:0}#O(){let t=new Mt(this.#t),e=new Mt(this.#t);this.#g=t,this.#C=e,this.#M=(r,o,a=Rt.now())=>{if(e[r]=o!==0?a:0,t[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#v(r)&&this.#R(this.#a[r],"expire")},o+1);l.unref&&l.unref()}},this.#A=r=>{e[r]=t[r]!==0?Rt.now():0},this.#i=(r,o)=>{if(t[o]){let a=t[o],l=e[o];if(!a||!l)return;r.ttl=a,r.start=l,r.now=s||i();let h=r.now-l;r.remainingTTL=a-h}};let s=0,i=()=>{let r=Rt.now();if(this.ttlResolution>0){s=r;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{let o=this.#l.get(r);if(o===void 0)return 0;let a=t[o],l=e[o];if(!a||!l)return 1/0;let h=(s||i())-l;return a-h},this.#v=r=>{let o=e[r],a=t[r];return!!a&&!!o&&(s||i())-o>a}}#A=()=>{};#i=()=>{};#M=()=>{};#v=()=>!1;#T(){let t=new Mt(this.#t);this.#u=0,this.#E=t,this.#F=e=>{this.#u-=t[e],t[e]=0},this.#j=(e,s,i,r)=>{if(this.#c(s))return 0;if(!ut(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,e),!ut(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#P=(e,s,i)=>{if(t[e]=s,this.#s){let r=this.#s-t[e];for(;this.#u>r;)this.#N(!0)}this.#u+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#u)}}#F=t=>{};#P=(t,e,s)=>{};#j=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#d;!(!this.#D(e)||((t||!this.#v(e))&&(yield e),e===this.#m));)e=this.#w[e]}*#$({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#m;!(!this.#D(e)||((t||!this.#v(e))&&(yield e),e===this.#d));)e=this.#y[e]}#D(t){return t!==void 0&&this.#l.get(this.#a[t])===t}*entries(){for(let t of this.#k())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#c(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*rentries(){for(let t of this.#$())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#c(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*keys(){for(let t of this.#k()){let e=this.#a[t];e!==void 0&&!this.#c(this.#r[t])&&(yield e)}}*rkeys(){for(let t of this.#$()){let e=this.#a[t];e!==void 0&&!this.#c(this.#r[t])&&(yield e)}}*values(){for(let t of this.#k())this.#r[t]!==void 0&&!this.#c(this.#r[t])&&(yield this.#r[t])}*rvalues(){for(let t of this.#$())this.#r[t]!==void 0&&!this.#c(this.#r[t])&&(yield this.#r[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let s of this.#k()){let i=this.#r[s],r=this.#c(i)?i.__staleWhileFetching:i;if(r!==void 0&&t(r,this.#a[s],this))return this.get(this.#a[s],e)}}forEach(t,e=this){for(let s of this.#k()){let i=this.#r[s],r=this.#c(i)?i.__staleWhileFetching:i;r!==void 0&&t.call(e,r,this.#a[s],this)}}rforEach(t,e=this){for(let s of this.#$()){let i=this.#r[s],r=this.#c(i)?i.__staleWhileFetching:i;r!==void 0&&t.call(e,r,this.#a[s],this)}}purgeStale(){let t=!1;for(let e of this.#$({allowStale:!0}))this.#v(e)&&(this.#R(this.#a[e],"expire"),t=!0);return t}info(t){let e=this.#l.get(t);if(e===void 0)return;let s=this.#r[e],i=this.#c(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#g&&this.#C){let o=this.#g[e],a=this.#C[e];if(o&&a){let l=o-(Rt.now()-a);r.ttl=l,r.start=Date.now()}}return this.#E&&(r.size=this.#E[e]),r}dump(){let t=[];for(let e of this.#k({allowStale:!0})){let s=this.#a[e],i=this.#r[e],r=this.#c(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let o={value:r};if(this.#g&&this.#C){o.ttl=this.#g[e];let a=Rt.now()-this.#C[e];o.start=Math.floor(Date.now()-a)}this.#E&&(o.size=this.#E[e]),t.unshift([s,o])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let i=Date.now()-s.start;s.start=Rt.now()-i}this.set(e,s.value,s)}}set(t,e,s={}){if(e===void 0)return this.delete(t),this;let{ttl:i=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=s,{noUpdateTTL:h=this.noUpdateTTL}=s,u=this.#j(t,e,s.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#R(t,"set"),this;let c=this.#h===0?void 0:this.#l.get(t);if(c===void 0)c=this.#h===0?this.#d:this.#_.length!==0?this.#_.pop():this.#h===this.#t?this.#N(!1):this.#h,this.#a[c]=t,this.#r[c]=e,this.#l.set(t,c),this.#y[this.#d]=c,this.#w[c]=this.#d,this.#d=c,this.#h++,this.#P(c,u,l),l&&(l.set="add"),h=!1;else{this.#W(c);let f=this.#r[c];if(e!==f){if(this.#b&&this.#c(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!o&&(this.#x&&this.#n?.(d,t,"set"),this.#f&&this.#p?.push([d,t,"set"]))}else o||(this.#x&&this.#n?.(f,t,"set"),this.#f&&this.#p?.push([f,t,"set"]));if(this.#F(c),this.#P(c,u,l),this.#r[c]=e,l){l.set="replace";let d=f&&this.#c(f)?f.__staleWhileFetching:f;d!==void 0&&(l.oldValue=d)}}else l&&(l.set="update")}if(i!==0&&!this.#g&&this.#O(),this.#g&&(h||this.#M(c,i,r),l&&this.#i(l,c)),!o&&this.#f&&this.#p){let f=this.#p,d;for(;d=f?.shift();)this.#e?.(...d)}return this}pop(){try{for(;this.#h;){let t=this.#r[this.#m];if(this.#N(!0),this.#c(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#f&&this.#p){let t=this.#p,e;for(;e=t?.shift();)this.#e?.(...e)}}}#N(t){let e=this.#m,s=this.#a[e],i=this.#r[e];return this.#b&&this.#c(i)?i.__abortController.abort(new Error("evicted")):(this.#x||this.#f)&&(this.#x&&this.#n?.(i,s,"evict"),this.#f&&this.#p?.push([i,s,"evict"])),this.#F(e),t&&(this.#a[e]=void 0,this.#r[e]=void 0,this.#_.push(e)),this.#h===1?(this.#m=this.#d=0,this.#_.length=0):this.#m=this.#y[e],this.#l.delete(s),this.#h--,e}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#l.get(t);if(r!==void 0){let o=this.#r[r];if(this.#c(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(r))i&&(i.has="stale",this.#i(i,r));else return s&&this.#A(r),i&&(i.has="hit",this.#i(i,r)),!0}else i&&(i.has="miss");return!1}peek(t,e={}){let{allowStale:s=this.allowStale}=e,i=this.#l.get(t);if(i===void 0||!s&&this.#v(i))return;let r=this.#r[i];return this.#c(r)?r.__staleWhileFetching:r}#I(t,e,s,i){let r=e===void 0?void 0:this.#r[e];if(this.#c(r))return r;let o=new xe,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:s,context:i},h=(p,b=!1)=>{let{aborted:y}=o.signal,v=s.ignoreFetchAbort&&p!==void 0;if(s.status&&(y&&!b?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,v&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),y&&!v&&!b)return c(o.signal.reason);let S=d;return this.#r[e]===d&&(p===void 0?S.__staleWhileFetching?this.#r[e]=S.__staleWhileFetching:this.#R(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,p,l.options))),p},u=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),c(p)),c=p=>{let{aborted:b}=o.signal,y=b&&s.allowStaleOnFetchAbort,v=y||s.allowStaleOnFetchRejection,S=v||s.noDeleteOnFetchRejection,_=d;if(this.#r[e]===d&&(!S||_.__staleWhileFetching===void 0?this.#R(t,"fetch"):y||(this.#r[e]=_.__staleWhileFetching)),v)return s.status&&_.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),_.__staleWhileFetching;if(_.__returned===_)throw p},f=(p,b)=>{let y=this.#o?.(t,r,l);y&&y instanceof Promise&&y.then(v=>p(v===void 0?void 0:v),b),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=v=>h(v,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(f).then(h,u),g=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,g,{...l.options,status:void 0}),e=this.#l.get(t)):this.#r[e]=g,g}#c(t){if(!this.#b)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof xe}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:p,forceRefresh:b=!1,status:y,signal:v}=e;if(!this.#b)return y&&(y.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:y});let S={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:y,signal:v},_=this.#l.get(t);if(_===void 0){y&&(y.fetch="miss");let k=this.#I(t,_,S,p);return k.__returned=k}else{let k=this.#r[_];if(this.#c(k)){let Q=s&&k.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",Q&&(y.returnedStale=!0)),Q?k.__staleWhileFetching:k.__returned=k}let Y=this.#v(_);if(!b&&!Y)return y&&(y.fetch="hit"),this.#W(_),i&&this.#A(_),y&&this.#i(y,_),k;let A=this.#I(t,_,S,p),xt=A.__staleWhileFetching!==void 0&&s;return y&&(y.fetch=Y?"stale":"refresh",xt&&Y&&(y.returnedStale=!0)),xt?A.__staleWhileFetching:A.__returned=A}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=this.#S;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...o}=e,a=this.get(t,o);if(!r&&a!==void 0)return a;let l=s(t,a,{options:o,context:i});return this.set(t,l,o),l}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=e,a=this.#l.get(t);if(a!==void 0){let l=this.#r[a],h=this.#c(l);return o&&this.#i(o,a),this.#v(a)?(o&&(o.get="stale"),h?(o&&s&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?l.__staleWhileFetching:void 0):(r||this.#R(t,"expire"),o&&s&&(o.returnedStale=!0),s?l:void 0)):(o&&(o.get="hit"),h?l.__staleWhileFetching:(this.#W(a),i&&this.#A(a),l))}else o&&(o.get="miss")}#L(t,e){this.#w[e]=t,this.#y[t]=e}#W(t){t!==this.#d&&(t===this.#m?this.#m=this.#y[t]:this.#L(this.#w[t],this.#y[t]),this.#L(this.#d,t),this.#d=t)}delete(t){return this.#R(t,"delete")}#R(t,e){let s=!1;if(this.#h!==0){let i=this.#l.get(t);if(i!==void 0)if(s=!0,this.#h===1)this.#B(e);else{this.#F(i);let r=this.#r[i];if(this.#c(r)?r.__abortController.abort(new Error("deleted")):(this.#x||this.#f)&&(this.#x&&this.#n?.(r,t,e),this.#f&&this.#p?.push([r,t,e])),this.#l.delete(t),this.#a[i]=void 0,this.#r[i]=void 0,i===this.#d)this.#d=this.#w[i];else if(i===this.#m)this.#m=this.#y[i];else{let o=this.#w[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#w[a]=this.#w[i]}this.#h--,this.#_.push(i)}}if(this.#f&&this.#p?.length){let i=this.#p,r;for(;r=i?.shift();)this.#e?.(...r)}return s}clear(){return this.#B("delete")}#B(t){for(let e of this.#$({allowStale:!0})){let s=this.#r[e];if(this.#c(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#a[e];this.#x&&this.#n?.(s,i,t),this.#f&&this.#p?.push([s,i,t])}}if(this.#l.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#g&&this.#C&&(this.#g.fill(0),this.#C.fill(0)),this.#E&&this.#E.fill(0),this.#m=0,this.#d=0,this.#_.length=0,this.#u=0,this.#h=0,this.#f&&this.#p){let e=this.#p,s;for(;s=e?.shift();)this.#e?.(...s)}}};var jt=require("node:path"),Jn=require("node:url"),it=require("fs"),Ta=I(require("node:fs"),1),pt=require("node:fs/promises");var Te=require("node:events"),Ls=I(require("node:stream"),1),Un=require("node:string_decoder"),Bn=typeof process=="object"&&process?process:{stdout:null,stderr:null},Sa=n=>!!n&&typeof n=="object"&&(n instanceof dt||n instanceof Ls.default||_a(n)||xa(n)),_a=n=>!!n&&typeof n=="object"&&n instanceof Te.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==Ls.default.Writable.prototype.pipe,xa=n=>!!n&&typeof n=="object"&&n instanceof Te.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",ot=Symbol("EOF"),at=Symbol("maybeEmitEnd"),ft=Symbol("emittedEnd"),Ee=Symbol("emittingEnd"),Kt=Symbol("emittedError"),Ce=Symbol("closed"),Hn=Symbol("read"),Oe=Symbol("flush"),Vn=Symbol("flushChunk"),J=Symbol("encoding"),Ft=Symbol("decoder"),T=Symbol("flowing"),Jt=Symbol("paused"),Pt=Symbol("resume"),R=Symbol("buffer"),N=Symbol("pipes"),M=Symbol("bufferLength"),Fs=Symbol("bufferPush"),Ae=Symbol("bufferShift"),F=Symbol("objectMode"),O=Symbol("destroyed"),Ps=Symbol("error"),js=Symbol("emitData"),zn=Symbol("emitEnd"),Ds=Symbol("emitEnd2"),et=Symbol("async"),Ns=Symbol("abort"),ke=Symbol("aborted"),Xt=Symbol("signal"),St=Symbol("dataListeners"),H=Symbol("discarded"),Zt=n=>Promise.resolve().then(n),Ea=n=>n(),Ca=n=>n==="end"||n==="finish"||n==="prefinish",Oa=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,Aa=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),$e=class{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[Pt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Is=class extends $e{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=i=>this.dest.emit("error",i),t.on("error",this.proxyErrors)}},ka=n=>!!n.objectMode,$a=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",dt=class extends Te.EventEmitter{[T]=!1;[Jt]=!1;[N]=[];[R]=[];[F];[J];[et];[Ft];[ot]=!1;[ft]=!1;[Ee]=!1;[Ce]=!1;[Kt]=null;[M]=0;[O]=!1;[Xt];[ke]=!1;[St]=0;[H]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");ka(e)?(this[F]=!0,this[J]=null):$a(e)?(this[J]=e.encoding,this[F]=!1):(this[F]=!1,this[J]=null),this[et]=!!e.async,this[Ft]=this[J]?new Un.StringDecoder(this[J]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[R]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[N]});let{signal:s}=e;s&&(this[Xt]=s,s.aborted?this[Ns]():s.addEventListener("abort",()=>this[Ns]()))}get bufferLength(){return this[M]}get encoding(){return this[J]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[F]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[et]}set async(t){this[et]=this[et]||!!t}[Ns](){this[ke]=!0,this.emit("abort",this[Xt]?.reason),this.destroy(this[Xt]?.reason)}get aborted(){return this[ke]}set aborted(t){}write(t,e,s){if(this[ke])return!1;if(this[ot])throw new Error("write after end");if(this[O])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let i=this[et]?Zt:Ea;if(!this[F]&&!Buffer.isBuffer(t)){if(Aa(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Oa(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[F]?(this[T]&&this[M]!==0&&this[Oe](!0),this[T]?this.emit("data",t):this[Fs](t),this[M]!==0&&this.emit("readable"),s&&i(s),this[T]):t.length?(typeof t=="string"&&!(e===this[J]&&!this[Ft]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[J]&&(t=this[Ft].write(t)),this[T]&&this[M]!==0&&this[Oe](!0),this[T]?this.emit("data",t):this[Fs](t),this[M]!==0&&this.emit("readable"),s&&i(s),this[T]):(this[M]!==0&&this.emit("readable"),s&&i(s),this[T])}read(t){if(this[O])return null;if(this[H]=!1,this[M]===0||t===0||t&&t>this[M])return this[at](),null;this[F]&&(t=null),this[R].length>1&&!this[F]&&(this[R]=[this[J]?this[R].join(""):Buffer.concat(this[R],this[M])]);let e=this[Hn](t||null,this[R][0]);return this[at](),e}[Hn](t,e){if(this[F])this[Ae]();else{let s=e;t===s.length||t===null?this[Ae]():typeof s=="string"?(this[R][0]=s.slice(t),e=s.slice(0,t),this[M]-=t):(this[R][0]=s.subarray(t),e=s.subarray(0,t),this[M]-=t)}return this.emit("data",e),!this[R].length&&!this[ot]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=void 0),typeof e=="function"&&(s=e,e="utf8"),t!==void 0&&this.write(t,e),s&&this.once("end",s),this[ot]=!0,this.writable=!1,(this[T]||!this[Jt])&&this[at](),this}[Pt](){this[O]||(!this[St]&&!this[N].length&&(this[H]=!0),this[Jt]=!1,this[T]=!0,this.emit("resume"),this[R].length?this[Oe]():this[ot]?this[at]():this.emit("drain"))}resume(){return this[Pt]()}pause(){this[T]=!1,this[Jt]=!0,this[H]=!1}get destroyed(){return this[O]}get flowing(){return this[T]}get paused(){return this[Jt]}[Fs](t){this[F]?this[M]+=1:this[M]+=t.length,this[R].push(t)}[Ae](){return this[F]?this[M]-=1:this[M]-=this[R][0].length,this[R].shift()}[Oe](t=!1){do;while(this[Vn](this[Ae]())&&this[R].length);!t&&!this[R].length&&!this[ot]&&this.emit("drain")}[Vn](t){return this.emit("data",t),this[T]}pipe(t,e){if(this[O])return t;this[H]=!1;let s=this[ft];return e=e||{},t===Bn.stdout||t===Bn.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[N].push(e.proxyErrors?new Is(this,t,e):new $e(this,t,e)),this[et]?Zt(()=>this[Pt]()):this[Pt]()),t}unpipe(t){let e=this[N].find(s=>s.dest===t);e&&(this[N].length===1?(this[T]&&this[St]===0&&(this[T]=!1),this[N]=[]):this[N].splice(this[N].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let s=super.on(t,e);if(t==="data")this[H]=!1,this[St]++,!this[N].length&&!this[T]&&this[Pt]();else if(t==="readable"&&this[M]!==0)super.emit("readable");else if(Ca(t)&&this[ft])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Kt]){let i=e;this[et]?Zt(()=>i.call(this,this[Kt])):i.call(this,this[Kt])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){let s=super.off(t,e);return t==="data"&&(this[St]=this.listeners("data").length,this[St]===0&&!this[H]&&!this[N].length&&(this[T]=!1)),s}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[St]=0,!this[H]&&!this[N].length&&(this[T]=!1)),e}get emittedEnd(){return this[ft]}[at](){!this[Ee]&&!this[ft]&&!this[O]&&this[R].length===0&&this[ot]&&(this[Ee]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ce]&&this.emit("close"),this[Ee]=!1)}emit(t,...e){let s=e[0];if(t!=="error"&&t!=="close"&&t!==O&&this[O])return!1;if(t==="data")return!this[F]&&!s?!1:this[et]?(Zt(()=>this[js](s)),!0):this[js](s);if(t==="end")return this[zn]();if(t==="close"){if(this[Ce]=!0,!this[ft]&&!this[O])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[Kt]=s,super.emit(Ps,s);let r=!this[Xt]||this.listeners("error").length?super.emit("error",s):!1;return this[at](),r}else if(t==="resume"){let r=super.emit("resume");return this[at](),r}else if(t==="finish"||t==="prefinish"){let r=super.emit(t);return this.removeAllListeners(t),r}let i=super.emit(t,...e);return this[at](),i}[js](t){for(let s of this[N])s.dest.write(t)===!1&&this.pause();let e=this[H]?!1:super.emit("data",t);return this[at](),e}[zn](){return this[ft]?!1:(this[ft]=!0,this.readable=!1,this[et]?(Zt(()=>this[Ds]()),!0):this[Ds]())}[Ds](){if(this[Ft]){let e=this[Ft].end();if(e){for(let s of this[N])s.dest.write(e);this[H]||super.emit("data",e)}}for(let e of this[N])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[F]||(t.dataLength=0);let e=this.promise();return this.on("data",s=>{t.push(s),this[F]||(t.dataLength+=s.length)}),await e,t}async concat(){if(this[F])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[J]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(O,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[H]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ot])return e();let r,o,a=c=>{this.off("data",l),this.off("end",h),this.off(O,u),e(),o(c)},l=c=>{this.off("error",a),this.off("end",h),this.off(O,u),this.pause(),r({value:c,done:!!this[ot]})},h=()=>{this.off("error",a),this.off("data",l),this.off(O,u),e(),r({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((c,f)=>{o=f,r=c,this.once(O,u),this.once("error",a),this.once("end",h),this.once("data",l)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[H]=!1;let t=!1,e=()=>(this.pause(),this.off(Ps,e),this.off(O,e),this.off("end",e),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}};return this.once("end",e),this.once(Ps,e),this.once(O,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[O])return t?this.emit("error",t):this.emit(O),this;this[O]=!0,this[H]=!0,this[R].length=0,this[M]=0;let e=this;return typeof e.close=="function"&&!this[Ce]&&e.close(),t?this.emit("error",t):this.emit(O),this}static get isStream(){return Sa}};var Ra=it.realpathSync.native,te={lstatSync:it.lstatSync,readdir:it.readdir,readdirSync:it.readdirSync,readlinkSync:it.readlinkSync,realpathSync:Ra,promises:{lstat:pt.lstat,readdir:pt.readdir,readlink:pt.readlink,realpath:pt.realpath}},Xn=n=>!n||n===te||n===Ta?te:{...te,...n,promises:{...te.promises,...n.promises||{}}},Zn=/^\\\\\?\\([a-z]:)\\?$/i,Ma=n=>n.replace(/\//g,"\\").replace(Zn,"$1\\"),Fa=/[\\\/]/,q=0,Qn=1,tr=2,st=4,er=6,sr=8,_t=10,ir=12,G=15,Qt=~G,Ws=16,Gn=32,ee=64,X=128,Re=256,Fe=512,qn=ee|X|Fe,Pa=1023,Bs=n=>n.isFile()?sr:n.isDirectory()?st:n.isSymbolicLink()?_t:n.isCharacterDevice()?tr:n.isBlockDevice()?er:n.isSocket()?ir:n.isFIFO()?Qn:q,Yn=new Map,se=n=>{let t=Yn.get(n);if(t)return t;let e=n.normalize("NFKD");return Yn.set(n,e),e},Kn=new Map,Me=n=>{let t=Kn.get(n);if(t)return t;let e=se(n.toLowerCase());return Kn.set(n,e),e},Pe=class extends Yt{constructor(){super({max:256})}},Hs=class extends Yt{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},nr=Symbol("PathScurry setAsCwd"),P=class{name;root;roots;parent;nocase;isCWD=!1;#t;#s;get dev(){return this.#s}#n;get mode(){return this.#n}#e;get nlink(){return this.#e}#o;get uid(){return this.#o}#S;get gid(){return this.#S}#h;get rdev(){return this.#h}#u;get blksize(){return this.#u}#l;get ino(){return this.#l}#a;get size(){return this.#a}#r;get blocks(){return this.#r}#y;get atimeMs(){return this.#y}#w;get mtimeMs(){return this.#w}#m;get ctimeMs(){return this.#m}#d;get birthtimeMs(){return this.#d}#_;get atime(){return this.#_}#p;get mtime(){return this.#p}#E;get ctime(){return this.#E}#C;get birthtime(){return this.#C}#g;#x;#b;#f;#O;#A;#i;#M;#v;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=q,s,i,r,o,a){this.name=t,this.#g=r?Me(t):se(t),this.#i=e&Pa,this.nocase=r,this.roots=i,this.root=s||this,this.#M=o,this.#b=a.fullpath,this.#O=a.relative,this.#A=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=Xn(a.fs)}depth(){return this.#x!==void 0?this.#x:this.parent?this.#x=this.parent.depth()+1:this.#x=0}childrenCache(){return this.#M}resolve(t){if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#F(i):this.#F(i)}#F(t){let e=this;for(let s of t)e=e.child(s);return e}children(){let t=this.#M.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#M.set(this,e),this.#i&=~Ws,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),i=this.nocase?Me(t):se(t);for(let l of s)if(l.#g===i)return l;let r=this.parent?this.sep:"",o=this.#b?this.#b+r+t:void 0,a=this.newChild(t,q,{...e,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=X),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let t=this.name,e=this.parent;if(!e)return this.#O=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let t=this.name,e=this.parent;if(!e)return this.#A=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#b!==void 0)return this.#b;let t=this.name,e=this.parent;if(!e)return this.#b=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+t;return this.#b=i}fullpathPosix(){if(this.#f!==void 0)return this.#f;if(this.sep==="/")return this.#f=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#f=`//?/${i}`:this.#f=i}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return this.#f=s}isUnknown(){return(this.#i&G)===q}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&G)===sr}isDirectory(){return(this.#i&G)===st}isCharacterDevice(){return(this.#i&G)===tr}isBlockDevice(){return(this.#i&G)===er}isFIFO(){return(this.#i&G)===Qn}isSocket(){return(this.#i&G)===ir}isSymbolicLink(){return(this.#i&_t)===_t}lstatCached(){return this.#i&Gn?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#T}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let t=this.#i&G;return!(t!==q&&t!==_t||this.#i&Re||this.#i&X)}calledReaddir(){return!!(this.#i&Ws)}isENOENT(){return!!(this.#i&X)}isNamed(t){return this.nocase?this.#g===Me(t):this.#g===se(t)}async readlink(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#v=s}catch(e){this.#c(e.code);return}}readlinkSync(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#v=s}catch(e){this.#c(e.code);return}}#P(t){this.#i|=Ws;for(let e=t.provisional;e<t.length;e++){let s=t[e];s&&s.#j()}}#j(){this.#i&X||(this.#i=(this.#i|X)&Qt,this.#k())}#k(){let t=this.children();t.provisional=0;for(let e of t)e.#j()}#$(){this.#i|=Fe,this.#D()}#D(){if(this.#i&ee)return;let t=this.#i;(t&G)===st&&(t&=Qt),this.#i=t|ee,this.#k()}#N(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#j():this.children().provisional=0}#I(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#j()}#c(t=""){let e=this.#i;e|=Re,t==="ENOENT"&&(e|=X),(t==="EINVAL"||t==="UNKNOWN")&&(e&=Qt),this.#i=e,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#L(t,e){return this.#R(t,e)||this.#W(t,e)}#W(t,e){let s=Bs(t),i=this.newChild(t.name,s,{parent:this}),r=i.#i&G;return r!==st&&r!==_t&&r!==q&&(i.#i|=ee),e.unshift(i),e.provisional++,i}#R(t,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?Me(t.name):se(t.name))===i.#g)return this.#B(t,i,s,e)}}#B(t,e,s,i){let r=e.name;return e.#i=e.#i&Qt|Bs(t),r!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e}async lstat(){if(!(this.#i&X))try{return this.#U(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#I(t.code)}}lstatSync(){if(!(this.#i&X))try{return this.#U(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#I(t.code)}}#U(t){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:h,dev:u,gid:c,ino:f,mode:d,mtime:g,mtimeMs:p,nlink:b,rdev:y,size:v,uid:S}=t;this.#_=e,this.#y=s,this.#C=i,this.#d=r,this.#u=o,this.#r=a,this.#E=l,this.#m=h,this.#s=u,this.#S=c,this.#l=f,this.#n=d,this.#p=g,this.#w=p,this.#e=b,this.#h=y,this.#a=v,this.#o=S;let _=Bs(t);this.#i=this.#i&Qt|_|Gn,_!==q&&_!==st&&_!==_t&&(this.#i|=ee)}#V=[];#z=!1;#G(t){this.#z=!1;let e=this.#V.slice();this.#V.length=0,e.forEach(s=>s(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);e?t(null,r):queueMicrotask(()=>t(null,r));return}if(this.#V.push(t),this.#z)return;this.#z=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#N(r.code),s.provisional=0;else{for(let a of o)this.#L(a,s);this.#P(s)}this.#G(s.slice(0,s.provisional))})}#H;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#H)await this.#H;else{let s=()=>{};this.#H=new Promise(i=>s=i);try{for(let i of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#L(i,t);this.#P(t)}catch(i){this.#N(i.code),t.provisional=0}this.#H=void 0,s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of this.#t.readdirSync(e,{withFileTypes:!0}))this.#L(s,t);this.#P(t)}catch(s){this.#N(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#i&qn)return!1;let t=G&this.#i;return t===q||t===st||t===_t}shouldWalk(t,e){return(this.#i&st)===st&&!(this.#i&qn)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#T)return this.#T;if(!((Fe|Re|X)&this.#i))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#T=this.resolve(t)}catch{this.#$()}}realpathSync(){if(this.#T)return this.#T;if(!((Fe|Re|X)&this.#i))try{let t=this.#t.realpathSync(this.fullpath());return this.#T=this.resolve(t)}catch{this.#$()}}[nr](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),i.#O=s.join(this.sep),i.#A=s.join("/"),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)i.#O=void 0,i.#A=void 0,i=i.parent}},je=class n extends P{sep="\\";splitSep=Fa;constructor(t,e=q,s,i,r,o,a){super(t,e,s,i,r,o,a)}newChild(t,e=q,s={}){return new n(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return jt.win32.parse(t).root}getRoot(t){if(t=Ma(t.toUpperCase()),t===this.root.name)return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new Dt(t,this).root}sameRoot(t,e=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(Zn,"$1\\"),t===e}},De=class n extends P{splitSep="/";sep="/";constructor(t,e=q,s,i,r,o,a){super(t,e,s,i,r,o,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=q,s={}){return new n(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}},Ne=class{root;rootPath;roots;cwd;#t;#s;#n;nocase;#e;constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=te}={}){this.#e=Xn(o),(t instanceof URL||t.startsWith("file://"))&&(t=(0,Jn.fileURLToPath)(t));let a=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new Pe,this.#s=new Pe,this.#n=new Hs(r);let l=a.substring(this.rootPath.length).split(s);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let h=this.root,u=l.length-1,c=e.sep,f=this.rootPath,d=!1;for(let g of l){let p=u--;h=h.child(g,{relative:new Array(p).fill("..").join(c),relativePosix:new Array(p).fill("..").join("/"),fullpath:f+=(d?"":c)+g}),d=!0}this.cwd=h}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let e="";for(let r=t.length-1;r>=0;r--){let o=t[r];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#t.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return this.#t.set(e,i),i}resolvePosix(...t){let e="";for(let r=t.length-1;r>=0;r--){let o=t[r];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#s.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return this.#s.set(e,i),i}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let i=await t.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(i=>i.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=[];(!r||r(t))&&a.push(s?t:t.fullpath());let l=new Set,h=(c,f)=>{l.add(c),c.readdirCB((d,g)=>{if(d)return f(d);let p=g.length;if(!p)return f();let b=()=>{--p===0&&f()};for(let y of g)(!r||r(y))&&a.push(s?y:y.fullpath()),i&&y.isSymbolicLink()?y.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(l,o)?h(v,b):b()):y.shouldWalk(l,o)?h(y,b):b()},!0)},u=t;return new Promise((c,f)=>{h(u,d=>{if(d)return f(d);c(a)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=[];(!r||r(t))&&a.push(s?t:t.fullpath());let l=new Set([t]);for(let h of l){let u=h.readdirSync();for(let c of u){(!r||r(c))&&a.push(s?c:c.fullpath());let f=c;if(c.isSymbolicLink()){if(!(i&&(f=c.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(l,o)&&l.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e;(!r||r(t))&&(yield s?t:t.fullpath());let a=new Set([t]);for(let l of a){let h=l.readdirSync();for(let u of h){(!r||r(u))&&(yield s?u:u.fullpath());let c=u;if(u.isSymbolicLink()){if(!(i&&(c=u.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(a,o)&&a.add(c)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=new dt({objectMode:!0});(!r||r(t))&&a.write(s?t:t.fullpath());let l=new Set,h=[t],u=0,c=()=>{let f=!1;for(;!f;){let d=h.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let g=(b,y,v=!1)=>{if(b)return a.emit("error",b);if(i&&!v){let S=[];for(let _ of y)_.isSymbolicLink()&&S.push(_.realpath().then(k=>k?.isUnknown()?k.lstat():k));if(S.length){Promise.all(S).then(()=>g(null,y,!0));return}}for(let S of y)S&&(!r||r(S))&&(a.write(s?S:S.fullpath())||(f=!0));u--;for(let S of y){let _=S.realpathCached()||S;_.shouldWalk(l,o)&&h.push(_)}f&&!a.flowing?a.once("drain",c):p||c()},p=!0;d.readdirCB(g,!0),p=!1}};return c(),a}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof P||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=new dt({objectMode:!0}),l=new Set;(!r||r(t))&&a.write(s?t:t.fullpath());let h=[t],u=0,c=()=>{let f=!1;for(;!f;){let d=h.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let g=d.readdirSync();for(let p of g)(!r||r(p))&&(a.write(s?p:p.fullpath())||(f=!0));u--;for(let p of g){let b=p;if(p.isSymbolicLink()){if(!(i&&(b=p.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(l,o)&&h.push(b)}}f&&!a.flowing&&a.once("drain",c)};return c(),a}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[nr](e)}},Dt=class extends Ne{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,jt.win32,"\\",{...e,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(t){return jt.win32.parse(t).root.toUpperCase()}newRoot(t){return new je(this.rootPath,st,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},Nt=class extends Ne{sep="/";constructor(t=process.cwd(),e={}){let{nocase:s=!1}=e;super(t,jt.posix,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new De(this.rootPath,st,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},ie=class extends Nt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},hh=process.platform==="win32"?je:De,rr=process.platform==="win32"?Dt:process.platform==="darwin"?ie:Nt;var ja=n=>n.length>=1,Da=n=>n.length>=1,It=class n{#t;#s;#n;length;#e;#o;#S;#h;#u;#l;#a=!0;constructor(t,e,s,i){if(!ja(t))throw new TypeError("empty pattern list");if(!Da(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#s=e,this.#n=s,this.#e=i,this.#n===0){if(this.isUNC()){let[r,o,a,l,...h]=this.#t,[u,c,f,d,...g]=this.#s;h[0]===""&&(h.shift(),g.shift());let p=[r,o,a,l,""].join("/"),b=[u,c,f,d,""].join("/");this.#t=[p,...h],this.#s=[b,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#t,[a,...l]=this.#s;o[0]===""&&(o.shift(),l.shift());let h=r+"/",u=a+"/";this.#t=[h,...o],this.#s=[u,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===C}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#S=this.#S||(this.#n===0?this.isAbsolute()?this.#s[0]+this.#s.slice(1).join("/"):this.#s.join("/"):this.#s.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new n(this.#t,this.#s,this.#n+1,this.#e),this.#o.#l=this.#l,this.#o.#u=this.#u,this.#o.#h=this.#h,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#u!==void 0?this.#u:this.#u=this.#e==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#h!==void 0?this.#h:this.#h=this.#e==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#l!==void 0?this.#l:this.#l=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Na=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Lt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:o=Na}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of t)this.add(a)}add(t){let e=new B(t,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],r=e.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new It(i,r,0,this.platform),a=new B(o.globString(),this.mmopts),l=r[r.length-1]==="**",h=o.isAbsolute();h?this.absolute.push(a):this.relative.push(a),l&&(h?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(t){let e=t.fullpath(),s=`${e}/`,i=t.relative()||".",r=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(r))return!0;for(let o of this.absolute)if(o.match(e)||o.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};var Vs=class n{store;constructor(t=new Map){this.store=t}copy(){return new n(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},zs=class{store=new Map;add(t,e,s){let i=(e?2:0)|(s?1:0),r=this.store.get(t);this.store.set(t,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},Us=class{store=new Map;add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},ne=class n{hasWalkedCache;matches=new zs;subwalks=new Us;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new Vs}processPatterns(t,e){this.patterns=e;let s=e.map(i=>[t,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let c=r.rest();if(c)r=c;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,h,u=!1;for(;typeof(l=r.pattern())=="string"&&(h=r.rest());)i=i.resolve(l),r=h,u=!0;if(l=r.pattern(),h=r.rest(),u){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof l=="string"){let c=l===".."||l===""||l===".";this.matches.add(i.resolve(l),a,c);continue}else if(l===C){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let c=h?.pattern(),f=h?.rest();if(!h||(c===""||c===".")&&!f)this.matches.add(i,a,c===""||c===".");else if(c===".."){let d=i.parent||i;f?this.hasWalkedCache.hasWalked(d,f)||this.subwalks.add(d,f):this.matches.add(d,a,!0)}}else l instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),i=this.child();for(let r of e)for(let o of s){let a=o.isAbsolute(),l=o.pattern(),h=o.rest();l===C?i.testGlobstar(r,o,h,a):l instanceof RegExp?i.testRegExp(r,l,h,a):i.testString(r,l,h,a)}return i}testGlobstar(t,e,s,i){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,i,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(t,r,s.rest(),i);else if(r===".."){let o=t.parent||t;this.subwalks.add(o,s)}else r instanceof RegExp&&this.testRegExp(t,r,s.rest(),i)}}testRegExp(t,e,s,i){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}};var Ia=(n,t)=>typeof n=="string"?new Lt([n],t):Array.isArray(n)?new Lt(n,t):n,Ie=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#s;#n;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#s=Ia(s.ignore??[],s),!this.includeChildMatches&&typeof this.#s.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(t){return this.seen.has(t)||!!this.#s?.ignored?.(t)}#o(t){return!!this.#s?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#e(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=r.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,e)}matchFinish(t,e){if(this.#e(t))return;if(!this.includeChildMatches&&this.#s?.add){let r=`${t.relativePosix()}/**`;this.#s.add(r)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let r=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(t,e,s){let i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){let i=this.matchCheckSync(t,s);i&&this.matchFinish(i,e)}walkCB(t,e,s){this.signal?.aborted&&s(),this.walkCB2(t,e,new ne(this.opts),s)}walkCB2(t,e,s,i){if(this.#o(t))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,i));return}s.processPatterns(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||(r++,this.match(a,l,h).then(()=>o()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirCached();a.calledReaddir()?this.walkCB3(a,l,s,o):a.readdirCB((h,u)=>this.walkCB3(a,u,s,o),!0)}o()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||(r++,this.match(a,l,h).then(()=>o()));for(let[a,l]of s.subwalks.entries())r++,this.walkCB2(a,l,s.child(),o);o()}walkCBSync(t,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(t,e,new ne(this.opts),s)}walkCB2Sync(t,e,s,i){if(this.#o(t))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,i));return}s.processPatterns(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||this.matchSync(a,l,h);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirSync();this.walkCB3Sync(a,l,s,o)}o()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||this.matchSync(a,l,h);for(let[a,l]of s.subwalks.entries())r++,this.walkCB2Sync(a,l,s.child(),o);o()}},re=class extends Ie{matches=new Set;constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},oe=class extends Ie{results;constructor(t,e,s){super(t,e,s),this.results=new dt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var La=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Z=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,or.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=t,this.platform=e.platform||La,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=e.platform==="win32"?Dt:e.platform==="darwin"?ie:e.platform?Nt:rr;this.scurry=new l(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(l=>new B(l,i)),[o,a]=r.reduce((l,h)=>(l[0].push(...h.set),l[1].push(...h.globParts),l),[[],[]]);this.patterns=o.map((l,h)=>{let u=a[h];if(!u)throw new Error("invalid pattern object");return new It(l,u,0,this.platform)})}async walk(){return[...await new re(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new re(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new oe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new oe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var Gs=(n,t={})=>{Array.isArray(n)||(n=[n]);for(let e of n)if(new B(e,t).hasMagic())return!0;return!1};function We(n,t={}){return new Z(n,t).streamSync()}function lr(n,t={}){return new Z(n,t).stream()}function hr(n,t={}){return new Z(n,t).walkSync()}async function ar(n,t={}){return new Z(n,t).walk()}function Be(n,t={}){return new Z(n,t).iterateSync()}function cr(n,t={}){return new Z(n,t).iterate()}var Wa=We,Ba=Object.assign(lr,{sync:We}),Ha=Be,Va=Object.assign(cr,{sync:Be}),za=Object.assign(hr,{stream:We,iterate:Be}),Le=Object.assign(ar,{glob:ar,globSync:hr,sync:za,globStream:lr,stream:Ba,globStreamSync:We,streamSync:Wa,globIterate:cr,iterate:Va,globIterateSync:Be,iterateSync:Ha,Glob:Z,hasMagic:Gs,escape:Tt,unescape:K});Le.glob=Le;var Ua=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at"},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on"},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean"},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach"},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong"},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically"},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support"},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with"},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight"},{id:"ai.ever-evolving",category:"ai-slop",severity:"red",regex:/\b(?:ever[\s-]evolving|ever[\s-]changing)\b/gi,suggestion:"cut this \u2014 it says nothing"},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this"},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed"},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift"},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why"},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms"},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works"},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it"},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level"},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact"}],Ga=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler'},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end."},{id:"formula.it-is-important",category:"ai-slop",severity:"yellow",regex:/\bit is important to note\b/gi,suggestion:"just note it. skip the preamble."},{id:"formula.at-the-end",category:"ai-slop",severity:"yellow",regex:/\bat the end of the day\b/gi,suggestion:"cut this \u2014 it means nothing"},{id:"formula.needless-to-say",category:"ai-slop",severity:"yellow",regex:/\bneedless to say\b/gi,suggestion:"if it's needless, don't say it"},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it"},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead"},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed."},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it"}],qa=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it"},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't."},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly"},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent"}],Ya=[{id:"struct.antithesis",category:"structure",severity:"yellow",regex:/\bnot (?:just|only) .{3,50}, but .{3,50}/gi,suggestion:"this antithesis pattern is an AI tell \u2014 restructure"},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore than just\b/gi,suggestion:"say what it IS, not what it isn't"},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"'},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"'},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"'},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly"}],Ka=[...Ua,...Ga,...qa,...Ya];function ur(n,t,e){let s=[];for(let i of Ka){i.regex.lastIndex=0;let r;for(;(r=i.regex.exec(n))!==null;)s.push({file:e,line:t,column:r.index+1,pattern:i.id,category:i.category,severity:i.severity,excerpt:Ja(n.trim(),r.index,r[0].length),suggestion:i.suggestion})}return s}function Ja(n,t,e){let s=n.slice(0,t),i=n.slice(t,t+e),r=n.slice(t+e);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}async function He(n,t=[]){let e=[];for(let o of n)if(Wt.existsSync(o)&&Wt.statSync(o).isFile())e.push(o);else{let a=await Le("**/*.md",{cwd:o,ignore:["node_modules/**",".git/**",...t],absolute:!0});e.push(...a)}let s=[...new Set(e)],i=[],r={files:0,total_lines:0,red:0,yellow:0,clean:0};for(let o of s){if(!o.endsWith(".md"))continue;let a;try{a=Wt.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
41
- `),h=[];for(let f=0;f<l.length;f++){let d=l[f];d.startsWith("```")||d.startsWith("---")||d.startsWith("#")||d.trim().length<10||h.push(...ur(d,f+1,qs.relative(process.cwd(),o)))}r.files++,r.total_lines+=l.length;let u=h.filter(f=>f.severity==="red").length,c=h.filter(f=>f.severity==="yellow").length;r.red+=u,r.yellow+=c,u+c===0&&r.clean++,i.push({file:qs.relative(process.cwd(),o),findings:h,lines:l.length})}return{results:i,summary:r}}bt();async function fr(n,t){let e=Ht(),s=n.length?n:e.scan_paths||["."],i=e.ignore||[],{results:r,summary:o}=await He(s,i);if(t.json){console.log(JSON.stringify({results:r.filter(l=>l.findings.length>0),summary:o},null,2)),t.failOnHit&&o.red+o.yellow>0&&process.exit(1);return}console.log(`
42
- ${W()} ${m.dim("scan")}
43
- `);let a=0;for(let l of r)if(l.findings.length!==0){console.log(` ${m.bold(l.file)} ${m.dim(`(${l.lines} lines)`)}`);for(let h of l.findings)on(h),a++;console.log("")}an(o),t.failOnHit&&o.red+o.yellow>0&&process.exit(1)}var mt=I(require("fs"));bt();function dr(n,t,e,s){let i=[];if(i.push("You are rewriting a draft to match a specific voice profile."),i.push(""),i.push("<voice_profile>"),i.push(`<name>${n.name}</name>`),n.brand&&i.push(`<brand>${n.brand}</brand>`),n.description&&i.push(`<description>${n.description}</description>`),n.keywords?.length&&i.push(`<keywords>${n.keywords.join(", ")}</keywords>`),i.push(""),i.push(t),i.push("</voice_profile>"),i.push(""),s.length>0){i.push("<issues_found>");let r=s.filter(a=>a.severity==="red"),o=s.filter(a=>a.severity==="yellow");r.length&&i.push(`Critical issues (${r.length}): ${r.map(a=>a.pattern).join(", ")}`),o.length&&i.push(`Advisory issues (${o.length}): ${o.map(a=>a.pattern).join(", ")}`),i.push("</issues_found>"),i.push("")}return i.push("<draft>"),i.push(e),i.push("</draft>"),i.push(""),i.push("<instruction>"),i.push("Rewrite this draft to match the voice profile. Rules:"),i.push("1. Preserve the original meaning and all factual claims"),i.push("2. Match the profile's rhythm, tone, vocabulary, and sentence patterns"),i.push("3. Fix every critical issue listed above"),i.push("4. Remove AI-slop patterns (delve, leverage, tapestry, etc.)"),i.push("5. Ground your style in the anchor passages from the profile"),i.push("6. Never use words from the never-list"),i.push("7. Keep the same format (markdown headings, lists, links)"),i.push("8. Return ONLY the rewritten text, no commentary"),i.push("</instruction>"),i.join(`
44
- `)}async function pr(n,t,e){let i=Ht().profile,r;n&&t?(i=n,r=t):n&&(n.endsWith(".md")||mt.existsSync(n)?r=n:i=n),i||(console.log(`
45
- ${m.red("\u2717")} no profile specified`),console.log(` ${m.dim("usage:")} hyv rewrite <profile> <file>`),console.log(` ${m.dim("or set a default:")} hyv init --profile <name>`),process.exit(1));let o;r?(mt.existsSync(r)||(console.log(`
46
- ${m.red("\u2717")} file not found: ${r}`),process.exit(1)),o=mt.readFileSync(r,"utf-8")):o=mt.readFileSync(0,"utf-8"),o.trim()||(console.log(`
104
+ </body></html>`),clearTimeout(h),s.close(),a({api_key:d,email:g||"",name:p||""});return}u.writeHead(302,{Location:r}),u.end()})});try{await(0,dn.default)(r)}catch{console.log(` ${m.yellow("!")} couldn't open browser. visit:`),console.log(` ${m.cyan(r)}
105
+ `)}try{let{api_key:a,email:l,name:h}=await o;de({api_key:a,base_url:Tt,user_email:l,user_name:h}),console.log(` ${m.green("\u2713")} authenticated as ${m.bold(l||h)}`);try{let c=await st("/cli/heartbeat");c.plan==="none"||c.status==="none"?(console.log(` ${m.yellow("!")} no active subscription`),console.log(` ${m.dim("visit")} ${m.cyan(`${Tt}/dashboard`)} ${m.dim("to subscribe")}`)):console.log(` ${m.green("\u2713")} plan: ${m.bold(c.plan)}`)}catch{}n&&(ds({profile:n}),console.log(` ${m.green("\u2713")} default profile set to ${m.bold(n)}`)),As(n)}catch(a){console.log(`
106
+ ${m.red("\u2717")} authentication failed: ${a.message}`),process.exit(1)}}function As(n){let t=ko();if(t.length>0){console.log(`
107
+ ${m.green("\u2713")} agent integration installed:`);for(let e of t)console.log(` ${m.dim("\u2192")} ${e}`);console.log(`
108
+ ${m.dim('you can now say "rewrite in my voice" or "hyv <profile>" in these agents')}`)}else console.log(`
109
+ ${m.dim("no agents detected in this directory")}`),console.log(` ${m.dim("agent files are included in the package at:")} node_modules/@holdyourvoice/hyv/agents/`)}async function $o(n){de({api_key:n,base_url:Tt});try{let t=await st("/cli/heartbeat");de({api_key:n,base_url:Tt,user_email:t.email,user_name:t.name}),console.log(` ${m.green("\u2713")} authenticated with license key`)}catch(t){console.log(` ${m.red("\u2717")} invalid license key: ${t.message}`),process.exit(1)}}var Bt=P(require("fs")),Ys=P(require("path"));var Dn=P(An(),1);var Gt=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var No={"[: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]},qt=n=>n.replace(/[[\]\\-]/g,"\\$&"),Lo=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),kn=n=>n.join(""),$n=(n,t)=>{let e=t;if(n.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=e+1,o=!1,a=!1,l=!1,h=!1,c=e,u="";t:for(;r<n.length;){let p=n.charAt(r);if((p==="!"||p==="^")&&r===e+1){h=!0,r++;continue}if(p==="]"&&o&&!l){c=r+1;break}if(o=!0,p==="\\"&&!l){l=!0,r++;continue}if(p==="["&&!l){for(let[b,[y,v,x]]of Object.entries(No))if(n.startsWith(b,r)){if(u)return["$.",!1,n.length-e,!0];r+=b.length,x?i.push(y):s.push(y),a=a||v;continue t}}if(l=!1,u){p>u?s.push(qt(u)+"-"+qt(p)):p===u&&s.push(qt(p)),u="",r++;continue}if(n.startsWith("-]",r+1)){s.push(qt(p+"-")),r+=2;continue}if(n.startsWith("-",r+1)){u=p,r+=2;continue}s.push(qt(p)),r++}if(c<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,n.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!h){let p=s[0].length===2?s[0].slice(-1):s[0];return[Lo(p),!1,c-e,!1]}let f="["+(h?"^":"")+kn(s)+"]",d="["+(h?"":"^")+kn(i)+"]";return[s.length&&i.length?"("+f+"|"+d+")":s.length?f:d,a,c-e,!0]};var X=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var B,Io=new Set(["!","?","+","*","@"]),Ts=n=>Io.has(n),Tn=n=>Ts(n.type),Wo=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Bo=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ho=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Fn=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Vo="(?!(?:^|/)\\.\\.?(?:$|/))",Se="(?!\\.)",Uo=new Set(["[","."]),zo=new Set(["..","."]),Go=new Set("().*{}+?[]^$\\!"),qo=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Fs="[^/]",Rn=Fs+"*?",Mn=Fs+"+?",vt=class{type;#t;#s;#n=!1;#e=[];#o;#x;#h;#u=!1;#l;#a;#r=!1;constructor(t,e,s={}){this.type=t,t&&(this.#s=!0),this.#o=e,this.#t=this.#o?this.#o.#t:this,this.#l=this.#t===this?s:this.#t.#l,this.#h=this.#t===this?[]:this.#t.#h,t==="!"&&!this.#t.#u&&this.#h.push(this),this.#x=this.#o?this.#o.#e.length:0}get hasMagic(){if(this.#s!==void 0)return this.#s;for(let t of this.#e)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#s=!0;return this.#s}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#e.map(t=>String(t)).join("|")+")":this.#a=this.#e.map(t=>String(t)).join("")}#y(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#h.pop();){if(t.type!=="!")continue;let e=t,s=e.#o;for(;s;){for(let i=e.#x+1;!s.type&&i<s.#e.length;i++)for(let r of t.#e){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#e[i])}e=s,s=e.#o}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof B&&e.#o===this))throw new Error("invalid part: "+e);this.#e.push(e)}}toJSON(){let t=this.type===null?this.#e.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#e.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#x===0)return!0;let t=this.#o;for(let e=0;e<this.#x;e++){let s=t.#e[e];if(!(s instanceof B&&s.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#e.length:0;return this.#x===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new B(this.type,t);for(let s of this.#e)e.copyIn(s);return e}static#w(t,e,s,i,r){let o=i.maxExtglobRecursion??2,a=!1,l=!1,h=-1,c=!1;if(e.type===null){let p=s,b="";for(;p<t.length;){let y=t.charAt(p++);if(a||y==="\\"){a=!a,b+=y;continue}if(l){p===h+1?(y==="^"||y==="!")&&(c=!0):y==="]"&&!(p===h+2&&c)&&(l=!1),b+=y;continue}else if(y==="["){l=!0,h=p,c=!1,b+=y;continue}if(!i.noext&&Ts(y)&&t.charAt(p)==="("&&r<=o){e.push(b),b="";let x=new B(y,e);p=B.#w(t,x,p,i,r+1),e.push(x);continue}b+=y}return e.push(b),p}let u=s+1,f=new B(null,e),d=[],g="";for(;u<t.length;){let p=t.charAt(u++);if(a||p==="\\"){a=!a,g+=p;continue}if(l){u===h+1?(p==="^"||p==="!")&&(c=!0):p==="]"&&!(u===h+2&&c)&&(l=!1),g+=p;continue}else if(p==="["){l=!0,h=u,c=!1,g+=p;continue}if(Ts(p)&&t.charAt(u)==="("&&(r<=o||e&&e.#S(p))){let y=e&&e.#S(p)?0:1;f.push(g),g="";let v=new B(p,f);f.push(v),u=B.#w(t,v,u,i,r+y);continue}if(p==="|"){f.push(g),g="",d.push(f),f=new B(null,e);continue}if(p===")")return g===""&&e.#e.length===0&&(e.#r=!0),f.push(g),g="",e.push(...d,f),u;g+=p}return e.type=null,e.#s=void 0,e.#e=[t.substring(s-1)],u}#m(t){return this.#d(t,Bo)}#d(t,e=Wo){if(!t||typeof t!="object"||t.type!==null||t.#e.length!==1||this.type===null)return!1;let s=t.#e[0];return!s||typeof s!="object"||s.type===null?!1:this.#S(s.type,e)}#S(t,e=Ho){return!!e.get(this.type)?.includes(t)}#p(t,e){let s=t.#e[0],i=new B(null,s,this.options);i.#e.push(""),s.push(i),this.#E(t,e)}#E(t,e){let s=t.#e[0];this.#e.splice(e,1,...s.#e);for(let i of s.#e)typeof i=="object"&&(i.#o=this);this.#a=void 0}#C(t){return!!Fn.get(this.type)?.has(t)}#g(t){if(!t||typeof t!="object"||t.type!==null||t.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let e=t.#e[0];return!e||typeof e!="object"||e.type===null?!1:this.#C(e.type)}#_(t){let e=Fn.get(this.type),s=t.#e[0],i=e?.get(s.type);if(!i)return!1;this.#e=s.#e;for(let r of this.#e)typeof r=="object"&&(r.#o=this);this.type=i,this.#a=void 0,this.#r=!1}#b(){if(Tn(this)){let t=0,e=!1;do{e=!0;for(let s=0;s<this.#e.length;s++){let i=this.#e[s];typeof i=="object"&&(i.#b(),this.#d(i)?(e=!1,this.#E(i,s)):this.#m(i)?(e=!1,this.#p(i,s)):this.#g(i)&&(e=!1,this.#_(i)))}}while(!e&&++t<10)}else for(let t of this.#e)typeof t=="object"&&t.#b();this.#a=void 0}static fromGlob(t,e={}){let s=new B(null,void 0,e);return B.#w(t,s,0,e,0),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||this.#s||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let a=(this.#l.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:t})}get options(){return this.#l}toRegExpSource(t){let e=t??!!this.#l.dot;if(this.#t===this&&(this.#b(),this.#y()),!Tn(this)){let l=this.isStart()&&this.isEnd(),h=this.#e.map(d=>{let[g,p,b,y]=typeof d=="string"?B.#O(d,this.#s,l):d.toRegExpSource(t);return this.#s=this.#s||b,this.#n=this.#n||y,g}).join(""),c="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&zo.has(this.#e[0]))){let g=Uo,p=e&&g.has(h.charAt(0))||h.startsWith("\\.")&&g.has(h.charAt(2))||h.startsWith("\\.\\.")&&g.has(h.charAt(4)),b=!e&&!t&&g.has(h.charAt(0));c=p?Vo:b?Se:""}let u="";return this.isEnd()&&this.#t.#u&&this.#o?.type==="!"&&(u="(?:$|\\/)"),[c+h+u,X(h),this.#s=!!this.#s,this.#n]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#f(e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString(),h=this;return h.#e=[l],h.type=null,h.#s=void 0,[l,X(this.toString()),!1,!1]}let o=!s||t||e||!Se?"":this.#f(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#r)a=(this.isStart()&&!e?Se:"")+Mn;else{let l=this.type==="!"?"))"+(this.isStart()&&!e&&!t?Se:"")+Rn+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+l}return[a,X(r),this.#s=!!this.#s,this.#n]}#f(t){return this.#e.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,r,o]=e.toRegExpSource(t);return this.#n=this.#n||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#O(t,e,s=!1){let i=!1,r="",o=!1,a=!1;for(let l=0;l<t.length;l++){let h=t.charAt(l);if(i){i=!1,r+=(Go.has(h)?"\\":"")+h,a=!1;continue}if(h==="\\"){l===t.length-1?r+="\\\\":i=!0;continue}if(h==="["){let[c,u,f,d]=$n(t,l);if(f){r+=c,o=o||u,l+=f-1,e=e||d,a=!1;continue}}if(h==="*"){if(a)continue;a=!0,r+=s&&/^[*]+$/.test(t)?Mn:Rn,e=!0;continue}else a=!1;if(h==="?"){r+=Fs,e=!0;continue}r+=qo(h)}return[r,X(t),!!e,o]}};B=vt;var Ft=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var L=(n,t,e={})=>(Gt(t),!e.nocomment&&t.charAt(0)==="#"?!1:new V(t,e).match(n)),Yo=/^\*+([^+@!?\*\[\(]*)$/,Ko=n=>t=>!t.startsWith(".")&&t.endsWith(n),Jo=n=>t=>t.endsWith(n),Xo=n=>(n=n.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(n)),Zo=n=>(n=n.toLowerCase(),t=>t.toLowerCase().endsWith(n)),Qo=/^\*+\.\*+$/,ta=n=>!n.startsWith(".")&&n.includes("."),ea=n=>n!=="."&&n!==".."&&n.includes("."),sa=/^\.\*+$/,ia=n=>n!=="."&&n!==".."&&n.startsWith("."),na=/^\*+$/,ra=n=>n.length!==0&&!n.startsWith("."),oa=n=>n.length!==0&&n!=="."&&n!=="..",aa=/^\?+([^+@!?\*\[\(]*)?$/,la=([n,t=""])=>{let e=Nn([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ha=([n,t=""])=>{let e=Ln([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},ca=([n,t=""])=>{let e=Ln([n]);return t?s=>e(s)&&s.endsWith(t):e},ua=([n,t=""])=>{let e=Nn([n]);return t?s=>e(s)&&s.endsWith(t):e},Nn=([n])=>{let t=n.length;return e=>e.length===t&&!e.startsWith(".")},Ln=([n])=>{let t=n.length;return e=>e.length===t&&e!=="."&&e!==".."},In=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",jn={win32:{sep:"\\"},posix:{sep:"/"}},fa=In==="win32"?jn.win32.sep:jn.posix.sep;L.sep=fa;var O=Symbol("globstar **");L.GLOBSTAR=O;var da="[^/]",pa=da+"*?",ma="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ga="(?:(?!(?:\\/|^)\\.).)*?",ya=(n,t={})=>e=>L(e,n,t);L.filter=ya;var q=(n,t={})=>Object.assign({},n,t),wa=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return L;let t=L;return Object.assign((s,i,r={})=>t(s,i,q(n,r)),{Minimatch:class extends t.Minimatch{constructor(i,r={}){super(i,q(n,r))}static defaults(i){return t.defaults(q(n,i)).Minimatch}},AST:class extends t.AST{constructor(i,r,o={}){super(i,r,q(n,o))}static fromGlob(i,r={}){return t.AST.fromGlob(i,q(n,r))}},unescape:(s,i={})=>t.unescape(s,q(n,i)),escape:(s,i={})=>t.escape(s,q(n,i)),filter:(s,i={})=>t.filter(s,q(n,i)),defaults:s=>t.defaults(q(n,s)),makeRe:(s,i={})=>t.makeRe(s,q(n,i)),braceExpand:(s,i={})=>t.braceExpand(s,q(n,i)),match:(s,i,r={})=>t.match(s,i,q(n,r)),sep:t.sep,GLOBSTAR:O})};L.defaults=wa;var Wn=(n,t={})=>(Gt(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Dn.default)(n));L.braceExpand=Wn;var ba=(n,t={})=>new V(n,t).makeRe();L.makeRe=ba;var va=(n,t,e={})=>{let s=new V(t,e);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(t),n};L.match=va;var Pn=/[?*]|[+@!]\(.*?\)|\[|\]/,xa=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),V=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,e={}){Gt(t),e=e||{},this.options=e,this.maxGlobstarRecursion=e.maxGlobstarRecursion??200,this.pattern=t,this.platform=e.platform||In,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=r[0]===""&&r[1]===""&&(r[2]==="?"||!Pn.test(r[2]))&&!Pn.test(r[3]),h=/^[a-z]:/i.test(r[0]);if(l)return[...r.slice(0,4),...r.slice(4).map(c=>this.parse(c))];if(h)return[r[0],...r.slice(1).map(c=>this.parse(c))]}return r.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let i=0;i<t[s].length;i++)t[s][i]==="**"&&(t[s][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let r=t[i];i===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let i=t[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let o=i;for(;s[o+1]==="**";)o++;o>i&&s.splice(i+1,o-i);let a=s[i+1],l=s[i+2],h=s[i+3];if(a!==".."||!l||l==="."||l===".."||!h||h==="."||h==="..")continue;e=!0,s.splice(i,1);let c=s.slice(0);c[i]="**",t.push(c),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let a=s[o];o===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let l=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...l),s.length===0&&s.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let i=0,r=0,o=[],a="";for(;i<t.length&&r<e.length;)if(t[i]===e[r])o.push(a==="b"?e[r]:t[i]),i++,r++;else if(s&&t[i]==="**"&&e[r]===t[i+1])o.push(t[i]),i++;else if(s&&e[r]==="**"&&t[i]===e[r+1])o.push(e[r]),r++;else if(t[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(a==="b")return!1;a="a",o.push(t[i]),i++,r++}else if(e[r]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",o.push(e[r]),i++,r++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let i=0,r=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),l=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),h=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),c=!h&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),u=l?3:a?0:void 0,f=c?3:h?0:void 0;if(typeof u=="number"&&typeof f=="number"){let[d,g]=[t[u],e[f]];d.toLowerCase()===g.toLowerCase()&&(e[f]=d,r=f,i=u)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),e.includes(O)?this.#t(t,e,s,i,r):this.#n(t,e,s,i,r)}#t(t,e,s,i,r){let o=e.indexOf(O,r),a=e.lastIndexOf(O),[l,h,c]=s?[e.slice(r,o),e.slice(o+1),[]]:[e.slice(r,o),e.slice(o+1,a),e.slice(a+1)];if(l.length){let v=t.slice(i,i+l.length);if(!this.#n(v,l,s,0,0))return!1;i+=l.length}let u=0;if(c.length){if(c.length+i>t.length)return!1;let v=t.length-c.length;if(this.#n(t,c,s,v,0))u=c.length;else{if(t[t.length-1]!==""||i+c.length===t.length||(v--,!this.#n(t,c,s,v,0)))return!1;u=c.length+1}}if(!h.length){let v=!!u;for(let x=i;x<t.length-u;x++){let _=String(t[x]);if(v=!0,_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return s||v}let f=[[[],0]],d=f[0],g=0,p=[0];for(let v of h)v===O?(p.push(g),d=[[],0],f.push(d)):(d[0].push(v),g++);let b=f.length-1,y=t.length-u;for(let v of f)v[1]=y-(p[b--]+v[0].length);return!!this.#s(t,f,i,0,s,0,!!u)}#s(t,e,s,i,r,o,a){let l=e[i];if(!l){for(let u=s;u<t.length;u++){a=!0;let f=t[u];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[h,c]=l;for(;s<=c;){if(this.#n(t.slice(0,s+h.length),h,r,s,0)&&o<this.maxGlobstarRecursion){let d=this.#s(t,e,s+h.length,i+1,r,o+1,a);if(d!==!1)return d}let f=t[s];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;s++}return r||null}#n(t,e,s,i,r){let o,a,l,h;for(o=i,a=r,h=t.length,l=e.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");let c=e[a],u=t[o];if(this.debug(e,c,u),c===!1||c===O)return!1;let f;if(typeof c=="string"?(f=u===c,this.debug("string match",c,u,f)):(f=c.test(u),this.debug("pattern match",c,u,f)),!f)return!1}if(o===h&&a===l)return!0;if(o===h)return s;if(a===l)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Wn(this.pattern,this.options)}parse(t){Gt(t);let e=this.options;if(t==="**")return O;if(t==="")return"";let s,i=null;(s=t.match(na))?i=e.dot?oa:ra:(s=t.match(Yo))?i=(e.nocase?e.dot?Zo:Xo:e.dot?Jo:Ko)(s[1]):(s=t.match(aa))?i=(e.nocase?e.dot?ha:la:e.dot?ca:ua)(s):(s=t.match(Qo))?i=e.dot?ea:ta:(s=t.match(sa))&&(i=ia);let r=vt.fromGlob(t,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?pa:e.dot?ma:ga,i=new Set(e.nocase?["i"]:[]),r=t.map(l=>{let h=l.map(c=>{if(c instanceof RegExp)for(let u of c.flags.split(""))i.add(u);return typeof c=="string"?xa(c):c===O?O:c._src});return h.forEach((c,u)=>{let f=h[u+1],d=h[u-1];c!==O||d===O||(d===void 0?f!==void 0&&f!==O?h[u+1]="(?:\\/|"+s+"\\/)?"+f:h[u]=s:f===void 0?h[u-1]=d+"(?:\\/|"+s+")?":f!==O&&(h[u-1]=d+"(?:\\/|\\/"+s+"\\/)"+f,h[u+1]=O))}),h.filter(c=>c!==O).join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+a+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<r.length;a++){let l=r[a],h=i;if(s.matchBase&&l.length===1&&(h=[o]),this.matchOne(h,l,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return L.defaults(t).Minimatch}};L.AST=vt;L.Minimatch=V;L.escape=Ft;L.unescape=X;var cr=require("node:url");var Rt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Hn=new Set,Rs=typeof process=="object"&&process?process:{},Vn=(n,t,e,s)=>{typeof Rs.emitWarning=="function"?Rs.emitWarning(n,t,e,s):console.error(`[${e}] ${t}: ${n}`)},_e=globalThis.AbortController,Bn=globalThis.AbortSignal;if(typeof _e>"u"){Bn=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},_e=class{constructor(){t()}signal=new Bn;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let i of this.signal._onabort)i(s);this.signal.onabort?.(s)}}};let n=Rs.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{n&&(n=!1,Vn("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var Sa=n=>!Hn.has(n),ah=Symbol("type"),dt=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),Un=n=>dt(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Mt:null:null,Mt=class extends Array{constructor(t){super(t),this.fill(0)}},Ms=class n{heap;length;static#t=!1;static create(t){let e=Un(t);if(!e)return[];n.#t=!0;let s=new n(t,e);return n.#t=!1,s}constructor(t,e){if(!n.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Yt=class n{#t;#s;#n;#e;#o;#x;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#u;#l;#a;#r;#y;#w;#m;#d;#S;#p;#E;#C;#g;#_;#b;#f;static unsafeExposeInternals(t){return{starts:t.#C,ttls:t.#g,sizes:t.#E,keyMap:t.#l,keyList:t.#a,valList:t.#r,next:t.#y,prev:t.#w,get head(){return t.#m},get tail(){return t.#d},free:t.#S,isBackgroundFetch:e=>t.#c(e),backgroundFetch:(e,s,i,r)=>t.#L(e,s,i,r),moveToTail:e=>t.#W(e),indexes:e=>t.#k(e),rindexes:e=>t.#$(e),isStale:e=>t.#v(e)}}get max(){return this.#t}get maxSize(){return this.#s}get calculatedSize(){return this.#u}get size(){return this.#h}get fetchMethod(){return this.#o}get memoMethod(){return this.#x}get dispose(){return this.#n}get disposeAfter(){return this.#e}constructor(t){let{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:h,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:f,maxSize:d=0,maxEntrySize:g=0,sizeCalculation:p,fetchMethod:b,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:$,ignoreFetchAbort:J}=t;if(e!==0&&!dt(e))throw new TypeError("max option must be a nonnegative integer");let k=e?Un(e):Array;if(!k)throw new Error("invalid max value: "+e);if(this.#t=e,this.#s=d,this.maxEntrySize=g||this.#s,this.sizeCalculation=p,this.sizeCalculation){if(!this.#s&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#x=y,b!==void 0&&typeof b!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=b,this.#b=!!b,this.#l=new Map,this.#a=new Array(e).fill(void 0),this.#r=new Array(e).fill(void 0),this.#y=new k(e),this.#w=new k(e),this.#m=0,this.#d=0,this.#S=Ms.create(e),this.#h=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof c=="function"?(this.#e=c,this.#p=[]):(this.#e=void 0,this.#p=void 0),this.#_=!!this.#n,this.#f=!!this.#e,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!$,this.ignoreFetchAbort=!!J,this.maxEntrySize!==0){if(this.#s!==0&&!dt(this.#s))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#T()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=dt(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#O()}if(this.#t===0&&this.ttl===0&&this.#s===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#s){let bt="LRU_CACHE_UNBOUNDED";Sa(bt)&&(Hn.add(bt),Vn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",bt,n))}}getRemainingTTL(t){return this.#l.has(t)?1/0:0}#O(){let t=new Mt(this.#t),e=new Mt(this.#t);this.#g=t,this.#C=e,this.#R=(r,o,a=Rt.now())=>{if(e[r]=o!==0?a:0,t[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#v(r)&&this.#F(this.#a[r],"expire")},o+1);l.unref&&l.unref()}},this.#A=r=>{e[r]=t[r]!==0?Rt.now():0},this.#i=(r,o)=>{if(t[o]){let a=t[o],l=e[o];if(!a||!l)return;r.ttl=a,r.start=l,r.now=s||i();let h=r.now-l;r.remainingTTL=a-h}};let s=0,i=()=>{let r=Rt.now();if(this.ttlResolution>0){s=r;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return r};this.getRemainingTTL=r=>{let o=this.#l.get(r);if(o===void 0)return 0;let a=t[o],l=e[o];if(!a||!l)return 1/0;let h=(s||i())-l;return a-h},this.#v=r=>{let o=e[r],a=t[r];return!!a&&!!o&&(s||i())-o>a}}#A=()=>{};#i=()=>{};#R=()=>{};#v=()=>!1;#T(){let t=new Mt(this.#t);this.#u=0,this.#E=t,this.#M=e=>{this.#u-=t[e],t[e]=0},this.#P=(e,s,i,r)=>{if(this.#c(s))return 0;if(!dt(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,e),!dt(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#j=(e,s,i)=>{if(t[e]=s,this.#s){let r=this.#s-t[e];for(;this.#u>r;)this.#N(!0)}this.#u+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#u)}}#M=t=>{};#j=(t,e,s)=>{};#P=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#d;!(!this.#D(e)||((t||!this.#v(e))&&(yield e),e===this.#m));)e=this.#w[e]}*#$({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#m;!(!this.#D(e)||((t||!this.#v(e))&&(yield e),e===this.#d));)e=this.#y[e]}#D(t){return t!==void 0&&this.#l.get(this.#a[t])===t}*entries(){for(let t of this.#k())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#c(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*rentries(){for(let t of this.#$())this.#r[t]!==void 0&&this.#a[t]!==void 0&&!this.#c(this.#r[t])&&(yield[this.#a[t],this.#r[t]])}*keys(){for(let t of this.#k()){let e=this.#a[t];e!==void 0&&!this.#c(this.#r[t])&&(yield e)}}*rkeys(){for(let t of this.#$()){let e=this.#a[t];e!==void 0&&!this.#c(this.#r[t])&&(yield e)}}*values(){for(let t of this.#k())this.#r[t]!==void 0&&!this.#c(this.#r[t])&&(yield this.#r[t])}*rvalues(){for(let t of this.#$())this.#r[t]!==void 0&&!this.#c(this.#r[t])&&(yield this.#r[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let s of this.#k()){let i=this.#r[s],r=this.#c(i)?i.__staleWhileFetching:i;if(r!==void 0&&t(r,this.#a[s],this))return this.get(this.#a[s],e)}}forEach(t,e=this){for(let s of this.#k()){let i=this.#r[s],r=this.#c(i)?i.__staleWhileFetching:i;r!==void 0&&t.call(e,r,this.#a[s],this)}}rforEach(t,e=this){for(let s of this.#$()){let i=this.#r[s],r=this.#c(i)?i.__staleWhileFetching:i;r!==void 0&&t.call(e,r,this.#a[s],this)}}purgeStale(){let t=!1;for(let e of this.#$({allowStale:!0}))this.#v(e)&&(this.#F(this.#a[e],"expire"),t=!0);return t}info(t){let e=this.#l.get(t);if(e===void 0)return;let s=this.#r[e],i=this.#c(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#g&&this.#C){let o=this.#g[e],a=this.#C[e];if(o&&a){let l=o-(Rt.now()-a);r.ttl=l,r.start=Date.now()}}return this.#E&&(r.size=this.#E[e]),r}dump(){let t=[];for(let e of this.#k({allowStale:!0})){let s=this.#a[e],i=this.#r[e],r=this.#c(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let o={value:r};if(this.#g&&this.#C){o.ttl=this.#g[e];let a=Rt.now()-this.#C[e];o.start=Math.floor(Date.now()-a)}this.#E&&(o.size=this.#E[e]),t.unshift([s,o])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let i=Date.now()-s.start;s.start=Rt.now()-i}this.set(e,s.value,s)}}set(t,e,s={}){if(e===void 0)return this.delete(t),this;let{ttl:i=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=s,{noUpdateTTL:h=this.noUpdateTTL}=s,c=this.#P(t,e,s.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#F(t,"set"),this;let u=this.#h===0?void 0:this.#l.get(t);if(u===void 0)u=this.#h===0?this.#d:this.#S.length!==0?this.#S.pop():this.#h===this.#t?this.#N(!1):this.#h,this.#a[u]=t,this.#r[u]=e,this.#l.set(t,u),this.#y[this.#d]=u,this.#w[u]=this.#d,this.#d=u,this.#h++,this.#j(u,c,l),l&&(l.set="add"),h=!1;else{this.#W(u);let f=this.#r[u];if(e!==f){if(this.#b&&this.#c(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!o&&(this.#_&&this.#n?.(d,t,"set"),this.#f&&this.#p?.push([d,t,"set"]))}else o||(this.#_&&this.#n?.(f,t,"set"),this.#f&&this.#p?.push([f,t,"set"]));if(this.#M(u),this.#j(u,c,l),this.#r[u]=e,l){l.set="replace";let d=f&&this.#c(f)?f.__staleWhileFetching:f;d!==void 0&&(l.oldValue=d)}}else l&&(l.set="update")}if(i!==0&&!this.#g&&this.#O(),this.#g&&(h||this.#R(u,i,r),l&&this.#i(l,u)),!o&&this.#f&&this.#p){let f=this.#p,d;for(;d=f?.shift();)this.#e?.(...d)}return this}pop(){try{for(;this.#h;){let t=this.#r[this.#m];if(this.#N(!0),this.#c(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#f&&this.#p){let t=this.#p,e;for(;e=t?.shift();)this.#e?.(...e)}}}#N(t){let e=this.#m,s=this.#a[e],i=this.#r[e];return this.#b&&this.#c(i)?i.__abortController.abort(new Error("evicted")):(this.#_||this.#f)&&(this.#_&&this.#n?.(i,s,"evict"),this.#f&&this.#p?.push([i,s,"evict"])),this.#M(e),t&&(this.#a[e]=void 0,this.#r[e]=void 0,this.#S.push(e)),this.#h===1?(this.#m=this.#d=0,this.#S.length=0):this.#m=this.#y[e],this.#l.delete(s),this.#h--,e}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#l.get(t);if(r!==void 0){let o=this.#r[r];if(this.#c(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(r))i&&(i.has="stale",this.#i(i,r));else return s&&this.#A(r),i&&(i.has="hit",this.#i(i,r)),!0}else i&&(i.has="miss");return!1}peek(t,e={}){let{allowStale:s=this.allowStale}=e,i=this.#l.get(t);if(i===void 0||!s&&this.#v(i))return;let r=this.#r[i];return this.#c(r)?r.__staleWhileFetching:r}#L(t,e,s,i){let r=e===void 0?void 0:this.#r[e];if(this.#c(r))return r;let o=new _e,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:s,context:i},h=(p,b=!1)=>{let{aborted:y}=o.signal,v=s.ignoreFetchAbort&&p!==void 0;if(s.status&&(y&&!b?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,v&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),y&&!v&&!b)return u(o.signal.reason);let x=d;return this.#r[e]===d&&(p===void 0?x.__staleWhileFetching?this.#r[e]=x.__staleWhileFetching:this.#F(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,p,l.options))),p},c=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),u(p)),u=p=>{let{aborted:b}=o.signal,y=b&&s.allowStaleOnFetchAbort,v=y||s.allowStaleOnFetchRejection,x=v||s.noDeleteOnFetchRejection,_=d;if(this.#r[e]===d&&(!x||_.__staleWhileFetching===void 0?this.#F(t,"fetch"):y||(this.#r[e]=_.__staleWhileFetching)),v)return s.status&&_.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),_.__staleWhileFetching;if(_.__returned===_)throw p},f=(p,b)=>{let y=this.#o?.(t,r,l);y&&y instanceof Promise&&y.then(v=>p(v===void 0?void 0:v),b),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=v=>h(v,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(f).then(h,c),g=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,g,{...l.options,status:void 0}),e=this.#l.get(t)):this.#r[e]=g,g}#c(t){if(!this.#b)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof _e}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:p,forceRefresh:b=!1,status:y,signal:v}=e;if(!this.#b)return y&&(y.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:y});let x={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:y,signal:v},_=this.#l.get(t);if(_===void 0){y&&(y.fetch="miss");let $=this.#L(t,_,x,p);return $.__returned=$}else{let $=this.#r[_];if(this.#c($)){let et=s&&$.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",et&&(y.returnedStale=!0)),et?$.__staleWhileFetching:$.__returned=$}let J=this.#v(_);if(!b&&!J)return y&&(y.fetch="hit"),this.#W(_),i&&this.#A(_),y&&this.#i(y,_),$;let k=this.#L(t,_,x,p),_t=k.__staleWhileFetching!==void 0&&s;return y&&(y.fetch=J?"stale":"refresh",_t&&J&&(y.returnedStale=!0)),_t?k.__staleWhileFetching:k.__returned=k}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=this.#x;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...o}=e,a=this.get(t,o);if(!r&&a!==void 0)return a;let l=s(t,a,{options:o,context:i});return this.set(t,l,o),l}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=e,a=this.#l.get(t);if(a!==void 0){let l=this.#r[a],h=this.#c(l);return o&&this.#i(o,a),this.#v(a)?(o&&(o.get="stale"),h?(o&&s&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?l.__staleWhileFetching:void 0):(r||this.#F(t,"expire"),o&&s&&(o.returnedStale=!0),s?l:void 0)):(o&&(o.get="hit"),h?l.__staleWhileFetching:(this.#W(a),i&&this.#A(a),l))}else o&&(o.get="miss")}#I(t,e){this.#w[e]=t,this.#y[t]=e}#W(t){t!==this.#d&&(t===this.#m?this.#m=this.#y[t]:this.#I(this.#w[t],this.#y[t]),this.#I(this.#d,t),this.#d=t)}delete(t){return this.#F(t,"delete")}#F(t,e){let s=!1;if(this.#h!==0){let i=this.#l.get(t);if(i!==void 0)if(s=!0,this.#h===1)this.#B(e);else{this.#M(i);let r=this.#r[i];if(this.#c(r)?r.__abortController.abort(new Error("deleted")):(this.#_||this.#f)&&(this.#_&&this.#n?.(r,t,e),this.#f&&this.#p?.push([r,t,e])),this.#l.delete(t),this.#a[i]=void 0,this.#r[i]=void 0,i===this.#d)this.#d=this.#w[i];else if(i===this.#m)this.#m=this.#y[i];else{let o=this.#w[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#w[a]=this.#w[i]}this.#h--,this.#S.push(i)}}if(this.#f&&this.#p?.length){let i=this.#p,r;for(;r=i?.shift();)this.#e?.(...r)}return s}clear(){return this.#B("delete")}#B(t){for(let e of this.#$({allowStale:!0})){let s=this.#r[e];if(this.#c(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#a[e];this.#_&&this.#n?.(s,i,t),this.#f&&this.#p?.push([s,i,t])}}if(this.#l.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#g&&this.#C&&(this.#g.fill(0),this.#C.fill(0)),this.#E&&this.#E.fill(0),this.#m=0,this.#d=0,this.#S.length=0,this.#u=0,this.#h=0,this.#f&&this.#p){let e=this.#p,s;for(;s=e?.shift();)this.#e?.(...s)}}};var Dt=require("node:path"),tr=require("node:url"),rt=require("fs"),Ra=P(require("node:fs"),1),gt=require("node:fs/promises");var Te=require("node:events"),Ws=P(require("node:stream"),1),Kn=require("node:string_decoder"),zn=typeof process=="object"&&process?process:{stdout:null,stderr:null},_a=n=>!!n&&typeof n=="object"&&(n instanceof mt||n instanceof Ws.default||Ea(n)||Ca(n)),Ea=n=>!!n&&typeof n=="object"&&n instanceof Te.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==Ws.default.Writable.prototype.pipe,Ca=n=>!!n&&typeof n=="object"&&n instanceof Te.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",lt=Symbol("EOF"),ht=Symbol("maybeEmitEnd"),pt=Symbol("emittedEnd"),Ee=Symbol("emittingEnd"),Kt=Symbol("emittedError"),Ce=Symbol("closed"),Gn=Symbol("read"),Oe=Symbol("flush"),qn=Symbol("flushChunk"),Z=Symbol("encoding"),jt=Symbol("decoder"),F=Symbol("flowing"),Jt=Symbol("paused"),Pt=Symbol("resume"),R=Symbol("buffer"),I=Symbol("pipes"),M=Symbol("bufferLength"),js=Symbol("bufferPush"),Ae=Symbol("bufferShift"),D=Symbol("objectMode"),A=Symbol("destroyed"),Ps=Symbol("error"),Ds=Symbol("emitData"),Yn=Symbol("emitEnd"),Ns=Symbol("emitEnd2"),it=Symbol("async"),Ls=Symbol("abort"),ke=Symbol("aborted"),Xt=Symbol("signal"),xt=Symbol("dataListeners"),U=Symbol("discarded"),Zt=n=>Promise.resolve().then(n),Oa=n=>n(),Aa=n=>n==="end"||n==="finish"||n==="prefinish",ka=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,$a=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),$e=class{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[Pt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Is=class extends $e{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=i=>this.dest.emit("error",i),t.on("error",this.proxyErrors)}},Ta=n=>!!n.objectMode,Fa=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",mt=class extends Te.EventEmitter{[F]=!1;[Jt]=!1;[I]=[];[R]=[];[D];[Z];[it];[jt];[lt]=!1;[pt]=!1;[Ee]=!1;[Ce]=!1;[Kt]=null;[M]=0;[A]=!1;[Xt];[ke]=!1;[xt]=0;[U]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Ta(e)?(this[D]=!0,this[Z]=null):Fa(e)?(this[Z]=e.encoding,this[D]=!1):(this[D]=!1,this[Z]=null),this[it]=!!e.async,this[jt]=this[Z]?new Kn.StringDecoder(this[Z]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[R]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[I]});let{signal:s}=e;s&&(this[Xt]=s,s.aborted?this[Ls]():s.addEventListener("abort",()=>this[Ls]()))}get bufferLength(){return this[M]}get encoding(){return this[Z]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[D]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[it]}set async(t){this[it]=this[it]||!!t}[Ls](){this[ke]=!0,this.emit("abort",this[Xt]?.reason),this.destroy(this[Xt]?.reason)}get aborted(){return this[ke]}set aborted(t){}write(t,e,s){if(this[ke])return!1;if(this[lt])throw new Error("write after end");if(this[A])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let i=this[it]?Zt:Oa;if(!this[D]&&!Buffer.isBuffer(t)){if($a(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(ka(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[D]?(this[F]&&this[M]!==0&&this[Oe](!0),this[F]?this.emit("data",t):this[js](t),this[M]!==0&&this.emit("readable"),s&&i(s),this[F]):t.length?(typeof t=="string"&&!(e===this[Z]&&!this[jt]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[Z]&&(t=this[jt].write(t)),this[F]&&this[M]!==0&&this[Oe](!0),this[F]?this.emit("data",t):this[js](t),this[M]!==0&&this.emit("readable"),s&&i(s),this[F]):(this[M]!==0&&this.emit("readable"),s&&i(s),this[F])}read(t){if(this[A])return null;if(this[U]=!1,this[M]===0||t===0||t&&t>this[M])return this[ht](),null;this[D]&&(t=null),this[R].length>1&&!this[D]&&(this[R]=[this[Z]?this[R].join(""):Buffer.concat(this[R],this[M])]);let e=this[Gn](t||null,this[R][0]);return this[ht](),e}[Gn](t,e){if(this[D])this[Ae]();else{let s=e;t===s.length||t===null?this[Ae]():typeof s=="string"?(this[R][0]=s.slice(t),e=s.slice(0,t),this[M]-=t):(this[R][0]=s.subarray(t),e=s.subarray(0,t),this[M]-=t)}return this.emit("data",e),!this[R].length&&!this[lt]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=void 0),typeof e=="function"&&(s=e,e="utf8"),t!==void 0&&this.write(t,e),s&&this.once("end",s),this[lt]=!0,this.writable=!1,(this[F]||!this[Jt])&&this[ht](),this}[Pt](){this[A]||(!this[xt]&&!this[I].length&&(this[U]=!0),this[Jt]=!1,this[F]=!0,this.emit("resume"),this[R].length?this[Oe]():this[lt]?this[ht]():this.emit("drain"))}resume(){return this[Pt]()}pause(){this[F]=!1,this[Jt]=!0,this[U]=!1}get destroyed(){return this[A]}get flowing(){return this[F]}get paused(){return this[Jt]}[js](t){this[D]?this[M]+=1:this[M]+=t.length,this[R].push(t)}[Ae](){return this[D]?this[M]-=1:this[M]-=this[R][0].length,this[R].shift()}[Oe](t=!1){do;while(this[qn](this[Ae]())&&this[R].length);!t&&!this[R].length&&!this[lt]&&this.emit("drain")}[qn](t){return this.emit("data",t),this[F]}pipe(t,e){if(this[A])return t;this[U]=!1;let s=this[pt];return e=e||{},t===zn.stdout||t===zn.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[I].push(e.proxyErrors?new Is(this,t,e):new $e(this,t,e)),this[it]?Zt(()=>this[Pt]()):this[Pt]()),t}unpipe(t){let e=this[I].find(s=>s.dest===t);e&&(this[I].length===1?(this[F]&&this[xt]===0&&(this[F]=!1),this[I]=[]):this[I].splice(this[I].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let s=super.on(t,e);if(t==="data")this[U]=!1,this[xt]++,!this[I].length&&!this[F]&&this[Pt]();else if(t==="readable"&&this[M]!==0)super.emit("readable");else if(Aa(t)&&this[pt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Kt]){let i=e;this[it]?Zt(()=>i.call(this,this[Kt])):i.call(this,this[Kt])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){let s=super.off(t,e);return t==="data"&&(this[xt]=this.listeners("data").length,this[xt]===0&&!this[U]&&!this[I].length&&(this[F]=!1)),s}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[xt]=0,!this[U]&&!this[I].length&&(this[F]=!1)),e}get emittedEnd(){return this[pt]}[ht](){!this[Ee]&&!this[pt]&&!this[A]&&this[R].length===0&&this[lt]&&(this[Ee]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ce]&&this.emit("close"),this[Ee]=!1)}emit(t,...e){let s=e[0];if(t!=="error"&&t!=="close"&&t!==A&&this[A])return!1;if(t==="data")return!this[D]&&!s?!1:this[it]?(Zt(()=>this[Ds](s)),!0):this[Ds](s);if(t==="end")return this[Yn]();if(t==="close"){if(this[Ce]=!0,!this[pt]&&!this[A])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[Kt]=s,super.emit(Ps,s);let r=!this[Xt]||this.listeners("error").length?super.emit("error",s):!1;return this[ht](),r}else if(t==="resume"){let r=super.emit("resume");return this[ht](),r}else if(t==="finish"||t==="prefinish"){let r=super.emit(t);return this.removeAllListeners(t),r}let i=super.emit(t,...e);return this[ht](),i}[Ds](t){for(let s of this[I])s.dest.write(t)===!1&&this.pause();let e=this[U]?!1:super.emit("data",t);return this[ht](),e}[Yn](){return this[pt]?!1:(this[pt]=!0,this.readable=!1,this[it]?(Zt(()=>this[Ns]()),!0):this[Ns]())}[Ns](){if(this[jt]){let e=this[jt].end();if(e){for(let s of this[I])s.dest.write(e);this[U]||super.emit("data",e)}}for(let e of this[I])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[D]||(t.dataLength=0);let e=this.promise();return this.on("data",s=>{t.push(s),this[D]||(t.dataLength+=s.length)}),await e,t}async concat(){if(this[D])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Z]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(A,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[U]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[lt])return e();let r,o,a=u=>{this.off("data",l),this.off("end",h),this.off(A,c),e(),o(u)},l=u=>{this.off("error",a),this.off("end",h),this.off(A,c),this.pause(),r({value:u,done:!!this[lt]})},h=()=>{this.off("error",a),this.off("data",l),this.off(A,c),e(),r({done:!0,value:void 0})},c=()=>a(new Error("stream destroyed"));return new Promise((u,f)=>{o=f,r=u,this.once(A,c),this.once("error",a),this.once("end",h),this.once("data",l)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[U]=!1;let t=!1,e=()=>(this.pause(),this.off(Ps,e),this.off(A,e),this.off("end",e),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}};return this.once("end",e),this.once(Ps,e),this.once(A,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[A])return t?this.emit("error",t):this.emit(A),this;this[A]=!0,this[U]=!0,this[R].length=0,this[M]=0;let e=this;return typeof e.close=="function"&&!this[Ce]&&e.close(),t?this.emit("error",t):this.emit(A),this}static get isStream(){return _a}};var Ma=rt.realpathSync.native,te={lstatSync:rt.lstatSync,readdir:rt.readdir,readdirSync:rt.readdirSync,readlinkSync:rt.readlinkSync,realpathSync:Ma,promises:{lstat:gt.lstat,readdir:gt.readdir,readlink:gt.readlink,realpath:gt.realpath}},er=n=>!n||n===te||n===Ra?te:{...te,...n,promises:{...te.promises,...n.promises||{}}},sr=/^\\\\\?\\([a-z]:)\\?$/i,ja=n=>n.replace(/\//g,"\\").replace(sr,"$1\\"),Pa=/[\\\/]/,K=0,ir=1,nr=2,nt=4,rr=6,or=8,St=10,ar=12,Y=15,Qt=~Y,Bs=16,Jn=32,ee=64,Q=128,Fe=256,Me=512,Xn=ee|Q|Me,Da=1023,Hs=n=>n.isFile()?or:n.isDirectory()?nt:n.isSymbolicLink()?St:n.isCharacterDevice()?nr:n.isBlockDevice()?rr:n.isSocket()?ar:n.isFIFO()?ir:K,Zn=new Map,se=n=>{let t=Zn.get(n);if(t)return t;let e=n.normalize("NFKD");return Zn.set(n,e),e},Qn=new Map,Re=n=>{let t=Qn.get(n);if(t)return t;let e=se(n.toLowerCase());return Qn.set(n,e),e},je=class extends Yt{constructor(){super({max:256})}},Vs=class extends Yt{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},lr=Symbol("PathScurry setAsCwd"),N=class{name;root;roots;parent;nocase;isCWD=!1;#t;#s;get dev(){return this.#s}#n;get mode(){return this.#n}#e;get nlink(){return this.#e}#o;get uid(){return this.#o}#x;get gid(){return this.#x}#h;get rdev(){return this.#h}#u;get blksize(){return this.#u}#l;get ino(){return this.#l}#a;get size(){return this.#a}#r;get blocks(){return this.#r}#y;get atimeMs(){return this.#y}#w;get mtimeMs(){return this.#w}#m;get ctimeMs(){return this.#m}#d;get birthtimeMs(){return this.#d}#S;get atime(){return this.#S}#p;get mtime(){return this.#p}#E;get ctime(){return this.#E}#C;get birthtime(){return this.#C}#g;#_;#b;#f;#O;#A;#i;#R;#v;#T;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=K,s,i,r,o,a){this.name=t,this.#g=r?Re(t):se(t),this.#i=e&Da,this.nocase=r,this.roots=i,this.root=s||this,this.#R=o,this.#b=a.fullpath,this.#O=a.relative,this.#A=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=er(a.fs)}depth(){return this.#_!==void 0?this.#_:this.parent?this.#_=this.parent.depth()+1:this.#_=0}childrenCache(){return this.#R}resolve(t){if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#M(i):this.#M(i)}#M(t){let e=this;for(let s of t)e=e.child(s);return e}children(){let t=this.#R.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#R.set(this,e),this.#i&=~Bs,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),i=this.nocase?Re(t):se(t);for(let l of s)if(l.#g===i)return l;let r=this.parent?this.sep:"",o=this.#b?this.#b+r+t:void 0,a=this.newChild(t,K,{...e,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=Q),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let t=this.name,e=this.parent;if(!e)return this.#O=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let t=this.name,e=this.parent;if(!e)return this.#A=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#b!==void 0)return this.#b;let t=this.name,e=this.parent;if(!e)return this.#b=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+t;return this.#b=i}fullpathPosix(){if(this.#f!==void 0)return this.#f;if(this.sep==="/")return this.#f=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#f=`//?/${i}`:this.#f=i}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return this.#f=s}isUnknown(){return(this.#i&Y)===K}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&Y)===or}isDirectory(){return(this.#i&Y)===nt}isCharacterDevice(){return(this.#i&Y)===nr}isBlockDevice(){return(this.#i&Y)===rr}isFIFO(){return(this.#i&Y)===ir}isSocket(){return(this.#i&Y)===ar}isSymbolicLink(){return(this.#i&St)===St}lstatCached(){return this.#i&Jn?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#T}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let t=this.#i&Y;return!(t!==K&&t!==St||this.#i&Fe||this.#i&Q)}calledReaddir(){return!!(this.#i&Bs)}isENOENT(){return!!(this.#i&Q)}isNamed(t){return this.nocase?this.#g===Re(t):this.#g===se(t)}async readlink(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#v=s}catch(e){this.#c(e.code);return}}readlinkSync(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#v=s}catch(e){this.#c(e.code);return}}#j(t){this.#i|=Bs;for(let e=t.provisional;e<t.length;e++){let s=t[e];s&&s.#P()}}#P(){this.#i&Q||(this.#i=(this.#i|Q)&Qt,this.#k())}#k(){let t=this.children();t.provisional=0;for(let e of t)e.#P()}#$(){this.#i|=Me,this.#D()}#D(){if(this.#i&ee)return;let t=this.#i;(t&Y)===nt&&(t&=Qt),this.#i=t|ee,this.#k()}#N(t=""){t==="ENOTDIR"||t==="EPERM"?this.#D():t==="ENOENT"?this.#P():this.children().provisional=0}#L(t=""){t==="ENOTDIR"?this.parent.#D():t==="ENOENT"&&this.#P()}#c(t=""){let e=this.#i;e|=Fe,t==="ENOENT"&&(e|=Q),(t==="EINVAL"||t==="UNKNOWN")&&(e&=Qt),this.#i=e,t==="ENOTDIR"&&this.parent&&this.parent.#D()}#I(t,e){return this.#F(t,e)||this.#W(t,e)}#W(t,e){let s=Hs(t),i=this.newChild(t.name,s,{parent:this}),r=i.#i&Y;return r!==nt&&r!==St&&r!==K&&(i.#i|=ee),e.unshift(i),e.provisional++,i}#F(t,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?Re(t.name):se(t.name))===i.#g)return this.#B(t,i,s,e)}}#B(t,e,s,i){let r=e.name;return e.#i=e.#i&Qt|Hs(t),r!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e}async lstat(){if(!(this.#i&Q))try{return this.#z(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#L(t.code)}}lstatSync(){if(!(this.#i&Q))try{return this.#z(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#L(t.code)}}#z(t){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:h,dev:c,gid:u,ino:f,mode:d,mtime:g,mtimeMs:p,nlink:b,rdev:y,size:v,uid:x}=t;this.#S=e,this.#y=s,this.#C=i,this.#d=r,this.#u=o,this.#r=a,this.#E=l,this.#m=h,this.#s=c,this.#x=u,this.#l=f,this.#n=d,this.#p=g,this.#w=p,this.#e=b,this.#h=y,this.#a=v,this.#o=x;let _=Hs(t);this.#i=this.#i&Qt|_|Jn,_!==K&&_!==nt&&_!==St&&(this.#i|=ee)}#V=[];#U=!1;#G(t){this.#U=!1;let e=this.#V.slice();this.#V.length=0,e.forEach(s=>s(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);e?t(null,r):queueMicrotask(()=>t(null,r));return}if(this.#V.push(t),this.#U)return;this.#U=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#N(r.code),s.provisional=0;else{for(let a of o)this.#I(a,s);this.#j(s)}this.#G(s.slice(0,s.provisional))})}#H;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#H)await this.#H;else{let s=()=>{};this.#H=new Promise(i=>s=i);try{for(let i of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#I(i,t);this.#j(t)}catch(i){this.#N(i.code),t.provisional=0}this.#H=void 0,s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of this.#t.readdirSync(e,{withFileTypes:!0}))this.#I(s,t);this.#j(t)}catch(s){this.#N(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#i&Xn)return!1;let t=Y&this.#i;return t===K||t===nt||t===St}shouldWalk(t,e){return(this.#i&nt)===nt&&!(this.#i&Xn)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#T)return this.#T;if(!((Me|Fe|Q)&this.#i))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#T=this.resolve(t)}catch{this.#$()}}realpathSync(){if(this.#T)return this.#T;if(!((Me|Fe|Q)&this.#i))try{let t=this.#t.realpathSync(this.fullpath());return this.#T=this.resolve(t)}catch{this.#$()}}[lr](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),i.#O=s.join(this.sep),i.#A=s.join("/"),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)i.#O=void 0,i.#A=void 0,i=i.parent}},Pe=class n extends N{sep="\\";splitSep=Pa;constructor(t,e=K,s,i,r,o,a){super(t,e,s,i,r,o,a)}newChild(t,e=K,s={}){return new n(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return Dt.win32.parse(t).root}getRoot(t){if(t=ja(t.toUpperCase()),t===this.root.name)return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new Nt(t,this).root}sameRoot(t,e=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(sr,"$1\\"),t===e}},De=class n extends N{splitSep="/";sep="/";constructor(t,e=K,s,i,r,o,a){super(t,e,s,i,r,o,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=K,s={}){return new n(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}},Ne=class{root;rootPath;roots;cwd;#t;#s;#n;nocase;#e;constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=te}={}){this.#e=er(o),(t instanceof URL||t.startsWith("file://"))&&(t=(0,tr.fileURLToPath)(t));let a=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new je,this.#s=new je,this.#n=new Vs(r);let l=a.substring(this.rootPath.length).split(s);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#e),this.roots[this.rootPath]=this.root;let h=this.root,c=l.length-1,u=e.sep,f=this.rootPath,d=!1;for(let g of l){let p=c--;h=h.child(g,{relative:new Array(p).fill("..").join(u),relativePosix:new Array(p).fill("..").join("/"),fullpath:f+=(d?"":u)+g}),d=!0}this.cwd=h}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let e="";for(let r=t.length-1;r>=0;r--){let o=t[r];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#t.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return this.#t.set(e,i),i}resolvePosix(...t){let e="";for(let r=t.length-1;r>=0;r--){let o=t[r];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#s.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return this.#s.set(e,i),i}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let i=await t.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(i=>i.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=[];(!r||r(t))&&a.push(s?t:t.fullpath());let l=new Set,h=(u,f)=>{l.add(u),u.readdirCB((d,g)=>{if(d)return f(d);let p=g.length;if(!p)return f();let b=()=>{--p===0&&f()};for(let y of g)(!r||r(y))&&a.push(s?y:y.fullpath()),i&&y.isSymbolicLink()?y.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(l,o)?h(v,b):b()):y.shouldWalk(l,o)?h(y,b):b()},!0)},c=t;return new Promise((u,f)=>{h(c,d=>{if(d)return f(d);u(a)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=[];(!r||r(t))&&a.push(s?t:t.fullpath());let l=new Set([t]);for(let h of l){let c=h.readdirSync();for(let u of c){(!r||r(u))&&a.push(s?u:u.fullpath());let f=u;if(u.isSymbolicLink()){if(!(i&&(f=u.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(l,o)&&l.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e;(!r||r(t))&&(yield s?t:t.fullpath());let a=new Set([t]);for(let l of a){let h=l.readdirSync();for(let c of h){(!r||r(c))&&(yield s?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(i&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(a,o)&&a.add(u)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=new mt({objectMode:!0});(!r||r(t))&&a.write(s?t:t.fullpath());let l=new Set,h=[t],c=0,u=()=>{let f=!1;for(;!f;){let d=h.shift();if(!d){c===0&&a.end();return}c++,l.add(d);let g=(b,y,v=!1)=>{if(b)return a.emit("error",b);if(i&&!v){let x=[];for(let _ of y)_.isSymbolicLink()&&x.push(_.realpath().then($=>$?.isUnknown()?$.lstat():$));if(x.length){Promise.all(x).then(()=>g(null,y,!0));return}}for(let x of y)x&&(!r||r(x))&&(a.write(s?x:x.fullpath())||(f=!0));c--;for(let x of y){let _=x.realpathCached()||x;_.shouldWalk(l,o)&&h.push(_)}f&&!a.flowing?a.once("drain",u):p||u()},p=!0;d.readdirCB(g,!0),p=!1}};return u(),a}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof N||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=e,a=new mt({objectMode:!0}),l=new Set;(!r||r(t))&&a.write(s?t:t.fullpath());let h=[t],c=0,u=()=>{let f=!1;for(;!f;){let d=h.shift();if(!d){c===0&&a.end();return}c++,l.add(d);let g=d.readdirSync();for(let p of g)(!r||r(p))&&(a.write(s?p:p.fullpath())||(f=!0));c--;for(let p of g){let b=p;if(p.isSymbolicLink()){if(!(i&&(b=p.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(l,o)&&h.push(b)}}f&&!a.flowing&&a.once("drain",u)};return u(),a}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[lr](e)}},Nt=class extends Ne{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,Dt.win32,"\\",{...e,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(t){return Dt.win32.parse(t).root.toUpperCase()}newRoot(t){return new Pe(this.rootPath,nt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},Lt=class extends Ne{sep="/";constructor(t=process.cwd(),e={}){let{nocase:s=!1}=e;super(t,Dt.posix,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new De(this.rootPath,nt,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},ie=class extends Lt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},fh=process.platform==="win32"?Pe:De,hr=process.platform==="win32"?Nt:process.platform==="darwin"?ie:Lt;var Na=n=>n.length>=1,La=n=>n.length>=1,It=class n{#t;#s;#n;length;#e;#o;#x;#h;#u;#l;#a=!0;constructor(t,e,s,i){if(!Na(t))throw new TypeError("empty pattern list");if(!La(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#s=e,this.#n=s,this.#e=i,this.#n===0){if(this.isUNC()){let[r,o,a,l,...h]=this.#t,[c,u,f,d,...g]=this.#s;h[0]===""&&(h.shift(),g.shift());let p=[r,o,a,l,""].join("/"),b=[c,u,f,d,""].join("/");this.#t=[p,...h],this.#s=[b,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#t,[a,...l]=this.#s;o[0]===""&&(o.shift(),l.shift());let h=r+"/",c=a+"/";this.#t=[h,...o],this.#s=[c,...l],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===O}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#x=this.#x||(this.#n===0?this.isAbsolute()?this.#s[0]+this.#s.slice(1).join("/"):this.#s.join("/"):this.#s.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new n(this.#t,this.#s,this.#n+1,this.#e),this.#o.#l=this.#l,this.#o.#u=this.#u,this.#o.#h=this.#h,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#u!==void 0?this.#u:this.#u=this.#e==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#h!==void 0?this.#h:this.#h=this.#e==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#l!==void 0?this.#l:this.#l=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Ia=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Wt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:o=Ia}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of t)this.add(a)}add(t){let e=new V(t,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],r=e.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new It(i,r,0,this.platform),a=new V(o.globString(),this.mmopts),l=r[r.length-1]==="**",h=o.isAbsolute();h?this.absolute.push(a):this.relative.push(a),l&&(h?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(t){let e=t.fullpath(),s=`${e}/`,i=t.relative()||".",r=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(r))return!0;for(let o of this.absolute)if(o.match(e)||o.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};var Us=class n{store;constructor(t=new Map){this.store=t}copy(){return new n(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},zs=class{store=new Map;add(t,e,s){let i=(e?2:0)|(s?1:0),r=this.store.get(t);this.store.set(t,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},Gs=class{store=new Map;add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},ne=class n{hasWalkedCache;matches=new zs;subwalks=new Gs;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new Us}processPatterns(t,e){this.patterns=e;let s=e.map(i=>[t,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let o=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let u=r.rest();if(u)r=u;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,h,c=!1;for(;typeof(l=r.pattern())=="string"&&(h=r.rest());)i=i.resolve(l),r=h,c=!0;if(l=r.pattern(),h=r.rest(),c){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof l=="string"){let u=l===".."||l===""||l===".";this.matches.add(i.resolve(l),a,u);continue}else if(l===O){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let u=h?.pattern(),f=h?.rest();if(!h||(u===""||u===".")&&!f)this.matches.add(i,a,u===""||u===".");else if(u===".."){let d=i.parent||i;f?this.hasWalkedCache.hasWalked(d,f)||this.subwalks.add(d,f):this.matches.add(d,a,!0)}}else l instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),i=this.child();for(let r of e)for(let o of s){let a=o.isAbsolute(),l=o.pattern(),h=o.rest();l===O?i.testGlobstar(r,o,h,a):l instanceof RegExp?i.testRegExp(r,l,h,a):i.testString(r,l,h,a)}return i}testGlobstar(t,e,s,i){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,i,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(t,r,s.rest(),i);else if(r===".."){let o=t.parent||t;this.subwalks.add(o,s)}else r instanceof RegExp&&this.testRegExp(t,r,s.rest(),i)}}testRegExp(t,e,s,i){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}};var Wa=(n,t)=>typeof n=="string"?new Wt([n],t):Array.isArray(n)?new Wt(n,t):n,Le=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#s;#n;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#s=Wa(s.ignore??[],s),!this.includeChildMatches&&typeof this.#s.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#e(t){return this.seen.has(t)||!!this.#s?.ignored?.(t)}#o(t){return!!this.#s?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=await r.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(r,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#e(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let o=r.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(r,e)}matchFinish(t,e){if(this.#e(t))return;if(!this.includeChildMatches&&this.#s?.add){let r=`${t.relativePosix()}/**`;this.#s.add(r)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let r=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(t,e,s){let i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){let i=this.matchCheckSync(t,s);i&&this.matchFinish(i,e)}walkCB(t,e,s){this.signal?.aborted&&s(),this.walkCB2(t,e,new ne(this.opts),s)}walkCB2(t,e,s,i){if(this.#o(t))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,i));return}s.processPatterns(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||(r++,this.match(a,l,h).then(()=>o()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirCached();a.calledReaddir()?this.walkCB3(a,l,s,o):a.readdirCB((h,c)=>this.walkCB3(a,c,s,o),!0)}o()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||(r++,this.match(a,l,h).then(()=>o()));for(let[a,l]of s.subwalks.entries())r++,this.walkCB2(a,l,s.child(),o);o()}walkCBSync(t,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(t,e,new ne(this.opts),s)}walkCB2Sync(t,e,s,i){if(this.#o(t))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,i));return}s.processPatterns(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||this.matchSync(a,l,h);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let l=a.readdirSync();this.walkCB3Sync(a,l,s,o)}o()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#e(a)||this.matchSync(a,l,h);for(let[a,l]of s.subwalks.entries())r++,this.walkCB2Sync(a,l,s.child(),o);o()}},re=class extends Le{matches=new Set;constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},oe=class extends Le{results;constructor(t,e,s){super(t,e,s),this.results=new mt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var Ba=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",tt=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,cr.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=t,this.platform=e.platform||Ba,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=e.platform==="win32"?Nt:e.platform==="darwin"?ie:e.platform?Lt:hr;this.scurry=new l(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(l=>new V(l,i)),[o,a]=r.reduce((l,h)=>(l[0].push(...h.set),l[1].push(...h.globParts),l),[[],[]]);this.patterns=o.map((l,h)=>{let c=a[h];if(!c)throw new Error("invalid pattern object");return new It(l,c,0,this.platform)})}async walk(){return[...await new re(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new re(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new oe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new oe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var qs=(n,t={})=>{Array.isArray(n)||(n=[n]);for(let e of n)if(new V(e,t).hasMagic())return!0;return!1};function We(n,t={}){return new tt(n,t).streamSync()}function fr(n,t={}){return new tt(n,t).stream()}function dr(n,t={}){return new tt(n,t).walkSync()}async function ur(n,t={}){return new tt(n,t).walk()}function Be(n,t={}){return new tt(n,t).iterateSync()}function pr(n,t={}){return new tt(n,t).iterate()}var Ha=We,Va=Object.assign(fr,{sync:We}),Ua=Be,za=Object.assign(pr,{sync:Be}),Ga=Object.assign(dr,{stream:We,iterate:Be}),Ie=Object.assign(ur,{glob:ur,globSync:dr,sync:Ga,globStream:fr,stream:Va,globStreamSync:We,streamSync:Ha,globIterate:pr,iterate:za,globIterateSync:Be,iterateSync:Ua,Glob:tt,hasMagic:qs,escape:Ft,unescape:X});Ie.glob=Ie;var qa=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at"},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on"},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean"},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach"},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong"},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically"},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support"},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with"},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight"},{id:"ai.ever-evolving",category:"ai-slop",severity:"red",regex:/\b(?:ever[\s-]evolving|ever[\s-]changing)\b/gi,suggestion:"cut this \u2014 it says nothing"},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this"},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed"},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift"},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why"},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms"},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works"},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it"},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level"},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact"}],Ya=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler'},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end."},{id:"formula.it-is-important",category:"ai-slop",severity:"yellow",regex:/\bit is important to note\b/gi,suggestion:"just note it. skip the preamble."},{id:"formula.at-the-end",category:"ai-slop",severity:"yellow",regex:/\bat the end of the day\b/gi,suggestion:"cut this \u2014 it means nothing"},{id:"formula.needless-to-say",category:"ai-slop",severity:"yellow",regex:/\bneedless to say\b/gi,suggestion:"if it's needless, don't say it"},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it"},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead"},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed."},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it"}],Ka=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it"},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't."},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly"},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent"}],Ja=[{id:"struct.antithesis",category:"structure",severity:"yellow",regex:/\bnot (?:just|only) .{3,50}, but .{3,50}/gi,suggestion:"this antithesis pattern is an AI tell \u2014 restructure"},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore than just\b/gi,suggestion:"say what it IS, not what it isn't"},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"'},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"'},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"'},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly"}],Xa=[...qa,...Ya,...Ka,...Ja];function mr(n,t,e){let s=[];for(let i of Xa){i.regex.lastIndex=0;let r;for(;(r=i.regex.exec(n))!==null;)s.push({file:e,line:t,column:r.index+1,pattern:i.id,category:i.category,severity:i.severity,excerpt:Za(n.trim(),r.index,r[0].length),suggestion:i.suggestion})}return s}function Za(n,t,e){let s=n.slice(0,t),i=n.slice(t,t+e),r=n.slice(t+e);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}async function He(n,t=[]){let e=[];for(let o of n)if(Bt.existsSync(o)&&Bt.statSync(o).isFile())e.push(o);else{let a=await Ie("**/*.md",{cwd:o,ignore:["node_modules/**",".git/**",...t],absolute:!0});e.push(...a)}let s=[...new Set(e)],i=[],r={files:0,total_lines:0,red:0,yellow:0,clean:0};for(let o of s){if(!o.endsWith(".md"))continue;let a;try{a=Bt.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
110
+ `),h=[];for(let f=0;f<l.length;f++){let d=l[f];d.startsWith("```")||d.startsWith("---")||d.startsWith("#")||d.trim().length<10||h.push(...mr(d,f+1,Ys.relative(process.cwd(),o)))}r.files++,r.total_lines+=l.length;let c=h.filter(f=>f.severity==="red").length,u=h.filter(f=>f.severity==="yellow").length;r.red+=c,r.yellow+=u,c+u===0&&r.clean++,i.push({file:Ys.relative(process.cwd(),o),findings:h,lines:l.length})}return{results:i,summary:r}}async function gr(n,t){let e=pe(),s=n.length?n:e.scan_paths||["."],i=e.ignore||[],{results:r,summary:o}=await He(s,i);if(t.json){console.log(JSON.stringify({results:r.filter(l=>l.findings.length>0),summary:o},null,2)),t.failOnHit&&o.red+o.yellow>0&&process.exit(1);return}console.log(`
111
+ ${H()} ${m.dim("scan")}
112
+ `);let a=0;for(let l of r)if(l.findings.length!==0){console.log(` ${m.bold(l.file)} ${m.dim(`(${l.lines} lines)`)}`);for(let h of l.findings)cn(h),a++;console.log("")}un(o),t.failOnHit&&o.red+o.yellow>0&&process.exit(1)}var yt=P(require("fs"));function yr(n,t,e,s){let i=[];if(i.push("You are rewriting a draft to match a specific voice profile."),i.push(""),i.push("<voice_profile>"),i.push(`<name>${n.name}</name>`),n.brand&&i.push(`<brand>${n.brand}</brand>`),n.description&&i.push(`<description>${n.description}</description>`),n.keywords?.length&&i.push(`<keywords>${n.keywords.join(", ")}</keywords>`),i.push(""),i.push(t),i.push("</voice_profile>"),i.push(""),s.length>0){i.push("<issues_found>");let r=s.filter(a=>a.severity==="red"),o=s.filter(a=>a.severity==="yellow");r.length&&i.push(`Critical issues (${r.length}): ${r.map(a=>a.pattern).join(", ")}`),o.length&&i.push(`Advisory issues (${o.length}): ${o.map(a=>a.pattern).join(", ")}`),i.push("</issues_found>"),i.push("")}return i.push("<draft>"),i.push(e),i.push("</draft>"),i.push(""),i.push("<instruction>"),i.push("Rewrite this draft to match the voice profile. Rules:"),i.push("1. Preserve the original meaning and all factual claims"),i.push("2. Match the profile's rhythm, tone, vocabulary, and sentence patterns"),i.push("3. Fix every critical issue listed above"),i.push("4. Remove AI-slop patterns (delve, leverage, tapestry, etc.)"),i.push("5. Ground your style in the anchor passages from the profile"),i.push("6. Never use words from the never-list"),i.push("7. Keep the same format (markdown headings, lists, links)"),i.push("8. Return ONLY the rewritten text, no commentary"),i.push("</instruction>"),i.join(`
113
+ `)}async function wr(n,t,e){let i=pe().profile,r;n&&t?(i=n,r=t):n&&(n.endsWith(".md")||yt.existsSync(n)?r=n:i=n),i||(console.log(`
114
+ ${m.red("\u2717")} no profile specified`),console.log(` ${m.dim("usage:")} hyv rewrite <profile> <file>`),console.log(` ${m.dim(" ")} hyv rewrite <profile> --text "your text here"`),console.log(` ${m.dim(" ")} echo "text" | hyv rewrite <profile>`),console.log(` ${m.dim("or set a default:")} hyv init --profile <name>`),process.exit(1));let o;e.text?o=e.text:r?(yt.existsSync(r)||(console.log(`
115
+ ${m.red("\u2717")} file not found: ${r}`),process.exit(1)),o=yt.readFileSync(r,"utf-8")):(process.stdin.isTTY&&(console.log(`
116
+ ${m.red("\u2717")} no text provided`),console.log(` ${m.dim("usage:")} hyv rewrite <profile> --text "your text here"`),console.log(` ${m.dim(" ")} echo "text" | hyv rewrite <profile>`),process.exit(1)),o=yt.readFileSync(0,"utf-8")),o.trim()||(console.log(`
47
117
  ${m.red("\u2717")} empty draft`),process.exit(1)),console.log(`
48
- ${W()} ${m.dim("rewrite")}
49
- `);let a,l;try{console.log(` ${m.dim("fetching profile:")} ${m.bold(i)}`);let f=await tt(`/cli/profiles/${encodeURIComponent(i)}`);a=f.profile,l=f.body||"",ms(a.slug||i,l)}catch{let f=ps(i);f||(console.log(` ${m.red("\u2717")} profile not found: ${i}`),console.log(` ${m.dim("run:")} hyv profiles ${m.dim("to see available profiles")}`),process.exit(1)),a={id:"",slug:i,name:i},l=f,console.log(` ${m.dim("using cached profile")}`)}console.log(` ${m.dim("scanning draft...")}`);let{results:h}=await He([r||"draft.md"],[]),u=h[0]?.findings||[];u.length>0?console.log(` ${m.yellow(String(u.length))} issues found`):console.log(` ${m.green("\u2713")} no issues found`);let c=dr(a,l,o,u);e.output?(mt.writeFileSync(e.output,c),console.log(`
118
+ ${H()} ${m.dim("rewrite")}
119
+ `);let a,l;try{console.log(` ${m.dim("fetching profile:")} ${m.bold(i)}`);let f=await st(`/cli/profiles/${encodeURIComponent(i)}`);a=f.profile,l=f.body||"",ki(a.slug||i,l)}catch{let f=Ai(i);f||(console.log(` ${m.red("\u2717")} profile not found: ${i}`),console.log(` ${m.dim("run:")} hyv profiles ${m.dim("to see available profiles")}`),process.exit(1)),a={id:"",slug:i,name:i},l=f,console.log(` ${m.dim("using cached profile")}`)}console.log(` ${m.dim("scanning draft...")}`);let{results:h}=await He([r||"draft.md"],[]),c=h[0]?.findings||[];c.length>0?console.log(` ${m.yellow(String(c.length))} issues found`):console.log(` ${m.green("\u2713")} no issues found`);let u=yr(a,l,o,c);e.output?(yt.writeFileSync(e.output,u),console.log(`
50
120
  ${m.green("\u2713")} prompt written to ${m.bold(e.output)}`)):(console.log(`
51
- ${"\u2500".repeat(60)}`),console.log(c),console.log(`${"\u2500".repeat(60)}
52
- `))}async function mr(n){let e=(await tt("/cli/profiles")).profiles||[];if(n.json){console.log(JSON.stringify(e,null,2));return}if(console.log(`
53
- ${W()} ${m.dim("profiles")}
54
- `),e.length===0){console.log(` ${m.dim("no voice profiles yet")}`),console.log(` ${m.dim("create one at:")} ${m.cyan("https://holdyourvoice.com/dashboard")}`);return}for(let s of e){let i=m.bold(s.name||s.slug),r=s.brand?m.dim(` (${s.brand})`):"",o=s.keywords?.length?m.dim(` \u2014 ${s.keywords.slice(0,3).join(", ")}`):"";console.log(` \u25CF ${i}${r}${o}`)}console.log("")}bt();async function gr(){console.log(`
55
- ${W()} ${m.dim("status")}
56
- `);let n=wt();if(!n){console.log(` ${m.red("\u2717")} not authenticated. run ${m.bold("hyv init")}`);return}try{let t=await tt("/cli/heartbeat");console.log(` ${m.bold("account")}`),console.log(` email: ${t.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"} (${t.status||"\u2014"})`),t.plan==="none"&&console.log(` ${m.dim("subscribe at:")} ${m.cyan("https://holdyourvoice.com/dashboard")}`),console.log(""),console.log(` ${m.bold("cli")}`),console.log(` server: ${m.dim(n.base_url)}`),console.log(` key: ${m.dim(n.api_key.slice(0,12)+"...")}`),console.log("")}catch(t){console.log(` ${m.red("\u2717")} connection failed: ${t.message}`)}}var gt=I(require("fs"));async function yr(n,t){gt.existsSync(n)||(console.log(`
57
- ${m.red("\u2717")} file not found: ${n}`),process.exit(1)),gt.existsSync(t)||(console.log(`
58
- ${m.red("\u2717")} file not found: ${t}`),process.exit(1));let e=gt.readFileSync(n,"utf-8"),s=gt.readFileSync(t,"utf-8");console.log(`
59
- ${W()} ${m.dim("reinforce")}
60
- `);try{await gs("/cli/learning/reinforce",{original:e,edited:s}),console.log(` ${m.green("\u2713")} learning signal sent`)}catch(i){console.log(` ${m.red("\u2717")} failed: ${i.message}`),process.exit(1)}}async function wr(n,t){gt.existsSync(n)||(console.log(`
61
- ${m.red("\u2717")} file not found: ${n}`),process.exit(1));let e=gt.readFileSync(n,"utf-8");console.log(`
62
- ${W()} ${m.dim("add sample")}
63
- `);try{await gs("/cli/learning/add",{text:e,profile:t.profile}),console.log(` ${m.green("\u2713")} sample added${t.profile?` to ${m.bold(t.profile)}`:""}`)}catch(s){console.log(` ${m.red("\u2717")} failed: ${s.message}`),process.exit(1)}}var lt=new ai;lt.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version("0.1.0");lt.command("init").description("authenticate and set up your project").option("-p, --profile <name>","set default voice profile").option("-k, --key <key>","use a license key directly").action(n=>cn(n.profile,{key:n.key}));lt.command("scan").description("scan local .md files for ai patterns and voice drift").argument("[paths...]","files or directories to scan").option("--json","output as json").option("--fail-on-hit","exit with code 1 if issues found").action((n,t)=>fr(n,t));lt.command("rewrite").description("generate a rewrite prompt for your ai agent").argument("[profile-or-file]","voice profile name or .md file").argument("[file]",".md file to rewrite").option("-o, --output <file>","write prompt to file instead of stdout").action((n,t,e)=>pr(n,t,e));lt.command("profiles").description("list your voice profiles").option("--json","output as json").action(n=>mr(n));lt.command("status").description("show account and cli status").action(()=>gr());lt.command("reinforce").description("send learning signals from an edited draft").argument("<original>","original .md file").argument("<edited>","edited .md file").action((n,t)=>yr(n,t));lt.command("add").description("add a writing sample to your voice profile").argument("<file>",".md file to add as sample").option("-p, --profile <name>","target profile").action((n,t)=>wr(n,t));lt.parse();
121
+ ${"\u2500".repeat(60)}`),console.log(u),console.log(`${"\u2500".repeat(60)}
122
+ `))}async function br(n){let e=(await st("/cli/profiles")).profiles||[];if(n.json){console.log(JSON.stringify(e,null,2));return}if(console.log(`
123
+ ${H()} ${m.dim("profiles")}
124
+ `),e.length===0){console.log(` ${m.dim("no voice profiles yet")}`),console.log(` ${m.dim("create one at:")} ${m.cyan("https://holdyourvoice.com/dashboard")}`);return}for(let s of e){let i=m.bold(s.name||s.slug),r=s.brand?m.dim(` (${s.brand})`):"",o=s.keywords?.length?m.dim(` \u2014 ${s.keywords.slice(0,3).join(", ")}`):"";console.log(` \u25CF ${i}${r}${o}`)}console.log("")}async function vr(){console.log(`
125
+ ${H()} ${m.dim("status")}
126
+ `);let n=Ct();if(!n){console.log(` ${m.red("\u2717")} not authenticated. run ${m.bold("hyv init")}`);return}try{let t=await st("/cli/heartbeat");console.log(` ${m.bold("account")}`),console.log(` email: ${t.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"} (${t.status||"\u2014"})`),t.plan==="none"&&console.log(` ${m.dim("subscribe at:")} ${m.cyan("https://holdyourvoice.com/dashboard")}`),console.log(""),console.log(` ${m.bold("cli")}`),console.log(` server: ${m.dim(n.base_url)}`),console.log(` key: ${m.dim(n.api_key.slice(0,12)+"...")}`),console.log("")}catch(t){console.log(` ${m.red("\u2717")} connection failed: ${t.message}`)}}var wt=P(require("fs"));async function xr(n,t){wt.existsSync(n)||(console.log(`
127
+ ${m.red("\u2717")} file not found: ${n}`),process.exit(1)),wt.existsSync(t)||(console.log(`
128
+ ${m.red("\u2717")} file not found: ${t}`),process.exit(1));let e=wt.readFileSync(n,"utf-8"),s=wt.readFileSync(t,"utf-8");console.log(`
129
+ ${H()} ${m.dim("reinforce")}
130
+ `);try{await ps("/cli/learning/reinforce",{original:e,edited:s}),console.log(` ${m.green("\u2713")} learning signal sent`)}catch(i){console.log(` ${m.red("\u2717")} failed: ${i.message}`),process.exit(1)}}async function Sr(n,t){wt.existsSync(n)||(console.log(`
131
+ ${m.red("\u2717")} file not found: ${n}`),process.exit(1));let e=wt.readFileSync(n,"utf-8");console.log(`
132
+ ${H()} ${m.dim("add sample")}
133
+ `);try{await ps("/cli/learning/add",{text:e,profile:t.profile}),console.log(` ${m.green("\u2713")} sample added${t.profile?` to ${m.bold(t.profile)}`:""}`)}catch(s){console.log(` ${m.red("\u2717")} failed: ${s.message}`),process.exit(1)}}var ct=new hi;ct.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version("0.2.0");ct.command("init").description("authenticate and set up your project").option("-p, --profile <name>","set default voice profile").option("-k, --key <key>","use a license key directly").action(n=>pn(n.profile,{key:n.key}));ct.command("scan").description("scan local .md files for ai patterns and voice drift").argument("[paths...]","files or directories to scan").option("--json","output as json").option("--fail-on-hit","exit with code 1 if issues found").action((n,t)=>gr(n,t));ct.command("rewrite").description("generate a rewrite prompt for your ai agent").argument("[profile-or-file]","voice profile name or .md file").argument("[file]",".md file to rewrite").option("-o, --output <file>","write prompt to file instead of stdout").option("-t, --text <text>","inline text to rewrite (instead of file/stdin)").action((n,t,e)=>wr(n,t,e));ct.command("profiles").description("list your voice profiles").option("--json","output as json").action(n=>br(n));ct.command("status").description("show account and cli status").action(()=>vr());ct.command("reinforce").description("send learning signals from an edited draft").argument("<original>","original .md file").argument("<edited>","edited .md file").action((n,t)=>xr(n,t));ct.command("add").description("add a writing sample to your voice profile").argument("<file>",".md file to add as sample").option("-p, --profile <name>","target profile").action((n,t)=>Sr(n,t));ct.parse();