@holdyourvoice/hyv 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +130 -124
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,34 +1,34 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var ea=Object.create;var Cs=Object.defineProperty;var ta=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var ia=Object.getPrototypeOf,na=Object.prototype.hasOwnProperty;var Wi=(n,e)=>()=>(n&&(e=n(n=0)),e);var O=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),ra=(n,e)=>{for(var t in e)Cs(n,t,{get:e[t],enumerable:!0})},oa=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sa(e))!na.call(n,i)&&i!==t&&Cs(n,i,{get:()=>e[i],enumerable:!(s=ta(e,i))||s.enumerable});return n};var S=(n,e,t)=>(t=n!=null?ea(ia(n)):{},oa(e||!n||!n.__esModule?Cs(t,"default",{value:n,enumerable:!0}):t,n));var ft=O(Os=>{var Nt=class extends Error{constructor(e,t,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Es=class extends Nt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Os.CommanderError=Nt;Os.InvalidArgumentError=Es});var Lt=O(As=>{var{InvalidArgumentError:aa}=ft(),ks=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new aa(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function la(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}As.Argument=ks;As.humanReadableArgName=la});var js=O(Vi=>{var{humanReadableArgName:ca}=Lt(),Fs=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),s=e._getHelpCommand();return s&&!s._hidden&&t.push(s),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let s=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return s(e).localeCompare(s(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),s=e._getHelpOption();if(s&&!s.hidden){let i=s.short&&e._findOption(s.short),r=s.long&&e._findOption(s.long);!i&&!r?t.push(s):s.long&&!r?t.push(e.createOption(s.long,s.description)):s.short&&!i&&t.push(e.createOption(s.short,s.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let s=e.parent;s;s=s.parent){let i=s.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(s=>ca(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((s,i)=>Math.max(s,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((s,i)=>Math.max(s,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let s="";for(let i=e.parent;i;i=i.parent)s=i.name()+" "+s;return s+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let s=`(${t.join(", ")})`;return e.description?`${e.description} ${s}`:s}return e.description}formatHelp(e,t){let s=t.padWidth(e,t),i=t.helpWidth||80,r=2,o=2;function a(m,g){if(g){let y=`${m.padEnd(s+o)}${g}`;return t.wrap(y,i-r,s+o)}return m}function l(m){return m.join(`
2
+ "use strict";var ta=Object.create;var Es=Object.defineProperty;var sa=Object.getOwnPropertyDescriptor;var ia=Object.getOwnPropertyNames;var na=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var Vi=(n,e)=>()=>(n&&(e=n(n=0)),e);var k=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),oa=(n,e)=>{for(var t in e)Es(n,t,{get:e[t],enumerable:!0})},aa=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ia(e))!ra.call(n,i)&&i!==t&&Es(n,i,{get:()=>e[i],enumerable:!(s=sa(e,i))||s.enumerable});return n};var S=(n,e,t)=>(t=n!=null?ta(na(n)):{},aa(e||!n||!n.__esModule?Es(t,"default",{value:n,enumerable:!0}):t,n));var dt=k(ks=>{var Lt=class extends Error{constructor(e,t,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Os=class extends Lt{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ks.CommanderError=Lt;ks.InvalidArgumentError=Os});var Dt=k(Fs=>{var{InvalidArgumentError:la}=dt(),As=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new la(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ca(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}Fs.Argument=As;Fs.humanReadableArgName=ca});var Rs=k(Hi=>{var{humanReadableArgName:ha}=Dt(),js=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),s=e._getHelpCommand();return s&&!s._hidden&&t.push(s),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let s=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return s(e).localeCompare(s(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),s=e._getHelpOption();if(s&&!s.hidden){let i=s.short&&e._findOption(s.short),r=s.long&&e._findOption(s.long);!i&&!r?t.push(s):s.long&&!r?t.push(e.createOption(s.long,s.description)):s.short&&!i&&t.push(e.createOption(s.short,s.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let s=e.parent;s;s=s.parent){let i=s.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(s=>ha(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((s,i)=>Math.max(s,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((s,i)=>Math.max(s,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((s,i)=>Math.max(s,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let s="";for(let i=e.parent;i;i=i.parent)s=i.name()+" "+s;return s+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let s=`(${t.join(", ")})`;return e.description?`${e.description} ${s}`:s}return e.description}formatHelp(e,t){let s=t.padWidth(e,t),i=t.helpWidth||80,r=2,o=2;function a(m,g){if(g){let y=`${m.padEnd(s+o)}${g}`;return t.wrap(y,i-r,s+o)}return m}function l(m){return m.join(`
3
3
  `).replace(/^/gm," ".repeat(r))}let h=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(h=h.concat([t.wrap(u,i,0),""]));let f=t.visibleArguments(e).map(m=>a(t.argumentTerm(m),t.argumentDescription(m)));f.length>0&&(h=h.concat(["Arguments:",l(f),""]));let p=t.visibleOptions(e).map(m=>a(t.optionTerm(m),t.optionDescription(m)));if(p.length>0&&(h=h.concat(["Options:",l(p),""])),this.showGlobalOptions){let m=t.visibleGlobalOptions(e).map(g=>a(t.optionTerm(g),t.optionDescription(g)));m.length>0&&(h=h.concat(["Global Options:",l(m),""]))}let d=t.visibleCommands(e).map(m=>a(t.subcommandTerm(m),t.subcommandDescription(m)));return d.length>0&&(h=h.concat(["Commands:",l(d),""])),h.join(`
4
4
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,s,i=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",o=new RegExp(`[\\n][${r}]+`);if(e.match(o))return e;let a=t-s;if(a<i)return e;let l=e.slice(0,s),h=e.slice(s).replace(`\r
5
5
  `,`
6
6
  `),u=" ".repeat(s),p="\\s\u200B",d=new RegExp(`
7
7
  |.{1,${a-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g"),m=h.match(d)||[];return l+m.map((g,y)=>g===`
8
8
  `?"":(y>0?u:"")+g.trimEnd()).join(`
9
- `)}};Vi.Help=Fs});var Ms=O(Ps=>{var{InvalidArgumentError:ha}=ft(),Rs=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=fa(e);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(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new ha(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ua(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ts=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let i=this.negativeOptions.get(s).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function ua(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function fa(n){let e,t,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Ps.Option=Rs;Ps.DualOptions=Ts});var Bi=O(Hi=>{function da(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let s=0;s<=n.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=n.length;i++){let r=1;n[i-1]===e[s-1]?r=0:r=1,t[i][s]=Math.min(t[i-1][s]+1,t[i][s-1]+1,t[i-1][s-1]+r),i>1&&s>1&&n[i-1]===e[s-2]&&n[i-2]===e[s-1]&&(t[i][s]=Math.min(t[i][s],t[i-2][s-2]+1))}return t[n.length][e.length]}function pa(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(o=>o.slice(2)));let s=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=da(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)),t&&(s=s.map(o=>`--${o}`)),s.length>1?`
9
+ `)}};Hi.Help=js});var Is=k(Ms=>{var{InvalidArgumentError:ua}=dt(),Ts=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=da(e);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(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new ua(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return fa(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ps=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let i=this.negativeOptions.get(s).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function fa(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function da(n){let e,t,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Ms.Option=Ts;Ms.DualOptions=Ps});var Bi=k(qi=>{function pa(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let s=0;s<=n.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let i=1;i<=n.length;i++){let r=1;n[i-1]===e[s-1]?r=0:r=1,t[i][s]=Math.min(t[i-1][s]+1,t[i][s-1]+1,t[i-1][s-1]+r),i>1&&s>1&&n[i-1]===e[s-2]&&n[i-2]===e[s-1]&&(t[i][s]=Math.min(t[i][s],t[i-2][s-2]+1))}return t[n.length][e.length]}function ga(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(o=>o.slice(2)));let s=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let a=pa(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)),t&&(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]}?)`:""}Hi.suggestSimilar=pa});var Ji=O(Gi=>{var ga=require("node:events").EventEmitter,Is=require("node:child_process"),de=require("node:path"),Ns=require("node:fs"),A=require("node:process"),{Argument:ma,humanReadableArgName:ya}=Lt(),{CommanderError:Ls}=ft(),{Help:ba}=js(),{Option:qi,DualOptions:wa}=Ms(),{suggestSimilar:Ui}=Bi(),Ds=class n extends ga{constructor(e){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=e||"",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:t=>A.stdout.write(t),writeErr:t=>A.stderr.write(t),getOutHelpWidth:()=>A.stdout.isTTY?A.stdout.columns:void 0,getErrHelpWidth:()=>A.stderr.isTTY?A.stderr.columns:void 0,outputError:(t,s)=>s(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,s){let i=t,r=s;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=e.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(e){return new n(e)}createHelp(){return Object.assign(new ba,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ma(e,t)}argument(e,t,s,i){let r=this.createArgument(e,t);return typeof s=="function"?r.default(i).argParser(s):r.default(s),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,s,i]=e.match(/([^ ]+) *(.*)/),r=t??"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(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,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(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
- Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new Ls(e,t,s)),A.exit(e)}action(e){let t=s=>{let i=this.registeredArguments.length,r=s.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new qi(e,t)}_callParseArg(e,t,s,i){try{return e.parseArg(t,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(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let s=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
14
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),s=t(e).find(i=>this._findCommand(i));if(s){let i=t(this._findCommand(s)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let i=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(s);r!==null&&e.parseArg?r=this._callParseArg(e,r,l,o):r!==null&&e.variadic&&(r=e._concatValue(r,l)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(s,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,s,i,r){if(typeof t=="object"&&t instanceof qi)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.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(e,t,s,i){return this._optionEx({},e,t,s,i)}requiredOption(e,t,s,i){return this._optionEx({mandatory:!0},e,t,s,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,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(e=!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=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){A.versions?.electron&&(t.from="electron");let i=A.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=A.argv),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":A.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;case"eval":s=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,f){let p=de.resolve(u,f);if(Ns.existsSync(p))return p;if(i.includes(de.extname(f)))return;let d=i.find(m=>Ns.existsSync(`${p}${m}`));if(d)return`${p}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ns.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=de.resolve(de.dirname(u),a)}if(a){let u=r(a,o);if(!u&&!e._executableFile&&this._scriptPath){let f=de.basename(this._scriptPath,de.extname(this._scriptPath));f!==this._name&&(u=r(a,`${f}-${e._name}`))}o=u||o}s=i.includes(de.extname(o));let l;A.platform!=="win32"?s?(t.unshift(o),t=zi(A.execArgv).concat(t),l=Is.spawn(A.argv[0],t,{stdio:"inherit"})):l=Is.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=zi(A.execArgv).concat(t),l=Is.spawn(A.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{A.on(f,()=>{l.killed===!1&&l.exitCode===null&&l.kill(f)})});let h=this._exitCallback;l.on("close",u=>{u=u??1,h?h(new Ls(u,"commander.executeSubCommandAsync","(close)")):A.exit(u)}),l.on("error",u=>{if(u.code==="ENOENT"){let f=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",p=`'${o}' does not exist
11
+ (Did you mean ${s[0]}?)`:""}qi.suggestSimilar=ga});var Yi=k(Ji=>{var ma=require("node:events").EventEmitter,Ns=require("node:child_process"),de=require("node:path"),Ls=require("node:fs"),A=require("node:process"),{Argument:ya,humanReadableArgName:ba}=Dt(),{CommanderError:Ds}=dt(),{Help:wa}=Rs(),{Option:Ui,DualOptions:va}=Is(),{suggestSimilar:zi}=Bi(),Ws=class n extends ma{constructor(e){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=e||"",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:t=>A.stdout.write(t),writeErr:t=>A.stderr.write(t),getOutHelpWidth:()=>A.stdout.isTTY?A.stdout.columns:void 0,getErrHelpWidth:()=>A.stderr.isTTY?A.stderr.columns:void 0,outputError:(t,s)=>s(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,s){let i=t,r=s;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,a]=e.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(e){return new n(e)}createHelp(){return Object.assign(new wa,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ya(e,t)}argument(e,t,s,i){let r=this.createArgument(e,t);return typeof s=="function"?r.default(i).argParser(s):r.default(s),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,s,i]=e.match(/([^ ]+) *(.*)/),r=t??"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(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,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(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
+ Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new Ds(e,t,s)),A.exit(e)}action(e){let t=s=>{let i=this.registeredArguments.length,r=s.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new Ui(e,t)}_callParseArg(e,t,s,i){try{return e.parseArg(t,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(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let s=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),s=t(e).find(i=>this._findCommand(i));if(s){let i=t(this._findCommand(s)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let i=(r,o,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(s);r!==null&&e.parseArg?r=this._callParseArg(e,r,l,o):r!==null&&e.variadic&&(r=e._concatValue(r,l)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(s,r,a)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,s,i,r){if(typeof t=="object"&&t instanceof Ui)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.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(e,t,s,i){return this._optionEx({},e,t,s,i)}requiredOption(e,t,s,i){return this._optionEx({mandatory:!0},e,t,s,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,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(e=!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=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){A.versions?.electron&&(t.from="electron");let i=A.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=A.argv),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":A.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;case"eval":s=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,f){let p=de.resolve(u,f);if(Ls.existsSync(p))return p;if(i.includes(de.extname(f)))return;let d=i.find(m=>Ls.existsSync(`${p}${m}`));if(d)return`${p}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Ls.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=de.resolve(de.dirname(u),a)}if(a){let u=r(a,o);if(!u&&!e._executableFile&&this._scriptPath){let f=de.basename(this._scriptPath,de.extname(this._scriptPath));f!==this._name&&(u=r(a,`${f}-${e._name}`))}o=u||o}s=i.includes(de.extname(o));let l;A.platform!=="win32"?s?(t.unshift(o),t=Gi(A.execArgv).concat(t),l=Ns.spawn(A.argv[0],t,{stdio:"inherit"})):l=Ns.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=Gi(A.execArgv).concat(t),l=Ns.spawn(A.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{A.on(f,()=>{l.killed===!1&&l.exitCode===null&&l.kill(f)})});let h=this._exitCallback;l.on("close",u=>{u=u??1,h?h(new Ds(u,"commander.executeSubCommandAsync","(close)")):A.exit(u)}),l.on("error",u=>{if(u.code==="ENOENT"){let f=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",p=`'${o}' does not exist
15
15
  - if '${e._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
- - ${f}`;throw new Error(p)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!h)A.exit(1);else{let f=new Ls(1,"commander.executeSubCommandAsync","(error)");f.nestedError=u,h(f)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(s));else return i._parseCommand(t,s)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(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 t=[];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)=>e(s,a,o),s.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],s.parseArg&&(r=e(s,r,s.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{s=this._chainOrCall(s,()=>r.callback(r.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let i=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);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,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let i=s.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let i=e.find(r=>s.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(s,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],s=[],i=t,r=e.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)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),r.length>0&&s.push(...r);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),r.length>0&&t.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:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let i=this.options[s].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
17
+ - ${f}`;throw new Error(p)}else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!h)A.exit(1);else{let f=new Ds(1,"commander.executeSubCommandAsync","(error)");f.nestedError=u,h(f)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(s));else return i._parseCommand(t,s)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(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 t=[];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)=>e(s,a,o),s.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],s.parseArg&&(r=e(s,r,s.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{s=this._chainOrCall(s,()=>r.callback(r.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let i=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);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,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let i=s.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let i=e.find(r=>s.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(s,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],s=[],i=t,r=e.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)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),r.length>0&&s.push(...r);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),r.length>0&&t.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:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let i=this.options[s].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
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=t||{},i=s.exitCode||1,r=s.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in A.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,A.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new wa(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,s.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),h=this.options.find(f=>f.negate&&a===f.attributeName()),u=this.options.find(f=>!f.negate&&a===f.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(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.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);t=Ui(e,i)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,s=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=Ui(e,i)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let i=this.createOption(t,s);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
- `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let i=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>ya(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=de.basename(e,de.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=i=>this._outputConfiguration.writeErr(i):s=i=>this._outputConfiguration.writeOut(i),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let i=this.helpInformation(s);if(t&&(i=t(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(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=A.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
20
+ `),this.outputHelp({error:!0}));let s=t||{},i=s.exitCode||1,r=s.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in A.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,A.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new va(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,s.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),h=this.options.find(f=>f.negate&&a===f.attributeName()),u=this.options.find(f=>!f.negate&&a===f.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(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.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);t=zi(e,i)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,s=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=zi(e,i)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let i=this.createOption(t,s);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
+ `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let i=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>ba(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=de.basename(e,de.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=i=>this._outputConfiguration.writeErr(i):s=i=>this._outputConfiguration.writeOut(i),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let i=this.helpInformation(s);if(t&&(i=t(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(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=A.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
22
  Expecting one of '${s.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let o;typeof t=="function"?o=t({error:r.error,command:r.command}):o=t,o&&r.write(`${o}
23
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function zi(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:s=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],s=r[3],i=r[4]),t&&i!=="0"?`${t}=${s}:${parseInt(i)+1}`:e})}Gi.Command=Ds});var Zi=O(X=>{var{Argument:Yi}=Lt(),{Command:Ws}=Ji(),{CommanderError:va,InvalidArgumentError:Ki}=ft(),{Help:xa}=js(),{Option:Xi}=Ms();X.program=new Ws;X.createCommand=n=>new Ws(n);X.createOption=(n,e)=>new Xi(n,e);X.createArgument=(n,e)=>new Yi(n,e);X.Command=Ws;X.Option=Xi;X.Argument=Yi;X.Help=xa;X.CommanderError=va;X.InvalidArgumentError=Ki;X.InvalidOptionArgumentError=Ki});var Hs=O((ou,sn)=>{"use strict";var tn=require("fs"),Vs;function Sa(){try{return tn.statSync("/.dockerenv"),!0}catch{return!1}}function $a(){try{return tn.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}sn.exports=()=>(Vs===void 0&&(Vs=Sa()||$a()),Vs)});var on=O((au,Bs)=>{"use strict";var _a=require("os"),Ca=require("fs"),nn=Hs(),rn=()=>{if(process.platform!=="linux")return!1;if(_a.release().toLowerCase().includes("microsoft"))return!nn();try{return Ca.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!nn():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Bs.exports=rn:Bs.exports=rn()});var ln=O((lu,an)=>{"use strict";an.exports=(n,e,t)=>{let s=i=>Object.defineProperty(n,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get(){let i=t();return s(i),i},set(i){s(i)}}),n}});var Ve=O((cu,pn)=>{var Ea=require("path"),Oa=require("child_process"),{promises:Wt,constants:dn}=require("fs"),Dt=on(),ka=Hs(),Us=ln(),cn=Ea.join(__dirname,"xdg-open"),{platform:We,arch:hn}=process,Aa=()=>{try{return Wt.statSync("/run/.containerenv"),!0}catch{return!1}},qs;function Fa(){return qs===void 0&&(qs=Aa()||ka()),qs}var ja=(()=>{let n="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",s=!1;try{await Wt.access(t,dn.F_OK),s=!0}catch{}if(!s)return n;let i=await Wt.readFile(t,{encoding:"utf8"}),r=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return r?(e=r.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):n}})(),un=async(n,e)=>{let t;for(let s of n)try{return await e(s)}catch(i){t=i}throw t},Vt=async n=>{if(n={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...n},Array.isArray(n.app))return un(n.app,a=>Vt({...n,app:a}));let{name:e,arguments:t=[]}=n.app||{};if(t=[...t],Array.isArray(e))return un(e,a=>Vt({...n,app:{name:a,arguments:t}}));let s,i=[],r={};if(We==="darwin")s="open",n.wait&&i.push("--wait-apps"),n.background&&i.push("--background"),n.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(We==="win32"||Dt&&!Fa()&&!e){let a=await ja();s=Dt?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Dt||(r.windowsVerbatimArguments=!0);let l=["Start"];n.wait&&l.push("-Wait"),e?(l.push(`"\`"${e}\`""`,"-ArgumentList"),n.target&&t.unshift(n.target)):n.target&&l.push(`"${n.target}"`),t.length>0&&(t=t.map(h=>`"\`"${h}\`""`),l.push(t.join(","))),n.target=Buffer.from(l.join(" "),"utf16le").toString("base64")}else{if(e)s=e;else{let a=!__dirname||__dirname==="/",l=!1;try{await Wt.access(cn,dn.X_OK),l=!0}catch{}s=process.versions.electron||We==="android"||a||!l?"xdg-open":cn}t.length>0&&i.push(...t),n.wait||(r.stdio="ignore",r.detached=!0)}n.target&&i.push(n.target),We==="darwin"&&t.length>0&&i.push("--args",...t);let o=Oa.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)},zs=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `target`");return Vt({...e,target:n})},Ra=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `name`");let{arguments:t=[]}=e||{};if(t!=null&&!Array.isArray(t))throw new TypeError("Expected `appArguments` as Array type");return Vt({...e,app:{name:n,arguments:t}})};function fn(n){if(typeof n=="string"||Array.isArray(n))return n;let{[hn]:e}=n;if(!e)throw new Error(`${hn} is not supported`);return e}function Gs({[We]:n},{wsl:e}){if(e&&Dt)return fn(e);if(!n)throw new Error(`${We} is not supported`);return fn(n)}var Ht={};Us(Ht,"chrome",()=>Gs({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"]}}));Us(Ht,"firefox",()=>Gs({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Us(Ht,"edge",()=>Gs({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));zs.apps=Ht;zs.openApp=Ra;pn.exports=zs});function Pa(n){J.existsSync(n)||J.mkdirSync(n,{recursive:!0})}function xe(){let n=process.env.HYV_API_KEY;if(n)return{api_key:n,base_url:process.env.HYV_BASE_URL||"https://holdyourvoice.com"};try{let e=J.readFileSync(mn,"utf-8"),t=JSON.parse(e);return t.api_key?t:null}catch{return null}}function Bt(n){Pa(Js),J.writeFileSync(mn,JSON.stringify(n,null,2))}function qt(){let n=je.join(process.cwd(),".hyv.yml");if(!J.existsSync(n))return{};try{let e=J.readFileSync(n,"utf-8"),t={};for(let s of e.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"?t.profile=a:o==="scan_paths"?t.scan_paths=a.split(",").map(l=>l.trim()):o==="ignore"&&(t.ignore=a.split(",").map(l=>l.trim()))}return t}catch{return{}}}function Ys(n){let e=je.join(process.cwd(),".hyv.yml"),t=["# hold your voice \u2014 project config"];n.profile&&t.push(`profile: ${n.profile}`),n.scan_paths?.length&&t.push(`scan_paths: ${n.scan_paths.join(", ")}`),J.writeFileSync(e,t.join(`
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Gi(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:s=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],s=r[3],i=r[4]),t&&i!=="0"?`${t}=${s}:${parseInt(i)+1}`:e})}Ji.Command=Ws});var Qi=k(X=>{var{Argument:Ki}=Dt(),{Command:Vs}=Yi(),{CommanderError:xa,InvalidArgumentError:Xi}=dt(),{Help:Sa}=Rs(),{Option:Zi}=Is();X.program=new Vs;X.createCommand=n=>new Vs(n);X.createOption=(n,e)=>new Zi(n,e);X.createArgument=(n,e)=>new Ki(n,e);X.Command=Vs;X.Option=Zi;X.Argument=Ki;X.Help=Sa;X.CommanderError=xa;X.InvalidArgumentError=Xi;X.InvalidOptionArgumentError=Xi});var qs=k((au,nn)=>{"use strict";var sn=require("fs"),Hs;function $a(){try{return sn.statSync("/.dockerenv"),!0}catch{return!1}}function _a(){try{return sn.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}nn.exports=()=>(Hs===void 0&&(Hs=$a()||_a()),Hs)});var an=k((lu,Bs)=>{"use strict";var Ca=require("os"),Ea=require("fs"),rn=qs(),on=()=>{if(process.platform!=="linux")return!1;if(Ca.release().toLowerCase().includes("microsoft"))return!rn();try{return Ea.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!rn():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Bs.exports=on:Bs.exports=on()});var cn=k((cu,ln)=>{"use strict";ln.exports=(n,e,t)=>{let s=i=>Object.defineProperty(n,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get(){let i=t();return s(i),i},set(i){s(i)}}),n}});var He=k((hu,gn)=>{var Oa=require("path"),ka=require("child_process"),{promises:Vt,constants:pn}=require("fs"),Wt=an(),Aa=qs(),zs=cn(),hn=Oa.join(__dirname,"xdg-open"),{platform:Ve,arch:un}=process,Fa=()=>{try{return Vt.statSync("/run/.containerenv"),!0}catch{return!1}},Us;function ja(){return Us===void 0&&(Us=Fa()||Aa()),Us}var Ra=(()=>{let n="/mnt/",e;return async function(){if(e)return e;let t="/etc/wsl.conf",s=!1;try{await Vt.access(t,pn.F_OK),s=!0}catch{}if(!s)return n;let i=await Vt.readFile(t,{encoding:"utf8"}),r=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return r?(e=r.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):n}})(),fn=async(n,e)=>{let t;for(let s of n)try{return await e(s)}catch(i){t=i}throw t},Ht=async n=>{if(n={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...n},Array.isArray(n.app))return fn(n.app,a=>Ht({...n,app:a}));let{name:e,arguments:t=[]}=n.app||{};if(t=[...t],Array.isArray(e))return fn(e,a=>Ht({...n,app:{name:a,arguments:t}}));let s,i=[],r={};if(Ve==="darwin")s="open",n.wait&&i.push("--wait-apps"),n.background&&i.push("--background"),n.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(Ve==="win32"||Wt&&!ja()&&!e){let a=await Ra();s=Wt?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Wt||(r.windowsVerbatimArguments=!0);let l=["Start"];n.wait&&l.push("-Wait"),e?(l.push(`"\`"${e}\`""`,"-ArgumentList"),n.target&&t.unshift(n.target)):n.target&&l.push(`"${n.target}"`),t.length>0&&(t=t.map(h=>`"\`"${h}\`""`),l.push(t.join(","))),n.target=Buffer.from(l.join(" "),"utf16le").toString("base64")}else{if(e)s=e;else{let a=!__dirname||__dirname==="/",l=!1;try{await Vt.access(hn,pn.X_OK),l=!0}catch{}s=process.versions.electron||Ve==="android"||a||!l?"xdg-open":hn}t.length>0&&i.push(...t),n.wait||(r.stdio="ignore",r.detached=!0)}n.target&&i.push(n.target),Ve==="darwin"&&t.length>0&&i.push("--args",...t);let o=ka.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)},Gs=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `target`");return Ht({...e,target:n})},Ta=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a `name`");let{arguments:t=[]}=e||{};if(t!=null&&!Array.isArray(t))throw new TypeError("Expected `appArguments` as Array type");return Ht({...e,app:{name:n,arguments:t}})};function dn(n){if(typeof n=="string"||Array.isArray(n))return n;let{[un]:e}=n;if(!e)throw new Error(`${un} is not supported`);return e}function Js({[Ve]:n},{wsl:e}){if(e&&Wt)return dn(e);if(!n)throw new Error(`${Ve} is not supported`);return dn(n)}var qt={};zs(qt,"chrome",()=>Js({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"]}}));zs(qt,"firefox",()=>Js({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));zs(qt,"edge",()=>Js({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Gs.apps=qt;Gs.openApp=Ta;gn.exports=Gs});function Ma(n){J.existsSync(n)||J.mkdirSync(n,{recursive:!0})}function xe(){let n=process.env.HYV_API_KEY;if(n)return{api_key:n,base_url:process.env.HYV_BASE_URL||"https://holdyourvoice.com"};try{let e=J.readFileSync(yn,"utf-8"),t=JSON.parse(e);return t.api_key?t:null}catch{return null}}function Bt(n){Ma(Ys),J.writeFileSync(yn,JSON.stringify(n,null,2))}function Ut(){let n=je.join(process.cwd(),".hyv.yml");if(!J.existsSync(n))return{};try{let e=J.readFileSync(n,"utf-8"),t={};for(let s of e.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"?t.profile=a:o==="scan_paths"?t.scan_paths=a.split(",").map(l=>l.trim()):o==="ignore"&&(t.ignore=a.split(",").map(l=>l.trim()))}return t}catch{return{}}}function Ks(n){let e=je.join(process.cwd(),".hyv.yml"),t=["# hold your voice \u2014 project config"];n.profile&&t.push(`profile: ${n.profile}`),n.scan_paths?.length&&t.push(`scan_paths: ${n.scan_paths.join(", ")}`),J.writeFileSync(e,t.join(`
25
25
  `)+`
26
- `)}function yn(n){let e=je.join(Ta,`${n}.md`);try{return J.readFileSync(e,"utf-8")}catch{return null}}var J,je,gn,Js,mn,Ta,Re=Wi(()=>{"use strict";J=S(require("fs")),je=S(require("path")),gn=S(require("os")),Js=je.join(gn.homedir(),".hyv"),mn=je.join(Js,"credentials.json"),Ta=je.join(Js,"profiles")});var Ut={};ra(Ut,{apiGet:()=>k,apiPost:()=>M});async function bn(n,e,t){let s=xe();if(!s)throw new Error("Not authenticated. Run: hyv init");let i=`${s.base_url||Ma}${e}`,r={method:n,headers:{Authorization:`Bearer ${s.api_key}`,"Content-Type":"application/json"}};t&&(r.body=JSON.stringify(t));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 k(n){return bn("GET",n)}function M(n,e){return bn("POST",n,e)}var Ma,U=Wi(()=>{"use strict";Re();Ma="https://holdyourvoice.com"});var vn=O((fu,wn)=>{"use strict";wn.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 Ks=O((du,Sn)=>{var dt=vn(),xn={};for(let n of Object.keys(dt))xn[dt[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"]}};Sn.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:e,labels:t}=w[n];delete w[n].channels,delete w[n].labels,Object.defineProperty(w[n],"channels",{value:e}),Object.defineProperty(w[n],"labels",{value:t})}w.rgb.hsl=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(e,t,s),r=Math.max(e,t,s),o=r-i,a,l;r===i?a=0:e===r?a=(t-s)/o:t===r?a=2+(s-e)/o:s===r&&(a=4+(e-t)/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 e,t,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),f=function(p){return(h-p)/6/u+1/2};return u===0?(i=0,r=0):(r=u/h,e=f(o),t=f(a),s=f(l),o===h?i=s-t:a===h?i=1/3+e-s:l===h&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,r*100,h*100]};w.rgb.hwb=function(n){let e=n[0],t=n[1],s=n[2],i=w.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,s));return s=1-1/255*Math.max(e,Math.max(t,s)),[i,r*100,s*100]};w.rgb.cmyk=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(1-e,1-t,1-s),r=(1-e-i)/(1-i)||0,o=(1-t-i)/(1-i)||0,a=(1-s-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function Ia(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}w.rgb.keyword=function(n){let e=xn[n];if(e)return e;let t=1/0,s;for(let i of Object.keys(dt)){let r=dt[i],o=Ia(n,r);o<t&&(t=o,s=i)}return s};w.keyword.rgb=function(n){return dt[n]};w.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let i=e*.4124+t*.3576+s*.1805,r=e*.2126+t*.7152+s*.0722,o=e*.0193+t*.1192+s*.9505;return[i*100,r*100,o*100]};w.rgb.lab=function(n){let e=w.rgb.xyz(n),t=e[0],s=e[1],i=e[2];t/=95.047,s/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+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*(t-s),a=200*(s-i);return[r,o,a]};w.hsl.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i,r,o;if(t===0)return o=s*255,[o,o,o];s<.5?i=s*(1+t):i=s+t-s*t;let a=2*s-i,l=[0,0,0];for(let h=0;h<3;h++)r=e+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 e=n[0],t=n[1]/100,s=n[2]/100,i=t,r=Math.max(s,.01);s*=2,t*=s<=1?s:2-s,i*=r<=1?r:2-r;let o=(s+t)/2,a=s===0?2*i/(r+i):2*t/(s+t);return[e,a*100,o*100]};w.hsv.rgb=function(n){let e=n[0]/60,t=n[1]/100,s=n[2]/100,i=Math.floor(e)%6,r=e-Math.floor(e),o=255*s*(1-t),a=255*s*(1-t*r),l=255*s*(1-t*(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 e=n[0],t=n[1]/100,s=n[2]/100,i=Math.max(s,.01),r,o;o=(2-t)*s;let a=(2-t)*i;return r=t*i,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};w.hwb.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i=t+s,r;i>1&&(t/=i,s/=i);let o=Math.floor(6*e),a=1-s;r=6*e-o,o&1&&(r=1-r);let l=t+r*(a-t),h,u,f;switch(o){default:case 6:case 0:h=a,u=l,f=t;break;case 1:h=l,u=a,f=t;break;case 2:h=t,u=a,f=l;break;case 3:h=t,u=l,f=a;break;case 4:h=l,u=t,f=a;break;case 5:h=a,u=t,f=l;break}return[h*255,u*255,f*255]};w.cmyk.rgb=function(n){let e=n[0]/100,t=n[1]/100,s=n[2]/100,i=n[3]/100,r=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(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 e=n[0]/100,t=n[1]/100,s=n[2]/100,i,r,o;return i=e*3.2406+t*-1.5372+s*-.4986,r=e*-.9689+t*1.8758+s*.0415,o=e*.0557+t*-.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 e=n[0],t=n[1],s=n[2];e/=95.047,t/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let i=116*t-16,r=500*(e-t),o=200*(t-s);return[i,r,o]};w.lab.xyz=function(n){let e=n[0],t=n[1],s=n[2],i,r,o;r=(e+16)/116,i=t/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 e=n[0],t=n[1],s=n[2],i;i=Math.atan2(s,t)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(t*t+s*s);return[e,o,i]};w.lch.lab=function(n){let e=n[0],t=n[1],i=n[2]/360*2*Math.PI,r=t*Math.cos(i),o=t*Math.sin(i);return[e,r,o]};w.rgb.ansi16=function(n,e=null){let[t,s,i]=n,r=e===null?w.rgb.hsv(n)[2]:e;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(t/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 e=n[0],t=n[1],s=n[2];return e===t&&t===s?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(s/255*5)};w.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(n>50)+1)*.5,s=(e&1)*t*255,i=(e>>1&1)*t*255,r=(e>>2&1)*t*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 e,t=Math.floor(n/36)/5*255,s=Math.floor((e=n%36)/6)/5*255,i=e%6/5*255;return[t,s,i]};w.rgb.hex=function(n){let t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};w.hex.rgb=function(n){let e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));let s=parseInt(t,16),i=s>>16&255,r=s>>8&255,o=s&255;return[i,r,o]};w.rgb.hcg=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.max(Math.max(e,t),s),r=Math.min(Math.min(e,t),s),o=i-r,a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:i===e?l=(t-s)/o%6:i===t?l=2+(s-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]};w.hsl.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=t<.5?2*e*t:2*e*(1-t),i=0;return s<1&&(i=(t-.5*s)/(1-s)),[n[0],s*100,i*100]};w.hsv.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=e*t,i=0;return s<1&&(i=(t-s)/(1-s)),[n[0],s*100,i*100]};w.hcg.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100;if(t===0)return[s*255,s*255,s*255];let i=[0,0,0],r=e%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-t)*s,[(t*i[0]+l)*255,(t*i[1]+l)*255,(t*i[2]+l)*255]};w.hcg.hsv=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e),i=0;return s>0&&(i=e/s),[n[0],i*100,s*100]};w.hcg.hsl=function(n){let e=n[1]/100,s=n[2]/100*(1-e)+.5*e,i=0;return s>0&&s<.5?i=e/(2*s):s>=.5&&s<1&&(i=e/(2*(1-s))),[n[0],i*100,s*100]};w.hcg.hwb=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e);return[n[0],(s-e)*100,(1-s)*100]};w.hwb.hcg=function(n){let e=n[1]/100,s=1-n[2]/100,i=s-e,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 e=Math.round(n[0]/100*255)&255,s=((e<<16)+(e<<8)+e).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 _n=O((pu,$n)=>{var zt=Ks();function Na(){let n={},e=Object.keys(zt);for(let t=e.length,s=0;s<t;s++)n[e[s]]={distance:-1,parent:null};return n}function La(n){let e=Na(),t=[n];for(e[n].distance=0;t.length;){let s=t.pop(),i=Object.keys(zt[s]);for(let r=i.length,o=0;o<r;o++){let a=i[o],l=e[a];l.distance===-1&&(l.distance=e[s].distance+1,l.parent=s,t.unshift(a))}}return e}function Da(n,e){return function(t){return e(n(t))}}function Wa(n,e){let t=[e[n].parent,n],s=zt[e[n].parent][n],i=e[n].parent;for(;e[i].parent;)t.unshift(e[i].parent),s=Da(zt[e[i].parent][i],s),i=e[i].parent;return s.conversion=t,s}$n.exports=function(n){let e=La(n),t={},s=Object.keys(e);for(let i=s.length,r=0;r<i;r++){let o=s[r];e[o].parent!==null&&(t[o]=Wa(o,e))}return t}});var En=O((gu,Cn)=>{var Xs=Ks(),Va=_n(),He={},Ha=Object.keys(Xs);function Ba(n){let e=function(...t){let s=t[0];return s==null?s:(s.length>1&&(t=s),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function qa(n){let e=function(...t){let s=t[0];if(s==null)return s;s.length>1&&(t=s);let i=n(t);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&&(e.conversion=n.conversion),e}Ha.forEach(n=>{He[n]={},Object.defineProperty(He[n],"channels",{value:Xs[n].channels}),Object.defineProperty(He[n],"labels",{value:Xs[n].labels});let e=Va(n);Object.keys(e).forEach(s=>{let i=e[s];He[n][s]=qa(i),He[n][s].raw=Ba(i)})});Cn.exports=He});var Rn=O((mu,jn)=>{"use strict";var On=(n,e)=>(...t)=>`\x1B[${n(...t)+e}m`,kn=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};5;${s}m`},An=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},Gt=n=>n,Fn=(n,e,t)=>[n,e,t],Be=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{let s=t();return Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},Zs,qe=(n,e,t,s)=>{Zs===void 0&&(Zs=En());let i=s?10:0,r={};for(let[o,a]of Object.entries(Zs)){let l=o==="ansi16"?"ansi":o;o===e?r[l]=n(t,i):typeof a=="object"&&(r[l]=n(a[e],i))}return r};function Ua(){let n=new Map,e={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]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[t,s]of Object.entries(e)){for(let[i,r]of Object.entries(s))e[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=e[i],n.set(r[0],r[1]);Object.defineProperty(e,t,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:n,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Be(e.color,"ansi",()=>qe(On,"ansi16",Gt,!1)),Be(e.color,"ansi256",()=>qe(kn,"ansi256",Gt,!1)),Be(e.color,"ansi16m",()=>qe(An,"rgb",Fn,!1)),Be(e.bgColor,"ansi",()=>qe(On,"ansi16",Gt,!0)),Be(e.bgColor,"ansi256",()=>qe(kn,"ansi256",Gt,!0)),Be(e.bgColor,"ansi16m",()=>qe(An,"rgb",Fn,!0)),e}Object.defineProperty(jn,"exports",{enumerable:!0,get:Ua})});var Pn=O((yu,Tn)=>{"use strict";Tn.exports=(n,e=process.argv)=>{let t=n.startsWith("-")?"":n.length===1?"-":"--",s=e.indexOf(t+n),i=e.indexOf("--");return s!==-1&&(i===-1||s<i)}});var Nn=O((bu,In)=>{"use strict";var za=require("os"),Mn=require("tty"),Z=Pn(),{env:I}=process,Se;Z("no-color")||Z("no-colors")||Z("color=false")||Z("color=never")?Se=0:(Z("color")||Z("colors")||Z("color=true")||Z("color=always"))&&(Se=1);"FORCE_COLOR"in I&&(I.FORCE_COLOR==="true"?Se=1:I.FORCE_COLOR==="false"?Se=0:Se=I.FORCE_COLOR.length===0?1:Math.min(parseInt(I.FORCE_COLOR,10),3));function Qs(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function ei(n,e){if(Se===0)return 0;if(Z("color=16m")||Z("color=full")||Z("color=truecolor"))return 3;if(Z("color=256"))return 2;if(n&&!e&&Se===void 0)return 0;let t=Se||0;if(I.TERM==="dumb")return t;if(process.platform==="win32"){let s=za.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in I)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(s=>s in I)||I.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in I)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(I.TEAMCITY_VERSION)?1:0;if(I.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in I){let s=parseInt((I.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(I.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(I.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(I.TERM)||"COLORTERM"in I?1:t}function Ga(n){let e=ei(n,n&&n.isTTY);return Qs(e)}In.exports={supportsColor:Ga,stdout:Qs(ei(!0,Mn.isatty(1))),stderr:Qs(ei(!0,Mn.isatty(2)))}});var Dn=O((wu,Ln)=>{"use strict";var Ja=(n,e,t)=>{let s=n.indexOf(e);if(s===-1)return n;let i=e.length,r=0,o="";do o+=n.substr(r,s-r)+e+t,r=s+i,s=n.indexOf(e,r);while(s!==-1);return o+=n.substr(r),o},Ya=(n,e,t,s)=>{let i=0,r="";do{let o=n[s-1]==="\r";r+=n.substr(i,(o?s-1:s)-i)+e+(o?`\r
26
+ `)}function bn(n){let e=je.join(Pa,`${n}.md`);try{return J.readFileSync(e,"utf-8")}catch{return null}}var J,je,mn,Ys,yn,Pa,Re=Vi(()=>{"use strict";J=S(require("fs")),je=S(require("path")),mn=S(require("os")),Ys=je.join(mn.homedir(),".hyv"),yn=je.join(Ys,"credentials.json"),Pa=je.join(Ys,"profiles")});var zt={};oa(zt,{apiGet:()=>E,apiPost:()=>M,requireSubscription:()=>Te});async function wn(n,e,t){let s=xe();if(!s)throw new Error("Not authenticated. Run: hyv init");let i=`${s.base_url||Ia}${e}`,r={method:n,headers:{Authorization:`Bearer ${s.api_key}`,"Content-Type":"application/json"}};t&&(r.body=JSON.stringify(t));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 E(n){return wn("GET",n)}function M(n,e){return wn("POST",n,e)}async function Te(){let n=await E("/cli/heartbeat");if(!n.plan||n.plan.toLowerCase()==="none"||n.status==="none")throw new Error("No active subscription. Run: hyv plan --upgrade")}var Ia,V=Vi(()=>{"use strict";Re();Ia="https://holdyourvoice.com"});var xn=k((du,vn)=>{"use strict";vn.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 Xs=k((pu,$n)=>{var pt=xn(),Sn={};for(let n of Object.keys(pt))Sn[pt[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"]}};$n.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:e,labels:t}=w[n];delete w[n].channels,delete w[n].labels,Object.defineProperty(w[n],"channels",{value:e}),Object.defineProperty(w[n],"labels",{value:t})}w.rgb.hsl=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(e,t,s),r=Math.max(e,t,s),o=r-i,a,l;r===i?a=0:e===r?a=(t-s)/o:t===r?a=2+(s-e)/o:s===r&&(a=4+(e-t)/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 e,t,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),f=function(p){return(h-p)/6/u+1/2};return u===0?(i=0,r=0):(r=u/h,e=f(o),t=f(a),s=f(l),o===h?i=s-t:a===h?i=1/3+e-s:l===h&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,r*100,h*100]};w.rgb.hwb=function(n){let e=n[0],t=n[1],s=n[2],i=w.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,s));return s=1-1/255*Math.max(e,Math.max(t,s)),[i,r*100,s*100]};w.rgb.cmyk=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.min(1-e,1-t,1-s),r=(1-e-i)/(1-i)||0,o=(1-t-i)/(1-i)||0,a=(1-s-i)/(1-i)||0;return[r*100,o*100,a*100,i*100]};function Na(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}w.rgb.keyword=function(n){let e=Sn[n];if(e)return e;let t=1/0,s;for(let i of Object.keys(pt)){let r=pt[i],o=Na(n,r);o<t&&(t=o,s=i)}return s};w.keyword.rgb=function(n){return pt[n]};w.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;let i=e*.4124+t*.3576+s*.1805,r=e*.2126+t*.7152+s*.0722,o=e*.0193+t*.1192+s*.9505;return[i*100,r*100,o*100]};w.rgb.lab=function(n){let e=w.rgb.xyz(n),t=e[0],s=e[1],i=e[2];t/=95.047,s/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+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*(t-s),a=200*(s-i);return[r,o,a]};w.hsl.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i,r,o;if(t===0)return o=s*255,[o,o,o];s<.5?i=s*(1+t):i=s+t-s*t;let a=2*s-i,l=[0,0,0];for(let h=0;h<3;h++)r=e+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 e=n[0],t=n[1]/100,s=n[2]/100,i=t,r=Math.max(s,.01);s*=2,t*=s<=1?s:2-s,i*=r<=1?r:2-r;let o=(s+t)/2,a=s===0?2*i/(r+i):2*t/(s+t);return[e,a*100,o*100]};w.hsv.rgb=function(n){let e=n[0]/60,t=n[1]/100,s=n[2]/100,i=Math.floor(e)%6,r=e-Math.floor(e),o=255*s*(1-t),a=255*s*(1-t*r),l=255*s*(1-t*(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 e=n[0],t=n[1]/100,s=n[2]/100,i=Math.max(s,.01),r,o;o=(2-t)*s;let a=(2-t)*i;return r=t*i,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};w.hwb.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100,i=t+s,r;i>1&&(t/=i,s/=i);let o=Math.floor(6*e),a=1-s;r=6*e-o,o&1&&(r=1-r);let l=t+r*(a-t),h,u,f;switch(o){default:case 6:case 0:h=a,u=l,f=t;break;case 1:h=l,u=a,f=t;break;case 2:h=t,u=a,f=l;break;case 3:h=t,u=l,f=a;break;case 4:h=l,u=t,f=a;break;case 5:h=a,u=t,f=l;break}return[h*255,u*255,f*255]};w.cmyk.rgb=function(n){let e=n[0]/100,t=n[1]/100,s=n[2]/100,i=n[3]/100,r=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(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 e=n[0]/100,t=n[1]/100,s=n[2]/100,i,r,o;return i=e*3.2406+t*-1.5372+s*-.4986,r=e*-.9689+t*1.8758+s*.0415,o=e*.0557+t*-.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 e=n[0],t=n[1],s=n[2];e/=95.047,t/=100,s/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let i=116*t-16,r=500*(e-t),o=200*(t-s);return[i,r,o]};w.lab.xyz=function(n){let e=n[0],t=n[1],s=n[2],i,r,o;r=(e+16)/116,i=t/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 e=n[0],t=n[1],s=n[2],i;i=Math.atan2(s,t)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(t*t+s*s);return[e,o,i]};w.lch.lab=function(n){let e=n[0],t=n[1],i=n[2]/360*2*Math.PI,r=t*Math.cos(i),o=t*Math.sin(i);return[e,r,o]};w.rgb.ansi16=function(n,e=null){let[t,s,i]=n,r=e===null?w.rgb.hsv(n)[2]:e;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(t/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 e=n[0],t=n[1],s=n[2];return e===t&&t===s?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(s/255*5)};w.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(n>50)+1)*.5,s=(e&1)*t*255,i=(e>>1&1)*t*255,r=(e>>2&1)*t*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 e,t=Math.floor(n/36)/5*255,s=Math.floor((e=n%36)/6)/5*255,i=e%6/5*255;return[t,s,i]};w.rgb.hex=function(n){let t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};w.hex.rgb=function(n){let e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));let s=parseInt(t,16),i=s>>16&255,r=s>>8&255,o=s&255;return[i,r,o]};w.rgb.hcg=function(n){let e=n[0]/255,t=n[1]/255,s=n[2]/255,i=Math.max(Math.max(e,t),s),r=Math.min(Math.min(e,t),s),o=i-r,a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:i===e?l=(t-s)/o%6:i===t?l=2+(s-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]};w.hsl.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=t<.5?2*e*t:2*e*(1-t),i=0;return s<1&&(i=(t-.5*s)/(1-s)),[n[0],s*100,i*100]};w.hsv.hcg=function(n){let e=n[1]/100,t=n[2]/100,s=e*t,i=0;return s<1&&(i=(t-s)/(1-s)),[n[0],s*100,i*100]};w.hcg.rgb=function(n){let e=n[0]/360,t=n[1]/100,s=n[2]/100;if(t===0)return[s*255,s*255,s*255];let i=[0,0,0],r=e%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-t)*s,[(t*i[0]+l)*255,(t*i[1]+l)*255,(t*i[2]+l)*255]};w.hcg.hsv=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e),i=0;return s>0&&(i=e/s),[n[0],i*100,s*100]};w.hcg.hsl=function(n){let e=n[1]/100,s=n[2]/100*(1-e)+.5*e,i=0;return s>0&&s<.5?i=e/(2*s):s>=.5&&s<1&&(i=e/(2*(1-s))),[n[0],i*100,s*100]};w.hcg.hwb=function(n){let e=n[1]/100,t=n[2]/100,s=e+t*(1-e);return[n[0],(s-e)*100,(1-s)*100]};w.hwb.hcg=function(n){let e=n[1]/100,s=1-n[2]/100,i=s-e,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 e=Math.round(n[0]/100*255)&255,s=((e<<16)+(e<<8)+e).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 Cn=k((gu,_n)=>{var Gt=Xs();function La(){let n={},e=Object.keys(Gt);for(let t=e.length,s=0;s<t;s++)n[e[s]]={distance:-1,parent:null};return n}function Da(n){let e=La(),t=[n];for(e[n].distance=0;t.length;){let s=t.pop(),i=Object.keys(Gt[s]);for(let r=i.length,o=0;o<r;o++){let a=i[o],l=e[a];l.distance===-1&&(l.distance=e[s].distance+1,l.parent=s,t.unshift(a))}}return e}function Wa(n,e){return function(t){return e(n(t))}}function Va(n,e){let t=[e[n].parent,n],s=Gt[e[n].parent][n],i=e[n].parent;for(;e[i].parent;)t.unshift(e[i].parent),s=Wa(Gt[e[i].parent][i],s),i=e[i].parent;return s.conversion=t,s}_n.exports=function(n){let e=Da(n),t={},s=Object.keys(e);for(let i=s.length,r=0;r<i;r++){let o=s[r];e[o].parent!==null&&(t[o]=Va(o,e))}return t}});var On=k((mu,En)=>{var Zs=Xs(),Ha=Cn(),qe={},qa=Object.keys(Zs);function Ba(n){let e=function(...t){let s=t[0];return s==null?s:(s.length>1&&(t=s),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function Ua(n){let e=function(...t){let s=t[0];if(s==null)return s;s.length>1&&(t=s);let i=n(t);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&&(e.conversion=n.conversion),e}qa.forEach(n=>{qe[n]={},Object.defineProperty(qe[n],"channels",{value:Zs[n].channels}),Object.defineProperty(qe[n],"labels",{value:Zs[n].labels});let e=Ha(n);Object.keys(e).forEach(s=>{let i=e[s];qe[n][s]=Ua(i),qe[n][s].raw=Ba(i)})});En.exports=qe});var Tn=k((yu,Rn)=>{"use strict";var kn=(n,e)=>(...t)=>`\x1B[${n(...t)+e}m`,An=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};5;${s}m`},Fn=(n,e)=>(...t)=>{let s=n(...t);return`\x1B[${38+e};2;${s[0]};${s[1]};${s[2]}m`},Jt=n=>n,jn=(n,e,t)=>[n,e,t],Be=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{let s=t();return Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0}),s},enumerable:!0,configurable:!0})},Qs,Ue=(n,e,t,s)=>{Qs===void 0&&(Qs=On());let i=s?10:0,r={};for(let[o,a]of Object.entries(Qs)){let l=o==="ansi16"?"ansi":o;o===e?r[l]=n(t,i):typeof a=="object"&&(r[l]=n(a[e],i))}return r};function za(){let n=new Map,e={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]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[t,s]of Object.entries(e)){for(let[i,r]of Object.entries(s))e[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},s[i]=e[i],n.set(r[0],r[1]);Object.defineProperty(e,t,{value:s,enumerable:!1})}return Object.defineProperty(e,"codes",{value:n,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Be(e.color,"ansi",()=>Ue(kn,"ansi16",Jt,!1)),Be(e.color,"ansi256",()=>Ue(An,"ansi256",Jt,!1)),Be(e.color,"ansi16m",()=>Ue(Fn,"rgb",jn,!1)),Be(e.bgColor,"ansi",()=>Ue(kn,"ansi16",Jt,!0)),Be(e.bgColor,"ansi256",()=>Ue(An,"ansi256",Jt,!0)),Be(e.bgColor,"ansi16m",()=>Ue(Fn,"rgb",jn,!0)),e}Object.defineProperty(Rn,"exports",{enumerable:!0,get:za})});var Mn=k((bu,Pn)=>{"use strict";Pn.exports=(n,e=process.argv)=>{let t=n.startsWith("-")?"":n.length===1?"-":"--",s=e.indexOf(t+n),i=e.indexOf("--");return s!==-1&&(i===-1||s<i)}});var Ln=k((wu,Nn)=>{"use strict";var Ga=require("os"),In=require("tty"),Z=Mn(),{env:I}=process,Se;Z("no-color")||Z("no-colors")||Z("color=false")||Z("color=never")?Se=0:(Z("color")||Z("colors")||Z("color=true")||Z("color=always"))&&(Se=1);"FORCE_COLOR"in I&&(I.FORCE_COLOR==="true"?Se=1:I.FORCE_COLOR==="false"?Se=0:Se=I.FORCE_COLOR.length===0?1:Math.min(parseInt(I.FORCE_COLOR,10),3));function ei(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function ti(n,e){if(Se===0)return 0;if(Z("color=16m")||Z("color=full")||Z("color=truecolor"))return 3;if(Z("color=256"))return 2;if(n&&!e&&Se===void 0)return 0;let t=Se||0;if(I.TERM==="dumb")return t;if(process.platform==="win32"){let s=Ga.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in I)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(s=>s in I)||I.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in I)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(I.TEAMCITY_VERSION)?1:0;if(I.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in I){let s=parseInt((I.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(I.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(I.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(I.TERM)||"COLORTERM"in I?1:t}function Ja(n){let e=ti(n,n&&n.isTTY);return ei(e)}Nn.exports={supportsColor:Ja,stdout:ei(ti(!0,In.isatty(1))),stderr:ei(ti(!0,In.isatty(2)))}});var Wn=k((vu,Dn)=>{"use strict";var Ya=(n,e,t)=>{let s=n.indexOf(e);if(s===-1)return n;let i=e.length,r=0,o="";do o+=n.substr(r,s-r)+e+t,r=s+i,s=n.indexOf(e,r);while(s!==-1);return o+=n.substr(r),o},Ka=(n,e,t,s)=>{let i=0,r="";do{let o=n[s-1]==="\r";r+=n.substr(i,(o?s-1:s)-i)+e+(o?`\r
27
27
  `:`
28
28
  `)+t,i=s+1,s=n.indexOf(`
29
- `,i)}while(s!==-1);return r+=n.substr(i),r};Ln.exports={stringReplaceAll:Ja,stringEncaseCRLFWithFirstIndex:Ya}});var qn=O((vu,Bn)=>{"use strict";var Ka=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Wn=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Xa=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Za=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Qa=new Map([["n",`
30
- `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Hn(n){let e=n[0]==="u",t=n[1]==="{";return e&&!t&&n.length===5||n[0]==="x"&&n.length===3?String.fromCharCode(parseInt(n.slice(1),16)):e&&t?String.fromCodePoint(parseInt(n.slice(2,-1),16)):Qa.get(n)||n}function el(n,e){let t=[],s=e.trim().split(/\s*,\s*/g),i;for(let r of s){let o=Number(r);if(!Number.isNaN(o))t.push(o);else if(i=r.match(Xa))t.push(i[2].replace(Za,(a,l,h)=>l?Hn(l):h));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}return t}function tl(n){Wn.lastIndex=0;let e=[],t;for(;(t=Wn.exec(n))!==null;){let s=t[1];if(t[2]){let i=el(s,t[2]);e.push([s].concat(i))}else e.push([s])}return e}function Vn(n,e){let t={};for(let i of e)for(let r of i.styles)t[r[0]]=i.inverse?null:r.slice(1);let s=n;for(let[i,r]of Object.entries(t))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}Bn.exports=(n,e)=>{let t=[],s=[],i=[];if(e.replace(Ka,(r,o,a,l,h,u)=>{if(o)i.push(Hn(o));else if(l){let f=i.join("");i=[],s.push(t.length===0?f:Vn(n,t)(f)),t.push({inverse:a,styles:tl(l)})}else if(h){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(Vn(n,t)(i.join(""))),i=[],t.pop()}else i.push(u)}),s.push(i.join("")),t.length>0){let r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return s.join("")}});var Xn=O((xu,Kn)=>{"use strict";var pt=Rn(),{stdout:si,stderr:ii}=Nn(),{stringReplaceAll:sl,stringEncaseCRLFWithFirstIndex:il}=Dn(),{isArray:Jt}=Array,zn=["ansi","ansi","ansi256","ansi16m"],Ue=Object.create(null),nl=(n,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=si?si.level:0;n.level=e.level===void 0?t:e.level},ni=class{constructor(e){return Gn(e)}},Gn=n=>{let e={};return nl(e,n),e.template=(...t)=>Yn(e.template,...t),Object.setPrototypeOf(e,Yt.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=ni,e.template};function Yt(n){return Gn(n)}for(let[n,e]of Object.entries(pt))Ue[n]={get(){let t=Kt(this,ri(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,n,{value:t}),t}};Ue.visible={get(){let n=Kt(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:n}),n}};var Jn=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let n of Jn)Ue[n]={get(){let{level:e}=this;return function(...t){let s=ri(pt.color[zn[e]][n](...t),pt.color.close,this._styler);return Kt(this,s,this._isEmpty)}}};for(let n of Jn){let e="bg"+n[0].toUpperCase()+n.slice(1);Ue[e]={get(){let{level:t}=this;return function(...s){let i=ri(pt.bgColor[zn[t]][n](...s),pt.bgColor.close,this._styler);return Kt(this,i,this._isEmpty)}}}}var rl=Object.defineProperties(()=>{},{...Ue,level:{enumerable:!0,get(){return this._generator.level},set(n){this._generator.level=n}}}),ri=(n,e,t)=>{let s,i;return t===void 0?(s=n,i=e):(s=t.openAll+n,i=e+t.closeAll),{open:n,close:e,openAll:s,closeAll:i,parent:t}},Kt=(n,e,t)=>{let s=(...i)=>Jt(i[0])&&Jt(i[0].raw)?Un(s,Yn(s,...i)):Un(s,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(s,rl),s._generator=n,s._styler=e,s._isEmpty=t,s},Un=(n,e)=>{if(n.level<=0||!e)return n._isEmpty?"":e;let t=n._styler;if(t===void 0)return e;let{openAll:s,closeAll:i}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=sl(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
31
- `);return r!==-1&&(e=il(e,i,s,r)),s+e+i},ti,Yn=(n,...e)=>{let[t]=e;if(!Jt(t)||!Jt(t.raw))return e.join(" ");let s=e.slice(1),i=[t.raw[0]];for(let r=1;r<t.length;r++)i.push(String(s[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]));return ti===void 0&&(ti=qn()),ti(n,i.join(""))};Object.defineProperties(Yt.prototype,Ue);var Xt=Yt();Xt.supportsColor=si;Xt.stderr=Yt({level:ii?ii.level:0});Xt.stderr.supportsColor=ii;Kn.exports=Xt});var cr=O((Ou,lr)=>{"use strict";lr.exports=or;function or(n,e,t){n instanceof RegExp&&(n=rr(n,t)),e instanceof RegExp&&(e=rr(e,t));var s=ar(n,e,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+e.length)}}function rr(n,e){var t=e.match(n);return t?t[0]:null}or.range=ar;function ar(n,e,t){var s,i,r,o,a,l=t.indexOf(n),h=t.indexOf(e,l+1),u=l;if(l>=0&&h>0){if(n===e)return[l,h];for(s=[],r=t.length;u>=0&&!a;)u==l?(s.push(u),l=t.indexOf(n,u+1)):s.length==1?a=[s.pop(),h]:(i=s.pop(),i<r&&(r=i,o=h),h=t.indexOf(e,u+1)),u=l<h&&l>=0?l:h;s.length&&(a=[r,o])}return a}});var yr=O((ku,mr)=>{var hr=cr();mr.exports=pl;var ur="\0SLASH"+Math.random()+"\0",fr="\0OPEN"+Math.random()+"\0",ci="\0CLOSE"+Math.random()+"\0",dr="\0COMMA"+Math.random()+"\0",pr="\0PERIOD"+Math.random()+"\0";function li(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}function fl(n){return n.split("\\\\").join(ur).split("\\{").join(fr).split("\\}").join(ci).split("\\,").join(dr).split("\\.").join(pr)}function dl(n){return n.split(ur).join("\\").split(fr).join("{").split(ci).join("}").split(dr).join(",").split(pr).join(".")}function gr(n){if(!n)return[""];var e=[],t=hr("{","}",n);if(!t)return n.split(",");var s=t.pre,i=t.body,r=t.post,o=s.split(",");o[o.length-1]+="{"+i+"}";var a=gr(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function pl(n,e){if(!n)return[];e=e||{};var t=e.max==null?1/0:e.max;return n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),yt(fl(n),t,!0).map(dl)}function gl(n){return"{"+n+"}"}function ml(n){return/^-?0\d/.test(n)}function yl(n,e){return n<=e}function bl(n,e){return n>=e}function yt(n,e,t){var s=[],i=hr("{","}",n);if(!i)return[n];var r=i.pre,o=i.post.length?yt(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<o.length&&a<e;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),f=h||u,p=i.body.indexOf(",")>=0;if(!f&&!p)return i.post.match(/,(?!,).*\}/)?(n=i.pre+"{"+i.body+ci+i.post,yt(n,e,!0)):[n];var d;if(f)d=i.body.split(/\.\./);else if(d=gr(i.body),d.length===1&&(d=yt(d[0],e,!1).map(gl),d.length===1))return o.map(function(Qo){return i.pre+d[0]+Qo});var m;if(f){var g=li(d[0]),y=li(d[1]),b=Math.max(d[0].length,d[1].length),v=d.length==3?Math.max(Math.abs(li(d[2])),1):1,x=yl,$=y<g;$&&(v*=-1,x=bl);var E=d.some(ml);m=[];for(var G=g;x(G,y)&&m.length<e;G+=v){var T;if(u)T=String.fromCharCode(G),T==="\\"&&(T="");else if(T=String(G),E){var Fe=b-T.length;if(Fe>0){var De=new Array(Fe+1).join("0");G<0?T="-"+De+T.slice(1):T=De+T}}m.push(T)}}else{m=[];for(var le=0;le<d.length;le++)m.push.apply(m,yt(d[le],e,!1))}for(var le=0;le<m.length;le++)for(var a=0;a<o.length&&s.length<e;a++){var l=r+m[le]+o[a];(!t||f||l)&&s.push(l)}}return s}});var Qi=S(Zi(),1),{program:Yh,createCommand:Kh,createArgument:Xh,createOption:Zh,CommanderError:Qh,InvalidArgumentError:eu,InvalidOptionArgumentError:tu,Command:en,Argument:su,Option:iu,Help:nu}=Qi.default;var tr=S(require("http")),P=S(require("fs")),R=S(require("path")),sr=S(require("os")),ir=S(Ve());Re();U();var pe=S(Xn()),c={dim:n=>pe.default.dim(n),bold:n=>pe.default.bold(n),accent:n=>pe.default.hex("#C4441A")(n),green:n=>pe.default.green(n),red:n=>pe.default.red(n),yellow:n=>pe.default.yellow(n),cyan:n=>pe.default.cyan(n),white:n=>pe.default.white(n)};function C(){return`${c.bold("hold your ")}${c.accent("voice")}`}function Zn(n){let e=n.severity==="red"?c.red("\u25CF"):c.yellow("\u25CF"),t=c.dim(`${n.file}:${n.line}`),s=c.dim(n.pattern);console.log(` ${e} ${t} ${s}`),console.log(` ${n.excerpt}`)}function Qn(n){if(console.log(""),console.log(` ${c.bold("scanned")} ${c.cyan(String(n.files))} files, ${c.cyan(String(n.total_lines))} lines`),n.red+n.yellow===0)console.log(` ${c.green("\u2713 clean \u2014 no issues found")}`);else{let e=[];n.red&&e.push(c.red(`${n.red} critical`)),n.yellow&&e.push(c.yellow(`${n.yellow} advisory`)),console.log(` ${e.join(", ")}`)}}var Te=process.env.HYV_BASE_URL||"https://holdyourvoice.com",ze=sr.homedir(),er=process.platform==="win32",ai=R.join(ze,".hyv"),Ge=R.join(ai,"voice.md"),gt=`# Hold Your Voice
29
+ `,i)}while(s!==-1);return r+=n.substr(i),r};Dn.exports={stringReplaceAll:Ya,stringEncaseCRLFWithFirstIndex:Ka}});var Un=k((xu,Bn)=>{"use strict";var Xa=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Vn=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Za=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Qa=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,el=new Map([["n",`
30
+ `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function qn(n){let e=n[0]==="u",t=n[1]==="{";return e&&!t&&n.length===5||n[0]==="x"&&n.length===3?String.fromCharCode(parseInt(n.slice(1),16)):e&&t?String.fromCodePoint(parseInt(n.slice(2,-1),16)):el.get(n)||n}function tl(n,e){let t=[],s=e.trim().split(/\s*,\s*/g),i;for(let r of s){let o=Number(r);if(!Number.isNaN(o))t.push(o);else if(i=r.match(Za))t.push(i[2].replace(Qa,(a,l,h)=>l?qn(l):h));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}return t}function sl(n){Vn.lastIndex=0;let e=[],t;for(;(t=Vn.exec(n))!==null;){let s=t[1];if(t[2]){let i=tl(s,t[2]);e.push([s].concat(i))}else e.push([s])}return e}function Hn(n,e){let t={};for(let i of e)for(let r of i.styles)t[r[0]]=i.inverse?null:r.slice(1);let s=n;for(let[i,r]of Object.entries(t))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}Bn.exports=(n,e)=>{let t=[],s=[],i=[];if(e.replace(Xa,(r,o,a,l,h,u)=>{if(o)i.push(qn(o));else if(l){let f=i.join("");i=[],s.push(t.length===0?f:Hn(n,t)(f)),t.push({inverse:a,styles:sl(l)})}else if(h){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");s.push(Hn(n,t)(i.join(""))),i=[],t.pop()}else i.push(u)}),s.push(i.join("")),t.length>0){let r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return s.join("")}});var Zn=k((Su,Xn)=>{"use strict";var gt=Tn(),{stdout:ii,stderr:ni}=Ln(),{stringReplaceAll:il,stringEncaseCRLFWithFirstIndex:nl}=Wn(),{isArray:Yt}=Array,Gn=["ansi","ansi","ansi256","ansi16m"],ze=Object.create(null),rl=(n,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let t=ii?ii.level:0;n.level=e.level===void 0?t:e.level},ri=class{constructor(e){return Jn(e)}},Jn=n=>{let e={};return rl(e,n),e.template=(...t)=>Kn(e.template,...t),Object.setPrototypeOf(e,Kt.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=ri,e.template};function Kt(n){return Jn(n)}for(let[n,e]of Object.entries(gt))ze[n]={get(){let t=Xt(this,oi(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,n,{value:t}),t}};ze.visible={get(){let n=Xt(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:n}),n}};var Yn=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let n of Yn)ze[n]={get(){let{level:e}=this;return function(...t){let s=oi(gt.color[Gn[e]][n](...t),gt.color.close,this._styler);return Xt(this,s,this._isEmpty)}}};for(let n of Yn){let e="bg"+n[0].toUpperCase()+n.slice(1);ze[e]={get(){let{level:t}=this;return function(...s){let i=oi(gt.bgColor[Gn[t]][n](...s),gt.bgColor.close,this._styler);return Xt(this,i,this._isEmpty)}}}}var ol=Object.defineProperties(()=>{},{...ze,level:{enumerable:!0,get(){return this._generator.level},set(n){this._generator.level=n}}}),oi=(n,e,t)=>{let s,i;return t===void 0?(s=n,i=e):(s=t.openAll+n,i=e+t.closeAll),{open:n,close:e,openAll:s,closeAll:i,parent:t}},Xt=(n,e,t)=>{let s=(...i)=>Yt(i[0])&&Yt(i[0].raw)?zn(s,Kn(s,...i)):zn(s,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(s,ol),s._generator=n,s._styler=e,s._isEmpty=t,s},zn=(n,e)=>{if(n.level<=0||!e)return n._isEmpty?"":e;let t=n._styler;if(t===void 0)return e;let{openAll:s,closeAll:i}=t;if(e.indexOf("\x1B")!==-1)for(;t!==void 0;)e=il(e,t.close,t.open),t=t.parent;let r=e.indexOf(`
31
+ `);return r!==-1&&(e=nl(e,i,s,r)),s+e+i},si,Kn=(n,...e)=>{let[t]=e;if(!Yt(t)||!Yt(t.raw))return e.join(" ");let s=e.slice(1),i=[t.raw[0]];for(let r=1;r<t.length;r++)i.push(String(s[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]));return si===void 0&&(si=Un()),si(n,i.join(""))};Object.defineProperties(Kt.prototype,ze);var Zt=Kt();Zt.supportsColor=ii;Zt.stderr=Kt({level:ni?ni.level:0});Zt.stderr.supportsColor=ni;Xn.exports=Zt});var hr=k((ku,cr)=>{"use strict";cr.exports=ar;function ar(n,e,t){n instanceof RegExp&&(n=or(n,t)),e instanceof RegExp&&(e=or(e,t));var s=lr(n,e,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+e.length)}}function or(n,e){var t=e.match(n);return t?t[0]:null}ar.range=lr;function lr(n,e,t){var s,i,r,o,a,l=t.indexOf(n),h=t.indexOf(e,l+1),u=l;if(l>=0&&h>0){if(n===e)return[l,h];for(s=[],r=t.length;u>=0&&!a;)u==l?(s.push(u),l=t.indexOf(n,u+1)):s.length==1?a=[s.pop(),h]:(i=s.pop(),i<r&&(r=i,o=h),h=t.indexOf(e,u+1)),u=l<h&&l>=0?l:h;s.length&&(a=[r,o])}return a}});var br=k((Au,yr)=>{var ur=hr();yr.exports=gl;var fr="\0SLASH"+Math.random()+"\0",dr="\0OPEN"+Math.random()+"\0",hi="\0CLOSE"+Math.random()+"\0",pr="\0COMMA"+Math.random()+"\0",gr="\0PERIOD"+Math.random()+"\0";function ci(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}function dl(n){return n.split("\\\\").join(fr).split("\\{").join(dr).split("\\}").join(hi).split("\\,").join(pr).split("\\.").join(gr)}function pl(n){return n.split(fr).join("\\").split(dr).join("{").split(hi).join("}").split(pr).join(",").split(gr).join(".")}function mr(n){if(!n)return[""];var e=[],t=ur("{","}",n);if(!t)return n.split(",");var s=t.pre,i=t.body,r=t.post,o=s.split(",");o[o.length-1]+="{"+i+"}";var a=mr(r);return r.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function gl(n,e){if(!n)return[];e=e||{};var t=e.max==null?1/0:e.max;return n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),bt(dl(n),t,!0).map(pl)}function ml(n){return"{"+n+"}"}function yl(n){return/^-?0\d/.test(n)}function bl(n,e){return n<=e}function wl(n,e){return n>=e}function bt(n,e,t){var s=[],i=ur("{","}",n);if(!i)return[n];var r=i.pre,o=i.post.length?bt(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<o.length&&a<e;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),f=h||u,p=i.body.indexOf(",")>=0;if(!f&&!p)return i.post.match(/,(?!,).*\}/)?(n=i.pre+"{"+i.body+hi+i.post,bt(n,e,!0)):[n];var d;if(f)d=i.body.split(/\.\./);else if(d=mr(i.body),d.length===1&&(d=bt(d[0],e,!1).map(ml),d.length===1))return o.map(function(ea){return i.pre+d[0]+ea});var m;if(f){var g=ci(d[0]),y=ci(d[1]),b=Math.max(d[0].length,d[1].length),v=d.length==3?Math.max(Math.abs(ci(d[2])),1):1,x=bl,$=y<g;$&&(v*=-1,x=wl);var O=d.some(yl);m=[];for(var G=g;x(G,y)&&m.length<e;G+=v){var T;if(u)T=String.fromCharCode(G),T==="\\"&&(T="");else if(T=String(G),O){var Fe=b-T.length;if(Fe>0){var We=new Array(Fe+1).join("0");G<0?T="-"+We+T.slice(1):T=We+T}}m.push(T)}}else{m=[];for(var le=0;le<d.length;le++)m.push.apply(m,bt(d[le],e,!1))}for(var le=0;le<m.length;le++)for(var a=0;a<o.length&&s.length<e;a++){var l=r+m[le]+o[a];(!t||f||l)&&s.push(l)}}return s}});var en=S(Qi(),1),{program:Kh,createCommand:Xh,createArgument:Zh,createOption:Qh,CommanderError:eu,InvalidArgumentError:tu,InvalidOptionArgumentError:su,Command:tn,Argument:iu,Option:nu,Help:ru}=en.default;var sr=S(require("http")),P=S(require("fs")),R=S(require("path")),ir=S(require("os")),nr=S(He());Re();V();var pe=S(Zn()),c={dim:n=>pe.default.dim(n),bold:n=>pe.default.bold(n),accent:n=>pe.default.hex("#C4441A")(n),green:n=>pe.default.green(n),red:n=>pe.default.red(n),yellow:n=>pe.default.yellow(n),cyan:n=>pe.default.cyan(n),white:n=>pe.default.white(n)};function C(){return`${c.bold("hold your ")}${c.accent("voice")}`}function Qn(n){let e=n.severity==="red"?c.red("\u25CF"):c.yellow("\u25CF"),t=c.dim(`${n.file}:${n.line}`),s=c.dim(n.pattern);console.log(` ${e} ${t} ${s}`),console.log(` ${n.excerpt}`)}function er(n){if(console.log(""),console.log(` ${c.bold("scanned")} ${c.cyan(String(n.files))} files, ${c.cyan(String(n.total_lines))} lines`),n.red+n.yellow===0)console.log(` ${c.green("\u2713 clean \u2014 no issues found")}`);else{let e=[];n.red&&e.push(c.red(`${n.red} critical`)),n.yellow&&e.push(c.yellow(`${n.yellow} advisory`)),console.log(` ${e.join(", ")}`)}}var Pe=process.env.HYV_BASE_URL||"https://holdyourvoice.com",Ge=ir.homedir(),tr=process.platform==="win32",li=R.join(Ge,".hyv"),Je=R.join(li,"voice.md"),mt=`# Hold Your Voice
32
32
 
33
33
  The user's voice profile is at \`~/.hyv/voice.md\`. Read it before rewriting.
34
34
 
@@ -56,17 +56,17 @@ hyv scan <file.md>
56
56
  - Preserve original meaning. Match the voice profile's rhythm, vocabulary, patterns.
57
57
  - If no profile specified, check \`.hyv.yml\` or ask the user.
58
58
  - If CLI not installed: \`npm i -g @holdyourvoice/hyv\` then \`hyv init\`
59
- `;function Je(n){P.existsSync(n)||P.mkdirSync(n,{recursive:!0})}function mt(n,e,t="Hold Your Voice"){return P.existsSync(n)?P.readFileSync(n,"utf-8").includes(t)?!1:(P.appendFileSync(n,`
59
+ `;function Ye(n){P.existsSync(n)||P.mkdirSync(n,{recursive:!0})}function yt(n,e,t="Hold Your Voice"){return P.existsSync(n)?P.readFileSync(n,"utf-8").includes(t)?!1:(P.appendFileSync(n,`
60
60
 
61
- `+e),!0):(Je(R.dirname(n)),P.writeFileSync(n,e),!0)}async function ol(){Je(ai);try{let e=(await k("/cli/profiles")).profiles||[];if(e.length===0)return!1;let t=[`# Voice Profile
62
- `];for(let s of e)t.push(`## ${s.name}${s.is_default?" (default)":""}`),s.brand&&t.push(`Brand: ${s.brand}`),s.description&&t.push(s.description),s.keywords?.length&&t.push(`Keywords: ${s.keywords.join(", ")}`),t.push("");return P.writeFileSync(Ge,t.join(`
63
- `)),!0}catch{return!1}}function al(){if(P.existsSync(Ge))return;Je(ai);let n=`# Voice Profile
61
+ `+e),!0):(Ye(R.dirname(n)),P.writeFileSync(n,e),!0)}async function al(){Ye(li);try{let e=(await E("/cli/profiles")).profiles||[];if(e.length===0)return!1;let t=[`# Voice Profile
62
+ `];for(let s of e)t.push(`## ${s.name}${s.is_default?" (default)":""}`),s.brand&&t.push(`Brand: ${s.brand}`),s.description&&t.push(s.description),s.keywords?.length&&t.push(`Keywords: ${s.keywords.join(", ")}`),t.push("");return P.writeFileSync(Je,t.join(`
63
+ `)),!0}catch{return!1}}function ll(){if(P.existsSync(Je))return;Ye(li);let n=`# Voice Profile
64
64
 
65
65
  This file is your cross-platform voice profile.
66
66
  All agents (Claude, ChatGPT, Codex, Cursor) read this file when rewriting in your voice.
67
67
 
68
68
  Run \`hyv export claude -o ~/.hyv/voice.md\` to populate with your actual voice profile.
69
- Or create a voice profile at: ${Te}/app/voice
69
+ Or create a voice profile at: ${Pe}/app/voice
70
70
 
71
71
  ## Instructions for agents
72
72
 
@@ -74,64 +74,68 @@ When the user asks to rewrite text "in my voice":
74
74
  1. Read this file for voice context
75
75
  2. Run: hyv rewrite --text "text to rewrite"
76
76
  3. Execute the rewrite from the prompt output
77
- `;P.writeFileSync(Ge,n)}function ll(){let n=R.join(ze,"Library","Application Support","Claude"),e=R.join(n,"claude_desktop_config.json"),t=R.join(ze,"AppData","Roaming","Claude"),s=R.join(t,"claude_desktop_config.json"),i=er?s:e;if(!P.existsSync(er?t:n))return!1;let o={};if(P.existsSync(i))try{o=JSON.parse(P.readFileSync(i,"utf-8"))}catch{o={}}if(o.mcpServers||(o.mcpServers={}),o.mcpServers.hyv)return!1;o.mcpServers.hyv={command:"hyv",args:["mcp"]};try{return P.writeFileSync(i,JSON.stringify(o,null,2)),!0}catch{return!1}}function cl(){let n=R.join(ze,".chatgpt");Je(n);let e=`Hold Your Voice \u2014 Voice Profile Integration
77
+ `;P.writeFileSync(Je,n)}function cl(){let n=R.join(Ge,"Library","Application Support","Claude"),e=R.join(n,"claude_desktop_config.json"),t=R.join(Ge,"AppData","Roaming","Claude"),s=R.join(t,"claude_desktop_config.json"),i=tr?s:e;if(!P.existsSync(tr?t:n))return!1;let o={};if(P.existsSync(i))try{o=JSON.parse(P.readFileSync(i,"utf-8"))}catch{o={}}if(o.mcpServers||(o.mcpServers={}),o.mcpServers.hyv)return!1;o.mcpServers.hyv={command:"hyv",args:["mcp"]};try{return P.writeFileSync(i,JSON.stringify(o,null,2)),!0}catch{return!1}}function hl(){let n=R.join(Ge,".chatgpt");Ye(n);let e=`Hold Your Voice \u2014 Voice Profile Integration
78
78
 
79
- The user's voice profile is at: ${Ge}
79
+ The user's voice profile is at: ${Je}
80
80
 
81
81
  When the user says "rewrite in my voice" or mentions "hyv" or "brand voice":
82
- 1. Ask the user to paste their voice profile from ${Ge}
82
+ 1. Ask the user to paste their voice profile from ${Je}
83
83
  2. Rewrite their text matching the profile's rhythm, vocabulary, and patterns
84
84
  3. Never use AI-slop words (delve, leverage, tapestry, foster, harness, pivotal)
85
85
  4. Preserve original meaning exactly
86
86
  5. Remove patterns like "not just X, but Y" and "the truth is"
87
- `,t=R.join(n,"hyv-instructions.txt");return P.writeFileSync(t,e),!0}function hl(){let n=process.cwd(),e=[],t=[],s=[{dir:R.join(n,".claude","commands"),scope:"project"},{dir:R.join(ze,".claude","commands"),scope:"global"}];for(let{dir:l,scope:h}of s){Je(l);let u=R.join(l,"hyv.md");mt(u,gt)&&e.push(`claude-code (${h})`)}let i=R.join(n,"CLAUDE.md");mt(i,gt)&&e.push("CLAUDE.md");let r=[{file:R.join(n,"AGENTS.md"),scope:"project"},{file:R.join(ze,".codex","AGENTS.md"),scope:"global"}];for(let{file:l,scope:h}of r)Je(R.dirname(l)),mt(l,gt)&&e.push(`codex (${h})`);let o=R.join(n,".cursorrules");mt(o,gt)&&e.push("cursor");let a=R.join(n,".windsurfrules");return mt(a,gt)&&e.push("windsurf"),ll()&&e.push("claude-desktop (mcp)"),cl()&&t.push("chatgpt"),{installed:e,needsConfig:t}}async function nr(n,e){if(e?.quiet||console.log(`
87
+ `,t=R.join(n,"hyv-instructions.txt");return P.writeFileSync(t,e),!0}function ul(){let n=process.cwd(),e=[],t=[],s=[{dir:R.join(n,".claude","commands"),scope:"project"},{dir:R.join(Ge,".claude","commands"),scope:"global"}];for(let{dir:l,scope:h}of s){Ye(l);let u=R.join(l,"hyv.md");yt(u,mt)&&e.push(`claude-code (${h})`)}let i=R.join(n,"CLAUDE.md");yt(i,mt)&&e.push("CLAUDE.md");let r=[{file:R.join(n,"AGENTS.md"),scope:"project"},{file:R.join(Ge,".codex","AGENTS.md"),scope:"global"}];for(let{file:l,scope:h}of r)Ye(R.dirname(l)),yt(l,mt)&&e.push(`codex (${h})`);let o=R.join(n,".cursorrules");yt(o,mt)&&e.push("cursor");let a=R.join(n,".windsurfrules");return yt(a,mt)&&e.push("windsurf"),cl()&&e.push("claude-desktop (mcp)"),hl()&&t.push("chatgpt"),{installed:e,needsConfig:t}}async function rr(n,e){if(e?.quiet||console.log(`
88
88
  ${C()}
89
- `),e?.key){await ul(e.key),await oi(n,e?.quiet);return}let t=xe();if(t)try{await k("/cli/heartbeat"),e?.quiet||console.log(` ${c.green("\u2713")} already authenticated as ${c.dim(t.user_email||"unknown")}`),n&&(Ys({profile:n}),e?.quiet||console.log(` ${c.green("\u2713")} default profile set to ${c.bold(n)}`)),await oi(n,e?.quiet);return}catch{e?.quiet||console.log(` ${c.dim("credentials expired, re-authenticating...")}`)}let s=tr.createServer(),i=await new Promise(a=>{s.listen(0,"127.0.0.1",()=>{a(s.address().port)})});e?.quiet||(console.log(" opening browser for authentication..."),console.log(` ${c.dim("if the browser doesn't open, visit the URL manually")}
90
- `));let r=`${Te}/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,f)=>{let p=new URL(u.url||"/",`http://127.0.0.1:${i}`),d=p.searchParams.get("token"),m=p.searchParams.get("email"),g=p.searchParams.get("name"),y=p.searchParams.get("error");if(y){f.writeHead(302,{Location:`${Te}/dashboard?cli_error=${encodeURIComponent(y)}`}),f.end(),clearTimeout(h),s.close(),l(new Error(y));return}if(d){f.writeHead(200,{"Content-Type":"text/html"}),f.end(`<!DOCTYPE html><html><body style="font-family:sans-serif;text-align:center;padding:60px">
89
+ `),e?.key){await fl(e.key),await ai(n,e?.quiet);return}let t=xe();if(t)try{await E("/cli/heartbeat"),e?.quiet||console.log(` ${c.green("\u2713")} already authenticated as ${c.dim(t.user_email||"unknown")}`),n&&(Ks({profile:n}),e?.quiet||console.log(` ${c.green("\u2713")} default profile set to ${c.bold(n)}`)),await ai(n,e?.quiet);return}catch{e?.quiet||console.log(` ${c.dim("credentials expired, re-authenticating...")}`)}let s=sr.createServer(),i=await new Promise(a=>{s.listen(0,"127.0.0.1",()=>{a(s.address().port)})});e?.quiet||(console.log(" opening browser for authentication..."),console.log(` ${c.dim("if the browser doesn't open, visit the URL manually")}
90
+ `));let r=`${Pe}/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,f)=>{let p=new URL(u.url||"/",`http://127.0.0.1:${i}`),d=p.searchParams.get("token"),m=p.searchParams.get("email"),g=p.searchParams.get("name"),y=p.searchParams.get("error");if(y){f.writeHead(302,{Location:`${Pe}/dashboard?cli_error=${encodeURIComponent(y)}`}),f.end(),clearTimeout(h),s.close(),l(new Error(y));return}if(d){f.writeHead(200,{"Content-Type":"text/html"}),f.end(`<!DOCTYPE html><html><body style="font-family:sans-serif;text-align:center;padding:60px">
91
91
  <h2 style="color:#1A7A4A">\u2713 authenticated</h2>
92
92
  <p>you can close this tab and return to your terminal.</p>
93
93
  <script>setTimeout(() => window.close(), 2000)</script>
94
- </body></html>`),clearTimeout(h),s.close(),a({api_key:d,email:m||"",name:g||""});return}f.writeHead(302,{Location:r}),f.end()})});try{await(0,ir.default)(r)}catch{e?.quiet||(console.log(` ${c.yellow("!")} couldn't open browser. visit:`),console.log(` ${c.cyan(r)}
95
- `))}try{let{api_key:a,email:l,name:h}=await o;Bt({api_key:a,base_url:Te,user_email:l,user_name:h}),e?.quiet||console.log(` ${c.green("\u2713")} authenticated as ${c.bold(l||h)}`);try{let u=await k("/cli/heartbeat");e?.quiet||(u.plan==="none"||u.status==="none"?(console.log(` ${c.yellow("!")} no active subscription`),console.log(` ${c.dim("visit")} ${c.cyan(`${Te}/dashboard`)} ${c.dim("to subscribe")}`)):console.log(` ${c.green("\u2713")} plan: ${c.bold(u.plan)}`))}catch{}n&&(Ys({profile:n}),e?.quiet||console.log(` ${c.green("\u2713")} default profile set to ${c.bold(n)}`)),await oi(n,e?.quiet)}catch(a){console.log(`
96
- ${c.red("\u2717")} authentication failed: ${a.message}`),process.exit(1)}}async function oi(n,e){await ol()||al(),e||console.log(` ${c.green("\u2713")} voice profile: ${c.dim(Ge)}`);let{installed:s,needsConfig:i}=hl();if(!e){if(s.length>0){console.log(`
94
+ </body></html>`),clearTimeout(h),s.close(),a({api_key:d,email:m||"",name:g||""});return}f.writeHead(302,{Location:r}),f.end()})});try{await(0,nr.default)(r)}catch{e?.quiet||(console.log(` ${c.yellow("!")} couldn't open browser. visit:`),console.log(` ${c.cyan(r)}
95
+ `))}try{let{api_key:a,email:l,name:h}=await o;Bt({api_key:a,base_url:Pe,user_email:l,user_name:h}),e?.quiet||console.log(` ${c.green("\u2713")} authenticated as ${c.bold(l||h)}`);try{let u=await E("/cli/heartbeat");e?.quiet||(u.plan==="none"||u.status==="none"?(console.log(` ${c.yellow("!")} no active subscription`),console.log(` ${c.dim("visit")} ${c.cyan(`${Pe}/dashboard`)} ${c.dim("to subscribe")}`)):console.log(` ${c.green("\u2713")} plan: ${c.bold(u.plan)}`))}catch{}n&&(Ks({profile:n}),e?.quiet||console.log(` ${c.green("\u2713")} default profile set to ${c.bold(n)}`)),await ai(n,e?.quiet)}catch(a){console.log(`
96
+ ${c.red("\u2717")} authentication failed: ${a.message}`),process.exit(1)}}async function ai(n,e){await al()||ll(),e||console.log(` ${c.green("\u2713")} voice profile: ${c.dim(Je)}`);let{installed:s,needsConfig:i}=ul();if(!e){if(s.length>0){console.log(`
97
97
  ${c.green("\u2713")} connected to:`);for(let r of s)console.log(` ${c.dim("\u2192")} ${r}`)}if(i.includes("chatgpt")){console.log(`
98
- ${c.cyan("\u2192")} opening chatgpt connector settings...`),console.log(` ${c.dim("add server:")} ${c.cyan("https://holdyourvoice.com/mcp")}`),console.log(` ${c.dim("auth: your CLI key will be used automatically")}`);try{let r=(await Promise.resolve().then(()=>S(Ve()))).default;await r("https://chatgpt.com/#settings/Connectors")}catch{}}console.log(`
99
- ${c.dim('say "rewrite in my voice" in any connected agent to get started')}`)}}async function ul(n){Bt({api_key:n,base_url:Te});try{let e=await k("/cli/heartbeat");Bt({api_key:n,base_url:Te,user_email:e.email,user_name:e.name}),console.log(` ${c.green("\u2713")} authenticated with license key`)}catch(e){console.log(` ${c.red("\u2717")} invalid license key: ${e.message}`),process.exit(1)}}var ot=S(require("fs")),ki=S(require("path"));var Er=S(yr(),1);var bt=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var wl={"[: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]},wt=n=>n.replace(/[[\]\\-]/g,"\\$&"),vl=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),br=n=>n.join(""),wr=(n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=t+1,o=!1,a=!1,l=!1,h=!1,u=t,f="";e:for(;r<n.length;){let g=n.charAt(r);if((g==="!"||g==="^")&&r===t+1){h=!0,r++;continue}if(g==="]"&&o&&!l){u=r+1;break}if(o=!0,g==="\\"&&!l){l=!0,r++;continue}if(g==="["&&!l){for(let[y,[b,v,x]]of Object.entries(wl))if(n.startsWith(y,r)){if(f)return["$.",!1,n.length-t,!0];r+=y.length,x?i.push(b):s.push(b),a=a||v;continue e}}if(l=!1,f){g>f?s.push(wt(f)+"-"+wt(g)):g===f&&s.push(wt(g)),f="",r++;continue}if(n.startsWith("-]",r+1)){s.push(wt(g+"-")),r+=2;continue}if(n.startsWith("-",r+1)){f=g,r+=2;continue}s.push(wt(g)),r++}if(u<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!h){let g=s[0].length===2?s[0].slice(-1):s[0];return[vl(g),!1,u-t,!1]}let p="["+(h?"^":"")+br(s)+"]",d="["+(h?"":"^")+br(i)+"]";return[s.length&&i.length?"("+p+"|"+d+")":s.length?p:d,a,u-t,!0]};var ie=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var z,xl=new Set(["!","?","+","*","@"]),hi=n=>xl.has(n),vr=n=>hi(n.type),Sl=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),$l=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),_l=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),xr=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Cl="(?!(?:^|/)\\.\\.?(?:$|/))",Zt="(?!\\.)",El=new Set(["[","."]),Ol=new Set(["..","."]),kl=new Set("().*{}+?[]^$\\!"),Al=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ui="[^/]",Sr=ui+"*?",$r=ui+"+?",Pe=class{type;#e;#s;#n=!1;#t=[];#o;#x;#c;#u=!1;#l;#a;#r=!1;constructor(e,t,s={}){this.type=e,e&&(this.#s=!0),this.#o=t,this.#e=this.#o?this.#o.#e:this,this.#l=this.#e===this?s:this.#e.#l,this.#c=this.#e===this?[]:this.#e.#c,e==="!"&&!this.#e.#u&&this.#c.push(this),this.#x=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#s!==void 0)return this.#s;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#s=!0;return this.#s}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#a=this.#t.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#c.pop();){if(e.type!=="!")continue;let t=e,s=t.#o;for(;s;){for(let i=t.#x+1;!s.type&&i<s.#t.length;i++)for(let r of e.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#t[i])}t=s,s=t.#o}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof z&&t.#o===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#x===0)return!0;let e=this.#o;for(let t=0;t<this.#x;t++){let s=e.#t[t];if(!(s instanceof z&&s.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#t.length:0;return this.#x===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new z(this.type,e);for(let s of this.#t)t.copyIn(s);return t}static#b(e,t,s,i,r){let o=i.maxExtglobRecursion??2,a=!1,l=!1,h=-1,u=!1;if(t.type===null){let g=s,y="";for(;g<e.length;){let b=e.charAt(g++);if(a||b==="\\"){a=!a,y+=b;continue}if(l){g===h+1?(b==="^"||b==="!")&&(u=!0):b==="]"&&!(g===h+2&&u)&&(l=!1),y+=b;continue}else if(b==="["){l=!0,h=g,u=!1,y+=b;continue}if(!i.noext&&hi(b)&&e.charAt(g)==="("&&r<=o){t.push(y),y="";let x=new z(b,t);g=z.#b(e,x,g,i,r+1),t.push(x);continue}y+=b}return t.push(y),g}let f=s+1,p=new z(null,t),d=[],m="";for(;f<e.length;){let g=e.charAt(f++);if(a||g==="\\"){a=!a,m+=g;continue}if(l){f===h+1?(g==="^"||g==="!")&&(u=!0):g==="]"&&!(f===h+2&&u)&&(l=!1),m+=g;continue}else if(g==="["){l=!0,h=f,u=!1,m+=g;continue}if(hi(g)&&e.charAt(f)==="("&&(r<=o||t&&t.#S(g))){let b=t&&t.#S(g)?0:1;p.push(m),m="";let v=new z(g,p);p.push(v),f=z.#b(e,v,f,i,r+b);continue}if(g==="|"){p.push(m),m="",d.push(p),p=new z(null,t);continue}if(g===")")return m===""&&t.#t.length===0&&(t.#r=!0),p.push(m),m="",t.push(...d,p),f;m+=g}return t.type=null,t.#s=void 0,t.#t=[e.substring(s-1)],f}#g(e){return this.#d(e,$l)}#d(e,t=Sl){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let s=e.#t[0];return!s||typeof s!="object"||s.type===null?!1:this.#S(s.type,t)}#S(e,t=_l){return!!t.get(this.type)?.includes(e)}#p(e,t){let s=e.#t[0],i=new z(null,s,this.options);i.#t.push(""),s.push(i),this.#_(e,t)}#_(e,t){let s=e.#t[0];this.#t.splice(t,1,...s.#t);for(let i of s.#t)typeof i=="object"&&(i.#o=this);this.#a=void 0}#C(e){return!!xr.get(this.type)?.has(e)}#m(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#C(t.type)}#$(e){let t=xr.get(this.type),s=e.#t[0],i=t?.get(s.type);if(!i)return!1;this.#t=s.#t;for(let r of this.#t)typeof r=="object"&&(r.#o=this);this.type=i,this.#a=void 0,this.#r=!1}#w(){if(vr(this)){let e=0,t=!1;do{t=!0;for(let s=0;s<this.#t.length;s++){let i=this.#t[s];typeof i=="object"&&(i.#w(),this.#d(i)?(t=!1,this.#_(i,s)):this.#g(i)?(t=!1,this.#p(i,s)):this.#m(i)&&(t=!1,this.#$(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#w();this.#a=void 0}static fromGlob(e,t={}){let s=new z(null,void 0,t);return z.#b(e,s,0,t,0),s}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,s,i,r]=this.toRegExpSource();if(!(i||this.#s||this.#l.nocase&&!this.#l.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return s;let a=(this.#l.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#l}toRegExpSource(e){let t=e??!!this.#l.dot;if(this.#e===this&&(this.#w(),this.#y()),!vr(this)){let l=this.isStart()&&this.isEnd(),h=this.#t.map(d=>{let[m,g,y,b]=typeof d=="string"?z.#E(d,this.#s,l):d.toRegExpSource(e);return this.#s=this.#s||y,this.#n=this.#n||b,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Ol.has(this.#t[0]))){let m=El,g=t&&m.has(h.charAt(0))||h.startsWith("\\.")&&m.has(h.charAt(2))||h.startsWith("\\.\\.")&&m.has(h.charAt(4)),y=!t&&!e&&m.has(h.charAt(0));u=g?Cl:y?Zt:""}let f="";return this.isEnd()&&this.#e.#u&&this.#o?.type==="!"&&(f="(?:$|\\/)"),[u+h+f,ie(h),this.#s=!!this.#s,this.#n]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#f(t);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString(),h=this;return h.#t=[l],h.type=null,h.#s=void 0,[l,ie(this.toString()),!1,!1]}let o=!s||e||t||!Zt?"":this.#f(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#r)a=(this.isStart()&&!t?Zt:"")+$r;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Zt:"")+Sr+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+l}return[a,ie(r),this.#s=!!this.#s,this.#n]}#f(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[s,i,r,o]=t.toRegExpSource(e);return this.#n=this.#n||o,s}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#E(e,t,s=!1){let i=!1,r="",o=!1,a=!1;for(let l=0;l<e.length;l++){let h=e.charAt(l);if(i){i=!1,r+=(kl.has(h)?"\\":"")+h,a=!1;continue}if(h==="\\"){l===e.length-1?r+="\\\\":i=!0;continue}if(h==="["){let[u,f,p,d]=wr(e,l);if(p){r+=u,o=o||f,l+=p-1,t=t||d,a=!1;continue}}if(h==="*"){if(a)continue;a=!0,r+=s&&/^[*]+$/.test(e)?$r:Sr,t=!0;continue}else a=!1;if(h==="?"){r+=ui,t=!0;continue}r+=Al(h)}return[r,ie(e),!!t,o]}};z=Pe;var Ye=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var B=(n,e,t={})=>(bt(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Y(e,t).match(n)),Fl=/^\*+([^+@!?\*\[\(]*)$/,jl=n=>e=>!e.startsWith(".")&&e.endsWith(n),Rl=n=>e=>e.endsWith(n),Tl=n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),Pl=n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),Ml=/^\*+\.\*+$/,Il=n=>!n.startsWith(".")&&n.includes("."),Nl=n=>n!=="."&&n!==".."&&n.includes("."),Ll=/^\.\*+$/,Dl=n=>n!=="."&&n!==".."&&n.startsWith("."),Wl=/^\*+$/,Vl=n=>n.length!==0&&!n.startsWith("."),Hl=n=>n.length!==0&&n!=="."&&n!=="..",Bl=/^\?+([^+@!?\*\[\(]*)?$/,ql=([n,e=""])=>{let t=Or([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},Ul=([n,e=""])=>{let t=kr([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},zl=([n,e=""])=>{let t=kr([n]);return e?s=>t(s)&&s.endsWith(e):t},Gl=([n,e=""])=>{let t=Or([n]);return e?s=>t(s)&&s.endsWith(e):t},Or=([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},kr=([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},Ar=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",_r={win32:{sep:"\\"},posix:{sep:"/"}},Jl=Ar==="win32"?_r.win32.sep:_r.posix.sep;B.sep=Jl;var F=Symbol("globstar **");B.GLOBSTAR=F;var Yl="[^/]",Kl=Yl+"*?",Xl="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Zl="(?:(?!(?:\\/|^)\\.).)*?",Ql=(n,e={})=>t=>B(t,n,e);B.filter=Ql;var Q=(n,e={})=>Object.assign({},n,e),ec=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return B;let e=B;return Object.assign((s,i,r={})=>e(s,i,Q(n,r)),{Minimatch:class extends e.Minimatch{constructor(i,r={}){super(i,Q(n,r))}static defaults(i){return e.defaults(Q(n,i)).Minimatch}},AST:class extends e.AST{constructor(i,r,o={}){super(i,r,Q(n,o))}static fromGlob(i,r={}){return e.AST.fromGlob(i,Q(n,r))}},unescape:(s,i={})=>e.unescape(s,Q(n,i)),escape:(s,i={})=>e.escape(s,Q(n,i)),filter:(s,i={})=>e.filter(s,Q(n,i)),defaults:s=>e.defaults(Q(n,s)),makeRe:(s,i={})=>e.makeRe(s,Q(n,i)),braceExpand:(s,i={})=>e.braceExpand(s,Q(n,i)),match:(s,i,r={})=>e.match(s,i,Q(n,r)),sep:e.sep,GLOBSTAR:F})};B.defaults=ec;var Fr=(n,e={})=>(bt(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Er.default)(n));B.braceExpand=Fr;var tc=(n,e={})=>new Y(n,e).makeRe();B.makeRe=tc;var sc=(n,e,t={})=>{let s=new Y(e,t);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(e),n};B.match=sc;var Cr=/[?*]|[+@!]\(.*?\)|\[|\]/,ic=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Y=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){bt(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Ar,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.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 e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...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]==="?"||!Cr.test(r[2]))&&!Cr.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(e){if(this.options.noglobstar)for(let s=0;s<e.length;s++)for(let i=0;i<e[s].length;i++)e[s][i]==="**"&&(e[s][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let s=-1;for(;(s=t.indexOf("**",s+1))!==-1;){let i=s;for(;t[i+1]==="**";)i++;i!==s&&t.splice(s,i-s)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.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)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let r=e[i];i===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let s=0;for(;(s=e.indexOf("..",s+1))!==-1;){let i=e[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(s-1,2),s-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let s of e){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;t=!0,s.splice(i,1);let u=s.slice(0);u[i]="**",e.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==="")&&(t=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(t=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...l),s.length===0&&s.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let s=t+1;s<e.length;s++){let i=this.partsMatch(e[t],e[s],!this.preserveMultipleSlashes);if(i){e[t]=[],e[s]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,s=!1){let i=0,r=0,o=[],a="";for(;i<e.length&&r<t.length;)if(e[i]===t[r])o.push(a==="b"?t[r]:e[i]),i++,r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,r++}else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[r]),i++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,s=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,s++;s&&(this.pattern=e.slice(s)),this.negate=t}matchOne(e,t,s=!1){let i=0,r=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),h=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),u=!h&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),f=l?3:a?0:void 0,p=u?3:h?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[d,m]=[e[f],t[p]];d.toLowerCase()===m.toLowerCase()&&(t[p]=d,r=p,i=f)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(F)?this.#e(e,t,s,i,r):this.#n(e,t,s,i,r)}#e(e,t,s,i,r){let o=t.indexOf(F,r),a=t.lastIndexOf(F),[l,h,u]=s?[t.slice(r,o),t.slice(o+1),[]]:[t.slice(r,o),t.slice(o+1,a),t.slice(a+1)];if(l.length){let v=e.slice(i,i+l.length);if(!this.#n(v,l,s,0,0))return!1;i+=l.length}let f=0;if(u.length){if(u.length+i>e.length)return!1;let v=e.length-u.length;if(this.#n(e,u,s,v,0))f=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(v--,!this.#n(e,u,s,v,0)))return!1;f=u.length+1}}if(!h.length){let v=!!f;for(let x=i;x<e.length-f;x++){let $=String(e[x]);if(v=!0,$==="."||$===".."||!this.options.dot&&$.startsWith("."))return!1}return s||v}let p=[[[],0]],d=p[0],m=0,g=[0];for(let v of h)v===F?(g.push(m),d=[[],0],p.push(d)):(d[0].push(v),m++);let y=p.length-1,b=e.length-f;for(let v of p)v[1]=b-(g[y--]+v[0].length);return!!this.#s(e,p,i,0,s,0,!!f)}#s(e,t,s,i,r,o,a){let l=t[i];if(!l){for(let f=s;f<e.length;f++){a=!0;let p=e[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return a}let[h,u]=l;for(;s<=u;){if(this.#n(e.slice(0,s+h.length),h,r,s,0)&&o<this.maxGlobstarRecursion){let d=this.#s(e,t,s+h.length,i+1,r,o+1,a);if(d!==!1)return d}let p=e[s];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;s++}return r||null}#n(e,t,s,i,r){let o,a,l,h;for(o=i,a=r,h=e.length,l=t.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");let u=t[a],f=e[o];if(this.debug(t,u,f),u===!1||u===F)return!1;let p;if(typeof u=="string"?(p=f===u,this.debug("string match",u,f,p)):(p=u.test(f),this.debug("pattern match",u,f,p)),!p)return!1}if(o===h&&a===l)return!0;if(o===h)return s;if(a===l)return o===h-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Fr(this.pattern,this.options)}parse(e){bt(e);let t=this.options;if(e==="**")return F;if(e==="")return"";let s,i=null;(s=e.match(Wl))?i=t.dot?Hl:Vl:(s=e.match(Fl))?i=(t.nocase?t.dot?Pl:Tl:t.dot?Rl:jl)(s[1]):(s=e.match(Bl))?i=(t.nocase?t.dot?Ul:ql:t.dot?zl:Gl)(s):(s=e.match(Ml))?i=t.dot?Nl:Il:(s=e.match(Ll))&&(i=Dl);let r=Pe.fromGlob(e,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 e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,s=t.noglobstar?Kl:t.dot?Xl:Zl,i=new Set(t.nocase?["i"]:[]),r=e.map(l=>{let h=l.map(u=>{if(u instanceof RegExp)for(let f of u.flags.split(""))i.add(f);return typeof u=="string"?ic(u):u===F?F:u._src});return h.forEach((u,f)=>{let p=h[f+1],d=h[f-1];u!==F||d===F||(d===void 0?p!==void 0&&p!==F?h[f+1]="(?:\\/|"+s+"\\/)?"+p:h[f]=s:p===void 0?h[f-1]=d+"(?:\\/|"+s+")?":p!==F&&(h[f-1]=d+"(?:\\/|\\/"+s+"\\/)"+p,h[f+1]=F))}),h.filter(u=>u!==F).join("/")}).join("|"),[o,a]=e.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(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);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,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return B.defaults(e).Minimatch}};B.AST=Pe;B.Minimatch=Y;B.escape=Ye;B.unescape=ie;var eo=require("node:url");var Ke=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Rr=new Set,fi=typeof process=="object"&&process?process:{},Tr=(n,e,t,s)=>{typeof fi.emitWarning=="function"?fi.emitWarning(n,e,t,s):console.error(`[${t}] ${e}: ${n}`)},Qt=globalThis.AbortController,jr=globalThis.AbortSignal;if(typeof Qt>"u"){jr=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},Qt=class{constructor(){e()}signal=new jr;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=fi.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,Tr("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",e))}}var nc=n=>!Rr.has(n),Ju=Symbol("type"),$e=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),Pr=n=>$e(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Xe:null:null,Xe=class extends Array{constructor(e){super(e),this.fill(0)}},di=class n{heap;length;static#e=!1;static create(e){let t=Pr(e);if(!t)return[];n.#e=!0;let s=new n(e,t);return n.#e=!1,s}constructor(e,t){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},vt=class n{#e;#s;#n;#t;#o;#x;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#l;#a;#r;#y;#b;#g;#d;#S;#p;#_;#C;#m;#$;#w;#f;static unsafeExposeInternals(e){return{starts:e.#C,ttls:e.#m,sizes:e.#_,keyMap:e.#l,keyList:e.#a,valList:e.#r,next:e.#y,prev:e.#b,get head(){return e.#g},get tail(){return e.#d},free:e.#S,isBackgroundFetch:t=>e.#h(t),backgroundFetch:(t,s,i,r)=>e.#L(t,s,i,r),moveToTail:t=>e.#W(t),indexes:t=>e.#k(t),rindexes:t=>e.#A(t),isStale:t=>e.#v(t)}}get max(){return this.#e}get maxSize(){return this.#s}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#x}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:h,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:p,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:y,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:$,allowStaleOnFetchAbort:E,ignoreFetchAbort:G}=e;if(t!==0&&!$e(t))throw new TypeError("max option must be a nonnegative integer");let T=t?Pr(t):Array;if(!T)throw new Error("invalid max value: "+t);if(this.#e=t,this.#s=d,this.maxEntrySize=m||this.#s,this.sizeCalculation=g,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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#x=b,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=y,this.#w=!!y,this.#l=new Map,this.#a=new Array(t).fill(void 0),this.#r=new Array(t).fill(void 0),this.#y=new T(t),this.#b=new T(t),this.#g=0,this.#d=0,this.#S=di.create(t),this.#c=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof u=="function"?(this.#t=u,this.#p=[]):(this.#t=void 0,this.#p=void 0),this.#$=!!this.#n,this.#f=!!this.#t,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!$,this.allowStaleOnFetchAbort=!!E,this.ignoreFetchAbort=!!G,this.maxEntrySize!==0){if(this.#s!==0&&!$e(this.#s))throw new TypeError("maxSize must be a positive integer if specified");if(!$e(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=$e(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!$e(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#E()}if(this.#e===0&&this.ttl===0&&this.#s===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#s){let Fe="LRU_CACHE_UNBOUNDED";nc(Fe)&&(Rr.add(Fe),Tr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Fe,n))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#E(){let e=new Xe(this.#e),t=new Xe(this.#e);this.#m=e,this.#C=t,this.#R=(r,o,a=Ke.now())=>{if(t[r]=o!==0?a:0,e[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#v(r)&&this.#j(this.#a[r],"expire")},o+1);l.unref&&l.unref()}},this.#O=r=>{t[r]=e[r]!==0?Ke.now():0},this.#i=(r,o)=>{if(e[o]){let a=e[o],l=t[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=Ke.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=e[o],l=t[o];if(!a||!l)return 1/0;let h=(s||i())-l;return a-h},this.#v=r=>{let o=t[r],a=e[r];return!!a&&!!o&&(s||i())-o>a}}#O=()=>{};#i=()=>{};#R=()=>{};#v=()=>!1;#F(){let e=new Xe(this.#e);this.#u=0,this.#_=e,this.#T=t=>{this.#u-=e[t],e[t]=0},this.#M=(t,s,i,r)=>{if(this.#h(s))return 0;if(!$e(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,t),!$e(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=(t,s,i)=>{if(e[t]=s,this.#s){let r=this.#s-e[t];for(;this.#u>r;)this.#N(!0)}this.#u+=e[t],i&&(i.entrySize=s,i.totalCalculatedSize=this.#u)}}#T=e=>{};#P=(e,t,s)=>{};#M=(e,t,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#d;!(!this.#I(t)||((e||!this.#v(t))&&(yield t),t===this.#g));)t=this.#b[t]}*#A({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#I(t)||((e||!this.#v(t))&&(yield t),t===this.#d));)t=this.#y[t]}#I(e){return e!==void 0&&this.#l.get(this.#a[e])===e}*entries(){for(let e of this.#k())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*rentries(){for(let e of this.#A())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*keys(){for(let e of this.#k()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*rkeys(){for(let e of this.#A()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*values(){for(let e of this.#k())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}*rvalues(){for(let e of this.#A())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let s of this.#k()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;if(r!==void 0&&e(r,this.#a[s],this))return this.get(this.#a[s],t)}}forEach(e,t=this){for(let s of this.#k()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#a[s],this)}}rforEach(e,t=this){for(let s of this.#A()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#a[s],this)}}purgeStale(){let e=!1;for(let t of this.#A({allowStale:!0}))this.#v(t)&&(this.#j(this.#a[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let s=this.#r[t],i=this.#h(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#m&&this.#C){let o=this.#m[t],a=this.#C[t];if(o&&a){let l=o-(Ke.now()-a);r.ttl=l,r.start=Date.now()}}return this.#_&&(r.size=this.#_[t]),r}dump(){let e=[];for(let t of this.#k({allowStale:!0})){let s=this.#a[t],i=this.#r[t],r=this.#h(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let o={value:r};if(this.#m&&this.#C){o.ttl=this.#m[t];let a=Ke.now()-this.#C[t];o.start=Math.floor(Date.now()-a)}this.#_&&(o.size=this.#_[t]),e.unshift([s,o])}return e}load(e){this.clear();for(let[t,s]of e){if(s.start){let i=Date.now()-s.start;s.start=Ke.now()-i}this.set(t,s.value,s)}}set(e,t,s={}){if(t===void 0)return this.delete(e),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.#M(e,t,s.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#j(e,"set"),this;let f=this.#c===0?void 0:this.#l.get(e);if(f===void 0)f=this.#c===0?this.#d:this.#S.length!==0?this.#S.pop():this.#c===this.#e?this.#N(!1):this.#c,this.#a[f]=e,this.#r[f]=t,this.#l.set(e,f),this.#y[this.#d]=f,this.#b[f]=this.#d,this.#d=f,this.#c++,this.#P(f,u,l),l&&(l.set="add"),h=!1;else{this.#W(f);let p=this.#r[f];if(t!==p){if(this.#w&&this.#h(p)){p.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=p;d!==void 0&&!o&&(this.#$&&this.#n?.(d,e,"set"),this.#f&&this.#p?.push([d,e,"set"]))}else o||(this.#$&&this.#n?.(p,e,"set"),this.#f&&this.#p?.push([p,e,"set"]));if(this.#T(f),this.#P(f,u,l),this.#r[f]=t,l){l.set="replace";let d=p&&this.#h(p)?p.__staleWhileFetching:p;d!==void 0&&(l.oldValue=d)}}else l&&(l.set="update")}if(i!==0&&!this.#m&&this.#E(),this.#m&&(h||this.#R(f,i,r),l&&this.#i(l,f)),!o&&this.#f&&this.#p){let p=this.#p,d;for(;d=p?.shift();)this.#t?.(...d)}return this}pop(){try{for(;this.#c;){let e=this.#r[this.#g];if(this.#N(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#p){let e=this.#p,t;for(;t=e?.shift();)this.#t?.(...t)}}}#N(e){let t=this.#g,s=this.#a[t],i=this.#r[t];return this.#w&&this.#h(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.#T(t),e&&(this.#a[t]=void 0,this.#r[t]=void 0,this.#S.push(t)),this.#c===1?(this.#g=this.#d=0,this.#S.length=0):this.#g=this.#y[t],this.#l.delete(s),this.#c--,t}has(e,t={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=t,r=this.#l.get(e);if(r!==void 0){let o=this.#r[r];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(r))i&&(i.has="stale",this.#i(i,r));else return s&&this.#O(r),i&&(i.has="hit",this.#i(i,r)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:s=this.allowStale}=t,i=this.#l.get(e);if(i===void 0||!s&&this.#v(i))return;let r=this.#r[i];return this.#h(r)?r.__staleWhileFetching:r}#L(e,t,s,i){let r=t===void 0?void 0:this.#r[t];if(this.#h(r))return r;let o=new Qt,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:s,context:i},h=(g,y=!1)=>{let{aborted:b}=o.signal,v=s.ignoreFetchAbort&&g!==void 0;if(s.status&&(b&&!y?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,v&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),b&&!v&&!y)return f(o.signal.reason);let x=d;return this.#r[t]===d&&(g===void 0?x.__staleWhileFetching?this.#r[t]=x.__staleWhileFetching:this.#j(e,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(e,g,l.options))),g},u=g=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=g),f(g)),f=g=>{let{aborted:y}=o.signal,b=y&&s.allowStaleOnFetchAbort,v=b||s.allowStaleOnFetchRejection,x=v||s.noDeleteOnFetchRejection,$=d;if(this.#r[t]===d&&(!x||$.__staleWhileFetching===void 0?this.#j(e,"fetch"):b||(this.#r[t]=$.__staleWhileFetching)),v)return s.status&&$.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),$.__staleWhileFetching;if($.__returned===$)throw g},p=(g,y)=>{let b=this.#o?.(e,r,l);b&&b instanceof Promise&&b.then(v=>g(v===void 0?void 0:v),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(g(void 0),s.allowStaleOnFetchAbort&&(g=v=>h(v,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(p).then(h,u),m=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.set(e,m,{...l.options,status:void 0}),t=this.#l.get(e)):this.#r[t]=m,m}#h(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Qt}async fetch(e,t={}){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:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:g,forceRefresh:y=!1,status:b,signal:v}=t;if(!this.#w)return b&&(b.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:b});let x={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:b,signal:v},$=this.#l.get(e);if($===void 0){b&&(b.fetch="miss");let E=this.#L(e,$,x,g);return E.__returned=E}else{let E=this.#r[$];if(this.#h(E)){let le=s&&E.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",le&&(b.returnedStale=!0)),le?E.__staleWhileFetching:E.__returned=E}let G=this.#v($);if(!y&&!G)return b&&(b.fetch="hit"),this.#W($),i&&this.#O($),b&&this.#i(b,$),E;let T=this.#L(e,$,x,g),De=T.__staleWhileFetching!==void 0&&s;return b&&(b.fetch=G?"stale":"refresh",De&&G&&(b.returnedStale=!0)),De?T.__staleWhileFetching:T.__returned=T}}async forceFetch(e,t={}){let s=await this.fetch(e,t);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,t={}){let s=this.#x;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...o}=t,a=this.get(e,o);if(!r&&a!==void 0)return a;let l=s(e,a,{options:o,context:i});return this.set(e,l,o),l}get(e,t={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#l.get(e);if(a!==void 0){let l=this.#r[a],h=this.#h(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.#j(e,"expire"),o&&s&&(o.returnedStale=!0),s?l:void 0)):(o&&(o.get="hit"),h?l.__staleWhileFetching:(this.#W(a),i&&this.#O(a),l))}else o&&(o.get="miss")}#D(e,t){this.#b[t]=e,this.#y[e]=t}#W(e){e!==this.#d&&(e===this.#g?this.#g=this.#y[e]:this.#D(this.#b[e],this.#y[e]),this.#D(this.#d,e),this.#d=e)}delete(e){return this.#j(e,"delete")}#j(e,t){let s=!1;if(this.#c!==0){let i=this.#l.get(e);if(i!==void 0)if(s=!0,this.#c===1)this.#V(t);else{this.#T(i);let r=this.#r[i];if(this.#h(r)?r.__abortController.abort(new Error("deleted")):(this.#$||this.#f)&&(this.#$&&this.#n?.(r,e,t),this.#f&&this.#p?.push([r,e,t])),this.#l.delete(e),this.#a[i]=void 0,this.#r[i]=void 0,i===this.#d)this.#d=this.#b[i];else if(i===this.#g)this.#g=this.#y[i];else{let o=this.#b[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#b[a]=this.#b[i]}this.#c--,this.#S.push(i)}}if(this.#f&&this.#p?.length){let i=this.#p,r;for(;r=i?.shift();)this.#t?.(...r)}return s}clear(){return this.#V("delete")}#V(e){for(let t of this.#A({allowStale:!0})){let s=this.#r[t];if(this.#h(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#a[t];this.#$&&this.#n?.(s,i,e),this.#f&&this.#p?.push([s,i,e])}}if(this.#l.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#m&&this.#C&&(this.#m.fill(0),this.#C.fill(0)),this.#_&&this.#_.fill(0),this.#g=0,this.#d=0,this.#S.length=0,this.#u=0,this.#c=0,this.#f&&this.#p){let t=this.#p,s;for(;s=t?.shift();)this.#t?.(...s)}}};var et=require("node:path"),qr=require("node:url"),ue=require("fs"),pc=S(require("node:fs"),1),Ee=require("node:fs/promises");var os=require("node:events"),vi=S(require("node:stream"),1),Dr=require("node:string_decoder"),Mr=typeof process=="object"&&process?process:{stdout:null,stderr:null},rc=n=>!!n&&typeof n=="object"&&(n instanceof Ce||n instanceof vi.default||oc(n)||ac(n)),oc=n=>!!n&&typeof n=="object"&&n instanceof os.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==vi.default.Writable.prototype.pipe,ac=n=>!!n&&typeof n=="object"&&n instanceof os.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",ge=Symbol("EOF"),me=Symbol("maybeEmitEnd"),_e=Symbol("emittedEnd"),es=Symbol("emittingEnd"),xt=Symbol("emittedError"),ts=Symbol("closed"),Ir=Symbol("read"),ss=Symbol("flush"),Nr=Symbol("flushChunk"),ne=Symbol("encoding"),Ze=Symbol("decoder"),N=Symbol("flowing"),St=Symbol("paused"),Qe=Symbol("resume"),L=Symbol("buffer"),q=Symbol("pipes"),D=Symbol("bufferLength"),pi=Symbol("bufferPush"),is=Symbol("bufferShift"),V=Symbol("objectMode"),j=Symbol("destroyed"),gi=Symbol("error"),mi=Symbol("emitData"),Lr=Symbol("emitEnd"),yi=Symbol("emitEnd2"),ce=Symbol("async"),bi=Symbol("abort"),ns=Symbol("aborted"),$t=Symbol("signal"),Me=Symbol("dataListeners"),K=Symbol("discarded"),_t=n=>Promise.resolve().then(n),lc=n=>n(),cc=n=>n==="end"||n==="finish"||n==="prefinish",hc=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,uc=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),rs=class{src;dest;opts;ondrain;constructor(e,t,s){this.src=e,this.dest=t,this.opts=s,this.ondrain=()=>e[Qe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},wi=class extends rs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,s){super(e,t,s),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},fc=n=>!!n.objectMode,dc=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",Ce=class extends os.EventEmitter{[N]=!1;[St]=!1;[q]=[];[L]=[];[V];[ne];[ce];[Ze];[ge]=!1;[_e]=!1;[es]=!1;[ts]=!1;[xt]=null;[D]=0;[j]=!1;[$t];[ns]=!1;[Me]=0;[K]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");fc(t)?(this[V]=!0,this[ne]=null):dc(t)?(this[ne]=t.encoding,this[V]=!1):(this[V]=!1,this[ne]=null),this[ce]=!!t.async,this[Ze]=this[ne]?new Dr.StringDecoder(this[ne]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[L]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[q]});let{signal:s}=t;s&&(this[$t]=s,s.aborted?this[bi]():s.addEventListener("abort",()=>this[bi]()))}get bufferLength(){return this[D]}get encoding(){return this[ne]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[V]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ce]}set async(e){this[ce]=this[ce]||!!e}[bi](){this[ns]=!0,this.emit("abort",this[$t]?.reason),this.destroy(this[$t]?.reason)}get aborted(){return this[ns]}set aborted(e){}write(e,t,s){if(this[ns])return!1;if(this[ge])throw new Error("write after end");if(this[j])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(s=t,t="utf8"),t||(t="utf8");let i=this[ce]?_t:lc;if(!this[V]&&!Buffer.isBuffer(e)){if(uc(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(hc(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[V]?(this[N]&&this[D]!==0&&this[ss](!0),this[N]?this.emit("data",e):this[pi](e),this[D]!==0&&this.emit("readable"),s&&i(s),this[N]):e.length?(typeof e=="string"&&!(t===this[ne]&&!this[Ze]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ne]&&(e=this[Ze].write(e)),this[N]&&this[D]!==0&&this[ss](!0),this[N]?this.emit("data",e):this[pi](e),this[D]!==0&&this.emit("readable"),s&&i(s),this[N]):(this[D]!==0&&this.emit("readable"),s&&i(s),this[N])}read(e){if(this[j])return null;if(this[K]=!1,this[D]===0||e===0||e&&e>this[D])return this[me](),null;this[V]&&(e=null),this[L].length>1&&!this[V]&&(this[L]=[this[ne]?this[L].join(""):Buffer.concat(this[L],this[D])]);let t=this[Ir](e||null,this[L][0]);return this[me](),t}[Ir](e,t){if(this[V])this[is]();else{let s=t;e===s.length||e===null?this[is]():typeof s=="string"?(this[L][0]=s.slice(e),t=s.slice(0,e),this[D]-=e):(this[L][0]=s.subarray(e),t=s.subarray(0,e),this[D]-=e)}return this.emit("data",t),!this[L].length&&!this[ge]&&this.emit("drain"),t}end(e,t,s){return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t="utf8"),e!==void 0&&this.write(e,t),s&&this.once("end",s),this[ge]=!0,this.writable=!1,(this[N]||!this[St])&&this[me](),this}[Qe](){this[j]||(!this[Me]&&!this[q].length&&(this[K]=!0),this[St]=!1,this[N]=!0,this.emit("resume"),this[L].length?this[ss]():this[ge]?this[me]():this.emit("drain"))}resume(){return this[Qe]()}pause(){this[N]=!1,this[St]=!0,this[K]=!1}get destroyed(){return this[j]}get flowing(){return this[N]}get paused(){return this[St]}[pi](e){this[V]?this[D]+=1:this[D]+=e.length,this[L].push(e)}[is](){return this[V]?this[D]-=1:this[D]-=this[L][0].length,this[L].shift()}[ss](e=!1){do;while(this[Nr](this[is]())&&this[L].length);!e&&!this[L].length&&!this[ge]&&this.emit("drain")}[Nr](e){return this.emit("data",e),this[N]}pipe(e,t){if(this[j])return e;this[K]=!1;let s=this[_e];return t=t||{},e===Mr.stdout||e===Mr.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,s?t.end&&e.end():(this[q].push(t.proxyErrors?new wi(this,e,t):new rs(this,e,t)),this[ce]?_t(()=>this[Qe]()):this[Qe]()),e}unpipe(e){let t=this[q].find(s=>s.dest===e);t&&(this[q].length===1?(this[N]&&this[Me]===0&&(this[N]=!1),this[q]=[]):this[q].splice(this[q].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let s=super.on(e,t);if(e==="data")this[K]=!1,this[Me]++,!this[q].length&&!this[N]&&this[Qe]();else if(e==="readable"&&this[D]!==0)super.emit("readable");else if(cc(e)&&this[_e])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[xt]){let i=t;this[ce]?_t(()=>i.call(this,this[xt])):i.call(this,this[xt])}return s}removeListener(e,t){return this.off(e,t)}off(e,t){let s=super.off(e,t);return e==="data"&&(this[Me]=this.listeners("data").length,this[Me]===0&&!this[K]&&!this[q].length&&(this[N]=!1)),s}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Me]=0,!this[K]&&!this[q].length&&(this[N]=!1)),t}get emittedEnd(){return this[_e]}[me](){!this[es]&&!this[_e]&&!this[j]&&this[L].length===0&&this[ge]&&(this[es]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ts]&&this.emit("close"),this[es]=!1)}emit(e,...t){let s=t[0];if(e!=="error"&&e!=="close"&&e!==j&&this[j])return!1;if(e==="data")return!this[V]&&!s?!1:this[ce]?(_t(()=>this[mi](s)),!0):this[mi](s);if(e==="end")return this[Lr]();if(e==="close"){if(this[ts]=!0,!this[_e]&&!this[j])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[xt]=s,super.emit(gi,s);let r=!this[$t]||this.listeners("error").length?super.emit("error",s):!1;return this[me](),r}else if(e==="resume"){let r=super.emit("resume");return this[me](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let i=super.emit(e,...t);return this[me](),i}[mi](e){for(let s of this[q])s.dest.write(e)===!1&&this.pause();let t=this[K]?!1:super.emit("data",e);return this[me](),t}[Lr](){return this[_e]?!1:(this[_e]=!0,this.readable=!1,this[ce]?(_t(()=>this[yi]()),!0):this[yi]())}[yi](){if(this[Ze]){let t=this[Ze].end();if(t){for(let s of this[q])s.dest.write(t);this[K]||super.emit("data",t)}}for(let t of this[q])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[V]||(e.dataLength=0);let t=this.promise();return this.on("data",s=>{e.push(s),this[V]||(e.dataLength+=s.length)}),await t,e}async concat(){if(this[V])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ne]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(j,()=>t(new Error("stream destroyed"))),this.on("error",s=>t(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[K]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ge])return t();let r,o,a=f=>{this.off("data",l),this.off("end",h),this.off(j,u),t(),o(f)},l=f=>{this.off("error",a),this.off("end",h),this.off(j,u),this.pause(),r({value:f,done:!!this[ge]})},h=()=>{this.off("error",a),this.off("data",l),this.off(j,u),t(),r({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((f,p)=>{o=p,r=f,this.once(j,u),this.once("error",a),this.once("end",h),this.once("data",l)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[K]=!1;let e=!1,t=()=>(this.pause(),this.off(gi,t),this.off(j,t),this.off("end",t),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}};return this.once("end",t),this.once(gi,t),this.once(j,t),{next:s,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[j])return e?this.emit("error",e):this.emit(j),this;this[j]=!0,this[K]=!0,this[L].length=0,this[D]=0;let t=this;return typeof t.close=="function"&&!this[ts]&&t.close(),e?this.emit("error",e):this.emit(j),this}static get isStream(){return rc}};var gc=ue.realpathSync.native,Et={lstatSync:ue.lstatSync,readdir:ue.readdir,readdirSync:ue.readdirSync,readlinkSync:ue.readlinkSync,realpathSync:gc,promises:{lstat:Ee.lstat,readdir:Ee.readdir,readlink:Ee.readlink,realpath:Ee.realpath}},Ur=n=>!n||n===Et||n===pc?Et:{...Et,...n,promises:{...Et.promises,...n.promises||{}}},zr=/^\\\\\?\\([a-z]:)\\?$/i,mc=n=>n.replace(/\//g,"\\").replace(zr,"$1\\"),yc=/[\\\/]/,te=0,Gr=1,Jr=2,he=4,Yr=6,Kr=8,Ie=10,Xr=12,ee=15,Ct=~ee,xi=16,Wr=32,Ot=64,re=128,as=256,cs=512,Vr=Ot|re|cs,bc=1023,Si=n=>n.isFile()?Kr:n.isDirectory()?he:n.isSymbolicLink()?Ie:n.isCharacterDevice()?Jr:n.isBlockDevice()?Yr:n.isSocket()?Xr:n.isFIFO()?Gr:te,Hr=new Map,kt=n=>{let e=Hr.get(n);if(e)return e;let t=n.normalize("NFKD");return Hr.set(n,t),t},Br=new Map,ls=n=>{let e=Br.get(n);if(e)return e;let t=kt(n.toLowerCase());return Br.set(n,t),t},hs=class extends vt{constructor(){super({max:256})}},$i=class extends vt{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Zr=Symbol("PathScurry setAsCwd"),H=class{name;root;roots;parent;nocase;isCWD=!1;#e;#s;get dev(){return this.#s}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#o;get uid(){return this.#o}#x;get gid(){return this.#x}#c;get rdev(){return this.#c}#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}#b;get mtimeMs(){return this.#b}#g;get ctimeMs(){return this.#g}#d;get birthtimeMs(){return this.#d}#S;get atime(){return this.#S}#p;get mtime(){return this.#p}#_;get ctime(){return this.#_}#C;get birthtime(){return this.#C}#m;#$;#w;#f;#E;#O;#i;#R;#v;#F;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=te,s,i,r,o,a){this.name=e,this.#m=r?ls(e):kt(e),this.#i=t&bc,this.nocase=r,this.roots=i,this.root=s||this,this.#R=o,this.#w=a.fullpath,this.#E=a.relative,this.#O=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=Ur(a.fs)}depth(){return this.#$!==void 0?this.#$:this.parent?this.#$=this.parent.depth()+1:this.#$=0}childrenCache(){return this.#R}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#T(i):this.#T(i)}#T(e){let t=this;for(let s of e)t=t.child(s);return t}children(){let e=this.#R.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#R.set(this,t),this.#i&=~xi,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let s=this.children(),i=this.nocase?ls(e):kt(e);for(let l of s)if(l.#m===i)return l;let r=this.parent?this.sep:"",o=this.#w?this.#w+r+e:void 0,a=this.newChild(e,te,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=re),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#E!==void 0)return this.#E;let e=this.name,t=this.parent;if(!t)return this.#E=this.name;let s=t.relative();return s+(!s||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let e=this.name,t=this.parent;if(!t)return this.#O=this.fullpathPosix();let s=t.relativePosix();return s+(!s||!t.parent?"":"/")+e}fullpath(){if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#w=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 e=this.parent,t=e.fullpathPosix(),s=t+(!t||!e.parent?"":"/")+this.name;return this.#f=s}isUnknown(){return(this.#i&ee)===te}isType(e){return this[`is${e}`]()}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&ee)===Kr}isDirectory(){return(this.#i&ee)===he}isCharacterDevice(){return(this.#i&ee)===Jr}isBlockDevice(){return(this.#i&ee)===Yr}isFIFO(){return(this.#i&ee)===Gr}isSocket(){return(this.#i&ee)===Xr}isSymbolicLink(){return(this.#i&Ie)===Ie}lstatCached(){return this.#i&Wr?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#F}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let e=this.#i&ee;return!(e!==te&&e!==Ie||this.#i&as||this.#i&re)}calledReaddir(){return!!(this.#i&xi)}isENOENT(){return!!(this.#i&re)}isNamed(e){return this.nocase?this.#m===ls(e):this.#m===kt(e)}async readlink(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(t);if(s)return this.#v=s}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(t);if(s)return this.#v=s}catch(t){this.#h(t.code);return}}#P(e){this.#i|=xi;for(let t=e.provisional;t<e.length;t++){let s=e[t];s&&s.#M()}}#M(){this.#i&re||(this.#i=(this.#i|re)&Ct,this.#k())}#k(){let e=this.children();e.provisional=0;for(let t of e)t.#M()}#A(){this.#i|=cs,this.#I()}#I(){if(this.#i&Ot)return;let e=this.#i;(e&ee)===he&&(e&=Ct),this.#i=e|Ot,this.#k()}#N(e=""){e==="ENOTDIR"||e==="EPERM"?this.#I():e==="ENOENT"?this.#M():this.children().provisional=0}#L(e=""){e==="ENOTDIR"?this.parent.#I():e==="ENOENT"&&this.#M()}#h(e=""){let t=this.#i;t|=as,e==="ENOENT"&&(t|=re),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Ct),this.#i=t,e==="ENOTDIR"&&this.parent&&this.parent.#I()}#D(e,t){return this.#j(e,t)||this.#W(e,t)}#W(e,t){let s=Si(e),i=this.newChild(e.name,s,{parent:this}),r=i.#i&ee;return r!==he&&r!==Ie&&r!==te&&(i.#i|=Ot),t.unshift(i),t.provisional++,i}#j(e,t){for(let s=t.provisional;s<t.length;s++){let i=t[s];if((this.nocase?ls(e.name):kt(e.name))===i.#m)return this.#V(e,i,s,t)}}#V(e,t,s,i){let r=t.name;return t.#i=t.#i&Ct|Si(e),r!==e.name&&(t.name=e.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(t)),i.provisional++,t}async lstat(){if(!(this.#i&re))try{return this.#U(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#L(e.code)}}lstatSync(){if(!(this.#i&re))try{return this.#U(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#L(e.code)}}#U(e){let{atime:t,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:h,dev:u,gid:f,ino:p,mode:d,mtime:m,mtimeMs:g,nlink:y,rdev:b,size:v,uid:x}=e;this.#S=t,this.#y=s,this.#C=i,this.#d=r,this.#u=o,this.#r=a,this.#_=l,this.#g=h,this.#s=u,this.#x=f,this.#l=p,this.#n=d,this.#p=m,this.#b=g,this.#t=y,this.#c=b,this.#a=v,this.#o=x;let $=Si(e);this.#i=this.#i&Ct|$|Wr,$!==te&&$!==he&&$!==Ie&&(this.#i|=Ot)}#B=[];#q=!1;#z(e){this.#q=!1;let t=this.#B.slice();this.#B.length=0,t.forEach(s=>s(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#B.push(e),this.#q)return;this.#q=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#N(r.code),s.provisional=0;else{for(let a of o)this.#D(a,s);this.#P(s)}this.#z(s.slice(0,s.provisional))})}#H;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=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.#e.promises.readdir(t,{withFileTypes:!0}))this.#D(i,e);this.#P(e)}catch(i){this.#N(i.code),e.provisional=0}this.#H=void 0,s()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let s of this.#e.readdirSync(t,{withFileTypes:!0}))this.#D(s,e);this.#P(e)}catch(s){this.#N(s.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&Vr)return!1;let e=ee&this.#i;return e===te||e===he||e===Ie}shouldWalk(e,t){return(this.#i&he)===he&&!(this.#i&Vr)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#F)return this.#F;if(!((cs|as|re)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#F=this.resolve(e)}catch{this.#A()}}realpathSync(){if(this.#F)return this.#F;if(!((cs|as|re)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#F=this.resolve(e)}catch{this.#A()}}[Zr](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),s=[],i=this;for(;i&&i.parent;)t.add(i),i.#E=s.join(this.sep),i.#O=s.join("/"),i=i.parent,s.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#E=void 0,i.#O=void 0,i=i.parent}},us=class n extends H{sep="\\";splitSep=yc;constructor(e,t=te,s,i,r,o,a){super(e,t,s,i,r,o,a)}newChild(e,t=te,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(e){return et.win32.parse(e).root}getRoot(e){if(e=mc(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,s]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=s;return this.roots[e]=new tt(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(zr,"$1\\"),e===t}},fs=class n extends H{splitSep="/";sep="/";constructor(e,t=te,s,i,r,o,a){super(e,t,s,i,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=te,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ds=class{root;rootPath;roots;cwd;#e;#s;#n;nocase;#t;constructor(e=process.cwd(),t,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=Et}={}){this.#t=Ur(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,qr.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new hs,this.#s=new hs,this.#n=new $i(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.#t),this.roots[this.rootPath]=this.root;let h=this.root,u=l.length-1,f=t.sep,p=this.rootPath,d=!1;for(let m of l){let g=u--;h=h.child(m,{relative:new Array(g).fill("..").join(f),relativePosix:new Array(g).fill("..").join("/"),fullpath:p+=(d?"":f)+m}),d=!0}this.cwd=h}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#e.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#s.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpathPosix();return this.#s.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd);let{withFileTypes:s}=t;if(e.canReaddir()){let i=await e.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd);let{withFileTypes:s=!0}=t;return e.canReaddir()?s?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e.withFileTypes,e=this.cwd);let s=await e.readlink();return t?s:s?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e.withFileTypes,e=this.cwd);let s=e.readlinkSync();return t?s:s?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e.withFileTypes,e=this.cwd);let s=await e.realpath();return t?s:s?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e.withFileTypes,e=this.cwd);let s=e.realpathSync();return t?s:s?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set,h=(f,p)=>{l.add(f),f.readdirCB((d,m)=>{if(d)return p(d);let g=m.length;if(!g)return p();let y=()=>{--g===0&&p()};for(let b of m)(!r||r(b))&&a.push(s?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(l,o)?h(v,y):y()):b.shouldWalk(l,o)?h(b,y):y()},!0)},u=e;return new Promise((f,p)=>{h(u,d=>{if(d)return p(d);f(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set([e]);for(let h of l){let u=h.readdirSync();for(let f of u){(!r||r(f))&&a.push(s?f:f.fullpath());let p=f;if(f.isSymbolicLink()){if(!(i&&(p=f.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield s?e:e.fullpath());let a=new Set([e]);for(let l of a){let h=l.readdirSync();for(let u of h){(!r||r(u))&&(yield s?u:u.fullpath());let f=u;if(u.isSymbolicLink()){if(!(i&&(f=u.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(a,o)&&a.add(f)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new Ce({objectMode:!0});(!r||r(e))&&a.write(s?e:e.fullpath());let l=new Set,h=[e],u=0,f=()=>{let p=!1;for(;!p;){let d=h.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=(y,b,v=!1)=>{if(y)return a.emit("error",y);if(i&&!v){let x=[];for(let $ of b)$.isSymbolicLink()&&x.push($.realpath().then(E=>E?.isUnknown()?E.lstat():E));if(x.length){Promise.all(x).then(()=>m(null,b,!0));return}}for(let x of b)x&&(!r||r(x))&&(a.write(s?x:x.fullpath())||(p=!0));u--;for(let x of b){let $=x.realpathCached()||x;$.shouldWalk(l,o)&&h.push($)}p&&!a.flowing?a.once("drain",f):g||f()},g=!0;d.readdirCB(m,!0),g=!1}};return f(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof H||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new Ce({objectMode:!0}),l=new Set;(!r||r(e))&&a.write(s?e:e.fullpath());let h=[e],u=0,f=()=>{let p=!1;for(;!p;){let d=h.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=d.readdirSync();for(let g of m)(!r||r(g))&&(a.write(s?g:g.fullpath())||(p=!0));u--;for(let g of m){let y=g;if(g.isSymbolicLink()){if(!(i&&(y=g.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,o)&&h.push(y)}}p&&!a.flowing&&a.once("drain",f)};return f(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Zr](t)}},tt=class extends ds{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,et.win32,"\\",{...t,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return et.win32.parse(e).root.toUpperCase()}newRoot(e){return new us(this.rootPath,he,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},st=class extends ds{sep="/";constructor(e=process.cwd(),t={}){let{nocase:s=!1}=t;super(e,et.posix,"/",{...t,nocase:s}),this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new fs(this.rootPath,he,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},At=class extends st{constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,{...t,nocase:s})}},Qu=process.platform==="win32"?us:fs,Qr=process.platform==="win32"?tt:process.platform==="darwin"?At:st;var wc=n=>n.length>=1,vc=n=>n.length>=1,it=class n{#e;#s;#n;length;#t;#o;#x;#c;#u;#l;#a=!0;constructor(e,t,s,i){if(!wc(e))throw new TypeError("empty pattern list");if(!vc(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#s=t,this.#n=s,this.#t=i,this.#n===0){if(this.isUNC()){let[r,o,a,l,...h]=this.#e,[u,f,p,d,...m]=this.#s;h[0]===""&&(h.shift(),m.shift());let g=[r,o,a,l,""].join("/"),y=[u,f,p,d,""].join("/");this.#e=[g,...h],this.#s=[y,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...l]=this.#s;o[0]===""&&(o.shift(),l.shift());let h=r+"/",u=a+"/";this.#e=[h,...o],this.#s=[u,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===F}isRegExp(){return this.#e[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.#e,this.#s,this.#n+1,this.#t),this.#o.#l=this.#l,this.#o.#u=this.#u,this.#o.#c=this.#c,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=this.#t==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#l!==void 0?this.#l:this.#l=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var xc=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",nt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:s,noext:i,noglobstar:r,platform:o=xc}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let t=new Y(e,this.mmopts);for(let s=0;s<t.set.length;s++){let i=t.set[s],r=t.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 Y(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(e){let t=e.fullpath(),s=`${t}/`,i=e.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(t)||o.match(s))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",s=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var _i=class n{store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let s=e.fullpath(),i=this.store.get(s);i?i.add(t.globString()):this.store.set(s,new Set([t.globString()]))}},Ci=class{store=new Map;add(e,t,s){let i=(t?2:0)|(s?1:0),r=this.store.get(e);this.store.set(e,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},Ei=class{store=new Map;add(e,t){if(!e.canReaddir())return;let s=this.store.get(e);s?s.find(i=>i.globString()===t.globString())||s.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Ft=class n{hasWalkedCache;matches=new Ci;subwalks=new Ei;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new _i}processPatterns(e,t){this.patterns=t;let s=t.map(i=>[e,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 f=r.rest();if(f)r=f;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 f=l===".."||l===""||l===".";this.matches.add(i.resolve(l),a,f);continue}else if(l===F){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let f=h?.pattern(),p=h?.rest();if(!h||(f===""||f===".")&&!p)this.matches.add(i,a,f===""||f===".");else if(f===".."){let d=i.parent||i;p?this.hasWalkedCache.hasWalked(d,p)||this.subwalks.add(d,p):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(e,t){let s=this.subwalks.get(e),i=this.child();for(let r of t)for(let o of s){let a=o.isAbsolute(),l=o.pattern(),h=o.rest();l===F?i.testGlobstar(r,o,h,a):l instanceof RegExp?i.testRegExp(r,l,h,a):i.testString(r,l,h,a)}return i}testGlobstar(e,t,s,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(s&&t.checkFollowGlobstar()?this.subwalks.add(e,s):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,s.rest(),i);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,s)}else r instanceof RegExp&&this.testRegExp(e,r,s.rest(),i)}}testRegExp(e,t,s,i){t.test(e.name)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}testString(e,t,s,i){e.isNamed(t)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}};var Sc=(n,e)=>typeof n=="string"?new nt([n],e):Array.isArray(n)?new nt(n,e):n,ps=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#s;#n;signal;maxDepth;includeChildMatches;constructor(e,t,s){if(this.patterns=e,this.path=t,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#s=Sc(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.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#s?.ignored?.(e)}#o(e){return!!this.#s?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||await e.realpath(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;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,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||e.realpathSync(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;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,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#s?.add){let r=`${e.relativePosix()}/**`;this.#s.add(r)}let s=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(s){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(e,t,s){let i=await this.matchCheck(e,s);i&&this.matchFinish(i,t)}matchSync(e,t,s){let i=this.matchCheckSync(e,s);i&&this.matchFinish(i,t)}walkCB(e,t,s){this.signal?.aborted&&s(),this.walkCB2(e,t,new Ft(this.opts),s)}walkCB2(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(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(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(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(e,t,s){this.signal?.aborted&&s(),this.walkCB2Sync(e,t,new Ft(this.opts),s)}walkCB2Sync(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(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(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(a)||this.matchSync(a,l,h);for(let[a,l]of s.subwalks.entries())r++,this.walkCB2Sync(a,l,s.child(),o);o()}},jt=class extends ps{matches=new Set;constructor(e,t,s){super(e,t,s)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(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}},Rt=class extends ps{results;constructor(e,t,s){super(e,t,s),this.results=new Ce({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,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 $c=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",oe=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(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,eo.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||$c,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?tt:t.platform==="darwin"?At:t.platform?st:Qr;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...t,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 Y(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 jt(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 jt(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 Rt(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 Rt(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 Oi=(n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Y(t,e).hasMagic())return!0;return!1};function gs(n,e={}){return new oe(n,e).streamSync()}function so(n,e={}){return new oe(n,e).stream()}function io(n,e={}){return new oe(n,e).walkSync()}async function to(n,e={}){return new oe(n,e).walk()}function ms(n,e={}){return new oe(n,e).iterateSync()}function no(n,e={}){return new oe(n,e).iterate()}var _c=gs,Cc=Object.assign(so,{sync:gs}),Ec=ms,Oc=Object.assign(no,{sync:ms}),kc=Object.assign(io,{stream:gs,iterate:ms}),rt=Object.assign(to,{glob:to,globSync:io,sync:kc,globStream:so,stream:Cc,globStreamSync:gs,streamSync:_c,globIterate:no,iterate:Oc,globIterateSync:ms,iterateSync:Ec,Glob:oe,hasMagic:Oi,escape:Ye,unescape:ie});rt.glob=rt;var Ac=[{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"}],Fc=[{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"}],jc=[{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"}],Rc=[{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"}],Tc=[...Ac,...Fc,...jc,...Rc];function ro(n,e,t){let s=[];for(let i of Tc){i.regex.lastIndex=0;let r;for(;(r=i.regex.exec(n))!==null;)s.push({file:t,line:e,column:r.index+1,pattern:i.id,category:i.category,severity:i.severity,excerpt:Pc(n.trim(),r.index,r[0].length),suggestion:i.suggestion})}return s}function Pc(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}async function Tt(n,e=[]){let t=[];for(let o of n)if(ot.existsSync(o)&&ot.statSync(o).isFile())t.push(o);else{let a=await rt("**/*.md",{cwd:o,ignore:["node_modules/**",".git/**",...e],absolute:!0});t.push(...a)}let s=[...new Set(t)],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=ot.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
100
- `),h=[];for(let p=0;p<l.length;p++){let d=l[p];d.startsWith("```")||d.startsWith("---")||d.startsWith("#")||d.trim().length<10||h.push(...ro(d,p+1,ki.relative(process.cwd(),o)))}r.files++,r.total_lines+=l.length;let u=h.filter(p=>p.severity==="red").length,f=h.filter(p=>p.severity==="yellow").length;r.red+=u,r.yellow+=f,u+f===0&&r.clean++,i.push({file:ki.relative(process.cwd(),o),findings:h,lines:l.length})}return{results:i,summary:r}}Re();var _=S(require("fs")),Ne=S(require("path")),co=S(require("os"));U();var be=Ne.join(co.homedir(),".hyv","learning"),ye=Ne.join(be,"events.jsonl"),Ai=Ne.join(be,".last-sync"),oo=Ne.join(be,".last-cleanup"),Tf=5*1024*1024;function ao(n){try{_.existsSync(be)||_.mkdirSync(be,{recursive:!0});let e=JSON.stringify({...n,timestamp:n.timestamp||Date.now()})+`
101
- `;_.appendFileSync(ye,e,"utf-8")}catch{}}function ho(n,e,t,s){if(ao({timestamp:Date.now(),type:s?"accept":"reject",ruleId:"algorithm.overall",original:n.slice(0,500),edited:s?void 0:e.slice(0,500),context:`score:${t}`}),s&&n!==e){let i=Wc(n,e);for(let r of i)ao({timestamp:Date.now(),type:"accept",ruleId:"algorithm.change",original:r.before.slice(0,200),edited:r.after.slice(0,200),context:`line:${r.line}`})}}var Oe=Ne.join(be,"ignored-rules.json"),Mc=3;function uo(n){if(n.length)try{_.existsSync(be)||_.mkdirSync(be,{recursive:!0});let e={};_.existsSync(Oe)&&(e=JSON.parse(_.readFileSync(Oe,"utf-8")));let t=Date.now();for(let s of n){let i=s.ruleId||s.pattern||"unknown";e[i]||(e[i]={ruleId:i,count:0,firstSeen:t,lastSeen:t}),e[i].count++,e[i].lastSeen=t}_.writeFileSync(Oe,JSON.stringify(e,null,2),"utf-8")}catch{}}function Mt(){try{if(!_.existsSync(Oe))return[];let n=JSON.parse(_.readFileSync(Oe,"utf-8")),e=[];for(let[t,s]of Object.entries(n))if(s.count>=Mc){let i=t.replace(/\./g," ").replace(/-/g," ");e.push({ruleId:t,count:s.count,suggestion:`You've ignored "${i}" flags ${s.count} times. Want us to stop flagging it?`})}return e.sort((t,s)=>s.count-t.count)}catch{return[]}}function fo(n){try{if(!_.existsSync(Oe))return;let e=JSON.parse(_.readFileSync(Oe,"utf-8"));delete e[n],_.writeFileSync(Oe,JSON.stringify(e,null,2),"utf-8")}catch{}}var Pt=Ne.join(be,"consolidated.md"),Ic=7;function Nc(){try{if(_.existsSync(Pt))return _.readFileSync(Pt,"utf-8")}catch{}return""}function lo(n){let e=Nc(),s=`
98
+ ${c.cyan("\u2192")} opening chatgpt connector settings...`),console.log(` ${c.dim("add server:")} ${c.cyan("https://holdyourvoice.com/mcp")}`),console.log(` ${c.dim("auth: your CLI key will be used automatically")}`);try{let r=(await Promise.resolve().then(()=>S(He()))).default;await r("https://chatgpt.com/#settings/Connectors")}catch{}}console.log(`
99
+ ${c.dim('say "rewrite in my voice" in any connected agent to get started')}`)}}async function fl(n){Bt({api_key:n,base_url:Pe});try{let e=await E("/cli/heartbeat");Bt({api_key:n,base_url:Pe,user_email:e.email,user_name:e.name}),console.log(` ${c.green("\u2713")} authenticated with license key`)}catch(e){console.log(` ${c.red("\u2717")} invalid license key: ${e.message}`),process.exit(1)}}var at=S(require("fs")),Ai=S(require("path"));var Or=S(br(),1);var wt=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var vl={"[: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]},vt=n=>n.replace(/[[\]\\-]/g,"\\$&"),xl=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wr=n=>n.join(""),vr=(n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=t+1,o=!1,a=!1,l=!1,h=!1,u=t,f="";e:for(;r<n.length;){let g=n.charAt(r);if((g==="!"||g==="^")&&r===t+1){h=!0,r++;continue}if(g==="]"&&o&&!l){u=r+1;break}if(o=!0,g==="\\"&&!l){l=!0,r++;continue}if(g==="["&&!l){for(let[y,[b,v,x]]of Object.entries(vl))if(n.startsWith(y,r)){if(f)return["$.",!1,n.length-t,!0];r+=y.length,x?i.push(b):s.push(b),a=a||v;continue e}}if(l=!1,f){g>f?s.push(vt(f)+"-"+vt(g)):g===f&&s.push(vt(g)),f="",r++;continue}if(n.startsWith("-]",r+1)){s.push(vt(g+"-")),r+=2;continue}if(n.startsWith("-",r+1)){f=g,r+=2;continue}s.push(vt(g)),r++}if(u<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!h){let g=s[0].length===2?s[0].slice(-1):s[0];return[xl(g),!1,u-t,!1]}let p="["+(h?"^":"")+wr(s)+"]",d="["+(h?"":"^")+wr(i)+"]";return[s.length&&i.length?"("+p+"|"+d+")":s.length?p:d,a,u-t,!0]};var ie=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var z,Sl=new Set(["!","?","+","*","@"]),ui=n=>Sl.has(n),xr=n=>ui(n.type),$l=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),_l=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Cl=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),Sr=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),El="(?!(?:^|/)\\.\\.?(?:$|/))",Qt="(?!\\.)",Ol=new Set(["[","."]),kl=new Set(["..","."]),Al=new Set("().*{}+?[]^$\\!"),Fl=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),fi="[^/]",$r=fi+"*?",_r=fi+"+?",Me=class{type;#e;#s;#n=!1;#t=[];#o;#x;#c;#u=!1;#l;#a;#r=!1;constructor(e,t,s={}){this.type=e,e&&(this.#s=!0),this.#o=t,this.#e=this.#o?this.#o.#e:this,this.#l=this.#e===this?s:this.#e.#l,this.#c=this.#e===this?[]:this.#e.#c,e==="!"&&!this.#e.#u&&this.#c.push(this),this.#x=this.#o?this.#o.#t.length:0}get hasMagic(){if(this.#s!==void 0)return this.#s;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#s=!0;return this.#s}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#a=this.#t.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#c.pop();){if(e.type!=="!")continue;let t=e,s=t.#o;for(;s;){for(let i=t.#x+1;!s.type&&i<s.#t.length;i++)for(let r of e.#t){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(s.#t[i])}t=s,s=t.#o}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof z&&t.#o===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#x===0)return!0;let e=this.#o;for(let t=0;t<this.#x;t++){let s=e.#t[t];if(!(s instanceof z&&s.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#t.length:0;return this.#x===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new z(this.type,e);for(let s of this.#t)t.copyIn(s);return t}static#b(e,t,s,i,r){let o=i.maxExtglobRecursion??2,a=!1,l=!1,h=-1,u=!1;if(t.type===null){let g=s,y="";for(;g<e.length;){let b=e.charAt(g++);if(a||b==="\\"){a=!a,y+=b;continue}if(l){g===h+1?(b==="^"||b==="!")&&(u=!0):b==="]"&&!(g===h+2&&u)&&(l=!1),y+=b;continue}else if(b==="["){l=!0,h=g,u=!1,y+=b;continue}if(!i.noext&&ui(b)&&e.charAt(g)==="("&&r<=o){t.push(y),y="";let x=new z(b,t);g=z.#b(e,x,g,i,r+1),t.push(x);continue}y+=b}return t.push(y),g}let f=s+1,p=new z(null,t),d=[],m="";for(;f<e.length;){let g=e.charAt(f++);if(a||g==="\\"){a=!a,m+=g;continue}if(l){f===h+1?(g==="^"||g==="!")&&(u=!0):g==="]"&&!(f===h+2&&u)&&(l=!1),m+=g;continue}else if(g==="["){l=!0,h=f,u=!1,m+=g;continue}if(ui(g)&&e.charAt(f)==="("&&(r<=o||t&&t.#S(g))){let b=t&&t.#S(g)?0:1;p.push(m),m="";let v=new z(g,p);p.push(v),f=z.#b(e,v,f,i,r+b);continue}if(g==="|"){p.push(m),m="",d.push(p),p=new z(null,t);continue}if(g===")")return m===""&&t.#t.length===0&&(t.#r=!0),p.push(m),m="",t.push(...d,p),f;m+=g}return t.type=null,t.#s=void 0,t.#t=[e.substring(s-1)],f}#g(e){return this.#d(e,_l)}#d(e,t=$l){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let s=e.#t[0];return!s||typeof s!="object"||s.type===null?!1:this.#S(s.type,t)}#S(e,t=Cl){return!!t.get(this.type)?.includes(e)}#p(e,t){let s=e.#t[0],i=new z(null,s,this.options);i.#t.push(""),s.push(i),this.#_(e,t)}#_(e,t){let s=e.#t[0];this.#t.splice(t,1,...s.#t);for(let i of s.#t)typeof i=="object"&&(i.#o=this);this.#a=void 0}#C(e){return!!Sr.get(this.type)?.has(e)}#m(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#C(t.type)}#$(e){let t=Sr.get(this.type),s=e.#t[0],i=t?.get(s.type);if(!i)return!1;this.#t=s.#t;for(let r of this.#t)typeof r=="object"&&(r.#o=this);this.type=i,this.#a=void 0,this.#r=!1}#w(){if(xr(this)){let e=0,t=!1;do{t=!0;for(let s=0;s<this.#t.length;s++){let i=this.#t[s];typeof i=="object"&&(i.#w(),this.#d(i)?(t=!1,this.#_(i,s)):this.#g(i)?(t=!1,this.#p(i,s)):this.#m(i)&&(t=!1,this.#$(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#w();this.#a=void 0}static fromGlob(e,t={}){let s=new z(null,void 0,t);return z.#b(e,s,0,t,0),s}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,s,i,r]=this.toRegExpSource();if(!(i||this.#s||this.#l.nocase&&!this.#l.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return s;let a=(this.#l.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#l}toRegExpSource(e){let t=e??!!this.#l.dot;if(this.#e===this&&(this.#w(),this.#y()),!xr(this)){let l=this.isStart()&&this.isEnd(),h=this.#t.map(d=>{let[m,g,y,b]=typeof d=="string"?z.#E(d,this.#s,l):d.toRegExpSource(e);return this.#s=this.#s||y,this.#n=this.#n||b,m}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&kl.has(this.#t[0]))){let m=Ol,g=t&&m.has(h.charAt(0))||h.startsWith("\\.")&&m.has(h.charAt(2))||h.startsWith("\\.\\.")&&m.has(h.charAt(4)),y=!t&&!e&&m.has(h.charAt(0));u=g?El:y?Qt:""}let f="";return this.isEnd()&&this.#e.#u&&this.#o?.type==="!"&&(f="(?:$|\\/)"),[u+h+f,ie(h),this.#s=!!this.#s,this.#n]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#f(t);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString(),h=this;return h.#t=[l],h.type=null,h.#s=void 0,[l,ie(this.toString()),!1,!1]}let o=!s||e||t||!Qt?"":this.#f(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let a="";if(this.type==="!"&&this.#r)a=(this.isStart()&&!t?Qt:"")+_r;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Qt:"")+$r+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+r+l}return[a,ie(r),this.#s=!!this.#s,this.#n]}#f(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[s,i,r,o]=t.toRegExpSource(e);return this.#n=this.#n||o,s}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#E(e,t,s=!1){let i=!1,r="",o=!1,a=!1;for(let l=0;l<e.length;l++){let h=e.charAt(l);if(i){i=!1,r+=(Al.has(h)?"\\":"")+h,a=!1;continue}if(h==="\\"){l===e.length-1?r+="\\\\":i=!0;continue}if(h==="["){let[u,f,p,d]=vr(e,l);if(p){r+=u,o=o||f,l+=p-1,t=t||d,a=!1;continue}}if(h==="*"){if(a)continue;a=!0,r+=s&&/^[*]+$/.test(e)?_r:$r,t=!0;continue}else a=!1;if(h==="?"){r+=fi,t=!0;continue}r+=Fl(h)}return[r,ie(e),!!t,o]}};z=Me;var Ke=(n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var B=(n,e,t={})=>(wt(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Y(e,t).match(n)),jl=/^\*+([^+@!?\*\[\(]*)$/,Rl=n=>e=>!e.startsWith(".")&&e.endsWith(n),Tl=n=>e=>e.endsWith(n),Pl=n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),Ml=n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),Il=/^\*+\.\*+$/,Nl=n=>!n.startsWith(".")&&n.includes("."),Ll=n=>n!=="."&&n!==".."&&n.includes("."),Dl=/^\.\*+$/,Wl=n=>n!=="."&&n!==".."&&n.startsWith("."),Vl=/^\*+$/,Hl=n=>n.length!==0&&!n.startsWith("."),ql=n=>n.length!==0&&n!=="."&&n!=="..",Bl=/^\?+([^+@!?\*\[\(]*)?$/,Ul=([n,e=""])=>{let t=kr([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},zl=([n,e=""])=>{let t=Ar([n]);return e?(e=e.toLowerCase(),s=>t(s)&&s.toLowerCase().endsWith(e)):t},Gl=([n,e=""])=>{let t=Ar([n]);return e?s=>t(s)&&s.endsWith(e):t},Jl=([n,e=""])=>{let t=kr([n]);return e?s=>t(s)&&s.endsWith(e):t},kr=([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},Ar=([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},Fr=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Cr={win32:{sep:"\\"},posix:{sep:"/"}},Yl=Fr==="win32"?Cr.win32.sep:Cr.posix.sep;B.sep=Yl;var F=Symbol("globstar **");B.GLOBSTAR=F;var Kl="[^/]",Xl=Kl+"*?",Zl="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ql="(?:(?!(?:\\/|^)\\.).)*?",ec=(n,e={})=>t=>B(t,n,e);B.filter=ec;var Q=(n,e={})=>Object.assign({},n,e),tc=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return B;let e=B;return Object.assign((s,i,r={})=>e(s,i,Q(n,r)),{Minimatch:class extends e.Minimatch{constructor(i,r={}){super(i,Q(n,r))}static defaults(i){return e.defaults(Q(n,i)).Minimatch}},AST:class extends e.AST{constructor(i,r,o={}){super(i,r,Q(n,o))}static fromGlob(i,r={}){return e.AST.fromGlob(i,Q(n,r))}},unescape:(s,i={})=>e.unescape(s,Q(n,i)),escape:(s,i={})=>e.escape(s,Q(n,i)),filter:(s,i={})=>e.filter(s,Q(n,i)),defaults:s=>e.defaults(Q(n,s)),makeRe:(s,i={})=>e.makeRe(s,Q(n,i)),braceExpand:(s,i={})=>e.braceExpand(s,Q(n,i)),match:(s,i,r={})=>e.match(s,i,Q(n,r)),sep:e.sep,GLOBSTAR:F})};B.defaults=tc;var jr=(n,e={})=>(wt(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Or.default)(n));B.braceExpand=jr;var sc=(n,e={})=>new Y(n,e).makeRe();B.makeRe=sc;var ic=(n,e,t={})=>{let s=new Y(e,t);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(e),n};B.match=ic;var Er=/[?*]|[+@!]\(.*?\)|\[|\]/,nc=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Y=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){wt(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Fr,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.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 e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...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]==="?"||!Er.test(r[2]))&&!Er.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(e){if(this.options.noglobstar)for(let s=0;s<e.length;s++)for(let i=0;i<e[s].length;i++)e[s][i]==="**"&&(e[s][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let s=-1;for(;(s=t.indexOf("**",s+1))!==-1;){let i=s;for(;t[i+1]==="**";)i++;i!==s&&t.splice(s,i-s)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.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)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let r=e[i];i===1&&r===""&&e[0]===""||(r==="."||r==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let s=0;for(;(s=e.indexOf("..",s+1))!==-1;){let i=e[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(s-1,2),s-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let s of e){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;t=!0,s.splice(i,1);let u=s.slice(0);u[i]="**",e.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==="")&&(t=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(t=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let o=s[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let l=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...l),s.length===0&&s.push(""),r-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let s=t+1;s<e.length;s++){let i=this.partsMatch(e[t],e[s],!this.preserveMultipleSlashes);if(i){e[t]=[],e[s]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,s=!1){let i=0,r=0,o=[],a="";for(;i<e.length&&r<t.length;)if(e[i]===t[r])o.push(a==="b"?t[r]:e[i]),i++,r++;else if(s&&e[i]==="**"&&t[r]===e[i+1])o.push(e[i]),i++;else if(s&&t[r]==="**"&&e[i]===t[r+1])o.push(t[r]),r++;else if(e[i]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,r++}else if(t[r]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[r]),i++,r++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,s=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,s++;s&&(this.pattern=e.slice(s)),this.negate=t}matchOne(e,t,s=!1){let i=0,r=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),h=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),u=!h&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),f=l?3:a?0:void 0,p=u?3:h?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[d,m]=[e[f],t[p]];d.toLowerCase()===m.toLowerCase()&&(t[p]=d,r=p,i=f)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(F)?this.#e(e,t,s,i,r):this.#n(e,t,s,i,r)}#e(e,t,s,i,r){let o=t.indexOf(F,r),a=t.lastIndexOf(F),[l,h,u]=s?[t.slice(r,o),t.slice(o+1),[]]:[t.slice(r,o),t.slice(o+1,a),t.slice(a+1)];if(l.length){let v=e.slice(i,i+l.length);if(!this.#n(v,l,s,0,0))return!1;i+=l.length}let f=0;if(u.length){if(u.length+i>e.length)return!1;let v=e.length-u.length;if(this.#n(e,u,s,v,0))f=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(v--,!this.#n(e,u,s,v,0)))return!1;f=u.length+1}}if(!h.length){let v=!!f;for(let x=i;x<e.length-f;x++){let $=String(e[x]);if(v=!0,$==="."||$===".."||!this.options.dot&&$.startsWith("."))return!1}return s||v}let p=[[[],0]],d=p[0],m=0,g=[0];for(let v of h)v===F?(g.push(m),d=[[],0],p.push(d)):(d[0].push(v),m++);let y=p.length-1,b=e.length-f;for(let v of p)v[1]=b-(g[y--]+v[0].length);return!!this.#s(e,p,i,0,s,0,!!f)}#s(e,t,s,i,r,o,a){let l=t[i];if(!l){for(let f=s;f<e.length;f++){a=!0;let p=e[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return a}let[h,u]=l;for(;s<=u;){if(this.#n(e.slice(0,s+h.length),h,r,s,0)&&o<this.maxGlobstarRecursion){let d=this.#s(e,t,s+h.length,i+1,r,o+1,a);if(d!==!1)return d}let p=e[s];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;s++}return r||null}#n(e,t,s,i,r){let o,a,l,h;for(o=i,a=r,h=e.length,l=t.length;o<h&&a<l;o++,a++){this.debug("matchOne loop");let u=t[a],f=e[o];if(this.debug(t,u,f),u===!1||u===F)return!1;let p;if(typeof u=="string"?(p=f===u,this.debug("string match",u,f,p)):(p=u.test(f),this.debug("pattern match",u,f,p)),!p)return!1}if(o===h&&a===l)return!0;if(o===h)return s;if(a===l)return o===h-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return jr(this.pattern,this.options)}parse(e){wt(e);let t=this.options;if(e==="**")return F;if(e==="")return"";let s,i=null;(s=e.match(Vl))?i=t.dot?ql:Hl:(s=e.match(jl))?i=(t.nocase?t.dot?Ml:Pl:t.dot?Tl:Rl)(s[1]):(s=e.match(Bl))?i=(t.nocase?t.dot?zl:Ul:t.dot?Gl:Jl)(s):(s=e.match(Il))?i=t.dot?Ll:Nl:(s=e.match(Dl))&&(i=Wl);let r=Me.fromGlob(e,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 e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,s=t.noglobstar?Xl:t.dot?Zl:Ql,i=new Set(t.nocase?["i"]:[]),r=e.map(l=>{let h=l.map(u=>{if(u instanceof RegExp)for(let f of u.flags.split(""))i.add(f);return typeof u=="string"?nc(u):u===F?F:u._src});return h.forEach((u,f)=>{let p=h[f+1],d=h[f-1];u!==F||d===F||(d===void 0?p!==void 0&&p!==F?h[f+1]="(?:\\/|"+s+"\\/)?"+p:h[f]=s:p===void 0?h[f-1]=d+"(?:\\/|"+s+")?":p!==F&&(h[f-1]=d+"(?:\\/|\\/"+s+"\\/)"+p,h[f+1]=F))}),h.filter(u=>u!==F).join("/")}).join("|"),[o,a]=e.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(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);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,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return B.defaults(e).Minimatch}};B.AST=Me;B.Minimatch=Y;B.escape=Ke;B.unescape=ie;var to=require("node:url");var Xe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Tr=new Set,di=typeof process=="object"&&process?process:{},Pr=(n,e,t,s)=>{typeof di.emitWarning=="function"?di.emitWarning(n,e,t,s):console.error(`[${t}] ${e}: ${n}`)},es=globalThis.AbortController,Rr=globalThis.AbortSignal;if(typeof es>"u"){Rr=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,i){this._onabort.push(i)}},es=class{constructor(){e()}signal=new Rr;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=di.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{n&&(n=!1,Pr("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",e))}}var rc=n=>!Tr.has(n),Yu=Symbol("type"),$e=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),Mr=n=>$e(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ze:null:null,Ze=class extends Array{constructor(e){super(e),this.fill(0)}},pi=class n{heap;length;static#e=!1;static create(e){let t=Mr(e);if(!t)return[];n.#e=!0;let s=new n(e,t);return n.#e=!1,s}constructor(e,t){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},xt=class n{#e;#s;#n;#t;#o;#x;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#u;#l;#a;#r;#y;#b;#g;#d;#S;#p;#_;#C;#m;#$;#w;#f;static unsafeExposeInternals(e){return{starts:e.#C,ttls:e.#m,sizes:e.#_,keyMap:e.#l,keyList:e.#a,valList:e.#r,next:e.#y,prev:e.#b,get head(){return e.#g},get tail(){return e.#d},free:e.#S,isBackgroundFetch:t=>e.#h(t),backgroundFetch:(t,s,i,r)=>e.#L(t,s,i,r),moveToTail:t=>e.#W(t),indexes:t=>e.#k(t),rindexes:t=>e.#A(t),isStale:t=>e.#v(t)}}get max(){return this.#e}get maxSize(){return this.#s}get calculatedSize(){return this.#u}get size(){return this.#c}get fetchMethod(){return this.#o}get memoMethod(){return this.#x}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:h,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:p,maxSize:d=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:y,memoMethod:b,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:$,allowStaleOnFetchAbort:O,ignoreFetchAbort:G}=e;if(t!==0&&!$e(t))throw new TypeError("max option must be a nonnegative integer");let T=t?Mr(t):Array;if(!T)throw new Error("invalid max value: "+t);if(this.#e=t,this.#s=d,this.maxEntrySize=m||this.#s,this.sizeCalculation=g,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(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#x=b,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=y,this.#w=!!y,this.#l=new Map,this.#a=new Array(t).fill(void 0),this.#r=new Array(t).fill(void 0),this.#y=new T(t),this.#b=new T(t),this.#g=0,this.#d=0,this.#S=pi.create(t),this.#c=0,this.#u=0,typeof h=="function"&&(this.#n=h),typeof u=="function"?(this.#t=u,this.#p=[]):(this.#t=void 0,this.#p=void 0),this.#$=!!this.#n,this.#f=!!this.#t,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!$,this.allowStaleOnFetchAbort=!!O,this.ignoreFetchAbort=!!G,this.maxEntrySize!==0){if(this.#s!==0&&!$e(this.#s))throw new TypeError("maxSize must be a positive integer if specified");if(!$e(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=$e(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!$e(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#E()}if(this.#e===0&&this.ttl===0&&this.#s===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#s){let Fe="LRU_CACHE_UNBOUNDED";rc(Fe)&&(Tr.add(Fe),Pr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Fe,n))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#E(){let e=new Ze(this.#e),t=new Ze(this.#e);this.#m=e,this.#C=t,this.#R=(r,o,a=Xe.now())=>{if(t[r]=o!==0?a:0,e[r]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#v(r)&&this.#j(this.#a[r],"expire")},o+1);l.unref&&l.unref()}},this.#O=r=>{t[r]=e[r]!==0?Xe.now():0},this.#i=(r,o)=>{if(e[o]){let a=e[o],l=t[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=Xe.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=e[o],l=t[o];if(!a||!l)return 1/0;let h=(s||i())-l;return a-h},this.#v=r=>{let o=t[r],a=e[r];return!!a&&!!o&&(s||i())-o>a}}#O=()=>{};#i=()=>{};#R=()=>{};#v=()=>!1;#F(){let e=new Ze(this.#e);this.#u=0,this.#_=e,this.#T=t=>{this.#u-=e[t],e[t]=0},this.#M=(t,s,i,r)=>{if(this.#h(s))return 0;if(!$e(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,t),!$e(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=(t,s,i)=>{if(e[t]=s,this.#s){let r=this.#s-e[t];for(;this.#u>r;)this.#N(!0)}this.#u+=e[t],i&&(i.entrySize=s,i.totalCalculatedSize=this.#u)}}#T=e=>{};#P=(e,t,s)=>{};#M=(e,t,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#k({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#d;!(!this.#I(t)||((e||!this.#v(t))&&(yield t),t===this.#g));)t=this.#b[t]}*#A({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#I(t)||((e||!this.#v(t))&&(yield t),t===this.#d));)t=this.#y[t]}#I(e){return e!==void 0&&this.#l.get(this.#a[e])===e}*entries(){for(let e of this.#k())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*rentries(){for(let e of this.#A())this.#r[e]!==void 0&&this.#a[e]!==void 0&&!this.#h(this.#r[e])&&(yield[this.#a[e],this.#r[e]])}*keys(){for(let e of this.#k()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*rkeys(){for(let e of this.#A()){let t=this.#a[e];t!==void 0&&!this.#h(this.#r[e])&&(yield t)}}*values(){for(let e of this.#k())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}*rvalues(){for(let e of this.#A())this.#r[e]!==void 0&&!this.#h(this.#r[e])&&(yield this.#r[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let s of this.#k()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;if(r!==void 0&&e(r,this.#a[s],this))return this.get(this.#a[s],t)}}forEach(e,t=this){for(let s of this.#k()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#a[s],this)}}rforEach(e,t=this){for(let s of this.#A()){let i=this.#r[s],r=this.#h(i)?i.__staleWhileFetching:i;r!==void 0&&e.call(t,r,this.#a[s],this)}}purgeStale(){let e=!1;for(let t of this.#A({allowStale:!0}))this.#v(t)&&(this.#j(this.#a[t],"expire"),e=!0);return e}info(e){let t=this.#l.get(e);if(t===void 0)return;let s=this.#r[t],i=this.#h(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#m&&this.#C){let o=this.#m[t],a=this.#C[t];if(o&&a){let l=o-(Xe.now()-a);r.ttl=l,r.start=Date.now()}}return this.#_&&(r.size=this.#_[t]),r}dump(){let e=[];for(let t of this.#k({allowStale:!0})){let s=this.#a[t],i=this.#r[t],r=this.#h(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let o={value:r};if(this.#m&&this.#C){o.ttl=this.#m[t];let a=Xe.now()-this.#C[t];o.start=Math.floor(Date.now()-a)}this.#_&&(o.size=this.#_[t]),e.unshift([s,o])}return e}load(e){this.clear();for(let[t,s]of e){if(s.start){let i=Date.now()-s.start;s.start=Xe.now()-i}this.set(t,s.value,s)}}set(e,t,s={}){if(t===void 0)return this.delete(e),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.#M(e,t,s.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#j(e,"set"),this;let f=this.#c===0?void 0:this.#l.get(e);if(f===void 0)f=this.#c===0?this.#d:this.#S.length!==0?this.#S.pop():this.#c===this.#e?this.#N(!1):this.#c,this.#a[f]=e,this.#r[f]=t,this.#l.set(e,f),this.#y[this.#d]=f,this.#b[f]=this.#d,this.#d=f,this.#c++,this.#P(f,u,l),l&&(l.set="add"),h=!1;else{this.#W(f);let p=this.#r[f];if(t!==p){if(this.#w&&this.#h(p)){p.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=p;d!==void 0&&!o&&(this.#$&&this.#n?.(d,e,"set"),this.#f&&this.#p?.push([d,e,"set"]))}else o||(this.#$&&this.#n?.(p,e,"set"),this.#f&&this.#p?.push([p,e,"set"]));if(this.#T(f),this.#P(f,u,l),this.#r[f]=t,l){l.set="replace";let d=p&&this.#h(p)?p.__staleWhileFetching:p;d!==void 0&&(l.oldValue=d)}}else l&&(l.set="update")}if(i!==0&&!this.#m&&this.#E(),this.#m&&(h||this.#R(f,i,r),l&&this.#i(l,f)),!o&&this.#f&&this.#p){let p=this.#p,d;for(;d=p?.shift();)this.#t?.(...d)}return this}pop(){try{for(;this.#c;){let e=this.#r[this.#g];if(this.#N(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#p){let e=this.#p,t;for(;t=e?.shift();)this.#t?.(...t)}}}#N(e){let t=this.#g,s=this.#a[t],i=this.#r[t];return this.#w&&this.#h(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.#T(t),e&&(this.#a[t]=void 0,this.#r[t]=void 0,this.#S.push(t)),this.#c===1?(this.#g=this.#d=0,this.#S.length=0):this.#g=this.#y[t],this.#l.delete(s),this.#c--,t}has(e,t={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=t,r=this.#l.get(e);if(r!==void 0){let o=this.#r[r];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(r))i&&(i.has="stale",this.#i(i,r));else return s&&this.#O(r),i&&(i.has="hit",this.#i(i,r)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:s=this.allowStale}=t,i=this.#l.get(e);if(i===void 0||!s&&this.#v(i))return;let r=this.#r[i];return this.#h(r)?r.__staleWhileFetching:r}#L(e,t,s,i){let r=t===void 0?void 0:this.#r[t];if(this.#h(r))return r;let o=new es,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:s,context:i},h=(g,y=!1)=>{let{aborted:b}=o.signal,v=s.ignoreFetchAbort&&g!==void 0;if(s.status&&(b&&!y?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,v&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),b&&!v&&!y)return f(o.signal.reason);let x=d;return this.#r[t]===d&&(g===void 0?x.__staleWhileFetching?this.#r[t]=x.__staleWhileFetching:this.#j(e,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(e,g,l.options))),g},u=g=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=g),f(g)),f=g=>{let{aborted:y}=o.signal,b=y&&s.allowStaleOnFetchAbort,v=b||s.allowStaleOnFetchRejection,x=v||s.noDeleteOnFetchRejection,$=d;if(this.#r[t]===d&&(!x||$.__staleWhileFetching===void 0?this.#j(e,"fetch"):b||(this.#r[t]=$.__staleWhileFetching)),v)return s.status&&$.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),$.__staleWhileFetching;if($.__returned===$)throw g},p=(g,y)=>{let b=this.#o?.(e,r,l);b&&b instanceof Promise&&b.then(v=>g(v===void 0?void 0:v),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(g(void 0),s.allowStaleOnFetchAbort&&(g=v=>h(v,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(p).then(h,u),m=Object.assign(d,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return t===void 0?(this.set(e,m,{...l.options,status:void 0}),t=this.#l.get(e)):this.#r[t]=m,m}#h(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof es}async fetch(e,t={}){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:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:g,forceRefresh:y=!1,status:b,signal:v}=t;if(!this.#w)return b&&(b.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:b});let x={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:m,ignoreFetchAbort:d,status:b,signal:v},$=this.#l.get(e);if($===void 0){b&&(b.fetch="miss");let O=this.#L(e,$,x,g);return O.__returned=O}else{let O=this.#r[$];if(this.#h(O)){let le=s&&O.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",le&&(b.returnedStale=!0)),le?O.__staleWhileFetching:O.__returned=O}let G=this.#v($);if(!y&&!G)return b&&(b.fetch="hit"),this.#W($),i&&this.#O($),b&&this.#i(b,$),O;let T=this.#L(e,$,x,g),We=T.__staleWhileFetching!==void 0&&s;return b&&(b.fetch=G?"stale":"refresh",We&&G&&(b.returnedStale=!0)),We?T.__staleWhileFetching:T.__returned=T}}async forceFetch(e,t={}){let s=await this.fetch(e,t);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,t={}){let s=this.#x;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...o}=t,a=this.get(e,o);if(!r&&a!==void 0)return a;let l=s(e,a,{options:o,context:i});return this.set(e,l,o),l}get(e,t={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=t,a=this.#l.get(e);if(a!==void 0){let l=this.#r[a],h=this.#h(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.#j(e,"expire"),o&&s&&(o.returnedStale=!0),s?l:void 0)):(o&&(o.get="hit"),h?l.__staleWhileFetching:(this.#W(a),i&&this.#O(a),l))}else o&&(o.get="miss")}#D(e,t){this.#b[t]=e,this.#y[e]=t}#W(e){e!==this.#d&&(e===this.#g?this.#g=this.#y[e]:this.#D(this.#b[e],this.#y[e]),this.#D(this.#d,e),this.#d=e)}delete(e){return this.#j(e,"delete")}#j(e,t){let s=!1;if(this.#c!==0){let i=this.#l.get(e);if(i!==void 0)if(s=!0,this.#c===1)this.#V(t);else{this.#T(i);let r=this.#r[i];if(this.#h(r)?r.__abortController.abort(new Error("deleted")):(this.#$||this.#f)&&(this.#$&&this.#n?.(r,e,t),this.#f&&this.#p?.push([r,e,t])),this.#l.delete(e),this.#a[i]=void 0,this.#r[i]=void 0,i===this.#d)this.#d=this.#b[i];else if(i===this.#g)this.#g=this.#y[i];else{let o=this.#b[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#b[a]=this.#b[i]}this.#c--,this.#S.push(i)}}if(this.#f&&this.#p?.length){let i=this.#p,r;for(;r=i?.shift();)this.#t?.(...r)}return s}clear(){return this.#V("delete")}#V(e){for(let t of this.#A({allowStale:!0})){let s=this.#r[t];if(this.#h(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#a[t];this.#$&&this.#n?.(s,i,e),this.#f&&this.#p?.push([s,i,e])}}if(this.#l.clear(),this.#r.fill(void 0),this.#a.fill(void 0),this.#m&&this.#C&&(this.#m.fill(0),this.#C.fill(0)),this.#_&&this.#_.fill(0),this.#g=0,this.#d=0,this.#S.length=0,this.#u=0,this.#c=0,this.#f&&this.#p){let t=this.#p,s;for(;s=t?.shift();)this.#t?.(...s)}}};var tt=require("node:path"),Ur=require("node:url"),ue=require("fs"),gc=S(require("node:fs"),1),Ee=require("node:fs/promises");var as=require("node:events"),xi=S(require("node:stream"),1),Wr=require("node:string_decoder"),Ir=typeof process=="object"&&process?process:{stdout:null,stderr:null},oc=n=>!!n&&typeof n=="object"&&(n instanceof Ce||n instanceof xi.default||ac(n)||lc(n)),ac=n=>!!n&&typeof n=="object"&&n instanceof as.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==xi.default.Writable.prototype.pipe,lc=n=>!!n&&typeof n=="object"&&n instanceof as.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function",ge=Symbol("EOF"),me=Symbol("maybeEmitEnd"),_e=Symbol("emittedEnd"),ts=Symbol("emittingEnd"),St=Symbol("emittedError"),ss=Symbol("closed"),Nr=Symbol("read"),is=Symbol("flush"),Lr=Symbol("flushChunk"),ne=Symbol("encoding"),Qe=Symbol("decoder"),N=Symbol("flowing"),$t=Symbol("paused"),et=Symbol("resume"),L=Symbol("buffer"),U=Symbol("pipes"),D=Symbol("bufferLength"),gi=Symbol("bufferPush"),ns=Symbol("bufferShift"),H=Symbol("objectMode"),j=Symbol("destroyed"),mi=Symbol("error"),yi=Symbol("emitData"),Dr=Symbol("emitEnd"),bi=Symbol("emitEnd2"),ce=Symbol("async"),wi=Symbol("abort"),rs=Symbol("aborted"),_t=Symbol("signal"),Ie=Symbol("dataListeners"),K=Symbol("discarded"),Ct=n=>Promise.resolve().then(n),cc=n=>n(),hc=n=>n==="end"||n==="finish"||n==="prefinish",uc=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,fc=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),os=class{src;dest;opts;ondrain;constructor(e,t,s){this.src=e,this.dest=t,this.opts=s,this.ondrain=()=>e[et](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},vi=class extends os{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,s){super(e,t,s),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors)}},dc=n=>!!n.objectMode,pc=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",Ce=class extends as.EventEmitter{[N]=!1;[$t]=!1;[U]=[];[L]=[];[H];[ne];[ce];[Qe];[ge]=!1;[_e]=!1;[ts]=!1;[ss]=!1;[St]=null;[D]=0;[j]=!1;[_t];[rs]=!1;[Ie]=0;[K]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");dc(t)?(this[H]=!0,this[ne]=null):pc(t)?(this[ne]=t.encoding,this[H]=!1):(this[H]=!1,this[ne]=null),this[ce]=!!t.async,this[Qe]=this[ne]?new Wr.StringDecoder(this[ne]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[L]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[U]});let{signal:s}=t;s&&(this[_t]=s,s.aborted?this[wi]():s.addEventListener("abort",()=>this[wi]()))}get bufferLength(){return this[D]}get encoding(){return this[ne]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[H]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ce]}set async(e){this[ce]=this[ce]||!!e}[wi](){this[rs]=!0,this.emit("abort",this[_t]?.reason),this.destroy(this[_t]?.reason)}get aborted(){return this[rs]}set aborted(e){}write(e,t,s){if(this[rs])return!1;if(this[ge])throw new Error("write after end");if(this[j])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(s=t,t="utf8"),t||(t="utf8");let i=this[ce]?Ct:cc;if(!this[H]&&!Buffer.isBuffer(e)){if(fc(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(uc(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[H]?(this[N]&&this[D]!==0&&this[is](!0),this[N]?this.emit("data",e):this[gi](e),this[D]!==0&&this.emit("readable"),s&&i(s),this[N]):e.length?(typeof e=="string"&&!(t===this[ne]&&!this[Qe]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ne]&&(e=this[Qe].write(e)),this[N]&&this[D]!==0&&this[is](!0),this[N]?this.emit("data",e):this[gi](e),this[D]!==0&&this.emit("readable"),s&&i(s),this[N]):(this[D]!==0&&this.emit("readable"),s&&i(s),this[N])}read(e){if(this[j])return null;if(this[K]=!1,this[D]===0||e===0||e&&e>this[D])return this[me](),null;this[H]&&(e=null),this[L].length>1&&!this[H]&&(this[L]=[this[ne]?this[L].join(""):Buffer.concat(this[L],this[D])]);let t=this[Nr](e||null,this[L][0]);return this[me](),t}[Nr](e,t){if(this[H])this[ns]();else{let s=t;e===s.length||e===null?this[ns]():typeof s=="string"?(this[L][0]=s.slice(e),t=s.slice(0,e),this[D]-=e):(this[L][0]=s.subarray(e),t=s.subarray(0,e),this[D]-=e)}return this.emit("data",t),!this[L].length&&!this[ge]&&this.emit("drain"),t}end(e,t,s){return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t="utf8"),e!==void 0&&this.write(e,t),s&&this.once("end",s),this[ge]=!0,this.writable=!1,(this[N]||!this[$t])&&this[me](),this}[et](){this[j]||(!this[Ie]&&!this[U].length&&(this[K]=!0),this[$t]=!1,this[N]=!0,this.emit("resume"),this[L].length?this[is]():this[ge]?this[me]():this.emit("drain"))}resume(){return this[et]()}pause(){this[N]=!1,this[$t]=!0,this[K]=!1}get destroyed(){return this[j]}get flowing(){return this[N]}get paused(){return this[$t]}[gi](e){this[H]?this[D]+=1:this[D]+=e.length,this[L].push(e)}[ns](){return this[H]?this[D]-=1:this[D]-=this[L][0].length,this[L].shift()}[is](e=!1){do;while(this[Lr](this[ns]())&&this[L].length);!e&&!this[L].length&&!this[ge]&&this.emit("drain")}[Lr](e){return this.emit("data",e),this[N]}pipe(e,t){if(this[j])return e;this[K]=!1;let s=this[_e];return t=t||{},e===Ir.stdout||e===Ir.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,s?t.end&&e.end():(this[U].push(t.proxyErrors?new vi(this,e,t):new os(this,e,t)),this[ce]?Ct(()=>this[et]()):this[et]()),e}unpipe(e){let t=this[U].find(s=>s.dest===e);t&&(this[U].length===1?(this[N]&&this[Ie]===0&&(this[N]=!1),this[U]=[]):this[U].splice(this[U].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let s=super.on(e,t);if(e==="data")this[K]=!1,this[Ie]++,!this[U].length&&!this[N]&&this[et]();else if(e==="readable"&&this[D]!==0)super.emit("readable");else if(hc(e)&&this[_e])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[St]){let i=t;this[ce]?Ct(()=>i.call(this,this[St])):i.call(this,this[St])}return s}removeListener(e,t){return this.off(e,t)}off(e,t){let s=super.off(e,t);return e==="data"&&(this[Ie]=this.listeners("data").length,this[Ie]===0&&!this[K]&&!this[U].length&&(this[N]=!1)),s}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ie]=0,!this[K]&&!this[U].length&&(this[N]=!1)),t}get emittedEnd(){return this[_e]}[me](){!this[ts]&&!this[_e]&&!this[j]&&this[L].length===0&&this[ge]&&(this[ts]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ss]&&this.emit("close"),this[ts]=!1)}emit(e,...t){let s=t[0];if(e!=="error"&&e!=="close"&&e!==j&&this[j])return!1;if(e==="data")return!this[H]&&!s?!1:this[ce]?(Ct(()=>this[yi](s)),!0):this[yi](s);if(e==="end")return this[Dr]();if(e==="close"){if(this[ss]=!0,!this[_e]&&!this[j])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[St]=s,super.emit(mi,s);let r=!this[_t]||this.listeners("error").length?super.emit("error",s):!1;return this[me](),r}else if(e==="resume"){let r=super.emit("resume");return this[me](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let i=super.emit(e,...t);return this[me](),i}[yi](e){for(let s of this[U])s.dest.write(e)===!1&&this.pause();let t=this[K]?!1:super.emit("data",e);return this[me](),t}[Dr](){return this[_e]?!1:(this[_e]=!0,this.readable=!1,this[ce]?(Ct(()=>this[bi]()),!0):this[bi]())}[bi](){if(this[Qe]){let t=this[Qe].end();if(t){for(let s of this[U])s.dest.write(t);this[K]||super.emit("data",t)}}for(let t of this[U])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[H]||(e.dataLength=0);let t=this.promise();return this.on("data",s=>{e.push(s),this[H]||(e.dataLength+=s.length)}),await t,e}async concat(){if(this[H])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ne]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(j,()=>t(new Error("stream destroyed"))),this.on("error",s=>t(s)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[K]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ge])return t();let r,o,a=f=>{this.off("data",l),this.off("end",h),this.off(j,u),t(),o(f)},l=f=>{this.off("error",a),this.off("end",h),this.off(j,u),this.pause(),r({value:f,done:!!this[ge]})},h=()=>{this.off("error",a),this.off("data",l),this.off(j,u),t(),r({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((f,p)=>{o=p,r=f,this.once(j,u),this.once("error",a),this.once("end",h),this.once("data",l)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[K]=!1;let e=!1,t=()=>(this.pause(),this.off(mi,t),this.off(j,t),this.off("end",t),e=!0,{done:!0,value:void 0}),s=()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}};return this.once("end",t),this.once(mi,t),this.once(j,t),{next:s,throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[j])return e?this.emit("error",e):this.emit(j),this;this[j]=!0,this[K]=!0,this[L].length=0,this[D]=0;let t=this;return typeof t.close=="function"&&!this[ss]&&t.close(),e?this.emit("error",e):this.emit(j),this}static get isStream(){return oc}};var mc=ue.realpathSync.native,Ot={lstatSync:ue.lstatSync,readdir:ue.readdir,readdirSync:ue.readdirSync,readlinkSync:ue.readlinkSync,realpathSync:mc,promises:{lstat:Ee.lstat,readdir:Ee.readdir,readlink:Ee.readlink,realpath:Ee.realpath}},zr=n=>!n||n===Ot||n===gc?Ot:{...Ot,...n,promises:{...Ot.promises,...n.promises||{}}},Gr=/^\\\\\?\\([a-z]:)\\?$/i,yc=n=>n.replace(/\//g,"\\").replace(Gr,"$1\\"),bc=/[\\\/]/,te=0,Jr=1,Yr=2,he=4,Kr=6,Xr=8,Ne=10,Zr=12,ee=15,Et=~ee,Si=16,Vr=32,kt=64,re=128,ls=256,hs=512,Hr=kt|re|hs,wc=1023,$i=n=>n.isFile()?Xr:n.isDirectory()?he:n.isSymbolicLink()?Ne:n.isCharacterDevice()?Yr:n.isBlockDevice()?Kr:n.isSocket()?Zr:n.isFIFO()?Jr:te,qr=new Map,At=n=>{let e=qr.get(n);if(e)return e;let t=n.normalize("NFKD");return qr.set(n,t),t},Br=new Map,cs=n=>{let e=Br.get(n);if(e)return e;let t=At(n.toLowerCase());return Br.set(n,t),t},us=class extends xt{constructor(){super({max:256})}},_i=class extends xt{constructor(e=16*1024){super({maxSize:e,sizeCalculation:t=>t.length+1})}},Qr=Symbol("PathScurry setAsCwd"),q=class{name;root;roots;parent;nocase;isCWD=!1;#e;#s;get dev(){return this.#s}#n;get mode(){return this.#n}#t;get nlink(){return this.#t}#o;get uid(){return this.#o}#x;get gid(){return this.#x}#c;get rdev(){return this.#c}#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}#b;get mtimeMs(){return this.#b}#g;get ctimeMs(){return this.#g}#d;get birthtimeMs(){return this.#d}#S;get atime(){return this.#S}#p;get mtime(){return this.#p}#_;get ctime(){return this.#_}#C;get birthtime(){return this.#C}#m;#$;#w;#f;#E;#O;#i;#R;#v;#F;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=te,s,i,r,o,a){this.name=e,this.#m=r?cs(e):At(e),this.#i=t&wc,this.nocase=r,this.roots=i,this.root=s||this,this.#R=o,this.#w=a.fullpath,this.#E=a.relative,this.#O=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=zr(a.fs)}depth(){return this.#$!==void 0?this.#$:this.parent?this.#$=this.parent.depth()+1:this.#$=0}childrenCache(){return this.#R}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#T(i):this.#T(i)}#T(e){let t=this;for(let s of e)t=t.child(s);return t}children(){let e=this.#R.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#R.set(this,t),this.#i&=~Si,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let s=this.children(),i=this.nocase?cs(e):At(e);for(let l of s)if(l.#m===i)return l;let r=this.parent?this.sep:"",o=this.#w?this.#w+r+e:void 0,a=this.newChild(e,te,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=re),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#E!==void 0)return this.#E;let e=this.name,t=this.parent;if(!t)return this.#E=this.name;let s=t.relative();return s+(!s||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let e=this.name,t=this.parent;if(!t)return this.#O=this.fullpathPosix();let s=t.relativePosix();return s+(!s||!t.parent?"":"/")+e}fullpath(){if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#w=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 e=this.parent,t=e.fullpathPosix(),s=t+(!t||!e.parent?"":"/")+this.name;return this.#f=s}isUnknown(){return(this.#i&ee)===te}isType(e){return this[`is${e}`]()}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&ee)===Xr}isDirectory(){return(this.#i&ee)===he}isCharacterDevice(){return(this.#i&ee)===Yr}isBlockDevice(){return(this.#i&ee)===Kr}isFIFO(){return(this.#i&ee)===Jr}isSocket(){return(this.#i&ee)===Zr}isSymbolicLink(){return(this.#i&Ne)===Ne}lstatCached(){return this.#i&Vr?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#F}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let e=this.#i&ee;return!(e!==te&&e!==Ne||this.#i&ls||this.#i&re)}calledReaddir(){return!!(this.#i&Si)}isENOENT(){return!!(this.#i&re)}isNamed(e){return this.nocase?this.#m===cs(e):this.#m===At(e)}async readlink(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(t);if(s)return this.#v=s}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(t);if(s)return this.#v=s}catch(t){this.#h(t.code);return}}#P(e){this.#i|=Si;for(let t=e.provisional;t<e.length;t++){let s=e[t];s&&s.#M()}}#M(){this.#i&re||(this.#i=(this.#i|re)&Et,this.#k())}#k(){let e=this.children();e.provisional=0;for(let t of e)t.#M()}#A(){this.#i|=hs,this.#I()}#I(){if(this.#i&kt)return;let e=this.#i;(e&ee)===he&&(e&=Et),this.#i=e|kt,this.#k()}#N(e=""){e==="ENOTDIR"||e==="EPERM"?this.#I():e==="ENOENT"?this.#M():this.children().provisional=0}#L(e=""){e==="ENOTDIR"?this.parent.#I():e==="ENOENT"&&this.#M()}#h(e=""){let t=this.#i;t|=ls,e==="ENOENT"&&(t|=re),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Et),this.#i=t,e==="ENOTDIR"&&this.parent&&this.parent.#I()}#D(e,t){return this.#j(e,t)||this.#W(e,t)}#W(e,t){let s=$i(e),i=this.newChild(e.name,s,{parent:this}),r=i.#i&ee;return r!==he&&r!==Ne&&r!==te&&(i.#i|=kt),t.unshift(i),t.provisional++,i}#j(e,t){for(let s=t.provisional;s<t.length;s++){let i=t[s];if((this.nocase?cs(e.name):At(e.name))===i.#m)return this.#V(e,i,s,t)}}#V(e,t,s,i){let r=t.name;return t.#i=t.#i&Et|$i(e),r!==e.name&&(t.name=e.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(t)),i.provisional++,t}async lstat(){if(!(this.#i&re))try{return this.#U(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#L(e.code)}}lstatSync(){if(!(this.#i&re))try{return this.#U(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#L(e.code)}}#U(e){let{atime:t,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:o,blocks:a,ctime:l,ctimeMs:h,dev:u,gid:f,ino:p,mode:d,mtime:m,mtimeMs:g,nlink:y,rdev:b,size:v,uid:x}=e;this.#S=t,this.#y=s,this.#C=i,this.#d=r,this.#u=o,this.#r=a,this.#_=l,this.#g=h,this.#s=u,this.#x=f,this.#l=p,this.#n=d,this.#p=m,this.#b=g,this.#t=y,this.#c=b,this.#a=v,this.#o=x;let $=$i(e);this.#i=this.#i&Et|$|Vr,$!==te&&$!==he&&$!==Ne&&(this.#i|=kt)}#q=[];#B=!1;#z(e){this.#B=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(s=>s(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#q.push(e),this.#B)return;this.#B=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(r,o)=>{if(r)this.#N(r.code),s.provisional=0;else{for(let a of o)this.#D(a,s);this.#P(s)}this.#z(s.slice(0,s.provisional))})}#H;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=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.#e.promises.readdir(t,{withFileTypes:!0}))this.#D(i,e);this.#P(e)}catch(i){this.#N(i.code),e.provisional=0}this.#H=void 0,s()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let s of this.#e.readdirSync(t,{withFileTypes:!0}))this.#D(s,e);this.#P(e)}catch(s){this.#N(s.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&Hr)return!1;let e=ee&this.#i;return e===te||e===he||e===Ne}shouldWalk(e,t){return(this.#i&he)===he&&!(this.#i&Hr)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#F)return this.#F;if(!((hs|ls|re)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#F=this.resolve(e)}catch{this.#A()}}realpathSync(){if(this.#F)return this.#F;if(!((hs|ls|re)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#F=this.resolve(e)}catch{this.#A()}}[Qr](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),s=[],i=this;for(;i&&i.parent;)t.add(i),i.#E=s.join(this.sep),i.#O=s.join("/"),i=i.parent,s.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#E=void 0,i.#O=void 0,i=i.parent}},fs=class n extends q{sep="\\";splitSep=bc;constructor(e,t=te,s,i,r,o,a){super(e,t,s,i,r,o,a)}newChild(e,t=te,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(e){return tt.win32.parse(e).root}getRoot(e){if(e=yc(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,s]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=s;return this.roots[e]=new st(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Gr,"$1\\"),e===t}},ds=class n extends q{splitSep="/";sep="/";constructor(e,t=te,s,i,r,o,a){super(e,t,s,i,r,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=te,s={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ps=class{root;rootPath;roots;cwd;#e;#s;#n;nocase;#t;constructor(e=process.cwd(),t,s,{nocase:i,childrenCacheSize:r=16*1024,fs:o=Ot}={}){this.#t=zr(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,Ur.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new us,this.#s=new us,this.#n=new _i(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.#t),this.roots[this.rootPath]=this.root;let h=this.root,u=l.length-1,f=t.sep,p=this.rootPath,d=!1;for(let m of l){let g=u--;h=h.child(m,{relative:new Array(g).fill("..").join(f),relativePosix:new Array(g).fill("..").join("/"),fullpath:p+=(d?"":f)+m}),d=!0}this.cwd=h}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#e.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let r=e.length-1;r>=0;r--){let o=e[r];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))break}let s=this.#s.get(t);if(s!==void 0)return s;let i=this.cwd.resolve(t).fullpathPosix();return this.#s.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:s}=t;if(e.canReaddir()){let i=await e.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:s=!0}=t;return e.canReaddir()?s?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let s=await e.readlink();return t?s:s?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let s=e.readlinkSync();return t?s:s?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let s=await e.realpath();return t?s:s?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let s=e.realpathSync();return t?s:s?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set,h=(f,p)=>{l.add(f),f.readdirCB((d,m)=>{if(d)return p(d);let g=m.length;if(!g)return p();let y=()=>{--g===0&&p()};for(let b of m)(!r||r(b))&&a.push(s?b:b.fullpath()),i&&b.isSymbolicLink()?b.realpath().then(v=>v?.isUnknown()?v.lstat():v).then(v=>v?.shouldWalk(l,o)?h(v,y):y()):b.shouldWalk(l,o)?h(b,y):y()},!0)},u=e;return new Promise((f,p)=>{h(u,d=>{if(d)return p(d);f(a)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=[];(!r||r(e))&&a.push(s?e:e.fullpath());let l=new Set([e]);for(let h of l){let u=h.readdirSync();for(let f of u){(!r||r(f))&&a.push(s?f:f.fullpath());let p=f;if(f.isSymbolicLink()){if(!(i&&(p=f.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(l,o)&&l.add(p)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t;(!r||r(e))&&(yield s?e:e.fullpath());let a=new Set([e]);for(let l of a){let h=l.readdirSync();for(let u of h){(!r||r(u))&&(yield s?u:u.fullpath());let f=u;if(u.isSymbolicLink()){if(!(i&&(f=u.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(a,o)&&a.add(f)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new Ce({objectMode:!0});(!r||r(e))&&a.write(s?e:e.fullpath());let l=new Set,h=[e],u=0,f=()=>{let p=!1;for(;!p;){let d=h.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=(y,b,v=!1)=>{if(y)return a.emit("error",y);if(i&&!v){let x=[];for(let $ of b)$.isSymbolicLink()&&x.push($.realpath().then(O=>O?.isUnknown()?O.lstat():O));if(x.length){Promise.all(x).then(()=>m(null,b,!0));return}}for(let x of b)x&&(!r||r(x))&&(a.write(s?x:x.fullpath())||(p=!0));u--;for(let x of b){let $=x.realpathCached()||x;$.shouldWalk(l,o)&&h.push($)}p&&!a.flowing?a.once("drain",f):g||f()},g=!0;d.readdirCB(m,!0),g=!1}};return f(),a}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:o}=t,a=new Ce({objectMode:!0}),l=new Set;(!r||r(e))&&a.write(s?e:e.fullpath());let h=[e],u=0,f=()=>{let p=!1;for(;!p;){let d=h.shift();if(!d){u===0&&a.end();return}u++,l.add(d);let m=d.readdirSync();for(let g of m)(!r||r(g))&&(a.write(s?g:g.fullpath())||(p=!0));u--;for(let g of m){let y=g;if(g.isSymbolicLink()){if(!(i&&(y=g.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(l,o)&&h.push(y)}}p&&!a.flowing&&a.once("drain",f)};return f(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Qr](t)}},st=class extends ps{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,tt.win32,"\\",{...t,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return tt.win32.parse(e).root.toUpperCase()}newRoot(e){return new fs(this.rootPath,he,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},it=class extends ps{sep="/";constructor(e=process.cwd(),t={}){let{nocase:s=!1}=t;super(e,tt.posix,"/",{...t,nocase:s}),this.nocase=s}parseRootPath(e){return"/"}newRoot(e){return new ds(this.rootPath,he,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Ft=class extends it{constructor(e=process.cwd(),t={}){let{nocase:s=!0}=t;super(e,{...t,nocase:s})}},ef=process.platform==="win32"?fs:ds,eo=process.platform==="win32"?st:process.platform==="darwin"?Ft:it;var vc=n=>n.length>=1,xc=n=>n.length>=1,nt=class n{#e;#s;#n;length;#t;#o;#x;#c;#u;#l;#a=!0;constructor(e,t,s,i){if(!vc(e))throw new TypeError("empty pattern list");if(!xc(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#s=t,this.#n=s,this.#t=i,this.#n===0){if(this.isUNC()){let[r,o,a,l,...h]=this.#e,[u,f,p,d,...m]=this.#s;h[0]===""&&(h.shift(),m.shift());let g=[r,o,a,l,""].join("/"),y=[u,f,p,d,""].join("/");this.#e=[g,...h],this.#s=[y,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[r,...o]=this.#e,[a,...l]=this.#s;o[0]===""&&(o.shift(),l.shift());let h=r+"/",u=a+"/";this.#e=[h,...o],this.#s=[u,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===F}isRegExp(){return this.#e[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.#e,this.#s,this.#n+1,this.#t),this.#o.#l=this.#l,this.#o.#u=this.#u,this.#o.#c=this.#c,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=this.#t==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#l!==void 0?this.#l:this.#l=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var Sc=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",rt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:s,noext:i,noglobstar:r,platform:o=Sc}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let t=new Y(e,this.mmopts);for(let s=0;s<t.set.length;s++){let i=t.set[s],r=t.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let o=new nt(i,r,0,this.platform),a=new Y(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(e){let t=e.fullpath(),s=`${t}/`,i=e.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(t)||o.match(s))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",s=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var Ci=class n{store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let s=e.fullpath(),i=this.store.get(s);i?i.add(t.globString()):this.store.set(s,new Set([t.globString()]))}},Ei=class{store=new Map;add(e,t,s){let i=(t?2:0)|(s?1:0),r=this.store.get(e);this.store.set(e,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},Oi=class{store=new Map;add(e,t){if(!e.canReaddir())return;let s=this.store.get(e);s?s.find(i=>i.globString()===t.globString())||s.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},jt=class n{hasWalkedCache;matches=new Ei;subwalks=new Oi;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new Ci}processPatterns(e,t){this.patterns=t;let s=t.map(i=>[e,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 f=r.rest();if(f)r=f;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 f=l===".."||l===""||l===".";this.matches.add(i.resolve(l),a,f);continue}else if(l===F){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let f=h?.pattern(),p=h?.rest();if(!h||(f===""||f===".")&&!p)this.matches.add(i,a,f===""||f===".");else if(f===".."){let d=i.parent||i;p?this.hasWalkedCache.hasWalked(d,p)||this.subwalks.add(d,p):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(e,t){let s=this.subwalks.get(e),i=this.child();for(let r of t)for(let o of s){let a=o.isAbsolute(),l=o.pattern(),h=o.rest();l===F?i.testGlobstar(r,o,h,a):l instanceof RegExp?i.testRegExp(r,l,h,a):i.testString(r,l,h,a)}return i}testGlobstar(e,t,s,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(s&&t.checkFollowGlobstar()?this.subwalks.add(e,s):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(e,r,s.rest(),i);else if(r===".."){let o=e.parent||e;this.subwalks.add(o,s)}else r instanceof RegExp&&this.testRegExp(e,r,s.rest(),i)}}testRegExp(e,t,s,i){t.test(e.name)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}testString(e,t,s,i){e.isNamed(t)&&(s?this.subwalks.add(e,s):this.matches.add(e,i,!1))}};var $c=(n,e)=>typeof n=="string"?new rt([n],e):Array.isArray(n)?new rt(n,e):n,gs=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#s;#n;signal;maxDepth;includeChildMatches;constructor(e,t,s){if(this.patterns=e,this.path=t,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#s=$c(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.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#s?.ignored?.(e)}#o(e){return!!this.#s?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||await e.realpath(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;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,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=e.realpathCached()||e.realpathSync(),!s)return;e=s}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;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,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#s?.add){let r=`${e.relativePosix()}/**`;this.#s.add(r)}let s=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(s){let r=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!r.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(r?o+r+i:"."+i)}}async match(e,t,s){let i=await this.matchCheck(e,s);i&&this.matchFinish(i,t)}matchSync(e,t,s){let i=this.matchCheckSync(e,s);i&&this.matchFinish(i,t)}walkCB(e,t,s){this.signal?.aborted&&s(),this.walkCB2(e,t,new jt(this.opts),s)}walkCB2(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(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(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(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(e,t,s){this.signal?.aborted&&s(),this.walkCB2Sync(e,t,new jt(this.opts),s)}walkCB2Sync(e,t,s,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,s,i));return}s.processPatterns(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(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(e,t,s,i){s=s.filterEntries(e,t);let r=1,o=()=>{--r===0&&i()};for(let[a,l,h]of s.matches.entries())this.#t(a)||this.matchSync(a,l,h);for(let[a,l]of s.subwalks.entries())r++,this.walkCB2Sync(a,l,s.child(),o);o()}},Rt=class extends gs{matches=new Set;constructor(e,t,s){super(e,t,s)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(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}},Tt=class extends gs{results;constructor(e,t,s){super(e,t,s),this.results=new Ce({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,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 _c=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",oe=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(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,to.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||_c,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?st:t.platform==="darwin"?Ft:t.platform?it:eo;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...t,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 Y(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 nt(l,u,0,this.platform)})}async walk(){return[...await new Rt(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 Rt(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 Tt(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 Tt(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 ki=(n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Y(t,e).hasMagic())return!0;return!1};function ms(n,e={}){return new oe(n,e).streamSync()}function io(n,e={}){return new oe(n,e).stream()}function no(n,e={}){return new oe(n,e).walkSync()}async function so(n,e={}){return new oe(n,e).walk()}function ys(n,e={}){return new oe(n,e).iterateSync()}function ro(n,e={}){return new oe(n,e).iterate()}var Cc=ms,Ec=Object.assign(io,{sync:ms}),Oc=ys,kc=Object.assign(ro,{sync:ys}),Ac=Object.assign(no,{stream:ms,iterate:ys}),ot=Object.assign(so,{glob:so,globSync:no,sync:Ac,globStream:io,stream:Ec,globStreamSync:ms,streamSync:Cc,globIterate:ro,iterate:kc,globIterateSync:ys,iterateSync:Oc,Glob:oe,hasMagic:ki,escape:Ke,unescape:ie});ot.glob=ot;var Fc=[{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"}],jc=[{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"}],Rc=[{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"}],Tc=[{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"}],Pc=[...Fc,...jc,...Rc,...Tc];function oo(n,e,t){let s=[];for(let i of Pc){i.regex.lastIndex=0;let r;for(;(r=i.regex.exec(n))!==null;)s.push({file:t,line:e,column:r.index+1,pattern:i.id,category:i.category,severity:i.severity,excerpt:Mc(n.trim(),r.index,r[0].length),suggestion:i.suggestion})}return s}function Mc(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}async function Pt(n,e=[]){let t=[];for(let o of n)if(at.existsSync(o)&&at.statSync(o).isFile())t.push(o);else{let a=await ot("**/*.md",{cwd:o,ignore:["node_modules/**",".git/**",...e],absolute:!0});t.push(...a)}let s=[...new Set(t)],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=at.readFileSync(o,"utf-8")}catch{continue}let l=a.split(`
100
+ `),h=[];for(let p=0;p<l.length;p++){let d=l[p];d.startsWith("```")||d.startsWith("---")||d.startsWith("#")||d.trim().length<10||h.push(...oo(d,p+1,Ai.relative(process.cwd(),o)))}r.files++,r.total_lines+=l.length;let u=h.filter(p=>p.severity==="red").length,f=h.filter(p=>p.severity==="yellow").length;r.red+=u,r.yellow+=f,u+f===0&&r.clean++,i.push({file:Ai.relative(process.cwd(),o),findings:h,lines:l.length})}return{results:i,summary:r}}Re();var _=S(require("fs")),Le=S(require("path")),ho=S(require("os"));V();var be=Le.join(ho.homedir(),".hyv","learning"),ye=Le.join(be,"events.jsonl"),Fi=Le.join(be,".last-sync"),ao=Le.join(be,".last-cleanup"),Pf=5*1024*1024;function lo(n){try{_.existsSync(be)||_.mkdirSync(be,{recursive:!0});let e=JSON.stringify({...n,timestamp:n.timestamp||Date.now()})+`
101
+ `;_.appendFileSync(ye,e,"utf-8")}catch{}}function uo(n,e,t,s){if(lo({timestamp:Date.now(),type:s?"accept":"reject",ruleId:"algorithm.overall",original:n.slice(0,500),edited:s?void 0:e.slice(0,500),context:`score:${t}`}),s&&n!==e){let i=Vc(n,e);for(let r of i)lo({timestamp:Date.now(),type:"accept",ruleId:"algorithm.change",original:r.before.slice(0,200),edited:r.after.slice(0,200),context:`line:${r.line}`})}}var Oe=Le.join(be,"ignored-rules.json"),Ic=3;function fo(n){if(n.length)try{_.existsSync(be)||_.mkdirSync(be,{recursive:!0});let e={};_.existsSync(Oe)&&(e=JSON.parse(_.readFileSync(Oe,"utf-8")));let t=Date.now();for(let s of n){let i=s.ruleId||s.pattern||"unknown";e[i]||(e[i]={ruleId:i,count:0,firstSeen:t,lastSeen:t}),e[i].count++,e[i].lastSeen=t}_.writeFileSync(Oe,JSON.stringify(e,null,2),"utf-8")}catch{}}function It(){try{if(!_.existsSync(Oe))return[];let n=JSON.parse(_.readFileSync(Oe,"utf-8")),e=[];for(let[t,s]of Object.entries(n))if(s.count>=Ic){let i=t.replace(/\./g," ").replace(/-/g," ");e.push({ruleId:t,count:s.count,suggestion:`You've ignored "${i}" flags ${s.count} times. Want us to stop flagging it?`})}return e.sort((t,s)=>s.count-t.count)}catch{return[]}}function po(n){try{if(!_.existsSync(Oe))return;let e=JSON.parse(_.readFileSync(Oe,"utf-8"));delete e[n],_.writeFileSync(Oe,JSON.stringify(e,null,2),"utf-8")}catch{}}var Mt=Le.join(be,"consolidated.md"),Nc=7;function Lc(){try{if(_.existsSync(Mt))return _.readFileSync(Mt,"utf-8")}catch{}return""}function co(n){let e=Lc(),s=`
102
102
 
103
103
  ## Consolidated ${new Date().toISOString().split("T")[0]}
104
104
 
105
- ${n}`;_.writeFileSync(Pt,e+s,"utf-8")}function Lc(){if(!_.existsSync(ye))return{events:[],rawLines:[]};let e=_.readFileSync(ye,"utf-8").trim().split(`
106
- `).filter(o=>o.length>0),t=Date.now()-Ic*24*60*60*1e3,s=[],i=[],r=[];for(let o of e)try{let a=JSON.parse(o);a.timestamp&&a.timestamp<t?(s.push(a),i.push(o)):r.push(o)}catch{r.push(o)}return _.writeFileSync(ye,r.join(`
105
+ ${n}`;_.writeFileSync(Mt,e+s,"utf-8")}function Dc(){if(!_.existsSync(ye))return{events:[],rawLines:[]};let e=_.readFileSync(ye,"utf-8").trim().split(`
106
+ `).filter(o=>o.length>0),t=Date.now()-Nc*24*60*60*1e3,s=[],i=[],r=[];for(let o of e)try{let a=JSON.parse(o);a.timestamp&&a.timestamp<t?(s.push(a),i.push(o)):r.push(o)}catch{r.push(o)}return _.writeFileSync(ye,r.join(`
107
107
  `)+(r.length?`
108
- `:""),"utf-8"),{events:s,rawLines:i}}function po(n){let e=new Map;for(let s of n){let i=s.ruleId;e.has(i)||e.set(i,{accepts:0,rejects:0,edits:[]});let r=e.get(i);s.type==="accept"&&r.accepts++,s.type==="reject"&&r.rejects++,s.type==="edit"&&s.edited&&r.edits.push(`${s.original.slice(0,60)} \u2192 ${s.edited.slice(0,60)}`)}let t=[];for(let[s,i]of e)t.push(`- ${s}: ${i.accepts} accepts, ${i.rejects} rejects`),i.edits.length>0&&t.push(` edits: ${i.edits.slice(0,3).join("; ")}`);return t.join(`
109
- `)}async function Dc(n){if(n.length===0)return null;try{let{apiPost:e}=await Promise.resolve().then(()=>(U(),Ut)),t=po(n);return(await e("/api/llm",{model:"free",system:`You extract voice patterns from a user's editing behavior.
108
+ `:""),"utf-8"),{events:s,rawLines:i}}function go(n){let e=new Map;for(let s of n){let i=s.ruleId;e.has(i)||e.set(i,{accepts:0,rejects:0,edits:[]});let r=e.get(i);s.type==="accept"&&r.accepts++,s.type==="reject"&&r.rejects++,s.type==="edit"&&s.edited&&r.edits.push(`${s.original.slice(0,60)} \u2192 ${s.edited.slice(0,60)}`)}let t=[];for(let[s,i]of e)t.push(`- ${s}: ${i.accepts} accepts, ${i.rejects} rejects`),i.edits.length>0&&t.push(` edits: ${i.edits.slice(0,3).join("; ")}`);return t.join(`
109
+ `)}async function Wc(n){if(n.length===0)return null;try{let{apiPost:e}=await Promise.resolve().then(()=>(V(),zt)),t=go(n);return(await e("/api/llm",{model:"free",system:`You extract voice patterns from a user's editing behavior.
110
110
  Return a concise bullet list of their preferences. No commentary. Max 10 bullets.`,prompt:`User learning signals over the past month:
111
111
 
112
112
  ${t}
113
113
 
114
- Extract their voice preferences as bullet points.`,maxTokens:200,action:"free"}))?.text||null}catch{return null}}async function go(){let{events:n}=Lc();if(n.length===0)return _.writeFileSync(oo,new Date().toISOString(),"utf-8"),{consolidated:0,kept:0};let e=await Dc(n);if(e)lo(e);else{let t=po(n);lo(`Raw summary (${n.length} events):
115
- ${t}`)}return _.writeFileSync(oo,new Date().toISOString(),"utf-8"),{consolidated:n.length,kept:0}}function mo(){try{if(_.existsSync(Pt))return _.readFileSync(Pt,"utf-8")}catch{}return""}async function yo(){if(!_.existsSync(ye))return{synced:0,errors:0};try{let e=_.readFileSync(ye,"utf-8").trim().split(`
116
- `).filter(o=>o.length>0);if(e.length===0)return{synced:0,errors:0};let t=[];for(let o of e)try{t.push(JSON.parse(o))}catch{}if(t.length===0)return{synced:0,errors:0};let s=0,i=0,r=20;for(let o=0;o<t.length;o+=r){let a=t.slice(o,o+r);try{await M("/cli/learning/batch",{events:a}),s+=a.length}catch{i+=a.length}}return i===0&&(_.writeFileSync(ye,"","utf-8"),_.writeFileSync(Ai,new Date().toISOString(),"utf-8")),{synced:s,errors:i}}catch{return{synced:0,errors:1}}}function bo(){let n={total:0,byType:{},lastSync:void 0};if(_.existsSync(ye)){let t=_.readFileSync(ye,"utf-8").trim().split(`
117
- `).filter(s=>s.length>0);n.total=t.length;for(let s of t)try{let i=JSON.parse(s);n.byType[i.type]=(n.byType[i.type]||0)+1}catch{}}return _.existsSync(Ai)&&(n.lastSync=_.readFileSync(Ai,"utf-8").trim()),n}function Wc(n,e){let t=n.split(`
114
+ Extract their voice preferences as bullet points.`,maxTokens:200,action:"free"}))?.text||null}catch{return null}}async function mo(){let{events:n}=Dc();if(n.length===0)return _.writeFileSync(ao,new Date().toISOString(),"utf-8"),{consolidated:0,kept:0};let e=await Wc(n);if(e)co(e);else{let t=go(n);co(`Raw summary (${n.length} events):
115
+ ${t}`)}return _.writeFileSync(ao,new Date().toISOString(),"utf-8"),{consolidated:n.length,kept:0}}function yo(){try{if(_.existsSync(Mt))return _.readFileSync(Mt,"utf-8")}catch{}return""}async function bo(){if(!_.existsSync(ye))return{synced:0,errors:0};try{let e=_.readFileSync(ye,"utf-8").trim().split(`
116
+ `).filter(o=>o.length>0);if(e.length===0)return{synced:0,errors:0};let t=[];for(let o of e)try{t.push(JSON.parse(o))}catch{}if(t.length===0)return{synced:0,errors:0};let s=0,i=0,r=20;for(let o=0;o<t.length;o+=r){let a=t.slice(o,o+r);try{await M("/cli/learning/batch",{events:a}),s+=a.length}catch{i+=a.length}}return i===0&&(_.writeFileSync(ye,"","utf-8"),_.writeFileSync(Fi,new Date().toISOString(),"utf-8")),{synced:s,errors:i}}catch{return{synced:0,errors:1}}}function wo(){let n={total:0,byType:{},lastSync:void 0};if(_.existsSync(ye)){let t=_.readFileSync(ye,"utf-8").trim().split(`
117
+ `).filter(s=>s.length>0);n.total=t.length;for(let s of t)try{let i=JSON.parse(s);n.byType[i.type]=(n.byType[i.type]||0)+1}catch{}}return _.existsSync(Fi)&&(n.lastSync=_.readFileSync(Fi,"utf-8").trim()),n}function Vc(n,e){let t=n.split(`
118
118
  `),s=e.split(`
119
- `),i=[],r=Math.max(t.length,s.length);for(let o=0;o<r;o++){let a=t[o]||"",l=s[o]||"";a!==l&&i.push({line:o+1,before:a,after:l})}return i}async function wo(n,e){let t=qt(),s=n.length?n:t.scan_paths||["."],i=t.ignore||[],{results:r,summary:o}=await Tt(s,i),a=r.flatMap(u=>u.findings.map(f=>({ruleId:f.pattern})));if(a.length>0&&uo(a),e.json){console.log(JSON.stringify({results:r.filter(u=>u.findings.length>0),summary:o},null,2)),e.failOnHit&&o.red+o.yellow>0&&process.exit(1);return}console.log(`
119
+ `),i=[],r=Math.max(t.length,s.length);for(let o=0;o<r;o++){let a=t[o]||"",l=s[o]||"";a!==l&&i.push({line:o+1,before:a,after:l})}return i}V();async function vo(n,e){try{await Te()}catch(u){e.json?console.log(JSON.stringify({error:u.message})):console.log(`
120
+ ${c.red("\u2717")} ${u.message}
121
+ `),process.exit(1);return}let t=Ut(),s=n.length?n:t.scan_paths||["."],i=t.ignore||[],{results:r,summary:o}=await Pt(s,i),a=r.flatMap(u=>u.findings.map(f=>({ruleId:f.pattern})));if(a.length>0&&fo(a),e.json){console.log(JSON.stringify({results:r.filter(u=>u.findings.length>0),summary:o},null,2)),e.failOnHit&&o.red+o.yellow>0&&process.exit(1);return}console.log(`
120
122
  ${C()} ${c.dim("scan")}
121
- `);let l=0;for(let u of r)if(u.findings.length!==0){console.log(` ${c.bold(u.file)} ${c.dim(`(${u.lines} lines)`)}`);for(let f of u.findings)Zn(f),l++;console.log("")}Qn(o);let h=Mt();if(h.length>0){console.log(` ${c.yellow("\u{1F4A1} suggestions:")}`);for(let u of h.slice(0,3))console.log(` ${c.dim("\u2192")} ${u.suggestion}`);console.log("")}if(e.failOnHit&&o.red+o.yellow>0&&process.exit(1),o.red+o.yellow>0)try{(await apiGet("/cli/profiles")).profiles?.length||console.log(` ${c.yellow("tip:")} create a voice profile for personalized results \u2014 run: ${c.cyan("hyv onboard")}
122
- `)}catch{}}var se=S(require("fs"));var Vc=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at",autoFixable:!0},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on",autoFixable:!0},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean",autoFixable:!0},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach",autoFixable:!0},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong",autoFixable:!0},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically",autoFixable:!0},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support",autoFixable:!0},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with",autoFixable:!0},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight",autoFixable:!0},{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",autoFixable:!0},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this",autoFixable:!0},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed",autoFixable:!0},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift",autoFixable:!0},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why",autoFixable:!0},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms",autoFixable:!0},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works",autoFixable:!0},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it",autoFixable:!0},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level",autoFixable:!0},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact",autoFixable:!0},{id:"ai.transform",category:"ai-slop",severity:"yellow",regex:/\btransform\b/gi,suggestion:"describe what specifically changed",autoFixable:!1},{id:"ai.empower",category:"ai-slop",severity:"yellow",regex:/\bempower\b/gi,suggestion:"describe what people can actually do",autoFixable:!0},{id:"ai.unlock",category:"ai-slop",severity:"yellow",regex:/\bunlock\b/gi,suggestion:"describe what they get access to",autoFixable:!0},{id:"ai.nuanced",category:"ai-slop",severity:"yellow",regex:/\bnuanced\b/gi,suggestion:"explain the specific complexity",autoFixable:!0},{id:"ai.multifaceted",category:"ai-slop",severity:"red",regex:/\bmultifaceted\b/gi,suggestion:"name the specific aspects",autoFixable:!0},{id:"ai.comprehensive",category:"ai-slop",severity:"yellow",regex:/\bcomprehensive\b/gi,suggestion:"say what it covers specifically",autoFixable:!1},{id:"ai.innovative",category:"ai-slop",severity:"yellow",regex:/\binnovative\b/gi,suggestion:"describe what's actually new",autoFixable:!0},{id:"ai.cut[t]?ing-edge",category:"ai-slop",severity:"red",regex:/\bcut(?:t)?ing[\s-]edge\b/gi,suggestion:"name the specific technology",autoFixable:!0},{id:"ai.state-of-the-art",category:"ai-slop",severity:"red",regex:/\bstate[\s-]of[\s-]the[\s-]art\b/gi,suggestion:"describe what makes it current",autoFixable:!0},{id:"ai.best-practices",category:"ai-slop",severity:"yellow",regex:/\bbest[\s-]practices?\b/gi,suggestion:"name the specific practice",autoFixable:!1},{id:"ai.world-class",category:"ai-slop",severity:"red",regex:/\bworld[\s-]class\b/gi,suggestion:"prove it with specifics",autoFixable:!0},{id:"ai.second-to-none",category:"ai-slop",severity:"red",regex:/\bsecond[\s-]to[\s-]none\b/gi,suggestion:"drop the superlative, show the work",autoFixable:!0}],Hc=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler',autoFixable:!0},{id:"formula.secondly",category:"ai-slop",severity:"yellow",regex:/\bsecondly\b/gi,suggestion:'just continue \u2014 "secondly" is filler',autoFixable:!0},{id:"formula.lastly",category:"ai-slop",severity:"yellow",regex:/\blastly\b/gi,suggestion:'just end \u2014 "lastly" is filler',autoFixable:!0},{id:"formula.moreover",category:"ai-slop",severity:"yellow",regex:/\bmoreover\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.furthermore",category:"ai-slop",severity:"yellow",regex:/\bfurthermore\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end.",autoFixable:!0},{id:"formula.in-summary",category:"ai-slop",severity:"red",regex:/\bin summary\b/gi,suggestion:"just summarize. the label is redundant.",autoFixable:!0},{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.",autoFixable:!0},{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",autoFixable:!0},{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",autoFixable:!0},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it",autoFixable:!0},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead",autoFixable:!0},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed.",autoFixable:!0},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it",autoFixable:!0},{id:"formula.its-worth-noting",category:"ai-slop",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0}],Bc=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it",autoFixable:!0},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't.",autoFixable:!0},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent",autoFixable:!0},{id:"hedge.perhaps",category:"voice-drift",severity:"yellow",regex:/\bperhaps\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.maybe",category:"voice-drift",severity:"yellow",regex:/\bmaybe\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.possibly",category:"voice-drift",severity:"yellow",regex:/\bpossibly\b/gi,suggestion:"commit or cut",autoFixable:!1},{id:"hedge.it-seems",category:"voice-drift",severity:"yellow",regex:/\bit seems\b/gi,suggestion:"state it directly",autoFixable:!0},{id:"hedge.i-think",category:"voice-drift",severity:"yellow",regex:/\bi think\b/gi,suggestion:'just say it. the "i think" is implied.',autoFixable:!0},{id:"hedge.in-my-opinion",category:"voice-drift",severity:"yellow",regex:/\bin my opinion\b/gi,suggestion:"just state it. it's your article.",autoFixable:!0}],qc=[{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",autoFixable:!1},{id:"struct.not-just-but-also",category:"structure",severity:"yellow",regex:/\bnot\s+just\b.{3,80}\bbut\s+(?:also\s+)?/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore\s+than\s+just\b/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"',autoFixable:!0},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"',autoFixable:!0},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"',autoFixable:!0},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly",autoFixable:!1},{id:"struct.in-other-words",category:"structure",severity:"red",regex:/\bin other words\b/gi,suggestion:"just say it once, well",autoFixable:!1},{id:"struct.rhetorical-truth",category:"structure",severity:"yellow",regex:/\b(?:the\s+)?(?:uncomfortable|hard|harsh|brutal|ugly|unsexy|real|honest)\s+(?:truth|reality)\b/gi,suggestion:"state the fact directly, skip the framing",autoFixable:!1},{id:"struct.truth-is",category:"structure",severity:"yellow",regex:/\bthe\s+truth\s+is\b/gi,suggestion:"just say the truth. the framing is filler.",autoFixable:!1},{id:"struct.lesson-setup",category:"structure",severity:"yellow",regex:/\b(?:here'?s\s+)?what\s+.{3,80}\s+(?:taught|teaches)\s+(?:me|us|you|everyone)\b/gi,suggestion:"just share the lesson",autoFixable:!1},{id:"struct.negation-cascade",category:"structure",severity:"yellow",regex:/\b(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w/gi,suggestion:"three negations in a row reads like AI performance",autoFixable:!1},{id:"struct.inline-triplet",category:"structure",severity:"yellow",regex:/\bit'?s\s+\w[^,.!?;\n]{0,30},\s*it'?s\s+\w[^,.!?;\n]{0,30}[,.]?\s*(?:and\s+)?it'?s\b/gi,suggestion:`the "it's X, it's Y, it's Z" pattern is an AI tell`,autoFixable:!1},{id:"struct.moment-becomes",category:"structure",severity:"red",regex:/\b(?:the\s+)?moment\b.{3,80}\bbecomes?\b/gi,suggestion:'"the moment X becomes Y" is polished founder cadence \u2014 restructure',autoFixable:!1},{id:"struct.same-better",category:"structure",severity:"red",regex:/\bsame\s+[^.!?\n]{1,35}[.!?]\s*(?:better|nicer|cleaner|calmer|safer)\s+[^.!?\n]{1,35}[.!?]?/gi,suggestion:'"same X. better Y." is screenshot-ready founder cadence',autoFixable:!1},{id:"struct.this-is-why",category:"structure",severity:"yellow",regex:/\bthis\s+is\s+(?:also\s+)?(?:why|how|where|what\b)/gi,suggestion:"signpost claims are AI tells \u2014 just make the point",autoFixable:!1},{id:"struct.heres-where",category:"structure",severity:"yellow",regex:/\b(?:here'?s|here\s+is)\s+(?:where|why|what|the\s+part|the\s+(?:harder|real|actual|main|bigger)\s+problem)\b/gi,suggestion:"just make the point without the signpost",autoFixable:!1},{id:"struct.generic-buyer",category:"structure",severity:"red",regex:/\bpeople\s+don'?t\s+just\s+buy\b|\bpeople\s+buy\s+the\s+feeling\b/gi,suggestion:"generic buyer psychology is AI filler",autoFixable:!1}],Uc=[{id:"punct.em-dash",category:"ai-slop",severity:"yellow",regex:/—/g,suggestion:"em dashes are an AI tell \u2014 use a period, comma, or parentheses",autoFixable:!1}],zc=[...Vc,...Hc,...Bc,...qc,...Uc],vo={delve:"dig",leverage:"use",tapestry:"web",holistic:"complete",robust:"strong",pivotal:"key",foster:"build",harness:"use",illuminate:"show","ever-evolving":"changing",everchanging:"changing","fast-paced":"fast","game-changer":"breakthrough",paradigm:"model",synergy:"fit",ecosystem:"network",seamless:"smooth",actionable:"practical",granular:"specific",impactful:"effective",empower:"enable",unlock:"open",nuanced:"complex",multifaceted:"complex",innovative:"new","cutting-edge":"modern","state-of-the-art":"modern","world-class":"excellent","second-to-none":"best",firstly:"",secondly:"",lastly:"",moreover:"",furthermore:"",perhaps:"",arguably:""};function Gc(n){let t=n.split(/[.!?]+/).filter(o=>o.trim().length>0).map(o=>o.trim().split(/\s+/).length),s=t.length>0?t.reduce((o,a)=>o+a,0)/t.length:0,i=t.length>1?Math.sqrt(t.reduce((o,a)=>o+Math.pow(a-s,2),0)/t.length):0,r="low";return i>8?r="high":i>4&&(r="medium"),{avgWords:s,variance:r,sentences:t}}function Jc(n){let e=[],t=n.split(`
123
- `),s=t.findIndex(r=>r.trim().length>10);if(s<0)return e;let i=t[s].trim().toLowerCase();return(i.endsWith("?")||/^(?:have you|do you|did you|what if|why do|how do|what's|how's)\b/.test(i))&&e.push({id:"voice.question-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a question instead of a concrete observation",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with a concrete observation, moment, mechanism, or pattern",autoFixable:!1}),/^(?:the most important thing|the key to|success is|if you want to|what i learned|here's what|the biggest mistake)\b/.test(i)&&e.push({id:"voice.lesson-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a lesson or inspirational claim",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with something concrete and specific, not a lesson",autoFixable:!1}),/^(?:most|many)\s+(?:brands|teams|people|founders|companies|businesses)\b/.test(i)&&e.push({id:"voice.generic-generalization",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a generic generalization",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Start with a specific observation, not a sweeping claim",autoFixable:!1}),e}function Yc(n){let e=[],t=n.split(`
124
- `),s=[];for(let i=0;i<t.length;i++){let r=t[i].trim();if(r.length<10||r.startsWith("#")||r.startsWith("```"))continue;let o=r.split(/(?<=[.!?])\s+/);for(let a of o){let l=a.trim().split(/\s+/).filter(h=>h.length>0);l.length>0&&l.length<=5?(s.push({line:i+1,text:a.trim()}),s.length>=3&&(e.push({id:"voice.staccato-triplet",line:s[0].line,column:1,category:"cadence",severity:"yellow",rule:"Three short sentences in a row reads like performance",match:s.map(h=>h.text).join(" | "),excerpt:s[0].text,suggestion:"Vary sentence length \u2014 short staccato runs feel like AI trying to sound punchy",autoFixable:!1}),s=[])):s=[]}}return e}var Kc=new Set(["alignment","authenticity","awareness","clarity","confidence","consistency","differentiation","execution","framework","identity","messaging","narrative","personality","positioning","preference","presence","recall","relevance","resonance","signal","strategy","trust","utility","value"]);function Xc(n,e){let t=[];return(n.toLowerCase().match(/[a-z']+/g)||[]).filter(r=>Kc.has(r)).length>=3&&!/\b(?:for example|for instance|such as)\b|\d/i.test(n)&&t.push({id:"voice.abstract-cluster",line:e,column:1,category:"voice-drift",severity:"yellow",rule:"Abstract noun cluster \u2014 reads like a strategy deck",match:n.trim().slice(0,80),excerpt:n.trim().slice(0,120),suggestion:"Ground in specifics \u2014 name the thing, show the number, quote the person",autoFixable:!1}),t}function Zc(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r)continue;let o=r.toLowerCase().trim();i.includes(o)&&s.push({id:"voice.never-list",line:e,column:i.indexOf(o)+1,category:"voice-drift",severity:"red",rule:`Never-list violation: "${r}"`,match:o,excerpt:n.trim().slice(0,120),suggestion:`Your voice profile explicitly bans "${r}" \u2014 restructure`,autoFixable:!1})}return s}function Qc(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r.text)continue;let a=r.text.toLowerCase().trim().split(/\s+/);if(a.length<3)continue;let l=a.slice(0,4).join(" ");i.includes(l)&&s.push({id:`learned.${r.type}`,line:e,column:i.indexOf(l)+1,category:"learned",severity:"yellow",rule:`Learned pattern (${r.type}): "${r.text.slice(0,60)}"`,match:l,excerpt:n.trim().slice(0,120),suggestion:"Your editing history suggests this pattern should be rewritten",autoFixable:!1})}return s}function eh(n){let e=new Set;for(let t of n)t.status==="accepted"&&t.rule_id&&e.add(t.rule_id),t.status==="dismissed"&&t.accept_rate!==void 0&&t.accept_rate<.25&&e.add(t.rule_id);return e}function Le(n,e){let t=n.split(`
125
- `),s=[],i=new Map,r=new Map,o=e?.drift_snapshot?eh(e.drift_snapshot):new Set,a=e?.never_list||[],l=e?.learned_patterns||[];for(let d=0;d<t.length;d++){let m=t[d],g=d+1;if(!m.startsWith("```")&&!m.startsWith("---")&&!m.startsWith("#")&&!(m.trim().length<10)){for(let y of zc){y.regex.lastIndex=0;let b;for(;(b=y.regex.exec(m))!==null;){let v=o.has(y.id);s.push({id:y.id,line:g,column:b.index+1,category:y.category,severity:v?"yellow":y.severity,rule:y.suggestion,match:b[0],excerpt:th(m.trim(),b.index,b[0].length),suggestion:y.suggestion,autoFixable:y.autoFixable,driftAccepted:v})}}s.push(...Xc(m,g)),s.push(...Zc(m,g,a)),s.push(...Qc(m,g,l))}}s.push(...Jc(n)),s.push(...Yc(n));for(let d of s)i.has(d.line)||i.set(d.line,[]),i.get(d.line).push(d),r.has(d.id)||r.set(d.id,[]),r.get(d.id).push(d);let h=s.filter(d=>d.severity==="red").length,u=s.filter(d=>d.severity==="yellow").length,f=s.filter(d=>d.autoFixable).length,p=s.filter(d=>d.driftAccepted).length;return{signals:s,byLine:i,byRule:r,summary:{red:h,yellow:u,autoFixable:f,driftAccepted:p,total:s.length}}}function xo(n,e){let{avgWords:t,variance:s}=Gc(n);if(!e?.avg_words)return 100;let i=e.avg_words,r=Math.abs(t-i)/i,o=Math.max(0,Math.round((1-r)*100));return e.variance&&s===e.variance?o=Math.min(100,o+10):e.variance&&s!==e.variance&&(o=Math.max(0,o-10)),o}function th(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}function ys(n){let e=n.byLine,t=[];for(let[h,u]of e){let f=u.filter(y=>!y.driftAccepted);if(f.length===0){t.push({line:h,signals:u,strategy:"skip",priority:0,instruction:"All issues on this line are consistently dismissed by user"});continue}let p=f.map(y=>sh(y)),d=ih(p),m=rh(h,f,d),g=d==="auto_fix"?oh(h,f):void 0;t.push({line:h,signals:f,strategy:d,priority:nh(f,d),instruction:m,autoFixText:g})}let s=t.filter(h=>h.strategy==="auto_fix"),i=t.filter(h=>h.strategy==="restructure"||h.strategy==="voice_drift"),r=t.filter(h=>h.strategy==="skip"),o=Math.max(1,n.summary.total>0?new Set(n.signals.map(h=>h.line)).size:0),a=t.filter(h=>h.strategy!=="skip").length,l=Math.max(0,Math.round((o-a)/Math.max(1,o)*100));return{issues:t,autoFixes:s,llmFixes:i,skipped:r,stats:{total:t.length,autoFixable:s.length,needsLLM:i.length,skipped:r.length,score:l}}}function sh(n){return n.driftAccepted?"skip":n.autoFixable&&n.category==="ai-slop"||n.autoFixable&&n.category==="voice-drift"?"auto_fix":n.category==="voice-drift"||n.category==="cadence"||n.category==="learned"?"voice_drift":(n.category==="structure","restructure")}function ih(n){return n.includes("restructure")?"restructure":n.includes("voice_drift")?"voice_drift":n.includes("auto_fix")?"auto_fix":"skip"}function nh(n,e){let t=0,s=n.filter(r=>r.severity==="red").length,i=n.filter(r=>r.severity==="yellow").length;return t+=s*10+i*5,e==="restructure"&&(t+=20),e==="voice_drift"&&(t+=15),e==="auto_fix"&&(t+=5),t}function rh(n,e,t){let s=[...new Set(e.map(r=>r.rule))],i=e.filter(r=>r.severity==="red");if(t==="auto_fix")return`Replace AI-slop words: ${s.join("; ")}`;if(t==="restructure"){let r=e.map(o=>o.match).filter(Boolean).slice(0,3);return`Restructure line ${n}: ${s[0]||"structural issue"}. Patterns: ${r.join(", ")}`}return t==="voice_drift"?`Rewrite line ${n} to match voice profile: ${s[0]||"voice drift"}`:`Review line ${n}`}function oh(n,e){return e.filter(s=>s.autoFixable).map(s=>s.id).join(",")}function bs(n,e){let t=n.split(`
126
- `),s=[];for(let i of e){if(i.strategy!=="auto_fix")continue;let r=i.line-1;if(r<0||r>=t.length)continue;let o=t[r],a=o;for(let l of i.signals){if(!l.autoFixable)continue;let h=vo[l.match.toLowerCase()];if(h!==void 0){let u=new RegExp(ah(l.match),"gi");a=a.replace(u,f=>h===""?"":f[0]===f[0].toUpperCase()?h.charAt(0).toUpperCase()+h.slice(1):h)}}a=a.replace(/\s{2,}/g," ").trim(),a!==o&&(s.push({line:i.line,before:o,after:a,rule:i.signals.map(l=>l.id).join(", ")}),t[r]=a)}return{original:n,fixed:t.join(`
127
- `),changes:s,changed:s.length>0}}function ah(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}U();Re();var ae=S(require("fs")),ji=S(require("path")),_o=S(require("os")),So=5*60*1e3,ws=new Map;async function at(n,e={}){let t=e.includeSamples!==!1,s=e.forceRefresh||!1;if(!s){let r=ws.get(n);if(r&&Date.now()-r.timestamp<So)return r.data}let i=Eo(n);return i&&!s?Date.now()-i.timestamp<So?(ws.set(n,i),i.data):(ws.set(n,i),lh(n).catch(()=>{}),i.data):$o(n)}async function $o(n){try{let e=await k(`/cli/profiles/${encodeURIComponent(n)}/full`),t={id:e.profile.id,name:e.profile.name,slug:e.profile.slug,brand:e.profile.brand,keywords:e.profile.keywords,description:e.profile.description,body:e.body,drift_snapshot:e.drift_snapshot||[],learned_patterns:e.learned_patterns||[],voice_samples:e.voice_samples||[],voice_rules:e.voice_rules||[],never_list:e.never_list||[],cadence:e.cadence||{}},s={data:t,timestamp:Date.now(),version:1};return ws.set(n,s),ch(n,s),t}catch{let t=Eo(n);if(t)return t.data;let s=yn(n);if(s)return hh(n,s);throw new Error(`Profile not found: ${n}. Run: hyv init`)}}async function lh(n){try{await $o(n)}catch{}}var Fi=ji.join(_o.homedir(),".hyv","cache","profiles");function Co(n){return ji.join(Fi,`${n.replace(/[^a-z0-9-]/gi,"_")}.json`)}function Eo(n){try{let e=Co(n);if(!ae.existsSync(e))return null;let t=ae.readFileSync(e,"utf-8"),s=JSON.parse(t);return!s.data||!s.timestamp?null:s}catch{return null}}function ch(n,e){try{ae.existsSync(Fi)||ae.mkdirSync(Fi,{recursive:!0}),ae.writeFileSync(Co(n),JSON.stringify(e),"utf-8")}catch{}}function hh(n,e){return{id:"",name:n,slug:n,body:e,drift_snapshot:[],learned_patterns:[],voice_samples:[],voice_rules:[],never_list:[],cadence:{}}}function lt(){return qt().profile}var uh=15,fh=2,dh=200,ph=10;function vs(n,e,t,s,i=1){let r=[],o=t.issues.filter(l=>l.strategy==="restructure"||l.strategy==="voice_drift").sort((l,h)=>h.priority-l.priority).slice(0,uh);return r.push(gh(n,o.length,i)),r.push(""),o.length>0&&(r.push(mh(e,o,n)),r.push("")),o.some(l=>l.strategy==="voice_drift")&&n.voice_samples?.length&&(r.push(bh(n.voice_samples)),r.push("")),r.push(wh(e,o,i)),r.join(`
128
- `)}function gh(n,e,t){let s=[];if(s.push(`Rewrite ${e} lines to match ${n.name}'s voice.`),n.description&&s.push(`Voice: ${n.description.slice(0,100)}`),n.cadence?.avg_words&&s.push(`Rhythm: ${n.cadence.avg_words} words/sentence, ${n.cadence.variance||"mixed"} variance`),n.never_list?.length){let r=n.never_list.slice(0,ph);s.push(`Never: ${r.join(", ")}`)}let i=n.drift_snapshot.filter(r=>r.status==="accepted"&&r.profile_line).map(r=>r.profile_line).slice(0,3);return i.length&&s.push(`User voice: ${i.join("; ")}`),t>1&&s.push(`RETRY ${t}: Previous rewrite had issues. Be more careful.`),s.join(`
129
- `)}function mh(n,e,t){let s=[];s.push("FIX THESE LINES:");for(let i of e){let r=vh(n,i.line),o=yh(i,t);s.push(`${i.line}: "${Oo(r,80)}" \u2192 ${o}`)}return s.join(`
130
- `)}function yh(n,e){let t=n.signals.filter(r=>r.autoFixable&&r.match);if(t.length>0&&t.length===n.signals.length)return`replace: ${t.map(r=>r.match).join(", ")}`;let s=n.signals.find(r=>r.category==="structure");if(s)return s.suggestion.slice(0,60);let i=n.signals.find(r=>r.category==="voice-drift"||r.category==="learned");return i?i.suggestion.slice(0,60):n.signals.some(r=>r.category==="cadence")?`match rhythm: ${e.cadence?.avg_words||12} words/sentence`:n.instruction.slice(0,60)}function bh(n){let e=["VOICE EXAMPLES:"];for(let t=0;t<Math.min(fh,n.length);t++){let s=n[t];e.push(`[${s.origin}] ${Oo(s.text,dh)}`)}return e.join(`
131
- `)}function wh(n,e,t){let s=[];return s.push("OUTPUT: Return the FULL text with only the flagged lines rewritten."),s.push("- Include all lines (changed + unchanged)"),s.push("- Preserve markdown formatting"),s.push("- No commentary, no fences"),s.join(`
132
- `)}function vh(n,e){return n.split(`
133
- `)[e-1]?.trim()||""}function Oo(n,e){return n.length<=e?n:n.slice(0,e-3)+"..."}var ko=70;var xh=25;function xs(n,e,t,s){let i=[],r=Le(e,t),o=r.summary.red,a=r.summary.yellow;if(o>0&&i.push(`Rewrite introduced ${o} new critical issues`),s){let x=new Set(s.signals.map(E=>E.id)),$=r.signals.filter(E=>!x.has(E.id));if($.length>0){let E=[...new Set($.map(G=>G.id))].slice(0,5);i.push(`Rewrite introduced new patterns: ${E.join(", ")}`)}}let l=xo(e,t.cadence);l<100-xh&&i.push(`Cadence deviation: score ${l}/100 (target avg ${t.cadence?.avg_words||"?"} words)`);let h=[],u=e.toLowerCase();for(let x of t.never_list||[])x&&u.includes(x.toLowerCase())&&h.push(x);h.length>0&&i.push(`Never-list violations: ${h.join(", ")}`);let f=Sh(n,e);f<60&&i.push(`Semantic drift detected: score ${f}/100`);let p=e.length/Math.max(1,n.length);(p<.5||p>2)&&i.push(`Length changed too much: ${(p*100).toFixed(0)}% of original`);let d=Math.max(0,100-o*20-a*5),m=Math.max(0,100-h.length*25),g=Math.round(d*.35+l*.25+f*.25+m*.15),y=g<ko&&i.length>0,b=!1,v;return y&&(v=$h(i,r,t)),{valid:g>=ko,score:g,issues:i,newSignals:r,cadenceScore:l,neverListHits:h,needsRetry:y,needsVerification:b,retryInstruction:v}}function Sh(n,e){let t=Ao(n),s=Ao(e);if(t.size===0)return 100;let i=0;for(let l of t)s.has(l)&&i++;let r=i/t.size*100,o=e.length/Math.max(1,n.length),a=o>=.7&&o<=1.5?100:Math.max(0,100-Math.abs(1-o)*100);return Math.round(r*.7+a*.3)}function Ao(n){let e=n.toLowerCase().match(/[a-z]{4,}/g)||[],t=new Set(["that","this","with","from","have","been","were","they","their","would","could","should","about","which","when","what","there","than","them","then","into","over","also","just","more","some","very","your","only","will","each","make","like","well","back","much","most","other","after"]);return new Set(e.filter(s=>!t.has(s)))}function $h(n,e,t){let s=[];s.push("The rewrite had these issues:");for(let r of n)s.push(`- ${r}`);s.push("");let i=e.byRule;if(i.size>0){s.push("Fix these specific patterns:");for(let[r,o]of i){let a=o.map(l=>l.line).join(", ");s.push(`- ${r} on lines ${a}`)}}return t.never_list?.length&&(s.push(""),s.push(`Remember: never use these words: ${t.never_list.join(", ")}`)),s.join(`
134
- `)}var Fo=50;async function jo(n,e,t){let s=lt(),i;if(n&&e?(s=n,i=e):n&&(n.endsWith(".md")||se.existsSync(n)?i=n:s=n),!s){try{let{apiGet:d}=await Promise.resolve().then(()=>(U(),Ut));(await d("/cli/profiles")).profiles?.length||(console.error(`
123
+ `);let l=0;for(let u of r)if(u.findings.length!==0){console.log(` ${c.bold(u.file)} ${c.dim(`(${u.lines} lines)`)}`);for(let f of u.findings)Qn(f),l++;console.log("")}er(o);let h=It();if(h.length>0){console.log(` ${c.yellow("\u{1F4A1} suggestions:")}`);for(let u of h.slice(0,3))console.log(` ${c.dim("\u2192")} ${u.suggestion}`);console.log("")}if(e.failOnHit&&o.red+o.yellow>0&&process.exit(1),o.red+o.yellow>0)try{(await E("/cli/profiles")).profiles?.length||console.log(` ${c.yellow("tip:")} create a voice profile for personalized results \u2014 run: ${c.cyan("hyv onboard")}
124
+ `)}catch{}}var se=S(require("fs"));var Hc=[{id:"ai.delve",category:"ai-slop",severity:"red",regex:/\bdelve\b/gi,suggestion:"use a specific verb: dig, explore, look at",autoFixable:!0},{id:"ai.leverage",category:"ai-slop",severity:"red",regex:/\bleverage\b/gi,suggestion:"use: use, apply, build on",autoFixable:!0},{id:"ai.tapestry",category:"ai-slop",severity:"red",regex:/\btapestry\b/gi,suggestion:"be specific about what you mean",autoFixable:!0},{id:"ai.holistic",category:"ai-slop",severity:"red",regex:/\bholistic\b/gi,suggestion:"describe the actual approach",autoFixable:!0},{id:"ai.robust",category:"ai-slop",severity:"yellow",regex:/\brobust\b/gi,suggestion:"say what actually makes it strong",autoFixable:!0},{id:"ai.pivotal",category:"ai-slop",severity:"yellow",regex:/\bpivotal\b/gi,suggestion:"say why it matters specifically",autoFixable:!0},{id:"ai.foster",category:"ai-slop",severity:"yellow",regex:/\bfoster\b/gi,suggestion:"use: build, grow, encourage, support",autoFixable:!0},{id:"ai.harness",category:"ai-slop",severity:"yellow",regex:/\bharness\b/gi,suggestion:"use: use, apply, work with",autoFixable:!0},{id:"ai.illuminate",category:"ai-slop",severity:"yellow",regex:/\billuminate\b/gi,suggestion:"use: show, explain, highlight",autoFixable:!0},{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",autoFixable:!0},{id:"ai.fast-paced",category:"ai-slop",severity:"red",regex:/\bfast[\s-]paced\b/gi,suggestion:"cut this \u2014 every industry says this",autoFixable:!0},{id:"ai.game-changer",category:"ai-slop",severity:"red",regex:/\bgame[\s-]changer\b/gi,suggestion:"explain what actually changed",autoFixable:!0},{id:"ai.paradigm",category:"ai-slop",severity:"red",regex:/\bparadigm\b/gi,suggestion:"describe the actual shift",autoFixable:!0},{id:"ai.synergy",category:"ai-slop",severity:"red",regex:/\bsynergy\b/gi,suggestion:"describe what works together and why",autoFixable:!0},{id:"ai.ecosystem",category:"ai-slop",severity:"yellow",regex:/\becosystem\b/gi,suggestion:"name the specific tools/partners/platforms",autoFixable:!0},{id:"ai.seamless",category:"ai-slop",severity:"yellow",regex:/\bseamless\b/gi,suggestion:"describe how it actually works",autoFixable:!0},{id:"ai.actionable",category:"ai-slop",severity:"yellow",regex:/\bactionable\b/gi,suggestion:"just give the action, don't label it",autoFixable:!0},{id:"ai.granular",category:"ai-slop",severity:"yellow",regex:/\bgranular\b/gi,suggestion:"say: specific, detailed, or name the level",autoFixable:!0},{id:"ai.impactful",category:"ai-slop",severity:"yellow",regex:/\bimpactful\b/gi,suggestion:"describe the actual impact",autoFixable:!0},{id:"ai.transform",category:"ai-slop",severity:"yellow",regex:/\btransform\b/gi,suggestion:"describe what specifically changed",autoFixable:!1},{id:"ai.empower",category:"ai-slop",severity:"yellow",regex:/\bempower\b/gi,suggestion:"describe what people can actually do",autoFixable:!0},{id:"ai.unlock",category:"ai-slop",severity:"yellow",regex:/\bunlock\b/gi,suggestion:"describe what they get access to",autoFixable:!0},{id:"ai.nuanced",category:"ai-slop",severity:"yellow",regex:/\bnuanced\b/gi,suggestion:"explain the specific complexity",autoFixable:!0},{id:"ai.multifaceted",category:"ai-slop",severity:"red",regex:/\bmultifaceted\b/gi,suggestion:"name the specific aspects",autoFixable:!0},{id:"ai.comprehensive",category:"ai-slop",severity:"yellow",regex:/\bcomprehensive\b/gi,suggestion:"say what it covers specifically",autoFixable:!1},{id:"ai.innovative",category:"ai-slop",severity:"yellow",regex:/\binnovative\b/gi,suggestion:"describe what's actually new",autoFixable:!0},{id:"ai.cut[t]?ing-edge",category:"ai-slop",severity:"red",regex:/\bcut(?:t)?ing[\s-]edge\b/gi,suggestion:"name the specific technology",autoFixable:!0},{id:"ai.state-of-the-art",category:"ai-slop",severity:"red",regex:/\bstate[\s-]of[\s-]the[\s-]art\b/gi,suggestion:"describe what makes it current",autoFixable:!0},{id:"ai.best-practices",category:"ai-slop",severity:"yellow",regex:/\bbest[\s-]practices?\b/gi,suggestion:"name the specific practice",autoFixable:!1},{id:"ai.world-class",category:"ai-slop",severity:"red",regex:/\bworld[\s-]class\b/gi,suggestion:"prove it with specifics",autoFixable:!0},{id:"ai.second-to-none",category:"ai-slop",severity:"red",regex:/\bsecond[\s-]to[\s-]none\b/gi,suggestion:"drop the superlative, show the work",autoFixable:!0}],qc=[{id:"formula.firstly",category:"ai-slop",severity:"yellow",regex:/\bfirstly\b/gi,suggestion:'just start \u2014 "firstly" is filler',autoFixable:!0},{id:"formula.secondly",category:"ai-slop",severity:"yellow",regex:/\bsecondly\b/gi,suggestion:'just continue \u2014 "secondly" is filler',autoFixable:!0},{id:"formula.lastly",category:"ai-slop",severity:"yellow",regex:/\blastly\b/gi,suggestion:'just end \u2014 "lastly" is filler',autoFixable:!0},{id:"formula.moreover",category:"ai-slop",severity:"yellow",regex:/\bmoreover\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.furthermore",category:"ai-slop",severity:"yellow",regex:/\bfurthermore\b/gi,suggestion:"just add the point",autoFixable:!0},{id:"formula.in-conclusion",category:"ai-slop",severity:"red",regex:/\bin conclusion\b/gi,suggestion:"just end. readers know it's the end.",autoFixable:!0},{id:"formula.in-summary",category:"ai-slop",severity:"red",regex:/\bin summary\b/gi,suggestion:"just summarize. the label is redundant.",autoFixable:!0},{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.",autoFixable:!0},{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",autoFixable:!0},{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",autoFixable:!0},{id:"formula.it-goes-without",category:"ai-slop",severity:"yellow",regex:/\bit goes without saying\b/gi,suggestion:"then don't say it",autoFixable:!0},{id:"formula.in-today",category:"ai-slop",severity:"red",regex:/\bin today'?s\b/gi,suggestion:"start with your actual point instead",autoFixable:!0},{id:"formula.lets-dive",category:"ai-slop",severity:"red",regex:/\blet'?s (?:dive|jump|dig|delve)\b/gi,suggestion:"just start. no diving needed.",autoFixable:!0},{id:"formula.without-further",category:"ai-slop",severity:"red",regex:/\bwithout further ado\b/gi,suggestion:"cut this \u2014 just get to it",autoFixable:!0},{id:"formula.its-worth-noting",category:"ai-slop",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0}],Bc=[{id:"hedge.some-might",category:"voice-drift",severity:"yellow",regex:/\bsome might say\b/gi,suggestion:"commit to the claim or drop it",autoFixable:!0},{id:"hedge.arguably",category:"voice-drift",severity:"yellow",regex:/\barguably\b/gi,suggestion:"commit. say it or don't.",autoFixable:!0},{id:"hedge.worth-noting",category:"voice-drift",severity:"yellow",regex:/\bit'?s worth noting\b/gi,suggestion:"just note it directly",autoFixable:!0},{id:"hedge.to-some-extent",category:"voice-drift",severity:"yellow",regex:/\bto some extent\b/gi,suggestion:"be specific about the extent",autoFixable:!0},{id:"hedge.perhaps",category:"voice-drift",severity:"yellow",regex:/\bperhaps\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.maybe",category:"voice-drift",severity:"yellow",regex:/\bmaybe\b/gi,suggestion:"commit or cut",autoFixable:!0},{id:"hedge.possibly",category:"voice-drift",severity:"yellow",regex:/\bpossibly\b/gi,suggestion:"commit or cut",autoFixable:!1},{id:"hedge.it-seems",category:"voice-drift",severity:"yellow",regex:/\bit seems\b/gi,suggestion:"state it directly",autoFixable:!0},{id:"hedge.i-think",category:"voice-drift",severity:"yellow",regex:/\bi think\b/gi,suggestion:'just say it. the "i think" is implied.',autoFixable:!0},{id:"hedge.in-my-opinion",category:"voice-drift",severity:"yellow",regex:/\bin my opinion\b/gi,suggestion:"just state it. it's your article.",autoFixable:!0}],Uc=[{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",autoFixable:!1},{id:"struct.not-just-but-also",category:"structure",severity:"yellow",regex:/\bnot\s+just\b.{3,80}\bbut\s+(?:also\s+)?/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.more-than-just",category:"structure",severity:"yellow",regex:/\bmore\s+than\s+just\b/gi,suggestion:"say what it IS, not what it isn't",autoFixable:!1},{id:"struct.in-order-to",category:"structure",severity:"yellow",regex:/\bin order to\b/gi,suggestion:'just use "to"',autoFixable:!0},{id:"struct.due-to-the-fact",category:"structure",severity:"yellow",regex:/\bdue to the fact that\b/gi,suggestion:'use "because"',autoFixable:!0},{id:"struct.for-the-purpose",category:"structure",severity:"yellow",regex:/\bfor the purpose of\b/gi,suggestion:'use "to"',autoFixable:!0},{id:"struct.which-is-another",category:"structure",severity:"red",regex:/\bwhich is another way of saying\b/gi,suggestion:"just say the thing directly",autoFixable:!1},{id:"struct.in-other-words",category:"structure",severity:"red",regex:/\bin other words\b/gi,suggestion:"just say it once, well",autoFixable:!1},{id:"struct.rhetorical-truth",category:"structure",severity:"yellow",regex:/\b(?:the\s+)?(?:uncomfortable|hard|harsh|brutal|ugly|unsexy|real|honest)\s+(?:truth|reality)\b/gi,suggestion:"state the fact directly, skip the framing",autoFixable:!1},{id:"struct.truth-is",category:"structure",severity:"yellow",regex:/\bthe\s+truth\s+is\b/gi,suggestion:"just say the truth. the framing is filler.",autoFixable:!1},{id:"struct.lesson-setup",category:"structure",severity:"yellow",regex:/\b(?:here'?s\s+)?what\s+.{3,80}\s+(?:taught|teaches)\s+(?:me|us|you|everyone)\b/gi,suggestion:"just share the lesson",autoFixable:!1},{id:"struct.negation-cascade",category:"structure",severity:"yellow",regex:/\b(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w[^.!?\n]{0,80}[.!?][ \t]*\n?[ \t]*(?:no|not)\s+\w/gi,suggestion:"three negations in a row reads like AI performance",autoFixable:!1},{id:"struct.inline-triplet",category:"structure",severity:"yellow",regex:/\bit'?s\s+\w[^,.!?;\n]{0,30},\s*it'?s\s+\w[^,.!?;\n]{0,30}[,.]?\s*(?:and\s+)?it'?s\b/gi,suggestion:`the "it's X, it's Y, it's Z" pattern is an AI tell`,autoFixable:!1},{id:"struct.moment-becomes",category:"structure",severity:"red",regex:/\b(?:the\s+)?moment\b.{3,80}\bbecomes?\b/gi,suggestion:'"the moment X becomes Y" is polished founder cadence \u2014 restructure',autoFixable:!1},{id:"struct.same-better",category:"structure",severity:"red",regex:/\bsame\s+[^.!?\n]{1,35}[.!?]\s*(?:better|nicer|cleaner|calmer|safer)\s+[^.!?\n]{1,35}[.!?]?/gi,suggestion:'"same X. better Y." is screenshot-ready founder cadence',autoFixable:!1},{id:"struct.this-is-why",category:"structure",severity:"yellow",regex:/\bthis\s+is\s+(?:also\s+)?(?:why|how|where|what\b)/gi,suggestion:"signpost claims are AI tells \u2014 just make the point",autoFixable:!1},{id:"struct.heres-where",category:"structure",severity:"yellow",regex:/\b(?:here'?s|here\s+is)\s+(?:where|why|what|the\s+part|the\s+(?:harder|real|actual|main|bigger)\s+problem)\b/gi,suggestion:"just make the point without the signpost",autoFixable:!1},{id:"struct.generic-buyer",category:"structure",severity:"red",regex:/\bpeople\s+don'?t\s+just\s+buy\b|\bpeople\s+buy\s+the\s+feeling\b/gi,suggestion:"generic buyer psychology is AI filler",autoFixable:!1}],zc=[{id:"punct.em-dash",category:"ai-slop",severity:"yellow",regex:/—/g,suggestion:"em dashes are an AI tell \u2014 use a period, comma, or parentheses",autoFixable:!1}],Gc=[...Hc,...qc,...Bc,...Uc,...zc],xo={delve:"dig",leverage:"use",tapestry:"web",holistic:"complete",robust:"strong",pivotal:"key",foster:"build",harness:"use",illuminate:"show","ever-evolving":"changing",everchanging:"changing","fast-paced":"fast","game-changer":"breakthrough",paradigm:"model",synergy:"fit",ecosystem:"network",seamless:"smooth",actionable:"practical",granular:"specific",impactful:"effective",empower:"enable",unlock:"open",nuanced:"complex",multifaceted:"complex",innovative:"new","cutting-edge":"modern","state-of-the-art":"modern","world-class":"excellent","second-to-none":"best",firstly:"",secondly:"",lastly:"",moreover:"",furthermore:"",perhaps:"",arguably:""};function Jc(n){let t=n.split(/[.!?]+/).filter(o=>o.trim().length>0).map(o=>o.trim().split(/\s+/).length),s=t.length>0?t.reduce((o,a)=>o+a,0)/t.length:0,i=t.length>1?Math.sqrt(t.reduce((o,a)=>o+Math.pow(a-s,2),0)/t.length):0,r="low";return i>8?r="high":i>4&&(r="medium"),{avgWords:s,variance:r,sentences:t}}function Yc(n){let e=[],t=n.split(`
125
+ `),s=t.findIndex(r=>r.trim().length>10);if(s<0)return e;let i=t[s].trim().toLowerCase();return(i.endsWith("?")||/^(?:have you|do you|did you|what if|why do|how do|what's|how's)\b/.test(i))&&e.push({id:"voice.question-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a question instead of a concrete observation",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with a concrete observation, moment, mechanism, or pattern",autoFixable:!1}),/^(?:the most important thing|the key to|success is|if you want to|what i learned|here's what|the biggest mistake)\b/.test(i)&&e.push({id:"voice.lesson-opener",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a lesson or inspirational claim",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Open with something concrete and specific, not a lesson",autoFixable:!1}),/^(?:most|many)\s+(?:brands|teams|people|founders|companies|businesses)\b/.test(i)&&e.push({id:"voice.generic-generalization",line:s+1,column:1,category:"voice-drift",severity:"yellow",rule:"Opens with a generic generalization",match:i.slice(0,80),excerpt:t[s].trim().slice(0,120),suggestion:"Start with a specific observation, not a sweeping claim",autoFixable:!1}),e}function Kc(n){let e=[],t=n.split(`
126
+ `),s=[];for(let i=0;i<t.length;i++){let r=t[i].trim();if(r.length<10||r.startsWith("#")||r.startsWith("```"))continue;let o=r.split(/(?<=[.!?])\s+/);for(let a of o){let l=a.trim().split(/\s+/).filter(h=>h.length>0);l.length>0&&l.length<=5?(s.push({line:i+1,text:a.trim()}),s.length>=3&&(e.push({id:"voice.staccato-triplet",line:s[0].line,column:1,category:"cadence",severity:"yellow",rule:"Three short sentences in a row reads like performance",match:s.map(h=>h.text).join(" | "),excerpt:s[0].text,suggestion:"Vary sentence length \u2014 short staccato runs feel like AI trying to sound punchy",autoFixable:!1}),s=[])):s=[]}}return e}var Xc=new Set(["alignment","authenticity","awareness","clarity","confidence","consistency","differentiation","execution","framework","identity","messaging","narrative","personality","positioning","preference","presence","recall","relevance","resonance","signal","strategy","trust","utility","value"]);function Zc(n,e){let t=[];return(n.toLowerCase().match(/[a-z']+/g)||[]).filter(r=>Xc.has(r)).length>=3&&!/\b(?:for example|for instance|such as)\b|\d/i.test(n)&&t.push({id:"voice.abstract-cluster",line:e,column:1,category:"voice-drift",severity:"yellow",rule:"Abstract noun cluster \u2014 reads like a strategy deck",match:n.trim().slice(0,80),excerpt:n.trim().slice(0,120),suggestion:"Ground in specifics \u2014 name the thing, show the number, quote the person",autoFixable:!1}),t}function Qc(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r)continue;let o=r.toLowerCase().trim();i.includes(o)&&s.push({id:"voice.never-list",line:e,column:i.indexOf(o)+1,category:"voice-drift",severity:"red",rule:`Never-list violation: "${r}"`,match:o,excerpt:n.trim().slice(0,120),suggestion:`Your voice profile explicitly bans "${r}" \u2014 restructure`,autoFixable:!1})}return s}function eh(n,e,t){let s=[],i=n.toLowerCase();for(let r of t){if(!r.text)continue;let a=r.text.toLowerCase().trim().split(/\s+/);if(a.length<3)continue;let l=a.slice(0,4).join(" ");i.includes(l)&&s.push({id:`learned.${r.type}`,line:e,column:i.indexOf(l)+1,category:"learned",severity:"yellow",rule:`Learned pattern (${r.type}): "${r.text.slice(0,60)}"`,match:l,excerpt:n.trim().slice(0,120),suggestion:"Your editing history suggests this pattern should be rewritten",autoFixable:!1})}return s}function th(n){let e=new Set;for(let t of n)t.status==="accepted"&&t.rule_id&&e.add(t.rule_id),t.status==="dismissed"&&t.accept_rate!==void 0&&t.accept_rate<.25&&e.add(t.rule_id);return e}function De(n,e){let t=n.split(`
127
+ `),s=[],i=new Map,r=new Map,o=e?.drift_snapshot?th(e.drift_snapshot):new Set,a=e?.never_list||[],l=e?.learned_patterns||[];for(let d=0;d<t.length;d++){let m=t[d],g=d+1;if(!m.startsWith("```")&&!m.startsWith("---")&&!m.startsWith("#")&&!(m.trim().length<10)){for(let y of Gc){y.regex.lastIndex=0;let b;for(;(b=y.regex.exec(m))!==null;){let v=o.has(y.id);s.push({id:y.id,line:g,column:b.index+1,category:y.category,severity:v?"yellow":y.severity,rule:y.suggestion,match:b[0],excerpt:sh(m.trim(),b.index,b[0].length),suggestion:y.suggestion,autoFixable:y.autoFixable,driftAccepted:v})}}s.push(...Zc(m,g)),s.push(...Qc(m,g,a)),s.push(...eh(m,g,l))}}s.push(...Yc(n)),s.push(...Kc(n));for(let d of s)i.has(d.line)||i.set(d.line,[]),i.get(d.line).push(d),r.has(d.id)||r.set(d.id,[]),r.get(d.id).push(d);let h=s.filter(d=>d.severity==="red").length,u=s.filter(d=>d.severity==="yellow").length,f=s.filter(d=>d.autoFixable).length,p=s.filter(d=>d.driftAccepted).length;return{signals:s,byLine:i,byRule:r,summary:{red:h,yellow:u,autoFixable:f,driftAccepted:p,total:s.length}}}function So(n,e){let{avgWords:t,variance:s}=Jc(n);if(!e?.avg_words)return 100;let i=e.avg_words,r=Math.abs(t-i)/i,o=Math.max(0,Math.round((1-r)*100));return e.variance&&s===e.variance?o=Math.min(100,o+10):e.variance&&s!==e.variance&&(o=Math.max(0,o-10)),o}function sh(n,e,t){let s=n.slice(0,e),i=n.slice(e,e+t),r=n.slice(e+t);return`${s}\xAB${i}\xBB${r}`.slice(0,120)}function bs(n){let e=n.byLine,t=[];for(let[h,u]of e){let f=u.filter(y=>!y.driftAccepted);if(f.length===0){t.push({line:h,signals:u,strategy:"skip",priority:0,instruction:"All issues on this line are consistently dismissed by user"});continue}let p=f.map(y=>ih(y)),d=nh(p),m=oh(h,f,d),g=d==="auto_fix"?ah(h,f):void 0;t.push({line:h,signals:f,strategy:d,priority:rh(f,d),instruction:m,autoFixText:g})}let s=t.filter(h=>h.strategy==="auto_fix"),i=t.filter(h=>h.strategy==="restructure"||h.strategy==="voice_drift"),r=t.filter(h=>h.strategy==="skip"),o=Math.max(1,n.summary.total>0?new Set(n.signals.map(h=>h.line)).size:0),a=t.filter(h=>h.strategy!=="skip").length,l=Math.max(0,Math.round((o-a)/Math.max(1,o)*100));return{issues:t,autoFixes:s,llmFixes:i,skipped:r,stats:{total:t.length,autoFixable:s.length,needsLLM:i.length,skipped:r.length,score:l}}}function ih(n){return n.driftAccepted?"skip":n.autoFixable&&n.category==="ai-slop"||n.autoFixable&&n.category==="voice-drift"?"auto_fix":n.category==="voice-drift"||n.category==="cadence"||n.category==="learned"?"voice_drift":(n.category==="structure","restructure")}function nh(n){return n.includes("restructure")?"restructure":n.includes("voice_drift")?"voice_drift":n.includes("auto_fix")?"auto_fix":"skip"}function rh(n,e){let t=0,s=n.filter(r=>r.severity==="red").length,i=n.filter(r=>r.severity==="yellow").length;return t+=s*10+i*5,e==="restructure"&&(t+=20),e==="voice_drift"&&(t+=15),e==="auto_fix"&&(t+=5),t}function oh(n,e,t){let s=[...new Set(e.map(r=>r.rule))],i=e.filter(r=>r.severity==="red");if(t==="auto_fix")return`Replace AI-slop words: ${s.join("; ")}`;if(t==="restructure"){let r=e.map(o=>o.match).filter(Boolean).slice(0,3);return`Restructure line ${n}: ${s[0]||"structural issue"}. Patterns: ${r.join(", ")}`}return t==="voice_drift"?`Rewrite line ${n} to match voice profile: ${s[0]||"voice drift"}`:`Review line ${n}`}function ah(n,e){return e.filter(s=>s.autoFixable).map(s=>s.id).join(",")}function ws(n,e){let t=n.split(`
128
+ `),s=[];for(let i of e){if(i.strategy!=="auto_fix")continue;let r=i.line-1;if(r<0||r>=t.length)continue;let o=t[r],a=o;for(let l of i.signals){if(!l.autoFixable)continue;let h=xo[l.match.toLowerCase()];if(h!==void 0){let u=new RegExp(lh(l.match),"gi");a=a.replace(u,f=>h===""?"":f[0]===f[0].toUpperCase()?h.charAt(0).toUpperCase()+h.slice(1):h)}}a=a.replace(/\s{2,}/g," ").trim(),a!==o&&(s.push({line:i.line,before:o,after:a,rule:i.signals.map(l=>l.id).join(", ")}),t[r]=a)}return{original:n,fixed:t.join(`
129
+ `),changes:s,changed:s.length>0}}function lh(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}V();Re();var ae=S(require("fs")),Ri=S(require("path")),Co=S(require("os")),$o=5*60*1e3,vs=new Map;async function lt(n,e={}){let t=e.includeSamples!==!1,s=e.forceRefresh||!1;if(!s){let r=vs.get(n);if(r&&Date.now()-r.timestamp<$o)return r.data}let i=Oo(n);return i&&!s?Date.now()-i.timestamp<$o?(vs.set(n,i),i.data):(vs.set(n,i),ch(n).catch(()=>{}),i.data):_o(n)}async function _o(n){try{let e=await E(`/cli/profiles/${encodeURIComponent(n)}/full`),t={id:e.profile.id,name:e.profile.name,slug:e.profile.slug,brand:e.profile.brand,keywords:e.profile.keywords,description:e.profile.description,body:e.body,drift_snapshot:e.drift_snapshot||[],learned_patterns:e.learned_patterns||[],voice_samples:e.voice_samples||[],voice_rules:e.voice_rules||[],never_list:e.never_list||[],cadence:e.cadence||{}},s={data:t,timestamp:Date.now(),version:1};return vs.set(n,s),hh(n,s),t}catch{let t=Oo(n);if(t)return t.data;let s=bn(n);if(s)return uh(n,s);throw new Error(`Profile not found: ${n}. Run: hyv init`)}}async function ch(n){try{await _o(n)}catch{}}var ji=Ri.join(Co.homedir(),".hyv","cache","profiles");function Eo(n){return Ri.join(ji,`${n.replace(/[^a-z0-9-]/gi,"_")}.json`)}function Oo(n){try{let e=Eo(n);if(!ae.existsSync(e))return null;let t=ae.readFileSync(e,"utf-8"),s=JSON.parse(t);return!s.data||!s.timestamp?null:s}catch{return null}}function hh(n,e){try{ae.existsSync(ji)||ae.mkdirSync(ji,{recursive:!0}),ae.writeFileSync(Eo(n),JSON.stringify(e),"utf-8")}catch{}}function uh(n,e){return{id:"",name:n,slug:n,body:e,drift_snapshot:[],learned_patterns:[],voice_samples:[],voice_rules:[],never_list:[],cadence:{}}}function ct(){return Ut().profile}var fh=15,dh=2,ph=200,gh=10;function xs(n,e,t,s,i=1){let r=[],o=t.issues.filter(l=>l.strategy==="restructure"||l.strategy==="voice_drift").sort((l,h)=>h.priority-l.priority).slice(0,fh);return r.push(mh(n,o.length,i)),r.push(""),o.length>0&&(r.push(yh(e,o,n)),r.push("")),o.some(l=>l.strategy==="voice_drift")&&n.voice_samples?.length&&(r.push(wh(n.voice_samples)),r.push("")),r.push(vh(e,o,i)),r.join(`
130
+ `)}function mh(n,e,t){let s=[];if(s.push(`Rewrite ${e} lines to match ${n.name}'s voice.`),n.description&&s.push(`Voice: ${n.description.slice(0,100)}`),n.cadence?.avg_words&&s.push(`Rhythm: ${n.cadence.avg_words} words/sentence, ${n.cadence.variance||"mixed"} variance`),n.never_list?.length){let r=n.never_list.slice(0,gh);s.push(`Never: ${r.join(", ")}`)}let i=n.drift_snapshot.filter(r=>r.status==="accepted"&&r.profile_line).map(r=>r.profile_line).slice(0,3);return i.length&&s.push(`User voice: ${i.join("; ")}`),t>1&&s.push(`RETRY ${t}: Previous rewrite had issues. Be more careful.`),s.join(`
131
+ `)}function yh(n,e,t){let s=[];s.push("FIX THESE LINES:");for(let i of e){let r=xh(n,i.line),o=bh(i,t);s.push(`${i.line}: "${ko(r,80)}" \u2192 ${o}`)}return s.join(`
132
+ `)}function bh(n,e){let t=n.signals.filter(r=>r.autoFixable&&r.match);if(t.length>0&&t.length===n.signals.length)return`replace: ${t.map(r=>r.match).join(", ")}`;let s=n.signals.find(r=>r.category==="structure");if(s)return s.suggestion.slice(0,60);let i=n.signals.find(r=>r.category==="voice-drift"||r.category==="learned");return i?i.suggestion.slice(0,60):n.signals.some(r=>r.category==="cadence")?`match rhythm: ${e.cadence?.avg_words||12} words/sentence`:n.instruction.slice(0,60)}function wh(n){let e=["VOICE EXAMPLES:"];for(let t=0;t<Math.min(dh,n.length);t++){let s=n[t];e.push(`[${s.origin}] ${ko(s.text,ph)}`)}return e.join(`
133
+ `)}function vh(n,e,t){let s=[];return s.push("OUTPUT: Return the FULL text with only the flagged lines rewritten."),s.push("- Include all lines (changed + unchanged)"),s.push("- Preserve markdown formatting"),s.push("- No commentary, no fences"),s.join(`
134
+ `)}function xh(n,e){return n.split(`
135
+ `)[e-1]?.trim()||""}function ko(n,e){return n.length<=e?n:n.slice(0,e-3)+"..."}var Ao=70;var Sh=25;function Ss(n,e,t,s){let i=[],r=De(e,t),o=r.summary.red,a=r.summary.yellow;if(o>0&&i.push(`Rewrite introduced ${o} new critical issues`),s){let x=new Set(s.signals.map(O=>O.id)),$=r.signals.filter(O=>!x.has(O.id));if($.length>0){let O=[...new Set($.map(G=>G.id))].slice(0,5);i.push(`Rewrite introduced new patterns: ${O.join(", ")}`)}}let l=So(e,t.cadence);l<100-Sh&&i.push(`Cadence deviation: score ${l}/100 (target avg ${t.cadence?.avg_words||"?"} words)`);let h=[],u=e.toLowerCase();for(let x of t.never_list||[])x&&u.includes(x.toLowerCase())&&h.push(x);h.length>0&&i.push(`Never-list violations: ${h.join(", ")}`);let f=$h(n,e);f<60&&i.push(`Semantic drift detected: score ${f}/100`);let p=e.length/Math.max(1,n.length);(p<.5||p>2)&&i.push(`Length changed too much: ${(p*100).toFixed(0)}% of original`);let d=Math.max(0,100-o*20-a*5),m=Math.max(0,100-h.length*25),g=Math.round(d*.35+l*.25+f*.25+m*.15),y=g<Ao&&i.length>0,b=!1,v;return y&&(v=_h(i,r,t)),{valid:g>=Ao,score:g,issues:i,newSignals:r,cadenceScore:l,neverListHits:h,needsRetry:y,needsVerification:b,retryInstruction:v}}function $h(n,e){let t=Fo(n),s=Fo(e);if(t.size===0)return 100;let i=0;for(let l of t)s.has(l)&&i++;let r=i/t.size*100,o=e.length/Math.max(1,n.length),a=o>=.7&&o<=1.5?100:Math.max(0,100-Math.abs(1-o)*100);return Math.round(r*.7+a*.3)}function Fo(n){let e=n.toLowerCase().match(/[a-z]{4,}/g)||[],t=new Set(["that","this","with","from","have","been","were","they","their","would","could","should","about","which","when","what","there","than","them","then","into","over","also","just","more","some","very","your","only","will","each","make","like","well","back","much","most","other","after"]);return new Set(e.filter(s=>!t.has(s)))}function _h(n,e,t){let s=[];s.push("The rewrite had these issues:");for(let r of n)s.push(`- ${r}`);s.push("");let i=e.byRule;if(i.size>0){s.push("Fix these specific patterns:");for(let[r,o]of i){let a=o.map(l=>l.line).join(", ");s.push(`- ${r} on lines ${a}`)}}return t.never_list?.length&&(s.push(""),s.push(`Remember: never use these words: ${t.never_list.join(", ")}`)),s.join(`
136
+ `)}V();var jo=50;async function Ro(n,e,t){try{await Te()}catch(d){t.json?console.log(JSON.stringify({error:d.message})):console.log(`
137
+ ${c.red("\u2717")} ${d.message}
138
+ `),process.exit(1);return}let s=ct(),i;if(n&&e?(s=n,i=e):n&&(n.endsWith(".md")||se.existsSync(n)?i=n:s=n),!s){try{let{apiGet:d}=await Promise.resolve().then(()=>(V(),zt));(await d("/cli/profiles")).profiles?.length||(console.error(`
135
139
  ${c.red("\u2717")} no voice profiles found`),console.error(` ${c.dim("create one:")} hyv onboard`),console.error(` ${c.dim("or visit:")} https://holdyourvoice.com/dashboard
136
140
  `),process.exit(1))}catch{}console.error(`
137
141
  ${c.red("\u2717")} no profile specified`),console.error(` ${c.dim("usage:")} hyv rewrite <profile> <file>`),console.error(` ${c.dim("or set a default:")} hyv init --profile <name>`),process.exit(1)}let r;t.text?r=t.text:i?(se.existsSync(i)||(console.error(`
@@ -139,40 +143,40 @@ ${t}`)}return _.writeFileSync(oo,new Date().toISOString(),"utf-8"),{consolidated
139
143
  ${c.red("\u2717")} no text provided`),process.exit(1)),r=se.readFileSync(0,"utf-8")),r.trim()||(console.error(`
140
144
  ${c.red("\u2717")} empty draft`),process.exit(1)),console.log(`
141
145
  ${C()} ${c.dim("algorithm")} ${c.dim("v2.0")}
142
- `),console.log(` ${c.dim("1/6")} loading profile: ${c.bold(s)}`);let o;try{o=await at(s)}catch(d){console.error(`
146
+ `),console.log(` ${c.dim("1/6")} loading profile: ${c.bold(s)}`);let o;try{o=await lt(s)}catch(d){console.error(`
143
147
  ${c.red("\u2717")} ${d.message}`),process.exit(1)}console.log(` ${c.dim("drift rules:")} ${o.drift_snapshot.length}`),console.log(` ${c.dim("learned patterns:")} ${o.learned_patterns.length}`),console.log(` ${c.dim("voice samples:")} ${o.voice_samples.length}`),console.log(`
144
- ${c.dim("2/6")} extracting signals...`);let a=Le(r,o);console.log(` ${c.red(a.summary.red)} critical`),console.log(` ${c.yellow(a.summary.yellow)} advisory`),console.log(` ${c.dim(a.summary.autoFixable)} auto-fixable`),console.log(` ${c.dim(a.summary.driftAccepted)} drift-accepted (skipped)`),console.log(`
145
- ${c.dim("3/6")} classifying issues...`);let l=ys(a);console.log(` ${c.green(l.autoFixes.length)} auto-fixes`),console.log(` ${c.yellow(l.llmFixes.length)} need LLM rewrite`),console.log(` ${c.dim(l.skipped.length)} skipped`);let h=r;if(l.autoFixes.length>0){console.log(`
146
- ${c.dim("4/6")} applying ${l.autoFixes.length} auto-fixes...`);let d=bs(r,l.issues);if(h=d.fixed,d.changed){console.log(` ${c.green("\u2713")} ${d.changes.length} lines fixed`);for(let m of d.changes.slice(0,5))console.log(` ${c.dim(`line ${m.line}:`)} ${m.before.slice(0,40)} \u2192 ${c.green(m.after.slice(0,40))}`)}else console.log(` ${c.dim("no auto-fixes applied")}`)}else console.log(`
147
- ${c.dim("4/6")} no auto-fixes needed`);let u=h,f=l.stats.score,p=f<Fo;if(l.llmFixes.length>0){console.log(`
148
- ${c.dim("5/6")} building prompt for your LLM...`);let d=vs(o,h,l,a,1),m=i?`${i}.hyv-prompt.md`:"hyv-rewrite-prompt.md";se.writeFileSync(m,d,"utf-8"),console.log(` ${c.dim("prompt:")} ${m}`),t.output?(se.writeFileSync(t.output,d,"utf-8"),console.log(`
148
+ ${c.dim("2/6")} extracting signals...`);let a=De(r,o);console.log(` ${c.red(a.summary.red)} critical`),console.log(` ${c.yellow(a.summary.yellow)} advisory`),console.log(` ${c.dim(a.summary.autoFixable)} auto-fixable`),console.log(` ${c.dim(a.summary.driftAccepted)} drift-accepted (skipped)`),console.log(`
149
+ ${c.dim("3/6")} classifying issues...`);let l=bs(a);console.log(` ${c.green(l.autoFixes.length)} auto-fixes`),console.log(` ${c.yellow(l.llmFixes.length)} need LLM rewrite`),console.log(` ${c.dim(l.skipped.length)} skipped`);let h=r;if(l.autoFixes.length>0){console.log(`
150
+ ${c.dim("4/6")} applying ${l.autoFixes.length} auto-fixes...`);let d=ws(r,l.issues);if(h=d.fixed,d.changed){console.log(` ${c.green("\u2713")} ${d.changes.length} lines fixed`);for(let m of d.changes.slice(0,5))console.log(` ${c.dim(`line ${m.line}:`)} ${m.before.slice(0,40)} \u2192 ${c.green(m.after.slice(0,40))}`)}else console.log(` ${c.dim("no auto-fixes applied")}`)}else console.log(`
151
+ ${c.dim("4/6")} no auto-fixes needed`);let u=h,f=l.stats.score,p=f<jo;if(l.llmFixes.length>0){console.log(`
152
+ ${c.dim("5/6")} building prompt for your LLM...`);let d=xs(o,h,l,a,1),m=i?`${i}.hyv-prompt.md`:"hyv-rewrite-prompt.md";se.writeFileSync(m,d,"utf-8"),console.log(` ${c.dim("prompt:")} ${m}`),t.output?(se.writeFileSync(t.output,d,"utf-8"),console.log(`
149
153
  ${c.green("\u2713")} prompt written to ${c.bold(t.output)}`)):(console.log(`
150
154
  ${"\u2500".repeat(50)}`),console.log(d),console.log(`${"\u2500".repeat(50)}
151
155
  `)),console.log(` ${c.yellow("\u2192")} pass this prompt to your AI agent to rewrite`),console.log(` ${c.dim(" then validate:")} hyv validate <output.md> --profile ${s}`)}else console.log(`
152
156
  ${c.dim("5/6")} no LLM rewrite needed \u2014 all issues auto-fixable`);console.log(`
153
157
  ${c.dim("6/6")} algorithm complete`),console.log(`
154
- ${"\u2500".repeat(50)}`),console.log(` ${c.bold("Score:")} ${To(f)}/100`),console.log(` ${c.bold("Auto-fixed:")} ${l.autoFixes.length} lines`),console.log(` ${c.bold("Needs LLM:")} ${l.llmFixes.length} lines`),console.log(` ${c.bold("Skipped:")} ${l.skipped.length} lines (drift-accepted)`),p&&l.llmFixes.length>0&&console.log(`
155
- ${c.yellow("\u26A0")} Score below ${Fo} \u2014 verify the rewrite after your LLM processes it`),console.log(`${"\u2500".repeat(50)}
156
- `),ho(r,u,f,!0),t.json&&console.log(JSON.stringify({score:f,auto_fixed:l.autoFixes.length,needs_llm:l.llmFixes.length,skipped:l.skipped.length,needs_verification:p,signals:a.summary,prompt_file:l.llmFixes.length>0?i?`${i}.hyv-prompt.md`:"hyv-rewrite-prompt.md":null},null,2))}async function Ro(n,e){let t=e.profile||lt();t||(console.error(`
158
+ ${"\u2500".repeat(50)}`),console.log(` ${c.bold("Score:")} ${Po(f)}/100`),console.log(` ${c.bold("Auto-fixed:")} ${l.autoFixes.length} lines`),console.log(` ${c.bold("Needs LLM:")} ${l.llmFixes.length} lines`),console.log(` ${c.bold("Skipped:")} ${l.skipped.length} lines (drift-accepted)`),p&&l.llmFixes.length>0&&console.log(`
159
+ ${c.yellow("\u26A0")} Score below ${jo} \u2014 verify the rewrite after your LLM processes it`),console.log(`${"\u2500".repeat(50)}
160
+ `),uo(r,u,f,!0),t.json&&console.log(JSON.stringify({score:f,auto_fixed:l.autoFixes.length,needs_llm:l.llmFixes.length,skipped:l.skipped.length,needs_verification:p,signals:a.summary,prompt_file:l.llmFixes.length>0?i?`${i}.hyv-prompt.md`:"hyv-rewrite-prompt.md":null},null,2))}async function To(n,e){let t=e.profile||ct();t||(console.error(`
157
161
  ${c.red("\u2717")} no profile specified`),process.exit(1));let s;e.text?s=e.text:n&&se.existsSync(n)?s=se.readFileSync(n,"utf-8"):(process.stdin.isTTY&&(console.error(`
158
162
  ${c.red("\u2717")} no text provided`),process.exit(1)),s=se.readFileSync(0,"utf-8")),console.log(`
159
163
  ${C()} ${c.dim("validate")}
160
- `);let i=await at(t),r=Le(s,i),o=xs(s,s,i);if(console.log(` ${c.bold("Score:")} ${To(o.score)}/100`),console.log(` ${c.bold("Signals:")} ${r.summary.red} red, ${r.summary.yellow} yellow`),console.log(` ${c.bold("Cadence:")} ${o.cadenceScore}/100`),o.neverListHits.length>0&&console.log(` ${c.red("Never-list:")} ${o.neverListHits.join(", ")}`),o.issues.length>0){console.log(`
164
+ `);let i=await lt(t),r=De(s,i),o=Ss(s,s,i);if(console.log(` ${c.bold("Score:")} ${Po(o.score)}/100`),console.log(` ${c.bold("Signals:")} ${r.summary.red} red, ${r.summary.yellow} yellow`),console.log(` ${c.bold("Cadence:")} ${o.cadenceScore}/100`),o.neverListHits.length>0&&console.log(` ${c.red("Never-list:")} ${o.neverListHits.join(", ")}`),o.issues.length>0){console.log(`
161
165
  ${c.yellow("Issues:")}`);for(let a of o.issues)console.log(` - ${a}`)}o.valid?console.log(`
162
166
  ${c.green("\u2713")} text passes validation`):console.log(`
163
- ${c.yellow("\u26A0")} text needs improvement`),e.json&&console.log(JSON.stringify({score:o.score,valid:o.valid,cadence_score:o.cadenceScore,never_list_hits:o.neverListHits,issues:o.issues,signals:r.summary},null,2))}function To(n){return n>=80?c.green(String(n)):n>=50?c.yellow(String(n)):c.red(String(n))}U();async function Po(n){let t=(await k("/cli/profiles")).profiles||[];if(n.json){console.log(JSON.stringify(t,null,2));return}if(console.log(`
167
+ ${c.yellow("\u26A0")} text needs improvement`),e.json&&console.log(JSON.stringify({score:o.score,valid:o.valid,cadence_score:o.cadenceScore,never_list_hits:o.neverListHits,issues:o.issues,signals:r.summary},null,2))}function Po(n){return n>=80?c.green(String(n)):n>=50?c.yellow(String(n)):c.red(String(n))}V();async function Mo(n){let t=(await E("/cli/profiles")).profiles||[];if(n.json){console.log(JSON.stringify(t,null,2));return}if(console.log(`
164
168
  ${C()} ${c.dim("profiles")}
165
- `),t.length===0){console.log(` ${c.dim("no voice profiles yet")}`),console.log(` ${c.dim("create one at:")} ${c.cyan("https://holdyourvoice.com/dashboard")}`);return}for(let s of t){let i=c.bold(s.name||s.slug),r=s.brand?c.dim(` (${s.brand})`):"",o=s.keywords?.length?c.dim(` \u2014 ${s.keywords.slice(0,3).join(", ")}`):"";console.log(` \u25CF ${i}${r}${o}`)}console.log("")}U();Re();async function Mo(n){let e=xe();if(!e){n.json?console.log(JSON.stringify({error:"Not authenticated. Run: hyv init"})):console.log(`
166
- ${c.red("\u2717")} not authenticated. run ${c.bold("hyv init")}`),process.exit(2);return}try{let t=await k("/cli/heartbeat");if(n.json){console.log(JSON.stringify({email:t.email,name:t.name,plan:t.plan,status:t.status,server:e.base_url,key_prefix:e.api_key.slice(0,12)},null,2));return}console.log(`
169
+ `),t.length===0){console.log(` ${c.dim("no voice profiles yet")}`),console.log(` ${c.dim("create one at:")} ${c.cyan("https://holdyourvoice.com/dashboard")}`);return}for(let s of t){let i=c.bold(s.name||s.slug),r=s.brand?c.dim(` (${s.brand})`):"",o=s.keywords?.length?c.dim(` \u2014 ${s.keywords.slice(0,3).join(", ")}`):"";console.log(` \u25CF ${i}${r}${o}`)}console.log("")}V();Re();async function Io(n){let e=xe();if(!e){n.json?console.log(JSON.stringify({error:"Not authenticated. Run: hyv init"})):console.log(`
170
+ ${c.red("\u2717")} not authenticated. run ${c.bold("hyv init")}`),process.exit(2);return}try{let t=await E("/cli/heartbeat");if(n.json){console.log(JSON.stringify({email:t.email,name:t.name,plan:t.plan,status:t.status,server:e.base_url,key_prefix:e.api_key.slice(0,12)},null,2));return}console.log(`
167
171
  ${C()} ${c.dim("status")}
168
- `),console.log(` ${c.bold("account")}`),console.log(` email: ${t.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"} (${t.status||"\u2014"})`),t.plan==="none"&&console.log(` ${c.dim("subscribe at:")} ${c.cyan("https://holdyourvoice.com/dashboard")}`),console.log(""),console.log(` ${c.bold("cli")}`),console.log(` server: ${c.dim(e.base_url)}`),console.log(` key: ${c.dim(e.api_key.slice(0,12)+"...")}`),console.log("")}catch(t){n.json?console.log(JSON.stringify({error:t.message})):console.log(` ${c.red("\u2717")} connection failed: ${t.message}`),process.exit(1)}}var ke=S(require("fs"));U();async function Io(n,e,t){if(!ke.existsSync(n)){let r={error:`File not found: ${n}`};t.json?console.log(JSON.stringify(r)):console.log(`
172
+ `),console.log(` ${c.bold("account")}`),console.log(` email: ${t.email||"\u2014"}`),console.log(` plan: ${t.plan||"none"} (${t.status||"\u2014"})`),t.plan==="none"&&console.log(` ${c.dim("subscribe at:")} ${c.cyan("https://holdyourvoice.com/dashboard")}`),console.log(""),console.log(` ${c.bold("cli")}`),console.log(` server: ${c.dim(e.base_url)}`),console.log(` key: ${c.dim(e.api_key.slice(0,12)+"...")}`),console.log("")}catch(t){n.json?console.log(JSON.stringify({error:t.message})):console.log(` ${c.red("\u2717")} connection failed: ${t.message}`),process.exit(1)}}var ke=S(require("fs"));V();async function No(n,e,t){if(!ke.existsSync(n)){let r={error:`File not found: ${n}`};t.json?console.log(JSON.stringify(r)):console.log(`
169
173
  ${c.red("\u2717")} ${r.error}`),process.exit(1);return}if(!ke.existsSync(e)){let r={error:`File not found: ${e}`};t.json?console.log(JSON.stringify(r)):console.log(`
170
174
  ${c.red("\u2717")} ${r.error}`),process.exit(1);return}let s=ke.readFileSync(n,"utf-8"),i=ke.readFileSync(e,"utf-8");t.json||console.log(`
171
175
  ${C()} ${c.dim("reinforce")}
172
- `);try{let r=await M("/cli/learning/reinforce",{original:s,edited:i});t.json?console.log(JSON.stringify({ok:!0,...r})):console.log(` ${c.green("\u2713")} learning signal sent`)}catch(r){t.json?console.log(JSON.stringify({error:r.message})):console.log(` ${c.red("\u2717")} failed: ${r.message}`),process.exit(1)}}async function No(n,e){if(!ke.existsSync(n)){let s={error:`File not found: ${n}`};e.json?console.log(JSON.stringify(s)):console.log(`
176
+ `);try{let r=await M("/cli/learning/reinforce",{original:s,edited:i});t.json?console.log(JSON.stringify({ok:!0,...r})):console.log(` ${c.green("\u2713")} learning signal sent`)}catch(r){t.json?console.log(JSON.stringify({error:r.message})):console.log(` ${c.red("\u2717")} failed: ${r.message}`),process.exit(1)}}async function Lo(n,e){if(!ke.existsSync(n)){let s={error:`File not found: ${n}`};e.json?console.log(JSON.stringify(s)):console.log(`
173
177
  ${c.red("\u2717")} ${s.error}`),process.exit(1);return}let t=ke.readFileSync(n,"utf-8");e.json||console.log(`
174
178
  ${C()} ${c.dim("add sample")}
175
- `);try{let s=await M("/cli/learning/add",{text:t,profile:e.profile});e.json?console.log(JSON.stringify({ok:!0,...s})):console.log(` ${c.green("\u2713")} sample added${e.profile?` to ${c.bold(e.profile)}`:""}`)}catch(s){e.json?console.log(JSON.stringify({error:s.message})):console.log(` ${c.red("\u2717")} failed: ${s.message}`),process.exit(1)}}var Lo=S(require("fs"));U();var Ri={claude:{name:"Claude / Claude Code",wrap:(n,e)=>`You are rewriting text to match a specific voice profile. Use this voice profile for all writing:
179
+ `);try{let s=await M("/cli/learning/add",{text:t,profile:e.profile});e.json?console.log(JSON.stringify({ok:!0,...s})):console.log(` ${c.green("\u2713")} sample added${e.profile?` to ${c.bold(e.profile)}`:""}`)}catch(s){e.json?console.log(JSON.stringify({error:s.message})):console.log(` ${c.red("\u2717")} failed: ${s.message}`),process.exit(1)}}var Do=S(require("fs"));V();var Ti={claude:{name:"Claude / Claude Code",wrap:(n,e)=>`You are rewriting text to match a specific voice profile. Use this voice profile for all writing:
176
180
 
177
181
  ${e}
178
182
 
@@ -193,43 +197,43 @@ ${e}
193
197
  - Match this voice profile for all writing
194
198
  - Preserve meaning
195
199
  - Remove AI-slop patterns
196
- - Use the same rhythm and vocabulary`}};async function Do(n,e){if(!Ri[n]){let r=Object.keys(Ri).join(", ");e.json?console.log(JSON.stringify({error:`Unknown format: ${n}. Valid: ${r}`})):(console.log(`
197
- ${c.red("\u2717")} unknown format: ${c.bold(n)}`),console.log(` ${c.dim("valid formats:")} ${r}`)),process.exit(1);return}let t;try{t=(await k("/cli/profiles")).profiles||[]}catch(r){e.json?console.log(JSON.stringify({error:r.message})):console.log(`
200
+ - Use the same rhythm and vocabulary`}};async function Wo(n,e){if(!Ti[n]){let r=Object.keys(Ti).join(", ");e.json?console.log(JSON.stringify({error:`Unknown format: ${n}. Valid: ${r}`})):(console.log(`
201
+ ${c.red("\u2717")} unknown format: ${c.bold(n)}`),console.log(` ${c.dim("valid formats:")} ${r}`)),process.exit(1);return}let t;try{t=(await E("/cli/profiles")).profiles||[]}catch(r){e.json?console.log(JSON.stringify({error:r.message})):console.log(`
198
202
  ${c.red("\u2717")} failed to fetch profiles: ${r.message}`),process.exit(1);return}if(t.length===0){e.json?console.log(JSON.stringify({error:"No voice profiles found"})):(console.log(`
199
- ${c.red("\u2717")} no voice profiles found`),console.log(` ${c.dim("create one at")} ${c.cyan("https://holdyourvoice.com/dashboard")}`)),process.exit(1);return}let s=Ri[n],i=[];for(let r of t)try{let o=await k(`/cli/profiles/${encodeURIComponent(r.slug||r.name)}`),a=s.wrap(o.profile,o.body);if(e.output){let l=e.output.replace("{name}",r.slug||r.name);Lo.writeFileSync(l,a),i.push({profile:r.name,file:l})}else i.push({profile:r.name,prompt:a})}catch{i.push({profile:r.name,error:"Failed to fetch profile body"})}if(e.json){console.log(JSON.stringify({format:n,results:i},null,2));return}console.log(`
203
+ ${c.red("\u2717")} no voice profiles found`),console.log(` ${c.dim("create one at")} ${c.cyan("https://holdyourvoice.com/dashboard")}`)),process.exit(1);return}let s=Ti[n],i=[];for(let r of t)try{let o=await E(`/cli/profiles/${encodeURIComponent(r.slug||r.name)}`),a=s.wrap(o.profile,o.body);if(e.output){let l=e.output.replace("{name}",r.slug||r.name);Do.writeFileSync(l,a),i.push({profile:r.name,file:l})}else i.push({profile:r.name,prompt:a})}catch{i.push({profile:r.name,error:"Failed to fetch profile body"})}if(e.json){console.log(JSON.stringify({format:n,results:i},null,2));return}console.log(`
200
204
  ${C()} ${c.dim("export")}
201
205
  `),console.log(` ${c.bold(n.toUpperCase())} \u2014 ${s.name}
202
206
  `);for(let r of i){if(r.error){console.log(` ${c.red("\u2717")} ${r.profile}: ${r.error}`);continue}r.file?console.log(` ${c.green("\u2713")} ${c.bold(r.profile)} \u2192 ${c.dim(r.file)}`):(console.log(` ${c.bold("\u2500\u2500 "+r.profile+" \u2500\u2500".padEnd(60,"\u2500"))}`),console.log(r.prompt),console.log(` ${"\u2500".repeat(60)}
203
- `))}}U();Re();var _h={solo:{name:"Solo",price:"$19/mo",docs:"50 docs/mo"},team:{name:"Team",price:"$59/mo",docs:"300 docs/mo"},agency:{name:"BYOK",price:"$99 once",docs:"unlimited"}};async function Wo(n){if(!xe()){n.json?console.log(JSON.stringify({error:"Not authenticated. Run: hyv init"})):console.log(`
204
- ${c.red("\u2717")} not authenticated. run ${c.bold("hyv init")}`),process.exit(2);return}if(n.manage){try{let t=await M("/cli/subscribe/manage"),s=t.portal_url||t.url;if(s){let i=(await Promise.resolve().then(()=>S(Ve()))).default;await i(s),console.log(`
207
+ `))}}V();Re();var Ch={solo:{name:"Solo",price:"$19/mo",docs:"50 docs/mo"},team:{name:"Team",price:"$59/mo",docs:"300 docs/mo"},agency:{name:"BYOK",price:"$99 once",docs:"unlimited"}};async function Vo(n){if(!xe()){n.json?console.log(JSON.stringify({error:"Not authenticated. Run: hyv init"})):console.log(`
208
+ ${c.red("\u2717")} not authenticated. run ${c.bold("hyv init")}`),process.exit(2);return}if(n.manage){try{let t=await M("/cli/subscribe/manage"),s=t.portal_url||t.url;if(s){let i=(await Promise.resolve().then(()=>S(He()))).default;await i(s),console.log(`
205
209
  ${c.green("\u2713")} opening billing portal...`)}else console.log(`
206
210
  ${c.dim("manage billing at:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`)}catch{console.log(`
207
- ${c.dim("manage billing at:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`)}return}if(n.upgrade){try{let s=(await M("/cli/subscribe",{plan:"team"})).checkout_url;if(s){let i=(await Promise.resolve().then(()=>S(Ve()))).default;await i(s),console.log(`
211
+ ${c.dim("manage billing at:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`)}return}if(n.upgrade){try{let s=(await M("/cli/subscribe",{plan:"team"})).checkout_url;if(s){let i=(await Promise.resolve().then(()=>S(He()))).default;await i(s),console.log(`
208
212
  ${c.green("\u2713")} opening checkout...`)}else console.log(`
209
213
  ${c.dim("upgrade at:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`)}catch{console.log(`
210
- ${c.dim("upgrade at:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`)}return}try{let t=await k("/cli/heartbeat");if(n.json){console.log(JSON.stringify({plan:t.plan,status:t.status,email:t.email},null,2));return}let s=(t.plan||"none").toLowerCase(),i=_h[s];console.log(`
214
+ ${c.dim("upgrade at:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`)}return}try{let t=await E("/cli/heartbeat");if(n.json){console.log(JSON.stringify({plan:t.plan,status:t.status,email:t.email},null,2));return}let s=(t.plan||"none").toLowerCase(),i=Ch[s];console.log(`
211
215
  ${C()} ${c.dim("plan")}
212
- `),console.log(` ${c.bold("account")} ${t.email||"\u2014"}`),i?(console.log(` ${c.bold("plan")} ${i.name} ${c.dim(i.price)}`),console.log(` ${c.bold("status")} ${t.status||"\u2014"}`),console.log(` ${c.bold("quota")} ${i.docs}`)):console.log(` ${c.bold("plan")} ${c.yellow(t.plan||"none")} (${t.status||"\u2014"})`),console.log(""),console.log(` ${c.dim("manage:")} hyv plan --manage`),console.log(` ${c.dim("upgrade:")} hyv plan --upgrade`),console.log(` ${c.dim("web:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`),console.log("")}catch(t){n.json?console.log(JSON.stringify({error:t.message})):console.log(` ${c.red("\u2717")} failed: ${t.message}`),process.exit(1)}}var Vo=S(require("readline")),we=S(require("fs")),ve=S(require("path")),Ho=S(require("os"));U();var Ti=ve.join(Ho.homedir(),".hyv"),Bo=ve.join(Ti,"voice.md");function fe(){return Vo.createInterface({input:process.stdin,output:process.stdout})}function Ae(n,e){return new Promise(t=>{n.question(e,s=>t(s.trim()))})}async function Ch(n,e,t){console.log("");for(let s=0;s<t.length;s++)console.log(` ${c.dim(`${s+1}.`)} ${t[s]}`);for(console.log("");;){let s=await Ae(n,` ${c.bold(e)} `),i=parseInt(s,10);if(i>=1&&i<=t.length)return t[i-1];if(t.includes(s.toLowerCase()))return s.toLowerCase();console.log(` ${c.yellow("!")} enter a number (1-${t.length})`)}}async function Pi(n,e,t=!0){let s=t?"Y/n":"y/N",i=await Ae(n,` ${c.bold(e)} ${c.dim(`(${s})`)} `);return i?i.toLowerCase().startsWith("y"):t}async function Eh(n,e){return console.log(` ${c.dim(e)}`),console.log(` ${c.dim("(paste text, then press Enter twice to finish)")}`),console.log(""),new Promise(t=>{let s=[],i=0,r=o=>{if(o.trim()===""){if(i++,i>=1&&s.length>0){n.removeListener("line",r),t(s.join(`
213
- `));return}}else i=0,s.push(o)};n.on("line",r)})}async function ct(){try{we.existsSync(Ti)||we.mkdirSync(Ti,{recursive:!0});let e=(await k("/cli/profiles")).profiles||[];if(e.length===0)return;let t=[`# Voice Profile
216
+ `),console.log(` ${c.bold("account")} ${t.email||"\u2014"}`),i?(console.log(` ${c.bold("plan")} ${i.name} ${c.dim(i.price)}`),console.log(` ${c.bold("status")} ${t.status||"\u2014"}`),console.log(` ${c.bold("quota")} ${i.docs}`)):console.log(` ${c.bold("plan")} ${c.yellow(t.plan||"none")} (${t.status||"\u2014"})`),console.log(""),console.log(` ${c.dim("manage:")} hyv plan --manage`),console.log(` ${c.dim("upgrade:")} hyv plan --upgrade`),console.log(` ${c.dim("web:")} ${c.cyan("https://holdyourvoice.com/app/billing")}`),console.log("")}catch(t){n.json?console.log(JSON.stringify({error:t.message})):console.log(` ${c.red("\u2717")} failed: ${t.message}`),process.exit(1)}}var Ho=S(require("readline")),we=S(require("fs")),ve=S(require("path")),qo=S(require("os"));V();var Pi=ve.join(qo.homedir(),".hyv"),Bo=ve.join(Pi,"voice.md");function fe(){return Ho.createInterface({input:process.stdin,output:process.stdout})}function Ae(n,e){return new Promise(t=>{n.question(e,s=>t(s.trim()))})}async function Eh(n,e,t){console.log("");for(let s=0;s<t.length;s++)console.log(` ${c.dim(`${s+1}.`)} ${t[s]}`);for(console.log("");;){let s=await Ae(n,` ${c.bold(e)} `),i=parseInt(s,10);if(i>=1&&i<=t.length)return t[i-1];if(t.includes(s.toLowerCase()))return s.toLowerCase();console.log(` ${c.yellow("!")} enter a number (1-${t.length})`)}}async function Mi(n,e,t=!0){let s=t?"Y/n":"y/N",i=await Ae(n,` ${c.bold(e)} ${c.dim(`(${s})`)} `);return i?i.toLowerCase().startsWith("y"):t}async function Oh(n,e){return console.log(` ${c.dim(e)}`),console.log(` ${c.dim("(paste text, then press Enter twice to finish)")}`),console.log(""),new Promise(t=>{let s=[],i=0,r=o=>{if(o.trim()===""){if(i++,i>=1&&s.length>0){n.removeListener("line",r),t(s.join(`
217
+ `));return}}else i=0,s.push(o)};n.on("line",r)})}async function ht(){try{we.existsSync(Pi)||we.mkdirSync(Pi,{recursive:!0});let e=(await E("/cli/profiles")).profiles||[];if(e.length===0)return;let t=[`# Voice Profile
214
218
  `];for(let s of e)t.push(`## ${s.name}${s.is_default?" (default)":""}`),s.brand&&t.push(`Brand: ${s.brand}`),s.description&&t.push(s.description),s.keywords?.length&&t.push(`Keywords: ${s.keywords.join(", ")}`),t.push("");we.writeFileSync(Bo,t.join(`
215
- `))}catch{}}function It(n){console.log(""),console.log(` ${c.green("\u2713")} profile ${c.bold(n)} created`),console.log(` ${c.green("\u2713")} voice profile exported: ${c.dim(Bo)}`),console.log(""),console.log(` ${c.dim("next:")} hyv scan draft.md ${c.dim("\u2014 check a draft")}`),console.log(` ${c.dim(" ")}hyv rewrite draft.md ${c.dim("\u2014 generate rewrite prompt")}`),console.log(` ${c.dim(" ")}say "rewrite in my voice" in any connected agent`),console.log("")}async function Ss(n,e){return await Ae(n,` ${c.bold("profile name?")} ${c.dim(`(default: ${e})`)} `)||e}var Oh=[{key:"style",q:"How would you describe your writing style?",type:"text"},{key:"tone",q:"What tone do you use most?",type:"choice",options:["casual","professional","mixed","academic","conversational"]},{key:"contractions",q:"Do you use contractions? (don't, can't, it's)",type:"choice",options:["always","sometimes","never"]},{key:"sentence_length",q:"How long are your typical sentences?",type:"choice",options:["short and punchy","medium","long and flowing","mixed"]},{key:"em_dashes",q:"Do you use em dashes \u2014 like this?",type:"choice",options:["yes, often","sometimes","no"]},{key:"opening_moves",q:'How do you typically open a piece? (e.g., "with a question", "with a bold claim", "with a story")',type:"text"},{key:"never_use",q:'Words or phrases you never use? (comma-separated, or "none")',type:"text"},{key:"formality",q:"Formality level? (1 = very casual, 10 = very formal)",type:"scale"},{key:"first_person",q:"Do you write in first person? (I, me, my)",type:"choice",options:["always","sometimes","never"]},{key:"examples",q:"How do you use examples?",type:"choice",options:["lots of concrete examples","a few","rarely"]},{key:"jargon",q:"Technical jargon level?",type:"choice",options:["none \u2014 plain English","some when needed","heavy \u2014 my audience is technical"]},{key:"content_type",q:"What do you write most?",type:"choice",options:["blog posts","linkedin posts","tweets / X","newsletters","mixed"]}];async function qo(n){let e=fe();console.log(`
219
+ `))}catch{}}function Nt(n){console.log(""),console.log(` ${c.green("\u2713")} profile ${c.bold(n)} created`),console.log(` ${c.green("\u2713")} voice profile exported: ${c.dim(Bo)}`),console.log(""),console.log(` ${c.dim("next:")} hyv scan draft.md ${c.dim("\u2014 check a draft")}`),console.log(` ${c.dim(" ")}hyv rewrite draft.md ${c.dim("\u2014 generate rewrite prompt")}`),console.log(` ${c.dim(" ")}say "rewrite in my voice" in any connected agent`),console.log("")}async function $s(n,e){return await Ae(n,` ${c.bold("profile name?")} ${c.dim(`(default: ${e})`)} `)||e}var kh=[{key:"style",q:"How would you describe your writing style?",type:"text"},{key:"tone",q:"What tone do you use most?",type:"choice",options:["casual","professional","mixed","academic","conversational"]},{key:"contractions",q:"Do you use contractions? (don't, can't, it's)",type:"choice",options:["always","sometimes","never"]},{key:"sentence_length",q:"How long are your typical sentences?",type:"choice",options:["short and punchy","medium","long and flowing","mixed"]},{key:"em_dashes",q:"Do you use em dashes \u2014 like this?",type:"choice",options:["yes, often","sometimes","no"]},{key:"opening_moves",q:'How do you typically open a piece? (e.g., "with a question", "with a bold claim", "with a story")',type:"text"},{key:"never_use",q:'Words or phrases you never use? (comma-separated, or "none")',type:"text"},{key:"formality",q:"Formality level? (1 = very casual, 10 = very formal)",type:"scale"},{key:"first_person",q:"Do you write in first person? (I, me, my)",type:"choice",options:["always","sometimes","never"]},{key:"examples",q:"How do you use examples?",type:"choice",options:["lots of concrete examples","a few","rarely"]},{key:"jargon",q:"Technical jargon level?",type:"choice",options:["none \u2014 plain English","some when needed","heavy \u2014 my audience is technical"]},{key:"content_type",q:"What do you write most?",type:"choice",options:["blog posts","linkedin posts","tweets / X","newsletters","mixed"]}];async function Uo(n){let e=fe();console.log(`
216
220
  ${C()} ${c.dim("onboarding \u2014 questions")}
217
221
  `),console.log(` ${c.dim("answer 12 quick questions to build your voice profile.")}`),console.log(` ${c.dim("takes about 2 minutes.")}
218
- `);let t=await Ss(e,"my-voice");console.log("");let s=[];for(let i of Oh){let r;if(i.type==="choice"&&i.options)r=await Ch(e,i.q,i.options);else if(i.type==="scale")for(;;){let o=await Ae(e,` ${c.bold(i.q)} `),a=parseInt(o,10);if(a>=1&&a<=10){r=String(a);break}console.log(` ${c.yellow("!")} enter a number 1-10`)}else r=await Ae(e,` ${c.bold(i.q)} `);s.push({question:i.q,key:i.key,answer:r})}e.close(),console.log(""),console.log(` ${c.dim("creating profile...")}`);try{let i=await M("/cli/onboarding/questions",{name:t,answers:s});n.json?console.log(JSON.stringify({ok:!0,profile:i.profile?.name||t})):(await ct(),It(i.profile?.name||t))}catch(i){n.json?console.log(JSON.stringify({error:i.message})):console.log(`
219
- ${c.red("\u2717")} ${i.message}`),process.exit(1)}}async function Uo(n,e){if(n.length===0){console.log(`
222
+ `);let t=await $s(e,"my-voice");console.log("");let s=[];for(let i of kh){let r;if(i.type==="choice"&&i.options)r=await Eh(e,i.q,i.options);else if(i.type==="scale")for(;;){let o=await Ae(e,` ${c.bold(i.q)} `),a=parseInt(o,10);if(a>=1&&a<=10){r=String(a);break}console.log(` ${c.yellow("!")} enter a number 1-10`)}else r=await Ae(e,` ${c.bold(i.q)} `);s.push({question:i.q,key:i.key,answer:r})}e.close(),console.log(""),console.log(` ${c.dim("creating profile...")}`);try{let i=await M("/cli/onboarding/questions",{name:t,answers:s});n.json?console.log(JSON.stringify({ok:!0,profile:i.profile?.name||t})):(await ht(),Nt(i.profile?.name||t))}catch(i){n.json?console.log(JSON.stringify({error:i.message})):console.log(`
223
+ ${c.red("\u2717")} ${i.message}`),process.exit(1)}}async function zo(n,e){if(n.length===0){console.log(`
220
224
  ${c.red("\u2717")} no urls provided`),console.log(` ${c.dim("usage:")} hyv onboard --url https://blog.example.com`),process.exit(1);return}console.log(`
221
225
  ${C()} ${c.dim("onboarding \u2014 url scrape")}
222
226
  `),console.log(` ${c.dim("scraping:")} ${n.map(s=>c.cyan(s)).join(`
223
227
  `)}
224
- `);let t="my-voice";if(!e.json){let s=fe();t=await Ss(s,"my-voice"),s.close(),console.log(` ${c.dim(`using profile name: ${t}`)}
225
- `)}try{let s=await M("/cli/onboarding/scrape",{urls:n,name:t});if(e.json){console.log(JSON.stringify({ok:!0,...s}));return}let i=s.samples_found||0,r=s.words_found||0,o=s.profile?.name||t;if(i===0){console.log(` ${c.yellow("!")} couldn't extract any content from those urls`),console.log(` ${c.dim("try:")} a blog homepage, substack, or medium profile`),console.log(` ${c.dim("or:")} use ${c.dim("hyv onboard --folder ./my-writing/")} for local files`),process.exit(1);return}console.log(` ${c.green("\u2713")} found ${c.bold(String(i))} articles, ~${c.bold(String(r))} words`),await ct(),It(o)}catch(s){e.json?console.log(JSON.stringify({error:s.message})):console.log(`
226
- ${c.red("\u2717")} ${s.message}`),process.exit(1)}}function kh(n){return n.split(/\s+/).filter(e=>e.length>0).length}async function zo(n,e){if(!we.existsSync(n)){console.log(`
228
+ `);let t="my-voice";if(!e.json){let s=fe();t=await $s(s,"my-voice"),s.close(),console.log(` ${c.dim(`using profile name: ${t}`)}
229
+ `)}try{let s=await M("/cli/onboarding/scrape",{urls:n,name:t});if(e.json){console.log(JSON.stringify({ok:!0,...s}));return}let i=s.samples_found||0,r=s.words_found||0,o=s.profile?.name||t;if(i===0){console.log(` ${c.yellow("!")} couldn't extract any content from those urls`),console.log(` ${c.dim("try:")} a blog homepage, substack, or medium profile`),console.log(` ${c.dim("or:")} use ${c.dim("hyv onboard --folder ./my-writing/")} for local files`),process.exit(1);return}console.log(` ${c.green("\u2713")} found ${c.bold(String(i))} articles, ~${c.bold(String(r))} words`),await ht(),Nt(o)}catch(s){e.json?console.log(JSON.stringify({error:s.message})):console.log(`
230
+ ${c.red("\u2717")} ${s.message}`),process.exit(1)}}function Ah(n){return n.split(/\s+/).filter(e=>e.length>0).length}async function Go(n,e){if(!we.existsSync(n)){console.log(`
227
231
  ${c.red("\u2717")} folder not found: ${n}`),process.exit(1);return}console.log(`
228
232
  ${C()} ${c.dim("onboarding \u2014 local folder")}
229
- `);let t=ve.basename(n);if(!e.json){let u=fe();t=await Ss(u,t),u.close(),console.log(` ${c.dim(`using profile name: ${t}`)}
230
- `)}let s=ve.resolve(n),i=["**/*.md","**/*.txt","**/*.markdown"],r=[];for(let u of i){let f=await rt(u,{cwd:s,nodir:!0,absolute:!0});r.push(...f)}if(r=[...new Set(r)],r.length===0){console.log(` ${c.red("\u2717")} no .md or .txt files found in ${n}`),console.log(` ${c.dim("supported formats:")} .md, .txt, .markdown`),process.exit(1);return}let o=[],a=0;for(let u of r)try{let f=we.readFileSync(u,"utf-8"),p=kh(f);p>=50&&(o.push({path:u,name:ve.relative(s,u),words:p,text:f}),a+=p)}catch{}if(o.length===0){console.log(` ${c.red("\u2717")} all files are too short (need 50+ words each)`),process.exit(1);return}console.log(` ${c.bold("found")} ${c.cyan(String(o.length))} files, ~${c.cyan(String(a))} words
231
- `);for(let u of o.slice(0,20))console.log(` ${c.dim(u.name)} ${c.dim(`(${u.words} words)`)}`);if(o.length>20&&console.log(` ${c.dim(`... and ${o.length-20} more`)}`),console.log(""),!e.json){let u=fe(),f=await Pi(u,"upload these files?");if(u.close(),!f){console.log(` ${c.dim("cancelled")}
232
- `);return}}console.log("");let l=0,h=0;for(let u=0;u<o.length;u++){let f=o[u];try{await M("/cli/learning/add",{text:f.text.slice(0,5e3)}),l++,e.json||process.stdout.write(`\r ${c.dim("uploading:")} ${l}/${o.length}`)}catch{h++}}e.json||(process.stdout.write("\r"),console.log(` ${c.green("\u2713")} uploaded ${c.bold(String(l))} files${h>0?c.red(` (${h} failed)`):""}`),console.log(` ${c.dim("analyzing voice patterns...")}`));try{let u=await M("/cli/onboarding/analyze",{name:t}),f=u.profile?.name||t;e.json?console.log(JSON.stringify({ok:!0,uploaded:l,errors:h,profile:u.profile})):(await ct(),It(f))}catch(u){e.json?console.log(JSON.stringify({ok:!0,uploaded:l,errors:h,analysis_error:u.message})):(console.log(` ${c.yellow("!")} samples uploaded but analysis failed: ${u.message}`),console.log(` ${c.dim("try again:")} hyv onboard --analyze`),await ct(),console.log(""))}}var Ah=`Analyze my writing style from the samples below. Extract patterns and return your analysis in this EXACT format (use the exact labels):
233
+ `);let t=ve.basename(n);if(!e.json){let u=fe();t=await $s(u,t),u.close(),console.log(` ${c.dim(`using profile name: ${t}`)}
234
+ `)}let s=ve.resolve(n),i=["**/*.md","**/*.txt","**/*.markdown"],r=[];for(let u of i){let f=await ot(u,{cwd:s,nodir:!0,absolute:!0});r.push(...f)}if(r=[...new Set(r)],r.length===0){console.log(` ${c.red("\u2717")} no .md or .txt files found in ${n}`),console.log(` ${c.dim("supported formats:")} .md, .txt, .markdown`),process.exit(1);return}let o=[],a=0;for(let u of r)try{let f=we.readFileSync(u,"utf-8"),p=Ah(f);p>=50&&(o.push({path:u,name:ve.relative(s,u),words:p,text:f}),a+=p)}catch{}if(o.length===0){console.log(` ${c.red("\u2717")} all files are too short (need 50+ words each)`),process.exit(1);return}console.log(` ${c.bold("found")} ${c.cyan(String(o.length))} files, ~${c.cyan(String(a))} words
235
+ `);for(let u of o.slice(0,20))console.log(` ${c.dim(u.name)} ${c.dim(`(${u.words} words)`)}`);if(o.length>20&&console.log(` ${c.dim(`... and ${o.length-20} more`)}`),console.log(""),!e.json){let u=fe(),f=await Mi(u,"upload these files?");if(u.close(),!f){console.log(` ${c.dim("cancelled")}
236
+ `);return}}console.log("");let l=0,h=0;for(let u=0;u<o.length;u++){let f=o[u];try{await M("/cli/learning/add",{text:f.text.slice(0,5e3)}),l++,e.json||process.stdout.write(`\r ${c.dim("uploading:")} ${l}/${o.length}`)}catch{h++}}e.json||(process.stdout.write("\r"),console.log(` ${c.green("\u2713")} uploaded ${c.bold(String(l))} files${h>0?c.red(` (${h} failed)`):""}`),console.log(` ${c.dim("analyzing voice patterns...")}`));try{let u=await M("/cli/onboarding/analyze",{name:t}),f=u.profile?.name||t;e.json?console.log(JSON.stringify({ok:!0,uploaded:l,errors:h,profile:u.profile})):(await ht(),Nt(f))}catch(u){e.json?console.log(JSON.stringify({ok:!0,uploaded:l,errors:h,analysis_error:u.message})):(console.log(` ${c.yellow("!")} samples uploaded but analysis failed: ${u.message}`),console.log(` ${c.dim("try again:")} hyv onboard --analyze`),await ht(),console.log(""))}}var Fh=`Analyze my writing style from the samples below. Extract patterns and return your analysis in this EXACT format (use the exact labels):
233
237
 
234
238
  STYLE: [one-line description of the writing style]
235
239
  TONE: [casual / professional / mixed / academic / conversational]
@@ -251,75 +255,77 @@ DETAILED_NOTES:
251
255
  ---
252
256
  MY WRITING SAMPLES:
253
257
 
254
- [paste your writing samples here \u2014 blog posts, tweets, emails, essays, any prose that represents your voice]`;async function Go(n){console.log(`
258
+ [paste your writing samples here \u2014 blog posts, tweets, emails, essays, any prose that represents your voice]`;async function Jo(n){console.log(`
255
259
  ${C()} ${c.dim("onboarding \u2014 llm extract")}
256
- `);let e="my-voice";if(!n.json){let r=fe();e=await Ss(r,"my-voice"),r.close(),console.log(` ${c.dim(`using profile name: ${e}`)}
260
+ `);let e="my-voice";if(!n.json){let r=fe();e=await $s(r,"my-voice"),r.close(),console.log(` ${c.dim(`using profile name: ${e}`)}
257
261
  `)}console.log(` ${c.dim("this generates a prompt you paste into any LLM.")}`),console.log(` ${c.dim("then paste the LLM's response back here.")}
258
- `),console.log(` ${c.bold("\u2500\u2500 copy this prompt \u2500\u2500".padEnd(60,"\u2500"))}`),console.log(""),console.log(Ah),console.log(""),console.log(` ${"\u2500".repeat(60)}`),console.log("");let t=fe();if(!await Pi(t,"ready to paste the llm response?")){t.close(),console.log(` ${c.dim("cancelled")}
259
- `);return}console.log("");let i=await Eh(t,"paste the llm's response below:");if(t.close(),!i.trim()){console.log(`
260
- ${c.red("\u2717")} empty response`),process.exit(1);return}console.log(""),console.log(` ${c.dim("creating profile from llm response...")}`);try{let r=await M("/cli/onboarding/extract",{llm_response:i,name:e}),o=r.profile?.name||e;n.json?console.log(JSON.stringify({ok:!0,profile:r.profile})):(await ct(),It(o))}catch(r){n.json?console.log(JSON.stringify({error:r.message})):console.log(`
261
- ${c.red("\u2717")} ${r.message}`),process.exit(1)}}async function Fh(n){let e=fe();console.log(`
262
+ `),console.log(` ${c.bold("\u2500\u2500 copy this prompt \u2500\u2500".padEnd(60,"\u2500"))}`),console.log(""),console.log(Fh),console.log(""),console.log(` ${"\u2500".repeat(60)}`),console.log("");let t=fe();if(!await Mi(t,"ready to paste the llm response?")){t.close(),console.log(` ${c.dim("cancelled")}
263
+ `);return}console.log("");let i=await Oh(t,"paste the llm's response below:");if(t.close(),!i.trim()){console.log(`
264
+ ${c.red("\u2717")} empty response`),process.exit(1);return}console.log(""),console.log(` ${c.dim("creating profile from llm response...")}`);try{let r=await M("/cli/onboarding/extract",{llm_response:i,name:e}),o=r.profile?.name||e;n.json?console.log(JSON.stringify({ok:!0,profile:r.profile})):(await ht(),Nt(o))}catch(r){n.json?console.log(JSON.stringify({error:r.message})):console.log(`
265
+ ${c.red("\u2717")} ${r.message}`),process.exit(1)}}async function jh(n){let e=fe();console.log(`
262
266
  ${C()} ${c.dim("onboarding")}
263
267
  `),console.log(` ${c.bold("how do you want to create your voice profile?")}
264
- `),console.log(` ${c.dim("1.")} answer questions ${c.dim("(quick start, ~2 min)")}`),console.log(` ${c.dim("2.")} point to a blog or url ${c.dim("(we scrape your writing)")}`),console.log(` ${c.dim("3.")} upload from a local folder ${c.dim(".md and .txt files)")}`),console.log(` ${c.dim("4.")} extract from any llm ${c.dim("(paste a prompt + samples)")}`),console.log("");let t=await Ae(e,` ${c.bold("pick one:")} ${c.dim("(1-4)")} `);switch(e.close(),t){case"1":await qo(n);break;case"2":{let s=fe(),i=await Ae(s,`
265
- ${c.bold("enter url(s), comma-separated:")} `);s.close();let r=i.split(",").map(o=>o.trim()).filter(Boolean);await Uo(r,n);break}case"3":{let s=fe(),i=await Ae(s,`
266
- ${c.bold("path to folder:")} `);s.close(),await zo(i,n);break}case"4":await Go(n);break;default:console.log(`
268
+ `),console.log(` ${c.dim("1.")} answer questions ${c.dim("(quick start, ~2 min)")}`),console.log(` ${c.dim("2.")} point to a blog or url ${c.dim("(we scrape your writing)")}`),console.log(` ${c.dim("3.")} upload from a local folder ${c.dim(".md and .txt files)")}`),console.log(` ${c.dim("4.")} extract from any llm ${c.dim("(paste a prompt + samples)")}`),console.log("");let t=await Ae(e,` ${c.bold("pick one:")} ${c.dim("(1-4)")} `);switch(e.close(),t){case"1":await Uo(n);break;case"2":{let s=fe(),i=await Ae(s,`
269
+ ${c.bold("enter url(s), comma-separated:")} `);s.close();let r=i.split(",").map(o=>o.trim()).filter(Boolean);await zo(r,n);break}case"3":{let s=fe(),i=await Ae(s,`
270
+ ${c.bold("path to folder:")} `);s.close(),await Go(i,n);break}case"4":await Jo(n);break;default:console.log(`
267
271
  ${c.red("\u2717")} invalid choice. run ${c.dim("hyv onboard --help")} for options.
268
- `),process.exit(1)}}async function Jo(n){try{let e=await k("/cli/profiles");if(e.profiles?.length>0&&!n.analyze){let t=fe(),s=await Pi(t,`you already have ${e.profiles.length} profile(s). create another?`,!1);if(t.close(),!s){console.log(` ${c.dim("cancelled")}
269
- `);return}}}catch{}if(n.questions)await qo(n);else if(n.url){let e=n.url.split(",").map(t=>t.trim()).filter(Boolean);await Uo(e,n)}else if(n.folder)await zo(n.folder,n);else if(n.extract)await Go(n);else if(n.analyze){console.log(`
272
+ `),process.exit(1)}}async function Yo(n){try{await Te()}catch(e){n.json?console.log(JSON.stringify({error:e.message})):console.log(`
273
+ ${c.red("\u2717")} ${e.message}
274
+ `),process.exit(1);return}try{let e=await E("/cli/profiles");if(e.profiles?.length>0&&!n.analyze){let t=fe(),s=await Mi(t,`you already have ${e.profiles.length} profile(s). create another?`,!1);if(t.close(),!s){console.log(` ${c.dim("cancelled")}
275
+ `);return}}}catch{}if(n.questions)await Uo(n);else if(n.url){let e=n.url.split(",").map(t=>t.trim()).filter(Boolean);await zo(e,n)}else if(n.folder)await Go(n.folder,n);else if(n.extract)await Jo(n);else if(n.analyze){console.log(`
270
276
  ${C()} ${c.dim("analyzing voice patterns...")}
271
- `);try{let e=await M("/cli/onboarding/analyze",{}),t=e.profile?.name||"my-voice";n.json?console.log(JSON.stringify({ok:!0,profile:e.profile})):(await ct(),It(t))}catch(e){console.log(` ${c.red("\u2717")} ${e.message}`),process.exit(1)}}else await Fh(n)}var ht=S(require("fs")),Ii=S(require("path")),Yo=S(require("os"));U();var Mi=Ii.join(Yo.homedir(),".hyv"),jh=Ii.join(Mi,"voice.md");async function Rh(){try{ht.existsSync(Mi)||ht.mkdirSync(Mi,{recursive:!0});let e=(await k("/cli/profiles")).profiles||[];if(e.length===0)return;let t=[`# Voice Profile
272
- `];for(let s of e)t.push(`## ${s.name}${s.is_default?" (default)":""}`),s.brand&&t.push(`Brand: ${s.brand}`),s.description&&t.push(s.description),s.keywords?.length&&t.push(`Keywords: ${s.keywords.join(", ")}`),t.push("");ht.writeFileSync(jh,t.join(`
273
- `))}catch{}}async function Ni(n,e){if(!n||n.trim()===""){e.json?console.log(JSON.stringify({error:"No name provided"})):(console.log(`
277
+ `);try{let e=await M("/cli/onboarding/analyze",{}),t=e.profile?.name||"my-voice";n.json?console.log(JSON.stringify({ok:!0,profile:e.profile})):(await ht(),Nt(t))}catch(e){console.log(` ${c.red("\u2717")} ${e.message}`),process.exit(1)}}else await jh(n)}var ut=S(require("fs")),Ni=S(require("path")),Ko=S(require("os"));V();var Ii=Ni.join(Ko.homedir(),".hyv"),Rh=Ni.join(Ii,"voice.md");async function Th(){try{ut.existsSync(Ii)||ut.mkdirSync(Ii,{recursive:!0});let e=(await E("/cli/profiles")).profiles||[];if(e.length===0)return;let t=[`# Voice Profile
278
+ `];for(let s of e)t.push(`## ${s.name}${s.is_default?" (default)":""}`),s.brand&&t.push(`Brand: ${s.brand}`),s.description&&t.push(s.description),s.keywords?.length&&t.push(`Keywords: ${s.keywords.join(", ")}`),t.push("");ut.writeFileSync(Rh,t.join(`
279
+ `))}catch{}}async function Li(n,e){if(!n||n.trim()===""){e.json?console.log(JSON.stringify({error:"No name provided"})):(console.log(`
274
280
  ${c.red("\u2717")} no name provided`),console.log(` ${c.dim("usage:")} hyv rename <new-name>`),console.log(` ${c.dim(' hyv rename "my brand voice"')}
275
281
  `)),process.exit(1);return}let t=n.trim();if(t.length>100){e.json?console.log(JSON.stringify({error:"Name too long (max 100 characters)"})):console.log(`
276
282
  ${c.red("\u2717")} name too long (max 100 characters)
277
- `),process.exit(1);return}let s;try{s=(await k("/cli/profiles")).profiles||[]}catch(r){e.json?console.log(JSON.stringify({error:r.message})):console.log(`
283
+ `),process.exit(1);return}let s;try{s=(await E("/cli/profiles")).profiles||[]}catch(r){e.json?console.log(JSON.stringify({error:r.message})):console.log(`
278
284
  ${c.red("\u2717")} ${r.message}
279
285
  `),process.exit(1);return}if(s.length===0){e.json?console.log(JSON.stringify({error:"No voice profiles found"})):(console.log(`
280
286
  ${c.red("\u2717")} no voice profiles found`),console.log(` ${c.dim("create one:")} hyv onboard
281
287
  `)),process.exit(1);return}let i;if(e.profile)i=e.profile;else if(s.length===1)i=s[0].slug||s[0].id;else{let r=s.find(o=>o.is_default);if(r)i=r.slug||r.id;else{e.json?console.log(JSON.stringify({error:"Multiple profiles found. Specify which one with: hyv rename <name> --profile <profile-slug>"})):(console.log(`
282
288
  ${c.red("\u2717")} multiple profiles found. specify which one:`),console.log(` ${c.dim("usage:")} hyv rename "${t}" --profile <profile-slug>`),console.log(` ${c.dim("available:")} ${s.map(o=>o.slug||o.name).join(", ")}
283
- `)),process.exit(1);return}}try{let r=await M("/cli/profiles/rename",{slug_or_id:i,new_name:t});e.json?console.log(JSON.stringify({ok:!0,profile:r.profile})):(await Rh(),console.log(`
289
+ `)),process.exit(1);return}}try{let r=await M("/cli/profiles/rename",{slug_or_id:i,new_name:t});e.json?console.log(JSON.stringify({ok:!0,profile:r.profile})):(await Th(),console.log(`
284
290
  ${C()} ${c.dim("rename")}
285
291
  `),console.log(` ${c.green("\u2713")} profile renamed to ${c.bold(r.profile?.name||t)}`),console.log(` ${c.green("\u2713")} voice.md updated
286
292
  `))}catch(r){e.json?console.log(JSON.stringify({error:r.message})):console.log(`
287
293
  ${c.red("\u2717")} ${r.message}
288
- `),process.exit(1)}}function Th(n){let e=n.toLowerCase().trim(),t=n.trim(),s=[/rename\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:to|as)\s+(.+)/i,/update\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/change\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/call\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/set\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/name\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/(?:voice\s+)?profile\s+(?:rename|name)\s+(?:to|as)\s+(.+)/i,/rename\s+(?:to|as)\s+(.+)/i,/update\s+(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i];for(let i of s){let r=t.match(i);if(r&&r[1]){let o=r[1].trim();if((o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),o=o.replace(/[.!?]+$/,"").trim(),o.length>0&&o.length<=100)return{action:"rename",name:o,raw:t}}}return{action:"unknown",raw:t}}async function Ko(n,e){if(!n||n.trim()===""){e.json?console.log(JSON.stringify({error:"No input provided"})):(console.log(`
294
+ `),process.exit(1)}}function Ph(n){let e=n.toLowerCase().trim(),t=n.trim(),s=[/rename\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:to|as)\s+(.+)/i,/update\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/change\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/call\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/set\s+(?:my\s+)?(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i,/name\s+(?:my\s+)?(?:voice\s+)?profile\s+(.+)/i,/(?:voice\s+)?profile\s+(?:rename|name)\s+(?:to|as)\s+(.+)/i,/rename\s+(?:to|as)\s+(.+)/i,/update\s+(?:voice\s+)?profile\s+(?:name\s+)?(?:to|as)\s+(.+)/i];for(let i of s){let r=t.match(i);if(r&&r[1]){let o=r[1].trim();if((o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),o=o.replace(/[.!?]+$/,"").trim(),o.length>0&&o.length<=100)return{action:"rename",name:o,raw:t}}}return{action:"unknown",raw:t}}async function Xo(n,e){if(!n||n.trim()===""){e.json?console.log(JSON.stringify({error:"No input provided"})):(console.log(`
289
295
  ${c.red("\u2717")} no input provided`),console.log(` ${c.dim("usage:")} hyv say "rename my profile to cristiano ronaldo"`),console.log(` ${c.dim(' hyv say "update my voice profile name to brand voice"')}
290
- `)),process.exit(1);return}let t=Th(n);if(e.json){console.log(JSON.stringify({intent:t})),t.action==="unknown"&&process.exit(1);return}switch(t.action){case"rename":t.name&&await Ni(t.name,{json:e.json});break;case"unknown":default:console.log(`
296
+ `)),process.exit(1);return}let t=Ph(n);if(e.json){console.log(JSON.stringify({intent:t})),t.action==="unknown"&&process.exit(1);return}switch(t.action){case"rename":t.name&&await Li(t.name,{json:e.json});break;case"unknown":default:console.log(`
291
297
  ${c.yellow("!")} I didn't understand that command`),console.log(` ${c.dim("try:")} hyv say "rename my profile to <name>"`),console.log(` ${c.dim("or:")} hyv rename <new-name>`),console.log(` ${c.dim("or:")} hyv --help
292
- `),process.exit(1);break}}var ut=S(require("fs")),Di=S(require("path")),_s=S(require("os"));var Xo=Di.join(_s.homedir(),".hyv","voice.md");function Li(n,e){return JSON.stringify({jsonrpc:"2.0",id:n,result:e})}function Ph(n,e,t){return JSON.stringify({jsonrpc:"2.0",id:n,error:{code:e,message:t}})}function $s(n){process.stdout.write(n+`
293
- `)}async function Mh(n){let e=n.text||"",t=n.profile||lt()||"default";if(!e.trim())return"Error: no text provided";try{let s=await at(t),i=Le(e,s),r=ys(i),o=e;if(r.autoFixes.length>0&&(o=bs(e,r.issues).fixed),r.llmFixes.length>0){let a=vs(s,o,r,i,1);return`Auto-fixed ${r.autoFixes.length} issues. ${r.llmFixes.length} issues need LLM rewrite.
298
+ `),process.exit(1);break}}var ft=S(require("fs")),Wi=S(require("path")),Cs=S(require("os"));var Zo=Wi.join(Cs.homedir(),".hyv","voice.md");function Di(n,e){return JSON.stringify({jsonrpc:"2.0",id:n,result:e})}function Mh(n,e,t){return JSON.stringify({jsonrpc:"2.0",id:n,error:{code:e,message:t}})}function _s(n){process.stdout.write(n+`
299
+ `)}async function Ih(n){let e=n.text||"",t=n.profile||ct()||"default";if(!e.trim())return"Error: no text provided";try{let s=await lt(t),i=De(e,s),r=bs(i),o=e;if(r.autoFixes.length>0&&(o=ws(e,r.issues).fixed),r.llmFixes.length>0){let a=xs(s,o,r,i,1);return`Auto-fixed ${r.autoFixes.length} issues. ${r.llmFixes.length} issues need LLM rewrite.
294
300
 
295
- ${a}`}return o}catch(s){return`Error: ${s.message}`}}async function Ih(n){let e=n.text||"",t=n.file||"";if(!e.trim()&&!t.trim())return"Error: no text or file provided";try{if(t){let{results:i,summary:r}=await Tt([t]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?`No issues found in ${t}`:`Found ${o.length} issues:
301
+ ${a}`}return o}catch(s){return`Error: ${s.message}`}}async function Nh(n){let e=n.text||"",t=n.file||"";if(!e.trim()&&!t.trim())return"Error: no text or file provided";try{if(t){let{results:i,summary:r}=await Pt([t]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?`No issues found in ${t}`:`Found ${o.length} issues:
296
302
  ${o.join(`
297
- `)}`}let s=Di.join(_s.tmpdir(),`hyv-scan-${Date.now()}.md`);ut.writeFileSync(s,e);try{let{results:i,summary:r}=await Tt([s]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?"No AI patterns found":`Found ${o.length} issues:
303
+ `)}`}let s=Wi.join(Cs.tmpdir(),`hyv-scan-${Date.now()}.md`);ft.writeFileSync(s,e);try{let{results:i,summary:r}=await Pt([s]),o=i.flatMap(a=>a.findings.map(l=>`line ${l.line}: [${l.severity}] ${l.pattern} \u2014 ${l.excerpt}`));return o.length===0?"No AI patterns found":`Found ${o.length} issues:
298
304
  ${o.join(`
299
- `)}`}finally{try{ut.unlinkSync(s)}catch{}}}catch(s){return`Error: ${s.message}`}}async function Nh(n){try{let{apiGet:e}=await Promise.resolve().then(()=>(U(),Ut)),s=(await e("/cli/profiles")).profiles||[];return s.length===0?"No voice profiles found. Create one at holdyourvoice.com or run: hyv new <name>":s.map(i=>`${i.name}${i.is_default?" (default)":""}${i.keywords?.length?" \u2014 "+i.keywords.slice(0,3).join(", "):""}`).join(`
300
- `)}catch(e){return`Error: ${e.message}`}}async function Lh(n){let e=n.text||"",t=n.profile||lt()||"default";if(!e.trim())return"Error: no text provided";try{let s=await at(t),i=xs(e,e,s),r=[`Score: ${i.score}/100`];return i.cadenceScore&&r.push(`Cadence: ${i.cadenceScore}/100`),i.neverListHits.length&&r.push(`Never-list hits: ${i.neverListHits.join(", ")}`),i.valid?r.push("PASS"):r.push("NEEDS IMPROVEMENT"),i.issues.length&&r.push(`Issues:
305
+ `)}`}finally{try{ft.unlinkSync(s)}catch{}}}catch(s){return`Error: ${s.message}`}}async function Lh(n){try{let{apiGet:e}=await Promise.resolve().then(()=>(V(),zt)),s=(await e("/cli/profiles")).profiles||[];return s.length===0?"No voice profiles found. Create one at holdyourvoice.com or run: hyv new <name>":s.map(i=>`${i.name}${i.is_default?" (default)":""}${i.keywords?.length?" \u2014 "+i.keywords.slice(0,3).join(", "):""}`).join(`
306
+ `)}catch(e){return`Error: ${e.message}`}}async function Dh(n){let e=n.text||"",t=n.profile||ct()||"default";if(!e.trim())return"Error: no text provided";try{let s=await lt(t),i=Ss(e,e,s),r=[`Score: ${i.score}/100`];return i.cadenceScore&&r.push(`Cadence: ${i.cadenceScore}/100`),i.neverListHits.length&&r.push(`Never-list hits: ${i.neverListHits.join(", ")}`),i.valid?r.push("PASS"):r.push("NEEDS IMPROVEMENT"),i.issues.length&&r.push(`Issues:
301
307
  ${i.issues.map(o=>` - ${o}`).join(`
302
308
  `)}`),r.join(`
303
- `)}catch(s){return`Error: ${s.message}`}}var Dh=[{name:"hyv_rewrite",description:`Rewrite text to match the user's voice profile. Auto-fixes AI patterns and generates a prompt for remaining issues. Use when the user says "rewrite in my voice" or wants text rewritten.`,inputSchema:{type:"object",properties:{text:{type:"string",description:"The text to rewrite"},profile:{type:"string",description:"Voice profile name (optional, uses default if omitted)"}},required:["text"]}},{name:"hyv_scan",description:"Scan text or a file for AI writing patterns and voice drift. Returns a list of issues found.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Inline text to scan"},file:{type:"string",description:"Path to a .md file to scan"}}}},{name:"hyv_profiles",description:"List the user's voice profiles. Use before rewriting to pick the right profile.",inputSchema:{type:"object",properties:{}}},{name:"hyv_validate",description:"Validate text against a voice profile. Returns a score and list of remaining issues.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Text to validate"},profile:{type:"string",description:"Voice profile name (optional)"}},required:["text"]}}];async function Wh(n){let e;try{e=JSON.parse(n)}catch{return}let{id:t,method:s,params:i}=e;switch(s){case"initialize":$s(Li(t,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"hyv",version:"0.6.0"}}));break;case"notifications/initialized":break;case"tools/list":$s(Li(t,{tools:Dh}));break;case"tools/call":{let r=i?.name,o=i?.arguments||{},a;try{switch(r){case"hyv_rewrite":a=await Mh(o);break;case"hyv_scan":a=await Ih(o);break;case"hyv_profiles":a=await Nh(o);break;case"hyv_validate":a=await Lh(o);break;default:a=`Unknown tool: ${r}`;break}}catch(l){a=`Error: ${l.message}`}$s(Li(t,{content:[{type:"text",text:a}]}));break}default:t!==void 0&&$s(Ph(t,-32601,`Method not found: ${s}`));break}}function Zo(){ut.existsSync(Xo)?process.stderr.write(`[hyv-mcp] voice profile: ${Xo}
309
+ `)}catch(s){return`Error: ${s.message}`}}var Wh=[{name:"hyv_rewrite",description:`Rewrite text to match the user's voice profile. Auto-fixes AI patterns and generates a prompt for remaining issues. Use when the user says "rewrite in my voice" or wants text rewritten.`,inputSchema:{type:"object",properties:{text:{type:"string",description:"The text to rewrite"},profile:{type:"string",description:"Voice profile name (optional, uses default if omitted)"}},required:["text"]}},{name:"hyv_scan",description:"Scan text or a file for AI writing patterns and voice drift. Returns a list of issues found.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Inline text to scan"},file:{type:"string",description:"Path to a .md file to scan"}}}},{name:"hyv_profiles",description:"List the user's voice profiles. Use before rewriting to pick the right profile.",inputSchema:{type:"object",properties:{}}},{name:"hyv_validate",description:"Validate text against a voice profile. Returns a score and list of remaining issues.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Text to validate"},profile:{type:"string",description:"Voice profile name (optional)"}},required:["text"]}}];async function Vh(n){let e;try{e=JSON.parse(n)}catch{return}let{id:t,method:s,params:i}=e;switch(s){case"initialize":_s(Di(t,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"hyv",version:"0.6.0"}}));break;case"notifications/initialized":break;case"tools/list":_s(Di(t,{tools:Wh}));break;case"tools/call":{let r=i?.name,o=i?.arguments||{},a;try{switch(r){case"hyv_rewrite":a=await Ih(o);break;case"hyv_scan":a=await Nh(o);break;case"hyv_profiles":a=await Lh(o);break;case"hyv_validate":a=await Dh(o);break;default:a=`Unknown tool: ${r}`;break}}catch(l){a=`Error: ${l.message}`}_s(Di(t,{content:[{type:"text",text:a}]}));break}default:t!==void 0&&_s(Mh(t,-32601,`Method not found: ${s}`));break}}function Qo(){ft.existsSync(Zo)?process.stderr.write(`[hyv-mcp] voice profile: ${Zo}
304
310
  `):process.stderr.write(`[hyv-mcp] no voice.md found \u2014 run hyv init first
305
311
  `);let n="";process.stdin.setEncoding("utf-8"),process.stdin.on("data",e=>{n+=e;let t=n.split(`
306
- `);n=t.pop()||"";for(let s of t)s.trim()&&Wh(s.trim()).catch(i=>{process.stderr.write(`[hyv-mcp] error: ${i.message}
312
+ `);n=t.pop()||"";for(let s of t)s.trim()&&Vh(s.trim()).catch(i=>{process.stderr.write(`[hyv-mcp] error: ${i.message}
307
313
  `)})}),process.stdin.on("end",()=>{process.exit(0)}),process.stderr.write(`[hyv-mcp] server started
308
- `)}var W=new en;W.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version("0.6.0");W.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").option("-q, --quiet","minimal output (for CI)").action(n=>nr(n.profile,{key:n.key,quiet:n.quiet}));W.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,e)=>wo(n,e));W.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)").option("--json","output as json").action((n,e,t)=>jo(n,e,t));W.command("profiles").description("list your voice profiles").option("--json","output as json").action(n=>Po(n));W.command("status").description("show account and cli status").option("--json","output as json").option("-q, --quiet","minimal output (for CI)").action(n=>Mo(n));W.command("reinforce").description("send learning signals from an edited draft").argument("<original>","original .md file").argument("<edited>","edited .md file").option("--json","output as json").action((n,e,t)=>Io(n,e,t));W.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").option("--json","output as json").action((n,e)=>No(n,e));W.command("validate").description("validate text against your voice profile").argument("[file]",".md file to validate").option("-p, --profile <name>","voice profile to validate against").option("-t, --text <text>","inline text to validate").option("--json","output as json").action((n,e)=>Ro(n,e));W.command("export").description("export voice profile as system prompt for AI apps").argument("<format>","target format: claude, chatgpt, generic, cursor").option("-o, --output <file>","write to file (use {name} for profile name)").option("--json","output as json").action((n,e)=>Do(n,e));W.command("plan").description("show or manage your subscription").option("--upgrade","open checkout to upgrade").option("--manage","open billing portal").option("--json","output as json").action(n=>Wo(n));W.command("onboard").description("create your voice profile (questions, url scrape, folder, or llm extract)").option("--questions","answer questions to build profile").option("--url <urls>","comma-separated urls to scrape for writing samples").option("--folder <path>","path to a folder of .md/.txt files to upload").option("--extract","generate a prompt to extract voice from any llm").option("--analyze","re-analyze uploaded samples to build/update profile").option("--json","output as json").action(n=>Jo(n));W.command("rename").description("rename a voice profile").argument("<new-name>","new name for the profile").option("-p, --profile <slug>","specific profile to rename (uses default if only one exists)").option("--json","output as json").action((n,e)=>Ni(n,e));W.command("say").description('natural language commands (e.g., "rename my profile to X")').argument("<input>","natural language command").option("--json","output as json").action((n,e)=>Ko(n,e));W.command("mcp").description("start MCP server (for Claude Desktop and other MCP hosts)").option("--setup-chatgpt","open ChatGPT connector settings to add HYV").action(async n=>{if(n.setupChatgpt){let e=(await Promise.resolve().then(()=>S(Ve()))).default;console.log(`
314
+ `)}var W=new tn;W.name("hyv").description("hold your voice \u2014 voice gate layer for ai workflows").version("0.6.0");W.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").option("-q, --quiet","minimal output (for CI)").action(n=>rr(n.profile,{key:n.key,quiet:n.quiet}));W.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,e)=>vo(n,e));W.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)").option("--json","output as json").action((n,e,t)=>Ro(n,e,t));W.command("profiles").description("list your voice profiles").option("--json","output as json").action(n=>Mo(n));W.command("status").description("show account and cli status").option("--json","output as json").option("-q, --quiet","minimal output (for CI)").action(n=>Io(n));W.command("reinforce").description("send learning signals from an edited draft").argument("<original>","original .md file").argument("<edited>","edited .md file").option("--json","output as json").action((n,e,t)=>No(n,e,t));W.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").option("--json","output as json").action((n,e)=>Lo(n,e));W.command("validate").description("validate text against your voice profile").argument("[file]",".md file to validate").option("-p, --profile <name>","voice profile to validate against").option("-t, --text <text>","inline text to validate").option("--json","output as json").action((n,e)=>To(n,e));W.command("export").description("export voice profile as system prompt for AI apps").argument("<format>","target format: claude, chatgpt, generic, cursor").option("-o, --output <file>","write to file (use {name} for profile name)").option("--json","output as json").action((n,e)=>Wo(n,e));W.command("plan").description("show or manage your subscription").option("--upgrade","open checkout to upgrade").option("--manage","open billing portal").option("--json","output as json").action(n=>Vo(n));W.command("onboard").description("create your voice profile (questions, url scrape, folder, or llm extract)").option("--questions","answer questions to build profile").option("--url <urls>","comma-separated urls to scrape for writing samples").option("--folder <path>","path to a folder of .md/.txt files to upload").option("--extract","generate a prompt to extract voice from any llm").option("--analyze","re-analyze uploaded samples to build/update profile").option("--json","output as json").action(n=>Yo(n));W.command("rename").description("rename a voice profile").argument("<new-name>","new name for the profile").option("-p, --profile <slug>","specific profile to rename (uses default if only one exists)").option("--json","output as json").action((n,e)=>Li(n,e));W.command("say").description('natural language commands (e.g., "rename my profile to X")').argument("<input>","natural language command").option("--json","output as json").action((n,e)=>Xo(n,e));W.command("mcp").description("start MCP server (for Claude Desktop and other MCP hosts)").option("--setup-chatgpt","open ChatGPT connector settings to add HYV").action(async n=>{if(n.setupChatgpt){let e=(await Promise.resolve().then(()=>S(He()))).default;console.log(`
309
315
  ${C()} ${c.dim("chatgpt setup")}
310
316
  `),console.log(" opening chatgpt connector settings..."),console.log(` ${c.dim("add this server url:")} ${c.cyan("https://holdyourvoice.com/mcp")}`),console.log(` ${c.dim('authentication: select "OAuth" or "API Key"')}`),console.log(` ${c.dim("your CLI key will be used for auth")}
311
- `),await e("https://chatgpt.com/#settings/Connectors");return}Zo()});W.command("learn").description("manage learning signals").option("--sync","sync pending learning events to server").option("--consolidate","consolidate old learnings into summary").option("--stats","show learning statistics").option("--show","show consolidated learnings").option("--suggestions","show proactive suggestions").option("--dismiss <ruleId>","dismiss a suggestion").option("--json","output as json").action(async n=>{if(n.sync){console.log(`
317
+ `),await e("https://chatgpt.com/#settings/Connectors");return}Qo()});W.command("learn").description("manage learning signals").option("--sync","sync pending learning events to server").option("--consolidate","consolidate old learnings into summary").option("--stats","show learning statistics").option("--show","show consolidated learnings").option("--suggestions","show proactive suggestions").option("--dismiss <ruleId>","dismiss a suggestion").option("--json","output as json").action(async n=>{if(n.sync){console.log(`
312
318
  ${C()} ${c.dim("learn sync")}
313
- `);let s=await yo();console.log(` ${c.green("\u2713")} synced ${s.synced} events`),s.errors>0&&console.log(` ${c.yellow("\u26A0")} ${s.errors} errors`);return}if(n.consolidate){console.log(`
319
+ `);let s=await bo();console.log(` ${c.green("\u2713")} synced ${s.synced} events`),s.errors>0&&console.log(` ${c.yellow("\u26A0")} ${s.errors} errors`);return}if(n.consolidate){console.log(`
314
320
  ${C()} ${c.dim("learn consolidate")}
315
- `),console.log(` ${c.dim("consolidating old learnings...")}`);let s=await go();console.log(` ${c.green("\u2713")} consolidated ${s.consolidated} events`);return}if(n.show){let s=mo();s?(console.log(`
321
+ `),console.log(` ${c.dim("consolidating old learnings...")}`);let s=await mo();console.log(` ${c.green("\u2713")} consolidated ${s.consolidated} events`);return}if(n.show){let s=yo();s?(console.log(`
316
322
  ${C()} ${c.dim("consolidated learnings")}
317
323
  `),console.log(s)):(console.log(`
318
- ${c.dim("no consolidated learnings yet")}`),console.log(` ${c.dim("run:")} hyv learn --consolidate`));return}if(n.dismiss){fo(n.dismiss),console.log(` ${c.green("\u2713")} dismissed suggestion for ${c.bold(n.dismiss)}`);return}if(n.suggestions){let s=Mt();if(s.length===0){console.log(`
324
+ ${c.dim("no consolidated learnings yet")}`),console.log(` ${c.dim("run:")} hyv learn --consolidate`));return}if(n.dismiss){po(n.dismiss),console.log(` ${c.green("\u2713")} dismissed suggestion for ${c.bold(n.dismiss)}`);return}if(n.suggestions){let s=It();if(s.length===0){console.log(`
319
325
  ${c.dim("no suggestions yet \u2014 keep scanning!")}
320
326
  `);return}console.log(`
321
327
  ${C()} ${c.dim("suggestions")}
322
- `);for(let i of s)console.log(` ${c.yellow("\u2192")} ${i.suggestion}`),console.log(` ${c.dim("dismiss:")} hyv learn --dismiss ${i.ruleId}`);console.log("");return}let e=bo();if(n.json){console.log(JSON.stringify(e,null,2));return}console.log(`
328
+ `);for(let i of s)console.log(` ${c.yellow("\u2192")} ${i.suggestion}`),console.log(` ${c.dim("dismiss:")} hyv learn --dismiss ${i.ruleId}`);console.log("");return}let e=wo();if(n.json){console.log(JSON.stringify(e,null,2));return}console.log(`
323
329
  ${C()} ${c.dim("learn stats")}
324
- `),console.log(` ${c.bold("Pending:")} ${e.total} events`);for(let[s,i]of Object.entries(e.byType))console.log(` ${s}: ${i}`);e.lastSync&&console.log(` ${c.dim("Last sync:")} ${e.lastSync}`);let t=Mt();t.length>0&&console.log(`
330
+ `),console.log(` ${c.bold("Pending:")} ${e.total} events`);for(let[s,i]of Object.entries(e.byType))console.log(` ${s}: ${i}`);e.lastSync&&console.log(` ${c.dim("Last sync:")} ${e.lastSync}`);let t=It();t.length>0&&console.log(`
325
331
  ${c.yellow("\u{1F4A1}")} ${t.length} suggestions \u2014 run ${c.dim("hyv learn --suggestions")}`)});W.parse();