@redocly/cli 2.43.2 → 2.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -5,21 +5,21 @@ import { dirname as __pathDirname } from 'node:path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  var __filename = __fileURLToPath(import.meta.url);
7
7
  var __dirname = __pathDirname(__filename);
8
- import{a as Ai,c as vi}from"./chunks/OFAMJNQ6.js";import{a as ui,b as fi,c as rt,d as mi,e as gn,f as He,g as Wt,h as di,i as hi,j as yo,k as gi,l as fr,m as Pe,n as yn,o as yi,p as bi,q as Si,r as wi,s as kr,t as bo,u as mt,v as Ur}from"./chunks/WF2UYHZN.js";import{a as Sn,b as Ci,c as xi}from"./chunks/EK3VLO23.js";import{a as qt,b as W}from"./chunks/6HPPISLY.js";import{a as fn,b as ur,c as go,d as li,e as dn,f as pi,g as hn,h as Fr}from"./chunks/7M747VY2.js";import{a as ai,c as mn,d as ho}from"./chunks/P26PQ2RU.js";import"./chunks/RS5PUOTT.js";import{a as tt,b as si,c as ii}from"./chunks/E23LWKBB.js";import{a as ci}from"./chunks/O6MCQRCP.js";import{c as bn,d as Ei,f as Oi}from"./chunks/6QZTE6N6.js";import"./chunks/O6PRCLSV.js";import"./chunks/32XCOMOR.js";import{$ as ri,A as Zs,C as Qs,D as ye,F as Ne,G as pe,H as ee,I as Q,J as et,K as de,L as Fe,M as ue,N as Nr,O as y,Q as lr,R as ut,T as ei,U as ti,W as ft,X as ln,Y as Lr,_ as Mr,a as Ws,aa as pr,b as Rt,c as re,ca as ni,d as yt,da as Ot,ea as pn,f as zs,fa as un,g as Vs,ga as ze,h as an,i as mo,j as Bs,ja as oi,l as Ie,la as Ve,n as Me,o as Gs,p as cn,q as _e,r as Hs,s as Ys,t as Ks,u as cr,y as Js,z as Xs}from"./chunks/DLYUMFFQ.js";import"./chunks/NEWT5A6S.js";import{a as We,c as B,e as Pt}from"./chunks/RFWIIJFG.js";var mr=B((Ab,Pi)=>{"use strict";var af="2.0.0",cf=Number.MAX_SAFE_INTEGER||9007199254740991,lf=16,pf=250,uf=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Pi.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:lf,MAX_SAFE_BUILD_LENGTH:pf,MAX_SAFE_INTEGER:cf,RELEASE_TYPES:uf,SEMVER_SPEC_VERSION:af,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var qr=B((vb,Ri)=>{"use strict";var ff=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Ri.exports=ff});var dr=B((bt,$i)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:So,MAX_SAFE_BUILD_LENGTH:mf,MAX_LENGTH:df}=mr(),hf=qr();bt=$i.exports={};var gf=bt.re=[],yf=bt.safeRe=[],T=bt.src=[],bf=bt.safeSrc=[],j=bt.t={},Sf=0,wo="[a-zA-Z0-9-]",wf=[["\\s",1],["\\d",df],[wo,mf]],Ef=t=>{for(let[e,r]of wf)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Z=(t,e,r)=>{let n=Ef(e),o=Sf++;hf(t,o,e),j[t]=o,T[o]=e,bf[o]=n,gf[o]=new RegExp(e,r?"g":void 0),yf[o]=new RegExp(n,r?"g":void 0)};Z("NUMERICIDENTIFIER","0|[1-9]\\d*");Z("NUMERICIDENTIFIERLOOSE","\\d+");Z("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${wo}*`);Z("MAINVERSION",`(${T[j.NUMERICIDENTIFIER]})\\.(${T[j.NUMERICIDENTIFIER]})\\.(${T[j.NUMERICIDENTIFIER]})`);Z("MAINVERSIONLOOSE",`(${T[j.NUMERICIDENTIFIERLOOSE]})\\.(${T[j.NUMERICIDENTIFIERLOOSE]})\\.(${T[j.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASEIDENTIFIER",`(?:${T[j.NONNUMERICIDENTIFIER]}|${T[j.NUMERICIDENTIFIER]})`);Z("PRERELEASEIDENTIFIERLOOSE",`(?:${T[j.NONNUMERICIDENTIFIER]}|${T[j.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASE",`(?:-(${T[j.PRERELEASEIDENTIFIER]}(?:\\.${T[j.PRERELEASEIDENTIFIER]})*))`);Z("PRERELEASELOOSE",`(?:-?(${T[j.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${T[j.PRERELEASEIDENTIFIERLOOSE]})*))`);Z("BUILDIDENTIFIER",`${wo}+`);Z("BUILD",`(?:\\+(${T[j.BUILDIDENTIFIER]}(?:\\.${T[j.BUILDIDENTIFIER]})*))`);Z("FULLPLAIN",`v?${T[j.MAINVERSION]}${T[j.PRERELEASE]}?${T[j.BUILD]}?`);Z("FULL",`^${T[j.FULLPLAIN]}$`);Z("LOOSEPLAIN",`[v=\\s]*${T[j.MAINVERSIONLOOSE]}${T[j.PRERELEASELOOSE]}?${T[j.BUILD]}?`);Z("LOOSE",`^${T[j.LOOSEPLAIN]}$`);Z("GTLT","((?:<|>)?=?)");Z("XRANGEIDENTIFIERLOOSE",`${T[j.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Z("XRANGEIDENTIFIER",`${T[j.NUMERICIDENTIFIER]}|x|X|\\*`);Z("XRANGEPLAIN",`[v=\\s]*(${T[j.XRANGEIDENTIFIER]})(?:\\.(${T[j.XRANGEIDENTIFIER]})(?:\\.(${T[j.XRANGEIDENTIFIER]})(?:${T[j.PRERELEASE]})?${T[j.BUILD]}?)?)?`);Z("XRANGEPLAINLOOSE",`[v=\\s]*(${T[j.XRANGEIDENTIFIERLOOSE]})(?:\\.(${T[j.XRANGEIDENTIFIERLOOSE]})(?:\\.(${T[j.XRANGEIDENTIFIERLOOSE]})(?:${T[j.PRERELEASELOOSE]})?${T[j.BUILD]}?)?)?`);Z("XRANGE",`^${T[j.GTLT]}\\s*${T[j.XRANGEPLAIN]}$`);Z("XRANGELOOSE",`^${T[j.GTLT]}\\s*${T[j.XRANGEPLAINLOOSE]}$`);Z("COERCEPLAIN",`(^|[^\\d])(\\d{1,${So}})(?:\\.(\\d{1,${So}}))?(?:\\.(\\d{1,${So}}))?`);Z("COERCE",`${T[j.COERCEPLAIN]}(?:$|[^\\d])`);Z("COERCEFULL",T[j.COERCEPLAIN]+`(?:${T[j.PRERELEASE]})?(?:${T[j.BUILD]})?(?:$|[^\\d])`);Z("COERCERTL",T[j.COERCE],!0);Z("COERCERTLFULL",T[j.COERCEFULL],!0);Z("LONETILDE","(?:~>?)");Z("TILDETRIM",`(\\s*)${T[j.LONETILDE]}\\s+`,!0);bt.tildeTrimReplace="$1~";Z("TILDE",`^${T[j.LONETILDE]}${T[j.XRANGEPLAIN]}$`);Z("TILDELOOSE",`^${T[j.LONETILDE]}${T[j.XRANGEPLAINLOOSE]}$`);Z("LONECARET","(?:\\^)");Z("CARETTRIM",`(\\s*)${T[j.LONECARET]}\\s+`,!0);bt.caretTrimReplace="$1^";Z("CARET",`^${T[j.LONECARET]}${T[j.XRANGEPLAIN]}$`);Z("CARETLOOSE",`^${T[j.LONECARET]}${T[j.XRANGEPLAINLOOSE]}$`);Z("COMPARATORLOOSE",`^${T[j.GTLT]}\\s*(${T[j.LOOSEPLAIN]})$|^$`);Z("COMPARATOR",`^${T[j.GTLT]}\\s*(${T[j.FULLPLAIN]})$|^$`);Z("COMPARATORTRIM",`(\\s*)${T[j.GTLT]}\\s*(${T[j.LOOSEPLAIN]}|${T[j.XRANGEPLAIN]})`,!0);bt.comparatorTrimReplace="$1$2$3";Z("HYPHENRANGE",`^\\s*(${T[j.XRANGEPLAIN]})\\s+-\\s+(${T[j.XRANGEPLAIN]})\\s*$`);Z("HYPHENRANGELOOSE",`^\\s*(${T[j.XRANGEPLAINLOOSE]})\\s+-\\s+(${T[j.XRANGEPLAINLOOSE]})\\s*$`);Z("STAR","(<|>)?=?\\s*\\*");Z("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Z("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var wn=B((Pb,Ii)=>{"use strict";var Of=Object.freeze({loose:!0}),Cf=Object.freeze({}),xf=t=>t?typeof t!="object"?Of:t:Cf;Ii.exports=xf});var Eo=B((Rb,ji)=>{"use strict";var _i=/^[0-9]+$/,Ti=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=_i.test(t),n=_i.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Af=(t,e)=>Ti(e,t);ji.exports={compareIdentifiers:Ti,rcompareIdentifiers:Af}});var Te=B(($b,Ni)=>{"use strict";var En=qr(),{MAX_LENGTH:Di,MAX_SAFE_INTEGER:On}=mr(),{safeRe:Cn,t:xn}=dr(),vf=wn(),{compareIdentifiers:Oo}=Eo(),Pf=(t,e)=>{let r=e.split(".");if(r.length>t.length)return!1;for(let n=0;n<r.length;n++)if(Oo(t[n],r[n])!==0)return!1;return!0},Co=class t{constructor(e,r){if(r=vf(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Di)throw new TypeError(`version is longer than ${Di} characters`);En("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Cn[xn.LOOSE]:Cn[xn.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>On||this.major<0)throw new TypeError("Invalid major version");if(this.minor>On||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>On||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<On)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(En("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(En("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Oo(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(En("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Oo(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Cn[xn.PRERELEASELOOSE]:Cn[xn.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let s=[r,o];if(n===!1&&(s=[r]),Pf(this.prerelease,r)){let i=this.prerelease[r.split(".").length];isNaN(i)&&(this.prerelease=s)}else this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ni.exports=Co});var $t=B((Ib,Mi)=>{"use strict";var Li=Te(),Rf=(t,e,r=!1)=>{if(t instanceof Li)return t;try{return new Li(t,e)}catch(n){if(!r)return null;throw n}};Mi.exports=Rf});var ki=B((_b,Fi)=>{"use strict";var $f=$t(),If=(t,e)=>{let r=$f(t,e);return r?r.version:null};Fi.exports=If});var qi=B((Tb,Ui)=>{"use strict";var _f=$t(),Tf=(t,e)=>{let r=_f(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Ui.exports=Tf});var Vi=B((jb,zi)=>{"use strict";var Wi=Te(),jf=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new Wi(t instanceof Wi?t.version:t,r).inc(e,n,o).version}catch{return null}};zi.exports=jf});var Hi=B((Db,Gi)=>{"use strict";var Bi=$t(),Df=(t,e)=>{let r=Bi(t,null,!0),n=Bi(e,null,!0),o=r.compare(n);if(o===0)return null;let s=o>0,i=s?r:n,a=s?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};Gi.exports=Df});var Ki=B((Nb,Yi)=>{"use strict";var Nf=Te(),Lf=(t,e)=>new Nf(t,e).major;Yi.exports=Lf});var Xi=B((Lb,Ji)=>{"use strict";var Mf=Te(),Ff=(t,e)=>new Mf(t,e).minor;Ji.exports=Ff});var Qi=B((Mb,Zi)=>{"use strict";var kf=Te(),Uf=(t,e)=>new kf(t,e).patch;Zi.exports=Uf});var ta=B((Fb,ea)=>{"use strict";var qf=$t(),Wf=(t,e)=>{let r=qf(t,e);return r&&r.prerelease.length?r.prerelease:null};ea.exports=Wf});var nt=B((kb,na)=>{"use strict";var ra=Te(),zf=(t,e,r)=>new ra(t,r).compare(new ra(e,r));na.exports=zf});var sa=B((Ub,oa)=>{"use strict";var Vf=nt(),Bf=(t,e,r)=>Vf(e,t,r);oa.exports=Bf});var aa=B((qb,ia)=>{"use strict";var Gf=nt(),Hf=(t,e)=>Gf(t,e,!0);ia.exports=Hf});var An=B((Wb,la)=>{"use strict";var ca=Te(),Yf=(t,e,r)=>{let n=new ca(t,r),o=new ca(e,r);return n.compare(o)||n.compareBuild(o)};la.exports=Yf});var ua=B((zb,pa)=>{"use strict";var Kf=An(),Jf=(t,e)=>t.sort((r,n)=>Kf(r,n,e));pa.exports=Jf});var ma=B((Vb,fa)=>{"use strict";var Xf=An(),Zf=(t,e)=>t.sort((r,n)=>Xf(n,r,e));fa.exports=Zf});var Wr=B((Bb,da)=>{"use strict";var Qf=nt(),em=(t,e,r)=>Qf(t,e,r)>0;da.exports=em});var vn=B((Gb,ha)=>{"use strict";var tm=nt(),rm=(t,e,r)=>tm(t,e,r)<0;ha.exports=rm});var xo=B((Hb,ga)=>{"use strict";var nm=nt(),om=(t,e,r)=>nm(t,e,r)===0;ga.exports=om});var Ao=B((Yb,ya)=>{"use strict";var sm=nt(),im=(t,e,r)=>sm(t,e,r)!==0;ya.exports=im});var Pn=B((Kb,ba)=>{"use strict";var am=nt(),cm=(t,e,r)=>am(t,e,r)>=0;ba.exports=cm});var Rn=B((Jb,Sa)=>{"use strict";var lm=nt(),pm=(t,e,r)=>lm(t,e,r)<=0;Sa.exports=pm});var vo=B((Xb,wa)=>{"use strict";var um=xo(),fm=Ao(),mm=Wr(),dm=Pn(),hm=vn(),gm=Rn(),ym=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return um(t,r,n);case"!=":return fm(t,r,n);case">":return mm(t,r,n);case">=":return dm(t,r,n);case"<":return hm(t,r,n);case"<=":return gm(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};wa.exports=ym});var Oa=B((Zb,Ea)=>{"use strict";var bm=Te(),Sm=$t(),{safeRe:$n,t:In}=dr(),wm=(t,e)=>{if(t instanceof bm)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?$n[In.COERCEFULL]:$n[In.COERCE]);else{let c=e.includePrerelease?$n[In.COERCERTLFULL]:$n[In.COERCERTL],p;for(;(p=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||p.index+p[0].length!==r.index+r[0].length)&&(r=p),c.lastIndex=p.index+p[1].length+p[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",s=r[4]||"0",i=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Sm(`${n}.${o}.${s}${i}${a}`,e)};Ea.exports=wm});var xa=B((Qb,Ca)=>{"use strict";var Em=$t(),Om=mr(),Cm=Te(),xm=(t,e,r)=>{if(!Om.RELEASE_TYPES.includes(e))return null;let n=Am(t,r);return n&&vm(n,e)},Am=(t,e)=>{let r=t instanceof Cm?t.version:t;return Em(r,e)},vm=(t,e)=>{if(Pm(e))return t.version;switch(t.prerelease=[],e){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},Pm=t=>t.startsWith("pre");Ca.exports=xm});var va=B((eS,Aa)=>{"use strict";var Po=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};Aa.exports=Po});var ot=B((tS,Ia)=>{"use strict";var Rm=/\s+/g,Ro=class t{constructor(e,r){if(r=Im(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof $o)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Rm," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!Ra(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&km(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(Fm,"");let n=((this.options.includePrerelease&&Lm)|(this.options.loose&&Mm))+":"+e,o=Pa.get(n);if(o)return o;let s=this.options.loose,i=s?ke[je.HYPHENRANGELOOSE]:ke[je.HYPHENRANGE];e=e.replace(i,Jm(this.options.includePrerelease)),fe("hyphen replace",e),e=e.replace(ke[je.COMPARATORTRIM],jm),fe("comparator trim",e),e=e.replace(ke[je.TILDETRIM],Dm),fe("tilde trim",e),e=e.replace(ke[je.CARETTRIM],Nm),fe("caret trim",e);let a=e.split(" ").map(l=>Um(l,this.options)).join(" ").split(/\s+/).map(l=>Km(l,this.options));s&&(a=a.filter(l=>(fe("loose invalid filter",l,this.options),!!l.match(ke[je.COMPARATORLOOSE])))),fe("range list",a);let c=new Map,p=a.map(l=>new $o(l,this.options));for(let l of p){if(Ra(l))return[l];c.set(l.value,l)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return Pa.set(n,u),u}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>$a(n,r)&&e.set.some(o=>$a(o,r)&&n.every(s=>o.every(i=>s.intersects(i,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new _m(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Xm(this.set[r],e,this.options))return!0;return!1}};Ia.exports=Ro;var $m=va(),Pa=new $m,Im=wn(),$o=zr(),fe=qr(),_m=Te(),{safeRe:ke,src:Tm,t:je,comparatorTrimReplace:jm,tildeTrimReplace:Dm,caretTrimReplace:Nm}=dr(),{FLAG_INCLUDE_PRERELEASE:Lm,FLAG_LOOSE:Mm}=mr(),Fm=new RegExp(Tm[je.BUILD],"g"),Ra=t=>t.value==="<0.0.0-0",km=t=>t.value==="",$a=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(s=>o.intersects(s,e)),o=n.pop();return r},Um=(t,e)=>(t=t.replace(ke[je.BUILD],""),fe("comp",t,e),t=Vm(t,e),fe("caret",t),t=Wm(t,e),fe("tildes",t),t=Gm(t,e),fe("xrange",t),t=Ym(t,e),fe("stars",t),t),Ce=t=>!t||t.toLowerCase()==="x"||t==="*",qm=(t,e,r)=>Ce(t)&&!Ce(e)||Ce(e)&&r&&!Ce(r),Wm=(t,e)=>t.trim().split(/\s+/).map(r=>zm(r,e)).join(" "),zm=(t,e)=>{let r=e.loose?ke[je.TILDELOOSE]:ke[je.TILDE],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{fe("tilde",t,o,s,i,a,c);let p;return Ce(s)?p="":Ce(i)?p=`>=${s}.0.0${n} <${+s+1}.0.0-0`:Ce(a)?p=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:c?(fe("replaceTilde pr",c),p=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`):p=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`,fe("tilde return",p),p})},Vm=(t,e)=>t.trim().split(/\s+/).map(r=>Bm(r,e)).join(" "),Bm=(t,e)=>{fe("caret",t,e);let r=e.loose?ke[je.CARETLOOSE]:ke[je.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{fe("caret",t,o,s,i,a,c);let p;return Ce(s)?p="":Ce(i)?p=`>=${s}.0.0${n} <${+s+1}.0.0-0`:Ce(a)?s==="0"?p=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.0${n} <${+s+1}.0.0-0`:c?(fe("replaceCaret pr",c),s==="0"?i==="0"?p=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:p=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`):(fe("no pr"),s==="0"?i==="0"?p=`>=${s}.${i}.${a} <${s}.${i}.${+a+1}-0`:p=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.${a} <${+s+1}.0.0-0`),fe("caret return",p),p})},Gm=(t,e)=>(fe("replaceXRanges",t,e),t.split(/\s+/).map(r=>Hm(r,e)).join(" ")),Hm=(t,e)=>{t=t.trim();let r=e.loose?ke[je.XRANGELOOSE]:ke[je.XRANGE];return t.replace(r,(n,o,s,i,a,c)=>{if(fe("xRange",t,n,o,s,i,a,c),qm(s,i,a))return t;let p=Ce(s),u=p||Ce(i),l=u||Ce(a),d=l;return o==="="&&d&&(o=""),c=e.includePrerelease?"-0":"",p?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&d?(u&&(i=0),a=0,o===">"?(o=">=",u?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",u?s=+s+1:i=+i+1),o==="<"&&(c="-0"),n=`${o+s}.${i}.${a}${c}`):u?n=`>=${s}.0.0${c} <${+s+1}.0.0-0`:l&&(n=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),fe("xRange return",n),n})},Ym=(t,e)=>(fe("replaceStars",t,e),t.trim().replace(ke[je.STAR],"")),Km=(t,e)=>(fe("replaceGTE0",t,e),t.trim().replace(ke[e.includePrerelease?je.GTE0PRE:je.GTE0],"")),Jm=t=>(e,r,n,o,s,i,a,c,p,u,l,d)=>(Ce(n)?r="":Ce(o)?r=`>=${n}.0.0${t?"-0":""}`:Ce(s)?r=`>=${n}.${o}.0${t?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Ce(p)?c="":Ce(u)?c=`<${+p+1}.0.0-0`:Ce(l)?c=`<${p}.${+u+1}.0-0`:d?c=`<=${p}.${u}.${l}-${d}`:t?c=`<${p}.${u}.${+l+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Xm=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(fe(t[n].semver),t[n].semver!==$o.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var zr=B((rS,La)=>{"use strict";var Vr=Symbol("SemVer ANY"),To=class t{static get ANY(){return Vr}constructor(e,r){if(r=_a(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),_o("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Vr?this.value="":this.value=this.operator+this.semver.version,_o("comp",this)}parse(e){let r=this.options.loose?Ta[ja.COMPARATORLOOSE]:Ta[ja.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Da(n[2],this.options.loose):this.semver=Vr}toString(){return this.value}test(e){if(_o("Comparator.test",e,this.options.loose),this.semver===Vr||e===Vr)return!0;if(typeof e=="string")try{e=new Da(e,this.options)}catch{return!1}return Io(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Na(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Na(this.value,r).test(e.semver):(r=_a(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Io(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Io(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};La.exports=To;var _a=wn(),{safeRe:Ta,t:ja}=dr(),Io=vo(),_o=qr(),Da=Te(),Na=ot()});var Br=B((nS,Ma)=>{"use strict";var Zm=ot(),Qm=(t,e,r)=>{try{e=new Zm(e,r)}catch{return!1}return e.test(t)};Ma.exports=Qm});var ka=B((oS,Fa)=>{"use strict";var ed=ot(),td=(t,e)=>new ed(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Fa.exports=td});var qa=B((sS,Ua)=>{"use strict";var rd=Te(),nd=ot(),od=(t,e,r)=>{let n=null,o=null,s=null;try{s=new nd(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===-1)&&(n=i,o=new rd(n,r))}),n};Ua.exports=od});var za=B((iS,Wa)=>{"use strict";var sd=Te(),id=ot(),ad=(t,e,r)=>{let n=null,o=null,s=null;try{s=new id(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===1)&&(n=i,o=new sd(n,r))}),n};Wa.exports=ad});var Ga=B((aS,Ba)=>{"use strict";var jo=Te(),cd=ot(),Va=Wr(),ld=(t,e)=>{t=new cd(t,e);let r=new jo("0.0.0");if(t.test(r)||(r=new jo("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],s=null;o.forEach(i=>{let a=new jo(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Va(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),s&&(!r||Va(r,s))&&(r=s)}return r&&t.test(r)?r:null};Ba.exports=ld});var Ya=B((cS,Ha)=>{"use strict";var pd=ot(),ud=(t,e)=>{try{return new pd(t,e).range||"*"}catch{return null}};Ha.exports=ud});var _n=B((lS,Za)=>{"use strict";var fd=Te(),Xa=zr(),{ANY:md}=Xa,dd=ot(),hd=Br(),Ka=Wr(),Ja=vn(),gd=Rn(),yd=Pn(),bd=(t,e,r,n)=>{t=new fd(t,n),e=new dd(e,n);let o,s,i,a,c;switch(r){case">":o=Ka,s=gd,i=Ja,a=">",c=">=";break;case"<":o=Ja,s=yd,i=Ka,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(hd(t,e,n))return!1;for(let p=0;p<e.set.length;++p){let u=e.set[p],l=null,d=null;if(u.forEach(m=>{m.semver===md&&(m=new Xa(">=0.0.0")),l=l||m,d=d||m,o(m.semver,l.semver,n)?l=m:i(m.semver,d.semver,n)&&(d=m)}),l.operator===a||l.operator===c||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===c&&i(t,d.semver))return!1}return!0};Za.exports=bd});var ec=B((pS,Qa)=>{"use strict";var Sd=_n(),wd=(t,e,r)=>Sd(t,e,">",r);Qa.exports=wd});var rc=B((uS,tc)=>{"use strict";var Ed=_n(),Od=(t,e,r)=>Ed(t,e,"<",r);tc.exports=Od});var sc=B((fS,oc)=>{"use strict";var nc=ot(),Cd=(t,e,r)=>(t=new nc(t,r),e=new nc(e,r),t.intersects(e,r));oc.exports=Cd});var ac=B((mS,ic)=>{"use strict";var xd=Br(),Ad=nt();ic.exports=(t,e,r)=>{let n=[],o=null,s=null,i=t.sort((u,l)=>Ad(u,l,r));for(let u of i)xd(u,e,r)?(s=u,o||(o=u)):(s&&n.push([o,s]),s=null,o=null);o&&n.push([o,null]);let a=[];for(let[u,l]of n)u===l?a.push(u):!l&&u===i[0]?a.push("*"):l?u===i[0]?a.push(`<=${l}`):a.push(`${u} - ${l}`):a.push(`>=${u}`);let c=a.join(" || "),p=typeof e.raw=="string"?e.raw:String(e);return c.length<p.length?c:e}});var mc=B((dS,fc)=>{"use strict";var cc=ot(),Lo=zr(),{ANY:Do}=Lo,No=Br(),Mo=nt(),vd=(t,e,r={})=>{if(t===e)return!0;t=new cc(t,r),e=new cc(e,r);let n=!1;e:for(let o of t.set){for(let s of e.set){let i=Rd(o,s,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},Pd=[new Lo(">=0.0.0-0")],lc=[new Lo(">=0.0.0")],Rd=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Do){if(e.length===1&&e[0].semver===Do)return!0;r.includePrerelease?t=Pd:t=lc}if(e.length===1&&e[0].semver===Do){if(r.includePrerelease)return!0;e=lc}let n=new Set,o,s;for(let m of t)m.operator===">"||m.operator===">="?o=pc(o,m,r):m.operator==="<"||m.operator==="<="?s=uc(s,m,r):n.add(m.semver);if(n.size>1)return null;let i;if(o&&s){if(i=Mo(o.semver,s.semver,r),i>0)return null;if(i===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let m of n){if(o&&!No(m,String(o),r)||s&&!No(m,String(s),r))return null;for(let w of e)if(!No(m,String(w),r))return!1;return!0}let a,c,p,u,l=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;l&&l.prerelease.length===1&&s.operator==="<"&&l.prerelease[0]===0&&(l=!1);for(let m of e){if(u=u||m.operator===">"||m.operator===">=",p=p||m.operator==="<"||m.operator==="<=",o){if(d&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===d.major&&m.semver.minor===d.minor&&m.semver.patch===d.patch&&(d=!1),m.operator===">"||m.operator===">="){if(a=pc(o,m,r),a===m&&a!==o)return!1}else if(o.operator===">="&&!m.test(o.semver))return!1}if(s){if(l&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===l.major&&m.semver.minor===l.minor&&m.semver.patch===l.patch&&(l=!1),m.operator==="<"||m.operator==="<="){if(c=uc(s,m,r),c===m&&c!==s)return!1}else if(s.operator==="<="&&!m.test(s.semver))return!1}if(!m.operator&&(s||o)&&i!==0)return!1}return!(o&&p&&!s&&i!==0||s&&u&&!o&&i!==0||d||l)},pc=(t,e,r)=>{if(!t)return e;let n=Mo(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},uc=(t,e,r)=>{if(!t)return e;let n=Mo(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};fc.exports=vd});var ko=B((hS,gc)=>{"use strict";var Fo=dr(),dc=mr(),$d=Te(),hc=Eo(),Id=$t(),_d=ki(),Td=qi(),jd=Vi(),Dd=Hi(),Nd=Ki(),Ld=Xi(),Md=Qi(),Fd=ta(),kd=nt(),Ud=sa(),qd=aa(),Wd=An(),zd=ua(),Vd=ma(),Bd=Wr(),Gd=vn(),Hd=xo(),Yd=Ao(),Kd=Pn(),Jd=Rn(),Xd=vo(),Zd=Oa(),Qd=xa(),eh=zr(),th=ot(),rh=Br(),nh=ka(),oh=qa(),sh=za(),ih=Ga(),ah=Ya(),ch=_n(),lh=ec(),ph=rc(),uh=sc(),fh=ac(),mh=mc();gc.exports={parse:Id,valid:_d,clean:Td,inc:jd,diff:Dd,major:Nd,minor:Ld,patch:Md,prerelease:Fd,compare:kd,rcompare:Ud,compareLoose:qd,compareBuild:Wd,sort:zd,rsort:Vd,gt:Bd,lt:Gd,eq:Hd,neq:Yd,gte:Kd,lte:Jd,cmp:Xd,coerce:Zd,truncate:Qd,Comparator:eh,Range:th,satisfies:rh,toComparators:nh,maxSatisfying:oh,minSatisfying:sh,minVersion:ih,validRange:ah,outside:ch,gtr:lh,ltr:ph,intersects:uh,simplifyRange:fh,subset:mh,SemVer:$d,re:Fo.re,src:Fo.src,tokens:Fo.t,SEMVER_SPEC_VERSION:dc.SEMVER_SPEC_VERSION,RELEASE_TYPES:dc.RELEASE_TYPES,compareIdentifiers:hc.compareIdentifiers,rcompareIdentifiers:hc.rcompareIdentifiers}});var bc=B((bS,dh)=>{dh.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Vo=B((SS,Ct)=>{var qo=We("fs"),Wo=We("path"),hh=We("os"),gh=We("crypto"),yh=bc(),zo=yh.version,bh=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Sh(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
8
+ import{a as xi,c as vi}from"./chunks/OFAMJNQ6.js";import{a as ui,b as fi,c as rt,d as mi,e as gn,f as He,g as Wt,h as di,i as hi,j as yo,k as gi,l as fr,m as Pe,n as yn,o as yi,p as bi,q as Si,r as wi,s as kr,t as bo,u as mt,v as Ur}from"./chunks/ASFBZUY5.js";import{a as Sn,b as Ai,c as Ci}from"./chunks/EFU2RD5U.js";import{a as qt,b as W}from"./chunks/SIC26ONQ.js";import{a as fn,b as ur,c as go,d as li,e as dn,f as pi,g as hn,h as Fr}from"./chunks/UUKR7FEE.js";import{a as ai,c as mn,d as ho}from"./chunks/P26PQ2RU.js";import"./chunks/RS5PUOTT.js";import{a as tt,b as si,c as ii}from"./chunks/QLQQS5L4.js";import{a as ci}from"./chunks/O6MCQRCP.js";import{c as bn,d as Ei,f as Oi}from"./chunks/JF4SD24U.js";import"./chunks/O6PRCLSV.js";import"./chunks/32XCOMOR.js";import{$ as ri,A as Zs,C as Qs,D as ye,F as Ne,G as pe,H as ee,I as Q,J as et,K as de,L as Fe,M as ue,N as Nr,O as y,Q as lr,R as ut,T as ei,U as ti,W as ft,X as ln,Y as Lr,_ as Mr,a as Ws,aa as pr,b as Rt,c as re,ca as ni,d as yt,da as Ot,ea as pn,f as zs,fa as un,g as Vs,ga as ze,h as an,i as mo,j as Bs,ja as oi,l as Ie,la as Ve,n as Me,o as Gs,p as cn,q as _e,r as Hs,s as Ys,t as Ks,u as cr,y as Js,z as Xs}from"./chunks/J46HWXZ6.js";import"./chunks/NEWT5A6S.js";import{a as We,c as B,e as Pt}from"./chunks/RFWIIJFG.js";var mr=B((xb,Pi)=>{"use strict";var af="2.0.0",cf=Number.MAX_SAFE_INTEGER||9007199254740991,lf=16,pf=250,uf=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Pi.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:lf,MAX_SAFE_BUILD_LENGTH:pf,MAX_SAFE_INTEGER:cf,RELEASE_TYPES:uf,SEMVER_SPEC_VERSION:af,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var qr=B((vb,Ri)=>{"use strict";var ff=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Ri.exports=ff});var dr=B((bt,$i)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:So,MAX_SAFE_BUILD_LENGTH:mf,MAX_LENGTH:df}=mr(),hf=qr();bt=$i.exports={};var gf=bt.re=[],yf=bt.safeRe=[],T=bt.src=[],bf=bt.safeSrc=[],j=bt.t={},Sf=0,wo="[a-zA-Z0-9-]",wf=[["\\s",1],["\\d",df],[wo,mf]],Ef=t=>{for(let[e,r]of wf)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Z=(t,e,r)=>{let n=Ef(e),o=Sf++;hf(t,o,e),j[t]=o,T[o]=e,bf[o]=n,gf[o]=new RegExp(e,r?"g":void 0),yf[o]=new RegExp(n,r?"g":void 0)};Z("NUMERICIDENTIFIER","0|[1-9]\\d*");Z("NUMERICIDENTIFIERLOOSE","\\d+");Z("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${wo}*`);Z("MAINVERSION",`(${T[j.NUMERICIDENTIFIER]})\\.(${T[j.NUMERICIDENTIFIER]})\\.(${T[j.NUMERICIDENTIFIER]})`);Z("MAINVERSIONLOOSE",`(${T[j.NUMERICIDENTIFIERLOOSE]})\\.(${T[j.NUMERICIDENTIFIERLOOSE]})\\.(${T[j.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASEIDENTIFIER",`(?:${T[j.NONNUMERICIDENTIFIER]}|${T[j.NUMERICIDENTIFIER]})`);Z("PRERELEASEIDENTIFIERLOOSE",`(?:${T[j.NONNUMERICIDENTIFIER]}|${T[j.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASE",`(?:-(${T[j.PRERELEASEIDENTIFIER]}(?:\\.${T[j.PRERELEASEIDENTIFIER]})*))`);Z("PRERELEASELOOSE",`(?:-?(${T[j.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${T[j.PRERELEASEIDENTIFIERLOOSE]})*))`);Z("BUILDIDENTIFIER",`${wo}+`);Z("BUILD",`(?:\\+(${T[j.BUILDIDENTIFIER]}(?:\\.${T[j.BUILDIDENTIFIER]})*))`);Z("FULLPLAIN",`v?${T[j.MAINVERSION]}${T[j.PRERELEASE]}?${T[j.BUILD]}?`);Z("FULL",`^${T[j.FULLPLAIN]}$`);Z("LOOSEPLAIN",`[v=\\s]*${T[j.MAINVERSIONLOOSE]}${T[j.PRERELEASELOOSE]}?${T[j.BUILD]}?`);Z("LOOSE",`^${T[j.LOOSEPLAIN]}$`);Z("GTLT","((?:<|>)?=?)");Z("XRANGEIDENTIFIERLOOSE",`${T[j.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Z("XRANGEIDENTIFIER",`${T[j.NUMERICIDENTIFIER]}|x|X|\\*`);Z("XRANGEPLAIN",`[v=\\s]*(${T[j.XRANGEIDENTIFIER]})(?:\\.(${T[j.XRANGEIDENTIFIER]})(?:\\.(${T[j.XRANGEIDENTIFIER]})(?:${T[j.PRERELEASE]})?${T[j.BUILD]}?)?)?`);Z("XRANGEPLAINLOOSE",`[v=\\s]*(${T[j.XRANGEIDENTIFIERLOOSE]})(?:\\.(${T[j.XRANGEIDENTIFIERLOOSE]})(?:\\.(${T[j.XRANGEIDENTIFIERLOOSE]})(?:${T[j.PRERELEASELOOSE]})?${T[j.BUILD]}?)?)?`);Z("XRANGE",`^${T[j.GTLT]}\\s*${T[j.XRANGEPLAIN]}$`);Z("XRANGELOOSE",`^${T[j.GTLT]}\\s*${T[j.XRANGEPLAINLOOSE]}$`);Z("COERCEPLAIN",`(^|[^\\d])(\\d{1,${So}})(?:\\.(\\d{1,${So}}))?(?:\\.(\\d{1,${So}}))?`);Z("COERCE",`${T[j.COERCEPLAIN]}(?:$|[^\\d])`);Z("COERCEFULL",T[j.COERCEPLAIN]+`(?:${T[j.PRERELEASE]})?(?:${T[j.BUILD]})?(?:$|[^\\d])`);Z("COERCERTL",T[j.COERCE],!0);Z("COERCERTLFULL",T[j.COERCEFULL],!0);Z("LONETILDE","(?:~>?)");Z("TILDETRIM",`(\\s*)${T[j.LONETILDE]}\\s+`,!0);bt.tildeTrimReplace="$1~";Z("TILDE",`^${T[j.LONETILDE]}${T[j.XRANGEPLAIN]}$`);Z("TILDELOOSE",`^${T[j.LONETILDE]}${T[j.XRANGEPLAINLOOSE]}$`);Z("LONECARET","(?:\\^)");Z("CARETTRIM",`(\\s*)${T[j.LONECARET]}\\s+`,!0);bt.caretTrimReplace="$1^";Z("CARET",`^${T[j.LONECARET]}${T[j.XRANGEPLAIN]}$`);Z("CARETLOOSE",`^${T[j.LONECARET]}${T[j.XRANGEPLAINLOOSE]}$`);Z("COMPARATORLOOSE",`^${T[j.GTLT]}\\s*(${T[j.LOOSEPLAIN]})$|^$`);Z("COMPARATOR",`^${T[j.GTLT]}\\s*(${T[j.FULLPLAIN]})$|^$`);Z("COMPARATORTRIM",`(\\s*)${T[j.GTLT]}\\s*(${T[j.LOOSEPLAIN]}|${T[j.XRANGEPLAIN]})`,!0);bt.comparatorTrimReplace="$1$2$3";Z("HYPHENRANGE",`^\\s*(${T[j.XRANGEPLAIN]})\\s+-\\s+(${T[j.XRANGEPLAIN]})\\s*$`);Z("HYPHENRANGELOOSE",`^\\s*(${T[j.XRANGEPLAINLOOSE]})\\s+-\\s+(${T[j.XRANGEPLAINLOOSE]})\\s*$`);Z("STAR","(<|>)?=?\\s*\\*");Z("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Z("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var wn=B((Pb,Ii)=>{"use strict";var Of=Object.freeze({loose:!0}),Af=Object.freeze({}),Cf=t=>t?typeof t!="object"?Of:t:Af;Ii.exports=Cf});var Eo=B((Rb,ji)=>{"use strict";var _i=/^[0-9]+$/,Ti=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=_i.test(t),n=_i.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},xf=(t,e)=>Ti(e,t);ji.exports={compareIdentifiers:Ti,rcompareIdentifiers:xf}});var Te=B(($b,Ni)=>{"use strict";var En=qr(),{MAX_LENGTH:Di,MAX_SAFE_INTEGER:On}=mr(),{safeRe:An,t:Cn}=dr(),vf=wn(),{compareIdentifiers:Oo}=Eo(),Pf=(t,e)=>{let r=e.split(".");if(r.length>t.length)return!1;for(let n=0;n<r.length;n++)if(Oo(t[n],r[n])!==0)return!1;return!0},Ao=class t{constructor(e,r){if(r=vf(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Di)throw new TypeError(`version is longer than ${Di} characters`);En("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?An[Cn.LOOSE]:An[Cn.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>On||this.major<0)throw new TypeError("Invalid major version");if(this.minor>On||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>On||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<On)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(En("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(En("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Oo(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(En("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Oo(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?An[Cn.PRERELEASELOOSE]:An[Cn.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let s=[r,o];if(n===!1&&(s=[r]),Pf(this.prerelease,r)){let i=this.prerelease[r.split(".").length];isNaN(i)&&(this.prerelease=s)}else this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ni.exports=Ao});var $t=B((Ib,Mi)=>{"use strict";var Li=Te(),Rf=(t,e,r=!1)=>{if(t instanceof Li)return t;try{return new Li(t,e)}catch(n){if(!r)return null;throw n}};Mi.exports=Rf});var ki=B((_b,Fi)=>{"use strict";var $f=$t(),If=(t,e)=>{let r=$f(t,e);return r?r.version:null};Fi.exports=If});var qi=B((Tb,Ui)=>{"use strict";var _f=$t(),Tf=(t,e)=>{let r=_f(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Ui.exports=Tf});var Vi=B((jb,zi)=>{"use strict";var Wi=Te(),jf=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new Wi(t instanceof Wi?t.version:t,r).inc(e,n,o).version}catch{return null}};zi.exports=jf});var Hi=B((Db,Gi)=>{"use strict";var Bi=$t(),Df=(t,e)=>{let r=Bi(t,null,!0),n=Bi(e,null,!0),o=r.compare(n);if(o===0)return null;let s=o>0,i=s?r:n,a=s?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};Gi.exports=Df});var Ki=B((Nb,Yi)=>{"use strict";var Nf=Te(),Lf=(t,e)=>new Nf(t,e).major;Yi.exports=Lf});var Xi=B((Lb,Ji)=>{"use strict";var Mf=Te(),Ff=(t,e)=>new Mf(t,e).minor;Ji.exports=Ff});var Qi=B((Mb,Zi)=>{"use strict";var kf=Te(),Uf=(t,e)=>new kf(t,e).patch;Zi.exports=Uf});var ta=B((Fb,ea)=>{"use strict";var qf=$t(),Wf=(t,e)=>{let r=qf(t,e);return r&&r.prerelease.length?r.prerelease:null};ea.exports=Wf});var nt=B((kb,na)=>{"use strict";var ra=Te(),zf=(t,e,r)=>new ra(t,r).compare(new ra(e,r));na.exports=zf});var sa=B((Ub,oa)=>{"use strict";var Vf=nt(),Bf=(t,e,r)=>Vf(e,t,r);oa.exports=Bf});var aa=B((qb,ia)=>{"use strict";var Gf=nt(),Hf=(t,e)=>Gf(t,e,!0);ia.exports=Hf});var xn=B((Wb,la)=>{"use strict";var ca=Te(),Yf=(t,e,r)=>{let n=new ca(t,r),o=new ca(e,r);return n.compare(o)||n.compareBuild(o)};la.exports=Yf});var ua=B((zb,pa)=>{"use strict";var Kf=xn(),Jf=(t,e)=>t.sort((r,n)=>Kf(r,n,e));pa.exports=Jf});var ma=B((Vb,fa)=>{"use strict";var Xf=xn(),Zf=(t,e)=>t.sort((r,n)=>Xf(n,r,e));fa.exports=Zf});var Wr=B((Bb,da)=>{"use strict";var Qf=nt(),em=(t,e,r)=>Qf(t,e,r)>0;da.exports=em});var vn=B((Gb,ha)=>{"use strict";var tm=nt(),rm=(t,e,r)=>tm(t,e,r)<0;ha.exports=rm});var Co=B((Hb,ga)=>{"use strict";var nm=nt(),om=(t,e,r)=>nm(t,e,r)===0;ga.exports=om});var xo=B((Yb,ya)=>{"use strict";var sm=nt(),im=(t,e,r)=>sm(t,e,r)!==0;ya.exports=im});var Pn=B((Kb,ba)=>{"use strict";var am=nt(),cm=(t,e,r)=>am(t,e,r)>=0;ba.exports=cm});var Rn=B((Jb,Sa)=>{"use strict";var lm=nt(),pm=(t,e,r)=>lm(t,e,r)<=0;Sa.exports=pm});var vo=B((Xb,wa)=>{"use strict";var um=Co(),fm=xo(),mm=Wr(),dm=Pn(),hm=vn(),gm=Rn(),ym=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return um(t,r,n);case"!=":return fm(t,r,n);case">":return mm(t,r,n);case">=":return dm(t,r,n);case"<":return hm(t,r,n);case"<=":return gm(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};wa.exports=ym});var Oa=B((Zb,Ea)=>{"use strict";var bm=Te(),Sm=$t(),{safeRe:$n,t:In}=dr(),wm=(t,e)=>{if(t instanceof bm)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?$n[In.COERCEFULL]:$n[In.COERCE]);else{let c=e.includePrerelease?$n[In.COERCERTLFULL]:$n[In.COERCERTL],p;for(;(p=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||p.index+p[0].length!==r.index+r[0].length)&&(r=p),c.lastIndex=p.index+p[1].length+p[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",s=r[4]||"0",i=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Sm(`${n}.${o}.${s}${i}${a}`,e)};Ea.exports=wm});var Ca=B((Qb,Aa)=>{"use strict";var Em=$t(),Om=mr(),Am=Te(),Cm=(t,e,r)=>{if(!Om.RELEASE_TYPES.includes(e))return null;let n=xm(t,r);return n&&vm(n,e)},xm=(t,e)=>{let r=t instanceof Am?t.version:t;return Em(r,e)},vm=(t,e)=>{if(Pm(e))return t.version;switch(t.prerelease=[],e){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},Pm=t=>t.startsWith("pre");Aa.exports=Cm});var va=B((eS,xa)=>{"use strict";var Po=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};xa.exports=Po});var ot=B((tS,Ia)=>{"use strict";var Rm=/\s+/g,Ro=class t{constructor(e,r){if(r=Im(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof $o)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Rm," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!Ra(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&km(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(Fm,"");let n=((this.options.includePrerelease&&Lm)|(this.options.loose&&Mm))+":"+e,o=Pa.get(n);if(o)return o;let s=this.options.loose,i=s?ke[je.HYPHENRANGELOOSE]:ke[je.HYPHENRANGE];e=e.replace(i,Jm(this.options.includePrerelease)),fe("hyphen replace",e),e=e.replace(ke[je.COMPARATORTRIM],jm),fe("comparator trim",e),e=e.replace(ke[je.TILDETRIM],Dm),fe("tilde trim",e),e=e.replace(ke[je.CARETTRIM],Nm),fe("caret trim",e);let a=e.split(" ").map(l=>Um(l,this.options)).join(" ").split(/\s+/).map(l=>Km(l,this.options));s&&(a=a.filter(l=>(fe("loose invalid filter",l,this.options),!!l.match(ke[je.COMPARATORLOOSE])))),fe("range list",a);let c=new Map,p=a.map(l=>new $o(l,this.options));for(let l of p){if(Ra(l))return[l];c.set(l.value,l)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return Pa.set(n,u),u}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>$a(n,r)&&e.set.some(o=>$a(o,r)&&n.every(s=>o.every(i=>s.intersects(i,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new _m(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Xm(this.set[r],e,this.options))return!0;return!1}};Ia.exports=Ro;var $m=va(),Pa=new $m,Im=wn(),$o=zr(),fe=qr(),_m=Te(),{safeRe:ke,src:Tm,t:je,comparatorTrimReplace:jm,tildeTrimReplace:Dm,caretTrimReplace:Nm}=dr(),{FLAG_INCLUDE_PRERELEASE:Lm,FLAG_LOOSE:Mm}=mr(),Fm=new RegExp(Tm[je.BUILD],"g"),Ra=t=>t.value==="<0.0.0-0",km=t=>t.value==="",$a=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(s=>o.intersects(s,e)),o=n.pop();return r},Um=(t,e)=>(t=t.replace(ke[je.BUILD],""),fe("comp",t,e),t=Vm(t,e),fe("caret",t),t=Wm(t,e),fe("tildes",t),t=Gm(t,e),fe("xrange",t),t=Ym(t,e),fe("stars",t),t),Ae=t=>!t||t.toLowerCase()==="x"||t==="*",qm=(t,e,r)=>Ae(t)&&!Ae(e)||Ae(e)&&r&&!Ae(r),Wm=(t,e)=>t.trim().split(/\s+/).map(r=>zm(r,e)).join(" "),zm=(t,e)=>{let r=e.loose?ke[je.TILDELOOSE]:ke[je.TILDE],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{fe("tilde",t,o,s,i,a,c);let p;return Ae(s)?p="":Ae(i)?p=`>=${s}.0.0${n} <${+s+1}.0.0-0`:Ae(a)?p=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:c?(fe("replaceTilde pr",c),p=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`):p=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`,fe("tilde return",p),p})},Vm=(t,e)=>t.trim().split(/\s+/).map(r=>Bm(r,e)).join(" "),Bm=(t,e)=>{fe("caret",t,e);let r=e.loose?ke[je.CARETLOOSE]:ke[je.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{fe("caret",t,o,s,i,a,c);let p;return Ae(s)?p="":Ae(i)?p=`>=${s}.0.0${n} <${+s+1}.0.0-0`:Ae(a)?s==="0"?p=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.0${n} <${+s+1}.0.0-0`:c?(fe("replaceCaret pr",c),s==="0"?i==="0"?p=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:p=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`):(fe("no pr"),s==="0"?i==="0"?p=`>=${s}.${i}.${a} <${s}.${i}.${+a+1}-0`:p=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.${a} <${+s+1}.0.0-0`),fe("caret return",p),p})},Gm=(t,e)=>(fe("replaceXRanges",t,e),t.split(/\s+/).map(r=>Hm(r,e)).join(" ")),Hm=(t,e)=>{t=t.trim();let r=e.loose?ke[je.XRANGELOOSE]:ke[je.XRANGE];return t.replace(r,(n,o,s,i,a,c)=>{if(fe("xRange",t,n,o,s,i,a,c),qm(s,i,a))return t;let p=Ae(s),u=p||Ae(i),l=u||Ae(a),d=l;return o==="="&&d&&(o=""),c=e.includePrerelease?"-0":"",p?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&d?(u&&(i=0),a=0,o===">"?(o=">=",u?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",u?s=+s+1:i=+i+1),o==="<"&&(c="-0"),n=`${o+s}.${i}.${a}${c}`):u?n=`>=${s}.0.0${c} <${+s+1}.0.0-0`:l&&(n=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),fe("xRange return",n),n})},Ym=(t,e)=>(fe("replaceStars",t,e),t.trim().replace(ke[je.STAR],"")),Km=(t,e)=>(fe("replaceGTE0",t,e),t.trim().replace(ke[e.includePrerelease?je.GTE0PRE:je.GTE0],"")),Jm=t=>(e,r,n,o,s,i,a,c,p,u,l,d)=>(Ae(n)?r="":Ae(o)?r=`>=${n}.0.0${t?"-0":""}`:Ae(s)?r=`>=${n}.${o}.0${t?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Ae(p)?c="":Ae(u)?c=`<${+p+1}.0.0-0`:Ae(l)?c=`<${p}.${+u+1}.0-0`:d?c=`<=${p}.${u}.${l}-${d}`:t?c=`<${p}.${u}.${+l+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Xm=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(fe(t[n].semver),t[n].semver!==$o.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var zr=B((rS,La)=>{"use strict";var Vr=Symbol("SemVer ANY"),To=class t{static get ANY(){return Vr}constructor(e,r){if(r=_a(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),_o("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Vr?this.value="":this.value=this.operator+this.semver.version,_o("comp",this)}parse(e){let r=this.options.loose?Ta[ja.COMPARATORLOOSE]:Ta[ja.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Da(n[2],this.options.loose):this.semver=Vr}toString(){return this.value}test(e){if(_o("Comparator.test",e,this.options.loose),this.semver===Vr||e===Vr)return!0;if(typeof e=="string")try{e=new Da(e,this.options)}catch{return!1}return Io(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Na(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Na(this.value,r).test(e.semver):(r=_a(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Io(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Io(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};La.exports=To;var _a=wn(),{safeRe:Ta,t:ja}=dr(),Io=vo(),_o=qr(),Da=Te(),Na=ot()});var Br=B((nS,Ma)=>{"use strict";var Zm=ot(),Qm=(t,e,r)=>{try{e=new Zm(e,r)}catch{return!1}return e.test(t)};Ma.exports=Qm});var ka=B((oS,Fa)=>{"use strict";var ed=ot(),td=(t,e)=>new ed(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Fa.exports=td});var qa=B((sS,Ua)=>{"use strict";var rd=Te(),nd=ot(),od=(t,e,r)=>{let n=null,o=null,s=null;try{s=new nd(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===-1)&&(n=i,o=new rd(n,r))}),n};Ua.exports=od});var za=B((iS,Wa)=>{"use strict";var sd=Te(),id=ot(),ad=(t,e,r)=>{let n=null,o=null,s=null;try{s=new id(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===1)&&(n=i,o=new sd(n,r))}),n};Wa.exports=ad});var Ga=B((aS,Ba)=>{"use strict";var jo=Te(),cd=ot(),Va=Wr(),ld=(t,e)=>{t=new cd(t,e);let r=new jo("0.0.0");if(t.test(r)||(r=new jo("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],s=null;o.forEach(i=>{let a=new jo(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Va(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),s&&(!r||Va(r,s))&&(r=s)}return r&&t.test(r)?r:null};Ba.exports=ld});var Ya=B((cS,Ha)=>{"use strict";var pd=ot(),ud=(t,e)=>{try{return new pd(t,e).range||"*"}catch{return null}};Ha.exports=ud});var _n=B((lS,Za)=>{"use strict";var fd=Te(),Xa=zr(),{ANY:md}=Xa,dd=ot(),hd=Br(),Ka=Wr(),Ja=vn(),gd=Rn(),yd=Pn(),bd=(t,e,r,n)=>{t=new fd(t,n),e=new dd(e,n);let o,s,i,a,c;switch(r){case">":o=Ka,s=gd,i=Ja,a=">",c=">=";break;case"<":o=Ja,s=yd,i=Ka,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(hd(t,e,n))return!1;for(let p=0;p<e.set.length;++p){let u=e.set[p],l=null,d=null;if(u.forEach(m=>{m.semver===md&&(m=new Xa(">=0.0.0")),l=l||m,d=d||m,o(m.semver,l.semver,n)?l=m:i(m.semver,d.semver,n)&&(d=m)}),l.operator===a||l.operator===c||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===c&&i(t,d.semver))return!1}return!0};Za.exports=bd});var ec=B((pS,Qa)=>{"use strict";var Sd=_n(),wd=(t,e,r)=>Sd(t,e,">",r);Qa.exports=wd});var rc=B((uS,tc)=>{"use strict";var Ed=_n(),Od=(t,e,r)=>Ed(t,e,"<",r);tc.exports=Od});var sc=B((fS,oc)=>{"use strict";var nc=ot(),Ad=(t,e,r)=>(t=new nc(t,r),e=new nc(e,r),t.intersects(e,r));oc.exports=Ad});var ac=B((mS,ic)=>{"use strict";var Cd=Br(),xd=nt();ic.exports=(t,e,r)=>{let n=[],o=null,s=null,i=t.sort((u,l)=>xd(u,l,r));for(let u of i)Cd(u,e,r)?(s=u,o||(o=u)):(s&&n.push([o,s]),s=null,o=null);o&&n.push([o,null]);let a=[];for(let[u,l]of n)u===l?a.push(u):!l&&u===i[0]?a.push("*"):l?u===i[0]?a.push(`<=${l}`):a.push(`${u} - ${l}`):a.push(`>=${u}`);let c=a.join(" || "),p=typeof e.raw=="string"?e.raw:String(e);return c.length<p.length?c:e}});var mc=B((dS,fc)=>{"use strict";var cc=ot(),Lo=zr(),{ANY:Do}=Lo,No=Br(),Mo=nt(),vd=(t,e,r={})=>{if(t===e)return!0;t=new cc(t,r),e=new cc(e,r);let n=!1;e:for(let o of t.set){for(let s of e.set){let i=Rd(o,s,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},Pd=[new Lo(">=0.0.0-0")],lc=[new Lo(">=0.0.0")],Rd=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Do){if(e.length===1&&e[0].semver===Do)return!0;r.includePrerelease?t=Pd:t=lc}if(e.length===1&&e[0].semver===Do){if(r.includePrerelease)return!0;e=lc}let n=new Set,o,s;for(let m of t)m.operator===">"||m.operator===">="?o=pc(o,m,r):m.operator==="<"||m.operator==="<="?s=uc(s,m,r):n.add(m.semver);if(n.size>1)return null;let i;if(o&&s){if(i=Mo(o.semver,s.semver,r),i>0)return null;if(i===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let m of n){if(o&&!No(m,String(o),r)||s&&!No(m,String(s),r))return null;for(let w of e)if(!No(m,String(w),r))return!1;return!0}let a,c,p,u,l=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;l&&l.prerelease.length===1&&s.operator==="<"&&l.prerelease[0]===0&&(l=!1);for(let m of e){if(u=u||m.operator===">"||m.operator===">=",p=p||m.operator==="<"||m.operator==="<=",o){if(d&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===d.major&&m.semver.minor===d.minor&&m.semver.patch===d.patch&&(d=!1),m.operator===">"||m.operator===">="){if(a=pc(o,m,r),a===m&&a!==o)return!1}else if(o.operator===">="&&!m.test(o.semver))return!1}if(s){if(l&&m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===l.major&&m.semver.minor===l.minor&&m.semver.patch===l.patch&&(l=!1),m.operator==="<"||m.operator==="<="){if(c=uc(s,m,r),c===m&&c!==s)return!1}else if(s.operator==="<="&&!m.test(s.semver))return!1}if(!m.operator&&(s||o)&&i!==0)return!1}return!(o&&p&&!s&&i!==0||s&&u&&!o&&i!==0||d||l)},pc=(t,e,r)=>{if(!t)return e;let n=Mo(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},uc=(t,e,r)=>{if(!t)return e;let n=Mo(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};fc.exports=vd});var ko=B((hS,gc)=>{"use strict";var Fo=dr(),dc=mr(),$d=Te(),hc=Eo(),Id=$t(),_d=ki(),Td=qi(),jd=Vi(),Dd=Hi(),Nd=Ki(),Ld=Xi(),Md=Qi(),Fd=ta(),kd=nt(),Ud=sa(),qd=aa(),Wd=xn(),zd=ua(),Vd=ma(),Bd=Wr(),Gd=vn(),Hd=Co(),Yd=xo(),Kd=Pn(),Jd=Rn(),Xd=vo(),Zd=Oa(),Qd=Ca(),eh=zr(),th=ot(),rh=Br(),nh=ka(),oh=qa(),sh=za(),ih=Ga(),ah=Ya(),ch=_n(),lh=ec(),ph=rc(),uh=sc(),fh=ac(),mh=mc();gc.exports={parse:Id,valid:_d,clean:Td,inc:jd,diff:Dd,major:Nd,minor:Ld,patch:Md,prerelease:Fd,compare:kd,rcompare:Ud,compareLoose:qd,compareBuild:Wd,sort:zd,rsort:Vd,gt:Bd,lt:Gd,eq:Hd,neq:Yd,gte:Kd,lte:Jd,cmp:Xd,coerce:Zd,truncate:Qd,Comparator:eh,Range:th,satisfies:rh,toComparators:nh,maxSatisfying:oh,minSatisfying:sh,minVersion:ih,validRange:ah,outside:ch,gtr:lh,ltr:ph,intersects:uh,simplifyRange:fh,subset:mh,SemVer:$d,re:Fo.re,src:Fo.src,tokens:Fo.t,SEMVER_SPEC_VERSION:dc.SEMVER_SPEC_VERSION,RELEASE_TYPES:dc.RELEASE_TYPES,compareIdentifiers:hc.compareIdentifiers,rcompareIdentifiers:hc.rcompareIdentifiers}});var bc=B((bS,dh)=>{dh.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Vo=B((SS,At)=>{var qo=We("fs"),Wo=We("path"),hh=We("os"),gh=We("crypto"),yh=bc(),zo=yh.version,bh=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Sh(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
9
9
  `);let n;for(;(n=bh.exec(r))!=null;){let o=n[1],s=n[2]||"";s=s.trim();let i=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(s=s.replace(/\\n/g,`
10
- `),s=s.replace(/\\r/g,"\r")),e[o]=s}return e}function wh(t){let e=Ec(t),r=xe.configDotenv({path:e});if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let n=wc(t).split(","),o=n.length,s;for(let i=0;i<o;i++)try{let a=n[i].trim(),c=Ch(r,a);s=xe.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=o)throw a}return xe.parse(s)}function Eh(t){console.log(`[dotenv@${zo}][INFO] ${t}`)}function Oh(t){console.log(`[dotenv@${zo}][WARN] ${t}`)}function Tn(t){console.log(`[dotenv@${zo}][DEBUG] ${t}`)}function wc(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Ch(t,e){let r;try{r=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let o=r.searchParams.get("environment");if(!o){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${o.toUpperCase()}`,i=t.parsed[s];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:n}}function Ec(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)qo.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=Wo.resolve(process.cwd(),".env.vault");return qo.existsSync(e)?e:null}function Sc(t){return t[0]==="~"?Wo.join(hh.homedir(),t.slice(1)):t}function xh(t){Eh("Loading env from encrypted .env.vault");let e=xe._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),xe.populate(r,e,t),{parsed:e}}function Ah(t){let e=Wo.resolve(process.cwd(),".env"),r="utf8",n=!!(t&&t.debug);t&&t.encoding?r=t.encoding:n&&Tn("No encoding is specified. UTF-8 is used by default");let o=[e];if(t&&t.path)if(!Array.isArray(t.path))o=[Sc(t.path)];else{o=[];for(let c of t.path)o.push(Sc(c))}let s,i={};for(let c of o)try{let p=xe.parse(qo.readFileSync(c,{encoding:r}));xe.populate(i,p,t)}catch(p){n&&Tn(`Failed to load ${c} ${p.message}`),s=p}let a=process.env;return t&&t.processEnv!=null&&(a=t.processEnv),xe.populate(a,i,t),s?{parsed:i,error:s}:{parsed:i}}function vh(t){if(wc(t).length===0)return xe.configDotenv(t);let e=Ec(t);return e?xe._configVault(t):(Oh(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),xe.configDotenv(t))}function Ph(t,e){let r=Buffer.from(e.slice(-64),"hex"),n=Buffer.from(t,"base64"),o=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let i=gh.createDecipheriv("aes-256-gcm",r,o);return i.setAuthTag(s),`${i.update(n)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",p=i.message==="Unsupported state or unable to authenticate data";if(a||c){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(p){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw i}}function Rh(t,e,r={}){let n=!!(r&&r.debug),o=!!(r&&r.override);if(typeof e!="object"){let s=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw s.code="OBJECT_REQUIRED",s}for(let s of Object.keys(e))Object.prototype.hasOwnProperty.call(t,s)?(o===!0&&(t[s]=e[s]),n&&Tn(o===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):t[s]=e[s]}var xe={configDotenv:Ah,_configVault:xh,_parseVault:wh,config:vh,decrypt:Ph,parse:Sh,populate:Rh};Ct.exports.configDotenv=xe.configDotenv;Ct.exports._configVault=xe._configVault;Ct.exports._parseVault=xe._parseVault;Ct.exports.config=xe.config;Ct.exports.decrypt=xe.decrypt;Ct.exports.parse=xe.parse;Ct.exports.populate=xe.populate;Ct.exports=xe});var sp=B(xs=>{"use strict";xs.parse=Qg;xs.serialize=ey;var Hg=Object.prototype.toString,Yg=Object.prototype.hasOwnProperty,Kg=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Jg=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,Xg=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,Zg=/^[\u0020-\u003A\u003D-\u007E]*$/;function Qg(t,e){if(typeof t!="string")throw new TypeError("argument str must be a string");var r={},n=t.length;if(n<2)return r;var o=e&&e.decode||ty,s=0,i=0,a=0;do{if(i=t.indexOf("=",s),i===-1)break;if(a=t.indexOf(";",s),a===-1)a=n;else if(i>a){s=t.lastIndexOf(";",i-1)+1;continue}var c=np(t,s,i),p=op(t,i,c),u=t.slice(c,p);if(!Yg.call(r,u)){var l=np(t,i+1,a),d=op(t,a,l);t.charCodeAt(l)===34&&t.charCodeAt(d-1)===34&&(l++,d--);var m=t.slice(l,d);r[u]=ny(m,o)}s=a+1}while(s<n);return r}function np(t,e,r){do{var n=t.charCodeAt(e);if(n!==32&&n!==9)return e}while(++e<r);return r}function op(t,e,r){for(;e>r;){var n=t.charCodeAt(--e);if(n!==32&&n!==9)return e+1}return r}function ey(t,e,r){var n=r&&r.encode||encodeURIComponent;if(typeof n!="function")throw new TypeError("option encode is invalid");if(!Kg.test(t))throw new TypeError("argument name is invalid");var o=n(e);if(!Jg.test(o))throw new TypeError("argument val is invalid");var s=t+"="+o;if(!r)return s;if(r.maxAge!=null){var i=Math.floor(r.maxAge);if(!isFinite(i))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+i}if(r.domain){if(!Xg.test(r.domain))throw new TypeError("option domain is invalid");s+="; Domain="+r.domain}if(r.path){if(!Zg.test(r.path))throw new TypeError("option path is invalid");s+="; Path="+r.path}if(r.expires){var a=r.expires;if(!ry(a)||isNaN(a.valueOf()))throw new TypeError("option expires is invalid");s+="; Expires="+a.toUTCString()}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.partitioned&&(s+="; Partitioned"),r.priority){var c=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(c){case"low":s+="; Priority=Low";break;case"medium":s+="; Priority=Medium";break;case"high":s+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var p=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(p){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s}function ty(t){return t.indexOf("%")!==-1?decodeURIComponent(t):t}function ry(t){return Hg.call(t)==="[object Date]"}function ny(t,e){try{return e(t)}catch{return t}}});var lp=B((tx,tn)=>{"use strict";var Jn={decodeValues:!0,map:!1,silent:!1};function As(t){return typeof t=="string"&&!!t.trim()}function vs(t,e){var r=t.split(";").filter(As),n=r.shift(),o=oy(n),s=o.name,i=o.value;e=e?Object.assign({},Jn,e):Jn;try{i=e.decodeValues?decodeURIComponent(i):i}catch(c){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+i+"'. Set options.decodeValues to false to disable this feature.",c)}var a={name:s,value:i};return r.forEach(function(c){var p=c.split("="),u=p.shift().trimLeft().toLowerCase(),l=p.join("=");u==="expires"?a.expires=new Date(l):u==="max-age"?a.maxAge=parseInt(l,10):u==="secure"?a.secure=!0:u==="httponly"?a.httpOnly=!0:u==="samesite"?a.sameSite=l:u==="partitioned"?a.partitioned=!0:a[u]=l}),a}function oy(t){var e="",r="",n=t.split("=");return n.length>1?(e=n.shift(),r=n.join("=")):r=t,{name:e,value:r}}function cp(t,e){if(e=e?Object.assign({},Jn,e):Jn,!t)return e.map?{}:[];if(t.headers)if(typeof t.headers.getSetCookie=="function")t=t.headers.getSetCookie();else if(t.headers["set-cookie"])t=t.headers["set-cookie"];else{var r=t.headers[Object.keys(t.headers).find(function(o){return o.toLowerCase()==="set-cookie"})];!r&&t.headers.cookie&&!e.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),t=r}if(Array.isArray(t)||(t=[t]),e.map){var n={};return t.filter(As).reduce(function(o,s){var i=vs(s,e);return o[i.name]=i,o},n)}else return t.filter(As).map(function(o){return vs(o,e)})}function sy(t){if(Array.isArray(t))return t;if(typeof t!="string")return[];var e=[],r=0,n,o,s,i,a;function c(){for(;r<t.length&&/\s/.test(t.charAt(r));)r+=1;return r<t.length}function p(){return o=t.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<t.length;){for(n=r,a=!1;c();)if(o=t.charAt(r),o===","){for(s=r,r+=1,c(),i=r;r<t.length&&p();)r+=1;r<t.length&&t.charAt(r)==="="?(a=!0,r=i,e.push(t.substring(n,s)),n=r):r=s+1}else r+=1;(!a||r>=t.length)&&e.push(t.substring(n,t.length))}return e}tn.exports=cp;tn.exports.parse=cp;tn.exports.parseString=vs;tn.exports.splitCookiesString=sy});var yc=Pt(ko(),1);import*as Uo from"node:process";try{let t=ii?.node;typeof t=="string"&&!yc.satisfies(Uo.version,t)&&y.warn(`
10
+ `),s=s.replace(/\\r/g,"\r")),e[o]=s}return e}function wh(t){let e=Ec(t),r=Ce.configDotenv({path:e});if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let n=wc(t).split(","),o=n.length,s;for(let i=0;i<o;i++)try{let a=n[i].trim(),c=Ah(r,a);s=Ce.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=o)throw a}return Ce.parse(s)}function Eh(t){console.log(`[dotenv@${zo}][INFO] ${t}`)}function Oh(t){console.log(`[dotenv@${zo}][WARN] ${t}`)}function Tn(t){console.log(`[dotenv@${zo}][DEBUG] ${t}`)}function wc(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Ah(t,e){let r;try{r=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let o=r.searchParams.get("environment");if(!o){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${o.toUpperCase()}`,i=t.parsed[s];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:n}}function Ec(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)qo.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=Wo.resolve(process.cwd(),".env.vault");return qo.existsSync(e)?e:null}function Sc(t){return t[0]==="~"?Wo.join(hh.homedir(),t.slice(1)):t}function Ch(t){Eh("Loading env from encrypted .env.vault");let e=Ce._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),Ce.populate(r,e,t),{parsed:e}}function xh(t){let e=Wo.resolve(process.cwd(),".env"),r="utf8",n=!!(t&&t.debug);t&&t.encoding?r=t.encoding:n&&Tn("No encoding is specified. UTF-8 is used by default");let o=[e];if(t&&t.path)if(!Array.isArray(t.path))o=[Sc(t.path)];else{o=[];for(let c of t.path)o.push(Sc(c))}let s,i={};for(let c of o)try{let p=Ce.parse(qo.readFileSync(c,{encoding:r}));Ce.populate(i,p,t)}catch(p){n&&Tn(`Failed to load ${c} ${p.message}`),s=p}let a=process.env;return t&&t.processEnv!=null&&(a=t.processEnv),Ce.populate(a,i,t),s?{parsed:i,error:s}:{parsed:i}}function vh(t){if(wc(t).length===0)return Ce.configDotenv(t);let e=Ec(t);return e?Ce._configVault(t):(Oh(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),Ce.configDotenv(t))}function Ph(t,e){let r=Buffer.from(e.slice(-64),"hex"),n=Buffer.from(t,"base64"),o=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let i=gh.createDecipheriv("aes-256-gcm",r,o);return i.setAuthTag(s),`${i.update(n)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",p=i.message==="Unsupported state or unable to authenticate data";if(a||c){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(p){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw i}}function Rh(t,e,r={}){let n=!!(r&&r.debug),o=!!(r&&r.override);if(typeof e!="object"){let s=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw s.code="OBJECT_REQUIRED",s}for(let s of Object.keys(e))Object.prototype.hasOwnProperty.call(t,s)?(o===!0&&(t[s]=e[s]),n&&Tn(o===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):t[s]=e[s]}var Ce={configDotenv:xh,_configVault:Ch,_parseVault:wh,config:vh,decrypt:Ph,parse:Sh,populate:Rh};At.exports.configDotenv=Ce.configDotenv;At.exports._configVault=Ce._configVault;At.exports._parseVault=Ce._parseVault;At.exports.config=Ce.config;At.exports.decrypt=Ce.decrypt;At.exports.parse=Ce.parse;At.exports.populate=Ce.populate;At.exports=Ce});var sp=B(Cs=>{"use strict";Cs.parse=Qg;Cs.serialize=ey;var Hg=Object.prototype.toString,Yg=Object.prototype.hasOwnProperty,Kg=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Jg=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,Xg=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,Zg=/^[\u0020-\u003A\u003D-\u007E]*$/;function Qg(t,e){if(typeof t!="string")throw new TypeError("argument str must be a string");var r={},n=t.length;if(n<2)return r;var o=e&&e.decode||ty,s=0,i=0,a=0;do{if(i=t.indexOf("=",s),i===-1)break;if(a=t.indexOf(";",s),a===-1)a=n;else if(i>a){s=t.lastIndexOf(";",i-1)+1;continue}var c=np(t,s,i),p=op(t,i,c),u=t.slice(c,p);if(!Yg.call(r,u)){var l=np(t,i+1,a),d=op(t,a,l);t.charCodeAt(l)===34&&t.charCodeAt(d-1)===34&&(l++,d--);var m=t.slice(l,d);r[u]=ny(m,o)}s=a+1}while(s<n);return r}function np(t,e,r){do{var n=t.charCodeAt(e);if(n!==32&&n!==9)return e}while(++e<r);return r}function op(t,e,r){for(;e>r;){var n=t.charCodeAt(--e);if(n!==32&&n!==9)return e+1}return r}function ey(t,e,r){var n=r&&r.encode||encodeURIComponent;if(typeof n!="function")throw new TypeError("option encode is invalid");if(!Kg.test(t))throw new TypeError("argument name is invalid");var o=n(e);if(!Jg.test(o))throw new TypeError("argument val is invalid");var s=t+"="+o;if(!r)return s;if(r.maxAge!=null){var i=Math.floor(r.maxAge);if(!isFinite(i))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+i}if(r.domain){if(!Xg.test(r.domain))throw new TypeError("option domain is invalid");s+="; Domain="+r.domain}if(r.path){if(!Zg.test(r.path))throw new TypeError("option path is invalid");s+="; Path="+r.path}if(r.expires){var a=r.expires;if(!ry(a)||isNaN(a.valueOf()))throw new TypeError("option expires is invalid");s+="; Expires="+a.toUTCString()}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.partitioned&&(s+="; Partitioned"),r.priority){var c=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(c){case"low":s+="; Priority=Low";break;case"medium":s+="; Priority=Medium";break;case"high":s+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var p=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(p){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s}function ty(t){return t.indexOf("%")!==-1?decodeURIComponent(t):t}function ry(t){return Hg.call(t)==="[object Date]"}function ny(t,e){try{return e(t)}catch{return t}}});var lp=B((tC,tn)=>{"use strict";var Jn={decodeValues:!0,map:!1,silent:!1};function xs(t){return typeof t=="string"&&!!t.trim()}function vs(t,e){var r=t.split(";").filter(xs),n=r.shift(),o=oy(n),s=o.name,i=o.value;e=e?Object.assign({},Jn,e):Jn;try{i=e.decodeValues?decodeURIComponent(i):i}catch(c){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+i+"'. Set options.decodeValues to false to disable this feature.",c)}var a={name:s,value:i};return r.forEach(function(c){var p=c.split("="),u=p.shift().trimLeft().toLowerCase(),l=p.join("=");u==="expires"?a.expires=new Date(l):u==="max-age"?a.maxAge=parseInt(l,10):u==="secure"?a.secure=!0:u==="httponly"?a.httpOnly=!0:u==="samesite"?a.sameSite=l:u==="partitioned"?a.partitioned=!0:a[u]=l}),a}function oy(t){var e="",r="",n=t.split("=");return n.length>1?(e=n.shift(),r=n.join("=")):r=t,{name:e,value:r}}function cp(t,e){if(e=e?Object.assign({},Jn,e):Jn,!t)return e.map?{}:[];if(t.headers)if(typeof t.headers.getSetCookie=="function")t=t.headers.getSetCookie();else if(t.headers["set-cookie"])t=t.headers["set-cookie"];else{var r=t.headers[Object.keys(t.headers).find(function(o){return o.toLowerCase()==="set-cookie"})];!r&&t.headers.cookie&&!e.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),t=r}if(Array.isArray(t)||(t=[t]),e.map){var n={};return t.filter(xs).reduce(function(o,s){var i=vs(s,e);return o[i.name]=i,o},n)}else return t.filter(xs).map(function(o){return vs(o,e)})}function sy(t){if(Array.isArray(t))return t;if(typeof t!="string")return[];var e=[],r=0,n,o,s,i,a;function c(){for(;r<t.length&&/\s/.test(t.charAt(r));)r+=1;return r<t.length}function p(){return o=t.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<t.length;){for(n=r,a=!1;c();)if(o=t.charAt(r),o===","){for(s=r,r+=1,c(),i=r;r<t.length&&p();)r+=1;r<t.length&&t.charAt(r)==="="?(a=!0,r=i,e.push(t.substring(n,s)),n=r):r=s+1}else r+=1;(!a||r>=t.length)&&e.push(t.substring(n,t.length))}return e}tn.exports=cp;tn.exports.parse=cp;tn.exports.parseString=vs;tn.exports.splitCookiesString=sy});var yc=Pt(ko(),1);import*as Uo from"node:process";try{let t=ii?.node;typeof t=="string"&&!yc.satisfies(Uo.version,t)&&y.warn(`
11
11
  \u26A0\uFE0F Warning: failed to satisfy expected node version. Expected: "${t}", Current "${Uo.version}"
12
12
 
13
13
  `)}catch{}var of=Pt(Vo(),1);import*as sf from"node:path";import{notStrictEqual as Zh,strictEqual as Qh}from"assert";var $h={right:Dh,center:Nh},Ih=0,jn=1,_h=2,Dn=3,Bo=class{constructor(e){var r;this.width=e.width,this.wrap=(r=e.wrap)!==null&&r!==void 0?r:!0,this.rows=[]}span(...e){let r=this.div(...e);r.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let r=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(r),r}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let r=e.split(`
14
14
  `).map(o=>o.split(" ")),n=0;return r.forEach(o=>{o.length>1&&Ye.stringWidth(o[0])>n&&(n=Math.min(Math.floor(this.width*.5),Ye.stringWidth(o[0])))}),r.forEach(o=>{this.div(...o.map((s,i)=>({text:s.trim(),padding:this.measurePadding(s),width:i===0&&o.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let r=Ye.stripAnsi(e);return[0,r.match(/\s*$/)[0].length,0,r.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(r=>{this.rowToString(r,e)}),e.filter(r=>!r.hidden).map(r=>r.text).join(`
15
15
  `)}rowToString(e,r){return this.rasterize(e).forEach((n,o)=>{let s="";n.forEach((i,a)=>{let{width:c}=e[a],p=this.negatePadding(e[a]),u=i;if(p>Ye.stringWidth(i)&&(u+=" ".repeat(p-Ye.stringWidth(i))),e[a].align&&e[a].align!=="left"&&this.wrap){let d=$h[e[a].align];u=d(u,p),Ye.stringWidth(u)<p&&(u+=" ".repeat((c||0)-Ye.stringWidth(u)-1))}let l=e[a].padding||[0,0,0,0];l[Dn]&&(s+=" ".repeat(l[Dn])),s+=Oc(e[a],u,"| "),s+=u,s+=Oc(e[a],u," |"),l[jn]&&(s+=" ".repeat(l[jn])),o===0&&r.length>0&&(s=this.renderInline(s,r[r.length-1]))}),r.push({text:s.replace(/ +$/,""),span:e.span})}),r}renderInline(e,r){let n=e.match(/^ */),o=n?n[0].length:0,s=r.text,i=Ye.stringWidth(s.trimRight());return r.span?this.wrap?o<i?e:(r.hidden=!0,s.trimRight()+" ".repeat(o-i)+e.trimLeft()):(r.hidden=!0,s+e):e}rasterize(e){let r=[],n=this.columnWidths(e),o;return e.forEach((s,i)=>{s.width=n[i],this.wrap?o=Ye.wrap(s.text,this.negatePadding(s),{hard:!0}).split(`
16
16
  `):o=s.text.split(`
17
- `),s.border&&(o.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(o.unshift(...new Array(s.padding[Ih]||0).fill("")),o.push(...new Array(s.padding[_h]||0).fill(""))),o.forEach((a,c)=>{r[c]||r.push([]);let p=r[c];for(let u=0;u<i;u++)p[u]===void 0&&p.push("");p.push(a)})}),r}negatePadding(e){let r=e.width||0;return e.padding&&(r-=(e.padding[Dn]||0)+(e.padding[jn]||0)),e.border&&(r-=4),r}columnWidths(e){if(!this.wrap)return e.map(i=>i.width||Ye.stringWidth(i.text));let r=e.length,n=this.width,o=e.map(i=>{if(i.width)return r--,n-=i.width,i.width}),s=r?Math.floor(n/r):0;return o.map((i,a)=>i===void 0?Math.max(s,Th(e[a])):i)}};function Oc(t,e,r){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?r:" ":""}function Th(t){let e=t.padding||[],r=1+(e[Dn]||0)+(e[jn]||0);return t.border?r+4:r}function jh(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Dh(t,e){t=t.trim();let r=Ye.stringWidth(t);return r<e?" ".repeat(e-r)+t:t}function Nh(t,e){t=t.trim();let r=Ye.stringWidth(t);return r>=e?t:" ".repeat(e-r>>1)+t}var Ye;function Cc(t,e){return Ye=e,new Bo({width:t?.width||jh(),wrap:t?.wrap})}var xc=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Go(t){return t.replace(xc,"")}function Ac(t,e){let[r,n]=t.match(xc)||["",""];t=Go(t);let o="";for(let s=0;s<t.length;s++)s!==0&&s%e===0&&(o+=`
18
- `),o+=t.charAt(s);return r&&n&&(o=`${r}${o}${n}`),o}function Ho(t){return Cc(t,{stringWidth:e=>[...e].length,stripAnsi:Go,wrap:Ac})}import{dirname as vc,resolve as Pc}from"path";import{readdirSync as Lh,statSync as Mh}from"fs";function Rc(t,e){let r=Pc(".",t),n;for(Mh(r).isDirectory()||(r=vc(r));;){if(n=e(r,Lh(r)),n)return Pc(r,n);if(r=vc(n=r),n===r)break}}import{inspect as eg}from"util";import{readFileSync as tg}from"fs";import{fileURLToPath as Uc}from"url";import{format as kh}from"util";import{readFileSync as Uh}from"fs";import{normalize as qh,resolve as Wh}from"path";function zt(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let r="",n=!1,o=t.match(/^-+/);for(let s=o?o[0].length:0;s<t.length;s++){let i=t.charAt(s);n&&(n=!1,i=i.toUpperCase()),s!==0&&(i==="-"||i==="_")?n=!0:i!=="-"&&i!=="_"&&(r+=i)}return r}}function Nn(t,e){let r=t.toLowerCase();e=e||"-";let n="";for(let o=0;o<t.length;o++){let s=r.charAt(o),i=t.charAt(o);s!==i&&o>0?n+=`${e}${r.charAt(o)}`:n+=i}return n}function Ln(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function $c(t){if(Array.isArray(t))return t.map(i=>typeof i!="string"?i+"":i);t=t.trim();let e=0,r=null,n=null,o=null,s=[];for(let i=0;i<t.length;i++){if(r=n,n=t.charAt(i),n===" "&&!o){r!==" "&&e++;continue}n===o?o=null:(n==="'"||n==='"')&&!o&&(o=n),s[e]||(s[e]=""),s[e]+=n}return s}var st;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(st||(st={}));var xt,Mn=class{constructor(e){xt=e}parse(e,r){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},r),o=$c(e),s=Fh(Object.assign(Object.create(null),n.alias)),i=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),c=n.configObjects||[],p=n.envPrefix,u=i["populate--"],l=u?"--":"_",d=Object.create(null),m=Object.create(null),w=n.__||xt.format,h={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},x=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,P=new RegExp("^--"+i["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(g){let b=typeof g=="object"?g.key:g,R=Object.keys(g).map(function(O){return{boolean:"bools",string:"strings",number:"numbers"}[O]}).filter(Boolean).pop();R&&(h[R][b]=!0),h.arrays[b]=!0,h.keys.push(b)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(g){h.bools[g]=!0,h.keys.push(g)}),[].concat(n.string||[]).filter(Boolean).forEach(function(g){h.strings[g]=!0,h.keys.push(g)}),[].concat(n.number||[]).filter(Boolean).forEach(function(g){h.numbers[g]=!0,h.keys.push(g)}),[].concat(n.count||[]).filter(Boolean).forEach(function(g){h.counts[g]=!0,h.keys.push(g)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(g){h.normalize[g]=!0,h.keys.push(g)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([g,b])=>{typeof b=="number"&&(h.nargs[g]=b,h.keys.push(g))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([g,b])=>{typeof b=="function"&&(h.coercions[g]=b,h.keys.push(g))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(g){h.configs[g]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([g,b])=>{(typeof b=="boolean"||typeof b=="function")&&(h.configs[g]=b)})),Ze(n.key,s,n.default,h.arrays),Object.keys(a).forEach(function(g){(h.aliases[g]||[]).forEach(function(b){a[b]=a[g]})});let C=null;fo();let A=[],E=Object.assign(Object.create(null),{_:[]}),$={};for(let g=0;g<o.length;g++){let b=o[g],R=b.replace(/^-{3,}/,"---"),O,S,D,N,G,ve;if(b!=="--"&&ae(b))_(b);else if(R.match(/---+(=|$)/)){_(b);continue}else if(b.match(/^--.+=/)||!i["short-option-groups"]&&b.match(/^-.+=/))N=b.match(/^--?([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&(z(N[1],h.arrays)?g=ie(g,N[1],o,N[2]):z(N[1],h.nargs)!==!1?g=J(g,N[1],o,N[2]):V(N[1],N[2]));else if(b.match(P)&&i["boolean-negation"])N=b.match(P),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],V(S,z(S,h.arrays)?[!1]:!1));else if(b.match(/^--.+/)||!i["short-option-groups"]&&b.match(/^-[^-]+/))N=b.match(/^--?(.+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],z(S,h.arrays)?g=ie(g,S,o):z(S,h.nargs)!==!1?g=J(g,S,o):(G=o[g+1],G!==void 0&&(!G.match(/^-/)||G.match(x))&&!z(S,h.bools)&&!z(S,h.counts)||/^(true|false)$/.test(G)?(V(S,G),g++):V(S,se(S))));else if(b.match(/^-.\..+=/))N=b.match(/^-([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&V(N[1],N[2]);else if(b.match(/^-.\..+/)&&!b.match(x))G=o[g+1],N=b.match(/^-(.\..+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],G!==void 0&&!G.match(/^-/)&&!z(S,h.bools)&&!z(S,h.counts)?(V(S,G),g++):V(S,se(S)));else if(b.match(/^-[^-]+/)&&!b.match(x)){D=b.slice(1,-1).split(""),O=!1;for(let Le=0;Le<D.length;Le++){if(G=b.slice(Le+2),D[Le+1]&&D[Le+1]==="="){ve=b.slice(Le+3),S=D[Le],z(S,h.arrays)?g=ie(g,S,o,ve):z(S,h.nargs)!==!1?g=J(g,S,o,ve):V(S,ve),O=!0;break}if(G==="-"){V(D[Le],G);continue}if(/[A-Za-z]/.test(D[Le])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(G)&&z(G,h.bools)===!1){V(D[Le],G),O=!0;break}if(D[Le+1]&&D[Le+1].match(/\W/)){V(D[Le],G),O=!0;break}else V(D[Le],se(D[Le]))}S=b.slice(-1)[0],!O&&S!=="-"&&(z(S,h.arrays)?g=ie(g,S,o):z(S,h.nargs)!==!1?g=J(g,S,o):(G=o[g+1],G!==void 0&&(!/^(-|--)[^-]/.test(G)||G.match(x))&&!z(S,h.bools)&&!z(S,h.counts)||/^(true|false)$/.test(G)?(V(S,G),g++):V(S,se(S))))}else if(b.match(/^-[0-9]$/)&&b.match(x)&&z(b.slice(1),h.bools))S=b.slice(1),V(S,se(S));else if(b==="--"){A=o.slice(g+1);break}else if(i["halt-at-non-option"]){A=o.slice(g);break}else _(b)}te(E,!0),te(E,!1),M(E),ne(),$e(E,h.aliases,a,!0),Y(E),i["set-placeholder-key"]&&ce(E),Object.keys(h.counts).forEach(function(g){le(E,g.split("."))||V(g,0)}),u&&A.length&&(E[l]=[]),A.forEach(function(g){E[l].push(g)}),i["camel-case-expansion"]&&i["strip-dashed"]&&Object.keys(E).filter(g=>g!=="--"&&g.includes("-")).forEach(g=>{delete E[g]}),i["strip-aliased"]&&[].concat(...Object.keys(s).map(g=>s[g])).forEach(g=>{i["camel-case-expansion"]&&g.includes("-")&&delete E[g.split(".").map(b=>zt(b)).join(".")],delete E[g]});function _(g){let b=v("_",g);(typeof b=="string"||typeof b=="number")&&E._.push(b)}function J(g,b,R,O){let S,D=z(b,h.nargs);if(D=typeof D!="number"||isNaN(D)?1:D,D===0)return Oe(O)||(C=Error(w("Argument unexpected for: %s",b))),V(b,se(b)),g;let N=Oe(O)?0:1;if(i["nargs-eats-options"])R.length-(g+1)+N<D&&(C=Error(w("Not enough arguments following: %s",b))),N=D;else{for(S=g+1;S<R.length&&(!R[S].match(/^-[^0-9]/)||R[S].match(x)||ae(R[S]));S++)N++;N<D&&(C=Error(w("Not enough arguments following: %s",b)))}let G=Math.min(N,D);for(!Oe(O)&&G>0&&(V(b,O),G--),S=g+1;S<G+g+1;S++)V(b,R[S]);return g+G}function ie(g,b,R,O){let S=[],D=O||R[g+1],N=z(b,h.nargs);if(z(b,h.bools)&&!/^(true|false)$/.test(D))S.push(!0);else if(Oe(D)||Oe(O)&&/^-/.test(D)&&!x.test(D)&&!ae(D)){if(a[b]!==void 0){let G=a[b];S=Array.isArray(G)?G:[G]}}else{Oe(O)||S.push(I(b,O));for(let G=g+1;G<R.length&&!(!i["greedy-arrays"]&&S.length>0||N&&typeof N=="number"&&S.length>=N||(D=R[G],/^-/.test(D)&&!x.test(D)&&!ae(D)));G++)g=G,S.push(I(b,D))}return typeof N=="number"&&(N&&S.length<N||isNaN(N)&&S.length===0)&&(C=Error(w("Not enough arguments following: %s",b))),V(b,S),g}function V(g,b){if(/-/.test(g)&&i["camel-case-expansion"]){let S=g.split(".").map(function(D){return zt(D)}).join(".");De(g,S)}let R=I(g,b),O=g.split(".");Ge(E,O,R),h.aliases[g]&&h.aliases[g].forEach(function(S){let D=S.split(".");Ge(E,D,R)}),O.length>1&&i["dot-notation"]&&(h.aliases[O[0]]||[]).forEach(function(S){let D=S.split("."),N=[].concat(O);N.shift(),D=D.concat(N),(h.aliases[g]||[]).includes(D.join("."))||Ge(E,D,R)}),z(g,h.normalize)&&!z(g,h.arrays)&&[g].concat(h.aliases[g]||[]).forEach(function(D){Object.defineProperty($,D,{enumerable:!0,get(){return b},set(N){b=typeof N=="string"?xt.normalize(N):N}})})}function De(g,b){h.aliases[g]&&h.aliases[g].length||(h.aliases[g]=[b],d[b]=!0),h.aliases[b]&&h.aliases[b].length||De(b,g)}function I(g,b){typeof b=="string"&&(b[0]==="'"||b[0]==='"')&&b[b.length-1]===b[0]&&(b=b.substring(1,b.length-1)),(z(g,h.bools)||z(g,h.counts))&&typeof b=="string"&&(b=b==="true");let R=Array.isArray(b)?b.map(function(O){return v(g,O)}):v(g,b);return z(g,h.counts)&&(Oe(R)||typeof R=="boolean")&&(R=Yo()),z(g,h.normalize)&&z(g,h.arrays)&&(Array.isArray(b)?R=b.map(O=>xt.normalize(O)):R=xt.normalize(b)),R}function v(g,b){return!i["parse-positional-numbers"]&&g==="_"||!z(g,h.strings)&&!z(g,h.bools)&&!Array.isArray(b)&&(Ln(b)&&i["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${b}`)))||!Oe(b)&&z(g,h.numbers))&&(b=Number(b)),b}function M(g){let b=Object.create(null);$e(b,h.aliases,a),Object.keys(h.configs).forEach(function(R){let O=g[R]||b[R];if(O)try{let S=null,D=xt.resolve(xt.cwd(),O),N=h.configs[R];if(typeof N=="function"){try{S=N(D)}catch(G){S=G}if(S instanceof Error){C=S;return}}else S=xt.require(D);U(S)}catch(S){S.name==="PermissionDenied"?C=S:g[R]&&(C=Error(w("Invalid JSON config file: %s",O)))}})}function U(g,b){Object.keys(g).forEach(function(R){let O=g[R],S=b?b+"."+R:R;typeof O=="object"&&O!==null&&!Array.isArray(O)&&i["dot-notation"]?U(O,S):(!le(E,S.split("."))||z(S,h.arrays)&&i["combine-arrays"])&&V(S,O)})}function ne(){typeof c<"u"&&c.forEach(function(g){U(g)})}function te(g,b){if(typeof p>"u")return;let R=typeof p=="string"?p:"",O=xt.env();Object.keys(O).forEach(function(S){if(R===""||S.lastIndexOf(R,0)===0){let D=S.split("__").map(function(N,G){return G===0&&(N=N.substring(R.length)),zt(N)});(b&&h.configs[D.join(".")]||!b)&&!le(g,D)&&V(D.join("."),O[S])}})}function Y(g){let b,R=new Set;Object.keys(g).forEach(function(O){if(!R.has(O)&&(b=z(O,h.coercions),typeof b=="function"))try{let S=v(O,b(g[O]));[].concat(h.aliases[O]||[],O).forEach(D=>{R.add(D),g[D]=S})}catch(S){C=S}})}function ce(g){return h.keys.forEach(b=>{~b.indexOf(".")||typeof g[b]>"u"&&(g[b]=void 0)}),g}function $e(g,b,R,O=!1){Object.keys(R).forEach(function(S){le(g,S.split("."))||(Ge(g,S.split("."),R[S]),O&&(m[S]=!0),(b[S]||[]).forEach(function(D){le(g,D.split("."))||Ge(g,D.split("."),R[S])}))})}function le(g,b){let R=g;i["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(S){R=R[S]||{}});let O=b[b.length-1];return typeof R!="object"?!1:O in R}function Ge(g,b,R){let O=g;i["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(ve){ve=Ic(ve),typeof O=="object"&&O[ve]===void 0&&(O[ve]={}),typeof O[ve]!="object"||Array.isArray(O[ve])?(Array.isArray(O[ve])?O[ve].push({}):O[ve]=[O[ve],{}],O=O[ve][O[ve].length-1]):O=O[ve]});let S=Ic(b[b.length-1]),D=z(b.join("."),h.arrays),N=Array.isArray(R),G=i["duplicate-arguments-array"];!G&&z(S,h.nargs)&&(G=!0,(!Oe(O[S])&&h.nargs[S]===1||Array.isArray(O[S])&&O[S].length===h.nargs[S])&&(O[S]=void 0)),R===Yo()?O[S]=Yo(O[S]):Array.isArray(O[S])?G&&D&&N?O[S]=i["flatten-duplicate-arrays"]?O[S].concat(R):(Array.isArray(O[S][0])?O[S]:[O[S]]).concat([R]):!G&&!!D==!!N?O[S]=R:O[S]=O[S].concat([R]):O[S]===void 0&&D?O[S]=N?R:[R]:G&&!(O[S]===void 0||z(S,h.counts)||z(S,h.bools))?O[S]=[O[S],R]:O[S]=R}function Ze(...g){g.forEach(function(b){Object.keys(b||{}).forEach(function(R){h.aliases[R]||(h.aliases[R]=[].concat(s[R]||[]),h.aliases[R].concat(R).forEach(function(O){if(/-/.test(O)&&i["camel-case-expansion"]){let S=zt(O);S!==R&&h.aliases[R].indexOf(S)===-1&&(h.aliases[R].push(S),d[S]=!0)}}),h.aliases[R].concat(R).forEach(function(O){if(O.length>1&&/[A-Z]/.test(O)&&i["camel-case-expansion"]){let S=Nn(O,"-");S!==R&&h.aliases[R].indexOf(S)===-1&&(h.aliases[R].push(S),d[S]=!0)}}),h.aliases[R].forEach(function(O){h.aliases[O]=[R].concat(h.aliases[R].filter(function(S){return O!==S}))}))})})}function z(g,b){let R=[].concat(h.aliases[g]||[],g),O=Object.keys(b),S=R.find(D=>O.includes(D));return S?b[S]:!1}function Ae(g){let b=Object.keys(h);return[].concat(b.map(O=>h[O])).some(function(O){return Array.isArray(O)?O.includes(g):O[g]})}function Qe(g,...b){return[].concat(...b).some(function(O){let S=g.match(O);return S&&Ae(S[1])})}function k(g){if(g.match(x)||!g.match(/^-[^-]+/))return!1;let b=!0,R,O=g.slice(1).split("");for(let S=0;S<O.length;S++){if(R=g.slice(S+2),!Ae(O[S])){b=!1;break}if(O[S+1]&&O[S+1]==="="||R==="-"||/[A-Za-z]/.test(O[S])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(R)||O[S+1]&&O[S+1].match(/\W/))break}return b}function ae(g){return i["unknown-options-as-args"]&&oe(g)}function oe(g){return g=g.replace(/^-{3,}/,"--"),g.match(x)||k(g)?!1:!Qe(g,/^-+([^=]+?)=[\s\S]*$/,P,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function se(g){return!z(g,h.bools)&&!z(g,h.counts)&&`${g}`in a?a[g]:Ee(qe(g))}function Ee(g){return{[st.BOOLEAN]:!0,[st.STRING]:"",[st.NUMBER]:void 0,[st.ARRAY]:[]}[g]}function qe(g){let b=st.BOOLEAN;return z(g,h.strings)?b=st.STRING:z(g,h.numbers)?b=st.NUMBER:z(g,h.bools)?b=st.BOOLEAN:z(g,h.arrays)&&(b=st.ARRAY),b}function Oe(g){return g===void 0}function fo(){Object.keys(h.counts).find(g=>z(g,h.arrays)?(C=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",g)),!0):z(g,h.nargs)?(C=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",g)),!0):!1)}return{aliases:Object.assign({},h.aliases),argv:Object.assign($,E),configuration:i,defaulted:Object.assign({},m),error:C,newAliases:Object.assign({},d)}}};function Fh(t){let e=[],r=Object.create(null),n=!0;for(Object.keys(t).forEach(function(o){e.push([].concat(t[o],o))});n;){n=!1;for(let o=0;o<e.length;o++)for(let s=o+1;s<e.length;s++)if(e[o].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[o]=e[o].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(o){o=o.filter(function(i,a,c){return c.indexOf(i)===a});let s=o.pop();s!==void 0&&typeof s=="string"&&(r[s]=o)}),r}function Yo(t){return t!==void 0?t+1:1}function Ic(t){return t==="__proto__"?"___proto___":t}var _c=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):10;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<_c)throw Error(`yargs parser supports a minimum Node.js version of ${_c}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var zh=process?process.env:{},Tc=new Mn({cwd:process.cwd,env:()=>zh,format:kh,normalize:qh,resolve:Wh,require:t=>{if(typeof We<"u")return We(t);if(t.match(/\.json$/))return Uh(t,"utf8");throw Error("only .json config files are supported in ESM")}}),Gr=function(e,r){return Tc.parse(e.slice(),r).argv};Gr.detailed=function(t,e){return Tc.parse(t.slice(),e)};Gr.camelCase=zt;Gr.decamelize=Nn;Gr.looksLikeNumber=Ln;var Ko=Gr;import{basename as rg,dirname as ng,extname as og,relative as sg,resolve as Fc}from"path";function jc(){return Vh()?0:1}function Vh(){return Bh()&&!process.defaultApp}function Bh(){return!!process.versions.electron}function Jo(t){return t.slice(jc()+1)}function Dc(){return process.argv[jc()]}var me=class t extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace(this,t)}};import{readFileSync as Gh,statSync as Hh,writeFile as Yh}from"fs";import{format as Kh}from"util";import{resolve as Jh}from"path";var Nc={fs:{readFileSync:Gh,writeFile:Yh},format:Kh,resolve:Jh,exists:t=>{try{return Hh(t).isFile()}catch{return!1}}};var dt,Xo=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),dt.format.apply(dt.format,[this.cache[this.locale][r]||r].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),r=e.shift(),n=e.shift(),o=e.shift(),s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let i=o===1?r:n;this.cache[this.locale][r]&&(i=this.cache[this.locale][r][o===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s();let a=[i];return~i.indexOf("%d")&&a.push(o),dt.format.apply(dt.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.cache[this.locale][r]=e[r])}_taggedLiteral(e,...r){let n="";return e.forEach(function(o,s){let i=r[s+1];n+=o,typeof i<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,r=this.writeQueue[0],n=r.directory,o=r.locale,s=r.cb,i=this._resolveLocaleFile(n,o),a=JSON.stringify(this.cache[o],null,2);dt.fs.writeFile(i,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(c)})}_readLocaleFile(){let e={},r=this._resolveLocaleFile(this.directory,this.locale);try{dt.fs.readFileSync&&(e=JSON.parse(dt.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,r){let n=dt.resolve(e,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){let o=dt.resolve(e,"./",r.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return dt.exists(e)}};function Lc(t,e){dt=e;let r=new Xo(t);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var Xh=t=>Lc(t,Nc),Mc=Xh;var ig="require is not supported by ESM",kc="loading a directory of commands is not supported yet for ESM",ag=Uc(import.meta.url).split("node_modules")[0],cg=Uc(import.meta.url),Zo={assert:{notStrictEqual:Zh,strictEqual:Qh},cliui:Ho,findUp:Rc,getEnv:t=>process.env[t],inspect:eg,getCallerFile:()=>{throw new me(kc)},getProcessArgvBin:Dc,mainFilename:ag||process.cwd(),Parser:Ko,path:{basename:rg,dirname:ng,extname:og,relative:sg,resolve:Fc},process:{argv:()=>process.argv,cwd:process.cwd,execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:tg,require:()=>{throw new me(ig)},requireDirectory:()=>{throw new me(kc)},stringWidth:t=>[...t].length,y18n:Mc({directory:Fc(cg,"../../../locales"),updateFiles:!1})};function Ue(t,e,r,n){r.assert.notStrictEqual(t,e,n)}function Qo(t,e){e.assert.strictEqual(typeof t,"string")}function hr(t){return Object.keys(t)}function he(t){return!!t&&!!t.then&&typeof t.then=="function"}function It(t){let r=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,o=r.shift();if(!o)throw new Error(`No command found in: ${t}`);let s={cmd:o.replace(n,""),demanded:[],optional:[]};return r.forEach((i,a)=>{let c=!1;i=i.replace(/\s/g,""),/\.+[\]>]/.test(i)&&a===r.length-1&&(c=!0),/^\[/.test(i)?s.optional.push({cmd:i.replace(n,"").split("|"),variadic:c}):s.demanded.push({cmd:i.replace(n,"").split("|"),variadic:c})}),s}var lg=["first","second","third","fourth","fifth","sixth"];function L(t,e,r){function n(){return typeof t=="object"?[{demanded:[],optional:[]},t,e]:[It(`cmd ${t}`),e,r]}try{let o=0,[s,i,a]=n(),c=[].slice.call(i);for(;c.length&&c[c.length-1]===void 0;)c.pop();let p=a||c.length;if(p<s.demanded.length)throw new me(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);let u=s.demanded.length+s.optional.length;if(p>u)throw new me(`Too many arguments provided. Expected max ${u} but received ${p}.`);s.demanded.forEach(l=>{let d=c.shift(),m=qc(d);l.cmd.filter(h=>h===m||h==="*").length===0&&Wc(m,l.cmd,o),o+=1}),s.optional.forEach(l=>{if(c.length===0)return;let d=c.shift(),m=qc(d);l.cmd.filter(h=>h===m||h==="*").length===0&&Wc(m,l.cmd,o),o+=1})}catch(o){console.warn(o.stack)}}function qc(t){return Array.isArray(t)?"array":t===null?"null":typeof t}function Wc(t,e,r){throw new me(`Invalid ${lg[r]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}var Fn=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,r,n=!0){if(L("<array|function> [boolean] [boolean]",[e,r,n],arguments.length),Array.isArray(e)){for(let o=0;o<e.length;o++){if(typeof e[o]!="function")throw Error("middleware must be a function");let s=e[o];s.applyBeforeValidation=r,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let o=e;o.applyBeforeValidation=r,o.global=n,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,r){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{let s=[...n[r]||[],r];return o.option?!s.includes(o.option):!0}),e.option=r,this.addMiddleware(e,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function zc(t){return t?t.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Vt(t,e,r,n){return r.reduce((o,s)=>{if(s.applyBeforeValidation!==n)return o;if(he(o))return o.then(i=>Promise.all([i,s(i,e)])).then(([i,a])=>Object.assign(i,a));{let i=s(o,e);return he(i)?i.then(a=>Object.assign(o,a)):Object.assign(o,i)}},t)}function Bt(t,e,r=n=>{throw n}){try{let n=pg(t)?t():t;return he(n)?n.then(o=>e(o)):e(n)}catch(n){return r(n)}}function pg(t){return typeof t=="function"}function es(t){if(typeof We>"u")return null;for(let e=0,r=Object.keys(We.cache),n;e<r.length;e++)if(n=We.cache[r[e]],n.exports===t)return n;return null}var gr=/(^\*)|(^\$0)/,ts=class{constructor(e,r,n,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=e,this.globalMiddleware=n,this.validation=r}addDirectory(e,r,n,o){o=o||{},typeof o.recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);let s=typeof o.visit=="function"?o.visit:i=>i;o.visit=(i,a,c)=>{let p=s(i,a,c);if(p){if(this.requireCache.has(a))return p;this.requireCache.add(a),this.addHandler(p)}return p},this.shim.requireDirectory({require:r,filename:n},e,o)}addHandler(e,r,n,o,s,i){let a=[],c=zc(s);if(o=o||(()=>{}),Array.isArray(e))if(ug(e))[e,...a]=e;else for(let p of e)this.addHandler(p);else if(mg(e)){let p=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(p=[].concat(p).concat(e.aliases)),this.addHandler(p,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Vc(n)){this.addHandler([e].concat(a),r,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let p=It(e);a=a.map(d=>It(d).cmd);let u=!1,l=[p.cmd].concat(a).filter(d=>gr.test(d)?(u=!0,!1):!0);l.length===0&&u&&l.push("$0"),u&&(p.cmd=l[0],a=l.slice(1),e=e.replace(gr,p.cmd)),a.forEach(d=>{this.aliasMap[d]=p.cmd}),r!==!1&&this.usage.command(e,r,u,a,i),this.handlers[p.cmd]={original:e,description:r,handler:o,builder:n||{},middlewares:c,deprecated:i,demanded:p.demanded,optional:p.optional},u&&(this.defaultCommand=this.handlers[p.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,r,n,o,s,i){let a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=r.getInternalMethods().getContext(),p=c.commands.slice(),u=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));let l=this.applyBuilderUpdateUsageAndParse(u,a,r,n.aliases,p,o,s,i);return he(l)?l.then(d=>this.applyMiddlewareAndGetResult(u,a,d.innerArgv,c,s,d.aliases,r)):this.applyMiddlewareAndGetResult(u,a,l.innerArgv,c,s,l.aliases,r)}applyBuilderUpdateUsageAndParse(e,r,n,o,s,i,a,c){let p=r.builder,u=n;if(kn(p)){let l=p(n.getInternalMethods().reset(o),c);if(he(l))return l.then(d=>(u=Gc(d)?d:n,this.parseAndUpdateUsage(e,r,u,s,i,a)))}else fg(p)&&(u=n.getInternalMethods().reset(o),Object.keys(r.builder).forEach(l=>{u.option(l,p[l])}));return this.parseAndUpdateUsage(e,r,u,s,i,a)}parseAndUpdateUsage(e,r,n,o,s,i){e&&n.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,r),r.description);let a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,i);return he(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,r){let n=gr.test(r.original)?r.original.replace(gr,"").trim():r.original,o=e.filter(s=>!gr.test(s));return o.push(n),`$0 ${o.join(" ")}`}applyMiddlewareAndGetResult(e,r,n,o,s,i,a){let c={};if(s)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(r,n,o,a));let p=this.globalMiddleware.getMiddleware().slice(0).concat(r.middlewares);if(n=Vt(n,a,p,!0),!a.getInternalMethods().getHasOutput()){let u=a.getInternalMethods().runValidation(i,c,a.parsed.error,e);n=Bt(n,l=>(u(l),l))}if(r.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let u=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,u,!1,!1),n=Vt(n,a,p,!1),n=Bt(n,l=>{let d=r.handler(l);return he(d)?d.then(()=>l):l}),e||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),he(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(l=>{try{a.getInternalMethods().getUsageInstance().fail(null,l)}catch{}})}return e||(o.commands.pop(),o.fullCommands.pop()),n}populatePositionals(e,r,n,o){r._=r._.slice(n.commands.length);let s=e.demanded.slice(0),i=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,r._.length);s.length;){let c=s.shift();this.populatePositional(c,r,a)}for(;i.length;){let c=i.shift();this.populatePositional(c,r,a)}return r._=n.commands.concat(r._.map(c=>""+c)),this.postProcessPositionals(r,a,this.cmdToParseOptions(e.original),o),a}populatePositional(e,r,n){let o=e.cmd[0];e.variadic?n[o]=r._.splice(0).map(String):r._.length&&(n[o]=[String(r._.shift())])}cmdToParseOptions(e){let r={array:[],default:{},alias:{},demand:{}},n=It(e);return n.demanded.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i,r.demand[s]=!0}),n.optional.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i}),r}postProcessPositionals(e,r,n,o){let s=Object.assign({},o.getOptions());s.default=Object.assign(n.default,s.default);for(let p of Object.keys(n.alias))s.alias[p]=(s.alias[p]||[]).concat(n.alias[p]);s.array=s.array.concat(n.array),s.config={};let i=[];if(Object.keys(r).forEach(p=>{r[p].map(u=>{s.configuration["unknown-options-as-args"]&&(s.key[p]=!0),i.push(`--${p}`),i.push(u)})}),!i.length)return;let a=Object.assign({},s.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(i,Object.assign({},s,{configuration:a}));if(c.error)o.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{let p=Object.keys(r);Object.keys(r).forEach(u=>{p.push(...c.aliases[u])}),Object.keys(c.argv).forEach(u=>{p.indexOf(u)!==-1&&(r[u]||(r[u]=c.argv[u]),e[u]=c.argv[u])})}}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=gr.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let r=this.defaultCommand.builder;if(kn(r))return r(e,!0);Vc(r)||Object.keys(r).forEach(n=>{e.option(n,r[n])})}moduleName(e){let r=es(e);if(!r)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(r.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:r,desc:n}){for(let o of[e,r,n]){if(typeof o=="string"||o===!1)return o;Ue(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();Ue(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Bc(t,e,r,n){return new ts(t,e,r,n)}function Vc(t){return typeof t=="object"&&!!t.builder&&typeof t.handler=="function"}function ug(t){return t.every(e=>typeof e=="string")}function kn(t){return typeof t=="function"}function fg(t){return typeof t=="object"}function mg(t){return typeof t=="object"&&!Array.isArray(t)}function _t(t={},e=()=>!0){let r={};return hr(t).forEach(n=>{e(n,t[n])&&(r[n]=t[n])}),r}function Tt(t){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let r=e;r._handle&&r.isTTY&&typeof r._handle.setBlocking=="function"&&r._handle.setBlocking(t)})}function dg(t){return typeof t=="boolean"}function Yc(t,e){let r=e.y18n.__,n={},o=[];n.failFn=function(v){o.push(v)};let s=null,i=!0;n.showHelpOnFail=function(v=!0,M){function U(){return typeof v=="string"?[!0,v]:[v,M]}let[ne,te]=U();return s=te,i=ne,n};let a=!1;n.fail=function(v,M){let U=t.getInternalMethods().getLoggerInstance();if(o.length)for(let ne=o.length-1;ne>=0;--ne){let te=o[ne];if(dg(te)){if(M)throw M;if(v)throw Error(v)}else te(v,M,n)}else{if(t.getExitProcess()&&Tt(!0),a||(a=!0,i&&(t.showHelp("error"),U.error()),(v||M)&&U.error(v||M),s&&((v||M)&&U.error(""),U.error(s))),M=M||new me(v),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,M);throw M}};let c=[],p=!1;n.usage=(I,v)=>I===null?(p=!0,c=[],n):(p=!1,c.push([I,v||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>r("Positionals:");let u=[];n.example=(I,v)=>{u.push([I,v||""])};let l=[];n.command=function(v,M,U,ne,te=!1){U&&(l=l.map(Y=>(Y[2]=!1,Y))),l.push([v,M||"",U,ne,te])},n.getCommands=()=>l;let d={};n.describe=function(v,M){Array.isArray(v)?v.forEach(U=>{n.describe(U,M)}):typeof v=="object"?Object.keys(v).forEach(U=>{n.describe(U,v[U])}):d[v]=M},n.getDescriptions=()=>d;let m=[];n.epilog=I=>{m.push(I)};let w=!1,h;n.wrap=I=>{w=!0,h=I};function x(){return w||(h=ie(),w=!0),h}let P="__yargsString__:";n.deferY18nLookup=I=>P+I,n.help=function(){if(E)return E;A();let v=t.customScriptName?t.$0:e.path.basename(t.$0),M=t.getDemandedOptions(),U=t.getDemandedCommands(),ne=t.getDeprecatedOptions(),te=t.getGroups(),Y=t.getOptions(),ce=[];ce=ce.concat(Object.keys(d)),ce=ce.concat(Object.keys(M)),ce=ce.concat(Object.keys(U)),ce=ce.concat(Object.keys(Y.default)),ce=ce.filter(_),ce=Object.keys(ce.reduce((k,ae)=>(ae!=="_"&&(k[ae]=!0),k),{}));let $e=x(),le=e.cliui({width:$e,wrap:!!$e});if(!p){if(c.length)c.forEach(k=>{le.div(`${k[0].replace(/\$0/g,v)}`),k[1]&&le.div({text:`${k[1]}`,padding:[1,0,0,0]})}),le.div();else if(l.length){let k=null;U._?k=`${v} <${r("command")}>
17
+ `),s.border&&(o.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(o.unshift(...new Array(s.padding[Ih]||0).fill("")),o.push(...new Array(s.padding[_h]||0).fill(""))),o.forEach((a,c)=>{r[c]||r.push([]);let p=r[c];for(let u=0;u<i;u++)p[u]===void 0&&p.push("");p.push(a)})}),r}negatePadding(e){let r=e.width||0;return e.padding&&(r-=(e.padding[Dn]||0)+(e.padding[jn]||0)),e.border&&(r-=4),r}columnWidths(e){if(!this.wrap)return e.map(i=>i.width||Ye.stringWidth(i.text));let r=e.length,n=this.width,o=e.map(i=>{if(i.width)return r--,n-=i.width,i.width}),s=r?Math.floor(n/r):0;return o.map((i,a)=>i===void 0?Math.max(s,Th(e[a])):i)}};function Oc(t,e,r){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?r:" ":""}function Th(t){let e=t.padding||[],r=1+(e[Dn]||0)+(e[jn]||0);return t.border?r+4:r}function jh(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Dh(t,e){t=t.trim();let r=Ye.stringWidth(t);return r<e?" ".repeat(e-r)+t:t}function Nh(t,e){t=t.trim();let r=Ye.stringWidth(t);return r>=e?t:" ".repeat(e-r>>1)+t}var Ye;function Ac(t,e){return Ye=e,new Bo({width:t?.width||jh(),wrap:t?.wrap})}var Cc=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Go(t){return t.replace(Cc,"")}function xc(t,e){let[r,n]=t.match(Cc)||["",""];t=Go(t);let o="";for(let s=0;s<t.length;s++)s!==0&&s%e===0&&(o+=`
18
+ `),o+=t.charAt(s);return r&&n&&(o=`${r}${o}${n}`),o}function Ho(t){return Ac(t,{stringWidth:e=>[...e].length,stripAnsi:Go,wrap:xc})}import{dirname as vc,resolve as Pc}from"path";import{readdirSync as Lh,statSync as Mh}from"fs";function Rc(t,e){let r=Pc(".",t),n;for(Mh(r).isDirectory()||(r=vc(r));;){if(n=e(r,Lh(r)),n)return Pc(r,n);if(r=vc(n=r),n===r)break}}import{inspect as eg}from"util";import{readFileSync as tg}from"fs";import{fileURLToPath as Uc}from"url";import{format as kh}from"util";import{readFileSync as Uh}from"fs";import{normalize as qh,resolve as Wh}from"path";function zt(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let r="",n=!1,o=t.match(/^-+/);for(let s=o?o[0].length:0;s<t.length;s++){let i=t.charAt(s);n&&(n=!1,i=i.toUpperCase()),s!==0&&(i==="-"||i==="_")?n=!0:i!=="-"&&i!=="_"&&(r+=i)}return r}}function Nn(t,e){let r=t.toLowerCase();e=e||"-";let n="";for(let o=0;o<t.length;o++){let s=r.charAt(o),i=t.charAt(o);s!==i&&o>0?n+=`${e}${r.charAt(o)}`:n+=i}return n}function Ln(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function $c(t){if(Array.isArray(t))return t.map(i=>typeof i!="string"?i+"":i);t=t.trim();let e=0,r=null,n=null,o=null,s=[];for(let i=0;i<t.length;i++){if(r=n,n=t.charAt(i),n===" "&&!o){r!==" "&&e++;continue}n===o?o=null:(n==="'"||n==='"')&&!o&&(o=n),s[e]||(s[e]=""),s[e]+=n}return s}var st;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(st||(st={}));var Ct,Mn=class{constructor(e){Ct=e}parse(e,r){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},r),o=$c(e),s=Fh(Object.assign(Object.create(null),n.alias)),i=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),c=n.configObjects||[],p=n.envPrefix,u=i["populate--"],l=u?"--":"_",d=Object.create(null),m=Object.create(null),w=n.__||Ct.format,h={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},C=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,P=new RegExp("^--"+i["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(g){let b=typeof g=="object"?g.key:g,R=Object.keys(g).map(function(O){return{boolean:"bools",string:"strings",number:"numbers"}[O]}).filter(Boolean).pop();R&&(h[R][b]=!0),h.arrays[b]=!0,h.keys.push(b)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(g){h.bools[g]=!0,h.keys.push(g)}),[].concat(n.string||[]).filter(Boolean).forEach(function(g){h.strings[g]=!0,h.keys.push(g)}),[].concat(n.number||[]).filter(Boolean).forEach(function(g){h.numbers[g]=!0,h.keys.push(g)}),[].concat(n.count||[]).filter(Boolean).forEach(function(g){h.counts[g]=!0,h.keys.push(g)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(g){h.normalize[g]=!0,h.keys.push(g)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([g,b])=>{typeof b=="number"&&(h.nargs[g]=b,h.keys.push(g))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([g,b])=>{typeof b=="function"&&(h.coercions[g]=b,h.keys.push(g))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(g){h.configs[g]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([g,b])=>{(typeof b=="boolean"||typeof b=="function")&&(h.configs[g]=b)})),Ze(n.key,s,n.default,h.arrays),Object.keys(a).forEach(function(g){(h.aliases[g]||[]).forEach(function(b){a[b]=a[g]})});let A=null;fo();let x=[],E=Object.assign(Object.create(null),{_:[]}),$={};for(let g=0;g<o.length;g++){let b=o[g],R=b.replace(/^-{3,}/,"---"),O,S,D,N,G,ve;if(b!=="--"&&ae(b))_(b);else if(R.match(/---+(=|$)/)){_(b);continue}else if(b.match(/^--.+=/)||!i["short-option-groups"]&&b.match(/^-.+=/))N=b.match(/^--?([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&(z(N[1],h.arrays)?g=ie(g,N[1],o,N[2]):z(N[1],h.nargs)!==!1?g=J(g,N[1],o,N[2]):V(N[1],N[2]));else if(b.match(P)&&i["boolean-negation"])N=b.match(P),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],V(S,z(S,h.arrays)?[!1]:!1));else if(b.match(/^--.+/)||!i["short-option-groups"]&&b.match(/^-[^-]+/))N=b.match(/^--?(.+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],z(S,h.arrays)?g=ie(g,S,o):z(S,h.nargs)!==!1?g=J(g,S,o):(G=o[g+1],G!==void 0&&(!G.match(/^-/)||G.match(C))&&!z(S,h.bools)&&!z(S,h.counts)||/^(true|false)$/.test(G)?(V(S,G),g++):V(S,se(S))));else if(b.match(/^-.\..+=/))N=b.match(/^-([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&V(N[1],N[2]);else if(b.match(/^-.\..+/)&&!b.match(C))G=o[g+1],N=b.match(/^-(.\..+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],G!==void 0&&!G.match(/^-/)&&!z(S,h.bools)&&!z(S,h.counts)?(V(S,G),g++):V(S,se(S)));else if(b.match(/^-[^-]+/)&&!b.match(C)){D=b.slice(1,-1).split(""),O=!1;for(let Le=0;Le<D.length;Le++){if(G=b.slice(Le+2),D[Le+1]&&D[Le+1]==="="){ve=b.slice(Le+3),S=D[Le],z(S,h.arrays)?g=ie(g,S,o,ve):z(S,h.nargs)!==!1?g=J(g,S,o,ve):V(S,ve),O=!0;break}if(G==="-"){V(D[Le],G);continue}if(/[A-Za-z]/.test(D[Le])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(G)&&z(G,h.bools)===!1){V(D[Le],G),O=!0;break}if(D[Le+1]&&D[Le+1].match(/\W/)){V(D[Le],G),O=!0;break}else V(D[Le],se(D[Le]))}S=b.slice(-1)[0],!O&&S!=="-"&&(z(S,h.arrays)?g=ie(g,S,o):z(S,h.nargs)!==!1?g=J(g,S,o):(G=o[g+1],G!==void 0&&(!/^(-|--)[^-]/.test(G)||G.match(C))&&!z(S,h.bools)&&!z(S,h.counts)||/^(true|false)$/.test(G)?(V(S,G),g++):V(S,se(S))))}else if(b.match(/^-[0-9]$/)&&b.match(C)&&z(b.slice(1),h.bools))S=b.slice(1),V(S,se(S));else if(b==="--"){x=o.slice(g+1);break}else if(i["halt-at-non-option"]){x=o.slice(g);break}else _(b)}te(E,!0),te(E,!1),M(E),ne(),$e(E,h.aliases,a,!0),Y(E),i["set-placeholder-key"]&&ce(E),Object.keys(h.counts).forEach(function(g){le(E,g.split("."))||V(g,0)}),u&&x.length&&(E[l]=[]),x.forEach(function(g){E[l].push(g)}),i["camel-case-expansion"]&&i["strip-dashed"]&&Object.keys(E).filter(g=>g!=="--"&&g.includes("-")).forEach(g=>{delete E[g]}),i["strip-aliased"]&&[].concat(...Object.keys(s).map(g=>s[g])).forEach(g=>{i["camel-case-expansion"]&&g.includes("-")&&delete E[g.split(".").map(b=>zt(b)).join(".")],delete E[g]});function _(g){let b=v("_",g);(typeof b=="string"||typeof b=="number")&&E._.push(b)}function J(g,b,R,O){let S,D=z(b,h.nargs);if(D=typeof D!="number"||isNaN(D)?1:D,D===0)return Oe(O)||(A=Error(w("Argument unexpected for: %s",b))),V(b,se(b)),g;let N=Oe(O)?0:1;if(i["nargs-eats-options"])R.length-(g+1)+N<D&&(A=Error(w("Not enough arguments following: %s",b))),N=D;else{for(S=g+1;S<R.length&&(!R[S].match(/^-[^0-9]/)||R[S].match(C)||ae(R[S]));S++)N++;N<D&&(A=Error(w("Not enough arguments following: %s",b)))}let G=Math.min(N,D);for(!Oe(O)&&G>0&&(V(b,O),G--),S=g+1;S<G+g+1;S++)V(b,R[S]);return g+G}function ie(g,b,R,O){let S=[],D=O||R[g+1],N=z(b,h.nargs);if(z(b,h.bools)&&!/^(true|false)$/.test(D))S.push(!0);else if(Oe(D)||Oe(O)&&/^-/.test(D)&&!C.test(D)&&!ae(D)){if(a[b]!==void 0){let G=a[b];S=Array.isArray(G)?G:[G]}}else{Oe(O)||S.push(I(b,O));for(let G=g+1;G<R.length&&!(!i["greedy-arrays"]&&S.length>0||N&&typeof N=="number"&&S.length>=N||(D=R[G],/^-/.test(D)&&!C.test(D)&&!ae(D)));G++)g=G,S.push(I(b,D))}return typeof N=="number"&&(N&&S.length<N||isNaN(N)&&S.length===0)&&(A=Error(w("Not enough arguments following: %s",b))),V(b,S),g}function V(g,b){if(/-/.test(g)&&i["camel-case-expansion"]){let S=g.split(".").map(function(D){return zt(D)}).join(".");De(g,S)}let R=I(g,b),O=g.split(".");Ge(E,O,R),h.aliases[g]&&h.aliases[g].forEach(function(S){let D=S.split(".");Ge(E,D,R)}),O.length>1&&i["dot-notation"]&&(h.aliases[O[0]]||[]).forEach(function(S){let D=S.split("."),N=[].concat(O);N.shift(),D=D.concat(N),(h.aliases[g]||[]).includes(D.join("."))||Ge(E,D,R)}),z(g,h.normalize)&&!z(g,h.arrays)&&[g].concat(h.aliases[g]||[]).forEach(function(D){Object.defineProperty($,D,{enumerable:!0,get(){return b},set(N){b=typeof N=="string"?Ct.normalize(N):N}})})}function De(g,b){h.aliases[g]&&h.aliases[g].length||(h.aliases[g]=[b],d[b]=!0),h.aliases[b]&&h.aliases[b].length||De(b,g)}function I(g,b){typeof b=="string"&&(b[0]==="'"||b[0]==='"')&&b[b.length-1]===b[0]&&(b=b.substring(1,b.length-1)),(z(g,h.bools)||z(g,h.counts))&&typeof b=="string"&&(b=b==="true");let R=Array.isArray(b)?b.map(function(O){return v(g,O)}):v(g,b);return z(g,h.counts)&&(Oe(R)||typeof R=="boolean")&&(R=Yo()),z(g,h.normalize)&&z(g,h.arrays)&&(Array.isArray(b)?R=b.map(O=>Ct.normalize(O)):R=Ct.normalize(b)),R}function v(g,b){return!i["parse-positional-numbers"]&&g==="_"||!z(g,h.strings)&&!z(g,h.bools)&&!Array.isArray(b)&&(Ln(b)&&i["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${b}`)))||!Oe(b)&&z(g,h.numbers))&&(b=Number(b)),b}function M(g){let b=Object.create(null);$e(b,h.aliases,a),Object.keys(h.configs).forEach(function(R){let O=g[R]||b[R];if(O)try{let S=null,D=Ct.resolve(Ct.cwd(),O),N=h.configs[R];if(typeof N=="function"){try{S=N(D)}catch(G){S=G}if(S instanceof Error){A=S;return}}else S=Ct.require(D);U(S)}catch(S){S.name==="PermissionDenied"?A=S:g[R]&&(A=Error(w("Invalid JSON config file: %s",O)))}})}function U(g,b){Object.keys(g).forEach(function(R){let O=g[R],S=b?b+"."+R:R;typeof O=="object"&&O!==null&&!Array.isArray(O)&&i["dot-notation"]?U(O,S):(!le(E,S.split("."))||z(S,h.arrays)&&i["combine-arrays"])&&V(S,O)})}function ne(){typeof c<"u"&&c.forEach(function(g){U(g)})}function te(g,b){if(typeof p>"u")return;let R=typeof p=="string"?p:"",O=Ct.env();Object.keys(O).forEach(function(S){if(R===""||S.lastIndexOf(R,0)===0){let D=S.split("__").map(function(N,G){return G===0&&(N=N.substring(R.length)),zt(N)});(b&&h.configs[D.join(".")]||!b)&&!le(g,D)&&V(D.join("."),O[S])}})}function Y(g){let b,R=new Set;Object.keys(g).forEach(function(O){if(!R.has(O)&&(b=z(O,h.coercions),typeof b=="function"))try{let S=v(O,b(g[O]));[].concat(h.aliases[O]||[],O).forEach(D=>{R.add(D),g[D]=S})}catch(S){A=S}})}function ce(g){return h.keys.forEach(b=>{~b.indexOf(".")||typeof g[b]>"u"&&(g[b]=void 0)}),g}function $e(g,b,R,O=!1){Object.keys(R).forEach(function(S){le(g,S.split("."))||(Ge(g,S.split("."),R[S]),O&&(m[S]=!0),(b[S]||[]).forEach(function(D){le(g,D.split("."))||Ge(g,D.split("."),R[S])}))})}function le(g,b){let R=g;i["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(S){R=R[S]||{}});let O=b[b.length-1];return typeof R!="object"?!1:O in R}function Ge(g,b,R){let O=g;i["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(ve){ve=Ic(ve),typeof O=="object"&&O[ve]===void 0&&(O[ve]={}),typeof O[ve]!="object"||Array.isArray(O[ve])?(Array.isArray(O[ve])?O[ve].push({}):O[ve]=[O[ve],{}],O=O[ve][O[ve].length-1]):O=O[ve]});let S=Ic(b[b.length-1]),D=z(b.join("."),h.arrays),N=Array.isArray(R),G=i["duplicate-arguments-array"];!G&&z(S,h.nargs)&&(G=!0,(!Oe(O[S])&&h.nargs[S]===1||Array.isArray(O[S])&&O[S].length===h.nargs[S])&&(O[S]=void 0)),R===Yo()?O[S]=Yo(O[S]):Array.isArray(O[S])?G&&D&&N?O[S]=i["flatten-duplicate-arrays"]?O[S].concat(R):(Array.isArray(O[S][0])?O[S]:[O[S]]).concat([R]):!G&&!!D==!!N?O[S]=R:O[S]=O[S].concat([R]):O[S]===void 0&&D?O[S]=N?R:[R]:G&&!(O[S]===void 0||z(S,h.counts)||z(S,h.bools))?O[S]=[O[S],R]:O[S]=R}function Ze(...g){g.forEach(function(b){Object.keys(b||{}).forEach(function(R){h.aliases[R]||(h.aliases[R]=[].concat(s[R]||[]),h.aliases[R].concat(R).forEach(function(O){if(/-/.test(O)&&i["camel-case-expansion"]){let S=zt(O);S!==R&&h.aliases[R].indexOf(S)===-1&&(h.aliases[R].push(S),d[S]=!0)}}),h.aliases[R].concat(R).forEach(function(O){if(O.length>1&&/[A-Z]/.test(O)&&i["camel-case-expansion"]){let S=Nn(O,"-");S!==R&&h.aliases[R].indexOf(S)===-1&&(h.aliases[R].push(S),d[S]=!0)}}),h.aliases[R].forEach(function(O){h.aliases[O]=[R].concat(h.aliases[R].filter(function(S){return O!==S}))}))})})}function z(g,b){let R=[].concat(h.aliases[g]||[],g),O=Object.keys(b),S=R.find(D=>O.includes(D));return S?b[S]:!1}function xe(g){let b=Object.keys(h);return[].concat(b.map(O=>h[O])).some(function(O){return Array.isArray(O)?O.includes(g):O[g]})}function Qe(g,...b){return[].concat(...b).some(function(O){let S=g.match(O);return S&&xe(S[1])})}function k(g){if(g.match(C)||!g.match(/^-[^-]+/))return!1;let b=!0,R,O=g.slice(1).split("");for(let S=0;S<O.length;S++){if(R=g.slice(S+2),!xe(O[S])){b=!1;break}if(O[S+1]&&O[S+1]==="="||R==="-"||/[A-Za-z]/.test(O[S])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(R)||O[S+1]&&O[S+1].match(/\W/))break}return b}function ae(g){return i["unknown-options-as-args"]&&oe(g)}function oe(g){return g=g.replace(/^-{3,}/,"--"),g.match(C)||k(g)?!1:!Qe(g,/^-+([^=]+?)=[\s\S]*$/,P,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function se(g){return!z(g,h.bools)&&!z(g,h.counts)&&`${g}`in a?a[g]:Ee(qe(g))}function Ee(g){return{[st.BOOLEAN]:!0,[st.STRING]:"",[st.NUMBER]:void 0,[st.ARRAY]:[]}[g]}function qe(g){let b=st.BOOLEAN;return z(g,h.strings)?b=st.STRING:z(g,h.numbers)?b=st.NUMBER:z(g,h.bools)?b=st.BOOLEAN:z(g,h.arrays)&&(b=st.ARRAY),b}function Oe(g){return g===void 0}function fo(){Object.keys(h.counts).find(g=>z(g,h.arrays)?(A=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",g)),!0):z(g,h.nargs)?(A=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",g)),!0):!1)}return{aliases:Object.assign({},h.aliases),argv:Object.assign($,E),configuration:i,defaulted:Object.assign({},m),error:A,newAliases:Object.assign({},d)}}};function Fh(t){let e=[],r=Object.create(null),n=!0;for(Object.keys(t).forEach(function(o){e.push([].concat(t[o],o))});n;){n=!1;for(let o=0;o<e.length;o++)for(let s=o+1;s<e.length;s++)if(e[o].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[o]=e[o].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(o){o=o.filter(function(i,a,c){return c.indexOf(i)===a});let s=o.pop();s!==void 0&&typeof s=="string"&&(r[s]=o)}),r}function Yo(t){return t!==void 0?t+1:1}function Ic(t){return t==="__proto__"?"___proto___":t}var _c=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):10;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<_c)throw Error(`yargs parser supports a minimum Node.js version of ${_c}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var zh=process?process.env:{},Tc=new Mn({cwd:process.cwd,env:()=>zh,format:kh,normalize:qh,resolve:Wh,require:t=>{if(typeof We<"u")return We(t);if(t.match(/\.json$/))return Uh(t,"utf8");throw Error("only .json config files are supported in ESM")}}),Gr=function(e,r){return Tc.parse(e.slice(),r).argv};Gr.detailed=function(t,e){return Tc.parse(t.slice(),e)};Gr.camelCase=zt;Gr.decamelize=Nn;Gr.looksLikeNumber=Ln;var Ko=Gr;import{basename as rg,dirname as ng,extname as og,relative as sg,resolve as Fc}from"path";function jc(){return Vh()?0:1}function Vh(){return Bh()&&!process.defaultApp}function Bh(){return!!process.versions.electron}function Jo(t){return t.slice(jc()+1)}function Dc(){return process.argv[jc()]}var me=class t extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace(this,t)}};import{readFileSync as Gh,statSync as Hh,writeFile as Yh}from"fs";import{format as Kh}from"util";import{resolve as Jh}from"path";var Nc={fs:{readFileSync:Gh,writeFile:Yh},format:Kh,resolve:Jh,exists:t=>{try{return Hh(t).isFile()}catch{return!1}}};var dt,Xo=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),dt.format.apply(dt.format,[this.cache[this.locale][r]||r].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),r=e.shift(),n=e.shift(),o=e.shift(),s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let i=o===1?r:n;this.cache[this.locale][r]&&(i=this.cache[this.locale][r][o===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s();let a=[i];return~i.indexOf("%d")&&a.push(o),dt.format.apply(dt.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.cache[this.locale][r]=e[r])}_taggedLiteral(e,...r){let n="";return e.forEach(function(o,s){let i=r[s+1];n+=o,typeof i<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,r=this.writeQueue[0],n=r.directory,o=r.locale,s=r.cb,i=this._resolveLocaleFile(n,o),a=JSON.stringify(this.cache[o],null,2);dt.fs.writeFile(i,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(c)})}_readLocaleFile(){let e={},r=this._resolveLocaleFile(this.directory,this.locale);try{dt.fs.readFileSync&&(e=JSON.parse(dt.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,r){let n=dt.resolve(e,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){let o=dt.resolve(e,"./",r.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return dt.exists(e)}};function Lc(t,e){dt=e;let r=new Xo(t);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var Xh=t=>Lc(t,Nc),Mc=Xh;var ig="require is not supported by ESM",kc="loading a directory of commands is not supported yet for ESM",ag=Uc(import.meta.url).split("node_modules")[0],cg=Uc(import.meta.url),Zo={assert:{notStrictEqual:Zh,strictEqual:Qh},cliui:Ho,findUp:Rc,getEnv:t=>process.env[t],inspect:eg,getCallerFile:()=>{throw new me(kc)},getProcessArgvBin:Dc,mainFilename:ag||process.cwd(),Parser:Ko,path:{basename:rg,dirname:ng,extname:og,relative:sg,resolve:Fc},process:{argv:()=>process.argv,cwd:process.cwd,execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:tg,require:()=>{throw new me(ig)},requireDirectory:()=>{throw new me(kc)},stringWidth:t=>[...t].length,y18n:Mc({directory:Fc(cg,"../../../locales"),updateFiles:!1})};function Ue(t,e,r,n){r.assert.notStrictEqual(t,e,n)}function Qo(t,e){e.assert.strictEqual(typeof t,"string")}function hr(t){return Object.keys(t)}function he(t){return!!t&&!!t.then&&typeof t.then=="function"}function It(t){let r=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,o=r.shift();if(!o)throw new Error(`No command found in: ${t}`);let s={cmd:o.replace(n,""),demanded:[],optional:[]};return r.forEach((i,a)=>{let c=!1;i=i.replace(/\s/g,""),/\.+[\]>]/.test(i)&&a===r.length-1&&(c=!0),/^\[/.test(i)?s.optional.push({cmd:i.replace(n,"").split("|"),variadic:c}):s.demanded.push({cmd:i.replace(n,"").split("|"),variadic:c})}),s}var lg=["first","second","third","fourth","fifth","sixth"];function L(t,e,r){function n(){return typeof t=="object"?[{demanded:[],optional:[]},t,e]:[It(`cmd ${t}`),e,r]}try{let o=0,[s,i,a]=n(),c=[].slice.call(i);for(;c.length&&c[c.length-1]===void 0;)c.pop();let p=a||c.length;if(p<s.demanded.length)throw new me(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);let u=s.demanded.length+s.optional.length;if(p>u)throw new me(`Too many arguments provided. Expected max ${u} but received ${p}.`);s.demanded.forEach(l=>{let d=c.shift(),m=qc(d);l.cmd.filter(h=>h===m||h==="*").length===0&&Wc(m,l.cmd,o),o+=1}),s.optional.forEach(l=>{if(c.length===0)return;let d=c.shift(),m=qc(d);l.cmd.filter(h=>h===m||h==="*").length===0&&Wc(m,l.cmd,o),o+=1})}catch(o){console.warn(o.stack)}}function qc(t){return Array.isArray(t)?"array":t===null?"null":typeof t}function Wc(t,e,r){throw new me(`Invalid ${lg[r]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}var Fn=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,r,n=!0){if(L("<array|function> [boolean] [boolean]",[e,r,n],arguments.length),Array.isArray(e)){for(let o=0;o<e.length;o++){if(typeof e[o]!="function")throw Error("middleware must be a function");let s=e[o];s.applyBeforeValidation=r,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let o=e;o.applyBeforeValidation=r,o.global=n,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,r){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{let s=[...n[r]||[],r];return o.option?!s.includes(o.option):!0}),e.option=r,this.addMiddleware(e,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function zc(t){return t?t.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Vt(t,e,r,n){return r.reduce((o,s)=>{if(s.applyBeforeValidation!==n)return o;if(he(o))return o.then(i=>Promise.all([i,s(i,e)])).then(([i,a])=>Object.assign(i,a));{let i=s(o,e);return he(i)?i.then(a=>Object.assign(o,a)):Object.assign(o,i)}},t)}function Bt(t,e,r=n=>{throw n}){try{let n=pg(t)?t():t;return he(n)?n.then(o=>e(o)):e(n)}catch(n){return r(n)}}function pg(t){return typeof t=="function"}function es(t){if(typeof We>"u")return null;for(let e=0,r=Object.keys(We.cache),n;e<r.length;e++)if(n=We.cache[r[e]],n.exports===t)return n;return null}var gr=/(^\*)|(^\$0)/,ts=class{constructor(e,r,n,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=e,this.globalMiddleware=n,this.validation=r}addDirectory(e,r,n,o){o=o||{},typeof o.recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);let s=typeof o.visit=="function"?o.visit:i=>i;o.visit=(i,a,c)=>{let p=s(i,a,c);if(p){if(this.requireCache.has(a))return p;this.requireCache.add(a),this.addHandler(p)}return p},this.shim.requireDirectory({require:r,filename:n},e,o)}addHandler(e,r,n,o,s,i){let a=[],c=zc(s);if(o=o||(()=>{}),Array.isArray(e))if(ug(e))[e,...a]=e;else for(let p of e)this.addHandler(p);else if(mg(e)){let p=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(p=[].concat(p).concat(e.aliases)),this.addHandler(p,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Vc(n)){this.addHandler([e].concat(a),r,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let p=It(e);a=a.map(d=>It(d).cmd);let u=!1,l=[p.cmd].concat(a).filter(d=>gr.test(d)?(u=!0,!1):!0);l.length===0&&u&&l.push("$0"),u&&(p.cmd=l[0],a=l.slice(1),e=e.replace(gr,p.cmd)),a.forEach(d=>{this.aliasMap[d]=p.cmd}),r!==!1&&this.usage.command(e,r,u,a,i),this.handlers[p.cmd]={original:e,description:r,handler:o,builder:n||{},middlewares:c,deprecated:i,demanded:p.demanded,optional:p.optional},u&&(this.defaultCommand=this.handlers[p.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,r,n,o,s,i){let a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=r.getInternalMethods().getContext(),p=c.commands.slice(),u=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));let l=this.applyBuilderUpdateUsageAndParse(u,a,r,n.aliases,p,o,s,i);return he(l)?l.then(d=>this.applyMiddlewareAndGetResult(u,a,d.innerArgv,c,s,d.aliases,r)):this.applyMiddlewareAndGetResult(u,a,l.innerArgv,c,s,l.aliases,r)}applyBuilderUpdateUsageAndParse(e,r,n,o,s,i,a,c){let p=r.builder,u=n;if(kn(p)){let l=p(n.getInternalMethods().reset(o),c);if(he(l))return l.then(d=>(u=Gc(d)?d:n,this.parseAndUpdateUsage(e,r,u,s,i,a)))}else fg(p)&&(u=n.getInternalMethods().reset(o),Object.keys(r.builder).forEach(l=>{u.option(l,p[l])}));return this.parseAndUpdateUsage(e,r,u,s,i,a)}parseAndUpdateUsage(e,r,n,o,s,i){e&&n.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,r),r.description);let a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,i);return he(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,r){let n=gr.test(r.original)?r.original.replace(gr,"").trim():r.original,o=e.filter(s=>!gr.test(s));return o.push(n),`$0 ${o.join(" ")}`}applyMiddlewareAndGetResult(e,r,n,o,s,i,a){let c={};if(s)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(r,n,o,a));let p=this.globalMiddleware.getMiddleware().slice(0).concat(r.middlewares);if(n=Vt(n,a,p,!0),!a.getInternalMethods().getHasOutput()){let u=a.getInternalMethods().runValidation(i,c,a.parsed.error,e);n=Bt(n,l=>(u(l),l))}if(r.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let u=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,u,!1,!1),n=Vt(n,a,p,!1),n=Bt(n,l=>{let d=r.handler(l);return he(d)?d.then(()=>l):l}),e||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),he(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(l=>{try{a.getInternalMethods().getUsageInstance().fail(null,l)}catch{}})}return e||(o.commands.pop(),o.fullCommands.pop()),n}populatePositionals(e,r,n,o){r._=r._.slice(n.commands.length);let s=e.demanded.slice(0),i=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,r._.length);s.length;){let c=s.shift();this.populatePositional(c,r,a)}for(;i.length;){let c=i.shift();this.populatePositional(c,r,a)}return r._=n.commands.concat(r._.map(c=>""+c)),this.postProcessPositionals(r,a,this.cmdToParseOptions(e.original),o),a}populatePositional(e,r,n){let o=e.cmd[0];e.variadic?n[o]=r._.splice(0).map(String):r._.length&&(n[o]=[String(r._.shift())])}cmdToParseOptions(e){let r={array:[],default:{},alias:{},demand:{}},n=It(e);return n.demanded.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i,r.demand[s]=!0}),n.optional.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i}),r}postProcessPositionals(e,r,n,o){let s=Object.assign({},o.getOptions());s.default=Object.assign(n.default,s.default);for(let p of Object.keys(n.alias))s.alias[p]=(s.alias[p]||[]).concat(n.alias[p]);s.array=s.array.concat(n.array),s.config={};let i=[];if(Object.keys(r).forEach(p=>{r[p].map(u=>{s.configuration["unknown-options-as-args"]&&(s.key[p]=!0),i.push(`--${p}`),i.push(u)})}),!i.length)return;let a=Object.assign({},s.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(i,Object.assign({},s,{configuration:a}));if(c.error)o.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{let p=Object.keys(r);Object.keys(r).forEach(u=>{p.push(...c.aliases[u])}),Object.keys(c.argv).forEach(u=>{p.indexOf(u)!==-1&&(r[u]||(r[u]=c.argv[u]),e[u]=c.argv[u])})}}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=gr.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let r=this.defaultCommand.builder;if(kn(r))return r(e,!0);Vc(r)||Object.keys(r).forEach(n=>{e.option(n,r[n])})}moduleName(e){let r=es(e);if(!r)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(r.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:r,desc:n}){for(let o of[e,r,n]){if(typeof o=="string"||o===!1)return o;Ue(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();Ue(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Bc(t,e,r,n){return new ts(t,e,r,n)}function Vc(t){return typeof t=="object"&&!!t.builder&&typeof t.handler=="function"}function ug(t){return t.every(e=>typeof e=="string")}function kn(t){return typeof t=="function"}function fg(t){return typeof t=="object"}function mg(t){return typeof t=="object"&&!Array.isArray(t)}function _t(t={},e=()=>!0){let r={};return hr(t).forEach(n=>{e(n,t[n])&&(r[n]=t[n])}),r}function Tt(t){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let r=e;r._handle&&r.isTTY&&typeof r._handle.setBlocking=="function"&&r._handle.setBlocking(t)})}function dg(t){return typeof t=="boolean"}function Yc(t,e){let r=e.y18n.__,n={},o=[];n.failFn=function(v){o.push(v)};let s=null,i=!0;n.showHelpOnFail=function(v=!0,M){function U(){return typeof v=="string"?[!0,v]:[v,M]}let[ne,te]=U();return s=te,i=ne,n};let a=!1;n.fail=function(v,M){let U=t.getInternalMethods().getLoggerInstance();if(o.length)for(let ne=o.length-1;ne>=0;--ne){let te=o[ne];if(dg(te)){if(M)throw M;if(v)throw Error(v)}else te(v,M,n)}else{if(t.getExitProcess()&&Tt(!0),a||(a=!0,i&&(t.showHelp("error"),U.error()),(v||M)&&U.error(v||M),s&&((v||M)&&U.error(""),U.error(s))),M=M||new me(v),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,M);throw M}};let c=[],p=!1;n.usage=(I,v)=>I===null?(p=!0,c=[],n):(p=!1,c.push([I,v||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>r("Positionals:");let u=[];n.example=(I,v)=>{u.push([I,v||""])};let l=[];n.command=function(v,M,U,ne,te=!1){U&&(l=l.map(Y=>(Y[2]=!1,Y))),l.push([v,M||"",U,ne,te])},n.getCommands=()=>l;let d={};n.describe=function(v,M){Array.isArray(v)?v.forEach(U=>{n.describe(U,M)}):typeof v=="object"?Object.keys(v).forEach(U=>{n.describe(U,v[U])}):d[v]=M},n.getDescriptions=()=>d;let m=[];n.epilog=I=>{m.push(I)};let w=!1,h;n.wrap=I=>{w=!0,h=I};function C(){return w||(h=ie(),w=!0),h}let P="__yargsString__:";n.deferY18nLookup=I=>P+I,n.help=function(){if(E)return E;x();let v=t.customScriptName?t.$0:e.path.basename(t.$0),M=t.getDemandedOptions(),U=t.getDemandedCommands(),ne=t.getDeprecatedOptions(),te=t.getGroups(),Y=t.getOptions(),ce=[];ce=ce.concat(Object.keys(d)),ce=ce.concat(Object.keys(M)),ce=ce.concat(Object.keys(U)),ce=ce.concat(Object.keys(Y.default)),ce=ce.filter(_),ce=Object.keys(ce.reduce((k,ae)=>(ae!=="_"&&(k[ae]=!0),k),{}));let $e=C(),le=e.cliui({width:$e,wrap:!!$e});if(!p){if(c.length)c.forEach(k=>{le.div(`${k[0].replace(/\$0/g,v)}`),k[1]&&le.div({text:`${k[1]}`,padding:[1,0,0,0]})}),le.div();else if(l.length){let k=null;U._?k=`${v} <${r("command")}>
19
19
  `:k=`${v} [${r("command")}]
20
- `,le.div(`${k}`)}}if(l.length>1||l.length===1&&!l[0][2]){le.div(r("Commands:"));let k=t.getInternalMethods().getContext(),ae=k.commands.length?`${k.commands.join(" ")} `:"";t.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(l=l.sort((oe,se)=>oe[0].localeCompare(se[0]))),l.forEach(oe=>{let se=`${v} ${ae}${oe[0].replace(/^\$0 ?/,"")}`;le.span({text:se,padding:[0,2,0,2],width:C(l,$e,`${v}${ae}`)+4},{text:oe[1]});let Ee=[];oe[2]&&Ee.push(`[${r("default")}]`),oe[3]&&oe[3].length&&Ee.push(`[${r("aliases:")} ${oe[3].join(", ")}]`),oe[4]&&(typeof oe[4]=="string"?Ee.push(`[${r("deprecated: %s",oe[4])}]`):Ee.push(`[${r("deprecated")}]`)),Ee.length?le.div({text:Ee.join(" "),padding:[0,0,0,2],align:"right"}):le.div()}),le.div()}let Ge=(Object.keys(Y.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);ce=ce.filter(k=>!t.parsed.newAliases[k]&&Ge.every(ae=>(Y.alias[ae]||[]).indexOf(k)===-1));let Ze=r("Options:");te[Ze]||(te[Ze]=[]),$(ce,Y.alias,te,Ze);let z=k=>/^--/.test(Un(k)),Ae=Object.keys(te).filter(k=>te[k].length>0).map(k=>{let ae=te[k].filter(_).map(oe=>{if(~Ge.indexOf(oe))return oe;for(let se=0,Ee;(Ee=Ge[se])!==void 0;se++)if(~(Y.alias[Ee]||[]).indexOf(oe))return Ee;return oe});return{groupName:k,normalizedKeys:ae}}).filter(({normalizedKeys:k})=>k.length>0).map(({groupName:k,normalizedKeys:ae})=>{let oe=ae.reduce((se,Ee)=>(se[Ee]=[Ee].concat(Y.alias[Ee]||[]).map(qe=>k===n.getPositionalGroupName()?qe:(/^[0-9]$/.test(qe)?~Y.boolean.indexOf(Ee)?"-":"--":qe.length>1?"--":"-")+qe).sort((qe,Oe)=>z(qe)===z(Oe)?0:z(qe)?1:-1).join(", "),se),{});return{groupName:k,normalizedKeys:ae,switches:oe}});if(Ae.filter(({groupName:k})=>k!==n.getPositionalGroupName()).some(({normalizedKeys:k,switches:ae})=>!k.every(oe=>z(ae[oe])))&&Ae.filter(({groupName:k})=>k!==n.getPositionalGroupName()).forEach(({normalizedKeys:k,switches:ae})=>{k.forEach(oe=>{z(ae[oe])&&(ae[oe]=hg(ae[oe],4))})}),Ae.forEach(({groupName:k,normalizedKeys:ae,switches:oe})=>{le.div(k),ae.forEach(se=>{let Ee=oe[se],qe=d[se]||"",Oe=null;~qe.lastIndexOf(P)&&(qe=r(qe.substring(P.length))),~Y.boolean.indexOf(se)&&(Oe=`[${r("boolean")}]`),~Y.count.indexOf(se)&&(Oe=`[${r("count")}]`),~Y.string.indexOf(se)&&(Oe=`[${r("string")}]`),~Y.normalize.indexOf(se)&&(Oe=`[${r("string")}]`),~Y.array.indexOf(se)&&(Oe=`[${r("array")}]`),~Y.number.indexOf(se)&&(Oe=`[${r("number")}]`);let fo=b=>typeof b=="string"?`[${r("deprecated: %s",b)}]`:`[${r("deprecated")}]`,g=[se in ne?fo(ne[se]):null,Oe,se in M?`[${r("required")}]`:null,Y.choices&&Y.choices[se]?`[${r("choices:")} ${n.stringifiedValues(Y.choices[se])}]`:null,J(Y.default[se],Y.defaultDescription[se])].filter(Boolean).join(" ");le.span({text:Un(Ee),padding:[0,2,0,2+Hc(Ee)],width:C(oe,$e)+4},qe),g?le.div({text:g,padding:[0,0,0,2],align:"right"}):le.div()}),le.div()}),u.length&&(le.div(r("Examples:")),u.forEach(k=>{k[0]=k[0].replace(/\$0/g,v)}),u.forEach(k=>{k[1]===""?le.div({text:k[0],padding:[0,2,0,2]}):le.div({text:k[0],padding:[0,2,0,2],width:C(u,$e)+4},{text:k[1]})}),le.div()),m.length>0){let k=m.map(ae=>ae.replace(/\$0/g,v)).join(`
20
+ `,le.div(`${k}`)}}if(l.length>1||l.length===1&&!l[0][2]){le.div(r("Commands:"));let k=t.getInternalMethods().getContext(),ae=k.commands.length?`${k.commands.join(" ")} `:"";t.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(l=l.sort((oe,se)=>oe[0].localeCompare(se[0]))),l.forEach(oe=>{let se=`${v} ${ae}${oe[0].replace(/^\$0 ?/,"")}`;le.span({text:se,padding:[0,2,0,2],width:A(l,$e,`${v}${ae}`)+4},{text:oe[1]});let Ee=[];oe[2]&&Ee.push(`[${r("default")}]`),oe[3]&&oe[3].length&&Ee.push(`[${r("aliases:")} ${oe[3].join(", ")}]`),oe[4]&&(typeof oe[4]=="string"?Ee.push(`[${r("deprecated: %s",oe[4])}]`):Ee.push(`[${r("deprecated")}]`)),Ee.length?le.div({text:Ee.join(" "),padding:[0,0,0,2],align:"right"}):le.div()}),le.div()}let Ge=(Object.keys(Y.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);ce=ce.filter(k=>!t.parsed.newAliases[k]&&Ge.every(ae=>(Y.alias[ae]||[]).indexOf(k)===-1));let Ze=r("Options:");te[Ze]||(te[Ze]=[]),$(ce,Y.alias,te,Ze);let z=k=>/^--/.test(Un(k)),xe=Object.keys(te).filter(k=>te[k].length>0).map(k=>{let ae=te[k].filter(_).map(oe=>{if(~Ge.indexOf(oe))return oe;for(let se=0,Ee;(Ee=Ge[se])!==void 0;se++)if(~(Y.alias[Ee]||[]).indexOf(oe))return Ee;return oe});return{groupName:k,normalizedKeys:ae}}).filter(({normalizedKeys:k})=>k.length>0).map(({groupName:k,normalizedKeys:ae})=>{let oe=ae.reduce((se,Ee)=>(se[Ee]=[Ee].concat(Y.alias[Ee]||[]).map(qe=>k===n.getPositionalGroupName()?qe:(/^[0-9]$/.test(qe)?~Y.boolean.indexOf(Ee)?"-":"--":qe.length>1?"--":"-")+qe).sort((qe,Oe)=>z(qe)===z(Oe)?0:z(qe)?1:-1).join(", "),se),{});return{groupName:k,normalizedKeys:ae,switches:oe}});if(xe.filter(({groupName:k})=>k!==n.getPositionalGroupName()).some(({normalizedKeys:k,switches:ae})=>!k.every(oe=>z(ae[oe])))&&xe.filter(({groupName:k})=>k!==n.getPositionalGroupName()).forEach(({normalizedKeys:k,switches:ae})=>{k.forEach(oe=>{z(ae[oe])&&(ae[oe]=hg(ae[oe],4))})}),xe.forEach(({groupName:k,normalizedKeys:ae,switches:oe})=>{le.div(k),ae.forEach(se=>{let Ee=oe[se],qe=d[se]||"",Oe=null;~qe.lastIndexOf(P)&&(qe=r(qe.substring(P.length))),~Y.boolean.indexOf(se)&&(Oe=`[${r("boolean")}]`),~Y.count.indexOf(se)&&(Oe=`[${r("count")}]`),~Y.string.indexOf(se)&&(Oe=`[${r("string")}]`),~Y.normalize.indexOf(se)&&(Oe=`[${r("string")}]`),~Y.array.indexOf(se)&&(Oe=`[${r("array")}]`),~Y.number.indexOf(se)&&(Oe=`[${r("number")}]`);let fo=b=>typeof b=="string"?`[${r("deprecated: %s",b)}]`:`[${r("deprecated")}]`,g=[se in ne?fo(ne[se]):null,Oe,se in M?`[${r("required")}]`:null,Y.choices&&Y.choices[se]?`[${r("choices:")} ${n.stringifiedValues(Y.choices[se])}]`:null,J(Y.default[se],Y.defaultDescription[se])].filter(Boolean).join(" ");le.span({text:Un(Ee),padding:[0,2,0,2+Hc(Ee)],width:A(oe,$e)+4},qe),g?le.div({text:g,padding:[0,0,0,2],align:"right"}):le.div()}),le.div()}),u.length&&(le.div(r("Examples:")),u.forEach(k=>{k[0]=k[0].replace(/\$0/g,v)}),u.forEach(k=>{k[1]===""?le.div({text:k[0],padding:[0,2,0,2]}):le.div({text:k[0],padding:[0,2,0,2],width:A(u,$e)+4},{text:k[1]})}),le.div()),m.length>0){let k=m.map(ae=>ae.replace(/\$0/g,v)).join(`
21
21
  `);le.div(`${k}
22
- `)}return le.toString().replace(/\s*$/,"")};function C(I,v,M){let U=0;return Array.isArray(I)||(I=Object.values(I).map(ne=>[ne])),I.forEach(ne=>{U=Math.max(e.stringWidth(M?`${M} ${Un(ne[0])}`:Un(ne[0]))+Hc(ne[0]),U)}),v&&(U=Math.min(U,parseInt((v*.5).toString(),10))),U}function A(){let I=t.getDemandedOptions(),v=t.getOptions();(Object.keys(v.alias)||[]).forEach(M=>{v.alias[M].forEach(U=>{d[U]&&n.describe(M,d[U]),U in I&&t.demandOption(M,I[U]),~v.boolean.indexOf(U)&&t.boolean(M),~v.count.indexOf(U)&&t.count(M),~v.string.indexOf(U)&&t.string(M),~v.normalize.indexOf(U)&&t.normalize(M),~v.array.indexOf(U)&&t.array(M),~v.number.indexOf(U)&&t.number(M)})})}let E;n.cacheHelpMessage=function(){E=this.help()},n.clearCachedHelpMessage=function(){E=void 0},n.hasCachedHelpMessage=function(){return!!E};function $(I,v,M,U){let ne=[],te=null;return Object.keys(M).forEach(Y=>{ne=ne.concat(M[Y])}),I.forEach(Y=>{te=[Y].concat(v[Y]),te.some(ce=>ne.indexOf(ce)!==-1)||M[U].push(Y)}),ne}function _(I){return t.getOptions().hiddenOptions.indexOf(I)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}n.showHelp=I=>{let v=t.getInternalMethods().getLoggerInstance();I||(I="error"),(typeof I=="function"?I:v[I])(n.help())},n.functionDescription=I=>["(",I.name?e.Parser.decamelize(I.name,"-"):r("generated-value"),")"].join(""),n.stringifiedValues=function(v,M){let U="",ne=M||", ",te=[].concat(v);return!v||!te.length||te.forEach(Y=>{U.length&&(U+=ne),U+=JSON.stringify(Y)}),U};function J(I,v){let M=`[${r("default:")} `;if(I===void 0&&!v)return null;if(v)M+=v;else switch(typeof I){case"string":M+=`"${I}"`;break;case"object":M+=JSON.stringify(I);break;default:M+=I}return`${M}]`}function ie(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let V=null;n.version=I=>{V=I},n.showVersion=I=>{let v=t.getInternalMethods().getLoggerInstance();I||(I="error"),(typeof I=="function"?I:v[I])(V)},n.reset=function(v){return s=null,a=!1,c=[],p=!1,m=[],u=[],l=[],d=_t(d,M=>!v[M]),n};let De=[];return n.freeze=function(){De.push({failMessage:s,failureOutput:a,usages:c,usageDisabled:p,epilogs:m,examples:u,commands:l,descriptions:d})},n.unfreeze=function(){let v=De.pop();v&&({failMessage:s,failureOutput:a,usages:c,usageDisabled:p,epilogs:m,examples:u,commands:l,descriptions:d}=v)},n}function rs(t){return typeof t=="object"}function hg(t,e){return rs(t)?{text:t.text,indentation:t.indentation+e}:{text:t,indentation:e}}function Hc(t){return rs(t)?t.indentation:0}function Un(t){return rs(t)?t.text:t}var Kc=`###-begin-{{app_name}}-completions-###
22
+ `)}return le.toString().replace(/\s*$/,"")};function A(I,v,M){let U=0;return Array.isArray(I)||(I=Object.values(I).map(ne=>[ne])),I.forEach(ne=>{U=Math.max(e.stringWidth(M?`${M} ${Un(ne[0])}`:Un(ne[0]))+Hc(ne[0]),U)}),v&&(U=Math.min(U,parseInt((v*.5).toString(),10))),U}function x(){let I=t.getDemandedOptions(),v=t.getOptions();(Object.keys(v.alias)||[]).forEach(M=>{v.alias[M].forEach(U=>{d[U]&&n.describe(M,d[U]),U in I&&t.demandOption(M,I[U]),~v.boolean.indexOf(U)&&t.boolean(M),~v.count.indexOf(U)&&t.count(M),~v.string.indexOf(U)&&t.string(M),~v.normalize.indexOf(U)&&t.normalize(M),~v.array.indexOf(U)&&t.array(M),~v.number.indexOf(U)&&t.number(M)})})}let E;n.cacheHelpMessage=function(){E=this.help()},n.clearCachedHelpMessage=function(){E=void 0},n.hasCachedHelpMessage=function(){return!!E};function $(I,v,M,U){let ne=[],te=null;return Object.keys(M).forEach(Y=>{ne=ne.concat(M[Y])}),I.forEach(Y=>{te=[Y].concat(v[Y]),te.some(ce=>ne.indexOf(ce)!==-1)||M[U].push(Y)}),ne}function _(I){return t.getOptions().hiddenOptions.indexOf(I)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}n.showHelp=I=>{let v=t.getInternalMethods().getLoggerInstance();I||(I="error"),(typeof I=="function"?I:v[I])(n.help())},n.functionDescription=I=>["(",I.name?e.Parser.decamelize(I.name,"-"):r("generated-value"),")"].join(""),n.stringifiedValues=function(v,M){let U="",ne=M||", ",te=[].concat(v);return!v||!te.length||te.forEach(Y=>{U.length&&(U+=ne),U+=JSON.stringify(Y)}),U};function J(I,v){let M=`[${r("default:")} `;if(I===void 0&&!v)return null;if(v)M+=v;else switch(typeof I){case"string":M+=`"${I}"`;break;case"object":M+=JSON.stringify(I);break;default:M+=I}return`${M}]`}function ie(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let V=null;n.version=I=>{V=I},n.showVersion=I=>{let v=t.getInternalMethods().getLoggerInstance();I||(I="error"),(typeof I=="function"?I:v[I])(V)},n.reset=function(v){return s=null,a=!1,c=[],p=!1,m=[],u=[],l=[],d=_t(d,M=>!v[M]),n};let De=[];return n.freeze=function(){De.push({failMessage:s,failureOutput:a,usages:c,usageDisabled:p,epilogs:m,examples:u,commands:l,descriptions:d})},n.unfreeze=function(){let v=De.pop();v&&({failMessage:s,failureOutput:a,usages:c,usageDisabled:p,epilogs:m,examples:u,commands:l,descriptions:d}=v)},n}function rs(t){return typeof t=="object"}function hg(t,e){return rs(t)?{text:t.text,indentation:t.indentation+e}:{text:t,indentation:e}}function Hc(t){return rs(t)?t.indentation:0}function Un(t){return rs(t)?t.text:t}var Kc=`###-begin-{{app_name}}-completions-###
23
23
  #
24
24
  # yargs command completion script
25
25
  #
@@ -66,49 +66,49 @@ _{{app_name}}_yargs_completions()
66
66
  }
67
67
  compdef _{{app_name}}_yargs_completions {{app_name}}
68
68
  ###-end-{{app_name}}-completions-###
69
- `;var ns=class{constructor(e,r,n,o){var s,i,a;this.yargs=e,this.usage=r,this.command=n,this.shim=o,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=(a=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((i=this.shim.getEnv("ZSH_NAME"))===null||i===void 0?void 0:i.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(e,r,n,o){let s=this.command.getCommandHandlers();for(let a=0,c=e.length;a<c;++a)if(s[e[a]]&&s[e[a]].builder){let p=s[e[a]].builder;if(kn(p)){let u=this.yargs.getInternalMethods().reset();return p(u,!0),u.argv}}let i=[];this.commandCompletions(i,e,n),this.optionCompletions(i,e,r,n),o(null,i)}commandCompletions(e,r,n){let o=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&o[o.length-1]!==n&&this.usage.getCommands().forEach(s=>{let i=It(s[0]).cmd;if(r.indexOf(i)===-1)if(!this.zshShell)e.push(i);else{let a=s[1]||"";e.push(i.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(e,r,n,o){if(o.match(/^-/)||o===""&&e.length===0){let s=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(a=>{let c=!!s.configuration["boolean-negation"]&&s.boolean.includes(a);!i.includes(a)&&!this.argsContainKey(r,n,a,c)&&(this.completeOptionKey(a,e,o),c&&s.default[a]&&this.completeOptionKey(`no-${a}`,e,o))})}}argsContainKey(e,r,n,o){if(e.indexOf(`--${n}`)!==-1||o&&e.indexOf(`--no-${n}`)!==-1)return!0;if(this.aliases){for(let s of this.aliases[n])if(r[s]!==void 0)return!0}return!1}completeOptionKey(e,r,n){let o=this.usage.getDescriptions(),s=c=>/^--/.test(c),i=c=>/^[^0-9]$/.test(c),a=!s(n)&&i(e)?"-":"--";if(!this.zshShell)r.push(a+e);else{let c=o[e]||"";r.push(a+`${e.replace(/:/g,"\\:")}:${c.replace("__yargsString__:","")}`)}}customCompletion(e,r,n,o){if(Ue(this.customCompletionFunction,null,this.shim),yg(this.customCompletionFunction)){let s=this.customCompletionFunction(n,r);return he(s)?s.then(i=>{this.shim.process.nextTick(()=>{o(null,i)})}).catch(i=>{this.shim.process.nextTick(()=>{o(i,void 0)})}):o(null,s)}else return bg(this.customCompletionFunction)?this.customCompletionFunction(n,r,(s=o)=>this.defaultCompletion(e,r,n,s),s=>{o(null,s)}):this.customCompletionFunction(n,r,s=>{o(null,s)})}getCompletion(e,r){let n=e.length?e[e.length-1]:"",o=this.yargs.parse(e,!0),s=this.customCompletionFunction?i=>this.customCompletion(e,i,n,r):i=>this.defaultCompletion(e,i,n,r);return he(o)?o.then(s):s(o)}generateCompletionScript(e,r){let n=this.zshShell?Jc:Kc,o=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,o),n=n.replace(/{{completion_command}}/g,r),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function Xc(t,e,r,n){return new ns(t,e,r,n)}function yg(t){return t.length<3}function bg(t){return t.length>3}function Zc(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],n;for(n=0;n<=e.length;n++)r[n]=[n];let o;for(o=0;o<=t.length;o++)r[0][o]=o;for(n=1;n<=e.length;n++)for(o=1;o<=t.length;o++)e.charAt(n-1)===t.charAt(o-1)?r[n][o]=r[n-1][o-1]:r[n][o]=Math.min(r[n-1][o-1]+1,Math.min(r[n][o-1]+1,r[n-1][o]+1));return r[e.length][t.length]}var Qc=["$0","--","_"];function el(t,e,r){let n=r.y18n.__,o=r.y18n.__n,s={};s.nonOptionCount=function(l){let d=t.getDemandedCommands(),w=l._.length+(l["--"]?l["--"].length:0)-t.getInternalMethods().getContext().commands.length;d._&&(w<d._.min||w>d._.max)&&(w<d._.min?d._.minMsg!==void 0?e.fail(d._.minMsg?d._.minMsg.replace(/\$0/g,w.toString()).replace(/\$1/,d._.min.toString()):null):e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",w,w.toString(),d._.min.toString())):w>d._.max&&(d._.maxMsg!==void 0?e.fail(d._.maxMsg?d._.maxMsg.replace(/\$0/g,w.toString()).replace(/\$1/,d._.max.toString()):null):e.fail(o("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",w,w.toString(),d._.max.toString()))))},s.positionalCount=function(l,d){d<l&&e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",d,d+"",l+""))},s.requiredArguments=function(l,d){let m=null;for(let w of Object.keys(d))(!Object.prototype.hasOwnProperty.call(l,w)||typeof l[w]>"u")&&(m=m||{},m[w]=d[w]);if(m){let w=[];for(let x of Object.keys(m)){let P=m[x];P&&w.indexOf(P)<0&&w.push(P)}let h=w.length?`
69
+ `;var ns=class{constructor(e,r,n,o){var s,i,a;this.yargs=e,this.usage=r,this.command=n,this.shim=o,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=(a=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((i=this.shim.getEnv("ZSH_NAME"))===null||i===void 0?void 0:i.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(e,r,n,o){let s=this.command.getCommandHandlers();for(let a=0,c=e.length;a<c;++a)if(s[e[a]]&&s[e[a]].builder){let p=s[e[a]].builder;if(kn(p)){let u=this.yargs.getInternalMethods().reset();return p(u,!0),u.argv}}let i=[];this.commandCompletions(i,e,n),this.optionCompletions(i,e,r,n),o(null,i)}commandCompletions(e,r,n){let o=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&o[o.length-1]!==n&&this.usage.getCommands().forEach(s=>{let i=It(s[0]).cmd;if(r.indexOf(i)===-1)if(!this.zshShell)e.push(i);else{let a=s[1]||"";e.push(i.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(e,r,n,o){if(o.match(/^-/)||o===""&&e.length===0){let s=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(a=>{let c=!!s.configuration["boolean-negation"]&&s.boolean.includes(a);!i.includes(a)&&!this.argsContainKey(r,n,a,c)&&(this.completeOptionKey(a,e,o),c&&s.default[a]&&this.completeOptionKey(`no-${a}`,e,o))})}}argsContainKey(e,r,n,o){if(e.indexOf(`--${n}`)!==-1||o&&e.indexOf(`--no-${n}`)!==-1)return!0;if(this.aliases){for(let s of this.aliases[n])if(r[s]!==void 0)return!0}return!1}completeOptionKey(e,r,n){let o=this.usage.getDescriptions(),s=c=>/^--/.test(c),i=c=>/^[^0-9]$/.test(c),a=!s(n)&&i(e)?"-":"--";if(!this.zshShell)r.push(a+e);else{let c=o[e]||"";r.push(a+`${e.replace(/:/g,"\\:")}:${c.replace("__yargsString__:","")}`)}}customCompletion(e,r,n,o){if(Ue(this.customCompletionFunction,null,this.shim),yg(this.customCompletionFunction)){let s=this.customCompletionFunction(n,r);return he(s)?s.then(i=>{this.shim.process.nextTick(()=>{o(null,i)})}).catch(i=>{this.shim.process.nextTick(()=>{o(i,void 0)})}):o(null,s)}else return bg(this.customCompletionFunction)?this.customCompletionFunction(n,r,(s=o)=>this.defaultCompletion(e,r,n,s),s=>{o(null,s)}):this.customCompletionFunction(n,r,s=>{o(null,s)})}getCompletion(e,r){let n=e.length?e[e.length-1]:"",o=this.yargs.parse(e,!0),s=this.customCompletionFunction?i=>this.customCompletion(e,i,n,r):i=>this.defaultCompletion(e,i,n,r);return he(o)?o.then(s):s(o)}generateCompletionScript(e,r){let n=this.zshShell?Jc:Kc,o=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,o),n=n.replace(/{{completion_command}}/g,r),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function Xc(t,e,r,n){return new ns(t,e,r,n)}function yg(t){return t.length<3}function bg(t){return t.length>3}function Zc(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],n;for(n=0;n<=e.length;n++)r[n]=[n];let o;for(o=0;o<=t.length;o++)r[0][o]=o;for(n=1;n<=e.length;n++)for(o=1;o<=t.length;o++)e.charAt(n-1)===t.charAt(o-1)?r[n][o]=r[n-1][o-1]:r[n][o]=Math.min(r[n-1][o-1]+1,Math.min(r[n][o-1]+1,r[n-1][o]+1));return r[e.length][t.length]}var Qc=["$0","--","_"];function el(t,e,r){let n=r.y18n.__,o=r.y18n.__n,s={};s.nonOptionCount=function(l){let d=t.getDemandedCommands(),w=l._.length+(l["--"]?l["--"].length:0)-t.getInternalMethods().getContext().commands.length;d._&&(w<d._.min||w>d._.max)&&(w<d._.min?d._.minMsg!==void 0?e.fail(d._.minMsg?d._.minMsg.replace(/\$0/g,w.toString()).replace(/\$1/,d._.min.toString()):null):e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",w,w.toString(),d._.min.toString())):w>d._.max&&(d._.maxMsg!==void 0?e.fail(d._.maxMsg?d._.maxMsg.replace(/\$0/g,w.toString()).replace(/\$1/,d._.max.toString()):null):e.fail(o("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",w,w.toString(),d._.max.toString()))))},s.positionalCount=function(l,d){d<l&&e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",d,d+"",l+""))},s.requiredArguments=function(l,d){let m=null;for(let w of Object.keys(d))(!Object.prototype.hasOwnProperty.call(l,w)||typeof l[w]>"u")&&(m=m||{},m[w]=d[w]);if(m){let w=[];for(let C of Object.keys(m)){let P=m[C];P&&w.indexOf(P)<0&&w.push(P)}let h=w.length?`
70
70
  ${w.join(`
71
- `)}`:"";e.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(m).length,Object.keys(m).join(", ")+h))}},s.unknownArguments=function(l,d,m,w,h=!0){let x=t.getInternalMethods().getCommandInstance().getCommands(),P=[],C=t.getInternalMethods().getContext();Object.keys(l).forEach(A=>{Qc.indexOf(A)===-1&&!Object.prototype.hasOwnProperty.call(m,A)&&!Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),A)&&!s.isValidAndSomeAliasIsNotNew(A,d)&&P.push(A)}),h&&(C.commands.length>0||x.length>0||w)&&l._.slice(C.commands.length).forEach(A=>{x.indexOf(""+A)===-1&&P.push(""+A)}),P.length>0&&e.fail(o("Unknown argument: %s","Unknown arguments: %s",P.length,P.join(", ")))},s.unknownCommands=function(l){let d=t.getInternalMethods().getCommandInstance().getCommands(),m=[],w=t.getInternalMethods().getContext();return(w.commands.length>0||d.length>0)&&l._.slice(w.commands.length).forEach(h=>{d.indexOf(""+h)===-1&&m.push(""+h)}),m.length>0?(e.fail(o("Unknown command: %s","Unknown commands: %s",m.length,m.join(", "))),!0):!1},s.isValidAndSomeAliasIsNotNew=function(l,d){if(!Object.prototype.hasOwnProperty.call(d,l))return!1;let m=t.parsed.newAliases;return[l,...d[l]].some(w=>!Object.prototype.hasOwnProperty.call(m,w)||!m[l])},s.limitedChoices=function(l){let d=t.getOptions(),m={};if(!Object.keys(d.choices).length)return;Object.keys(l).forEach(x=>{Qc.indexOf(x)===-1&&Object.prototype.hasOwnProperty.call(d.choices,x)&&[].concat(l[x]).forEach(P=>{d.choices[x].indexOf(P)===-1&&P!==void 0&&(m[x]=(m[x]||[]).concat(P))})});let w=Object.keys(m);if(!w.length)return;let h=n("Invalid values:");w.forEach(x=>{h+=`
72
- ${n("Argument: %s, Given: %s, Choices: %s",x,e.stringifiedValues(m[x]),e.stringifiedValues(d.choices[x]))}`}),e.fail(h)};let i={};s.implies=function(l,d){L("<string|object> [array|number|string]",[l,d],arguments.length),typeof l=="object"?Object.keys(l).forEach(m=>{s.implies(m,l[m])}):(t.global(l),i[l]||(i[l]=[]),Array.isArray(d)?d.forEach(m=>s.implies(l,m)):(Ue(d,void 0,r),i[l].push(d)))},s.getImplied=function(){return i};function a(u,l){let d=Number(l);return l=isNaN(d)?l:d,typeof l=="number"?l=u._.length>=l:l.match(/^--no-.+/)?(l=l.match(/^--no-(.+)/)[1],l=!u[l]):l=u[l],l}s.implications=function(l){let d=[];if(Object.keys(i).forEach(m=>{let w=m;(i[m]||[]).forEach(h=>{let x=w,P=h;x=a(l,x),h=a(l,h),x&&!h&&d.push(` ${w} -> ${P}`)})}),d.length){let m=`${n("Implications failed:")}
73
- `;d.forEach(w=>{m+=w}),e.fail(m)}};let c={};s.conflicts=function(l,d){L("<string|object> [array|string]",[l,d],arguments.length),typeof l=="object"?Object.keys(l).forEach(m=>{s.conflicts(m,l[m])}):(t.global(l),c[l]||(c[l]=[]),Array.isArray(d)?d.forEach(m=>s.conflicts(l,m)):c[l].push(d))},s.getConflicting=()=>c,s.conflicting=function(l){Object.keys(l).forEach(d=>{c[d]&&c[d].forEach(m=>{m&&l[d]!==void 0&&l[m]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",d,m))})})},s.recommendCommands=function(l,d){d=d.sort((x,P)=>P.length-x.length);let w=null,h=1/0;for(let x=0,P;(P=d[x])!==void 0;x++){let C=Zc(l,P);C<=3&&C<h&&(h=C,w=P)}w&&e.fail(n("Did you mean %s?",w))},s.reset=function(l){return i=_t(i,d=>!l[d]),c=_t(c,d=>!l[d]),s};let p=[];return s.freeze=function(){p.push({implied:i,conflicting:c})},s.unfreeze=function(){let l=p.pop();Ue(l,void 0,r),{implied:i,conflicting:c}=l},s}var os=[],Hr;function Yr(t,e,r,n){Hr=n;let o={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return o;let s=/\.json|\..*rc$/.test(t.extends),i=null;if(s)i=wg(e,t.extends);else try{i=We.resolve(t.extends)}catch{return t}Sg(i),os.push(i),o=s?JSON.parse(Hr.readFileSync(i,"utf8")):We(t.extends),delete t.extends,o=Yr(o,Hr.path.dirname(i),r,Hr)}return os=[],r?tl(o,t):Object.assign({},o,t)}function Sg(t){if(os.indexOf(t)>-1)throw new me(`Circular extended configurations: '${t}'.`)}function wg(t,e){return Hr.path.resolve(t,e)}function tl(t,e){let r={};function n(o){return o&&typeof o=="object"&&!Array.isArray(o)}Object.assign(r,t);for(let o of Object.keys(e))n(e[o])&&n(r[o])?r[o]=tl(t[o],e[o]):r[o]=e[o];return r}var F=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r},f=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},we,Gt,Kr,it,Ke,qn,jt,Ht,at,Wn,ct,St,Je,lt,yr,Re,q,zn,Vn,Xe,Yt,br,Kt,Dt,Bn,K,Jt,Xt,Zt,X,At,be;function bl(t){return(e=[],r=t.process.cwd(),n)=>{let o=new hs(e,r,n,t);return Object.defineProperty(o,"argv",{get:()=>o.parse(),enumerable:!0}),o.help(),o.version(),o}}var rl=Symbol("copyDoubleDash"),nl=Symbol("copyDoubleDash"),ss=Symbol("deleteFromParserHintObject"),ol=Symbol("freeze"),sl=Symbol("getDollarZero"),Qt=Symbol("getParserConfiguration"),is=Symbol("guessLocale"),il=Symbol("guessVersion"),al=Symbol("parsePositionalNumbers"),as=Symbol("pkgUp"),Nt=Symbol("populateParserHintArray"),Sr=Symbol("populateParserHintSingleValueDictionary"),cs=Symbol("populateParserHintArrayDictionary"),ls=Symbol("populateParserHintDictionary"),ps=Symbol("sanitizeKey"),us=Symbol("setKey"),fs=Symbol("unfreeze"),cl=Symbol("validateAsync"),ll=Symbol("getCommandInstance"),pl=Symbol("getContext"),ul=Symbol("getHasOutput"),fl=Symbol("getLoggerInstance"),ml=Symbol("getParseContext"),dl=Symbol("getUsageInstance"),hl=Symbol("getValidationInstance"),Gn=Symbol("hasParseCallback"),er=Symbol("postProcess"),gl=Symbol("rebase"),ms=Symbol("reset"),Jr=Symbol("runYargsParserAndExecuteCommands"),ds=Symbol("runValidation"),yl=Symbol("setHasOutput"),hs=class{constructor(e=[],r,n,o){this.customScriptName=!1,this.parsed=!1,we.set(this,void 0),Gt.set(this,void 0),Kr.set(this,{commands:[],fullCommands:[]}),it.set(this,null),Ke.set(this,null),qn.set(this,"show-hidden"),jt.set(this,null),Ht.set(this,!0),at.set(this,!0),Wn.set(this,[]),ct.set(this,void 0),St.set(this,{}),Je.set(this,!1),lt.set(this,null),yr.set(this,void 0),Re.set(this,""),q.set(this,void 0),zn.set(this,void 0),Vn.set(this,{}),Xe.set(this,null),Yt.set(this,null),br.set(this,{}),Kt.set(this,{}),Dt.set(this,void 0),Bn.set(this,!1),K.set(this,void 0),Jt.set(this,!1),Xt.set(this,!1),Zt.set(this,!1),X.set(this,void 0),At.set(this,null),be.set(this,void 0),F(this,K,o),F(this,Dt,e),F(this,Gt,r),F(this,zn,n),F(this,ct,new Fn(this)),this.$0=this[sl](),this[ms](),F(this,we,f(this,we)),F(this,X,f(this,X)),F(this,be,f(this,be)),F(this,q,f(this,q)),f(this,q).showHiddenOpt=f(this,qn),F(this,yr,this[nl]())}addHelpOpt(e,r){let n="help";return L("[string|boolean] [string]",[e,r],arguments.length),f(this,lt)&&(this[ss](f(this,lt)),F(this,lt,null)),e===!1&&r===void 0?this:(F(this,lt,typeof e=="string"?e:n),this.boolean(f(this,lt)),this.describe(f(this,lt),r||f(this,X).deferY18nLookup("Show help")),this)}help(e,r){return this.addHelpOpt(e,r)}addShowHiddenOpt(e,r){if(L("[string|boolean] [string]",[e,r],arguments.length),e===!1&&r===void 0)return this;let n=typeof e=="string"?e:f(this,qn);return this.boolean(n),this.describe(n,r||f(this,X).deferY18nLookup("Show hidden options")),f(this,q).showHiddenOpt=n,this}showHidden(e,r){return this.addShowHiddenOpt(e,r)}alias(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[cs](this.alias.bind(this),"alias",e,r),this}array(e){return L("<array|string>",[e],arguments.length),this[Nt]("array",e),this}boolean(e){return L("<array|string>",[e],arguments.length),this[Nt]("boolean",e),this}check(e,r){return L("<function> [boolean]",[e,r],arguments.length),this.middleware((n,o)=>Bt(()=>e(n),s=>(s?(typeof s=="string"||s instanceof Error)&&f(this,X).fail(s.toString(),s):f(this,X).fail(f(this,K).y18n.__("Argument check failed: %s",e.toString())),n),s=>(f(this,X).fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[cs](this.choices.bind(this),"choices",e,r),this}coerce(e,r){if(L("<object|string|array> [function]",[e,r],arguments.length),Array.isArray(e)){if(!r)throw new me("coerce callback must be provided");for(let n of e)this.coerce(n,r);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!r)throw new me("coerce callback must be provided");return f(this,q).key[e]=!0,f(this,ct).addCoerceMiddleware((n,o)=>{let s;return Bt(()=>(s=o.getAliases(),r(n[e])),i=>{if(n[e]=i,s[e])for(let a of s[e])n[a]=i;return n},i=>{throw new me(i.message)})},e),this}conflicts(e,r){return L("<string|object> [string|array]",[e,r],arguments.length),f(this,be).conflicts(e,r),this}config(e="config",r,n){return L("[object|string] [string|function] [function]",[e,r,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Yr(e,f(this,Gt),this[Qt]()["deep-merge-config"]||!1,f(this,K)),f(this,q).configObjects=(f(this,q).configObjects||[]).concat(e),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(e,r||f(this,X).deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(o=>{f(this,q).config[o]=n||!0}),this)}completion(e,r,n){return L("[string] [string|boolean|function] [function]",[e,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),F(this,Ke,e||f(this,Ke)||"completion"),!r&&r!==!1&&(r="generate completion script"),this.command(f(this,Ke),r),n&&f(this,it).registerFunction(n),this}command(e,r,n,o,s,i){return L("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,r,n,o,s,i],arguments.length),f(this,we).addHandler(e,r,n,o,s,i),this}commands(e,r,n,o,s,i){return this.command(e,r,n,o,s,i)}commandDir(e,r){L("<string> [object]",[e,r],arguments.length);let n=f(this,zn)||f(this,K).require;return f(this,we).addDirectory(e,n,f(this,K).getCallerFile(),r),this}count(e){return L("<array|string>",[e],arguments.length),this[Nt]("count",e),this}default(e,r,n){return L("<object|string|array> [*] [string]",[e,r,n],arguments.length),n&&(Qo(e,f(this,K)),f(this,q).defaultDescription[e]=n),typeof r=="function"&&(Qo(e,f(this,K)),f(this,q).defaultDescription[e]||(f(this,q).defaultDescription[e]=f(this,X).functionDescription(r)),r=r.call()),this[Sr](this.default.bind(this),"default",e,r),this}defaults(e,r,n){return this.default(e,r,n)}demandCommand(e=1,r,n,o){return L("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,r,n,o],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),f(this,q).demandedCommands._={min:e,max:r,minMsg:n,maxMsg:o},this}demand(e,r,n){return Array.isArray(r)?(r.forEach(o=>{Ue(n,!0,f(this,K)),this.demandOption(o,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof e=="number"?(Ue(n,!0,f(this,K)),this.demandCommand(e,r,n,n)):Array.isArray(e)?e.forEach(o=>{Ue(n,!0,f(this,K)),this.demandOption(o,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[Sr](this.demandOption.bind(this),"demandedOptions",e,r),this}deprecateOption(e,r){return L("<string> [string|boolean]",[e,r],arguments.length),f(this,q).deprecatedOptions[e]=r,this}describe(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[us](e,!0),f(this,X).describe(e,r),this}detectLocale(e){return L("<boolean>",[e],arguments.length),F(this,Ht,e),this}env(e){return L("[string|boolean]",[e],arguments.length),e===!1?delete f(this,q).envPrefix:f(this,q).envPrefix=e||"",this}epilogue(e){return L("<string>",[e],arguments.length),f(this,X).epilog(e),this}epilog(e){return this.epilogue(e)}example(e,r){return L("<string|array> [string]",[e,r],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):f(this,X).example(e,r),this}exit(e,r){F(this,Je,!0),F(this,jt,r),f(this,at)&&f(this,K).process.exit(e)}exitProcess(e=!0){return L("[boolean]",[e],arguments.length),F(this,at,e),this}fail(e){if(L("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new me("Invalid first argument. Expected function or boolean 'false'");return f(this,X).failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,r){return L("<array> [function]",[e,r],arguments.length),r?f(this,it).getCompletion(e,r):new Promise((n,o)=>{f(this,it).getCompletion(e,(s,i)=>{s?o(s):n(i)})})}getDemandedOptions(){return L([],0),f(this,q).demandedOptions}getDemandedCommands(){return L([],0),f(this,q).demandedCommands}getDeprecatedOptions(){return L([],0),f(this,q).deprecatedOptions}getDetectLocale(){return f(this,Ht)}getExitProcess(){return f(this,at)}getGroups(){return Object.assign({},f(this,St),f(this,Kt))}getHelp(){if(F(this,Je,!0),!f(this,X).hasCachedHelpMessage()){if(!this.parsed){let r=this[Jr](f(this,Dt),void 0,void 0,0,!0);if(he(r))return r.then(()=>f(this,X).help())}let e=f(this,we).runDefaultBuilderOn(this);if(he(e))return e.then(()=>f(this,X).help())}return Promise.resolve(f(this,X).help())}getOptions(){return f(this,q)}getStrict(){return f(this,Jt)}getStrictCommands(){return f(this,Xt)}getStrictOptions(){return f(this,Zt)}global(e,r){return L("<string|array> [boolean]",[e,r],arguments.length),e=[].concat(e),r!==!1?f(this,q).local=f(this,q).local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{f(this,q).local.indexOf(n)===-1&&f(this,q).local.push(n)}),this}group(e,r){L("<string|array> <string>",[e,r],arguments.length);let n=f(this,Kt)[r]||f(this,St)[r];f(this,Kt)[r]&&delete f(this,Kt)[r];let o={};return f(this,St)[r]=(n||[]).concat(e).filter(s=>o[s]?!1:o[s]=!0),this}hide(e){return L("<string>",[e],arguments.length),f(this,q).hiddenOptions.push(e),this}implies(e,r){return L("<string|object> [number|string|array]",[e,r],arguments.length),f(this,be).implies(e,r),this}locale(e){return L("[string]",[e],arguments.length),e?(F(this,Ht,!1),f(this,K).y18n.setLocale(e),this):(this[is](),f(this,K).y18n.getLocale())}middleware(e,r,n){return f(this,ct).addMiddleware(e,!!r,n)}nargs(e,r){return L("<string|object|array> [number]",[e,r],arguments.length),this[Sr](this.nargs.bind(this),"narg",e,r),this}normalize(e){return L("<array|string>",[e],arguments.length),this[Nt]("normalize",e),this}number(e){return L("<array|string>",[e],arguments.length),this[Nt]("number",e),this}option(e,r){if(L("<string|object> [object]",[e,r],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof r!="object"&&(r={}),f(this,q).key[e]=!0,r.alias&&this.alias(e,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(e,n);let o=r.demand||r.required||r.require;o&&this.demand(e,o),r.demandOption&&this.demandOption(e,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(e,r.conflicts),"default"in r&&this.default(e,r.default),r.implies!==void 0&&this.implies(e,r.implies),r.nargs!==void 0&&this.nargs(e,r.nargs),r.config&&this.config(e,r.configParser),r.normalize&&this.normalize(e),r.choices&&this.choices(e,r.choices),r.coerce&&this.coerce(e,r.coerce),r.group&&this.group(e,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(e),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(e),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(e),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(e),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(e),typeof r.global=="boolean"&&this.global(e,r.global),r.defaultDescription&&(f(this,q).defaultDescription[e]=r.defaultDescription),r.skipValidation&&this.skipValidation(e);let s=r.describe||r.description||r.desc;this.describe(e,s),r.hidden&&this.hide(e),r.requiresArg&&this.requiresArg(e)}return this}options(e,r){return this.option(e,r)}parse(e,r,n){L("[string|array] [function|boolean|object] [function]",[e,r,n],arguments.length),this[ol](),typeof e>"u"&&(e=f(this,Dt)),typeof r=="object"&&(F(this,Yt,r),r=n),typeof r=="function"&&(F(this,Xe,r),r=!1),r||F(this,Dt,e),f(this,Xe)&&F(this,at,!1);let o=this[Jr](e,!!r),s=this.parsed;return f(this,it).setParsed(this.parsed),he(o)?o.then(i=>(f(this,Xe)&&f(this,Xe).call(this,f(this,jt),i,f(this,Re)),i)).catch(i=>{throw f(this,Xe)&&f(this,Xe)(i,this.parsed.argv,f(this,Re)),i}).finally(()=>{this[fs](),this.parsed=s}):(f(this,Xe)&&f(this,Xe).call(this,f(this,jt),o,f(this,Re)),this[fs](),this.parsed=s,o)}parseAsync(e,r,n){let o=this.parse(e,r,n);return he(o)?o:Promise.resolve(o)}parseSync(e,r,n){let o=this.parse(e,r,n);if(he(o))throw new me(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(e){return L("<object>",[e],arguments.length),F(this,Vn,e),this}pkgConf(e,r){L("<string> [string]",[e,r],arguments.length);let n=null,o=this[as](r||f(this,Gt));return o[e]&&typeof o[e]=="object"&&(n=Yr(o[e],r||f(this,Gt),this[Qt]()["deep-merge-config"]||!1,f(this,K)),f(this,q).configObjects=(f(this,q).configObjects||[]).concat(n)),this}positional(e,r){L("<string> <object>",[e,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=_t(r,(i,a)=>{let c=n.indexOf(i)!==-1;return i==="type"&&["string","number","boolean"].indexOf(a)===-1&&(c=!1),c});let o=f(this,Kr).fullCommands[f(this,Kr).fullCommands.length-1],s=o?f(this,we).cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return hr(s).forEach(i=>{let a=s[i];Array.isArray(a)?a.indexOf(e)!==-1&&(r[i]=!0):a[e]&&!(i in r)&&(r[i]=a[e])}),this.group(e,f(this,X).getPositionalGroupName()),this.option(e,r)}recommendCommands(e=!0){return L("[boolean]",[e],arguments.length),F(this,Bn,e),this}required(e,r,n){return this.demand(e,r,n)}require(e,r,n){return this.demand(e,r,n)}requiresArg(e){return L("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&f(this,q).narg[e]?this:(this[Sr](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,r){return L("[string] [string]",[e,r],arguments.length),e=e||this.$0,f(this,yr).log(f(this,it).generateCompletionScript(e,r||f(this,Ke)||"completion")),this}showHelp(e){if(L("[string|function]",[e],arguments.length),F(this,Je,!0),!f(this,X).hasCachedHelpMessage()){if(!this.parsed){let n=this[Jr](f(this,Dt),void 0,void 0,0,!0);if(he(n))return n.then(()=>{f(this,X).showHelp(e)}),this}let r=f(this,we).runDefaultBuilderOn(this);if(he(r))return r.then(()=>{f(this,X).showHelp(e)}),this}return f(this,X).showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,r){return L("[boolean|string] [string]",[e,r],arguments.length),f(this,X).showHelpOnFail(e,r),this}showVersion(e){return L("[string|function]",[e],arguments.length),f(this,X).showVersion(e),this}skipValidation(e){return L("<array|string>",[e],arguments.length),this[Nt]("skipValidation",e),this}strict(e){return L("[boolean]",[e],arguments.length),F(this,Jt,e!==!1),this}strictCommands(e){return L("[boolean]",[e],arguments.length),F(this,Xt,e!==!1),this}strictOptions(e){return L("[boolean]",[e],arguments.length),F(this,Zt,e!==!1),this}string(e){return L("<array|string>",[e],arguments.length),this[Nt]("string",e),this}terminalWidth(){return L([],0),f(this,K).process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return L("<object>",[e],arguments.length),F(this,Ht,!1),f(this,K).y18n.updateLocale(e),this}usage(e,r,n,o){if(L("<string|null|undefined> [string|boolean] [function|object] [function]",[e,r,n,o],arguments.length),r!==void 0){if(Ue(e,null,f(this,K)),(e||"").match(/^\$0( |$)/))return this.command(e,r,n,o);throw new me(".usage() description must start with $0 if being used as alias for .command()")}else return f(this,X).usage(e),this}version(e,r,n){let o="version";if(L("[boolean|string] [string] [string]",[e,r,n],arguments.length),f(this,At)&&(this[ss](f(this,At)),f(this,X).version(void 0),F(this,At,null)),arguments.length===0)n=this[il](),e=o;else if(arguments.length===1){if(e===!1)return this;n=e,e=o}else arguments.length===2&&(n=r,r=void 0);return F(this,At,typeof e=="string"?e:o),r=r||f(this,X).deferY18nLookup("Show version number"),f(this,X).version(n||void 0),this.boolean(f(this,At)),this.describe(f(this,At),r),this}wrap(e){return L("<number|null|undefined>",[e],arguments.length),f(this,X).wrap(e),this}[(we=new WeakMap,Gt=new WeakMap,Kr=new WeakMap,it=new WeakMap,Ke=new WeakMap,qn=new WeakMap,jt=new WeakMap,Ht=new WeakMap,at=new WeakMap,Wn=new WeakMap,ct=new WeakMap,St=new WeakMap,Je=new WeakMap,lt=new WeakMap,yr=new WeakMap,Re=new WeakMap,q=new WeakMap,zn=new WeakMap,Vn=new WeakMap,Xe=new WeakMap,Yt=new WeakMap,br=new WeakMap,Kt=new WeakMap,Dt=new WeakMap,Bn=new WeakMap,K=new WeakMap,Jt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,X=new WeakMap,At=new WeakMap,be=new WeakMap,rl)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[nl](){return{log:(...e)=>{this[Gn]()||console.log(...e),F(this,Je,!0),f(this,Re).length&&F(this,Re,f(this,Re)+`
71
+ `)}`:"";e.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(m).length,Object.keys(m).join(", ")+h))}},s.unknownArguments=function(l,d,m,w,h=!0){let C=t.getInternalMethods().getCommandInstance().getCommands(),P=[],A=t.getInternalMethods().getContext();Object.keys(l).forEach(x=>{Qc.indexOf(x)===-1&&!Object.prototype.hasOwnProperty.call(m,x)&&!Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),x)&&!s.isValidAndSomeAliasIsNotNew(x,d)&&P.push(x)}),h&&(A.commands.length>0||C.length>0||w)&&l._.slice(A.commands.length).forEach(x=>{C.indexOf(""+x)===-1&&P.push(""+x)}),P.length>0&&e.fail(o("Unknown argument: %s","Unknown arguments: %s",P.length,P.join(", ")))},s.unknownCommands=function(l){let d=t.getInternalMethods().getCommandInstance().getCommands(),m=[],w=t.getInternalMethods().getContext();return(w.commands.length>0||d.length>0)&&l._.slice(w.commands.length).forEach(h=>{d.indexOf(""+h)===-1&&m.push(""+h)}),m.length>0?(e.fail(o("Unknown command: %s","Unknown commands: %s",m.length,m.join(", "))),!0):!1},s.isValidAndSomeAliasIsNotNew=function(l,d){if(!Object.prototype.hasOwnProperty.call(d,l))return!1;let m=t.parsed.newAliases;return[l,...d[l]].some(w=>!Object.prototype.hasOwnProperty.call(m,w)||!m[l])},s.limitedChoices=function(l){let d=t.getOptions(),m={};if(!Object.keys(d.choices).length)return;Object.keys(l).forEach(C=>{Qc.indexOf(C)===-1&&Object.prototype.hasOwnProperty.call(d.choices,C)&&[].concat(l[C]).forEach(P=>{d.choices[C].indexOf(P)===-1&&P!==void 0&&(m[C]=(m[C]||[]).concat(P))})});let w=Object.keys(m);if(!w.length)return;let h=n("Invalid values:");w.forEach(C=>{h+=`
72
+ ${n("Argument: %s, Given: %s, Choices: %s",C,e.stringifiedValues(m[C]),e.stringifiedValues(d.choices[C]))}`}),e.fail(h)};let i={};s.implies=function(l,d){L("<string|object> [array|number|string]",[l,d],arguments.length),typeof l=="object"?Object.keys(l).forEach(m=>{s.implies(m,l[m])}):(t.global(l),i[l]||(i[l]=[]),Array.isArray(d)?d.forEach(m=>s.implies(l,m)):(Ue(d,void 0,r),i[l].push(d)))},s.getImplied=function(){return i};function a(u,l){let d=Number(l);return l=isNaN(d)?l:d,typeof l=="number"?l=u._.length>=l:l.match(/^--no-.+/)?(l=l.match(/^--no-(.+)/)[1],l=!u[l]):l=u[l],l}s.implications=function(l){let d=[];if(Object.keys(i).forEach(m=>{let w=m;(i[m]||[]).forEach(h=>{let C=w,P=h;C=a(l,C),h=a(l,h),C&&!h&&d.push(` ${w} -> ${P}`)})}),d.length){let m=`${n("Implications failed:")}
73
+ `;d.forEach(w=>{m+=w}),e.fail(m)}};let c={};s.conflicts=function(l,d){L("<string|object> [array|string]",[l,d],arguments.length),typeof l=="object"?Object.keys(l).forEach(m=>{s.conflicts(m,l[m])}):(t.global(l),c[l]||(c[l]=[]),Array.isArray(d)?d.forEach(m=>s.conflicts(l,m)):c[l].push(d))},s.getConflicting=()=>c,s.conflicting=function(l){Object.keys(l).forEach(d=>{c[d]&&c[d].forEach(m=>{m&&l[d]!==void 0&&l[m]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",d,m))})})},s.recommendCommands=function(l,d){d=d.sort((C,P)=>P.length-C.length);let w=null,h=1/0;for(let C=0,P;(P=d[C])!==void 0;C++){let A=Zc(l,P);A<=3&&A<h&&(h=A,w=P)}w&&e.fail(n("Did you mean %s?",w))},s.reset=function(l){return i=_t(i,d=>!l[d]),c=_t(c,d=>!l[d]),s};let p=[];return s.freeze=function(){p.push({implied:i,conflicting:c})},s.unfreeze=function(){let l=p.pop();Ue(l,void 0,r),{implied:i,conflicting:c}=l},s}var os=[],Hr;function Yr(t,e,r,n){Hr=n;let o={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return o;let s=/\.json|\..*rc$/.test(t.extends),i=null;if(s)i=wg(e,t.extends);else try{i=We.resolve(t.extends)}catch{return t}Sg(i),os.push(i),o=s?JSON.parse(Hr.readFileSync(i,"utf8")):We(t.extends),delete t.extends,o=Yr(o,Hr.path.dirname(i),r,Hr)}return os=[],r?tl(o,t):Object.assign({},o,t)}function Sg(t){if(os.indexOf(t)>-1)throw new me(`Circular extended configurations: '${t}'.`)}function wg(t,e){return Hr.path.resolve(t,e)}function tl(t,e){let r={};function n(o){return o&&typeof o=="object"&&!Array.isArray(o)}Object.assign(r,t);for(let o of Object.keys(e))n(e[o])&&n(r[o])?r[o]=tl(t[o],e[o]):r[o]=e[o];return r}var F=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r},f=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},we,Gt,Kr,it,Ke,qn,jt,Ht,at,Wn,ct,St,Je,lt,yr,Re,q,zn,Vn,Xe,Yt,br,Kt,Dt,Bn,K,Jt,Xt,Zt,X,xt,be;function bl(t){return(e=[],r=t.process.cwd(),n)=>{let o=new hs(e,r,n,t);return Object.defineProperty(o,"argv",{get:()=>o.parse(),enumerable:!0}),o.help(),o.version(),o}}var rl=Symbol("copyDoubleDash"),nl=Symbol("copyDoubleDash"),ss=Symbol("deleteFromParserHintObject"),ol=Symbol("freeze"),sl=Symbol("getDollarZero"),Qt=Symbol("getParserConfiguration"),is=Symbol("guessLocale"),il=Symbol("guessVersion"),al=Symbol("parsePositionalNumbers"),as=Symbol("pkgUp"),Nt=Symbol("populateParserHintArray"),Sr=Symbol("populateParserHintSingleValueDictionary"),cs=Symbol("populateParserHintArrayDictionary"),ls=Symbol("populateParserHintDictionary"),ps=Symbol("sanitizeKey"),us=Symbol("setKey"),fs=Symbol("unfreeze"),cl=Symbol("validateAsync"),ll=Symbol("getCommandInstance"),pl=Symbol("getContext"),ul=Symbol("getHasOutput"),fl=Symbol("getLoggerInstance"),ml=Symbol("getParseContext"),dl=Symbol("getUsageInstance"),hl=Symbol("getValidationInstance"),Gn=Symbol("hasParseCallback"),er=Symbol("postProcess"),gl=Symbol("rebase"),ms=Symbol("reset"),Jr=Symbol("runYargsParserAndExecuteCommands"),ds=Symbol("runValidation"),yl=Symbol("setHasOutput"),hs=class{constructor(e=[],r,n,o){this.customScriptName=!1,this.parsed=!1,we.set(this,void 0),Gt.set(this,void 0),Kr.set(this,{commands:[],fullCommands:[]}),it.set(this,null),Ke.set(this,null),qn.set(this,"show-hidden"),jt.set(this,null),Ht.set(this,!0),at.set(this,!0),Wn.set(this,[]),ct.set(this,void 0),St.set(this,{}),Je.set(this,!1),lt.set(this,null),yr.set(this,void 0),Re.set(this,""),q.set(this,void 0),zn.set(this,void 0),Vn.set(this,{}),Xe.set(this,null),Yt.set(this,null),br.set(this,{}),Kt.set(this,{}),Dt.set(this,void 0),Bn.set(this,!1),K.set(this,void 0),Jt.set(this,!1),Xt.set(this,!1),Zt.set(this,!1),X.set(this,void 0),xt.set(this,null),be.set(this,void 0),F(this,K,o),F(this,Dt,e),F(this,Gt,r),F(this,zn,n),F(this,ct,new Fn(this)),this.$0=this[sl](),this[ms](),F(this,we,f(this,we)),F(this,X,f(this,X)),F(this,be,f(this,be)),F(this,q,f(this,q)),f(this,q).showHiddenOpt=f(this,qn),F(this,yr,this[nl]())}addHelpOpt(e,r){let n="help";return L("[string|boolean] [string]",[e,r],arguments.length),f(this,lt)&&(this[ss](f(this,lt)),F(this,lt,null)),e===!1&&r===void 0?this:(F(this,lt,typeof e=="string"?e:n),this.boolean(f(this,lt)),this.describe(f(this,lt),r||f(this,X).deferY18nLookup("Show help")),this)}help(e,r){return this.addHelpOpt(e,r)}addShowHiddenOpt(e,r){if(L("[string|boolean] [string]",[e,r],arguments.length),e===!1&&r===void 0)return this;let n=typeof e=="string"?e:f(this,qn);return this.boolean(n),this.describe(n,r||f(this,X).deferY18nLookup("Show hidden options")),f(this,q).showHiddenOpt=n,this}showHidden(e,r){return this.addShowHiddenOpt(e,r)}alias(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[cs](this.alias.bind(this),"alias",e,r),this}array(e){return L("<array|string>",[e],arguments.length),this[Nt]("array",e),this}boolean(e){return L("<array|string>",[e],arguments.length),this[Nt]("boolean",e),this}check(e,r){return L("<function> [boolean]",[e,r],arguments.length),this.middleware((n,o)=>Bt(()=>e(n),s=>(s?(typeof s=="string"||s instanceof Error)&&f(this,X).fail(s.toString(),s):f(this,X).fail(f(this,K).y18n.__("Argument check failed: %s",e.toString())),n),s=>(f(this,X).fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[cs](this.choices.bind(this),"choices",e,r),this}coerce(e,r){if(L("<object|string|array> [function]",[e,r],arguments.length),Array.isArray(e)){if(!r)throw new me("coerce callback must be provided");for(let n of e)this.coerce(n,r);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!r)throw new me("coerce callback must be provided");return f(this,q).key[e]=!0,f(this,ct).addCoerceMiddleware((n,o)=>{let s;return Bt(()=>(s=o.getAliases(),r(n[e])),i=>{if(n[e]=i,s[e])for(let a of s[e])n[a]=i;return n},i=>{throw new me(i.message)})},e),this}conflicts(e,r){return L("<string|object> [string|array]",[e,r],arguments.length),f(this,be).conflicts(e,r),this}config(e="config",r,n){return L("[object|string] [string|function] [function]",[e,r,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Yr(e,f(this,Gt),this[Qt]()["deep-merge-config"]||!1,f(this,K)),f(this,q).configObjects=(f(this,q).configObjects||[]).concat(e),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(e,r||f(this,X).deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(o=>{f(this,q).config[o]=n||!0}),this)}completion(e,r,n){return L("[string] [string|boolean|function] [function]",[e,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),F(this,Ke,e||f(this,Ke)||"completion"),!r&&r!==!1&&(r="generate completion script"),this.command(f(this,Ke),r),n&&f(this,it).registerFunction(n),this}command(e,r,n,o,s,i){return L("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,r,n,o,s,i],arguments.length),f(this,we).addHandler(e,r,n,o,s,i),this}commands(e,r,n,o,s,i){return this.command(e,r,n,o,s,i)}commandDir(e,r){L("<string> [object]",[e,r],arguments.length);let n=f(this,zn)||f(this,K).require;return f(this,we).addDirectory(e,n,f(this,K).getCallerFile(),r),this}count(e){return L("<array|string>",[e],arguments.length),this[Nt]("count",e),this}default(e,r,n){return L("<object|string|array> [*] [string]",[e,r,n],arguments.length),n&&(Qo(e,f(this,K)),f(this,q).defaultDescription[e]=n),typeof r=="function"&&(Qo(e,f(this,K)),f(this,q).defaultDescription[e]||(f(this,q).defaultDescription[e]=f(this,X).functionDescription(r)),r=r.call()),this[Sr](this.default.bind(this),"default",e,r),this}defaults(e,r,n){return this.default(e,r,n)}demandCommand(e=1,r,n,o){return L("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,r,n,o],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),f(this,q).demandedCommands._={min:e,max:r,minMsg:n,maxMsg:o},this}demand(e,r,n){return Array.isArray(r)?(r.forEach(o=>{Ue(n,!0,f(this,K)),this.demandOption(o,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof e=="number"?(Ue(n,!0,f(this,K)),this.demandCommand(e,r,n,n)):Array.isArray(e)?e.forEach(o=>{Ue(n,!0,f(this,K)),this.demandOption(o,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[Sr](this.demandOption.bind(this),"demandedOptions",e,r),this}deprecateOption(e,r){return L("<string> [string|boolean]",[e,r],arguments.length),f(this,q).deprecatedOptions[e]=r,this}describe(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[us](e,!0),f(this,X).describe(e,r),this}detectLocale(e){return L("<boolean>",[e],arguments.length),F(this,Ht,e),this}env(e){return L("[string|boolean]",[e],arguments.length),e===!1?delete f(this,q).envPrefix:f(this,q).envPrefix=e||"",this}epilogue(e){return L("<string>",[e],arguments.length),f(this,X).epilog(e),this}epilog(e){return this.epilogue(e)}example(e,r){return L("<string|array> [string]",[e,r],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):f(this,X).example(e,r),this}exit(e,r){F(this,Je,!0),F(this,jt,r),f(this,at)&&f(this,K).process.exit(e)}exitProcess(e=!0){return L("[boolean]",[e],arguments.length),F(this,at,e),this}fail(e){if(L("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new me("Invalid first argument. Expected function or boolean 'false'");return f(this,X).failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,r){return L("<array> [function]",[e,r],arguments.length),r?f(this,it).getCompletion(e,r):new Promise((n,o)=>{f(this,it).getCompletion(e,(s,i)=>{s?o(s):n(i)})})}getDemandedOptions(){return L([],0),f(this,q).demandedOptions}getDemandedCommands(){return L([],0),f(this,q).demandedCommands}getDeprecatedOptions(){return L([],0),f(this,q).deprecatedOptions}getDetectLocale(){return f(this,Ht)}getExitProcess(){return f(this,at)}getGroups(){return Object.assign({},f(this,St),f(this,Kt))}getHelp(){if(F(this,Je,!0),!f(this,X).hasCachedHelpMessage()){if(!this.parsed){let r=this[Jr](f(this,Dt),void 0,void 0,0,!0);if(he(r))return r.then(()=>f(this,X).help())}let e=f(this,we).runDefaultBuilderOn(this);if(he(e))return e.then(()=>f(this,X).help())}return Promise.resolve(f(this,X).help())}getOptions(){return f(this,q)}getStrict(){return f(this,Jt)}getStrictCommands(){return f(this,Xt)}getStrictOptions(){return f(this,Zt)}global(e,r){return L("<string|array> [boolean]",[e,r],arguments.length),e=[].concat(e),r!==!1?f(this,q).local=f(this,q).local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{f(this,q).local.indexOf(n)===-1&&f(this,q).local.push(n)}),this}group(e,r){L("<string|array> <string>",[e,r],arguments.length);let n=f(this,Kt)[r]||f(this,St)[r];f(this,Kt)[r]&&delete f(this,Kt)[r];let o={};return f(this,St)[r]=(n||[]).concat(e).filter(s=>o[s]?!1:o[s]=!0),this}hide(e){return L("<string>",[e],arguments.length),f(this,q).hiddenOptions.push(e),this}implies(e,r){return L("<string|object> [number|string|array]",[e,r],arguments.length),f(this,be).implies(e,r),this}locale(e){return L("[string]",[e],arguments.length),e?(F(this,Ht,!1),f(this,K).y18n.setLocale(e),this):(this[is](),f(this,K).y18n.getLocale())}middleware(e,r,n){return f(this,ct).addMiddleware(e,!!r,n)}nargs(e,r){return L("<string|object|array> [number]",[e,r],arguments.length),this[Sr](this.nargs.bind(this),"narg",e,r),this}normalize(e){return L("<array|string>",[e],arguments.length),this[Nt]("normalize",e),this}number(e){return L("<array|string>",[e],arguments.length),this[Nt]("number",e),this}option(e,r){if(L("<string|object> [object]",[e,r],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof r!="object"&&(r={}),f(this,q).key[e]=!0,r.alias&&this.alias(e,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(e,n);let o=r.demand||r.required||r.require;o&&this.demand(e,o),r.demandOption&&this.demandOption(e,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(e,r.conflicts),"default"in r&&this.default(e,r.default),r.implies!==void 0&&this.implies(e,r.implies),r.nargs!==void 0&&this.nargs(e,r.nargs),r.config&&this.config(e,r.configParser),r.normalize&&this.normalize(e),r.choices&&this.choices(e,r.choices),r.coerce&&this.coerce(e,r.coerce),r.group&&this.group(e,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(e),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(e),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(e),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(e),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(e),typeof r.global=="boolean"&&this.global(e,r.global),r.defaultDescription&&(f(this,q).defaultDescription[e]=r.defaultDescription),r.skipValidation&&this.skipValidation(e);let s=r.describe||r.description||r.desc;this.describe(e,s),r.hidden&&this.hide(e),r.requiresArg&&this.requiresArg(e)}return this}options(e,r){return this.option(e,r)}parse(e,r,n){L("[string|array] [function|boolean|object] [function]",[e,r,n],arguments.length),this[ol](),typeof e>"u"&&(e=f(this,Dt)),typeof r=="object"&&(F(this,Yt,r),r=n),typeof r=="function"&&(F(this,Xe,r),r=!1),r||F(this,Dt,e),f(this,Xe)&&F(this,at,!1);let o=this[Jr](e,!!r),s=this.parsed;return f(this,it).setParsed(this.parsed),he(o)?o.then(i=>(f(this,Xe)&&f(this,Xe).call(this,f(this,jt),i,f(this,Re)),i)).catch(i=>{throw f(this,Xe)&&f(this,Xe)(i,this.parsed.argv,f(this,Re)),i}).finally(()=>{this[fs](),this.parsed=s}):(f(this,Xe)&&f(this,Xe).call(this,f(this,jt),o,f(this,Re)),this[fs](),this.parsed=s,o)}parseAsync(e,r,n){let o=this.parse(e,r,n);return he(o)?o:Promise.resolve(o)}parseSync(e,r,n){let o=this.parse(e,r,n);if(he(o))throw new me(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(e){return L("<object>",[e],arguments.length),F(this,Vn,e),this}pkgConf(e,r){L("<string> [string]",[e,r],arguments.length);let n=null,o=this[as](r||f(this,Gt));return o[e]&&typeof o[e]=="object"&&(n=Yr(o[e],r||f(this,Gt),this[Qt]()["deep-merge-config"]||!1,f(this,K)),f(this,q).configObjects=(f(this,q).configObjects||[]).concat(n)),this}positional(e,r){L("<string> <object>",[e,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=_t(r,(i,a)=>{let c=n.indexOf(i)!==-1;return i==="type"&&["string","number","boolean"].indexOf(a)===-1&&(c=!1),c});let o=f(this,Kr).fullCommands[f(this,Kr).fullCommands.length-1],s=o?f(this,we).cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return hr(s).forEach(i=>{let a=s[i];Array.isArray(a)?a.indexOf(e)!==-1&&(r[i]=!0):a[e]&&!(i in r)&&(r[i]=a[e])}),this.group(e,f(this,X).getPositionalGroupName()),this.option(e,r)}recommendCommands(e=!0){return L("[boolean]",[e],arguments.length),F(this,Bn,e),this}required(e,r,n){return this.demand(e,r,n)}require(e,r,n){return this.demand(e,r,n)}requiresArg(e){return L("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&f(this,q).narg[e]?this:(this[Sr](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,r){return L("[string] [string]",[e,r],arguments.length),e=e||this.$0,f(this,yr).log(f(this,it).generateCompletionScript(e,r||f(this,Ke)||"completion")),this}showHelp(e){if(L("[string|function]",[e],arguments.length),F(this,Je,!0),!f(this,X).hasCachedHelpMessage()){if(!this.parsed){let n=this[Jr](f(this,Dt),void 0,void 0,0,!0);if(he(n))return n.then(()=>{f(this,X).showHelp(e)}),this}let r=f(this,we).runDefaultBuilderOn(this);if(he(r))return r.then(()=>{f(this,X).showHelp(e)}),this}return f(this,X).showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,r){return L("[boolean|string] [string]",[e,r],arguments.length),f(this,X).showHelpOnFail(e,r),this}showVersion(e){return L("[string|function]",[e],arguments.length),f(this,X).showVersion(e),this}skipValidation(e){return L("<array|string>",[e],arguments.length),this[Nt]("skipValidation",e),this}strict(e){return L("[boolean]",[e],arguments.length),F(this,Jt,e!==!1),this}strictCommands(e){return L("[boolean]",[e],arguments.length),F(this,Xt,e!==!1),this}strictOptions(e){return L("[boolean]",[e],arguments.length),F(this,Zt,e!==!1),this}string(e){return L("<array|string>",[e],arguments.length),this[Nt]("string",e),this}terminalWidth(){return L([],0),f(this,K).process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return L("<object>",[e],arguments.length),F(this,Ht,!1),f(this,K).y18n.updateLocale(e),this}usage(e,r,n,o){if(L("<string|null|undefined> [string|boolean] [function|object] [function]",[e,r,n,o],arguments.length),r!==void 0){if(Ue(e,null,f(this,K)),(e||"").match(/^\$0( |$)/))return this.command(e,r,n,o);throw new me(".usage() description must start with $0 if being used as alias for .command()")}else return f(this,X).usage(e),this}version(e,r,n){let o="version";if(L("[boolean|string] [string] [string]",[e,r,n],arguments.length),f(this,xt)&&(this[ss](f(this,xt)),f(this,X).version(void 0),F(this,xt,null)),arguments.length===0)n=this[il](),e=o;else if(arguments.length===1){if(e===!1)return this;n=e,e=o}else arguments.length===2&&(n=r,r=void 0);return F(this,xt,typeof e=="string"?e:o),r=r||f(this,X).deferY18nLookup("Show version number"),f(this,X).version(n||void 0),this.boolean(f(this,xt)),this.describe(f(this,xt),r),this}wrap(e){return L("<number|null|undefined>",[e],arguments.length),f(this,X).wrap(e),this}[(we=new WeakMap,Gt=new WeakMap,Kr=new WeakMap,it=new WeakMap,Ke=new WeakMap,qn=new WeakMap,jt=new WeakMap,Ht=new WeakMap,at=new WeakMap,Wn=new WeakMap,ct=new WeakMap,St=new WeakMap,Je=new WeakMap,lt=new WeakMap,yr=new WeakMap,Re=new WeakMap,q=new WeakMap,zn=new WeakMap,Vn=new WeakMap,Xe=new WeakMap,Yt=new WeakMap,br=new WeakMap,Kt=new WeakMap,Dt=new WeakMap,Bn=new WeakMap,K=new WeakMap,Jt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,X=new WeakMap,xt=new WeakMap,be=new WeakMap,rl)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[nl](){return{log:(...e)=>{this[Gn]()||console.log(...e),F(this,Je,!0),f(this,Re).length&&F(this,Re,f(this,Re)+`
74
74
  `),F(this,Re,f(this,Re)+e.join(" "))},error:(...e)=>{this[Gn]()||console.error(...e),F(this,Je,!0),f(this,Re).length&&F(this,Re,f(this,Re)+`
75
- `),F(this,Re,f(this,Re)+e.join(" "))}}}[ss](e){hr(f(this,q)).forEach(r=>{if((o=>o==="configObjects")(r))return;let n=f(this,q)[r];Array.isArray(n)?~n.indexOf(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete f(this,X).getDescriptions()[e]}[ol](){f(this,Wn).push({options:f(this,q),configObjects:f(this,q).configObjects.slice(0),exitProcess:f(this,at),groups:f(this,St),strict:f(this,Jt),strictCommands:f(this,Xt),strictOptions:f(this,Zt),completionCommand:f(this,Ke),output:f(this,Re),exitError:f(this,jt),hasOutput:f(this,Je),parsed:this.parsed,parseFn:f(this,Xe),parseContext:f(this,Yt)}),f(this,X).freeze(),f(this,be).freeze(),f(this,we).freeze(),f(this,ct).freeze()}[sl](){let e="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(f(this,K).process.argv()[0])?r=f(this,K).process.argv().slice(1,2):r=f(this,K).process.argv().slice(0,1),e=r.map(n=>{let o=this[gl](f(this,Gt),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),f(this,K).getEnv("_")&&f(this,K).getProcessArgvBin()===f(this,K).getEnv("_")&&(e=f(this,K).getEnv("_").replace(`${f(this,K).path.dirname(f(this,K).process.execPath())}/`,"")),e}[Qt](){return f(this,Vn)}[is](){if(!f(this,Ht))return;let e=f(this,K).getEnv("LC_ALL")||f(this,K).getEnv("LC_MESSAGES")||f(this,K).getEnv("LANG")||f(this,K).getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[il](){return this[as]().version||"unknown"}[al](e){let r=e["--"]?e["--"]:e._;for(let n=0,o;(o=r[n])!==void 0;n++)f(this,K).Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(r[n]=Number(o));return e}[as](e){let r=e||"*";if(f(this,br)[r])return f(this,br)[r];let n={};try{let o=e||f(this,K).mainFilename;!e&&f(this,K).path.extname(o)&&(o=f(this,K).path.dirname(o));let s=f(this,K).findUp(o,(i,a)=>{if(a.includes("package.json"))return"package.json"});Ue(s,void 0,f(this,K)),n=JSON.parse(f(this,K).readFileSync(s,"utf8"))}catch{}return f(this,br)[r]=n||{},f(this,br)[r]}[Nt](e,r){r=[].concat(r),r.forEach(n=>{n=this[ps](n),f(this,q)[e].push(n)})}[Sr](e,r,n,o){this[ls](e,r,n,o,(s,i,a)=>{f(this,q)[s][i]=a})}[cs](e,r,n,o){this[ls](e,r,n,o,(s,i,a)=>{f(this,q)[s][i]=(f(this,q)[s][i]||[]).concat(a)})}[ls](e,r,n,o,s){if(Array.isArray(n))n.forEach(i=>{e(i,o)});else if((i=>typeof i=="object")(n))for(let i of hr(n))e(i,n[i]);else s(r,this[ps](n),o)}[ps](e){return e==="__proto__"?"___proto___":e}[us](e,r){return this[Sr](this[us].bind(this),"key",e,r),this}[fs](){var e,r,n,o,s,i,a,c,p,u,l,d;let m=f(this,Wn).pop();Ue(m,void 0,f(this,K));let w;e=this,r=this,n=this,o=this,s=this,i=this,a=this,c=this,p=this,u=this,l=this,d=this,{options:{set value(h){F(e,q,h)}}.value,configObjects:w,exitProcess:{set value(h){F(r,at,h)}}.value,groups:{set value(h){F(n,St,h)}}.value,output:{set value(h){F(o,Re,h)}}.value,exitError:{set value(h){F(s,jt,h)}}.value,hasOutput:{set value(h){F(i,Je,h)}}.value,parsed:this.parsed,strict:{set value(h){F(a,Jt,h)}}.value,strictCommands:{set value(h){F(c,Xt,h)}}.value,strictOptions:{set value(h){F(p,Zt,h)}}.value,completionCommand:{set value(h){F(u,Ke,h)}}.value,parseFn:{set value(h){F(l,Xe,h)}}.value,parseContext:{set value(h){F(d,Yt,h)}}.value}=m,f(this,q).configObjects=w,f(this,X).unfreeze(),f(this,be).unfreeze(),f(this,we).unfreeze(),f(this,ct).unfreeze()}[cl](e,r){return Bt(r,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[ll].bind(this),getContext:this[pl].bind(this),getHasOutput:this[ul].bind(this),getLoggerInstance:this[fl].bind(this),getParseContext:this[ml].bind(this),getParserConfiguration:this[Qt].bind(this),getUsageInstance:this[dl].bind(this),getValidationInstance:this[hl].bind(this),hasParseCallback:this[Gn].bind(this),postProcess:this[er].bind(this),reset:this[ms].bind(this),runValidation:this[ds].bind(this),runYargsParserAndExecuteCommands:this[Jr].bind(this),setHasOutput:this[yl].bind(this)}}[ll](){return f(this,we)}[pl](){return f(this,Kr)}[ul](){return f(this,Je)}[fl](){return f(this,yr)}[ml](){return f(this,Yt)||{}}[dl](){return f(this,X)}[hl](){return f(this,be)}[Gn](){return!!f(this,Xe)}[er](e,r,n,o){return n||he(e)||(r||(e=this[rl](e)),(this[Qt]()["parse-positional-numbers"]||this[Qt]()["parse-positional-numbers"]===void 0)&&(e=this[al](e)),o&&(e=Vt(e,this,f(this,ct).getMiddleware(),!1))),e}[ms](e={}){F(this,q,f(this,q)||{});let r={};r.local=f(this,q).local?f(this,q).local:[],r.configObjects=f(this,q).configObjects?f(this,q).configObjects:[];let n={};r.local.forEach(i=>{n[i]=!0,(e[i]||[]).forEach(a=>{n[a]=!0})}),Object.assign(f(this,Kt),Object.keys(f(this,St)).reduce((i,a)=>{let c=f(this,St)[a].filter(p=>!(p in n));return c.length>0&&(i[a]=c),i},{})),F(this,St,{});let o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(i=>{r[i]=(f(this,q)[i]||[]).filter(a=>!n[a])}),s.forEach(i=>{r[i]=_t(f(this,q)[i],a=>!n[a])}),r.envPrefix=f(this,q).envPrefix,F(this,q,r),F(this,X,f(this,X)?f(this,X).reset(n):Yc(this,f(this,K))),F(this,be,f(this,be)?f(this,be).reset(n):el(this,f(this,X),f(this,K))),F(this,we,f(this,we)?f(this,we).reset():Bc(f(this,X),f(this,be),f(this,ct),f(this,K))),f(this,it)||F(this,it,Xc(this,f(this,X),f(this,we),f(this,K))),f(this,ct).reset(),F(this,Ke,null),F(this,Re,""),F(this,jt,null),F(this,Je,!1),this.parsed=!1,this}[gl](e,r){return f(this,K).path.relative(e,r)}[Jr](e,r,n,o=0,s=!1){let i=!!n||s;e=e||f(this,Dt),f(this,q).__=f(this,K).y18n.__,f(this,q).configuration=this[Qt]();let a=!!f(this,q).configuration["populate--"],c=Object.assign({},f(this,q).configuration,{"populate--":!0}),p=f(this,K).Parser.detailed(e,Object.assign({},f(this,q),{configuration:{"parse-positional-numbers":!1,...c}})),u=Object.assign(p.argv,f(this,Yt)),l,d=p.aliases,m=!1,w=!1;Object.keys(u).forEach(h=>{h===f(this,lt)&&u[h]?m=!0:h===f(this,At)&&u[h]&&(w=!0)}),u.$0=this.$0,this.parsed=p,o===0&&f(this,X).clearCachedHelpMessage();try{if(this[is](),r)return this[er](u,a,!!n,!1);f(this,lt)&&~[f(this,lt)].concat(d[f(this,lt)]||[]).filter(A=>A.length>1).indexOf(""+u._[u._.length-1])&&(u._.pop(),m=!0);let h=f(this,we).getCommands(),x=f(this,it).completionKey in u,P=m||x||s;if(u._.length){if(h.length){let C;for(let A=o||0,E;u._[A]!==void 0;A++)if(E=String(u._[A]),~h.indexOf(E)&&E!==f(this,Ke)){let $=f(this,we).runCommand(E,this,p,A+1,s,m||w||s);return this[er]($,a,!!n,!1)}else if(!C&&E!==f(this,Ke)){C=E;break}!f(this,we).hasDefaultCommand()&&f(this,Bn)&&C&&!P&&f(this,be).recommendCommands(C,h)}f(this,Ke)&&~u._.indexOf(f(this,Ke))&&!x&&(f(this,at)&&Tt(!0),this.showCompletionScript(),this.exit(0))}if(f(this,we).hasDefaultCommand()&&!P){let C=f(this,we).runCommand(null,this,p,0,s,m||w||s);return this[er](C,a,!!n,!1)}if(x){f(this,at)&&Tt(!0),e=[].concat(e);let C=e.slice(e.indexOf(`--${f(this,it).completionKey}`)+1);return f(this,it).getCompletion(C,(A,E)=>{if(A)throw new me(A.message);(E||[]).forEach($=>{f(this,yr).log($)}),this.exit(0)}),this[er](u,!a,!!n,!1)}if(f(this,Je)||(m?(f(this,at)&&Tt(!0),i=!0,this.showHelp("log"),this.exit(0)):w&&(f(this,at)&&Tt(!0),i=!0,f(this,X).showVersion("log"),this.exit(0))),!i&&f(this,q).skipValidation.length>0&&(i=Object.keys(u).some(C=>f(this,q).skipValidation.indexOf(C)>=0&&u[C]===!0)),!i){if(p.error)throw new me(p.error.message);if(!x){let C=this[ds](d,{},p.error);n||(l=Vt(u,this,f(this,ct).getMiddleware(),!0)),l=this[cl](C,l??u),he(l)&&!n&&(l=l.then(()=>Vt(u,this,f(this,ct).getMiddleware(),!1)))}}}catch(h){if(h instanceof me)f(this,X).fail(h.message,h);else throw h}return this[er](l??u,a,!!n,!0)}[ds](e,r,n,o){e={...e},r={...r};let s={...this.getDemandedOptions()};return i=>{if(n)throw new me(n.message);f(this,be).nonOptionCount(i),f(this,be).requiredArguments(i,s);let a=!1;f(this,Xt)&&(a=f(this,be).unknownCommands(i)),f(this,Jt)&&!a?f(this,be).unknownArguments(i,e,r,!!o):f(this,Zt)&&f(this,be).unknownArguments(i,e,{},!1,!1),f(this,be).limitedChoices(i),f(this,be).implications(i),f(this,be).conflicting(i)}}[yl](){F(this,Je,!0)}};function Gc(t){return!!t&&typeof t.getInternalMethods=="function"}var Eg=bl(Zo),Sl=Eg;function Hn(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}async function wl({argv:t,config:e}){let r=ur(e,t.residency);try{let n=new Fr;t.verbose&&(y.info(`OAuth client initialized.
75
+ `),F(this,Re,f(this,Re)+e.join(" "))}}}[ss](e){hr(f(this,q)).forEach(r=>{if((o=>o==="configObjects")(r))return;let n=f(this,q)[r];Array.isArray(n)?~n.indexOf(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete f(this,X).getDescriptions()[e]}[ol](){f(this,Wn).push({options:f(this,q),configObjects:f(this,q).configObjects.slice(0),exitProcess:f(this,at),groups:f(this,St),strict:f(this,Jt),strictCommands:f(this,Xt),strictOptions:f(this,Zt),completionCommand:f(this,Ke),output:f(this,Re),exitError:f(this,jt),hasOutput:f(this,Je),parsed:this.parsed,parseFn:f(this,Xe),parseContext:f(this,Yt)}),f(this,X).freeze(),f(this,be).freeze(),f(this,we).freeze(),f(this,ct).freeze()}[sl](){let e="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(f(this,K).process.argv()[0])?r=f(this,K).process.argv().slice(1,2):r=f(this,K).process.argv().slice(0,1),e=r.map(n=>{let o=this[gl](f(this,Gt),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),f(this,K).getEnv("_")&&f(this,K).getProcessArgvBin()===f(this,K).getEnv("_")&&(e=f(this,K).getEnv("_").replace(`${f(this,K).path.dirname(f(this,K).process.execPath())}/`,"")),e}[Qt](){return f(this,Vn)}[is](){if(!f(this,Ht))return;let e=f(this,K).getEnv("LC_ALL")||f(this,K).getEnv("LC_MESSAGES")||f(this,K).getEnv("LANG")||f(this,K).getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[il](){return this[as]().version||"unknown"}[al](e){let r=e["--"]?e["--"]:e._;for(let n=0,o;(o=r[n])!==void 0;n++)f(this,K).Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(r[n]=Number(o));return e}[as](e){let r=e||"*";if(f(this,br)[r])return f(this,br)[r];let n={};try{let o=e||f(this,K).mainFilename;!e&&f(this,K).path.extname(o)&&(o=f(this,K).path.dirname(o));let s=f(this,K).findUp(o,(i,a)=>{if(a.includes("package.json"))return"package.json"});Ue(s,void 0,f(this,K)),n=JSON.parse(f(this,K).readFileSync(s,"utf8"))}catch{}return f(this,br)[r]=n||{},f(this,br)[r]}[Nt](e,r){r=[].concat(r),r.forEach(n=>{n=this[ps](n),f(this,q)[e].push(n)})}[Sr](e,r,n,o){this[ls](e,r,n,o,(s,i,a)=>{f(this,q)[s][i]=a})}[cs](e,r,n,o){this[ls](e,r,n,o,(s,i,a)=>{f(this,q)[s][i]=(f(this,q)[s][i]||[]).concat(a)})}[ls](e,r,n,o,s){if(Array.isArray(n))n.forEach(i=>{e(i,o)});else if((i=>typeof i=="object")(n))for(let i of hr(n))e(i,n[i]);else s(r,this[ps](n),o)}[ps](e){return e==="__proto__"?"___proto___":e}[us](e,r){return this[Sr](this[us].bind(this),"key",e,r),this}[fs](){var e,r,n,o,s,i,a,c,p,u,l,d;let m=f(this,Wn).pop();Ue(m,void 0,f(this,K));let w;e=this,r=this,n=this,o=this,s=this,i=this,a=this,c=this,p=this,u=this,l=this,d=this,{options:{set value(h){F(e,q,h)}}.value,configObjects:w,exitProcess:{set value(h){F(r,at,h)}}.value,groups:{set value(h){F(n,St,h)}}.value,output:{set value(h){F(o,Re,h)}}.value,exitError:{set value(h){F(s,jt,h)}}.value,hasOutput:{set value(h){F(i,Je,h)}}.value,parsed:this.parsed,strict:{set value(h){F(a,Jt,h)}}.value,strictCommands:{set value(h){F(c,Xt,h)}}.value,strictOptions:{set value(h){F(p,Zt,h)}}.value,completionCommand:{set value(h){F(u,Ke,h)}}.value,parseFn:{set value(h){F(l,Xe,h)}}.value,parseContext:{set value(h){F(d,Yt,h)}}.value}=m,f(this,q).configObjects=w,f(this,X).unfreeze(),f(this,be).unfreeze(),f(this,we).unfreeze(),f(this,ct).unfreeze()}[cl](e,r){return Bt(r,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[ll].bind(this),getContext:this[pl].bind(this),getHasOutput:this[ul].bind(this),getLoggerInstance:this[fl].bind(this),getParseContext:this[ml].bind(this),getParserConfiguration:this[Qt].bind(this),getUsageInstance:this[dl].bind(this),getValidationInstance:this[hl].bind(this),hasParseCallback:this[Gn].bind(this),postProcess:this[er].bind(this),reset:this[ms].bind(this),runValidation:this[ds].bind(this),runYargsParserAndExecuteCommands:this[Jr].bind(this),setHasOutput:this[yl].bind(this)}}[ll](){return f(this,we)}[pl](){return f(this,Kr)}[ul](){return f(this,Je)}[fl](){return f(this,yr)}[ml](){return f(this,Yt)||{}}[dl](){return f(this,X)}[hl](){return f(this,be)}[Gn](){return!!f(this,Xe)}[er](e,r,n,o){return n||he(e)||(r||(e=this[rl](e)),(this[Qt]()["parse-positional-numbers"]||this[Qt]()["parse-positional-numbers"]===void 0)&&(e=this[al](e)),o&&(e=Vt(e,this,f(this,ct).getMiddleware(),!1))),e}[ms](e={}){F(this,q,f(this,q)||{});let r={};r.local=f(this,q).local?f(this,q).local:[],r.configObjects=f(this,q).configObjects?f(this,q).configObjects:[];let n={};r.local.forEach(i=>{n[i]=!0,(e[i]||[]).forEach(a=>{n[a]=!0})}),Object.assign(f(this,Kt),Object.keys(f(this,St)).reduce((i,a)=>{let c=f(this,St)[a].filter(p=>!(p in n));return c.length>0&&(i[a]=c),i},{})),F(this,St,{});let o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(i=>{r[i]=(f(this,q)[i]||[]).filter(a=>!n[a])}),s.forEach(i=>{r[i]=_t(f(this,q)[i],a=>!n[a])}),r.envPrefix=f(this,q).envPrefix,F(this,q,r),F(this,X,f(this,X)?f(this,X).reset(n):Yc(this,f(this,K))),F(this,be,f(this,be)?f(this,be).reset(n):el(this,f(this,X),f(this,K))),F(this,we,f(this,we)?f(this,we).reset():Bc(f(this,X),f(this,be),f(this,ct),f(this,K))),f(this,it)||F(this,it,Xc(this,f(this,X),f(this,we),f(this,K))),f(this,ct).reset(),F(this,Ke,null),F(this,Re,""),F(this,jt,null),F(this,Je,!1),this.parsed=!1,this}[gl](e,r){return f(this,K).path.relative(e,r)}[Jr](e,r,n,o=0,s=!1){let i=!!n||s;e=e||f(this,Dt),f(this,q).__=f(this,K).y18n.__,f(this,q).configuration=this[Qt]();let a=!!f(this,q).configuration["populate--"],c=Object.assign({},f(this,q).configuration,{"populate--":!0}),p=f(this,K).Parser.detailed(e,Object.assign({},f(this,q),{configuration:{"parse-positional-numbers":!1,...c}})),u=Object.assign(p.argv,f(this,Yt)),l,d=p.aliases,m=!1,w=!1;Object.keys(u).forEach(h=>{h===f(this,lt)&&u[h]?m=!0:h===f(this,xt)&&u[h]&&(w=!0)}),u.$0=this.$0,this.parsed=p,o===0&&f(this,X).clearCachedHelpMessage();try{if(this[is](),r)return this[er](u,a,!!n,!1);f(this,lt)&&~[f(this,lt)].concat(d[f(this,lt)]||[]).filter(x=>x.length>1).indexOf(""+u._[u._.length-1])&&(u._.pop(),m=!0);let h=f(this,we).getCommands(),C=f(this,it).completionKey in u,P=m||C||s;if(u._.length){if(h.length){let A;for(let x=o||0,E;u._[x]!==void 0;x++)if(E=String(u._[x]),~h.indexOf(E)&&E!==f(this,Ke)){let $=f(this,we).runCommand(E,this,p,x+1,s,m||w||s);return this[er]($,a,!!n,!1)}else if(!A&&E!==f(this,Ke)){A=E;break}!f(this,we).hasDefaultCommand()&&f(this,Bn)&&A&&!P&&f(this,be).recommendCommands(A,h)}f(this,Ke)&&~u._.indexOf(f(this,Ke))&&!C&&(f(this,at)&&Tt(!0),this.showCompletionScript(),this.exit(0))}if(f(this,we).hasDefaultCommand()&&!P){let A=f(this,we).runCommand(null,this,p,0,s,m||w||s);return this[er](A,a,!!n,!1)}if(C){f(this,at)&&Tt(!0),e=[].concat(e);let A=e.slice(e.indexOf(`--${f(this,it).completionKey}`)+1);return f(this,it).getCompletion(A,(x,E)=>{if(x)throw new me(x.message);(E||[]).forEach($=>{f(this,yr).log($)}),this.exit(0)}),this[er](u,!a,!!n,!1)}if(f(this,Je)||(m?(f(this,at)&&Tt(!0),i=!0,this.showHelp("log"),this.exit(0)):w&&(f(this,at)&&Tt(!0),i=!0,f(this,X).showVersion("log"),this.exit(0))),!i&&f(this,q).skipValidation.length>0&&(i=Object.keys(u).some(A=>f(this,q).skipValidation.indexOf(A)>=0&&u[A]===!0)),!i){if(p.error)throw new me(p.error.message);if(!C){let A=this[ds](d,{},p.error);n||(l=Vt(u,this,f(this,ct).getMiddleware(),!0)),l=this[cl](A,l??u),he(l)&&!n&&(l=l.then(()=>Vt(u,this,f(this,ct).getMiddleware(),!1)))}}}catch(h){if(h instanceof me)f(this,X).fail(h.message,h);else throw h}return this[er](l??u,a,!!n,!0)}[ds](e,r,n,o){e={...e},r={...r};let s={...this.getDemandedOptions()};return i=>{if(n)throw new me(n.message);f(this,be).nonOptionCount(i),f(this,be).requiredArguments(i,s);let a=!1;f(this,Xt)&&(a=f(this,be).unknownCommands(i)),f(this,Jt)&&!a?f(this,be).unknownArguments(i,e,r,!!o):f(this,Zt)&&f(this,be).unknownArguments(i,e,{},!1,!1),f(this,be).limitedChoices(i),f(this,be).implications(i),f(this,be).conflicting(i)}}[yl](){F(this,Je,!0)}};function Gc(t){return!!t&&typeof t.getInternalMethods=="function"}var Eg=bl(Zo),Sl=Eg;function Hn(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}async function wl({argv:t,config:e}){let r=ur(e,t.residency);try{let n=new Fr;t.verbose&&(y.info(`OAuth client initialized.
76
76
  `),y.info(`Local credentials file path: ${n.credentialsFilePath}
77
77
  `)),await n.login(r)}catch(n){t.verbose&&(y.error(`Residency: ${t.residency}.
78
78
  `),y.error(`Login URL: ${r}.
79
79
  `),y.error(n.stack||n.message)),t.residency?W(`\u274C Connection to ${r} failed.`):W("\u274C Login failed. Please check your credentials and try again.")}}async function El(){new Fr().logout(),y.output(`Logged out from the Redocly account. \u270B
80
- `)}import{writeFileSync as Og}from"fs";import{performance as Cg}from"perf_hooks";async function Ol({argv:t,config:e,version:r,collectSpecData:n}){let o=await rt(t.apis,e),s={errors:0,warnings:0,ignored:0};for(let{path:i,alias:a,output:c}of o)try{let p=Cg.now(),u=e.forAlias(a);u.skipPreprocessors(t["skip-preprocessor"]),u.skipDecorators(t["skip-decorator"]),a===void 0?y.info(ue(`bundling ${mt(i)}...
80
+ `)}import{writeFileSync as Og}from"fs";import{performance as Ag}from"perf_hooks";async function Ol({argv:t,config:e,version:r,collectSpecData:n}){let o=await rt(t.apis,e),s={errors:0,warnings:0,ignored:0};for(let{path:i,alias:a,output:c}of o)try{let p=Ag.now(),u=e.forAlias(a);u.skipPreprocessors(t["skip-preprocessor"]),u.skipDecorators(t["skip-decorator"]),a===void 0?y.info(ue(`bundling ${mt(i)}...
81
81
  `)):y.info(ue(`bundling ${mt(i)} using configuration for api '${a}'...
82
- `));let{bundle:l,problems:d,...m}=await pr({ref:i,config:u,dereference:t.dereferenced,removeUnusedComponents:t["remove-unused-components"],keepUrlRefs:t["keep-url-references"],componentRenamingConflicts:t["component-renaming-conflicts-severity"],componentNamesStrategy:t["component-names-strategy"],collectSpecData:n}),w=pn(d),{outputFile:h,ext:x}=bi({entrypoint:i,output:c,argvOutput:t.output,ext:t.ext,entries:t?.apis?.length||0});if(w.errors===0||t.force)if(h){let A=yo(kr(l.parsed),x,t.dereferenced);gi(h,A)}else{let A=yo(kr(l.parsed),t.ext||"yaml",t.dereferenced);y.output(A)}s.errors+=w.errors,s.warnings+=w.warnings,s.ignored+=w.ignored,un(d,{format:"codeframe",totals:w,version:r,command:"bundle"}),t.metafile&&(o.length>1&&y.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),Og(t.metafile,JSON.stringify(m),"utf-8"));let P=gn(p);w.errors>0?t.force?y.info(`\u2753 Created a bundle for ${Q(mt(i))} at ${Q(h||"stdout")} with errors ${pe(P)}.
82
+ `));let{bundle:l,problems:d,...m}=await pr({ref:i,config:u,dereference:t.dereferenced,removeUnusedComponents:t["remove-unused-components"],keepUrlRefs:t["keep-url-references"],componentRenamingConflicts:t["component-renaming-conflicts-severity"],componentNamesStrategy:t["component-names-strategy"],collectSpecData:n}),w=pn(d),{outputFile:h,ext:C}=bi({entrypoint:i,output:c,argvOutput:t.output,ext:t.ext,entries:t?.apis?.length||0});if(w.errors===0||t.force)if(h){let x=yo(kr(l.parsed),C,t.dereferenced);gi(h,x)}else{let x=yo(kr(l.parsed),t.ext||"yaml",t.dereferenced);y.output(x)}s.errors+=w.errors,s.warnings+=w.warnings,s.ignored+=w.ignored,un(d,{format:"codeframe",totals:w,version:r,command:"bundle"}),t.metafile&&(o.length>1&&y.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),Og(t.metafile,JSON.stringify(m),"utf-8"));let P=gn(p);w.errors>0?t.force?y.info(`\u2753 Created a bundle for ${Q(mt(i))} at ${Q(h||"stdout")} with errors ${pe(P)}.
83
83
  ${ee("Errors ignored because of --force")}.
84
84
  `):y.error(`\u274C Errors encountered while bundling ${Q(mt(i))}: bundle not created (use --force to ignore errors).
85
85
  `):y.info(`\u{1F4E6} Created a bundle for ${Q(mt(i))} at ${Q(h||"stdout")} ${pe(P)}.
86
- `);let C=m.visitorsData?.["remove-unused-components"]?.removedCount;C&&y.info(ue(`\u{1F9F9} Removed ${C} unused components.
87
- `))}catch(p){yi(p,i)}if(Si(e),!(s.errors===0||t.force))throw new qt("Bundle failed.")}import{spawn as xg}from"node:child_process";import*as Cl from"node:process";var Xr=t=>t.replace(/[^a-zA-Z0-9 ._\-:\\/@]/g,""),xl=t=>t.replace(/[^a-zA-Z0-9@._-]/g,"");function wr(){let t=Cl.platform==="win32";return{npxExecutableName:t?"npx.cmd":"npx",sanitize:(n,o)=>t&&n?o(n):n||"",shell:t}}var Al=async({argv:t})=>{y.info(`
86
+ `);let A=m.visitorsData?.["remove-unused-components"]?.removedCount;A&&y.info(ue(`\u{1F9F9} Removed ${A} unused components.
87
+ `))}catch(p){yi(p,i)}if(Si(e),!(s.errors===0||t.force))throw new qt("Bundle failed.")}import{spawn as Cg}from"node:child_process";import*as Al from"node:process";var Xr=t=>t.replace(/[^a-zA-Z0-9 ._\-:\\/@]/g,""),Cl=t=>t.replace(/[^a-zA-Z0-9@._-]/g,"");function wr(){let t=Al.platform==="win32";return{npxExecutableName:t?"npx.cmd":"npx",sanitize:(n,o)=>t&&n?o(n):n||"",shell:t}}var xl=async({argv:t})=>{y.info(`
88
88
  Launching eject using NPX.
89
89
 
90
- `);let{npxExecutableName:e,sanitize:r,shell:n}=wr(),o=r(t.path,Xr),s=r(t["project-dir"],Xr);xg(e,["-y","@redocly/realm","eject",`${t.type}`,o,`-d=${s}`,t.force?`--force=${t.force}`:""],{stdio:"inherit",shell:n}).on("error",a=>{throw y.info(`Eject launch failed: ${a.message}`),new Error("Eject launch failed.")})};import{writeFileSync as Ag}from"node:fs";async function vl({argv:t,config:e,version:r,collectSpecData:n}){let o=t["output-file"]||"auto-generated.arazzo.yaml",s={outputFile:o,descriptionPath:t.descriptionPath,collectSpecData:n,version:r,config:e};try{let{generate:i}=await import("./chunks/MK7BP3KL.js");y.info(ue(`
90
+ `);let{npxExecutableName:e,sanitize:r,shell:n}=wr(),o=r(t.path,Xr),s=r(t["project-dir"],Xr);Cg(e,["-y","@redocly/realm","eject",`${t.type}`,o,`-d=${s}`,t.force?`--force=${t.force}`:""],{stdio:"inherit",shell:n}).on("error",a=>{throw y.info(`Eject launch failed: ${a.message}`),new Error("Eject launch failed.")})};import{writeFileSync as xg}from"node:fs";async function vl({argv:t,config:e,version:r,collectSpecData:n}){let o=t["output-file"]||"auto-generated.arazzo.yaml",s={outputFile:o,descriptionPath:t.descriptionPath,collectSpecData:n,version:r,config:e};try{let{generate:i}=await import("./chunks/JTFBO6YU.js");y.info(ue(`
91
91
  Generating Arazzo description...
92
- `));let a=await i(s);Ag(o,Qs(a)),y.info(`
92
+ `));let a=await i(s);xg(o,Qs(a)),y.info(`
93
93
  `+Q(`Arazzo description ${ee(o)} successfully generated.`)+`
94
94
  `)}catch{throw new Ve(`
95
95
  \u274C Failed to generate Arazzo description. Check the output file path you provided, or the OpenAPI file content.`)}}import{basename as vg,dirname as Pg,extname as Rg,isAbsolute as $g,resolve as Zr}from"node:path";var Ig=/^[a-z][a-z0-9+.-]+:/i;function Pl(t,e){let{setup:r}=t;if(typeof r!="string")return t;if(Ig.test(r))throw new Ve(`
96
96
  \u274C \`client.setup\` must be a local file path \u2014 remote setup modules are not supported.
97
97
  Got: ${r}
98
- `);return $g(r)?t:{...t,setup:Zr(e,r)}}function _g(t){return`${t.replace(/[\\/]/g,"_")}.client.ts`}function Tg(t){if(t.startsWith("//"))return!1;if(t.startsWith("/"))return!0;try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}async function Rl({argv:t,config:e}){let{generateClient:r,mergeConfig:n}=await import("./chunks/X5UP7OHY.js"),o=e.configPath?Pg(e.configPath):process.cwd(),s={serverUrl:t["server-url"],outputMode:t["output-mode"],runtime:t.runtime,importExt:t["import-ext"],argsStyle:t["args-style"],errorMode:t["error-mode"],dateType:t["date-type"],mockData:t["mock-data"],mockSeed:t["mock-seed"],generators:t.generator?.map(u=>u.startsWith(".")?Zr(u):u),setup:t.setup===void 0?void 0:Pl({setup:t.setup},process.cwd()).setup},i=e.resolvedConfig.apis??{},a=Object.keys(i).filter(u=>re(i[u].client)||i[u].clientOutput!==void 0);if(t.api===void 0){if(t.output)throw new Ve("\n\u274C --output can't target multiple APIs. Set `clientOutput` under each api in redocly.yaml, or pass a single <api>.\n");if(a.length===0)throw new Ve("\n\u274C No API to generate. Add a `client` block or `clientOutput` under an `apis:` entry, or pass <api> (a file/URL or an `apis:` alias).\n")}let c=await rt(t.api===void 0?a:[t.api],e),p=new Set;for(let{path:u,alias:l}of c){let d=l??vg(u,Rg(u)),m=e.forAlias(l),{client:w,clientOutput:h}=m.resolvedConfig,x=Pl(re(w)?w:{},o),P=n(x,s),C=t.output!==void 0?Zr(t.output):h!==void 0?Zr(o,h):Zr(o,_g(d));if(!C.endsWith(".ts"))throw new Ve(`
98
+ `);return $g(r)?t:{...t,setup:Zr(e,r)}}function _g(t){return`${t.replace(/[\\/]/g,"_")}.client.ts`}function Tg(t){if(t.startsWith("//"))return!1;if(t.startsWith("/"))return!0;try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}async function Rl({argv:t,config:e}){let{generateClient:r,mergeConfig:n}=await import("./chunks/PKEPRIA3.js"),o=e.configPath?Pg(e.configPath):process.cwd(),s={serverUrl:t["server-url"],outputMode:t["output-mode"],runtime:t.runtime,importExt:t["import-ext"],argsStyle:t["args-style"],errorMode:t["error-mode"],dateType:t["date-type"],mockData:t["mock-data"],mockSeed:t["mock-seed"],generators:t.generator?.map(u=>u.startsWith(".")?Zr(u):u),setup:t.setup===void 0?void 0:Pl({setup:t.setup},process.cwd()).setup},i=e.resolvedConfig.apis??{},a=Object.keys(i).filter(u=>re(i[u].client)||i[u].clientOutput!==void 0);if(t.api===void 0){if(t.output)throw new Ve("\n\u274C --output can't target multiple APIs. Set `clientOutput` under each api in redocly.yaml, or pass a single <api>.\n");if(a.length===0)throw new Ve("\n\u274C No API to generate. Add a `client` block or `clientOutput` under an `apis:` entry, or pass <api> (a file/URL or an `apis:` alias).\n")}let c=await rt(t.api===void 0?a:[t.api],e),p=new Set;for(let{path:u,alias:l}of c){let d=l??vg(u,Rg(u)),m=e.forAlias(l),{client:w,clientOutput:h}=m.resolvedConfig,C=Pl(re(w)?w:{},o),P=n(C,s),A=t.output!==void 0?Zr(t.output):h!==void 0?Zr(o,h):Zr(o,_g(d));if(!A.endsWith(".ts"))throw new Ve(`
99
99
  \u274C output must point at a TypeScript file (ending in .ts).
100
- Got: ${C}
101
- `);if(p.has(C))throw new Ve(`
102
- \u274C Two APIs resolve to the same output path: ${C}.
100
+ Got: ${A}
101
+ `);if(p.has(A))throw new Ve(`
102
+ \u274C Two APIs resolve to the same output path: ${A}.
103
103
  Give each api a distinct \`clientOutput\`.
104
- `);if(p.add(C),P.serverUrl!==void 0&&!Tg(P.serverUrl))throw new Ve(`
104
+ `);if(p.add(A),P.serverUrl!==void 0&&!Tg(P.serverUrl))throw new Ve(`
105
105
  \u274C serverUrl must be an absolute URL (https://api.example.com) or a root-relative path (/v1) \u2014 set via --server-url or the \`client\` block in redocly.yaml.
106
106
  Got: ${P.serverUrl}
107
107
  `);try{y.info(ue(`
108
108
  Generating TypeScript client for ${d}...
109
- `));let A=await r({...P,api:u,output:C,config:m,configDir:o}),$=`TypeScript client successfully generated: ${`${A.files.length} ${Ie("file",A.files.length)}`} (${A.bytes} bytes) at ${ee(A.outputPath)}.`;y.info(`
109
+ `));let x=await r({...P,api:u,output:A,config:m,configDir:o}),$=`TypeScript client successfully generated: ${`${x.files.length} ${Ie("file",x.files.length)}`} (${x.bytes} bytes) at ${ee(x.outputPath)}.`;y.info(`
110
110
  `+Q($)+`
111
- `)}catch(A){let E=A instanceof Error?A.message:String(A);throw new Ve(`
111
+ `)}catch(x){let E=x instanceof Error?x.message:String(x);throw new Ve(`
112
112
  \u274C Failed to generate TypeScript client for ${d}.
113
113
  ${E}
114
114
  `)}}}import*as Gl from"node:path";import{performance as Fg}from"node:perf_hooks";var Se="components";var $l="channels",Il="operations";import*as _l from"node:path";function Er(t,e){if(re(t)){e(t);for(let r of Object.keys(t))Er(t[r],e)}else if(Array.isArray(t))for(let r of t)Er(r,e)}function Or(t){return t.startsWith(`#/${Se}/`)}function Tl(t,e){Er(t,r=>{if(_e(r)&&Or(r.$ref)){let n=_l.basename(r.$ref);r.$ref=r.$ref.replace(n,e+"_"+n)}else if(re(r.discriminator)&&re(r.discriminator.mapping)){let{mapping:n}=r.discriminator;for(let o of Object.keys(n)){let s=n[o];typeof s=="string"&&Or(s)&&(n[o]=s.split("/").map((i,a,c)=>c.length-1===a&&!i.startsWith(e+"_")?e+"_"+i:i).join("/"))}}})}function Qr(t,e,r){return e?(t||W("Info section is not found in specification."),t[e]||W(`${ee(`prefix-${r}-with-info-prop`)} argument value is not found in info section.`),Vs(t[e])||W(`${ee(`prefix-${r}-with-info-prop`)} argument value should be string.`),t[e].length>50&&W(`${ee(`prefix-${r}-with-info-prop`)} argument value length should not exceed 50 characters.`),t[e].replaceAll(/\s/g,"_")):""}function gs(t,e){return e?t?.map(r=>{let n={};for(let[o,s]of Object.entries(r))Object.assign(n,{[e+"_"+o]:s});return n}):t}function ht(t,e){return e?e+"_"+t:t}import*as jl from"node:path";function Yn(t,e){return t.replace(/"(#\/components\/.*?)"/g,r=>{let n=jl.basename(r);return r.replace(n,ht(n,e))})}function en(t){return t.map(e=>({name:e}))}import*as Kn from"node:path";function Dl(t){return Kn.basename(t,Kn.extname(t))}function Nl(t){return Object.entries(t).filter(([e,r])=>r.length>1)}function ys(t,e){for(let[r,n]of e)y.warn(`Conflict on ${t} : ${Ne(r)} in files: ${Q(n)}
@@ -118,28 +118,28 @@ Suggestion: please use ${Q("prefix-tags-with-filename")}, ${Q("prefix-tags-with-
118
118
 
119
119
  `))}function Ml(t){let e=t.map(([n])=>`\`${n}\``),r=ee(", ");y.warn(`
120
120
  warning: ${e.length} conflict(s) on the ${Ne(e.join(r))} tags description.
121
- `)}function jg(t,e){return!Rt(Object.values(t)[0],Object.values(e)[0])}function Dg(t){let e=!1;for(let r=0,n=t.length;r<n;r++){let o=t[r+1];o&&jg(t[r],o)&&(e=!0)}return e}var bs=0;function Fl({potentialConflicts:t,withoutXTagGroups:e}){for(let r of Object.keys(t))for(let[n,o]of Object.entries(t[r])){let s=Nl(o);if(s.length){if(r===Se)for(let[i,a]of Object.entries(s))Dg(a[1])&&(a[1]=a[1].map(c=>Object.keys(c)[0]),ys(pe(r)+" => "+n,[a]),bs+=1);else e&&r==="tags"?Ml(s):(bs+=s.length,ys(pe(r)+" => "+n,s));r==="tags"&&!e&&Ll(s.length)}}return bs}var Cr="tags",vt="x-tagGroups";function tr({joinedDef:t,withoutXTagGroups:e,context:r}){let{api:n,apiFilename:o,apiTitle:s,tags:i,potentialConflicts:a,tagsPrefix:c,componentsPrefix:p,oasVersion:u}=r;t.hasOwnProperty(Cr)||(t[Cr]=[]),a.tags.hasOwnProperty("all")||(a.tags.all={}),e&&!a.tags.hasOwnProperty("description")&&(a.tags.description={});for(let l of i||[]){let d=ht(l.name,c);l.description&&(l.description=Yn(l.description,p));let m=t.tags.find(h=>h.name===d);if(m&&e){let h=l.hasOwnProperty("description")&&m.description!==l.description;a.tags.description[d].push(...h?[n]:[])}else m||(u==="oas3_0"||u==="oas3_1"?l["x-displayName"]=l["x-displayName"]||l.name:u==="oas3_2"&&(l.summary=l.summary||l.name),l.name=d,t.tags.push(l),e&&(a.tags.description[d]=[n]));if(!e&&u!=="oas3_2"){let h=s||o;Ng(t,h),m||Lg(t,d,kl(t,h))}let w=!a.tags.all[d]||a.tags.all[d]&&!a.tags.all[d].includes(n);a.tags.all[d]=[...a.tags.all[d]||[],...!e&&w?[n]:[]]}}function kl(t,e){return t[vt].findIndex(r=>r.name===e)}function Ng(t,e){t.hasOwnProperty(vt)||(t[vt]=[]),t[vt].some(n=>n.name===e)||t[vt].push({name:e,tags:[]});let r=kl(t,e);t[vt][r].hasOwnProperty(Cr)||(t[vt][r][Cr]=[])}function Lg(t,e,r){t[vt][r][Cr].find(n=>n.name===e)||t[vt][r][Cr].push(e)}import*as Ul from"node:path";function ql({joinedDef:t,openapi:e,context:r}){let{api:n}=r,{externalDocs:o}=e;if(o){if(t.hasOwnProperty("externalDocs")){y.warn(`warning: skip externalDocs from ${Q(Ul.basename(n))}
122
- `);return}t.externalDocs=o}}function Wl({joinedDef:t,withoutXTagGroups:e,openapi:r,context:n,serversAreTheSame:o}){let{apiFilename:s,apiTitle:i,api:a,potentialConflicts:c,tagsPrefix:p,componentsPrefix:u,oasVersion:l}=n,{paths:d,servers:m}=r,w=new Set(Sn);if(d){t.hasOwnProperty("paths")||(t.paths={});for(let A of mo(d)){t.paths.hasOwnProperty(A)||(t.paths[A]={}),c.paths.hasOwnProperty(A)||(c.paths[A]={});let E=d[A],$=o?E.servers:E.servers||m||[];$&&x($,A);for(let _ of mo(E))w.has(_)&&C(E,A,_),_==="parameters"&&P(E,A),(typeof E[_]=="string"||_.startsWith("x-"))&&h(E,A,_)}}function h(A,E,$){let _=A[$];if(t.paths[E].hasOwnProperty($)&&!Rt(t.paths[E][$],_)){y.warn(`warning: different ${$} values in ${E}
123
- `);return}t.paths[E][$]=_}function x(A,E){if(A){t.paths[E].hasOwnProperty("servers")||(t.paths[E].servers=[]);for(let $ of A){let _=!1;for(let J of t.paths[E].servers)J.url===$.url&&(Mg(J,$)||W(`Different server values for (${$.url}) in ${E}.`),_=!0);_||t.paths[E].servers.push($)}}}function P(A,E){if(A.parameters){t.paths[E].hasOwnProperty("parameters")||(t.paths[E].parameters=[]);for(let $ of A.parameters){let _=!1;for(let J of t.paths[E].parameters)_e(J)&&_e($)&&J.$ref===$.$ref&&(_=!0),!_e(J)&&!_e($)&&J.name===$.name&&J.in===$.in&&(Rt(J.schema,$.schema)||W(`Different parameter schemas for (${$.name}) in ${E}.`),_=!0);_||t.paths[E].parameters.push($)}}}function C(A,E,$){let _=A[$];if(!_)return;t.paths[E][$]=_,c.paths[E][$]=[...c.paths[E][$]||[],a];let{operationId:J}=_;J&&(c.paths.hasOwnProperty("operationIds")||(c.paths.operationIds={}),c.paths.operationIds[J]=[...c.paths.operationIds[J]||[],a]);let{tags:ie,security:V}=t.paths[E][$];ie?(t.paths[E][$].tags=ie.map(De=>ht(De,p)),tr({joinedDef:t,withoutXTagGroups:e,context:{api:a,apiFilename:s,apiTitle:i,tags:en(ie),potentialConflicts:c,tagsPrefix:p,componentsPrefix:u,oasVersion:l}})):(t.paths[E][$].tags=[ht("other",p||s)],tr({joinedDef:t,withoutXTagGroups:e,context:{api:a,apiFilename:s,apiTitle:i,tags:en(["other"]),potentialConflicts:c,tagsPrefix:p||s,componentsPrefix:u,oasVersion:l}})),!V&&r.hasOwnProperty("security")?t.paths[E][$].security=gs(r.security,u):_.security&&(t.paths[E][$].security=gs(_.security,u))}}function Mg(t,e){return t.description===e.description?Rt(t.variables,e.variables):!1}function zl({joinedDef:t,openapi:e,context:r}){let{api:n,potentialConflicts:o,componentsPrefix:s}=r,{components:i}=e;if(i){t.hasOwnProperty(Se)||(t[Se]={});for(let[a,c]of Object.entries(i)){o[Se].hasOwnProperty(a)||(o[Se][a]={},t[Se][a]={});for(let p of Object.keys(c)){let u=ht(p,s);o.components[a][u]=[...o.components[a][p]||[],{[n]:c[p]}],t.components[a][u]=c[p]}}}}function Vl({joinedDef:t,withoutXTagGroups:e,openapi:r,context:n}){let{apiFilename:o,apiTitle:s,api:i,potentialConflicts:a,tagsPrefix:c,componentsPrefix:p,oasVersion:u}=n,l=u==="oas3_0"?"x-webhooks":"webhooks",d=r[l];if(d){t.hasOwnProperty(l)||(t[l]={});for(let m of Object.keys(d)){t[l][m]=d[m],a.webhooks.hasOwnProperty(m)||(a.webhooks[m]={});for(let w of Object.keys(d[m]))a.webhooks[m][w]=[...a.webhooks[m][w]||[],i];for(let w of Object.keys(t[l][m])){let{tags:h}=t[l][m][w];h&&(t[l][m][w].tags=h.map(x=>ht(x,c)),tr({joinedDef:t,withoutXTagGroups:e,context:{api:i,apiFilename:o,apiTitle:s,tags:en(h),potentialConflicts:a,tagsPrefix:c,componentsPrefix:p,oasVersion:u}}))}}}}function Bl(t,e,r){let o=e[0].parsed,s=Qr(o.info,r,Se);o.openapi||W("Version of specification is not found."),o.info||W("Info section is not found in specification."),o.info?.description&&(o.info.description=Yn(o.info.description,s)),t.openapi=o.openapi,t.info=o.info}async function Hl({argv:t,config:e,version:r,collectSpecData:n}){let o=Fg.now(),{"prefix-components-with-info-prop":s,"prefix-tags-with-filename":i,"prefix-tags-with-info-prop":a,"without-x-tag-groups":c,output:p}=t,u=[i&&"prefix-tags-with-filename",a&&"prefix-tags-with-info-prop",c&&"without-x-tag-groups"].filter(Boolean);if(u.length>1)return W(`You use ${ee(u.join(", "))} together.
124
- Please choose only one!`);let l=await rt(t.apis,e);if(l.length<2)return W("At least 2 APIs should be provided.");let d=yn(p||l[0].path),m=p||`openapi.${d}`,w=new ft(e.resolve),h=await Promise.all(l.map(({path:I})=>w.resolveDocument(null,I,!0))),x=new Set([...Object.keys(e.decorators.oas3_0),...Object.keys(e.decorators.oas3_1),...Object.keys(e.decorators.oas2)]);e.skipDecorators(Array.from(x));let P=new Set([...Object.keys(e.preprocessors.oas3_0),...Object.keys(e.preprocessors.oas3_1),...Object.keys(e.preprocessors.oas2)]);e.skipPreprocessors(Array.from(P));let C=await Promise.all(h.map(I=>ri({document:I,config:e,externalRefResolver:new ft(e.resolve),types:cr(ut(I.parsed))}).catch(v=>{W(`${v.message}: ${Q(I.source.absoluteRef)}`)})));for(let{problems:I,bundle:v}of C){let M=pn(I);M.errors&&(un(I,{totals:M,version:r,command:"join"}),W(`\u274C Errors encountered while bundling ${Q(v.source.absoluteRef)}: join will not proceed.`))}let A=null;for(let I of h)try{let v=ut(I.parsed);if(n?.(I),v!=="oas3_0"&&v!=="oas3_1"&&v!=="oas3_2")return W(`Only OpenAPI 3.0, 3.1, and 3.2 are supported: ${Q(I.source.absoluteRef)}.`);if(A=A??v,A!==v)return W(`All APIs must use the same OpenAPI version: ${Q(I.source.absoluteRef)}.`)}catch(v){return W(`${v.message}: ${Q(I.source.absoluteRef)}.`)}let[E,...$]=h??[],_=$.every(({parsed:{paths:I,servers:v}})=>!I||yt(I||{})?!0:v?.every(M=>E.parsed.servers?.find(({url:U})=>U===M.url))),J={},ie={tags:{},paths:{},components:{},webhooks:{}};Bl(J,h,s),_&&E.parsed.servers&&(J.servers=E.parsed.servers);for(let I of h){let v=re(I.parsed)?I.parsed:{},{tags:M,info:U}=v,ne=Gl.relative(process.cwd(),I.source.absoluteRef),te=Dl(ne),Y=i?te:Qr(U,a,"tags"),ce=Qr(U,s,Se);v.hasOwnProperty("x-tagGroups")&&y.warn(`warning: x-tagGroups at ${Q(ne)} will be skipped
125
- `);let $e={api:ne,apiFilename:te,apiTitle:U?.title,tags:M,potentialConflicts:ie,tagsPrefix:Y,componentsPrefix:ce,oasVersion:A};M&&tr({joinedDef:J,withoutXTagGroups:c,context:$e}),ql({joinedDef:J,openapi:v,context:$e}),Wl({joinedDef:J,withoutXTagGroups:c,openapi:v,context:$e,serversAreTheSame:_}),zl({joinedDef:J,openapi:v,context:$e}),Vl({joinedDef:J,withoutXTagGroups:c,openapi:v,context:$e}),ce&&Tl(v,ce)}let V=Fl({potentialConflicts:ie,withoutXTagGroups:c}),De=!0;if(V)return W(`Please fix conflicts before running ${ee("join")}.`);Pe(kr(J),m,De),He("join",o,m)}var Ss={realm:"@redocly/realm","redoc-revel":"@redocly/redoc-revel","revel-reef":"@redocly/revel-reef","redoc-reef":"@redocly/redoc-reef",redoc:"@redocly/redoc",revel:"@redocly/revel",reef:"@redocly/reef"},ws={redoc:"Redoc",revel:"Revel",reef:"Reef",realm:"Realm","redoc-revel":"Redoc + Revel","redoc-reef":"Redoc + Reef","revel-reef":"Revel + Reef"},Yl=["pro","enterprise"];import{spawn as kg}from"node:child_process";import{existsSync as Ug,readFileSync as qg}from"node:fs";import Wg from"node:path";var Kl=async({argv:t})=>{let{plan:e,port:r}=t,n=t["project-dir"],o=t.product||Vg(n);if(!zg(o))throw y.info(`Invalid product ${o}.`),new Error("Project preview launch failed.");let s=ws[o],i=Ss[o];y.info(`
121
+ `)}function jg(t,e){return!Rt(Object.values(t)[0],Object.values(e)[0])}function Dg(t){let e=!1;for(let r=0,n=t.length;r<n;r++){let o=t[r+1];o&&jg(t[r],o)&&(e=!0)}return e}var bs=0;function Fl({potentialConflicts:t,withoutXTagGroups:e}){for(let r of Object.keys(t))for(let[n,o]of Object.entries(t[r])){let s=Nl(o);if(s.length){if(r===Se)for(let[i,a]of Object.entries(s))Dg(a[1])&&(a[1]=a[1].map(c=>Object.keys(c)[0]),ys(pe(r)+" => "+n,[a]),bs+=1);else e&&r==="tags"?Ml(s):(bs+=s.length,ys(pe(r)+" => "+n,s));r==="tags"&&!e&&Ll(s.length)}}return bs}var Ar="tags",vt="x-tagGroups";function tr({joinedDef:t,withoutXTagGroups:e,context:r}){let{api:n,apiFilename:o,apiTitle:s,tags:i,potentialConflicts:a,tagsPrefix:c,componentsPrefix:p,oasVersion:u}=r;t.hasOwnProperty(Ar)||(t[Ar]=[]),a.tags.hasOwnProperty("all")||(a.tags.all={}),e&&!a.tags.hasOwnProperty("description")&&(a.tags.description={});for(let l of i||[]){let d=ht(l.name,c);l.description&&(l.description=Yn(l.description,p));let m=t.tags.find(h=>h.name===d);if(m&&e){let h=l.hasOwnProperty("description")&&m.description!==l.description;a.tags.description[d].push(...h?[n]:[])}else m||(u==="oas3_0"||u==="oas3_1"?l["x-displayName"]=l["x-displayName"]||l.name:u==="oas3_2"&&(l.summary=l.summary||l.name),l.name=d,t.tags.push(l),e&&(a.tags.description[d]=[n]));if(!e&&u!=="oas3_2"){let h=s||o;Ng(t,h),m||Lg(t,d,kl(t,h))}let w=!a.tags.all[d]||a.tags.all[d]&&!a.tags.all[d].includes(n);a.tags.all[d]=[...a.tags.all[d]||[],...!e&&w?[n]:[]]}}function kl(t,e){return t[vt].findIndex(r=>r.name===e)}function Ng(t,e){t.hasOwnProperty(vt)||(t[vt]=[]),t[vt].some(n=>n.name===e)||t[vt].push({name:e,tags:[]});let r=kl(t,e);t[vt][r].hasOwnProperty(Ar)||(t[vt][r][Ar]=[])}function Lg(t,e,r){t[vt][r][Ar].find(n=>n.name===e)||t[vt][r][Ar].push(e)}import*as Ul from"node:path";function ql({joinedDef:t,openapi:e,context:r}){let{api:n}=r,{externalDocs:o}=e;if(o){if(t.hasOwnProperty("externalDocs")){y.warn(`warning: skip externalDocs from ${Q(Ul.basename(n))}
122
+ `);return}t.externalDocs=o}}function Wl({joinedDef:t,withoutXTagGroups:e,openapi:r,context:n,serversAreTheSame:o}){let{apiFilename:s,apiTitle:i,api:a,potentialConflicts:c,tagsPrefix:p,componentsPrefix:u,oasVersion:l}=n,{paths:d,servers:m}=r,w=new Set(Sn);if(d){t.hasOwnProperty("paths")||(t.paths={});for(let x of mo(d)){t.paths.hasOwnProperty(x)||(t.paths[x]={}),c.paths.hasOwnProperty(x)||(c.paths[x]={});let E=d[x],$=o?E.servers:E.servers||m||[];$&&C($,x);for(let _ of mo(E))w.has(_)&&A(E,x,_),_==="parameters"&&P(E,x),(typeof E[_]=="string"||_.startsWith("x-"))&&h(E,x,_)}}function h(x,E,$){let _=x[$];if(t.paths[E].hasOwnProperty($)&&!Rt(t.paths[E][$],_)){y.warn(`warning: different ${$} values in ${E}
123
+ `);return}t.paths[E][$]=_}function C(x,E){if(x){t.paths[E].hasOwnProperty("servers")||(t.paths[E].servers=[]);for(let $ of x){let _=!1;for(let J of t.paths[E].servers)J.url===$.url&&(Mg(J,$)||W(`Different server values for (${$.url}) in ${E}.`),_=!0);_||t.paths[E].servers.push($)}}}function P(x,E){if(x.parameters){t.paths[E].hasOwnProperty("parameters")||(t.paths[E].parameters=[]);for(let $ of x.parameters){let _=!1;for(let J of t.paths[E].parameters)_e(J)&&_e($)&&J.$ref===$.$ref&&(_=!0),!_e(J)&&!_e($)&&J.name===$.name&&J.in===$.in&&(Rt(J.schema,$.schema)||W(`Different parameter schemas for (${$.name}) in ${E}.`),_=!0);_||t.paths[E].parameters.push($)}}}function A(x,E,$){let _=x[$];if(!_)return;t.paths[E][$]=_,c.paths[E][$]=[...c.paths[E][$]||[],a];let{operationId:J}=_;J&&(c.paths.hasOwnProperty("operationIds")||(c.paths.operationIds={}),c.paths.operationIds[J]=[...c.paths.operationIds[J]||[],a]);let{tags:ie,security:V}=t.paths[E][$];ie?(t.paths[E][$].tags=ie.map(De=>ht(De,p)),tr({joinedDef:t,withoutXTagGroups:e,context:{api:a,apiFilename:s,apiTitle:i,tags:en(ie),potentialConflicts:c,tagsPrefix:p,componentsPrefix:u,oasVersion:l}})):(t.paths[E][$].tags=[ht("other",p||s)],tr({joinedDef:t,withoutXTagGroups:e,context:{api:a,apiFilename:s,apiTitle:i,tags:en(["other"]),potentialConflicts:c,tagsPrefix:p||s,componentsPrefix:u,oasVersion:l}})),!V&&r.hasOwnProperty("security")?t.paths[E][$].security=gs(r.security,u):_.security&&(t.paths[E][$].security=gs(_.security,u))}}function Mg(t,e){return t.description===e.description?Rt(t.variables,e.variables):!1}function zl({joinedDef:t,openapi:e,context:r}){let{api:n,potentialConflicts:o,componentsPrefix:s}=r,{components:i}=e;if(i){t.hasOwnProperty(Se)||(t[Se]={});for(let[a,c]of Object.entries(i)){o[Se].hasOwnProperty(a)||(o[Se][a]={},t[Se][a]={});for(let p of Object.keys(c)){let u=ht(p,s);o.components[a][u]=[...o.components[a][p]||[],{[n]:c[p]}],t.components[a][u]=c[p]}}}}function Vl({joinedDef:t,withoutXTagGroups:e,openapi:r,context:n}){let{apiFilename:o,apiTitle:s,api:i,potentialConflicts:a,tagsPrefix:c,componentsPrefix:p,oasVersion:u}=n,l=u==="oas3_0"?"x-webhooks":"webhooks",d=r[l];if(d){t.hasOwnProperty(l)||(t[l]={});for(let m of Object.keys(d)){t[l][m]=d[m],a.webhooks.hasOwnProperty(m)||(a.webhooks[m]={});for(let w of Object.keys(d[m]))a.webhooks[m][w]=[...a.webhooks[m][w]||[],i];for(let w of Object.keys(t[l][m])){let{tags:h}=t[l][m][w];h&&(t[l][m][w].tags=h.map(C=>ht(C,c)),tr({joinedDef:t,withoutXTagGroups:e,context:{api:i,apiFilename:o,apiTitle:s,tags:en(h),potentialConflicts:a,tagsPrefix:c,componentsPrefix:p,oasVersion:u}}))}}}}function Bl(t,e,r){let o=e[0].parsed,s=Qr(o.info,r,Se);o.openapi||W("Version of specification is not found."),o.info||W("Info section is not found in specification."),o.info?.description&&(o.info.description=Yn(o.info.description,s)),t.openapi=o.openapi,t.info=o.info}async function Hl({argv:t,config:e,version:r,collectSpecData:n}){let o=Fg.now(),{"prefix-components-with-info-prop":s,"prefix-tags-with-filename":i,"prefix-tags-with-info-prop":a,"without-x-tag-groups":c,output:p}=t,u=[i&&"prefix-tags-with-filename",a&&"prefix-tags-with-info-prop",c&&"without-x-tag-groups"].filter(Boolean);if(u.length>1)return W(`You use ${ee(u.join(", "))} together.
124
+ Please choose only one!`);let l=await rt(t.apis,e);if(l.length<2)return W("At least 2 APIs should be provided.");let d=yn(p||l[0].path),m=p||`openapi.${d}`,w=new ft(e.resolve),h=await Promise.all(l.map(({path:I})=>w.resolveDocument(null,I,!0))),C=new Set([...Object.keys(e.decorators.oas3_0),...Object.keys(e.decorators.oas3_1),...Object.keys(e.decorators.oas2)]);e.skipDecorators(Array.from(C));let P=new Set([...Object.keys(e.preprocessors.oas3_0),...Object.keys(e.preprocessors.oas3_1),...Object.keys(e.preprocessors.oas2)]);e.skipPreprocessors(Array.from(P));let A=await Promise.all(h.map(I=>ri({document:I,config:e,externalRefResolver:new ft(e.resolve),types:cr(ut(I.parsed))}).catch(v=>{W(`${v.message}: ${Q(I.source.absoluteRef)}`)})));for(let{problems:I,bundle:v}of A){let M=pn(I);M.errors&&(un(I,{totals:M,version:r,command:"join"}),W(`\u274C Errors encountered while bundling ${Q(v.source.absoluteRef)}: join will not proceed.`))}let x=null;for(let I of h)try{let v=ut(I.parsed);if(n?.(I),v!=="oas3_0"&&v!=="oas3_1"&&v!=="oas3_2")return W(`Only OpenAPI 3.0, 3.1, and 3.2 are supported: ${Q(I.source.absoluteRef)}.`);if(x=x??v,x!==v)return W(`All APIs must use the same OpenAPI version: ${Q(I.source.absoluteRef)}.`)}catch(v){return W(`${v.message}: ${Q(I.source.absoluteRef)}.`)}let[E,...$]=h??[],_=$.every(({parsed:{paths:I,servers:v}})=>!I||yt(I||{})?!0:v?.every(M=>E.parsed.servers?.find(({url:U})=>U===M.url))),J={},ie={tags:{},paths:{},components:{},webhooks:{}};Bl(J,h,s),_&&E.parsed.servers&&(J.servers=E.parsed.servers);for(let I of h){let v=re(I.parsed)?I.parsed:{},{tags:M,info:U}=v,ne=Gl.relative(process.cwd(),I.source.absoluteRef),te=Dl(ne),Y=i?te:Qr(U,a,"tags"),ce=Qr(U,s,Se);v.hasOwnProperty("x-tagGroups")&&y.warn(`warning: x-tagGroups at ${Q(ne)} will be skipped
125
+ `);let $e={api:ne,apiFilename:te,apiTitle:U?.title,tags:M,potentialConflicts:ie,tagsPrefix:Y,componentsPrefix:ce,oasVersion:x};M&&tr({joinedDef:J,withoutXTagGroups:c,context:$e}),ql({joinedDef:J,openapi:v,context:$e}),Wl({joinedDef:J,withoutXTagGroups:c,openapi:v,context:$e,serversAreTheSame:_}),zl({joinedDef:J,openapi:v,context:$e}),Vl({joinedDef:J,withoutXTagGroups:c,openapi:v,context:$e}),ce&&Tl(v,ce)}let V=Fl({potentialConflicts:ie,withoutXTagGroups:c}),De=!0;if(V)return W(`Please fix conflicts before running ${ee("join")}.`);Pe(kr(J),m,De),He("join",o,m)}var Ss={realm:"@redocly/realm","redoc-revel":"@redocly/redoc-revel","revel-reef":"@redocly/revel-reef","redoc-reef":"@redocly/redoc-reef",redoc:"@redocly/redoc",revel:"@redocly/revel",reef:"@redocly/reef"},ws={redoc:"Redoc",revel:"Revel",reef:"Reef",realm:"Realm","redoc-revel":"Redoc + Revel","redoc-reef":"Redoc + Reef","revel-reef":"Revel + Reef"},Yl=["pro","enterprise"];import{spawn as kg}from"node:child_process";import{existsSync as Ug,readFileSync as qg}from"node:fs";import Wg from"node:path";var Kl=async({argv:t})=>{let{plan:e,port:r}=t,n=t["project-dir"],o=t.product||Vg(n);if(!zg(o))throw y.info(`Invalid product ${o}.`),new Error("Project preview launch failed.");let s=ws[o],i=Ss[o];y.info(`
126
126
  Launching preview of ${s} ${e} using NPX.
127
127
 
128
128
  `);let{npxExecutableName:a,shell:c}=wr();kg(a,["-y",i,"preview",`--plan=${e}`,`--port=${r||4e3}`],{stdio:"inherit",cwd:n,shell:c}).on("error",u=>{throw y.info(`Project preview launch failed: ${u.message}`),new Error("Project preview launch failed.")})},zg=t=>t?!!ws[t]:!1,Vg=t=>{let e=Wg.join(process.cwd(),t,"package.json");if(Ug(e))try{let n=JSON.parse(qg(e,"utf-8")).dependencies||{};for(let[o,s]of Object.entries(Ss))if(n[s])return y.info(`
129
129
  ${s} detected in project's 'package.json'`),o}catch{y.info(`Invalid 'package.json': ${e}. Using Realm.`)}return"realm"};import{existsSync as fy,readFileSync as my,writeFileSync as yp}from"node:fs";import{dirname as dy,basename as hy}from"node:path";function Es(t,e){return JSON.stringify(t,(n,o)=>{if(o instanceof ArrayBuffer){if(o.byteLength>1048576)return{__type:"ArrayBuffer",data:`File too large to serialize (${o.byteLength} bytes). Maximum allowed size is 1048576 bytes.`,byteLength:o.byteLength};let s=new Uint8Array(o);return{__type:"ArrayBuffer",data:Buffer.from(s).toString("base64"),byteLength:o.byteLength}}return o instanceof File?{__type:"File",name:o.name||"[File Object]",size:o.size||0,type:o.type||"",lastModified:o.lastModified||0}:o},e)}var Jl=Pt(Vo(),1);import*as Xl from"node:fs";import*as rr from"node:path";function Zl(t){if(t){let e=rr.dirname(t);for(;e!==rr.resolve(e,"..");){let r=rr.join(e,".env");if(Xl.existsSync(r)){Jl.config({path:r});break}e=rr.resolve(e,"..")}}return process.env}var Lt=Pt(ci(),1);function Bg(t,e={}){let{clientCert:r,clientKey:n,caCert:o}=e,s=new URL(t).origin,i=go(),a=i&&!li(t);if(r&&n&&a)return new Lt.ProxyAgent({uri:i,connect:{key:Buffer.from(n),cert:Buffer.from(r),...o&&{ca:Buffer.from(o)},rejectUnauthorized:!0}});if(r&&n)return new Lt.Client(s,{connect:{key:Buffer.from(n),cert:Buffer.from(r),...o&&{ca:Buffer.from(o)},rejectUnauthorized:!0}});if(a)return new Lt.ProxyAgent({uri:i})}function Ql(t){if(!go()&&(!t||Object.keys(t).length===0))return Lt.fetch;let r=new Map;return(n,o)=>{let s=typeof n=="string"?n:n instanceof URL?n.toString():"url"in n?n.url:void 0;if(!s)throw new Error("Invalid input URL");let i=t?Gg(s,t):void 0,a=new URL(s).origin,c=r.get(a);return c||(c=Bg(s,i)||o?.dispatcher,c&&r.set(a,c)),(0,Lt.fetch)(n,{...o,dispatcher:c})}}function Gg(t,e){let r=new URL(t);return e[r.origin]||e[r.hostname]}import*as Os from"node:path";function ep(t,e){let n=Math.max(...t.map(({file:i})=>Os.basename(i).length+40)),o=[{name:"Filename",width:n},{name:"Workflows",width:10},{name:"Passed",width:7},{name:"Failed",width:7},{name:"Warnings",width:8}],s="";s+=`${ue(`\u250C${o.map(i=>"\u2500".repeat(i.width+2)).join("\u252C")}\u2510`)}
130
130
  `,s+=`${ue(`\u2502${o.map(i=>` ${i.name.padEnd(i.width)} `).join("\u2502")}\u2502`)}
131
131
  `,s+=`${ue(`\u251C${o.map(i=>"\u2500".repeat(i.width+2)).join("\u253C")}\u2524`)}
132
- `,t.forEach(({file:i,executedWorkflows:a,argv:c})=>{let p=Os.basename(i),u=c?.workflow||[],l=c?.skip||[],d=u&&u.length?a.filter(({workflowId:$})=>u.includes($)):a;d=l&&l.length?d.filter(({workflowId:$})=>!l.includes($)):d;let{workflows:m}=bn(d),w=ue(m.total.toString().padEnd(11)),h=pe(m.passed.toString().padEnd(8)),x=m.failed>0?Ne(m.failed.toString().padEnd(8)):ue("-".padEnd(8)),P=m.warnings>0?ee(m.warnings.toString().padEnd(9)):ue("-".padEnd(9)),A=`${m.failed>0?"x":"\u2713"} ${p}`.padEnd(n+1),E=m.failed>0?Ne(A):pe(A);s+=ue("\u2502")+` ${E}`+ue("\u2502")+` ${w}`+ue("\u2502")+` ${h}`+ue("\u2502")+` ${x}`+ue("\u2502")+` ${P}`+ue("\u2502")+`
132
+ `,t.forEach(({file:i,executedWorkflows:a,argv:c})=>{let p=Os.basename(i),u=c?.workflow||[],l=c?.skip||[],d=u&&u.length?a.filter(({workflowId:$})=>u.includes($)):a;d=l&&l.length?d.filter(({workflowId:$})=>!l.includes($)):d;let{workflows:m}=bn(d),w=ue(m.total.toString().padEnd(11)),h=pe(m.passed.toString().padEnd(8)),C=m.failed>0?Ne(m.failed.toString().padEnd(8)):ue("-".padEnd(8)),P=m.warnings>0?ee(m.warnings.toString().padEnd(9)):ue("-".padEnd(9)),x=`${m.failed>0?"x":"\u2713"} ${p}`.padEnd(n+1),E=m.failed>0?Ne(x):pe(x);s+=ue("\u2502")+` ${E}`+ue("\u2502")+` ${w}`+ue("\u2502")+` ${h}`+ue("\u2502")+` ${C}`+ue("\u2502")+` ${P}`+ue("\u2502")+`
133
133
  `}),s+=`${ue(`\u2514${o.map(i=>"\u2500".repeat(i.width+2)).join("\u2534")}\u2518`)}${Ei}
134
- `,e.output(s)}function tp({entries:t=[],pageInfo:e={},version:r}={entries:[],pageInfo:{},version:void 0}){return{log:{version:"1.2",creator:{name:"@redocly/respect-core",version:r},pages:[Object.assign({startedDateTime:new Date().toISOString(),id:"page_1",title:"Page",pageTimings:{onContentLoad:-1,onLoad:-1}},e)],entries:t}}}var fp=Pt(ci(),1);import{URL as iy}from"url";function rp(t,e){if(t)if(typeof t.set=="function"&&typeof t.constructor=="function"){let r=t.constructor,n=new r(t);for(let o in e)n.set(o,e[o]);return n}else return Object.assign({},t,e);else return e}function Cs(t){let e=[];if(Array.isArray(t))for(let r=0;r<t.length;r+=2)e.push({name:t[r],value:t[r+1]});else if(t instanceof Map||t.entries)for(let[r,n]of t.entries())e.push({name:r,value:n});else if(re(t))for(let[r,n]of Object.entries(t))e.push({name:r,value:n});return e}var ip=Pt(sp(),1);function ap(t){let e=[];for(let[r,n]of Object.entries(t))if(r.toLowerCase()==="cookie"){let o=Array.isArray(n)?n:[n];for(let s of o){let i=ip.parse(s);for(let[a,c]of Object.entries(i))e.push({name:a,value:c})}}return e}var pp=Pt(lp(),1);function up(t){let e=[],r=t instanceof Headers?t.getSetCookie():t["set-cookie"];if(r)for(let n of r){let o;try{o=pp.parse(n)}catch{continue}for(let s of o){let{name:i,value:a,path:c,domain:p,expires:u,httpOnly:l,secure:d}=s,m={name:i,value:a,httpOnly:l||!1,secure:d||!1};c&&(m.path=c),p&&(m.domain=p),u&&(m.expires=u.toISOString()),e.push(m)}}return e}function Mt(t,e){let r=e[0]-t[0],n=e[1]-t[1];return r*1e3+n/1e6}var ay="x-har-request-id",Xn=new Map,Ps=function(t,e={}){return Ps.harEntryMap=Xn,async function(n,o={}){let{har:s=e.har,harPageRef:i=e.harPageRef,onHarEntry:a=e.onHarEntry}=o;if(s===!1)return t(n,o);let c=crypto.randomUUID(),p=process.hrtime(),u=new iy(typeof n=="string"?n:n.url),l={_compressed:!1,_resourceType:"fetch",_timestamps:{start:p,socket:p,lookup:p,connect:p,secureConnect:p,sent:p,firstByte:p,received:p},timings:{blocked:-1,dns:-1,connect:-1,send:0,wait:0,receive:0,ssl:-1},time:0,startedDateTime:new Date().toISOString(),cache:{beforeRequest:null,afterRequest:null},request:{method:o.method||"GET",url:u.href,cookies:ap(o.headers||{}),headers:Cs(o.headers||{}),queryString:[...u.searchParams].map(([V,De])=>({name:V,value:De})),headersSize:-1,bodySize:-1,postData:{},httpVersion:"HTTP/1.1"},response:{},pageref:""},d=o.dispatcher||new fp.Client(u.origin);d.on("connect",()=>l._timestamps.connect=process.hrtime()),o=Object.assign({},o,{headers:rp(o.headers,{[ay]:c}),dispatcher:d}),Xn.set(c,l),l._timestamps.sent=process.hrtime();let m=await t(n,o),w=m.clone(),h=m.clone();l._timestamps.firstByte=process.hrtime();let x=m.body===null?"":await w.text();l._timestamps.received=process.hrtime();let P=Xn.get(c);if(Xn.delete(c),!P)return m;P.response||(P.response={});let C=[...m.headers.entries()].map(([V,De])=>`${V}: ${De}`),A=`HTTP/1.1 ${m.status} ${m.statusText}`,E=Buffer.byteLength(A+`\r
135
- `+C.join(`\r
134
+ `,e.output(s)}function tp({entries:t=[],pageInfo:e={},version:r}={entries:[],pageInfo:{},version:void 0}){return{log:{version:"1.2",creator:{name:"@redocly/respect-core",version:r},pages:[Object.assign({startedDateTime:new Date().toISOString(),id:"page_1",title:"Page",pageTimings:{onContentLoad:-1,onLoad:-1}},e)],entries:t}}}var fp=Pt(ci(),1);import{URL as iy}from"url";function rp(t,e){if(t)if(typeof t.set=="function"&&typeof t.constructor=="function"){let r=t.constructor,n=new r(t);for(let o in e)n.set(o,e[o]);return n}else return Object.assign({},t,e);else return e}function As(t){let e=[];if(Array.isArray(t))for(let r=0;r<t.length;r+=2)e.push({name:t[r],value:t[r+1]});else if(t instanceof Map||t.entries)for(let[r,n]of t.entries())e.push({name:r,value:n});else if(re(t))for(let[r,n]of Object.entries(t))e.push({name:r,value:n});return e}var ip=Pt(sp(),1);function ap(t){let e=[];for(let[r,n]of Object.entries(t))if(r.toLowerCase()==="cookie"){let o=Array.isArray(n)?n:[n];for(let s of o){let i=ip.parse(s);for(let[a,c]of Object.entries(i))e.push({name:a,value:c})}}return e}var pp=Pt(lp(),1);function up(t){let e=[],r=t instanceof Headers?t.getSetCookie():t["set-cookie"];if(r)for(let n of r){let o;try{o=pp.parse(n)}catch{continue}for(let s of o){let{name:i,value:a,path:c,domain:p,expires:u,httpOnly:l,secure:d}=s,m={name:i,value:a,httpOnly:l||!1,secure:d||!1};c&&(m.path=c),p&&(m.domain=p),u&&(m.expires=u.toISOString()),e.push(m)}}return e}function Mt(t,e){let r=e[0]-t[0],n=e[1]-t[1];return r*1e3+n/1e6}var ay="x-har-request-id",Xn=new Map,Ps=function(t,e={}){return Ps.harEntryMap=Xn,async function(n,o={}){let{har:s=e.har,harPageRef:i=e.harPageRef,onHarEntry:a=e.onHarEntry}=o;if(s===!1)return t(n,o);let c=crypto.randomUUID(),p=process.hrtime(),u=new iy(typeof n=="string"?n:n.url),l={_compressed:!1,_resourceType:"fetch",_timestamps:{start:p,socket:p,lookup:p,connect:p,secureConnect:p,sent:p,firstByte:p,received:p},timings:{blocked:-1,dns:-1,connect:-1,send:0,wait:0,receive:0,ssl:-1},time:0,startedDateTime:new Date().toISOString(),cache:{beforeRequest:null,afterRequest:null},request:{method:o.method||"GET",url:u.href,cookies:ap(o.headers||{}),headers:As(o.headers||{}),queryString:[...u.searchParams].map(([V,De])=>({name:V,value:De})),headersSize:-1,bodySize:-1,postData:{},httpVersion:"HTTP/1.1"},response:{},pageref:""},d=o.dispatcher||new fp.Client(u.origin);d.on("connect",()=>l._timestamps.connect=process.hrtime()),o=Object.assign({},o,{headers:rp(o.headers,{[ay]:c}),dispatcher:d}),Xn.set(c,l),l._timestamps.sent=process.hrtime();let m=await t(n,o),w=m.clone(),h=m.clone();l._timestamps.firstByte=process.hrtime();let C=m.body===null?"":await w.text();l._timestamps.received=process.hrtime();let P=Xn.get(c);if(Xn.delete(c),!P)return m;P.response||(P.response={});let A=[...m.headers.entries()].map(([V,De])=>`${V}: ${De}`),x=`HTTP/1.1 ${m.status} ${m.statusText}`,E=Buffer.byteLength(x+`\r
135
+ `+A.join(`\r
136
136
  `)+`\r
137
137
  \r
138
- `);if(P._compressed=/^(gzip|compress|deflate|br)$/.test(m.headers.get("content-encoding")||""),P.response.content||(P.response.content={size:-1}),P._compressed){let V=await h.arrayBuffer();P.response.content.size=V.byteLength}else P.response.content.size=x?Buffer.byteLength(x):-1;let $=x?Buffer.byteLength(x):-1;P.response={headers:Cs(m.headers),cookies:up(m.headers),status:m.status,statusText:m.statusText||"",httpVersion:m.httpVersion?`HTTP/${m.httpVersion}`:"HTTP/1.1",redirectURL:m.headers.location||"",content:{size:P._compressed&&P.response.content.size!==-1?P.response.content.size:Buffer.byteLength(x),mimeType:m.headers.get("content-type")||"",text:x,compression:P._compressed&&P.response.content.size!==-1?P.response.content.size-$:0},bodySize:$,headersSize:E};let{_timestamps:_}=P;P.timings={blocked:Math.max(Mt(_.start,_.socket),.01),dns:-1,connect:Math.max(Mt(_.lookup,_.connect),-1),ssl:_.secureConnect?Math.max(Mt(_.connect,_.secureConnect),-1):-1,send:Mt(_.secureConnect||_.connect,_.sent),wait:Math.max(Mt(_.sent,_.firstByte),0),receive:Mt(_.firstByte,_.received)},P.time=Mt(_.start,_.received);let J=[],ie=P;do{let V=ie._parent;delete ie._parent,V&&J.unshift(V),ie=V}while(ie);return l.pageref=i||"page_1",J.forEach(V=>{V.pageref=l.pageref}),m.harEntry=l,Array.isArray(s?.log?.entries)&&s.log.entries.push(...J,l),a&&(J.forEach(V=>{a(V)}),a(l)),m}};function mp(t){let e={};for(let r of t){let{executedWorkflows:n,globalTimeoutError:o,ctx:s,secretValues:i}=r;e[r.file]=Oi({value:{totalRequests:r.totalRequests,executedWorkflows:n.map(a=>dp(a)),totalTimeMs:r.totalTimeMs,globalTimeoutError:o,secretValues:i},noSecretsMasking:s.noSecretsMasking,secretsSet:s.secretsSet||new Set})}return e}function dp(t){let{ctx:e,...r}=t,n=t.executedSteps.map(i=>cy(i,t.workflowId,e)),o=bn([t]);return{...r,executedSteps:n,status:o.steps.failed>0?"error":o.steps.warnings>0?"warn":"success",totalRequests:o.totalRequests,totalTimeMs:t.totalTimeMs}}function cy(t,e,r){if("executedSteps"in t)return dp(t);let n=r.$workflows[e].steps[t.stepId];return{type:"step",stepId:t.stepId,workflowId:e,request:{method:n?.request?.method||"",url:t.response?.requestUrl||"",headers:n?.request?.header||{},body:n?.request?.body},response:{statusCode:t.response?.statusCode||0,body:n?.response?.body,headers:t.response?.header||{},time:t.response?.time||0,size:t.response?.responseSize},checks:t.checks.map(o=>({...o,status:ly(o)})),totalTimeMs:n?.response?.time||0,retriesLeft:t.retriesLeft,status:py(t.checks)}}function ly(t){return t.passed?"success":t.severity==="error"?"error":"warn"}function py(t){let e=!1;for(let r of t){if(!r.passed&&r.severity==="error")return"error";!r.passed&&r.severity==="warn"&&(e=!0)}return e?"warn":"success"}import*as xr from"node:fs";import*as hp from"node:path";function gp(t={},e){let r={};for(let[n,o]of Object.entries(t))r[n]={clientCert:Rs(o.clientCert,e),clientKey:Rs(o.clientKey,e),caCert:Rs(o.caCert,e)};return r}function Rs(t,e){if(t)try{if(!(t.includes("-----BEGIN")&&t.includes("-----END"))){let n=hp.resolve(e,t);return xr.accessSync(n,xr.constants.R_OK),xr.readFileSync(n,"utf-8")}return uy(t)}catch(r){throw new Error(`Failed to read certificate: ${r.message}`)}}function uy(t){let e=t.match(/^(-----BEGIN[^-]+-----)\r?\n([A-Za-z0-9+/=\r\n\t ]+)\r?\n(-----END[^-]+-----)/);if(!e)throw new Error("Invalid certificate format");let[,r,n,o]=e,s=n.replace(/\s+/g,"").match(/.{1,64}/g)?.join(`
138
+ `);if(P._compressed=/^(gzip|compress|deflate|br)$/.test(m.headers.get("content-encoding")||""),P.response.content||(P.response.content={size:-1}),P._compressed){let V=await h.arrayBuffer();P.response.content.size=V.byteLength}else P.response.content.size=C?Buffer.byteLength(C):-1;let $=C?Buffer.byteLength(C):-1;P.response={headers:As(m.headers),cookies:up(m.headers),status:m.status,statusText:m.statusText||"",httpVersion:m.httpVersion?`HTTP/${m.httpVersion}`:"HTTP/1.1",redirectURL:m.headers.location||"",content:{size:P._compressed&&P.response.content.size!==-1?P.response.content.size:Buffer.byteLength(C),mimeType:m.headers.get("content-type")||"",text:C,compression:P._compressed&&P.response.content.size!==-1?P.response.content.size-$:0},bodySize:$,headersSize:E};let{_timestamps:_}=P;P.timings={blocked:Math.max(Mt(_.start,_.socket),.01),dns:-1,connect:Math.max(Mt(_.lookup,_.connect),-1),ssl:_.secureConnect?Math.max(Mt(_.connect,_.secureConnect),-1):-1,send:Mt(_.secureConnect||_.connect,_.sent),wait:Math.max(Mt(_.sent,_.firstByte),0),receive:Mt(_.firstByte,_.received)},P.time=Mt(_.start,_.received);let J=[],ie=P;do{let V=ie._parent;delete ie._parent,V&&J.unshift(V),ie=V}while(ie);return l.pageref=i||"page_1",J.forEach(V=>{V.pageref=l.pageref}),m.harEntry=l,Array.isArray(s?.log?.entries)&&s.log.entries.push(...J,l),a&&(J.forEach(V=>{a(V)}),a(l)),m}};function mp(t){let e={};for(let r of t){let{executedWorkflows:n,globalTimeoutError:o,ctx:s,secretValues:i}=r;e[r.file]=Oi({value:{totalRequests:r.totalRequests,executedWorkflows:n.map(a=>dp(a)),totalTimeMs:r.totalTimeMs,globalTimeoutError:o,secretValues:i},noSecretsMasking:s.noSecretsMasking,secretsSet:s.secretsSet||new Set})}return e}function dp(t){let{ctx:e,...r}=t,n=t.executedSteps.map(i=>cy(i,t.workflowId,e)),o=bn([t]);return{...r,executedSteps:n,status:o.steps.failed>0?"error":o.steps.warnings>0?"warn":"success",totalRequests:o.totalRequests,totalTimeMs:t.totalTimeMs}}function cy(t,e,r){if("executedSteps"in t)return dp(t);let n=r.$workflows[e].steps[t.stepId];return{type:"step",stepId:t.stepId,workflowId:e,request:{method:n?.request?.method||"",url:t.response?.requestUrl||"",headers:n?.request?.header||{},body:n?.request?.body},response:{statusCode:t.response?.statusCode||0,body:n?.response?.body,headers:t.response?.header||{},time:t.response?.time||0,size:t.response?.responseSize},checks:t.checks.map(o=>({...o,status:ly(o)})),totalTimeMs:n?.response?.time||0,retriesLeft:t.retriesLeft,status:py(t.checks)}}function ly(t){return t.passed?"success":t.severity==="error"?"error":"warn"}function py(t){let e=!1;for(let r of t){if(!r.passed&&r.severity==="error")return"error";!r.passed&&r.severity==="warn"&&(e=!0)}return e?"warn":"success"}import*as Cr from"node:fs";import*as hp from"node:path";function gp(t={},e){let r={};for(let[n,o]of Object.entries(t))r[n]={clientCert:Rs(o.clientCert,e),clientKey:Rs(o.clientKey,e),caCert:Rs(o.caCert,e)};return r}function Rs(t,e){if(t)try{if(!(t.includes("-----BEGIN")&&t.includes("-----END"))){let n=hp.resolve(e,t);return Cr.accessSync(n,Cr.constants.R_OK),Cr.readFileSync(n,"utf-8")}return uy(t)}catch(r){throw new Error(`Failed to read certificate: ${r.message}`)}}function uy(t){let e=t.match(/^(-----BEGIN[^-]+-----)\r?\n([A-Za-z0-9+/=\r\n\t ]+)\r?\n(-----END[^-]+-----)/);if(!e)throw new Error("Invalid certificate format");let[,r,n,o]=e,s=n.replace(/\s+/g,"").match(/.{1,64}/g)?.join(`
139
139
  `)||"";return`${r}
140
140
  ${s}
141
- ${o}`}async function bp({argv:t,config:e,version:r,collectSpecData:n}){let o,s;try{let{run:i,conditionallyMaskSecrets:a}=await import("./chunks/MK7BP3KL.js"),c=e.configPath?dy(e.configPath):process.cwd();t.mtls&&(o=gp(t.mtls,c));let p=Ql(o);t["har-output"]&&(s=tp({version:r}),p=Ps(p,{har:s}));let u=new ft({http:{headers:e.resolve?.http?.headers??[],customFetch:p}}),l={files:t.files,input:t.input,server:t.server,workflow:t.workflow,skip:t.skip,verbose:t.verbose,config:e,version:r,collectSpecData:n,severity:t.severity,maxSteps:t["max-steps"],maxFetchTimeout:t["max-fetch-timeout"],executionTimeout:t["execution-timeout"],requestFileLoader:{getFileBody:async x=>{if(!fy(x))throw new Error(`File ${x} doesn't exist or isn't readable.`);let P=my(x);return new File([P],hy(x))}},envVariables:Zl(c)||{},logger:y,fetch:p,externalRefResolver:u,noSecretsMasking:t["no-secrets-masking"]};if(l.skip&&l.workflow)throw new Error("Cannot use both --skip and --workflow flags at the same time.");if(t["har-output"]&&!t["har-output"].endsWith(".har"))throw new Error("File for HAR logs should be in .har format");if(t["json-output"]&&!t["json-output"].endsWith(".json"))throw new Error("File for JSON logs should be in .json format");if(l.files.length>1&&t["har-output"])throw new Error("Currently only a single file can be run with --har-output. Please run a single file at a time.");let d=performance.now(),m=await i(l);y.printNewLine(),ep(m,y),y.printNewLine();let w=m.some(x=>x.hasProblems),h=m.some(x=>x.hasWarnings);if(t["json-output"]){let x={files:mp(m),status:w?"error":h?"warn":"success",totalTime:performance.now()-d};yp(t["json-output"],Es(x,2),"utf-8"),y.output(Q(y.indent(`JSON logs saved in ${pe(t["json-output"])}`,2))),y.printNewLine(),y.printNewLine()}if(t["har-output"])for(let x of m){let P=a({value:s,noSecretsMasking:x.ctx.noSecretsMasking,secretsSet:x.ctx.secretsSet||new Set});yp(t["har-output"],Es(P,2),"utf-8"),y.output(Q(`Har logs saved in ${pe(t["har-output"])}`)),y.printNewLine(),y.printNewLine()}if(w)throw new Error(" Tests exited with error ")}catch(i){throw new Ve(i?.message??i)}}function wp(t){if(Array.isArray(t)){let e={};for(let r of t)if(r&&typeof r=="string"){let n=Sp(r);Object.assign(e,n)}return Object.keys(e).length>0?e:void 0}if(!(!t||typeof t!="string"))return Sp(t)}function Sp(t){try{let e=JSON.parse(t);if(!re(e))throw new Error("mTLS config must be an object mapping domains to certificate configurations");for(let[r,n]of Object.entries(e)){if(!re(n))throw new Error(`mTLS config for domain "${r}" must be an object`);$s(n,"clientCert",r,!0),$s(n,"clientKey",r,!0),$s(n,"caCert",r,!1)}return e}catch(e){throw e instanceof SyntaxError?new Error(`Invalid JSON for --mtls option: ${e.message}`):e}}function $s(t,e,r,n){let o=t[e];if(!o){if(n)throw new Error(`${e} is required for domain "${r}"`);return}if(typeof o!="string")throw new Error(`${e} for domain "${r}" must be a string`)}import{performance as Dy}from"perf_hooks";var wt={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Ep=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function Zn(t){if(t.length===0)return 0;let e=[...t].sort((n,o)=>n-o),r=Math.floor(e.length/2);return e.length%2!==0?e[r]:(e[r-1]+e[r])/2}function gy(t,e,r=wt){let{thresholds:n,weights:o}=r,s=pt(1-t.parameterCount/(n.maxParamsGood*2)),a=Math.max(t.maxRequestSchemaDepth,t.maxResponseSchemaDepth)/(n.maxDepthGood*2),c=Op(t,o.anyOfPenaltyMultiplier)/(n.maxPolymorphismGood*3),p=pt(1-a-c),u=(t.operationDescriptionPresent?1:0)+t.paramsWithDescription+t.schemaPropertiesWithDescription,l=1+t.parameterCount+t.totalSchemaProperties,d=l>0?pt(u/l):1,m=t.totalSchemaProperties>0?pt(t.constraintCount/t.totalSchemaProperties):1,w=(t.requestExamplePresent?1:0)+(t.responseExamplePresent?1:0),h=(t.requestBodyPresent?1:0)+1,x=pt(w/h),P=t.totalErrorResponses>0?pt(t.structuredErrorResponseCount/t.totalErrorResponses):1,C=pt(1-e/(n.maxDependencyDepthGood*2)),A=pt(1-t.ambiguousIdentifierCount/Math.max(n.maxAmbiguousGood+3,1)),E=Op(t,o.anyOfPenaltyMultiplier),$=E===0?1:t.hasDiscriminator?pt(1-E/(n.maxPolymorphismGood*4)):pt(1-E/(n.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:p,documentationQuality:d,constraintClarity:m,exampleCoverage:x,errorClarity:P,dependencyClarity:C,identifierClarity:A,polymorphismClarity:$}}function yy(t,e=wt){let r=e.weights,n=t.parameterSimplicity*r.parameterSimplicity+t.schemaSimplicity*r.schemaSimplicity+t.documentationQuality*r.documentationQuality+t.constraintClarity*r.constraintClarity+t.exampleCoverage*r.exampleCoverage+t.errorClarity*r.errorClarity+t.dependencyClarity*r.dependencyClarity+t.identifierClarity*r.identifierClarity+t.polymorphismClarity*r.polymorphismClarity;return Pp(pt(n)*100)}function Cp(t,e,r=wt){let n=new Map;for(let[o,s]of t.operations){let i=e.get(o)??0,a=gy(s,i,r);n.set(o,{agentReadiness:yy(a,r),subscores:a})}return n}function xp(t,e=wt){return pt(1-t/e.thresholds.maxOperationsForDiscoverability)}function Ap(t,e,r=wt){if(t.size===0)return{agentReadiness:100};let n=[];for(let i of t.values())n.push(i.agentReadiness);let o=r.weights.discoverabilityWeight,s=e*100;return{agentReadiness:Pp(Zn(n)*(1-o)+s*o)}}function Is(t,e,r){return t-e+e*r}function Op(t,e){return Is(t.polymorphismCount,t.anyOfCount,e)}function pt(t){return Math.max(0,Math.min(1,t))}function vp(t){let e=t.size||1,r={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let n of t.values())r.parameterSimplicity+=n.subscores.parameterSimplicity,r.schemaSimplicity+=n.subscores.schemaSimplicity,r.documentationQuality+=n.subscores.documentationQuality,r.constraintClarity+=n.subscores.constraintClarity,r.exampleCoverage+=n.subscores.exampleCoverage,r.errorClarity+=n.subscores.errorClarity,r.dependencyClarity+=n.subscores.dependencyClarity,r.identifierClarity+=n.subscores.identifierClarity,r.polymorphismClarity+=n.subscores.polymorphismClarity;return r.parameterSimplicity/=e,r.schemaSimplicity/=e,r.documentationQuality/=e,r.constraintClarity/=e,r.exampleCoverage/=e,r.errorClarity/=e,r.dependencyClarity/=e,r.identifierClarity/=e,r.polymorphismClarity/=e,r}function Pp(t){return Math.round(t*10)/10}function Rp(t,e,r){let n=Math.max(1,t);return e/n+r/n}function by(t,e){return e.totalSchemaProperties>t.totalSchemaProperties?!0:e.totalSchemaProperties<t.totalSchemaProperties?!1:Rp(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)>Rp(t.totalSchemaProperties,t.schemaPropertiesWithDescription,t.constraintCount)}var Sy=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function _s(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function _p(t){Object.assign(t,_s())}function Tp(t){return{ref:{enter(e){typeof e?.$ref=="string"&&(t.refsUsed.push(e.$ref),t.pendingRef=e.$ref)}},Schema:{enter(e,r){t.depth++,t.maxDepth=Math.max(t.maxDepth,t.depth);let n=0;for(let i of Sy)e[i]!==void 0&&(t.constraintCount++,n++);e.discriminator?.propertyName&&(t.hasDiscriminator=!0);let o={};for(let i of["oneOf","anyOf","allOf"]){let a=e[i];Array.isArray(a)&&(t.polymorphismCount+=a.length,i==="anyOf"&&(t.anyOfCount+=a.length),o[i]=a.length)}let s=[];if(re(e.properties)){let i=Object.entries(e.properties);t.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let p=c&&"$ref"in c&&c.$ref?r.resolve(c)?.node??c:c;p?.description&&t.schemaPropertiesWithDescription++,(p?.example!==void 0||p?.examples)&&(t.hasPropertyExamples=!0),p?.readOnly||t.writableTopLevelFields++}}t.debugEntries!==null&&t.debugEntries.push({ref:t.pendingRef,depth:t.depth,propertyNames:s,polymorphism:Object.keys(o).length>0?o:{},constraintCount:n}),t.pendingRef=null},leave(){t.depth--}}}}function jp(t,e,r){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:t,anyOfPenaltyMultiplier:e,debugOperationId:r,debugLogs:[]}}function wy(t,e,r){return{path:t,method:e,operationId:r.operationId,operationDescriptionPresent:!!r.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ey(t){let{inRequestBody:e,inResponse:r,currentResponseCode:n,errorStructuredCounted:o,maxEffectivePolymorphism:s,...i}=t;return i}function Dp(t){return{RequestBody:{enter(){t.current&&(t.current.requestBodyPresent=!0,t.current.inRequestBody=!0)},leave(){t.current&&(t.current.inRequestBody=!1)}},Response:{enter(e,r){let n=t.current;if(!n)return;let o=String(r.key);n.inResponse=!0,n.currentResponseCode=o,n.errorStructuredCounted=!1,Ip(o)&&(n.totalErrorResponses++,!e.content&&e.description&&(n.structuredErrorResponseCount++,n.errorStructuredCounted=!0))},leave(){t.current&&(t.current.inResponse=!1)}},MediaType:{enter(e){let r=t.current;if(r&&(Cy(e)&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inResponse&&Ip(r.currentResponseCode)&&!r.errorStructuredCounted&&(r.structuredErrorResponseCount++,r.errorStructuredCounted=!0),e.schema)){let n=!!t.debugOperationId&&(r.operationId===t.debugOperationId||`${r.method.toUpperCase()} ${r.path}`===t.debugOperationId),o=t.walkSchema(e.schema,n);by(r,o)&&(r.totalSchemaProperties=o.totalSchemaProperties,r.schemaPropertiesWithDescription=o.schemaPropertiesWithDescription,r.constraintCount=o.constraintCount);let s=Is(o.polymorphismCount,o.anyOfCount,t.anyOfPenaltyMultiplier);s>r.maxEffectivePolymorphism&&(r.maxEffectivePolymorphism=s,r.polymorphismCount=o.polymorphismCount,r.anyOfCount=o.anyOfCount),o.hasDiscriminator&&(r.hasDiscriminator=!0);for(let i of o.refsUsed)r.refsUsed.add(i);if(o.hasPropertyExamples&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inRequestBody&&(r.maxRequestSchemaDepth=Math.max(r.maxRequestSchemaDepth,o.maxDepth),r.topLevelWritableFieldCount=Math.max(r.topLevelWritableFieldCount,o.writableTopLevelFields)),r.inResponse&&(r.maxResponseSchemaDepth=Math.max(r.maxResponseSchemaDepth,o.maxDepth)),n&&o.debugEntries){let i=r.inRequestBody?"REQUEST BODY":`RESPONSE ${r.currentResponseCode}`;t.debugLogs.push({context:i,entries:o.debugEntries,totalProperties:o.totalSchemaProperties,totalPolymorphism:o.polymorphismCount,totalConstraints:o.constraintCount,maxDepth:o.maxDepth})}}}},Paths:{PathItem:{enter(e,r){t.currentPath=String(r.key),t.pathLevelParams=e.parameters??[]},Operation:{enter(e,r){let n=String(r.key),o=wy(t.currentPath,n,e);t.current=o;let s=Oy(t.pathLevelParams,e.parameters??[],r.resolve);for(let i of s.values())o.parameterCount++,i.required&&o.requiredParameterCount++,i.description&&o.paramsWithDescription++,xy(i)&&o.ambiguousIdentifierCount++},leave(e){let r=t.current;if(!r)return;let n=e.operationId??`${r.method.toUpperCase()} ${r.path}`;t.operations.set(n,Ey(r)),t.current=null}}}}}}function Np(t){return{operationCount:t.operations.size,operations:t.operations}}function $p(t,e){return e(t).node}function Oy(t,e,r){let n=new Map;for(let o of t){let s=$p(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}for(let o of e){let s=$p(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}return n}function Cy(t){return t.example!==void 0||zs(t.examples)}function xy(t){if(t.description)return!1;let e=(t.name??"").toLowerCase();return Ep.has(e)}function Ip(t){if(t==="default"||/^4xx$/i.test(t)||/^5xx$/i.test(t))return!0;let e=parseInt(t,10);return e>=400&&e<600}function Ay(t,e){if(!e.startsWith("#/"))return;let r=t;for(let n of e.slice(2).split("/"))r=r?.[Hs(n)];return r}function Lp({document:t,types:e,resolvedRefMap:r,ctx:n,debugOperationId:o,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??wt.weights.anyOfPenaltyMultiplier,a=_s(),c=Tp(a),p=Lr([{severity:"warn",ruleId:"score-schema",visitor:c}],e),u=(A,E)=>{_p(a),E&&(a.debugEntries=[]),Mr({document:{...t,parsed:A},rootType:e.Schema,normalizedVisitors:p,resolvedRefMap:r,ctx:n});let{depth:$,pendingRef:_,debugEntries:J,...ie}=a;return{...ie,refsUsed:[...a.refsUsed],debugEntries:E?a.debugEntries??void 0:void 0}},l=new Map,d=new WeakSet,m={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function w(A,E){return{maxDepth:Math.max(A.maxDepth,E.maxDepth),polymorphismCount:A.polymorphismCount+E.polymorphismCount,anyOfCount:A.anyOfCount+E.anyOfCount,hasDiscriminator:A.hasDiscriminator||E.hasDiscriminator,totalSchemaProperties:A.totalSchemaProperties+E.totalSchemaProperties,schemaPropertiesWithDescription:A.schemaPropertiesWithDescription+E.schemaPropertiesWithDescription,constraintCount:A.constraintCount+E.constraintCount,hasPropertyExamples:A.hasPropertyExamples||E.hasPropertyExamples,writableTopLevelFields:A.writableTopLevelFields+E.writableTopLevelFields,refsUsed:[...A.refsUsed,...E.refsUsed],debugEntries:A.debugEntries||E.debugEntries?[...A.debugEntries??[],...E.debugEntries??[]]:void 0}}let h=(A,E=!1)=>{let $=A,_=_e(A)?A.$ref:void 0;if(_){if(!E){let Y=l.get(_);if(Y)return Y}$=Ay(t.parsed,_)??A}if(re($)&&d.has($))return{...m};re($)&&d.add($);let J=$?.oneOf,ie=$?.anyOf,V=Array.isArray(J)&&J.length>1,De=Array.isArray(ie)&&ie.length>1,I=V||De,v=Array.isArray($?.allOf)&&$.allOf.length>0,M=$?.discriminator,U=!I&&re(M?.mapping)?Object.values(M.mapping).filter(Y=>typeof Y=="string"&&Ks(Y)).map(Y=>({$ref:Y})):null,ne=Array.isArray(U)&&U.length>0,te;if(I||v||ne){let Y={...$},ce=null,$e=Ae=>{ce=ce?w(ce,Ae):Ae},le=(Ae,Qe)=>{let k=h(Qe[0],E);for(let ae=1;ae<Qe.length;ae++){let oe=h(Qe[ae],E);oe.totalSchemaProperties>k.totalSchemaProperties&&(k=oe)}return{...k,polymorphismCount:k.polymorphismCount+Qe.length,anyOfCount:k.anyOfCount+(Ae==="anyOf"?Qe.length:0),hasDiscriminator:k.hasDiscriminator||!!M}};I&&delete Y.discriminator,V&&(delete Y.oneOf,$e(le("oneOf",J))),De&&(delete Y.anyOf,$e(le("anyOf",ie)));let Ge=null;if(ne){delete Y.discriminator;let Ae=h(U[0],E);for(let Qe=1;Qe<U.length;Qe++){let k=h(U[Qe],E);k.totalSchemaProperties>Ae.totalSchemaProperties&&(Ae=k)}Ge={...Ae,polymorphismCount:Ae.polymorphismCount+U.length,hasDiscriminator:!0}}let Ze=null;if(v){delete Y.allOf,Ze={...m};for(let Ae of $.allOf)Ze=w(Ze,h(Ae,E));Ze.polymorphismCount+=$.allOf.length}te=u(Y,E),Ze&&(te=w(te,Ze)),ce&&(te=w(te,ce)),Ge&&(te=w(te,Ge)),_&&(te={...te,refsUsed:[_,...te.refsUsed]})}else te=u(A,E);return re($)&&d.delete($),_&&!E&&l.set(_,te),te},x=jp(h,i,o),P=Dp(x),C=Lr([{severity:"warn",ruleId:"score",visitor:P}],e);return Mr({document:t,rootType:e.Root,normalizedVisitors:C,resolvedRefMap:r,ctx:n}),{metrics:Np(x),debugLogs:x.debugLogs}}function Mp(t){let e=new Map;for(let[o,s]of t)for(let i of s.refsUsed){let a=e.get(i);a||(a=new Set,e.set(i,a)),a.add(o)}let r=new Map;for(let o of t.keys())r.set(o,new Set);for(let o of e.values()){if(o.size<2)continue;let s=Array.from(o);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)r.get(s[i]).add(s[a]),r.get(s[a]).add(s[i])}let n=new Map;for(let o of t.keys()){let s=vy(o,r);n.set(o,s)}return n}function vy(t,e){let r=new Set([t]),n=[t],o=0;for(;n.length>0;){let s=[];for(let i of n)for(let a of e.get(i)??[])r.has(a)||(r.add(a),s.push(a));s.length>0&&o++,n=s}return o}function Fp(t){let e={agentReadiness:t.agentReadiness,discoverability:Math.round(t.discoverability*100),subscores:t.subscores,rawMetrics:{operationCount:t.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(t.rawMetrics.operations.entries()).map(([r,n])=>{let{refsUsed:o,...s}=n;return[r,s]}))},operationScores:Object.fromEntries(t.operationScores),dependencyDepths:Object.fromEntries(t.dependencyDepths),hotspots:t.hotspots};y.output(JSON.stringify(e,null,2))}function kp(t,e=!1){Py(t),Ry(t),Iy(t),e&&_y(t),Ty(t)}function Up(t){return t>=80?pe:t>=50?ee:Ne}function qp(t){return Up(t)(ye(t.toFixed(1)))}function H(t){y.output(t+`
142
- `)}function Py(t){H(""),H(ye(Fe(" Scores"))),H(""),H(` Agent Readiness: ${qp(t.agentReadiness)}/100`),H("")}function Ry(t){H(ye(Fe(" Subscores"))),H("");let e=t.subscores;Et("Parameter Simplicity",e.parameterSimplicity),Et("Schema Simplicity",e.schemaSimplicity),Et("Documentation Quality",e.documentationQuality),Et("Constraint Clarity",e.constraintClarity),Et("Example Coverage",e.exampleCoverage),Et("Error Clarity",e.errorClarity),Et("Dependency Clarity",e.dependencyClarity),Et("Identifier Clarity",e.identifierClarity),Et("Polymorphism Clarity",e.polymorphismClarity),Et("Discoverability",t.discoverability),H("")}function Et(t,e){let r=Math.round(e*100),n=$y(e);H(` ${t.padEnd(24)} ${n} ${Up(r)(r+"%")}`)}function $y(t){let r=Math.round(t*20);return de("["+"\u2588".repeat(r)+"\u2591".repeat(20-r)+"]")}function Iy(t){if(H(ye(Fe(" Raw Metrics Summary"))),H(""),H(` Total operations: ${t.rawMetrics.operationCount}`),t.rawMetrics.operationCount===0){H("");return}let e=[],r=[],n=[],o=[],s=0,i=0,a=0;for(let u of t.rawMetrics.operations.values())e.push(u.parameterCount),r.push(Math.max(u.maxRequestSchemaDepth,u.maxResponseSchemaDepth)),n.push(u.polymorphismCount),o.push(u.totalSchemaProperties),u.requestExamplePresent&&s++,u.responseExamplePresent&&i++,u.operationDescriptionPresent&&a++;let c=t.rawMetrics.operationCount;function p(u,l){let m=(l.reduce((P,C)=>P+C,0)/c).toFixed(1),w=Zn(l).toFixed(1),h=Math.min(...l),x=Math.max(...l);H(` ${u.padEnd(26)} avg ${m.padStart(6)} median ${w.padStart(6)} min ${String(h).padStart(5)} max ${String(x).padStart(5)}`)}p("Parameters/operation:",e),p("Schema depth:",r),p("Polymorphism/operation:",n),p("Properties/operation:",o),H(` Operations with request examples: ${s}/${c} (${Ts(s,c)})`),H(` Operations with response examples: ${i}/${c} (${Ts(i,c)})`),H(` Operations with description: ${a}/${c} (${Ts(a,c)})`),H("")}function Ts(t,e){return e>0?`${Math.round(t/e*100)}%`:"N/A"}function _y(t){H(ye(Fe(" Per-Operation Metrics"))),H("");let e=" "+"Operation".padEnd(50)+"Props".padStart(7)+"Poly".padStart(7)+"Depth".padStart(7)+"Params".padStart(8)+"Constr".padStart(8);H(de(e)),H(de(" "+"\u2500".repeat(e.length-2)));let r=[...t.rawMetrics.operations.entries()].sort(([,n],[,o])=>o.totalSchemaProperties-n.totalSchemaProperties);for(let[,n]of r){let o=(n.operationId??`${n.method.toUpperCase()} ${n.path}`).slice(0,48),s=Math.max(n.maxRequestSchemaDepth,n.maxResponseSchemaDepth),i=" "+o.padEnd(50)+String(n.totalSchemaProperties).padStart(7)+String(n.polymorphismCount).padStart(7)+String(s).padStart(7)+String(n.parameterCount).padStart(8)+String(n.constraintCount).padStart(8);H(i)}H("")}function Wp(t,e){if(H(""),H(ye(Fe(` Debug: ${t} schema breakdown`))),H(""),e.length===0){H(ee(` No schemas found for operation "${t}".`)),H(ee(' Make sure the value matches an operationId or "METHOD /path" exactly.')),H("");return}for(let r of e){H(ye(de(` ${r.context}`))),H(de(" "+"\u2500".repeat(70)));let n=new Map;for(let s of r.entries){let i=s.ref??`(inline depth ${s.depth})`,a=n.get(i);if(a){a.count++,a.totalProps+=s.propertyNames.length;for(let c of s.propertyNames)a.propNames.includes(c)||a.propNames.push(c)}else n.set(i,{count:1,totalProps:s.propertyNames.length,propNames:[...s.propertyNames]})}for(let s of r.entries){let i=s.ref??"(inline)",a=" ".repeat(Math.min(s.depth,6)),c=s.propertyNames.length,p=` ${a}${i}`;c>0&&(p+=` (${c} properties)`);let u=[];if(s.polymorphism.oneOf&&u.push(`oneOf:${s.polymorphism.oneOf}`),s.polymorphism.anyOf&&u.push(`anyOf:${s.polymorphism.anyOf}`),s.polymorphism.allOf&&u.push(`allOf:${s.polymorphism.allOf}`),u.length>0&&(p+=` [${u.join(", ")}]`),s.constraintCount>0&&(p+=` {${s.constraintCount} constraints}`),H(p),c>0&&c<=20)H(` ${a} properties: ${s.propertyNames.join(", ")}`);else if(c>20){let l=s.propertyNames.slice(0,15).join(", ");H(` ${a} properties: ${l}, ... +${c-15} more`)}}H(""),H(` Totals: ${r.totalProperties} properties, ${r.totalPolymorphism} polymorphism items, ${r.totalConstraints} constraints, max depth ${r.maxDepth}`);let o=[...n.entries()].filter(([,s])=>s.totalProps>0).sort(([,s],[,i])=>i.totalProps-s.totalProps).slice(0,10);if(o.length>0){H(""),H(ye(" Top schemas by property count:"));for(let[s,i]of o)H(` ${s}: ${i.totalProps} properties`)}H("")}}function Ty(t){if(t.hotspots.length===0){H(ye(Fe(" No hotspot operations found."))),H("");return}H(ye(Fe(` Top ${t.hotspots.length} Hotspot Operations`))),H("");for(let e of t.hotspots){let r=e.operationId?`${e.method.toUpperCase()} ${e.path} (${e.operationId})`:`${e.method.toUpperCase()} ${e.path}`;H(ye(` ${r}`)),H(` Agent Readiness: ${qp(e.agentReadinessScore)}`);for(let n of e.reasons)H(ee(` - ${n}`));H("")}}function zp(t,e,r,n=wt){let o=[];for(let[s,i]of e){let a=t.operations.get(s);if(!a)continue;let c=jy(a,r.get(s)??0,n);c.length!==0&&o.push({path:a.path,method:a.method,operationId:a.operationId,agentReadinessScore:i.agentReadiness,reasons:c})}return o.sort((s,i)=>s.reasons.length!==i.reasons.length?i.reasons.length-s.reasons.length:s.agentReadinessScore-i.agentReadinessScore),o.slice(0,n.hotspotLimit)}function jy(t,e,r){let{thresholds:n}=r,o=[];t.parameterCount>n.maxParamsGood&&o.push(`High parameter count (${t.parameterCount})`);let s=Math.max(t.maxRequestSchemaDepth,t.maxResponseSchemaDepth);s>n.maxDepthGood&&o.push(`Deep schema nesting (depth ${s})`),t.anyOfCount>0&&!t.hasDiscriminator?o.push(`Polymorphism (anyOf) without discriminator (${t.anyOfCount} anyOf)`):t.polymorphismCount>n.maxPolymorphismGood&&o.push(`High polymorphism count (${t.polymorphismCount})`);let i=t.requestBodyPresent&&!t.requestExamplePresent,a=!t.responseExamplePresent;return i&&a?o.push("Missing request and response examples"):i?o.push("Missing request body examples"):a&&o.push("Missing response examples"),t.totalErrorResponses>0&&t.structuredErrorResponseCount===0&&o.push("No structured error responses (4xx/5xx)"),t.operationDescriptionPresent||o.push("Missing operation description"),t.parameterCount>0&&t.paramsWithDescription===0&&o.push("No parameter descriptions"),e>n.maxDependencyDepthGood&&o.push(`High dependency depth (${e})`),t.ambiguousIdentifierCount>n.maxAmbiguousGood&&o.push(`Ambiguous identifiers (${t.ambiguousIdentifierCount})`),o}async function Vp({argv:t,config:e,collectSpecData:r}){let[{path:n}]=await rt(t.api?[t.api]:[],e),o=new ft(e.resolve),{bundle:s}=await pr({config:e,ref:n});r?.(s);let i=ut(s.parsed);if(lr(i)!=="oas3")return W(`The score command currently supports only OpenAPI 3.x. Detected: ${i}`);let a=Dy.now(),c=cn(e.extendTypes(cr(i),i),e),p=await ln({rootDocument:s,rootType:c.Root,externalRefResolver:o}),u=t["debug-operation-id"],{metrics:l,debugLogs:d}=Lp({document:s,types:c,resolvedRefMap:p,ctx:{problems:[],specVersion:i,config:e,visitorsData:{}},debugOperationId:u}),m=Mp(l.operations),w=Cp(l,m),h=xp(l.operationCount),{agentReadiness:x}=Ap(w,h),P=zp(l,w,m),C={agentReadiness:x,discoverability:h,subscores:vp(w),rawMetrics:l,hotspots:P,operationScores:w,dependencyDepths:m};Ny(C,n,a,t.format,!!t["operation-details"],u?{operationId:u,logs:d}:void 0)}function Ny(t,e,r,n,o,s){y.info(`Document: ${et(e)} score:
141
+ ${o}`}async function bp({argv:t,config:e,version:r,collectSpecData:n}){let o,s;try{let{run:i,conditionallyMaskSecrets:a}=await import("./chunks/JTFBO6YU.js"),c=e.configPath?dy(e.configPath):process.cwd();t.mtls&&(o=gp(t.mtls,c));let p=Ql(o);t["har-output"]&&(s=tp({version:r}),p=Ps(p,{har:s}));let u=new ft({http:{headers:e.resolve?.http?.headers??[],customFetch:p}}),l={files:t.files,input:t.input,server:t.server,workflow:t.workflow,skip:t.skip,verbose:t.verbose,config:e,version:r,collectSpecData:n,severity:t.severity,maxSteps:t["max-steps"],maxFetchTimeout:t["max-fetch-timeout"],executionTimeout:t["execution-timeout"],requestFileLoader:{getFileBody:async C=>{if(!fy(C))throw new Error(`File ${C} doesn't exist or isn't readable.`);let P=my(C);return new File([P],hy(C))}},envVariables:Zl(c)||{},logger:y,fetch:p,externalRefResolver:u,noSecretsMasking:t["no-secrets-masking"]};if(l.skip&&l.workflow)throw new Error("Cannot use both --skip and --workflow flags at the same time.");if(t["har-output"]&&!t["har-output"].endsWith(".har"))throw new Error("File for HAR logs should be in .har format");if(t["json-output"]&&!t["json-output"].endsWith(".json"))throw new Error("File for JSON logs should be in .json format");if(l.files.length>1&&t["har-output"])throw new Error("Currently only a single file can be run with --har-output. Please run a single file at a time.");let d=performance.now(),m=await i(l);y.printNewLine(),ep(m,y),y.printNewLine();let w=m.some(C=>C.hasProblems),h=m.some(C=>C.hasWarnings);if(t["json-output"]){let C={files:mp(m),status:w?"error":h?"warn":"success",totalTime:performance.now()-d};yp(t["json-output"],Es(C,2),"utf-8"),y.output(Q(y.indent(`JSON logs saved in ${pe(t["json-output"])}`,2))),y.printNewLine(),y.printNewLine()}if(t["har-output"])for(let C of m){let P=a({value:s,noSecretsMasking:C.ctx.noSecretsMasking,secretsSet:C.ctx.secretsSet||new Set});yp(t["har-output"],Es(P,2),"utf-8"),y.output(Q(`Har logs saved in ${pe(t["har-output"])}`)),y.printNewLine(),y.printNewLine()}if(w)throw new Error(" Tests exited with error ")}catch(i){throw new Ve(i?.message??i)}}function wp(t){if(Array.isArray(t)){let e={};for(let r of t)if(r&&typeof r=="string"){let n=Sp(r);Object.assign(e,n)}return Object.keys(e).length>0?e:void 0}if(!(!t||typeof t!="string"))return Sp(t)}function Sp(t){try{let e=JSON.parse(t);if(!re(e))throw new Error("mTLS config must be an object mapping domains to certificate configurations");for(let[r,n]of Object.entries(e)){if(!re(n))throw new Error(`mTLS config for domain "${r}" must be an object`);$s(n,"clientCert",r,!0),$s(n,"clientKey",r,!0),$s(n,"caCert",r,!1)}return e}catch(e){throw e instanceof SyntaxError?new Error(`Invalid JSON for --mtls option: ${e.message}`):e}}function $s(t,e,r,n){let o=t[e];if(!o){if(n)throw new Error(`${e} is required for domain "${r}"`);return}if(typeof o!="string")throw new Error(`${e} for domain "${r}" must be a string`)}import{performance as Dy}from"perf_hooks";var wt={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Ep=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function Zn(t){if(t.length===0)return 0;let e=[...t].sort((n,o)=>n-o),r=Math.floor(e.length/2);return e.length%2!==0?e[r]:(e[r-1]+e[r])/2}function gy(t,e,r=wt){let{thresholds:n,weights:o}=r,s=pt(1-t.parameterCount/(n.maxParamsGood*2)),a=Math.max(t.maxRequestSchemaDepth,t.maxResponseSchemaDepth)/(n.maxDepthGood*2),c=Op(t,o.anyOfPenaltyMultiplier)/(n.maxPolymorphismGood*3),p=pt(1-a-c),u=(t.operationDescriptionPresent?1:0)+t.paramsWithDescription+t.schemaPropertiesWithDescription,l=1+t.parameterCount+t.totalSchemaProperties,d=l>0?pt(u/l):1,m=t.totalSchemaProperties>0?pt(t.constraintCount/t.totalSchemaProperties):1,w=(t.requestExamplePresent?1:0)+(t.responseExamplePresent?1:0),h=(t.requestBodyPresent?1:0)+1,C=pt(w/h),P=t.totalErrorResponses>0?pt(t.structuredErrorResponseCount/t.totalErrorResponses):1,A=pt(1-e/(n.maxDependencyDepthGood*2)),x=pt(1-t.ambiguousIdentifierCount/Math.max(n.maxAmbiguousGood+3,1)),E=Op(t,o.anyOfPenaltyMultiplier),$=E===0?1:t.hasDiscriminator?pt(1-E/(n.maxPolymorphismGood*4)):pt(1-E/(n.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:p,documentationQuality:d,constraintClarity:m,exampleCoverage:C,errorClarity:P,dependencyClarity:A,identifierClarity:x,polymorphismClarity:$}}function yy(t,e=wt){let r=e.weights,n=t.parameterSimplicity*r.parameterSimplicity+t.schemaSimplicity*r.schemaSimplicity+t.documentationQuality*r.documentationQuality+t.constraintClarity*r.constraintClarity+t.exampleCoverage*r.exampleCoverage+t.errorClarity*r.errorClarity+t.dependencyClarity*r.dependencyClarity+t.identifierClarity*r.identifierClarity+t.polymorphismClarity*r.polymorphismClarity;return Pp(pt(n)*100)}function Ap(t,e,r=wt){let n=new Map;for(let[o,s]of t.operations){let i=e.get(o)??0,a=gy(s,i,r);n.set(o,{agentReadiness:yy(a,r),subscores:a})}return n}function Cp(t,e=wt){return pt(1-t/e.thresholds.maxOperationsForDiscoverability)}function xp(t,e,r=wt){if(t.size===0)return{agentReadiness:100};let n=[];for(let i of t.values())n.push(i.agentReadiness);let o=r.weights.discoverabilityWeight,s=e*100;return{agentReadiness:Pp(Zn(n)*(1-o)+s*o)}}function Is(t,e,r){return t-e+e*r}function Op(t,e){return Is(t.polymorphismCount,t.anyOfCount,e)}function pt(t){return Math.max(0,Math.min(1,t))}function vp(t){let e=t.size||1,r={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let n of t.values())r.parameterSimplicity+=n.subscores.parameterSimplicity,r.schemaSimplicity+=n.subscores.schemaSimplicity,r.documentationQuality+=n.subscores.documentationQuality,r.constraintClarity+=n.subscores.constraintClarity,r.exampleCoverage+=n.subscores.exampleCoverage,r.errorClarity+=n.subscores.errorClarity,r.dependencyClarity+=n.subscores.dependencyClarity,r.identifierClarity+=n.subscores.identifierClarity,r.polymorphismClarity+=n.subscores.polymorphismClarity;return r.parameterSimplicity/=e,r.schemaSimplicity/=e,r.documentationQuality/=e,r.constraintClarity/=e,r.exampleCoverage/=e,r.errorClarity/=e,r.dependencyClarity/=e,r.identifierClarity/=e,r.polymorphismClarity/=e,r}function Pp(t){return Math.round(t*10)/10}function Rp(t,e,r){let n=Math.max(1,t);return e/n+r/n}function by(t,e){return e.totalSchemaProperties>t.totalSchemaProperties?!0:e.totalSchemaProperties<t.totalSchemaProperties?!1:Rp(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)>Rp(t.totalSchemaProperties,t.schemaPropertiesWithDescription,t.constraintCount)}var Sy=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function _s(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function _p(t){Object.assign(t,_s())}function Tp(t){return{ref:{enter(e){typeof e?.$ref=="string"&&(t.refsUsed.push(e.$ref),t.pendingRef=e.$ref)}},Schema:{enter(e,r){t.depth++,t.maxDepth=Math.max(t.maxDepth,t.depth);let n=0;for(let i of Sy)e[i]!==void 0&&(t.constraintCount++,n++);e.discriminator?.propertyName&&(t.hasDiscriminator=!0);let o={};for(let i of["oneOf","anyOf","allOf"]){let a=e[i];Array.isArray(a)&&(t.polymorphismCount+=a.length,i==="anyOf"&&(t.anyOfCount+=a.length),o[i]=a.length)}let s=[];if(re(e.properties)){let i=Object.entries(e.properties);t.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let p=c&&"$ref"in c&&c.$ref?r.resolve(c)?.node??c:c;p?.description&&t.schemaPropertiesWithDescription++,(p?.example!==void 0||p?.examples)&&(t.hasPropertyExamples=!0),p?.readOnly||t.writableTopLevelFields++}}t.debugEntries!==null&&t.debugEntries.push({ref:t.pendingRef,depth:t.depth,propertyNames:s,polymorphism:Object.keys(o).length>0?o:{},constraintCount:n}),t.pendingRef=null},leave(){t.depth--}}}}function jp(t,e,r){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:t,anyOfPenaltyMultiplier:e,debugOperationId:r,debugLogs:[]}}function wy(t,e,r){return{path:t,method:e,operationId:r.operationId,operationDescriptionPresent:!!r.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ey(t){let{inRequestBody:e,inResponse:r,currentResponseCode:n,errorStructuredCounted:o,maxEffectivePolymorphism:s,...i}=t;return i}function Dp(t){return{RequestBody:{enter(){t.current&&(t.current.requestBodyPresent=!0,t.current.inRequestBody=!0)},leave(){t.current&&(t.current.inRequestBody=!1)}},Response:{enter(e,r){let n=t.current;if(!n)return;let o=String(r.key);n.inResponse=!0,n.currentResponseCode=o,n.errorStructuredCounted=!1,Ip(o)&&(n.totalErrorResponses++,!e.content&&e.description&&(n.structuredErrorResponseCount++,n.errorStructuredCounted=!0))},leave(){t.current&&(t.current.inResponse=!1)}},MediaType:{enter(e){let r=t.current;if(r&&(Ay(e)&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inResponse&&Ip(r.currentResponseCode)&&!r.errorStructuredCounted&&(r.structuredErrorResponseCount++,r.errorStructuredCounted=!0),e.schema)){let n=!!t.debugOperationId&&(r.operationId===t.debugOperationId||`${r.method.toUpperCase()} ${r.path}`===t.debugOperationId),o=t.walkSchema(e.schema,n);by(r,o)&&(r.totalSchemaProperties=o.totalSchemaProperties,r.schemaPropertiesWithDescription=o.schemaPropertiesWithDescription,r.constraintCount=o.constraintCount);let s=Is(o.polymorphismCount,o.anyOfCount,t.anyOfPenaltyMultiplier);s>r.maxEffectivePolymorphism&&(r.maxEffectivePolymorphism=s,r.polymorphismCount=o.polymorphismCount,r.anyOfCount=o.anyOfCount),o.hasDiscriminator&&(r.hasDiscriminator=!0);for(let i of o.refsUsed)r.refsUsed.add(i);if(o.hasPropertyExamples&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inRequestBody&&(r.maxRequestSchemaDepth=Math.max(r.maxRequestSchemaDepth,o.maxDepth),r.topLevelWritableFieldCount=Math.max(r.topLevelWritableFieldCount,o.writableTopLevelFields)),r.inResponse&&(r.maxResponseSchemaDepth=Math.max(r.maxResponseSchemaDepth,o.maxDepth)),n&&o.debugEntries){let i=r.inRequestBody?"REQUEST BODY":`RESPONSE ${r.currentResponseCode}`;t.debugLogs.push({context:i,entries:o.debugEntries,totalProperties:o.totalSchemaProperties,totalPolymorphism:o.polymorphismCount,totalConstraints:o.constraintCount,maxDepth:o.maxDepth})}}}},Paths:{PathItem:{enter(e,r){t.currentPath=String(r.key),t.pathLevelParams=e.parameters??[]},Operation:{enter(e,r){let n=String(r.key),o=wy(t.currentPath,n,e);t.current=o;let s=Oy(t.pathLevelParams,e.parameters??[],r.resolve);for(let i of s.values())o.parameterCount++,i.required&&o.requiredParameterCount++,i.description&&o.paramsWithDescription++,Cy(i)&&o.ambiguousIdentifierCount++},leave(e){let r=t.current;if(!r)return;let n=e.operationId??`${r.method.toUpperCase()} ${r.path}`;t.operations.set(n,Ey(r)),t.current=null}}}}}}function Np(t){return{operationCount:t.operations.size,operations:t.operations}}function $p(t,e){return e(t).node}function Oy(t,e,r){let n=new Map;for(let o of t){let s=$p(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}for(let o of e){let s=$p(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}return n}function Ay(t){return t.example!==void 0||zs(t.examples)}function Cy(t){if(t.description)return!1;let e=(t.name??"").toLowerCase();return Ep.has(e)}function Ip(t){if(t==="default"||/^4xx$/i.test(t)||/^5xx$/i.test(t))return!0;let e=parseInt(t,10);return e>=400&&e<600}function xy(t,e){if(!e.startsWith("#/"))return;let r=t;for(let n of e.slice(2).split("/"))r=r?.[Hs(n)];return r}function Lp({document:t,types:e,resolvedRefMap:r,ctx:n,debugOperationId:o,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??wt.weights.anyOfPenaltyMultiplier,a=_s(),c=Tp(a),p=Lr([{severity:"warn",ruleId:"score-schema",visitor:c}],e),u=(x,E)=>{_p(a),E&&(a.debugEntries=[]),Mr({document:{...t,parsed:x},rootType:e.Schema,normalizedVisitors:p,resolvedRefMap:r,ctx:n});let{depth:$,pendingRef:_,debugEntries:J,...ie}=a;return{...ie,refsUsed:[...a.refsUsed],debugEntries:E?a.debugEntries??void 0:void 0}},l=new Map,d=new WeakSet,m={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function w(x,E){return{maxDepth:Math.max(x.maxDepth,E.maxDepth),polymorphismCount:x.polymorphismCount+E.polymorphismCount,anyOfCount:x.anyOfCount+E.anyOfCount,hasDiscriminator:x.hasDiscriminator||E.hasDiscriminator,totalSchemaProperties:x.totalSchemaProperties+E.totalSchemaProperties,schemaPropertiesWithDescription:x.schemaPropertiesWithDescription+E.schemaPropertiesWithDescription,constraintCount:x.constraintCount+E.constraintCount,hasPropertyExamples:x.hasPropertyExamples||E.hasPropertyExamples,writableTopLevelFields:x.writableTopLevelFields+E.writableTopLevelFields,refsUsed:[...x.refsUsed,...E.refsUsed],debugEntries:x.debugEntries||E.debugEntries?[...x.debugEntries??[],...E.debugEntries??[]]:void 0}}let h=(x,E=!1)=>{let $=x,_=_e(x)?x.$ref:void 0;if(_){if(!E){let Y=l.get(_);if(Y)return Y}$=xy(t.parsed,_)??x}if(re($)&&d.has($))return{...m};re($)&&d.add($);let J=$?.oneOf,ie=$?.anyOf,V=Array.isArray(J)&&J.length>1,De=Array.isArray(ie)&&ie.length>1,I=V||De,v=Array.isArray($?.allOf)&&$.allOf.length>0,M=$?.discriminator,U=!I&&re(M?.mapping)?Object.values(M.mapping).filter(Y=>typeof Y=="string"&&Ks(Y)).map(Y=>({$ref:Y})):null,ne=Array.isArray(U)&&U.length>0,te;if(I||v||ne){let Y={...$},ce=null,$e=xe=>{ce=ce?w(ce,xe):xe},le=(xe,Qe)=>{let k=h(Qe[0],E);for(let ae=1;ae<Qe.length;ae++){let oe=h(Qe[ae],E);oe.totalSchemaProperties>k.totalSchemaProperties&&(k=oe)}return{...k,polymorphismCount:k.polymorphismCount+Qe.length,anyOfCount:k.anyOfCount+(xe==="anyOf"?Qe.length:0),hasDiscriminator:k.hasDiscriminator||!!M}};I&&delete Y.discriminator,V&&(delete Y.oneOf,$e(le("oneOf",J))),De&&(delete Y.anyOf,$e(le("anyOf",ie)));let Ge=null;if(ne){delete Y.discriminator;let xe=h(U[0],E);for(let Qe=1;Qe<U.length;Qe++){let k=h(U[Qe],E);k.totalSchemaProperties>xe.totalSchemaProperties&&(xe=k)}Ge={...xe,polymorphismCount:xe.polymorphismCount+U.length,hasDiscriminator:!0}}let Ze=null;if(v){delete Y.allOf,Ze={...m};for(let xe of $.allOf)Ze=w(Ze,h(xe,E));Ze.polymorphismCount+=$.allOf.length}te=u(Y,E),Ze&&(te=w(te,Ze)),ce&&(te=w(te,ce)),Ge&&(te=w(te,Ge)),_&&(te={...te,refsUsed:[_,...te.refsUsed]})}else te=u(x,E);return re($)&&d.delete($),_&&!E&&l.set(_,te),te},C=jp(h,i,o),P=Dp(C),A=Lr([{severity:"warn",ruleId:"score",visitor:P}],e);return Mr({document:t,rootType:e.Root,normalizedVisitors:A,resolvedRefMap:r,ctx:n}),{metrics:Np(C),debugLogs:C.debugLogs}}function Mp(t){let e=new Map;for(let[o,s]of t)for(let i of s.refsUsed){let a=e.get(i);a||(a=new Set,e.set(i,a)),a.add(o)}let r=new Map;for(let o of t.keys())r.set(o,new Set);for(let o of e.values()){if(o.size<2)continue;let s=Array.from(o);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)r.get(s[i]).add(s[a]),r.get(s[a]).add(s[i])}let n=new Map;for(let o of t.keys()){let s=vy(o,r);n.set(o,s)}return n}function vy(t,e){let r=new Set([t]),n=[t],o=0;for(;n.length>0;){let s=[];for(let i of n)for(let a of e.get(i)??[])r.has(a)||(r.add(a),s.push(a));s.length>0&&o++,n=s}return o}function Fp(t){let e={agentReadiness:t.agentReadiness,discoverability:Math.round(t.discoverability*100),subscores:t.subscores,rawMetrics:{operationCount:t.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(t.rawMetrics.operations.entries()).map(([r,n])=>{let{refsUsed:o,...s}=n;return[r,s]}))},operationScores:Object.fromEntries(t.operationScores),dependencyDepths:Object.fromEntries(t.dependencyDepths),hotspots:t.hotspots};y.output(JSON.stringify(e,null,2))}function kp(t,e=!1){Py(t),Ry(t),Iy(t),e&&_y(t),Ty(t)}function Up(t){return t>=80?pe:t>=50?ee:Ne}function qp(t){return Up(t)(ye(t.toFixed(1)))}function H(t){y.output(t+`
142
+ `)}function Py(t){H(""),H(ye(Fe(" Scores"))),H(""),H(` Agent Readiness: ${qp(t.agentReadiness)}/100`),H("")}function Ry(t){H(ye(Fe(" Subscores"))),H("");let e=t.subscores;Et("Parameter Simplicity",e.parameterSimplicity),Et("Schema Simplicity",e.schemaSimplicity),Et("Documentation Quality",e.documentationQuality),Et("Constraint Clarity",e.constraintClarity),Et("Example Coverage",e.exampleCoverage),Et("Error Clarity",e.errorClarity),Et("Dependency Clarity",e.dependencyClarity),Et("Identifier Clarity",e.identifierClarity),Et("Polymorphism Clarity",e.polymorphismClarity),Et("Discoverability",t.discoverability),H("")}function Et(t,e){let r=Math.round(e*100),n=$y(e);H(` ${t.padEnd(24)} ${n} ${Up(r)(r+"%")}`)}function $y(t){let r=Math.round(t*20);return de("["+"\u2588".repeat(r)+"\u2591".repeat(20-r)+"]")}function Iy(t){if(H(ye(Fe(" Raw Metrics Summary"))),H(""),H(` Total operations: ${t.rawMetrics.operationCount}`),t.rawMetrics.operationCount===0){H("");return}let e=[],r=[],n=[],o=[],s=0,i=0,a=0;for(let u of t.rawMetrics.operations.values())e.push(u.parameterCount),r.push(Math.max(u.maxRequestSchemaDepth,u.maxResponseSchemaDepth)),n.push(u.polymorphismCount),o.push(u.totalSchemaProperties),u.requestExamplePresent&&s++,u.responseExamplePresent&&i++,u.operationDescriptionPresent&&a++;let c=t.rawMetrics.operationCount;function p(u,l){let m=(l.reduce((P,A)=>P+A,0)/c).toFixed(1),w=Zn(l).toFixed(1),h=Math.min(...l),C=Math.max(...l);H(` ${u.padEnd(26)} avg ${m.padStart(6)} median ${w.padStart(6)} min ${String(h).padStart(5)} max ${String(C).padStart(5)}`)}p("Parameters/operation:",e),p("Schema depth:",r),p("Polymorphism/operation:",n),p("Properties/operation:",o),H(` Operations with request examples: ${s}/${c} (${Ts(s,c)})`),H(` Operations with response examples: ${i}/${c} (${Ts(i,c)})`),H(` Operations with description: ${a}/${c} (${Ts(a,c)})`),H("")}function Ts(t,e){return e>0?`${Math.round(t/e*100)}%`:"N/A"}function _y(t){H(ye(Fe(" Per-Operation Metrics"))),H("");let e=" "+"Operation".padEnd(50)+"Props".padStart(7)+"Poly".padStart(7)+"Depth".padStart(7)+"Params".padStart(8)+"Constr".padStart(8);H(de(e)),H(de(" "+"\u2500".repeat(e.length-2)));let r=[...t.rawMetrics.operations.entries()].sort(([,n],[,o])=>o.totalSchemaProperties-n.totalSchemaProperties);for(let[,n]of r){let o=(n.operationId??`${n.method.toUpperCase()} ${n.path}`).slice(0,48),s=Math.max(n.maxRequestSchemaDepth,n.maxResponseSchemaDepth),i=" "+o.padEnd(50)+String(n.totalSchemaProperties).padStart(7)+String(n.polymorphismCount).padStart(7)+String(s).padStart(7)+String(n.parameterCount).padStart(8)+String(n.constraintCount).padStart(8);H(i)}H("")}function Wp(t,e){if(H(""),H(ye(Fe(` Debug: ${t} schema breakdown`))),H(""),e.length===0){H(ee(` No schemas found for operation "${t}".`)),H(ee(' Make sure the value matches an operationId or "METHOD /path" exactly.')),H("");return}for(let r of e){H(ye(de(` ${r.context}`))),H(de(" "+"\u2500".repeat(70)));let n=new Map;for(let s of r.entries){let i=s.ref??`(inline depth ${s.depth})`,a=n.get(i);if(a){a.count++,a.totalProps+=s.propertyNames.length;for(let c of s.propertyNames)a.propNames.includes(c)||a.propNames.push(c)}else n.set(i,{count:1,totalProps:s.propertyNames.length,propNames:[...s.propertyNames]})}for(let s of r.entries){let i=s.ref??"(inline)",a=" ".repeat(Math.min(s.depth,6)),c=s.propertyNames.length,p=` ${a}${i}`;c>0&&(p+=` (${c} properties)`);let u=[];if(s.polymorphism.oneOf&&u.push(`oneOf:${s.polymorphism.oneOf}`),s.polymorphism.anyOf&&u.push(`anyOf:${s.polymorphism.anyOf}`),s.polymorphism.allOf&&u.push(`allOf:${s.polymorphism.allOf}`),u.length>0&&(p+=` [${u.join(", ")}]`),s.constraintCount>0&&(p+=` {${s.constraintCount} constraints}`),H(p),c>0&&c<=20)H(` ${a} properties: ${s.propertyNames.join(", ")}`);else if(c>20){let l=s.propertyNames.slice(0,15).join(", ");H(` ${a} properties: ${l}, ... +${c-15} more`)}}H(""),H(` Totals: ${r.totalProperties} properties, ${r.totalPolymorphism} polymorphism items, ${r.totalConstraints} constraints, max depth ${r.maxDepth}`);let o=[...n.entries()].filter(([,s])=>s.totalProps>0).sort(([,s],[,i])=>i.totalProps-s.totalProps).slice(0,10);if(o.length>0){H(""),H(ye(" Top schemas by property count:"));for(let[s,i]of o)H(` ${s}: ${i.totalProps} properties`)}H("")}}function Ty(t){if(t.hotspots.length===0){H(ye(Fe(" No hotspot operations found."))),H("");return}H(ye(Fe(` Top ${t.hotspots.length} Hotspot Operations`))),H("");for(let e of t.hotspots){let r=e.operationId?`${e.method.toUpperCase()} ${e.path} (${e.operationId})`:`${e.method.toUpperCase()} ${e.path}`;H(ye(` ${r}`)),H(` Agent Readiness: ${qp(e.agentReadinessScore)}`);for(let n of e.reasons)H(ee(` - ${n}`));H("")}}function zp(t,e,r,n=wt){let o=[];for(let[s,i]of e){let a=t.operations.get(s);if(!a)continue;let c=jy(a,r.get(s)??0,n);c.length!==0&&o.push({path:a.path,method:a.method,operationId:a.operationId,agentReadinessScore:i.agentReadiness,reasons:c})}return o.sort((s,i)=>s.reasons.length!==i.reasons.length?i.reasons.length-s.reasons.length:s.agentReadinessScore-i.agentReadinessScore),o.slice(0,n.hotspotLimit)}function jy(t,e,r){let{thresholds:n}=r,o=[];t.parameterCount>n.maxParamsGood&&o.push(`High parameter count (${t.parameterCount})`);let s=Math.max(t.maxRequestSchemaDepth,t.maxResponseSchemaDepth);s>n.maxDepthGood&&o.push(`Deep schema nesting (depth ${s})`),t.anyOfCount>0&&!t.hasDiscriminator?o.push(`Polymorphism (anyOf) without discriminator (${t.anyOfCount} anyOf)`):t.polymorphismCount>n.maxPolymorphismGood&&o.push(`High polymorphism count (${t.polymorphismCount})`);let i=t.requestBodyPresent&&!t.requestExamplePresent,a=!t.responseExamplePresent;return i&&a?o.push("Missing request and response examples"):i?o.push("Missing request body examples"):a&&o.push("Missing response examples"),t.totalErrorResponses>0&&t.structuredErrorResponseCount===0&&o.push("No structured error responses (4xx/5xx)"),t.operationDescriptionPresent||o.push("Missing operation description"),t.parameterCount>0&&t.paramsWithDescription===0&&o.push("No parameter descriptions"),e>n.maxDependencyDepthGood&&o.push(`High dependency depth (${e})`),t.ambiguousIdentifierCount>n.maxAmbiguousGood&&o.push(`Ambiguous identifiers (${t.ambiguousIdentifierCount})`),o}async function Vp({argv:t,config:e,collectSpecData:r}){let[{path:n}]=await rt(t.api?[t.api]:[],e),o=new ft(e.resolve),{bundle:s}=await pr({config:e,ref:n});r?.(s);let i=ut(s.parsed);if(lr(i)!=="oas3")return W(`The score command currently supports only OpenAPI 3.x. Detected: ${i}`);let a=Dy.now(),c=cn(e.extendTypes(cr(i),i),e),p=await ln({rootDocument:s,rootType:c.Root,externalRefResolver:o}),u=t["debug-operation-id"],{metrics:l,debugLogs:d}=Lp({document:s,types:c,resolvedRefMap:p,ctx:{problems:[],specVersion:i,config:e,visitorsData:{}},debugOperationId:u}),m=Mp(l.operations),w=Ap(l,m),h=Cp(l.operationCount),{agentReadiness:C}=xp(w,h),P=zp(l,w,m),A={agentReadiness:C,discoverability:h,subscores:vp(w),rawMetrics:l,hotspots:P,operationScores:w,dependencyDepths:m};Ny(A,n,a,t.format,!!t["operation-details"],u?{operationId:u,logs:d}:void 0)}function Ny(t,e,r,n,o,s){y.info(`Document: ${et(e)} score:
143
143
  `),n==="json"?Fp(t):kp(t,o),s&&Wp(s.operationId,s.logs),He("score",r,e)}async function Bp(t,e=!1){let r=ur(t,t.resolvedConfig?.residency),n=new Fr,o=await n.getAccessToken(r);if(o)return e&&y.info(`Using existing access token.
144
144
  `),o;e&&y.warn(`No valid access token found or refresh token expired. Attempting login...
145
145
  `);try{await n.login(r),o=await n.getAccessToken(r)}catch(s){e&&(y.error(`\u274C Login failed.
@@ -204,34 +204,34 @@ ${c.stack}
204
204
  `),y.error(`Error details: ${n.message}
205
205
  `),n.stack&&y.error(`Stack trace:
206
206
  ${n.stack}
207
- `)),y.warn("Something went wrong during plugins evaluation."),[]}}async function tu({apiPath:t,document:e,externalRefResolver:r,scorecardConfig:n,configPath:o,pluginsCodeOrPlugins:s,targetLevel:i,metadata:a={},verbose:c=!1}){let p=[],u=new Map,l=n.targets||[];i&&!n.levels?.some(C=>C.name===i)&&W(`Target level "${i}" not found in the scorecard configuration levels.
207
+ `)),y.warn("Something went wrong during plugins evaluation."),[]}}async function tu({apiPath:t,document:e,externalRefResolver:r,scorecardConfig:n,configPath:o,pluginsCodeOrPlugins:s,targetLevel:i,metadata:a={},verbose:c=!1}){let p=[],u=new Map,l=n.targets||[];i&&!n.levels?.some(A=>A.name===i)&&W(`Target level "${i}" not found in the scorecard configuration levels.
208
208
  `);let d=typeof s=="string"?await Qp(s,c,o?eu.dirname(o):void 0):s,m=Array.isArray(d)?d:[],w={},h;if(l.length>0){c&&y.info(`Scorecard has ${l.length} ${Ie("target",l.length)} defined. Resolving target configurations...
209
- `);let C=Qn(l,a);C?(c&&y.info(`Found matching target for metadata. Resolving configurations for target "${JSON.stringify(C.where)}"...
210
- `),h=C.rules):c&&y.info(`No matching target found for metadata. Proceeding with level configurations only.
211
- `)}w=await Xp(t,h,n.levels||[],m,o||"");for(let C of n.levels||[]){c&&y.info(`
212
- Validating level: "${C.name}"
209
+ `);let A=Qn(l,a);A?(c&&y.info(`Found matching target for metadata. Resolving configurations for target "${JSON.stringify(A.where)}"...
210
+ `),h=A.rules):c&&y.info(`No matching target found for metadata. Proceeding with level configurations only.
211
+ `)}w=await Xp(t,h,n.levels||[],m,o||"");for(let A of n.levels||[]){c&&y.info(`
212
+ Validating level: "${A.name}"
213
213
  `),c&&d&&d.length>0&&y.info(`Using ${d.length} ${Ie("plugin",d.length)} for this level.
214
- `);let A=w[C.name];c&&y.info(`Linting document against level rules...
215
- `);let $=(await oi({document:e,externalRefResolver:r,config:A})).filter(({ignored:_})=>!_).map(_=>({..._,scorecardLevel:C.name}));u.set(C.name,$),c&&y.info(`Found ${$.length} ${Ie("problem",$.length)} for level "${C.name}".
216
- `),p.push(...$)}let x=Yy(u,n.levels||[],i);return{problems:p,achievedLevel:x,targetLevelAchieved:i?x===i:!0}}function Yy(t,e,r){let n=null;for(let o of e){if((t.get(o.name)||[]).some(a=>a.severity==="error"))return n||"Non Conformant";if(n=o.name,r&&o.name===r)return o.name}return n||"Non Conformant"}async function ru({argv:t,config:e,version:r,collectSpecData:n}){let o=performance.now(),s=await rt(t.api?[t.api]:[],e),i=t["project-url"]||e.resolvedConfig.scorecardClassic?.fromProjectUrl||e.resolvedConfig.scorecard?.fromProjectUrl;i||W("Scorecard is not configured. Please provide it via --project-url flag or configure it in redocly.yaml. Learn more: https://redocly.com/docs/realm/config/scorecard#fromprojecturl-example"),Zp(i)||W(`Project URL must be from the .redocly.com domain. Received: ${i}`);let a=process.env.REDOCLY_AUTHORIZATION;Ky()&&!a&&W(`Please provide an API key using the REDOCLY_AUTHORIZATION environment variable.
214
+ `);let x=w[A.name];c&&y.info(`Linting document against level rules...
215
+ `);let $=(await oi({document:e,externalRefResolver:r,config:x})).filter(({ignored:_})=>!_).map(_=>({..._,scorecardLevel:A.name}));u.set(A.name,$),c&&y.info(`Found ${$.length} ${Ie("problem",$.length)} for level "${A.name}".
216
+ `),p.push(...$)}let C=Yy(u,n.levels||[],i);return{problems:p,achievedLevel:C,targetLevelAchieved:i?C===i:!0}}function Yy(t,e,r){let n=null;for(let o of e){if((t.get(o.name)||[]).some(a=>a.severity==="error"))return n||"Non Conformant";if(n=o.name,r&&o.name===r)return o.name}return n||"Non Conformant"}async function ru({argv:t,config:e,version:r,collectSpecData:n}){let o=performance.now(),s=await rt(t.api?[t.api]:[],e),i=t["project-url"]||e.resolvedConfig.scorecardClassic?.fromProjectUrl||e.resolvedConfig.scorecard?.fromProjectUrl;i||W("Scorecard is not configured. Please provide it via --project-url flag or configure it in redocly.yaml. Learn more: https://redocly.com/docs/realm/config/scorecard#fromprojecturl-example"),Zp(i)||W(`Project URL must be from the .redocly.com domain. Received: ${i}`);let a=process.env.REDOCLY_AUTHORIZATION;Ky()&&!a&&W(`Please provide an API key using the REDOCLY_AUTHORIZATION environment variable.
217
217
  `);let c=a||await Bp(e,t.verbose);c||W("Failed to obtain access token or API key.");let{scorecard:p,plugins:u}=await Jp({projectUrl:i,auth:c,isApiKey:!!a,verbose:t.verbose}),{path:l,alias:d}=s[0],w=mi(e,l).alias||d,h=w?e.resolvedConfig.apis?.[w]?.metadata:void 0;t.verbose&&w&&h&&y.info(`
218
218
  \u2713 Matched API "${de(w)}" from config
219
219
  `),t.verbose&&(y.info(`Processing API: ${de(w||"default")}
220
220
  `),y.info(`Path: ${mt(l)}
221
221
  `),h&&y.info(`Config Metadata: ${JSON.stringify(h,null,2)}
222
222
  `),y.info(`Project URL: ${i}
223
- `));let x=new ft(e.resolve),P=await x.resolveDocument(null,l,!0);n?.(P);let C=P.parsed?.info,A=C?.["x-metadata"]||{},E={title:C?.title,version:C?.version,...A,...h};t.verbose&&y.info(`Combined Metadata for target matching: ${JSON.stringify(E,null,2)}
223
+ `));let C=new ft(e.resolve),P=await C.resolveDocument(null,l,!0);n?.(P);let A=P.parsed?.info,x=A?.["x-metadata"]||{},E={title:A?.title,version:A?.version,...x,...h};t.verbose&&y.info(`Combined Metadata for target matching: ${JSON.stringify(E,null,2)}
224
224
  `);let $=t["target-level"]||Qn(p?.targets,E)?.minimumLevel;y.info(ue(`
225
225
  Running scorecard for ${mt(l)}...
226
- `));let{problems:_,achievedLevel:J,targetLevelAchieved:ie}=await tu({apiPath:l,document:P,externalRefResolver:x,scorecardConfig:p,configPath:e.configPath,pluginsCodeOrPlugins:u,targetLevel:$,metadata:E,verbose:t.verbose});if(_.length===0){y.output(Fe(ye(`
226
+ `));let{problems:_,achievedLevel:J,targetLevelAchieved:ie}=await tu({apiPath:l,document:P,externalRefResolver:C,scorecardConfig:p,configPath:e.configPath,pluginsCodeOrPlugins:u,targetLevel:$,metadata:E,verbose:t.verbose});if(_.length===0){y.output(Fe(ye(`
227
227
  \u2611\uFE0F Achieved Level: ${de(J)}
228
228
  `))),y.output(pe(`\u2705 No issues found for ${Q(mt(l))}. Your API meets all scorecard requirements.
229
229
  `));return}$&&!ie&&y.error(`
230
230
  \u274C Your API specification does not satisfy the target scorecard level "${$}".
231
231
  `),t.format==="json"?Hp(_,J,ie,r):t.format==="checkstyle"?Gp(l,_,J,ie):t.format==="junit"?Yp(l,_,J,ie):Kp(_,J,ie);let V=gn(o);if(y.info(`\u{1F4CA} Scorecard results for ${Q(mt(l))} at ${Q(l||"stdout")} ${pe(V)}.
232
- `),$&&!ie)throw new qt("Target scorecard level not achieved.");if(J!=="Non Conformant")return;throw new qt("Scorecard validation failed.")}function Ky(){return!!(process.env.CI||!process.stdin.isTTY)}import*as Iu from"node:fs";import{performance as Jy}from"perf_hooks";import*as Su from"node:fs";import*as no from"node:path";import*as nu from"node:path";function Be(t,e,r={}){Er(t,o=>{if(_e(o)&&Or(o.$ref))n(o,"$ref");else if(re(o.discriminator)&&re(o.discriminator.mapping)){let{mapping:s}=o.discriminator;for(let i of Object.keys(s)){let a=s[i];typeof a=="string"&&Or(a)&&n(o.discriminator.mapping,i)}}});function n(o,s){let i=o[s].split("/"),a=i.pop(),c=i[2],p=r[c];if(!p||!p[a])return;let u=Me(nu.relative(e,p[a].filename));u.startsWith(".")||(u="./"+u),o[s]=u}}import*as js from"node:path";import*as ou from"node:path";function nr(t,e,r){return ou.join(t,e)+`.${r}`}var su=["schemas","messages","securitySchemes","parameters","correlationIds","messageTraits","operationTraits","serverBindings","channelBindings","operationBindings","messageBindings"];var iu=["schemas","messages","securitySchemes","servers","serverVariables","parameters","replies","replyAddresses","correlationIds","messageTraits","operationTraits","tags","externalDocs","serverBindings","channelBindings","operationBindings","messageBindings"];function eo(t,e){return(e==="async2"?su:iu).filter(n=>n in t)}function au({asyncapi:t,asyncapiDir:e,componentsFiles:r,ext:n,specVersion:o}){let{components:s}=t;if(!s)return;let i=js.join(e,Se),a=eo(s,o);for(let c of a){let p=js.join(i,c);for(let u of Object.keys(s[c]||{})){let l=nr(p,u,n),d=[];c==="schemas"&&(d=(s[c]?.[u]?.allOf||[]).map(({$ref:m})=>m).filter(an)),r[c]=r[c]||{},r[c][u]={inherits:d,filename:l}}}}import*as lu from"node:fs";import*as vr from"node:path";import*as nn from"node:path";function gt(t,e,r){let n=nn.resolve(t),o=nn.resolve(e);o!==n&&!o.startsWith(n+nn.sep)&&W(`Refusing to write "${r}" outside the output directory.`)}import*as or from"node:fs";import*as cu from"node:path";function sr(t,e,r){if(!or.existsSync(t)||!or.statSync(t).isDirectory())return;let n=or.readdirSync(t);for(let o of n){let s=cu.join(t,o);or.statSync(s).isDirectory()?sr(s,e,r):e(s,t,r)}}function Ar(t,e,r){if(!ei(t))return;let n=fr(t);Be(n,e,r),Pe(n,t)}function pu({channels:t,asyncapiDir:e,outDir:r,componentsFiles:n,pathSeparator:o,ext:s}){let i={};if(!t)return i;lu.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${vr.join(r,Wt(a,o))}.${s}`,p=t[a];_e(p)||(gt(e,c,a),i[a]=c,Be(p,vr.dirname(c),n),Pe(p,c),t[a]={$ref:Me(vr.relative(e,c))},sr(r,Ar,n))}return i}import*as hu from"node:fs";import*as $r from"node:path";import*as uu from"node:fs";function Pr(t){return t!=="securitySchemes"}function to(t,e){Pr(e)&&uu.mkdirSync(t,{recursive:!0})}import*as fu from"node:fs";function ro(t,e){return fu.existsSync(t)&&!Rt(fr(t),e)}import*as mu from"node:path";function Rr(t,e,r){if(!(!re(t)&&!Array.isArray(t))){if(Array.isArray(t)){for(let n of t)Rr(n,e,r);return}for(let n of Object.keys(t)){let o=t[n];if(n==="$ref"&&typeof o=="string"&&o.startsWith("#/channels/")){let s=o.slice(11),i=s.indexOf("/"),a=i===-1?s:s.slice(0,i),c=i===-1?"":s.slice(i),p=r[a];if(p){let u=Me(mu.relative(e,p));t[n]=c?`${u}#${c}`:u}}else Rr(o,e,r)}}}function du(t,e){let r=t.components;r&&(yt(r[e])&&delete r[e],yt(r)&&delete t.components)}function gu({asyncapi:t,asyncapiDir:e,componentsFiles:r,channelsFiles:n,ext:o,specVersion:s}){let{components:i}=t;if(i){let p=function(u){let l=$r.join(a,u);to(l,u);for(let d of Object.keys(i?.[u]||{})){let m=nr(l,d,o);gt(e,m,d);let w=i?.[u]?.[d];Be(w,$r.dirname(m),r),Rr(w,$r.dirname(m),n),ro(m,w)?y.warn(`warning: conflict for ${d} - file already exists with different content: ${Q(m)} ... Skip.
233
- `):Pe(w,m),delete t.components?.[u]?.[d]}du(t,u)},a=$r.join(e,Se);hu.mkdirSync(a,{recursive:!0}),eo(i,s).forEach(p)}}import*as yu from"node:fs";import*as ir from"node:path";function bu({operations:t,asyncapiDir:e,outDir:r,componentsFiles:n,channelsFiles:o,pathSeparator:s,ext:i}){if(t){yu.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${ir.join(r,Wt(a,s))}.${i}`,p=t[a];_e(p)||(gt(e,c,a),Be(p,ir.dirname(c),n),Rr(p,ir.dirname(c),o),Pe(p,c),t[a]={$ref:Me(ir.relative(e,c))},sr(r,Ar,n))}}}function wu({asyncapi:t,asyncapiDir:e,pathSeparator:r,ext:n,specVersion:o}){Su.mkdirSync(e,{recursive:!0});let s={};au({asyncapi:t,asyncapiDir:e,componentsFiles:s,ext:n,specVersion:o});let i=t.channels,a=i?pu({channels:i,asyncapiDir:e,outDir:no.join(e,$l),componentsFiles:s,pathSeparator:r,ext:n}):{};gu({asyncapi:t,asyncapiDir:e,componentsFiles:s,channelsFiles:a,ext:n,specVersion:o}),o==="async3"&&t.operations&&bu({operations:t.operations,asyncapiDir:e,outDir:no.join(e,Il),componentsFiles:s,channelsFiles:a,pathSeparator:r,ext:n}),Be(t,e,s),Pe(t,no.join(e,`asyncapi.${n}`))}import*as Ru from"node:fs";import*as ao from"node:path";import*as vu from"node:fs";import*as Ir from"node:path";import*as oo from"node:path";function Eu(t){return oo.basename(t,oo.extname(t))}function Ou(t){return t?Ci.filter(e=>Pr(e)&&Object.keys(t).includes(e)):[]}function Cu(t,e,r,n,o){let s=[];r==="schemas"&&(s=(t?.[r]?.[n]?.allOf||[]).map(({$ref:i})=>i).filter(an)),e[r]=e[r]||{},e[r][n]={inherits:s,filename:o}}import*as so from"node:path";function xu(t,e,r,n){if(!t.discriminator)return;let o=`#/${Se}/schemas/${e}`,s={};for(let[p,{inherits:u,filename:l}]of Object.entries(n))if(u.indexOf(o)>-1){let d=Me(so.relative(so.dirname(r),l));s[p]=d.startsWith(".")?d:"./"+d}if(yt(s))return;let i=t.properties[t.discriminator.propertyName],a=i&&i.enum,c=t.discriminator.mapping=t.discriminator.mapping||{};for(let p of Object.keys(s))a&&!a.includes(p)||(c[p]&&c[p]!==s[p]&&y.warn(`warning: explicit mapping overlaps with local mapping entry ${Ne(p)} at ${Q(r)}. Please check it.`),c[p]=s[p])}function Au(t,e){t.components&&yt(t.components[e])&&delete t.components[e],yt(t.components)&&delete t.components}function Pu(t,e,r,n){let{components:o}=t;if(o){let a=function(p){let u=Ir.join(s,p);for(let l of Object.keys(o?.[p]||{})){let d=nr(u,l,n);gt(e,d,l),Cu(o,r,p,l,d)}},c=function(p){let u=Ir.join(s,p);to(u,p);for(let l of Object.keys(o?.[p]||{})){let d=nr(u,l,n),m=o?.[p]?.[l];Be(m,Ir.dirname(d),r),xu(m,Eu(d),d,r.schemas||{}),ro(d,m)?y.warn(`warning: conflict for ${l} - file already exists with different content: ${Q(d)} ... Skip.
234
- `):Pe(m,d),Pr(p)&&delete t.components?.[p]?.[l]}Au(t,p)},s=Ir.join(e,Se);vu.mkdirSync(s,{recursive:!0});let i=Ou(o);i.forEach(a),i.forEach(c)}}import*as on from"node:fs";import*as kt from"node:path";function io(t,e,r,n,o,s="",i){if(t){on.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${kt.join(r,Wt(a,o))}.${i}`,p=t[a];if(!_e(p)){gt(e,c,a);for(let u of Sn){let l=p[u],d=l?.["x-code-samples"]||l?.["x-codeSamples"];if(!(!d||!Array.isArray(d)))for(let m of d){if(m.source&&m.source.$ref)continue;let w=kt.join(e,"code_samples",di(m.lang),s+Wt(a,o),u+hi(m.lang));gt(e,w,m.lang),on.mkdirSync(kt.dirname(w),{recursive:!0}),on.writeFileSync(w,m.source),m.source={$ref:Me(kt.relative(r,w))}}}Pe(p,c),t[a]={$ref:Me(kt.relative(e,c))},sr(r,Ar,n)}}}}function $u(t,e,r,n){Ru.mkdirSync(e,{recursive:!0});let o={};Pu(t,e,o,n),io(t.paths,e,ao.join(e,"paths"),o,r,void 0,n);let s=t.webhooks||t["x-webhooks"];io(s,e,ao.join(e,"webhooks"),o,r,"webhook_",n),Be(t,e,o),Pe(t,ao.join(e,`openapi.${n}`))}async function _u({argv:t,collectSpecData:e}){let r=Jy.now(),{api:n,outDir:o,separator:s}=t,i=yn(n);Iu.existsSync(n)||W(`File ${Q(n)} does not exist.`);let a=fr(n);e?.({parsed:a});let c=ut(a);switch(c){case"async2":case"async3":wu({asyncapi:a,asyncapiDir:o,pathSeparator:s,ext:i,specVersion:c});break;case"oas3_0":case"oas3_1":case"oas3_2":$u(a,o,s,i);break;case"oas2":W("OpenAPI 2 is not supported by this command.");break;default:W("File does not conform to the OpenAPI or AsyncAPI Specification. Version is not specified.")}y.info(`\u{1FA93} Document: ${Q(n)} ${pe("is successfully split")}
232
+ `),$&&!ie)throw new qt("Target scorecard level not achieved.");if(J!=="Non Conformant")return;throw new qt("Scorecard validation failed.")}function Ky(){return!!(process.env.CI||!process.stdin.isTTY)}import*as Iu from"node:fs";import{performance as Jy}from"perf_hooks";import*as Su from"node:fs";import*as no from"node:path";import*as nu from"node:path";function Be(t,e,r={}){Er(t,o=>{if(_e(o)&&Or(o.$ref))n(o,"$ref");else if(re(o.discriminator)&&re(o.discriminator.mapping)){let{mapping:s}=o.discriminator;for(let i of Object.keys(s)){let a=s[i];typeof a=="string"&&Or(a)&&n(o.discriminator.mapping,i)}}});function n(o,s){let i=o[s].split("/"),a=i.pop(),c=i[2],p=r[c];if(!p||!p[a])return;let u=Me(nu.relative(e,p[a].filename));u.startsWith(".")||(u="./"+u),o[s]=u}}import*as js from"node:path";import*as ou from"node:path";function nr(t,e,r){return ou.join(t,e)+`.${r}`}var su=["schemas","messages","securitySchemes","parameters","correlationIds","messageTraits","operationTraits","serverBindings","channelBindings","operationBindings","messageBindings"];var iu=["schemas","messages","securitySchemes","servers","serverVariables","parameters","replies","replyAddresses","correlationIds","messageTraits","operationTraits","tags","externalDocs","serverBindings","channelBindings","operationBindings","messageBindings"];function eo(t,e){return(e==="async2"?su:iu).filter(n=>n in t)}function au({asyncapi:t,asyncapiDir:e,componentsFiles:r,ext:n,specVersion:o}){let s=t.components;if(!s)return;let i=js.join(e,Se),a=eo(s,o);for(let c of a){let p=js.join(i,c);for(let u of Object.keys(s[c]||{})){let l=nr(p,u,n),d=[];c==="schemas"&&(d=(s[c]?.[u]?.allOf||[]).map(({$ref:m})=>m).filter(an)),r[c]=r[c]||{},r[c][u]={inherits:d,filename:l}}}}import*as lu from"node:fs";import*as vr from"node:path";import*as nn from"node:path";function gt(t,e,r){let n=nn.resolve(t),o=nn.resolve(e);o!==n&&!o.startsWith(n+nn.sep)&&W(`Refusing to write "${r}" outside the output directory.`)}import*as or from"node:fs";import*as cu from"node:path";function sr(t,e,r){if(!or.existsSync(t)||!or.statSync(t).isDirectory())return;let n=or.readdirSync(t);for(let o of n){let s=cu.join(t,o);or.statSync(s).isDirectory()?sr(s,e,r):e(s,t,r)}}function xr(t,e,r){if(!ei(t))return;let n=fr(t);Be(n,e,r),Pe(n,t)}function pu({channels:t,asyncapiDir:e,outDir:r,componentsFiles:n,pathSeparator:o,ext:s}){let i={};if(!t)return i;lu.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${vr.join(r,Wt(a,o))}.${s}`,p=t[a];_e(p)||(gt(e,c,a),i[a]=c,Be(p,vr.dirname(c),n),Pe(p,c),t[a]={$ref:Me(vr.relative(e,c))},sr(r,xr,n))}return i}import*as hu from"node:fs";import*as $r from"node:path";import*as uu from"node:fs";function Pr(t){return t!=="securitySchemes"}function to(t,e){Pr(e)&&uu.mkdirSync(t,{recursive:!0})}import*as fu from"node:fs";function ro(t,e){return fu.existsSync(t)&&!Rt(fr(t),e)}import*as mu from"node:path";function Rr(t,e,r){if(!(!re(t)&&!Array.isArray(t))){if(Array.isArray(t)){for(let n of t)Rr(n,e,r);return}for(let n of Object.keys(t)){let o=t[n];if(n==="$ref"&&typeof o=="string"&&o.startsWith("#/channels/")){let s=o.slice(11),i=s.indexOf("/"),a=i===-1?s:s.slice(0,i),c=i===-1?"":s.slice(i),p=r[a];if(p){let u=Me(mu.relative(e,p));t[n]=c?`${u}#${c}`:u}}else Rr(o,e,r)}}}function du(t,e){let r=t.components;r&&(yt(r[e])&&delete r[e],yt(r)&&delete t.components)}function gu({asyncapi:t,asyncapiDir:e,componentsFiles:r,channelsFiles:n,ext:o,specVersion:s}){let i=t.components;if(i){let p=function(u){let l=$r.join(a,u);to(l,u);for(let d of Object.keys(i?.[u]||{})){let m=nr(l,d,o);gt(e,m,d);let w=i?.[u]?.[d];Be(w,$r.dirname(m),r),Rr(w,$r.dirname(m),n),ro(m,w)?y.warn(`warning: conflict for ${d} - file already exists with different content: ${Q(m)} ... Skip.
233
+ `):Pe(w,m),delete i?.[u]?.[d]}du(t,u)},a=$r.join(e,Se);hu.mkdirSync(a,{recursive:!0}),eo(i,s).forEach(p)}}import*as yu from"node:fs";import*as ir from"node:path";function bu({operations:t,asyncapiDir:e,outDir:r,componentsFiles:n,channelsFiles:o,pathSeparator:s,ext:i}){if(t){yu.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${ir.join(r,Wt(a,s))}.${i}`,p=t[a];_e(p)||(gt(e,c,a),Be(p,ir.dirname(c),n),Rr(p,ir.dirname(c),o),Pe(p,c),t[a]={$ref:Me(ir.relative(e,c))},sr(r,xr,n))}}}function wu({asyncapi:t,asyncapiDir:e,pathSeparator:r,ext:n,specVersion:o}){Su.mkdirSync(e,{recursive:!0});let s={};au({asyncapi:t,asyncapiDir:e,componentsFiles:s,ext:n,specVersion:o});let i=t.channels,a=i?pu({channels:i,asyncapiDir:e,outDir:no.join(e,$l),componentsFiles:s,pathSeparator:r,ext:n}):{};gu({asyncapi:t,asyncapiDir:e,componentsFiles:s,channelsFiles:a,ext:n,specVersion:o}),o==="async3"&&t.operations&&bu({operations:t.operations,asyncapiDir:e,outDir:no.join(e,Il),componentsFiles:s,channelsFiles:a,pathSeparator:r,ext:n}),Be(t,e,s),Pe(t,no.join(e,`asyncapi.${n}`))}import*as Ru from"node:fs";import*as ao from"node:path";import*as vu from"node:fs";import*as Ir from"node:path";import*as oo from"node:path";function Eu(t){return oo.basename(t,oo.extname(t))}function Ou(t){return t?Ai.filter(e=>Pr(e)&&Object.keys(t).includes(e)):[]}function Au(t,e,r,n,o){let s=[];r==="schemas"&&(s=(t?.[r]?.[n]?.allOf||[]).map(({$ref:i})=>i).filter(an)),e[r]=e[r]||{},e[r][n]={inherits:s,filename:o}}import*as so from"node:path";function Cu(t,e,r,n){if(!t.discriminator)return;let o=`#/${Se}/schemas/${e}`,s={};for(let[p,{inherits:u,filename:l}]of Object.entries(n))if(u.indexOf(o)>-1){let d=Me(so.relative(so.dirname(r),l));s[p]=d.startsWith(".")?d:"./"+d}if(yt(s))return;let i=t.properties[t.discriminator.propertyName],a=i&&i.enum,c=t.discriminator.mapping=t.discriminator.mapping||{};for(let p of Object.keys(s))a&&!a.includes(p)||(c[p]&&c[p]!==s[p]&&y.warn(`warning: explicit mapping overlaps with local mapping entry ${Ne(p)} at ${Q(r)}. Please check it.`),c[p]=s[p])}function xu(t,e){t.components&&yt(t.components[e])&&delete t.components[e],yt(t.components)&&delete t.components}function Pu(t,e,r,n){let{components:o}=t;if(o){let a=function(p){let u=Ir.join(s,p);for(let l of Object.keys(o?.[p]||{})){let d=nr(u,l,n);gt(e,d,l),Au(o,r,p,l,d)}},c=function(p){let u=Ir.join(s,p);to(u,p);for(let l of Object.keys(o?.[p]||{})){let d=nr(u,l,n),m=o?.[p]?.[l];Be(m,Ir.dirname(d),r),Cu(m,Eu(d),d,r.schemas||{}),ro(d,m)?y.warn(`warning: conflict for ${l} - file already exists with different content: ${Q(d)} ... Skip.
234
+ `):Pe(m,d),Pr(p)&&delete t.components?.[p]?.[l]}xu(t,p)},s=Ir.join(e,Se);vu.mkdirSync(s,{recursive:!0});let i=Ou(o);i.forEach(a),i.forEach(c)}}import*as on from"node:fs";import*as kt from"node:path";function io(t,e,r,n,o,s="",i){if(t){on.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${kt.join(r,Wt(a,o))}.${i}`,p=t[a];if(!_e(p)){gt(e,c,a);for(let u of Sn){let l=p[u],d=l?.["x-code-samples"]||l?.["x-codeSamples"];if(!(!d||!Array.isArray(d)))for(let m of d){if(m.source&&m.source.$ref)continue;let w=kt.join(e,"code_samples",di(m.lang),s+Wt(a,o),u+hi(m.lang));gt(e,w,m.lang),on.mkdirSync(kt.dirname(w),{recursive:!0}),on.writeFileSync(w,m.source),m.source={$ref:Me(kt.relative(r,w))}}}Pe(p,c),t[a]={$ref:Me(kt.relative(e,c))},sr(r,xr,n)}}}}function $u(t,e,r,n){Ru.mkdirSync(e,{recursive:!0});let o={};Pu(t,e,o,n),io(t.paths,e,ao.join(e,"paths"),o,r,void 0,n);let s=t.webhooks||t["x-webhooks"];io(s,e,ao.join(e,"webhooks"),o,r,"webhook_",n),Be(t,e,o),Pe(t,ao.join(e,`openapi.${n}`))}async function _u({argv:t,collectSpecData:e}){let r=Jy.now(),{api:n,outDir:o,separator:s}=t,i=yn(n);Iu.existsSync(n)||W(`File ${Q(n)} does not exist.`);let a=fr(n);e?.({parsed:a});let c=ut(a);switch(c){case"async2":case"async3":wu({asyncapi:a,asyncapiDir:o,pathSeparator:s,ext:i,specVersion:c});break;case"oas3_0":case"oas3_1":case"oas3_2":$u(a,o,s,i);break;case"oas2":W("OpenAPI 2 is not supported by this command.");break;default:W("File does not conform to the OpenAPI or AsyncAPI Specification. Version is not specified.")}y.info(`\u{1FA93} Document: ${Q(n)} ${pe("is successfully split")}
235
235
  and all related files are saved to the directory: ${Q(o)}
236
236
  `),He("split",r,n)}import{performance as Xy}from"perf_hooks";function Tu(t){let e={};for(let r of Object.keys(t)){let n=t[r];e[r]={metric:n.metric,total:n.total}}y.output(JSON.stringify(e,null,2))}function ju(t){let e=`| Feature | Count |
237
237
  | --- | --- |
@@ -242,9 +242,9 @@ Running scorecard for ${mt(l)}...
242
242
  `),n){case"stylish":Du(t);break;case"json":Tu(t);break;case"markdown":ju(t);break}He("stats",r,e)}function Lu(t){let e={refs:{metric:"\u{1F697} References",total:0,color:"red",items:new Set},externalDocs:{metric:"\u{1F4E6} External Documents",total:0,color:"magenta"},schemas:{metric:"\u{1F4C8} Schemas",total:0,color:"white"},parameters:{metric:"\u{1F449} Parameters",total:0,color:"yellow",items:new Set},links:{metric:"\u{1F517} Links",total:0,color:"cyan",items:new Set},pathItems:{metric:"\u{1F500} Path Items",total:0,color:"green"},webhooks:{metric:"\u{1F3A3} Webhooks",total:0,color:"green"},operations:{metric:"\u{1F477} Operations",total:0,color:"yellow"},tags:{metric:"\u{1F516} Tags",total:0,color:"white",items:new Set}},r={refs:{metric:"\u{1F697} References",total:0,color:"red",items:new Set},externalDocs:{metric:"\u{1F4E6} External Documents",total:0,color:"magenta"},schemas:{metric:"\u{1F4C8} Schemas",total:0,color:"white"},parameters:{metric:"\u{1F449} Parameters",total:0,color:"yellow",items:new Set},channels:{metric:"\u{1F4E1} Channels",total:0,color:"green"},operations:{metric:"\u{1F477} Operations",total:0,color:"yellow"},tags:{metric:"\u{1F516} Tags",total:0,color:"white",items:new Set}},n,o;switch(t){case"async2":o=r,n=Xs(o);break;case"async3":o=r,n=Zs(o);break;case"oas2":case"oas3_0":case"oas3_1":case"oas3_2":o=e,n=Js(o);break;default:return W(`Unsupported spec version: ${t}.`)}return{statsVisitor:n,statsAccumulator:o}}async function Mu({argv:t,config:e,collectSpecData:r}){let[{path:n}]=await rt(t.api?[t.api]:[],e),o=new ft(e.resolve),{bundle:s}=await pr({config:e,ref:n});r?.(s);let i=ut(s.parsed),a=cn(e.extendTypes(cr(i),i),e),{statsVisitor:c,statsAccumulator:p}=Lu(i),u=Xy.now(),l={problems:[],specVersion:i,config:e,visitorsData:{}},d=await ln({rootDocument:s,rootType:a.Root,externalRefResolver:o}),m=Lr([{severity:"warn",ruleId:"stats",visitor:c}],a);Mr({document:s,rootType:a.Root,normalizedVisitors:m,resolvedRefMap:d,ctx:l}),Nu(p,n,u,t.format)}import{spawn as Zy}from"node:child_process";var Fu=async({argv:t})=>{y.info(`
243
243
  Launching translate using NPX.
244
244
 
245
- `);let{npxExecutableName:e,sanitize:r,shell:n}=wr(),o=r(t["project-dir"],Xr),s=r(t.locale,xl);Zy(e,["-y","@redocly/realm","translate",s,`-d=${o}`],{stdio:"inherit",shell:n}).on("error",a=>{throw y.info(`Translate launch failed: ${a.message}`),new Error("Translate launch failed.")})};var _r=class extends Error{};async function Ds({operation:t,condition:e,onConditionNotMet:r,onRetry:n,startTime:o=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:i=5e3}){async function a(){let c=await t();if(!e||e(c))return c;if(Date.now()-o>s)throw new Error("Timeout exceeded.");return r?.(c),await Bs(i),await n?.(c),a()}return a()}function co(t,e){return e instanceof _r?W(e.message):e instanceof pi?W(`${t} Reason: ${e.message} (status: ${e.status})
245
+ `);let{npxExecutableName:e,sanitize:r,shell:n}=wr(),o=r(t["project-dir"],Xr),s=r(t.locale,Cl);Zy(e,["-y","@redocly/realm","translate",s,`-d=${o}`],{stdio:"inherit",shell:n}).on("error",a=>{throw y.info(`Translate launch failed: ${a.message}`),new Error("Translate launch failed.")})};var _r=class extends Error{};async function Ds({operation:t,condition:e,onConditionNotMet:r,onRetry:n,startTime:o=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:i=5e3}){async function a(){let c=await t();if(!e||e(c))return c;if(Date.now()-o>s)throw new Error("Timeout exceeded.");return r?.(c),await Bs(i),await n?.(c),a()}return a()}function co(t,e){return e instanceof _r?W(e.message):e instanceof pi?W(`${t} Reason: ${e.message} (status: ${e.status})
246
246
  `):W(`${t} Reason: ${e.message}
247
- `)}var Qy=5e3;async function lo({argv:t}){let e=performance.now(),r=new xi,{organization:n,project:o,pushId:s,wait:i}=t,a=t.domain||fn(),c=t["max-execution-time"]||1200,p=t["retry-interval"]?t["retry-interval"]*1e3:Qy,u=t["start-time"]||Date.now(),l=c*1e3,d=t["continue-on-deploy-failures"]||!1;try{let m=Hn(),w=new hn({domain:a,apiKey:m,command:"push-status"}),h;return h=await Ds({operation:()=>w.remotes.getPush({organizationId:n,projectId:o,pushId:s}),condition:i?C=>!["pending","running"].includes(C.status.preview.deploy.status):null,onConditionNotMet:C=>{Ns({status:C.status.preview.deploy.status,url:C.status.preview.deploy.url,spinner:r,buildType:"preview",continueOnDeployFailures:d,wait:i})},onRetry:C=>{t.onRetry&&t.onRetry({preview:C.status.preview,production:C.isMainBranch?C.status.production:null,commit:C.commit})},startTime:u,retryTimeoutMs:l,retryIntervalMs:p}),ku({buildType:"preview",spinner:r,wait:i,push:h,continueOnDeployFailures:d}),Uu(h.status.preview.scorecard),h.isMainBranch&&(!i||h.status.preview.deploy.status==="success")&&(h=await Ds({operation:()=>w.remotes.getPush({organizationId:n,projectId:o,pushId:s}),condition:i?C=>!["pending","running"].includes(C.status.production.deploy.status):null,onConditionNotMet:C=>{Ns({status:C.status.production.deploy.status,url:C.status.production.deploy.url,spinner:r,buildType:"production",continueOnDeployFailures:d,wait:i})},onRetry:C=>{t.onRetry&&t.onRetry({preview:C.status.preview,production:C.isMainBranch?C.status.production:null,commit:C.commit})},startTime:u,retryTimeoutMs:l,retryIntervalMs:p})),h.isMainBranch&&(ku({buildType:"production",spinner:r,wait:i,push:h,continueOnDeployFailures:d}),Uu(h.status.production.scorecard)),eb({organization:n,projectId:o,pushId:s,startedAt:e}),w.reportSunsetWarnings(),{preview:h.status.preview,production:h.isMainBranch?h.status.production:null,commit:h.commit}}catch(m){r.stop(),co("\u2717 Failed to get push status.",m)}finally{r.stop()}}function eb({organization:t,projectId:e,pushId:r,startedAt:n}){y.info(`
247
+ `)}var Qy=5e3;async function lo({argv:t}){let e=performance.now(),r=new Ci,{organization:n,project:o,pushId:s,wait:i}=t,a=t.domain||fn(),c=t["max-execution-time"]||1200,p=t["retry-interval"]?t["retry-interval"]*1e3:Qy,u=t["start-time"]||Date.now(),l=c*1e3,d=t["continue-on-deploy-failures"]||!1;try{let m=Hn(),w=new hn({domain:a,apiKey:m,command:"push-status"}),h;return h=await Ds({operation:()=>w.remotes.getPush({organizationId:n,projectId:o,pushId:s}),condition:i?A=>!["pending","running"].includes(A.status.preview.deploy.status):null,onConditionNotMet:A=>{Ns({status:A.status.preview.deploy.status,url:A.status.preview.deploy.url,spinner:r,buildType:"preview",continueOnDeployFailures:d,wait:i})},onRetry:A=>{t.onRetry&&t.onRetry({preview:A.status.preview,production:A.isMainBranch?A.status.production:null,commit:A.commit})},startTime:u,retryTimeoutMs:l,retryIntervalMs:p}),ku({buildType:"preview",spinner:r,wait:i,push:h,continueOnDeployFailures:d}),Uu(h.status.preview.scorecard),h.isMainBranch&&(!i||h.status.preview.deploy.status==="success")&&(h=await Ds({operation:()=>w.remotes.getPush({organizationId:n,projectId:o,pushId:s}),condition:i?A=>!["pending","running"].includes(A.status.production.deploy.status):null,onConditionNotMet:A=>{Ns({status:A.status.production.deploy.status,url:A.status.production.deploy.url,spinner:r,buildType:"production",continueOnDeployFailures:d,wait:i})},onRetry:A=>{t.onRetry&&t.onRetry({preview:A.status.preview,production:A.isMainBranch?A.status.production:null,commit:A.commit})},startTime:u,retryTimeoutMs:l,retryIntervalMs:p})),h.isMainBranch&&(ku({buildType:"production",spinner:r,wait:i,push:h,continueOnDeployFailures:d}),Uu(h.status.production.scorecard)),eb({organization:n,projectId:o,pushId:s,startedAt:e}),w.reportSunsetWarnings(),{preview:h.status.preview,production:h.isMainBranch?h.status.production:null,commit:h.commit}}catch(m){r.stop(),co("\u2717 Failed to get push status.",m)}finally{r.stop()}}function eb({organization:t,projectId:e,pushId:r,startedAt:n}){y.info(`
248
248
  Processed push-status for ${ee(t)}, ${ee(e)} and pushID ${ee(r)}.
249
249
  `),He("push-status",n,"Finished")}function ku({buildType:t,spinner:e,push:r,continueOnDeployFailures:n}){r&&(r.isOutdated||!r.hasChanges?y.warn(`Files not added to your project. Reason: ${r.isOutdated?"outdated":"no changes"}.
250
250
  `):Ns({status:r.status[t].deploy.status,url:r.status[t].deploy.url,buildType:t,spinner:e,continueOnDeployFailures:n}))}function Uu(t){if(!(!t||t.length===0)){y.output(`
@@ -261,21 +261,21 @@ ${et("Scorecard")}:`);for(let e of t)y.output(`
261
261
  ${et(`${Ur(r)} URL`)}: ${de(e||"No URL yet.")}
262
262
  `;case"failed":return`${Ne(`\u274C ${Ur(r)} deploy fail.`)}
263
263
  ${et(`${Ur(r)} URL`)}: ${de(e||"No URL yet.")}`;default:{let o=`${ee(`No status yet for ${r} deploy`)}`;return n?o:`Status: ${o}
264
- `}}}import*as ar from"node:fs";import*as Ut from"node:path";async function qu({argv:t,config:e}){let r=performance.now(),n=Date.now(),{organization:o,project:s,"mount-path":i,verbose:a}=t,c=t.domain||fn();if(!c)return W("No domain provided, please use --domain option or environment variable REDOCLY_AUTHORIZATION.");try{let{"commit-sha":p,"commit-url":u,"default-branch":l,"wait-for-deployment":d,"max-execution-time":m}=t,w=rb(t.author),h=Hn(),x=nb(t.files),P="push";if(!x.length)return He(P,r,"No files to upload");let C=new hn({domain:c,apiKey:h,command:P}),A=await C.remotes.getDefaultBranch(o,s),E=await C.remotes.upsert(o,s,{mountBranchName:A,mountPath:i});y.info(`Uploading to ${E.mountPath} ${x.length} ${Ie("file",x.length)}:
265
- `);let{id:$}=await C.remotes.push(o,s,{remoteId:E.id,commit:{message:t.message,branchName:t.branch,sha:p,url:u,createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:w},isMainBranch:l===t.branch},x.map(_=>({path:Me(_.name),stream:ar.createReadStream(_.path)})));return x.forEach(_=>{y.info(pe(`\u2713 ${_.name}
264
+ `}}}import*as ar from"node:fs";import*as Ut from"node:path";async function qu({argv:t,config:e}){let r=performance.now(),n=Date.now(),{organization:o,project:s,"mount-path":i,verbose:a}=t,c=t.domain||fn();if(!c)return W("No domain provided, please use --domain option or environment variable REDOCLY_AUTHORIZATION.");try{let{"commit-sha":p,"commit-url":u,"default-branch":l,"wait-for-deployment":d,"max-execution-time":m}=t,w=rb(t.author),h=Hn(),C=nb(t.files),P="push";if(!C.length)return He(P,r,"No files to upload");let A=new hn({domain:c,apiKey:h,command:P}),x=await A.remotes.getDefaultBranch(o,s),E=await A.remotes.upsert(o,s,{mountBranchName:x,mountPath:i});y.info(`Uploading to ${E.mountPath} ${C.length} ${Ie("file",C.length)}:
265
+ `);let{id:$}=await A.remotes.push(o,s,{remoteId:E.id,commit:{message:t.message,branchName:t.branch,sha:p,url:u,createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:w},isMainBranch:l===t.branch},C.map(_=>({path:Me(_.name),stream:ar.createReadStream(_.path)})));return C.forEach(_=>{y.info(pe(`\u2713 ${_.name}
266
266
  `))}),y.info(`
267
267
  `),y.info(`Push ID: ${$}
268
268
  `),d&&(y.info(`
269
- `),await lo({argv:{organization:o,project:s,pushId:$,wait:!0,domain:c,"max-execution-time":m,"start-time":n,"continue-on-deploy-failures":t["continue-on-deploy-failures"]},config:e,version:tt})),a&&He(P,r,`${Ie("file",x.length)} uploaded to organization ${o}, project ${s}. Push ID: ${$}.`),C.reportSunsetWarnings(),{pushId:$}}catch(p){co("\u2717 File upload failed.",p)}}function rb(t){if(!/^.+\s<[^<>]+>$/.test(t))throw new Error('Invalid author format. Use "Author Name <author@email.com>"');let[r,n]=t.split("<");return{name:r.trim(),email:n.replace(">","").trim()}}function nb(t){let e={};for(let n of t)if(ar.statSync(n).isDirectory()){let o=n;Wu(o,[]).forEach(i=>r(i,o))}else r(n,Ut.dirname(n));function r(n,o){let s=Ut.relative(o,n);e[s]&&y.warn(`File ${e[s]} is overwritten by ${n}
269
+ `),await lo({argv:{organization:o,project:s,pushId:$,wait:!0,domain:c,"max-execution-time":m,"start-time":n,"continue-on-deploy-failures":t["continue-on-deploy-failures"]},config:e,version:tt})),a&&He(P,r,`${Ie("file",C.length)} uploaded to organization ${o}, project ${s}. Push ID: ${$}.`),A.reportSunsetWarnings(),{pushId:$}}catch(p){co("\u2717 File upload failed.",p)}}function rb(t){if(!/^.+\s<[^<>]+>$/.test(t))throw new Error('Invalid author format. Use "Author Name <author@email.com>"');let[r,n]=t.split("<");return{name:r.trim(),email:n.replace(">","").trim()}}function nb(t){let e={};for(let n of t)if(ar.statSync(n).isDirectory()){let o=n;Wu(o,[]).forEach(i=>r(i,o))}else r(n,Ut.dirname(n));function r(n,o){let s=Ut.relative(o,n);e[s]&&y.warn(`File ${e[s]} is overwritten by ${n}
270
270
  `),e[s]=n}return Object.entries(e).map(([n,o])=>ob(n,o))}function ob(t,e){return{name:t,path:Ut.resolve(e)}}function Wu(t,e){let r=ar.readdirSync(t);for(let n of r){let o=Ut.join(t,n);ar.statSync(o).isDirectory()?e=Wu(o,e):e.push(o)}return e}var zu=Pt(ko(),1);import{existsSync as sb,writeFileSync as ib,readFileSync as ab,statSync as cb}from"node:fs";import{tmpdir as Ls}from"node:os";import{join as Ms}from"node:path";import*as sn from"node:process";var Fs="redocly-cli-version",po=4,lb=1e3*60*60*12,Vu=sn.env.NODE_ENV==="test"||sn.env.CI||!!sn.env.LAMBDA_TASK_ROOT||sn.env.REDOCLY_SUPPRESS_UPDATE_NOTICE==="true",Bu=()=>{if(!Vu)try{let t=ab(Ms(Ls(),Fs)).toString();pb(tt,t)&&fb(tt,t)}catch{return}},pb=(t,e)=>(0,zu.compare)(t,e)<0,ub=async t=>{let e=`http://registry.npmjs.org/${t}/latest`;try{return(await(await dn(e,{timeout:mn})).json()).version}catch{return}},Gu=()=>{!db()||Vu||ub(si).then(t=>{if(t){let e=Ms(Ls(),Fs);ib(e,t)}}).catch(()=>{})},fb=(t,e)=>{let r=[`A new version of ${de("Redocly CLI")} (${pe(e)}) is available.`,`Update now: \`${de("npm i -g @redocly/cli@latest")}\`.`,"Changelog: https://redocly.com/docs/cli/changelog/"],n=Math.max(...r.map(a=>bo(a).length)),o=ee("\u2550".repeat(n+po)),s=" ".repeat(po),i=["",s+ee("\u2554"+o+"\u2557"),s+ee("\u2551"+" ".repeat(n+po)+"\u2551"),r.map(mb(n,s)).join(`
271
271
  `),s+ee("\u2551"+" ".repeat(n+po)+"\u2551"),s+ee("\u255A"+o+"\u255D"),"",""].join(`
272
- `);y.info(i)},mb=(t,e)=>r=>{let n=" ".repeat(t-bo(r).length);return`${e}${ee("\u2551")} ${r}${n} ${ee("\u2551")}`},db=()=>{try{let t=Ms(Ls(),Fs);if(!sb(t))return!0;let e=new Date().getTime(),n=cb(t).mtime.getTime();return e-n>=lb}catch{return!1}};function Hu(t){if(!t||t==="/")throw new Error("Mount path cannot be empty or root path. Please use --mount-path option with a valid path.");return t}function Tr(t,e=!1){return r=>{let n=Number(r);if(isNaN(n)||n<=0)throw new Error(`${t} must be a positive number`);if(e&&!Number.isInteger(n))throw new Error(`${t} must be a positive integer`);return n}}import{execSync as hb}from"node:child_process";import*as Dr from"node:fs";import{existsSync as gb,writeFileSync as yb,readFileSync as bb}from"node:fs";import*as Ku from"node:os";import{tmpdir as Ju}from"node:os";import{join as Xu}from"node:path";async function Yu(t=mn){try{return await dn(ai,{timeout:t}),!0}catch{return!1}}var uo="***";async function Zu({config:t,argv:e,exit_code:r,execution_time:n,spec_version:o,spec_keyword:s,spec_full_version:i,respect_x_security_auth_types:a,respect_source_description_types:c,respect_criterion_object_types:p}){try{if(!e||!await Yu(1e3))return;let{_:[l],$0:d,...m}=e,{RedoclyOAuthClient:w}=await import("./chunks/H5AKFBMX.js"),h=new w,x=ur(t,m.residency),P=await h.isAuthorized(x),C=xb();C||(C=`ann_${vi()}`,Cb(C));let A=lr(o),E=[{id:l,object:"command",uri:`urn:redocly:cli:command:${l}`,logged_in:P?"yes":"no",command:l,...Ob(m,process.argv.slice(2)),node_version:process.version,npm_version:hb("npm -v").toString().replace(`
273
- `,""),version:tt,exit_code:r,execution_time:n,metadata:process.env.REDOCLY_CLI_TELEMETRY_METADATA,environment_ci:process.env.CI,environment:process.env.REDOCLY_ENVIRONMENT,has_config:typeof t?.document?.parsed>"u"?"no":"yes",spec_version:o,spec_keyword:s,spec_full_version:i,respect_x_security_auth_types:A==="arazzo1"&&a?.length?JSON.stringify(a):void 0,respect_source_description_types:A==="arazzo1"&&c?.length?JSON.stringify(c):void 0,respect_criterion_object_types:A==="arazzo1"&&p?.length?JSON.stringify(p):void 0}],$=Ai.mapToCloudEvent({type:"com.redocly.command.ran",source:"urn:redocly:cli",origin:"redocly-cli",env:"production",osPlatform:Ku.platform(),actor:{id:C,object:"user",uri:""},category:"product",data:E}),{otelTelemetry:_}=await import("./chunks/2H43OFX2.js");_.send($)}catch{}}function Qu(t,e){for(let r of t.sourceDescriptions??[])r.type&&e.add(r.type)}function ef(t,e){for(let r of t.workflows??[]){jr(r.successActions,e),jr(r.failureActions,e);for(let n of r.steps??[])tf(n.successCriteria,e),jr(n.onSuccess,e),jr(n.onFailure,e)}jr(Object.values(t.components?.successActions??{}),e),jr(Object.values(t.components?.failureActions??{}),e)}function jr(t,e){for(let r of t??[])tf(r.criteria,e)}function tf(t,e){for(let r of t??[]){let n=Sb(r);n&&e.add(n)}}function Sb(t){let e=t.type;return typeof e=="string"?e:e?.type||(t.condition?"simple":void 0)}function rf(t,e){for(let r of t.workflows??[]){for(let n of r["x-security"]??[]){let o=n.scheme;if(o?.type){let s=o.type==="http"?o.scheme:o.type;s&&e.add(s)}}for(let n of r.steps??[])for(let o of n["x-security"]??[]){let s=o.scheme;if(s?.type){let a=s.type==="http"?s.scheme:s.type;a&&e.add(a)}let i=o.schemeName;i&&e.add(i)}}}function wb(t){return Dr.existsSync(t)&&Dr.statSync(t).isFile()}function Eb(t){return Dr.existsSync(t)&&Dr.statSync(t).isDirectory()}function ks(t){return t&&(Ys(t)?t.split("://")[0]+"://url":wb(t)?t.replace(/.+\.([^.]+)$/,(e,r)=>"file-"+r):Eb(t)?"folder":t)}function Us(t,e,r){let n=Array.isArray(e)?e:[e];for(let o of n)t=t.replaceAll(o,r);return t}function nf(t,e){let r={};for(let[n,o]of Object.entries(t))e.includes(n)?r[n]=uo:re(o)?r[n]=nf(o,e):r[n]=o;return r}function qs(t,e,r=[]){if(Array.isArray(t))return t.forEach(n=>qs(n,e,r)),r;if(re(t))for(let[n,o]of Object.entries(t))e.includes(n)&&typeof o=="string"?r.push(o):(re(o)||Array.isArray(o))&&qs(o,e,r);return r}function Ob(t,e){let r=["organization","o","input","i","clientCert","clientKey","caCert","server","S"],n=e.join(" "),o={};for(let[s,i]of Object.entries(t))if(r.includes(s))o[s]=uo,n=Us(n,i,uo);else if(typeof i=="string"){let a=ks(i);o[s]=a,n=Us(n,i,a)}else if(Array.isArray(i)){o[s]=i.map(ks);for(let a of i){let c=ks(a);n.includes(a)&&(n=n.replaceAll(a,c))}}else if(re(i)){let a=qs(i,r);for(let c of a)n=Us(n,c,uo);o[s]=nf(i,r)}else o[s]=i;return{arguments:JSON.stringify(o),raw_input:n}}var Cb=t=>{if(!(process.env.CI||!t))try{let r=Xu(Ju(),ho);yb(r,t)}catch{}},xb=()=>{if(!process.env.CI)try{let e=Xu(Ju(),ho);return gb(e)?bb(e).toString().trim():void 0}catch{return}};function ge(t){return async e=>{let r=performance.now(),n=2,o,s="unknown",i,a,c,p=new Set,u=new Set,l=new Set,d=({parsed:m,source:w})=>{if(s="unknown",i=void 0,a=void 0,w?.absoluteRef&&ti(w.absoluteRef)){s="graphql";return}try{s=ut(m)}catch{s="unsupported"}re(m)&&(i=m?.openapi?"openapi":m?.swagger?"swagger":m?.asyncapi?"asyncapi":m?.arazzo?"arazzo":m?.overlay?"overlay":void 0,i&&(a=m[i]),lr(s)==="arazzo1"&&(rf(m,p),Qu(m,u),ef(m,l)))};try{e.config&&!Ws(e.config)&&W("Please provide a valid path to the configuration file."),c=await wi(e,tt),o=c.resolvedConfig.telemetry,n=1,typeof t=="function"&&await t({argv:e,config:c,version:tt,collectSpecData:d}),n=0}catch(m){m instanceof qt||(m instanceof Ve?y.error(m.message+`
272
+ `);y.info(i)},mb=(t,e)=>r=>{let n=" ".repeat(t-bo(r).length);return`${e}${ee("\u2551")} ${r}${n} ${ee("\u2551")}`},db=()=>{try{let t=Ms(Ls(),Fs);if(!sb(t))return!0;let e=new Date().getTime(),n=cb(t).mtime.getTime();return e-n>=lb}catch{return!1}};function Hu(t){if(!t||t==="/")throw new Error("Mount path cannot be empty or root path. Please use --mount-path option with a valid path.");return t}function Tr(t,e=!1){return r=>{let n=Number(r);if(isNaN(n)||n<=0)throw new Error(`${t} must be a positive number`);if(e&&!Number.isInteger(n))throw new Error(`${t} must be a positive integer`);return n}}import{execSync as hb}from"node:child_process";import*as Dr from"node:fs";import{existsSync as gb,writeFileSync as yb,readFileSync as bb}from"node:fs";import*as Ku from"node:os";import{tmpdir as Ju}from"node:os";import{join as Xu}from"node:path";async function Yu(t=mn){try{return await dn(ai,{timeout:t}),!0}catch{return!1}}var uo="***";async function Zu({config:t,argv:e,exit_code:r,execution_time:n,spec_version:o,spec_keyword:s,spec_full_version:i,respect_x_security_auth_types:a,respect_source_description_types:c,respect_criterion_object_types:p}){try{if(!e||!await Yu(1e3))return;let{_:[l],$0:d,...m}=e,{RedoclyOAuthClient:w}=await import("./chunks/2Q5SN6X4.js"),h=new w,C=ur(t,m.residency),P=await h.isAuthorized(C),A=Cb();A||(A=`ann_${vi()}`,Ab(A));let x=lr(o),E=[{id:l,object:"command",uri:`urn:redocly:cli:command:${l}`,logged_in:P?"yes":"no",command:l,...Ob(m,process.argv.slice(2)),node_version:process.version,npm_version:hb("npm -v").toString().replace(`
273
+ `,""),version:tt,exit_code:r,execution_time:n,metadata:process.env.REDOCLY_CLI_TELEMETRY_METADATA,environment_ci:process.env.CI,environment:process.env.REDOCLY_ENVIRONMENT,has_config:typeof t?.document?.parsed>"u"?"no":"yes",spec_version:o,spec_keyword:s,spec_full_version:i,respect_x_security_auth_types:x==="arazzo1"&&a?.length?JSON.stringify(a):void 0,respect_source_description_types:x==="arazzo1"&&c?.length?JSON.stringify(c):void 0,respect_criterion_object_types:x==="arazzo1"&&p?.length?JSON.stringify(p):void 0}],$=xi.mapToCloudEvent({type:"com.redocly.command.ran",source:"urn:redocly:cli",origin:"redocly-cli",env:"production",osPlatform:Ku.platform(),actor:{id:A,object:"user",uri:""},category:"product",data:E}),{otelTelemetry:_}=await import("./chunks/WWPXYCJE.js");_.send($)}catch{}}function Qu(t,e){for(let r of t.sourceDescriptions??[])r.type&&e.add(r.type)}function ef(t,e){for(let r of t.workflows??[]){jr(r.successActions,e),jr(r.failureActions,e);for(let n of r.steps??[])tf(n.successCriteria,e),jr(n.onSuccess,e),jr(n.onFailure,e)}jr(Object.values(t.components?.successActions??{}),e),jr(Object.values(t.components?.failureActions??{}),e)}function jr(t,e){for(let r of t??[])tf(r.criteria,e)}function tf(t,e){for(let r of t??[]){let n=Sb(r);n&&e.add(n)}}function Sb(t){let e=t.type;return typeof e=="string"?e:e?.type||(t.condition?"simple":void 0)}function rf(t,e){for(let r of t.workflows??[]){for(let n of r["x-security"]??[]){let o=n.scheme;if(o?.type){let s=o.type==="http"?o.scheme:o.type;s&&e.add(s)}}for(let n of r.steps??[])for(let o of n["x-security"]??[]){let s=o.scheme;if(s?.type){let a=s.type==="http"?s.scheme:s.type;a&&e.add(a)}let i=o.schemeName;i&&e.add(i)}}}function wb(t){return Dr.existsSync(t)&&Dr.statSync(t).isFile()}function Eb(t){return Dr.existsSync(t)&&Dr.statSync(t).isDirectory()}function ks(t){return t&&(Ys(t)?t.split("://")[0]+"://url":wb(t)?t.replace(/.+\.([^.]+)$/,(e,r)=>"file-"+r):Eb(t)?"folder":t)}function Us(t,e,r){let n=Array.isArray(e)?e:[e];for(let o of n)t=t.replaceAll(o,r);return t}function nf(t,e){let r={};for(let[n,o]of Object.entries(t))e.includes(n)?r[n]=uo:re(o)?r[n]=nf(o,e):r[n]=o;return r}function qs(t,e,r=[]){if(Array.isArray(t))return t.forEach(n=>qs(n,e,r)),r;if(re(t))for(let[n,o]of Object.entries(t))e.includes(n)&&typeof o=="string"?r.push(o):(re(o)||Array.isArray(o))&&qs(o,e,r);return r}function Ob(t,e){let r=["organization","o","input","i","clientCert","clientKey","caCert","server","S"],n=e.join(" "),o={};for(let[s,i]of Object.entries(t))if(r.includes(s))o[s]=uo,n=Us(n,i,uo);else if(typeof i=="string"){let a=ks(i);o[s]=a,n=Us(n,i,a)}else if(Array.isArray(i)){o[s]=i.map(ks);for(let a of i){let c=ks(a);n.includes(a)&&(n=n.replaceAll(a,c))}}else if(re(i)){let a=qs(i,r);for(let c of a)n=Us(n,c,uo);o[s]=nf(i,r)}else o[s]=i;return{arguments:JSON.stringify(o),raw_input:n}}var Ab=t=>{if(!(process.env.CI||!t))try{let r=Xu(Ju(),ho);yb(r,t)}catch{}},Cb=()=>{if(!process.env.CI)try{let e=Xu(Ju(),ho);return gb(e)?bb(e).toString().trim():void 0}catch{return}};function ge(t){return async e=>{let r=performance.now(),n=2,o,s="unknown",i,a,c,p=new Set,u=new Set,l=new Set,d=({parsed:m,source:w})=>{if(s="unknown",i=void 0,a=void 0,w?.absoluteRef&&ti(w.absoluteRef)){s="graphql";return}try{s=ut(m)}catch{s="unsupported"}re(m)&&(i=m?.openapi?"openapi":m?.swagger?"swagger":m?.asyncapi?"asyncapi":m?.arazzo?"arazzo":m?.overlay?"overlay":void 0,i&&(a=m[i]),lr(s)==="arazzo1"&&(rf(m,p),Qu(m,u),ef(m,l)))};try{e.config&&!Ws(e.config)&&W("Please provide a valid path to the configuration file."),c=await wi(e,tt),o=c.resolvedConfig.telemetry,n=1,typeof t=="function"&&await t({argv:e,config:c,version:tt,collectSpecData:d}),n=0}catch(m){m instanceof qt||(m instanceof Ve?y.error(m.message+`
274
274
 
275
275
  `):(y.error(`An unexpected error occurred. This is likely a bug that should be reported.
276
276
  `),y.error(m instanceof Error?m.stack||m.message:String(m)),y.error(`
277
277
  `)))}finally{if(process.env.REDOCLY_TELEMETRY!=="off"&&o!=="off"){let m=Math.round(performance.now()-r);await Zu({config:c,argv:e,exit_code:n,execution_time:m,spec_version:s,spec_keyword:i,spec_full_version:a,respect_x_security_auth_types:[...p],respect_source_description_types:[...u],respect_criterion_object_types:[...l]})}process.once("beforeExit",()=>{process.exit(n)})}}}of.config({path:sf.resolve(process.cwd(),"./.env")});Gu();Sl(Jo(process.argv)).version("version","Show version number.",tt).help("help","Show help.").parserConfiguration({"greedy-arrays":!1,"boolean-negation":!1}).command("stats [api]","Show statistics for an API description.",t=>t.env("REDOCLY_CLI_STATS").positional("api",{type:"string"}).option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},format:{description:"Use a specific output format.",choices:["stylish","json","markdown"],default:"stylish"}}),t=>{ge(Mu)(t)}).command("score [api]","Score an API description for integration simplicity and agent readiness.",t=>t.env("REDOCLY_CLI_SCORE").positional("api",{type:"string"}).option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},format:{description:"Use a specific output format.",choices:["stylish","json"],default:"stylish"},"operation-details":{description:"Print per-operation metric details.",type:"boolean",default:!1},"debug-operation-id":{description:"Print detailed schema breakdown for a specific operation.",type:"string"}}),t=>{ge(Vp)(t)}).command("split [api]","Split an API description into a multi-file structure.",t=>t.env("REDOCLY_CLI_SPLIT").positional("api",{description:"API description file that you want to split",type:"string"}).option({outDir:{description:"Output directory where files will be saved.",required:!0,type:"string"},separator:{description:"File path separator used while splitting.",required:!1,type:"string",default:"_"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}).demandOption("api"),t=>{ge(_u)(t)}).command("join [apis...]","Join multiple API descriptions into one [experimental].",t=>t.env("REDOCLY_CLI_JOIN").positional("apis",{array:!0,type:"string",demandOption:!0}).option({"prefix-tags-with-info-prop":{description:"Prefix tags with property value from info object.",requiresArg:!0,type:"string"},"prefix-tags-with-filename":{description:"Prefix tags with property value from file name.",type:"boolean",default:!1},"prefix-components-with-info-prop":{description:"Prefix components with property value from info object.",requiresArg:!0,type:"string"},"without-x-tag-groups":{description:"Skip automated x-tagGroups creation",type:"boolean"},output:{description:"Output file.",alias:"o",type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(Hl)(t)}).command("push-status [pushId]",!1,t=>t.env("REDOCLY_CLI_PUSH_STATUS").positional("pushId",{description:"Push id.",type:"string",demandOption:!0}).implies("max-execution-time","wait").option({organization:{description:"Name of the organization to push to.",type:"string",alias:"o",required:!0},project:{description:"Name of the project to push to.",type:"string",required:!0,alias:"p"},domain:{description:"Specify a domain.",alias:"d",type:"string",required:!1},wait:{description:"Wait for build to finish.",type:"boolean",default:!1},"max-execution-time":{description:"Maximum execution time in seconds.",type:"number"},"continue-on-deploy-failures":{description:"Command does not fail even if the deployment fails.",type:"boolean",default:!1},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(lo)(t)}).command("push [files...]","Push documents to Reunite.",t=>t.env("REDOCLY_CLI_PUSH").positional("files",{type:"string",array:!0,demandOption:!0}).option({branch:{description:"Branch name to push to.",type:"string",alias:"b",required:!0},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},organization:{description:"Name of the organization to push to.",type:"string",alias:"o",required:!0},project:{description:"Name of the project to push to.",type:"string",alias:"p",required:!0},"mount-path":{description:"The path files should be pushed to.",type:"string",alias:"mp",required:!0,coerce:Hu},author:{description:"Author of the commit.",type:"string",alias:"a",required:!0},message:{description:"Commit message.",type:"string",alias:"m",required:!0},"commit-sha":{description:"Commit SHA.",type:"string",alias:"sha"},"commit-url":{description:"Commit URL.",type:"string",alias:"url"},namespace:{description:"Repository namespace.",type:"string"},repository:{description:"Repository name.",type:"string"},"created-at":{description:"Commit creation date.",type:"string"},domain:{description:"Specify a domain.",alias:"d",type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"default-branch":{type:"string",default:"main"},"max-execution-time":{description:"Maximum execution time in seconds.",type:"number"},"wait-for-deployment":{description:"Wait for build to finish.",type:"boolean",default:!1},verbose:{type:"boolean",default:!1},"continue-on-deploy-failures":{description:"Command does not fail even if the deployment fails.",type:"boolean",default:!1}}),t=>{ge(qu)(t)}).command("lint [apis...]","Lint an API or Arazzo description.",t=>t.env("REDOCLY_CLI_LINT").positional("apis",{array:!0,type:"string",demandOption:!0}).option({format:{description:"Use a specific output format.",choices:["stylish","codeframe","json","checkstyle","codeclimate","summary","markdown","github-actions","junit"],default:"codeframe"},"max-problems":{requiresArg:!0,description:"Reduce output to a maximum of N problems.",type:"number",default:100},"generate-ignore-file":{description:"Generate an ignore file.",type:"boolean"},"skip-rule":{description:"Ignore certain rules.",array:!0,type:"string"},"skip-preprocessor":{description:"Ignore certain preprocessors.",array:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},extends:{description:"Override extends configurations (defaults or config file settings).",requiresArg:!0,array:!0,type:"string"}}),t=>{ge(ui)(t)}).command("bundle [apis...]","Bundle a multi-file API description to a single file.",t=>t.env("REDOCLY_CLI_BUNDLE").positional("apis",{array:!0,type:"string",demandOption:!0}).options({output:{type:"string",description:"Output file or folder for inline APIs.",alias:"o"},ext:{description:"Bundle file extension.",requiresArg:!0,choices:fi},"skip-preprocessor":{description:"Ignore certain preprocessors.",array:!0,type:"string"},"skip-decorator":{description:"Ignore certain decorators.",array:!0,type:"string"},dereferenced:{alias:"d",type:"boolean",description:"Produce a fully dereferenced bundle."},force:{alias:"f",type:"boolean",description:"Produce bundle output even when errors occur."},config:{description:"Path to the config file.",type:"string"},metafile:{description:"Produce metadata about the bundle",type:"string"},extends:{description:"Override extends configurations (defaults or config file settings).",requiresArg:!0,array:!0,type:"string",hidden:!0},"remove-unused-components":{description:"Remove unused components.",type:"boolean",default:!1},"keep-url-references":{description:"Keep absolute url references.",type:"boolean",alias:"k"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},"component-renaming-conflicts-severity":{description:"Whether to show warnings or fail on renaming conflicts (defaults to warn).",choices:["warn","error","off"]},"component-names-strategy":{description:"How to name inlined Schema components: 'basename' (default) or 'title' (from each schema's `title`).",choices:["basename","title"],default:"basename"}}).check(e=>{if(e.output&&(!e.apis||e.apis.length===0))throw new Error("At least one inline API must be specified when using --output.");return!0}),t=>{ge(Ol)(t)}).command("check-config","Lint the Redocly configuration file.",async t=>t.env("REDOCLY_CLI_CHECK_CONFIG").option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error"],default:"error"}}),t=>{ge()(t)}).command("login","Log in to Redocly.",async t=>t.env("REDOCLY_CLI_LOGIN").options({residency:{description:"Residency of the application. Defaults to `us`.",alias:["r"],type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"}}),t=>{ge(wl)(t)}).command("logout","Clear your stored credentials.",t=>t,t=>{ge(El)(t)}).command("preview","Preview Redocly project using one of the product NPM packages.",t=>t.env("REDOCLY_CLI_PREVIEW").options({product:{type:"string",choices:["redoc","revel","reef","realm","redoc-revel","redoc-reef","revel-reef"],description:"Product used to launch preview. Default is inferred from project's package.json or 'realm' is used."},plan:{type:"string",choices:Yl,default:"enterprise"},port:{alias:"p",type:"number",description:"Preview port.",default:4e3,coerce:Tr("port",!0)},"project-dir":{alias:["d","source-dir"],type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{process.argv.some(e=>e.startsWith("--source-dir"))&&y.error(`Option --source-dir is deprecated and will be removed soon. Use --project-dir instead.
278
- `),ge(Kl)(t)}).command("build-docs [api]","Produce API documentation as an HTML file",t=>t.positional("api",{type:"string"}).options({o:{describe:"Output destination file.",alias:"output",type:"string",default:"redoc-static.html"},title:{describe:"Page title.",type:"string"},disableGoogleFont:{describe:"Disable Google fonts.",type:"boolean",default:!1},t:{alias:"template",describe:"Path to handlebars page template, see https://github.com/Redocly/redocly-cli/blob/main/packages/cli/src/commands/build-docs/template.hbs for the example.",type:"string"},templateOptions:{describe:"Additional options to pass to the template. Use dot notation, e.g. templateOptions.metaDescription"},theme:{describe:"Redoc theme.openapi configuration. Use dot notation, e.g. theme.openapi.nativeScrollbars"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}).check(e=>{if(e.theme&&!e.theme?.openapi)throw new Error("Invalid option: theme.openapi not set.");return!0}),async t=>{let{handlerBuildCommand:e}=await import("./chunks/BFESXNQW.js");ge(e)(t)}).command("translate <locale>","Creates or updates translations.yaml files and fills them with missing built-in translations and translations from the redocly.yaml and sidebars.yaml files.",t=>t.env("REDOCLY_CLI_TRANSLATE").positional("locale",{description:"Locale code to generate translations for, or `all` for all current project locales.",type:"string",demandOption:!0}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(Fu)(t)}).command("eject <type> [path]","Helper function to eject project elements for customization.",t=>t.env("REDOCLY_CLI_EJECT").positional("type",{description:"Specifies what type of project element to eject. Currently this value must be `component`.",demandOption:!0,choices:["component"]}).positional("path",{description:"Filepath to a component or filepath with glob pattern.",type:"string"}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},force:{alias:"f",type:"boolean",description:'Skips the "overwrite existing" confirmation when ejecting a component that is already ejected in the destination.'},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(Al)(t)}).command("respect [files...]","Run Arazzo tests.",t=>t.env("REDOCLY_CLI_RESPECT").positional("files",{describe:"Test files or glob pattern.",type:"string",array:!0,default:[]}).options({input:{alias:"i",describe:"Input parameters.",type:"string"},server:{alias:"S",describe:"Server parameters.",type:"string"},workflow:{alias:"w",describe:"Workflow name.",type:"string",array:!0},skip:{alias:"s",describe:"Workflow to skip.",type:"string",array:!0},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"},"har-output":{describe:"Har file output name.",type:"string",alias:"H"},"json-output":{describe:"JSON file output name.",type:"string",alias:"J"},mtls:{describe:'Per-domain mutual TLS certificates configuration as JSON. Format: {"<domain>": {"clientCert": "<path>", "clientKey": "<path>", "caCert": "<path>"}}',type:"string",array:!0,coerce:wp},severity:{describe:"Severity of the check.",type:"string"},"max-steps":{describe:"Maximum number of steps to run (default: 2000).",type:"number",default:2e3,coerce:Tr("max-steps",!0)},"max-fetch-timeout":{describe:"Maximum time to wait for API response per request in milliseconds (default: 40 seconds).",type:"number",default:4e4,coerce:Tr("max-fetch-timeout",!1)},"execution-timeout":{describe:"Maximum time to wait for the Respect execution in milliseconds (default: 1 hour).",type:"number",default:36e5,coerce:Tr("execution-timeout",!1)},"no-secrets-masking":{describe:"Do not mask secrets in the output.",type:"boolean",default:!1}}),async t=>{ge(bp)(t)}).command("generate-arazzo <descriptionPath>","Auto-generate arazzo description file from an API description.",t=>t.env("REDOCLY_CLI_GENERATE_ARAZZO").positional("descriptionPath",{describe:"Description file path.",type:"string"}).options({"output-file":{alias:"o",describe:"Output File name.",type:"string",requiresArg:!0}}),async t=>{ge(vl)(t)}).command("generate-client [api]","Generate a TypeScript client from an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_CLIENT").positional("api",{describe:"OpenAPI description file path (or alias from redocly.yaml `apis:`).",type:"string"}).options({output:{alias:"o",describe:"Output file path for the generated client (must end in .ts).",type:"string",requiresArg:!0},"server-url":{describe:"Override the server URL inlined into the generated runtime. Defaults to `servers[0].url`.",type:"string",requiresArg:!0},"output-mode":{describe:"How the client is split across files: `single` (default, one file) or `split` (schema types and guards in a sibling `<name>.schemas.ts` the entry re-exports).",choices:["single","split"],requiresArg:!0},runtime:{describe:"Runtime distribution: 'inline' (default) embeds the runtime in the generated file; 'package' imports it from @redocly/client-generator.",choices:["inline","package"],requiresArg:!0},"import-ext":{describe:"Extension in generated relative imports: 'js' (default) suits tsc and bundlers; 'ts' suits runtimes that resolve specifiers literally, like Node's built-in type stripping (node client.ts).",choices:["js","ts"],requiresArg:!0},setup:{describe:"Path to a publisher setup module (a file default-exporting { config, middleware }) that gets included into the generated client \u2014 pre-configure defaults such as the server URL, retries, headers, and middleware, so a published SDK ships with them built in. Works across all output modes.",type:"string",requiresArg:!0},"args-style":{describe:"How operation inputs are passed: `flat` (default) spreads path params as positional arguments followed by `params`/`body`/`headers`; `grouped` bundles every input into a single `args` object (the per-call request `init` stays a separate trailing argument).",choices:["flat","grouped"],requiresArg:!0},"error-mode":{describe:"Error handling: 'throw' (default) throws ApiError on non-2xx; 'result' returns { data, error, response }.",choices:["throw","result"],requiresArg:!0},"date-type":{describe:"How `date-time`/`date` string fields are typed: 'string' (default) keeps the ISO wire shape; 'Date' emits a `Date` (pair with --generator transformers so the runtime value matches).",choices:["string","Date"],requiresArg:!0},"mock-data":{describe:"How the `mock` generator produces data: 'static' (default) inlines deterministic literals (zero-dep); 'faker' emits @faker-js/faker calls for realistic data (install @faker-js/faker as a dev dependency).",choices:["static","faker"],requiresArg:!0},"mock-seed":{describe:"Seed for faker-mode mocks: emits a top-level `faker.seed(<n>)` so generated data is reproducible across runs. Ignored in static mode.",type:"number",requiresArg:!0},generator:{describe:"Generator to run; repeat the flag to run several (default: sdk). A built-in name (sdk, zod, tanstack-query, swr, transformers, mock) or a custom-generator path/package specifier. Example: --generator sdk --generator zod",type:"string",array:!0,requiresArg:!0},config:{describe:"Path to the config file.",type:"string",requiresArg:!0}}),async t=>{ge(Rl)(t)}).command("generate-spec <traffic>","Infer an OpenAPI description from recorded HTTP traffic, optionally refined with AI [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_SPEC").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({type:{describe:"Target API description type.",choices:["openapi"],default:"openapi"},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, the rest of their URL becomes the API path, and it becomes the servers URL of the generated description.",type:"string"},title:{describe:"Title for the generated API description.",type:"string"},"with-ai":{describe:"Refine the inferred description with an AI provider to narrow the hypothesis.",type:"boolean",default:!1},"ai-provider":{describe:'AI provider used with --with-ai; runs the "claude", "codex", or "cursor" CLI in non-interactive mode.',choices:["claude","codex","cursor"],default:"claude"},"ai-model":{describe:"Model passed to the selected AI provider (provider-specific default applies).",type:"string"},"ai-concurrency":{describe:"Number of operations refined in parallel with --with-ai.",type:"number",default:4,coerce:Tr("ai-concurrency",!0)},output:{alias:"o",describe:"Write the generated description to this file instead of stdout.",type:"string"},config:{describe:"Path to the config file.",type:"string"}}),async t=>{let{handleGenerateSpec:e}=await import("./chunks/CHEI2COC.js");ge(e)(t)}).command("scorecard-classic [api]","Run quality scorecards with multiple rule levels to validate and maintain API description standards.",t=>t.positional("api",{type:"string"}).option({config:{describe:"Path to the config file.",type:"string"},"project-url":{describe:"URL to the project scorecard configuration.",type:"string"},format:{description:"Use a specific output format.",choices:["stylish","json","checkstyle","junit"],default:"stylish"},"target-level":{describe:"Target level for the scorecard.",type:"string"},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"}}),async t=>{ge(ru)(t)}).command("drift <traffic>","Detect drift between recorded HTTP traffic and an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_DRIFT").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({api:{describe:"OpenAPI description file or folder to validate against.",type:"string",demandOption:!0},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},"report-format":{describe:"Output format.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode (how requests are located via the description servers). Mutually exclusive with --server.",choices:["strict-host","basepath"],defaultDescription:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks (useful for logs exported without cookies).",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},"min-severity":{describe:"Discard findings below this severity from the report.",choices:["info","warning","error"],default:"info"},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},output:{alias:"o",describe:"Write the drift report (in the format selected with --format) to this file instead of stdout.",type:"string"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, and the rest of their URL is treated as the API path. It replaces the description servers and the remaining path is matched against the description paths directly. Mutually exclusive with --match-mode.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleDrift:e}=await import("./chunks/7COMRSUB.js");ge(e)(t)}).command("proxy","Capture live HTTP traffic through a reverse proxy into a HAR file, optionally validating it against an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_PROXY").option({target:{describe:"Upstream base URL to forward captured requests to.",type:"string",demandOption:!0},port:{describe:"Port the proxy listens on.",type:"number",default:4040},host:{describe:"Host the proxy binds to.",type:"string",default:"127.0.0.1"},har:{describe:"Path to the HAR file where captured traffic is written.",type:"string",demandOption:!0},api:{describe:"OpenAPI description file or folder to validate captured traffic against (live).",type:"string"},"report-format":{describe:"Output format for the validation report printed on shutdown.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode.",choices:["strict-host","basepath"],default:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks.",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleProxy:e}=await import("./chunks/HRN4XSXF.js");ge(e)(t)}).completion("completion","Generate autocomplete script for `redocly` command.").demandCommand(1).middleware([Bu]).strict().argv;
278
+ `),ge(Kl)(t)}).command("build-docs [api]","Produce API documentation as an HTML file",t=>t.positional("api",{type:"string"}).options({o:{describe:"Output destination file.",alias:"output",type:"string",default:"redoc-static.html"},title:{describe:"Page title.",type:"string"},disableGoogleFont:{describe:"Disable Google fonts.",type:"boolean",default:!1},t:{alias:"template",describe:"Path to handlebars page template, see https://github.com/Redocly/redocly-cli/blob/main/packages/cli/src/commands/build-docs/template.hbs for the example.",type:"string"},templateOptions:{describe:"Additional options to pass to the template. Use dot notation, e.g. templateOptions.metaDescription"},theme:{describe:"Redoc theme.openapi configuration. Use dot notation, e.g. theme.openapi.nativeScrollbars"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}).check(e=>{if(e.theme&&!e.theme?.openapi)throw new Error("Invalid option: theme.openapi not set.");return!0}),async t=>{let{handlerBuildCommand:e}=await import("./chunks/RZY3J6PM.js");ge(e)(t)}).command("translate <locale>","Creates or updates translations.yaml files and fills them with missing built-in translations and translations from the redocly.yaml and sidebars.yaml files.",t=>t.env("REDOCLY_CLI_TRANSLATE").positional("locale",{description:"Locale code to generate translations for, or `all` for all current project locales.",type:"string",demandOption:!0}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(Fu)(t)}).command("eject <type> [path]","Helper function to eject project elements for customization.",t=>t.env("REDOCLY_CLI_EJECT").positional("type",{description:"Specifies what type of project element to eject. Currently this value must be `component`.",demandOption:!0,choices:["component"]}).positional("path",{description:"Filepath to a component or filepath with glob pattern.",type:"string"}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},force:{alias:"f",type:"boolean",description:'Skips the "overwrite existing" confirmation when ejecting a component that is already ejected in the destination.'},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(xl)(t)}).command("respect [files...]","Run Arazzo tests.",t=>t.env("REDOCLY_CLI_RESPECT").positional("files",{describe:"Test files or glob pattern.",type:"string",array:!0,default:[]}).options({input:{alias:"i",describe:"Input parameters.",type:"string"},server:{alias:"S",describe:"Server parameters.",type:"string"},workflow:{alias:"w",describe:"Workflow name.",type:"string",array:!0},skip:{alias:"s",describe:"Workflow to skip.",type:"string",array:!0},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"},"har-output":{describe:"Har file output name.",type:"string",alias:"H"},"json-output":{describe:"JSON file output name.",type:"string",alias:"J"},mtls:{describe:'Per-domain mutual TLS certificates configuration as JSON. Format: {"<domain>": {"clientCert": "<path>", "clientKey": "<path>", "caCert": "<path>"}}',type:"string",array:!0,coerce:wp},severity:{describe:"Severity of the check.",type:"string"},"max-steps":{describe:"Maximum number of steps to run (default: 2000).",type:"number",default:2e3,coerce:Tr("max-steps",!0)},"max-fetch-timeout":{describe:"Maximum time to wait for API response per request in milliseconds (default: 40 seconds).",type:"number",default:4e4,coerce:Tr("max-fetch-timeout",!1)},"execution-timeout":{describe:"Maximum time to wait for the Respect execution in milliseconds (default: 1 hour).",type:"number",default:36e5,coerce:Tr("execution-timeout",!1)},"no-secrets-masking":{describe:"Do not mask secrets in the output.",type:"boolean",default:!1}}),async t=>{ge(bp)(t)}).command("generate-arazzo <descriptionPath>","Auto-generate arazzo description file from an API description.",t=>t.env("REDOCLY_CLI_GENERATE_ARAZZO").positional("descriptionPath",{describe:"Description file path.",type:"string"}).options({"output-file":{alias:"o",describe:"Output File name.",type:"string",requiresArg:!0}}),async t=>{ge(vl)(t)}).command("generate-client [api]","Generate a TypeScript client from an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_CLIENT").positional("api",{describe:"OpenAPI description file path (or alias from redocly.yaml `apis:`).",type:"string"}).options({output:{alias:"o",describe:"Output file path for the generated client (must end in .ts).",type:"string",requiresArg:!0},"server-url":{describe:"Override the server URL inlined into the generated runtime. Defaults to `servers[0].url`.",type:"string",requiresArg:!0},"output-mode":{describe:"How the client is split across files: `single` (default, one file) or `split` (schema types and guards in a sibling `<name>.schemas.ts` the entry re-exports).",choices:["single","split"],requiresArg:!0},runtime:{describe:"Runtime distribution: 'inline' (default) embeds the runtime in the generated file; 'package' imports it from @redocly/client-generator.",choices:["inline","package"],requiresArg:!0},"import-ext":{describe:"Extension in generated relative imports: 'js' (default) suits tsc and bundlers; 'ts' suits runtimes that resolve specifiers literally, like Node's built-in type stripping (node client.ts).",choices:["js","ts"],requiresArg:!0},setup:{describe:"Path to a publisher setup module (a file default-exporting { config, middleware }) that gets included into the generated client \u2014 pre-configure defaults such as the server URL, retries, headers, and middleware, so a published SDK ships with them built in. Works across all output modes.",type:"string",requiresArg:!0},"args-style":{describe:"How operation inputs are passed: `flat` (default) spreads path params as positional arguments followed by `params`/`body`/`headers`; `grouped` bundles every input into a single `args` object (the per-call request `init` stays a separate trailing argument).",choices:["flat","grouped"],requiresArg:!0},"error-mode":{describe:"Error handling: 'throw' (default) throws ApiError on non-2xx; 'result' returns { data, error, response }.",choices:["throw","result"],requiresArg:!0},"date-type":{describe:"How `date-time`/`date` string fields are typed: 'string' (default) keeps the ISO wire shape; 'Date' emits a `Date` (pair with --generator transformers so the runtime value matches).",choices:["string","Date"],requiresArg:!0},"mock-data":{describe:"How the `mock` generator produces data: 'static' (default) inlines deterministic literals (zero-dep); 'faker' emits @faker-js/faker calls for realistic data (install @faker-js/faker as a dev dependency).",choices:["static","faker"],requiresArg:!0},"mock-seed":{describe:"Seed for faker-mode mocks: emits a top-level `faker.seed(<n>)` so generated data is reproducible across runs. Ignored in static mode.",type:"number",requiresArg:!0},generator:{describe:"Generator to run; repeat the flag to run several (default: sdk). A built-in name (sdk, zod, tanstack-query, swr, transformers, mock) or a custom-generator path/package specifier. Example: --generator sdk --generator zod",type:"string",array:!0,requiresArg:!0},config:{describe:"Path to the config file.",type:"string",requiresArg:!0}}),async t=>{ge(Rl)(t)}).command("generate-spec <traffic>","Infer an OpenAPI description from recorded HTTP traffic, optionally refined with AI [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_SPEC").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({type:{describe:"Target API description type.",choices:["openapi"],default:"openapi"},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, the rest of their URL becomes the API path, and it becomes the servers URL of the generated description.",type:"string"},title:{describe:"Title for the generated API description.",type:"string"},"with-ai":{describe:"Refine the inferred description with an AI provider to narrow the hypothesis.",type:"boolean",default:!1},"ai-provider":{describe:'AI provider used with --with-ai; runs the "claude", "codex", or "cursor" CLI in non-interactive mode.',choices:["claude","codex","cursor"],default:"claude"},"ai-model":{describe:"Model passed to the selected AI provider (provider-specific default applies).",type:"string"},"ai-concurrency":{describe:"Number of operations refined in parallel with --with-ai.",type:"number",default:4,coerce:Tr("ai-concurrency",!0)},output:{alias:"o",describe:"Write the generated description to this file instead of stdout.",type:"string"},config:{describe:"Path to the config file.",type:"string"}}),async t=>{let{handleGenerateSpec:e}=await import("./chunks/JMYL7BXB.js");ge(e)(t)}).command("scorecard-classic [api]","Run quality scorecards with multiple rule levels to validate and maintain API description standards.",t=>t.positional("api",{type:"string"}).option({config:{describe:"Path to the config file.",type:"string"},"project-url":{describe:"URL to the project scorecard configuration.",type:"string"},format:{description:"Use a specific output format.",choices:["stylish","json","checkstyle","junit"],default:"stylish"},"target-level":{describe:"Target level for the scorecard.",type:"string"},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"}}),async t=>{ge(ru)(t)}).command("drift <traffic>","Detect drift between recorded HTTP traffic and an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_DRIFT").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({api:{describe:"OpenAPI description file or folder to validate against.",type:"string",demandOption:!0},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},"report-format":{describe:"Output format.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode (how requests are located via the description servers). Mutually exclusive with --server.",choices:["strict-host","basepath"],defaultDescription:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks (useful for logs exported without cookies).",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},"min-severity":{describe:"Discard findings below this severity from the report.",choices:["info","warning","error"],default:"info"},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},output:{alias:"o",describe:"Write the drift report (in the format selected with --format) to this file instead of stdout.",type:"string"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, and the rest of their URL is treated as the API path. It replaces the description servers and the remaining path is matched against the description paths directly. Mutually exclusive with --match-mode.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleDrift:e}=await import("./chunks/6H3RG723.js");ge(e)(t)}).command("proxy","Capture live HTTP traffic through a reverse proxy into a HAR file, optionally validating it against an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_PROXY").option({target:{describe:"Upstream base URL to forward captured requests to.",type:"string",demandOption:!0},port:{describe:"Port the proxy listens on.",type:"number",default:4040},host:{describe:"Host the proxy binds to.",type:"string",default:"127.0.0.1"},har:{describe:"Path to the HAR file where captured traffic is written.",type:"string",demandOption:!0},api:{describe:"OpenAPI description file or folder to validate captured traffic against (live).",type:"string"},"report-format":{describe:"Output format for the validation report printed on shutdown.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode.",choices:["strict-host","basepath"],default:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks.",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleProxy:e}=await import("./chunks/LCC3O74U.js");ge(e)(t)}).completion("completion","Generate autocomplete script for `redocly` command.").demandCommand(1).middleware([Bu]).strict().argv;
279
279
  /*! Bundled license information:
280
280
 
281
281
  cookie/index.js: