@spectrl/cli 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +47 -47
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
import { createRequire as __createRequire } from 'node:module';
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
if (process.stdout.isTTY && !process.env.NO_COLOR) process.env.FORCE_COLOR = process.env.FORCE_COLOR || '3';
|
|
5
|
-
var Au=Object.create;var ps=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Iu=Object.getOwnPropertyNames;var Ou=Object.getPrototypeOf,ku=Object.prototype.hasOwnProperty;var kn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Tu=(t,e)=>{for(var r in e)ps(t,r,{get:e[r],enumerable:!0})},Pu=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Iu(e))!ku.call(t,n)&&n!==r&&ps(t,n,{get:()=>e[n],enumerable:!(s=$u(e,n))||s.enumerable});return t};var _t=(t,e,r)=>(r=t!=null?Au(Ou(t)):{},Pu(e||!t||!t.__esModule?ps(r,"default",{value:t,enumerable:!0}):r,t));var ur=R((Hy,Yn)=>{"use strict";var cd="2.0.0",ud=Number.MAX_SAFE_INTEGER||9007199254740991,ld=16,dd=250,fd=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Yn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:ld,MAX_SAFE_BUILD_LENGTH:dd,MAX_SAFE_INTEGER:ud,RELEASE_TYPES:fd,SEMVER_SPEC_VERSION:cd,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var lr=R((Jy,Xn)=>{"use strict";var pd=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Xn.exports=pd});var jt=R((Te,Kn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:xs,MAX_SAFE_BUILD_LENGTH:hd,MAX_LENGTH:md}=ur(),gd=lr();Te=Kn.exports={};var Dd=Te.re=[],yd=Te.safeRe=[],b=Te.src=[],wd=Te.safeSrc=[],F=Te.t={},Ed=0,vs="[a-zA-Z0-9-]",xd=[["\\s",1],["\\d",md],[vs,hd]],vd=t=>{for(let[e,r]of xd)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},k=(t,e,r)=>{let s=vd(e),n=Ed++;gd(t,n,e),F[t]=n,b[n]=e,wd[n]=s,Dd[n]=new RegExp(e,r?"g":void 0),yd[n]=new RegExp(s,r?"g":void 0)};k("NUMERICIDENTIFIER","0|[1-9]\\d*");k("NUMERICIDENTIFIERLOOSE","\\d+");k("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${vs}*`);k("MAINVERSION",`(${b[F.NUMERICIDENTIFIER]})\\.(${b[F.NUMERICIDENTIFIER]})\\.(${b[F.NUMERICIDENTIFIER]})`);k("MAINVERSIONLOOSE",`(${b[F.NUMERICIDENTIFIERLOOSE]})\\.(${b[F.NUMERICIDENTIFIERLOOSE]})\\.(${b[F.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASEIDENTIFIER",`(?:${b[F.NONNUMERICIDENTIFIER]}|${b[F.NUMERICIDENTIFIER]})`);k("PRERELEASEIDENTIFIERLOOSE",`(?:${b[F.NONNUMERICIDENTIFIER]}|${b[F.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASE",`(?:-(${b[F.PRERELEASEIDENTIFIER]}(?:\\.${b[F.PRERELEASEIDENTIFIER]})*))`);k("PRERELEASELOOSE",`(?:-?(${b[F.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[F.PRERELEASEIDENTIFIERLOOSE]})*))`);k("BUILDIDENTIFIER",`${vs}+`);k("BUILD",`(?:\\+(${b[F.BUILDIDENTIFIER]}(?:\\.${b[F.BUILDIDENTIFIER]})*))`);k("FULLPLAIN",`v?${b[F.MAINVERSION]}${b[F.PRERELEASE]}?${b[F.BUILD]}?`);k("FULL",`^${b[F.FULLPLAIN]}$`);k("LOOSEPLAIN",`[v=\\s]*${b[F.MAINVERSIONLOOSE]}${b[F.PRERELEASELOOSE]}?${b[F.BUILD]}?`);k("LOOSE",`^${b[F.LOOSEPLAIN]}$`);k("GTLT","((?:<|>)?=?)");k("XRANGEIDENTIFIERLOOSE",`${b[F.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);k("XRANGEIDENTIFIER",`${b[F.NUMERICIDENTIFIER]}|x|X|\\*`);k("XRANGEPLAIN",`[v=\\s]*(${b[F.XRANGEIDENTIFIER]})(?:\\.(${b[F.XRANGEIDENTIFIER]})(?:\\.(${b[F.XRANGEIDENTIFIER]})(?:${b[F.PRERELEASE]})?${b[F.BUILD]}?)?)?`);k("XRANGEPLAINLOOSE",`[v=\\s]*(${b[F.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[F.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[F.XRANGEIDENTIFIERLOOSE]})(?:${b[F.PRERELEASELOOSE]})?${b[F.BUILD]}?)?)?`);k("XRANGE",`^${b[F.GTLT]}\\s*${b[F.XRANGEPLAIN]}$`);k("XRANGELOOSE",`^${b[F.GTLT]}\\s*${b[F.XRANGEPLAINLOOSE]}$`);k("COERCEPLAIN",`(^|[^\\d])(\\d{1,${xs}})(?:\\.(\\d{1,${xs}}))?(?:\\.(\\d{1,${xs}}))?`);k("COERCE",`${b[F.COERCEPLAIN]}(?:$|[^\\d])`);k("COERCEFULL",b[F.COERCEPLAIN]+`(?:${b[F.PRERELEASE]})?(?:${b[F.BUILD]})?(?:$|[^\\d])`);k("COERCERTL",b[F.COERCE],!0);k("COERCERTLFULL",b[F.COERCEFULL],!0);k("LONETILDE","(?:~>?)");k("TILDETRIM",`(\\s*)${b[F.LONETILDE]}\\s+`,!0);Te.tildeTrimReplace="$1~";k("TILDE",`^${b[F.LONETILDE]}${b[F.XRANGEPLAIN]}$`);k("TILDELOOSE",`^${b[F.LONETILDE]}${b[F.XRANGEPLAINLOOSE]}$`);k("LONECARET","(?:\\^)");k("CARETTRIM",`(\\s*)${b[F.LONECARET]}\\s+`,!0);Te.caretTrimReplace="$1^";k("CARET",`^${b[F.LONECARET]}${b[F.XRANGEPLAIN]}$`);k("CARETLOOSE",`^${b[F.LONECARET]}${b[F.XRANGEPLAINLOOSE]}$`);k("COMPARATORLOOSE",`^${b[F.GTLT]}\\s*(${b[F.LOOSEPLAIN]})$|^$`);k("COMPARATOR",`^${b[F.GTLT]}\\s*(${b[F.FULLPLAIN]})$|^$`);k("COMPARATORTRIM",`(\\s*)${b[F.GTLT]}\\s*(${b[F.LOOSEPLAIN]}|${b[F.XRANGEPLAIN]})`,!0);Te.comparatorTrimReplace="$1$2$3";k("HYPHENRANGE",`^\\s*(${b[F.XRANGEPLAIN]})\\s+-\\s+(${b[F.XRANGEPLAIN]})\\s*$`);k("HYPHENRANGELOOSE",`^\\s*(${b[F.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[F.XRANGEPLAINLOOSE]})\\s*$`);k("STAR","(<|>)?=?\\s*\\*");k("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");k("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Lr=R((Zy,Qn)=>{"use strict";var Cd=Object.freeze({loose:!0}),bd=Object.freeze({}),Fd=t=>t?typeof t!="object"?Cd:t:bd;Qn.exports=Fd});var Cs=R((Yy,ri)=>{"use strict";var ei=/^[0-9]+$/,ti=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=ei.test(t),s=ei.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:t<e?-1:1},Rd=(t,e)=>ti(e,t);ri.exports={compareIdentifiers:ti,rcompareIdentifiers:Rd}});var te=R((Xy,ni)=>{"use strict";var Mr=lr(),{MAX_LENGTH:si,MAX_SAFE_INTEGER:jr}=ur(),{safeRe:Br,t:Wr}=jt(),Sd=Lr(),{compareIdentifiers:bs}=Cs(),Fs=class t{constructor(e,r){if(r=Sd(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>si)throw new TypeError(`version is longer than ${si} characters`);Mr("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?Br[Wr.LOOSE]:Br[Wr.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>jr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>jr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>jr||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<jr)return i}return n}):this.prerelease=[],this.build=s[5]?s[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(Mr("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 s=this.prerelease[r],n=e.prerelease[r];if(Mr("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return bs(s,n)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let s=this.build[r],n=e.build[r];if(Mr("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return bs(s,n)}while(++r)}inc(e,r,s){if(e.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?Br[Wr.PRERELEASELOOSE]:Br[Wr.PRERELEASE]);if(!n||n[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,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);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 n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];s===!1&&(i=[r]),bs(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}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=Fs});var vt=R((Ky,oi)=>{"use strict";var ii=te(),_d=(t,e,r=!1)=>{if(t instanceof ii)return t;try{return new ii(t,e)}catch(s){if(!r)return null;throw s}};oi.exports=_d});var ci=R((Qy,ai)=>{"use strict";var Ad=vt(),$d=(t,e)=>{let r=Ad(t,e);return r?r.version:null};ai.exports=$d});var li=R((ew,ui)=>{"use strict";var Id=vt(),Od=(t,e)=>{let r=Id(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};ui.exports=Od});var pi=R((tw,fi)=>{"use strict";var di=te(),kd=(t,e,r,s,n)=>{typeof r=="string"&&(n=s,s=r,r=void 0);try{return new di(t instanceof di?t.version:t,r).inc(e,s,n).version}catch{return null}};fi.exports=kd});var gi=R((rw,mi)=>{"use strict";var hi=vt(),Td=(t,e)=>{let r=hi(t,null,!0),s=hi(e,null,!0),n=r.compare(s);if(n===0)return null;let i=n>0,o=i?r:s,a=i?s:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let d=c?"pre":"";return r.major!==s.major?d+"major":r.minor!==s.minor?d+"minor":r.patch!==s.patch?d+"patch":"prerelease"};mi.exports=Td});var yi=R((sw,Di)=>{"use strict";var Pd=te(),Nd=(t,e)=>new Pd(t,e).major;Di.exports=Nd});var Ei=R((nw,wi)=>{"use strict";var Ld=te(),Md=(t,e)=>new Ld(t,e).minor;wi.exports=Md});var vi=R((iw,xi)=>{"use strict";var jd=te(),Bd=(t,e)=>new jd(t,e).patch;xi.exports=Bd});var bi=R((ow,Ci)=>{"use strict";var Wd=vt(),qd=(t,e)=>{let r=Wd(t,e);return r&&r.prerelease.length?r.prerelease:null};Ci.exports=qd});var Ee=R((aw,Ri)=>{"use strict";var Fi=te(),Ud=(t,e,r)=>new Fi(t,r).compare(new Fi(e,r));Ri.exports=Ud});var _i=R((cw,Si)=>{"use strict";var zd=Ee(),Vd=(t,e,r)=>zd(e,t,r);Si.exports=Vd});var $i=R((uw,Ai)=>{"use strict";var Gd=Ee(),Hd=(t,e)=>Gd(t,e,!0);Ai.exports=Hd});var qr=R((lw,Oi)=>{"use strict";var Ii=te(),Jd=(t,e,r)=>{let s=new Ii(t,r),n=new Ii(e,r);return s.compare(n)||s.compareBuild(n)};Oi.exports=Jd});var Ti=R((dw,ki)=>{"use strict";var Zd=qr(),Yd=(t,e)=>t.sort((r,s)=>Zd(r,s,e));ki.exports=Yd});var Ni=R((fw,Pi)=>{"use strict";var Xd=qr(),Kd=(t,e)=>t.sort((r,s)=>Xd(s,r,e));Pi.exports=Kd});var dr=R((pw,Li)=>{"use strict";var Qd=Ee(),ef=(t,e,r)=>Qd(t,e,r)>0;Li.exports=ef});var Ur=R((hw,Mi)=>{"use strict";var tf=Ee(),rf=(t,e,r)=>tf(t,e,r)<0;Mi.exports=rf});var Rs=R((mw,ji)=>{"use strict";var sf=Ee(),nf=(t,e,r)=>sf(t,e,r)===0;ji.exports=nf});var Ss=R((gw,Bi)=>{"use strict";var of=Ee(),af=(t,e,r)=>of(t,e,r)!==0;Bi.exports=af});var zr=R((Dw,Wi)=>{"use strict";var cf=Ee(),uf=(t,e,r)=>cf(t,e,r)>=0;Wi.exports=uf});var Vr=R((yw,qi)=>{"use strict";var lf=Ee(),df=(t,e,r)=>lf(t,e,r)<=0;qi.exports=df});var _s=R((ww,Ui)=>{"use strict";var ff=Rs(),pf=Ss(),hf=dr(),mf=zr(),gf=Ur(),Df=Vr(),yf=(t,e,r,s)=>{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 ff(t,r,s);case"!=":return pf(t,r,s);case">":return hf(t,r,s);case">=":return mf(t,r,s);case"<":return gf(t,r,s);case"<=":return Df(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};Ui.exports=yf});var Vi=R((Ew,zi)=>{"use strict";var wf=te(),Ef=vt(),{safeRe:Gr,t:Hr}=jt(),xf=(t,e)=>{if(t instanceof wf)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?Gr[Hr.COERCEFULL]:Gr[Hr.COERCE]);else{let c=e.includePrerelease?Gr[Hr.COERCERTLFULL]:Gr[Hr.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Ef(`${s}.${n}.${i}${o}${a}`,e)};zi.exports=xf});var Hi=R((xw,Gi)=>{"use strict";var As=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 n=this.map.keys().next().value;this.delete(n)}this.map.set(e,r)}return this}};Gi.exports=As});var xe=R((vw,Xi)=>{"use strict";var vf=/\s+/g,$s=class t{constructor(e,r){if(r=bf(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Is)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(vf," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!Zi(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&If(n[0])){this.set=[n];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 s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let s=((this.options.includePrerelease&&Af)|(this.options.loose&&$f))+":"+e,n=Ji.get(s);if(n)return n;let i=this.options.loose,o=i?ne[re.HYPHENRANGELOOSE]:ne[re.HYPHENRANGE];e=e.replace(o,Wf(this.options.includePrerelease)),W("hyphen replace",e),e=e.replace(ne[re.COMPARATORTRIM],Rf),W("comparator trim",e),e=e.replace(ne[re.TILDETRIM],Sf),W("tilde trim",e),e=e.replace(ne[re.CARETTRIM],_f),W("caret trim",e);let a=e.split(" ").map(h=>Of(h,this.options)).join(" ").split(/\s+/).map(h=>Bf(h,this.options));i&&(a=a.filter(h=>(W("loose invalid filter",h,this.options),!!h.match(ne[re.COMPARATORLOOSE])))),W("range list",a);let c=new Map,u=a.map(h=>new Is(h,this.options));for(let h of u){if(Zi(h))return[h];c.set(h.value,h)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return Ji.set(s,d),d}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>Yi(s,r)&&e.set.some(n=>Yi(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Ff(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(qf(this.set[r],e,this.options))return!0;return!1}};Xi.exports=$s;var Cf=Hi(),Ji=new Cf,bf=Lr(),Is=fr(),W=lr(),Ff=te(),{safeRe:ne,t:re,comparatorTrimReplace:Rf,tildeTrimReplace:Sf,caretTrimReplace:_f}=jt(),{FLAG_INCLUDE_PRERELEASE:Af,FLAG_LOOSE:$f}=ur(),Zi=t=>t.value==="<0.0.0-0",If=t=>t.value==="",Yi=(t,e)=>{let r=!0,s=t.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,e)),n=s.pop();return r},Of=(t,e)=>(t=t.replace(ne[re.BUILD],""),W("comp",t,e),t=Pf(t,e),W("caret",t),t=kf(t,e),W("tildes",t),t=Lf(t,e),W("xrange",t),t=jf(t,e),W("stars",t),t),ie=t=>!t||t.toLowerCase()==="x"||t==="*",kf=(t,e)=>t.trim().split(/\s+/).map(r=>Tf(r,e)).join(" "),Tf=(t,e)=>{let r=e.loose?ne[re.TILDELOOSE]:ne[re.TILDE];return t.replace(r,(s,n,i,o,a)=>{W("tilde",t,s,n,i,o,a);let c;return ie(n)?c="":ie(i)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:ie(o)?c=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(W("replaceTilde pr",a),c=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):c=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,W("tilde return",c),c})},Pf=(t,e)=>t.trim().split(/\s+/).map(r=>Nf(r,e)).join(" "),Nf=(t,e)=>{W("caret",t,e);let r=e.loose?ne[re.CARETLOOSE]:ne[re.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(n,i,o,a,c)=>{W("caret",t,n,i,o,a,c);let u;return ie(i)?u="":ie(o)?u=`>=${i}.0.0${s} <${+i+1}.0.0-0`:ie(a)?i==="0"?u=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:c?(W("replaceCaret pr",c),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(W("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),W("caret return",u),u})},Lf=(t,e)=>(W("replaceXRanges",t,e),t.split(/\s+/).map(r=>Mf(r,e)).join(" ")),Mf=(t,e)=>{t=t.trim();let r=e.loose?ne[re.XRANGELOOSE]:ne[re.XRANGE];return t.replace(r,(s,n,i,o,a,c)=>{W("xRange",t,s,n,i,o,a,c);let u=ie(i),d=u||ie(o),h=d||ie(a),p=h;return n==="="&&p&&(n=""),c=e.includePrerelease?"-0":"",u?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&p?(d&&(o=0),a=0,n===">"?(n=">=",d?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",d?i=+i+1:o=+o+1),n==="<"&&(c="-0"),s=`${n+i}.${o}.${a}${c}`):d?s=`>=${i}.0.0${c} <${+i+1}.0.0-0`:h&&(s=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),W("xRange return",s),s})},jf=(t,e)=>(W("replaceStars",t,e),t.trim().replace(ne[re.STAR],"")),Bf=(t,e)=>(W("replaceGTE0",t,e),t.trim().replace(ne[e.includePrerelease?re.GTE0PRE:re.GTE0],"")),Wf=t=>(e,r,s,n,i,o,a,c,u,d,h,p)=>(ie(s)?r="":ie(n)?r=`>=${s}.0.0${t?"-0":""}`:ie(i)?r=`>=${s}.${n}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,ie(u)?c="":ie(d)?c=`<${+u+1}.0.0-0`:ie(h)?c=`<${u}.${+d+1}.0-0`:p?c=`<=${u}.${d}.${h}-${p}`:t?c=`<${u}.${d}.${+h+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),qf=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(W(t[s].semver),t[s].semver!==Is.ANY&&t[s].semver.prerelease.length>0){let n=t[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var fr=R((Cw,so)=>{"use strict";var pr=Symbol("SemVer ANY"),Ts=class t{static get ANY(){return pr}constructor(e,r){if(r=Ki(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),ks("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===pr?this.value="":this.value=this.operator+this.semver.version,ks("comp",this)}parse(e){let r=this.options.loose?Qi[eo.COMPARATORLOOSE]:Qi[eo.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new to(s[2],this.options.loose):this.semver=pr}toString(){return this.value}test(e){if(ks("Comparator.test",e,this.options.loose),this.semver===pr||e===pr)return!0;if(typeof e=="string")try{e=new to(e,this.options)}catch{return!1}return Os(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 ro(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new ro(this.value,r).test(e.semver):(r=Ki(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("=")||Os(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Os(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};so.exports=Ts;var Ki=Lr(),{safeRe:Qi,t:eo}=jt(),Os=_s(),ks=lr(),to=te(),ro=xe()});var hr=R((bw,no)=>{"use strict";var Uf=xe(),zf=(t,e,r)=>{try{e=new Uf(e,r)}catch{return!1}return e.test(t)};no.exports=zf});var oo=R((Fw,io)=>{"use strict";var Vf=xe(),Gf=(t,e)=>new Vf(t,e).set.map(r=>r.map(s=>s.value).join(" ").trim().split(" "));io.exports=Gf});var co=R((Rw,ao)=>{"use strict";var Hf=te(),Jf=xe(),Zf=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Jf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===-1)&&(s=o,n=new Hf(s,r))}),s};ao.exports=Zf});var lo=R((Sw,uo)=>{"use strict";var Yf=te(),Xf=xe(),Kf=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Xf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===1)&&(s=o,n=new Yf(s,r))}),s};uo.exports=Kf});var ho=R((_w,po)=>{"use strict";var Ps=te(),Qf=xe(),fo=dr(),ep=(t,e)=>{t=new Qf(t,e);let r=new Ps("0.0.0");if(t.test(r)||(r=new Ps("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let n=t.set[s],i=null;n.forEach(o=>{let a=new Ps(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||fo(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||fo(r,i))&&(r=i)}return r&&t.test(r)?r:null};po.exports=ep});var go=R((Aw,mo)=>{"use strict";var tp=xe(),rp=(t,e)=>{try{return new tp(t,e).range||"*"}catch{return null}};mo.exports=rp});var Jr=R(($w,Eo)=>{"use strict";var sp=te(),wo=fr(),{ANY:np}=wo,ip=xe(),op=hr(),Do=dr(),yo=Ur(),ap=Vr(),cp=zr(),up=(t,e,r,s)=>{t=new sp(t,s),e=new ip(e,s);let n,i,o,a,c;switch(r){case">":n=Do,i=ap,o=yo,a=">",c=">=";break;case"<":n=yo,i=cp,o=Do,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(op(t,e,s))return!1;for(let u=0;u<e.set.length;++u){let d=e.set[u],h=null,p=null;if(d.forEach(l=>{l.semver===np&&(l=new wo(">=0.0.0")),h=h||l,p=p||l,n(l.semver,h.semver,s)?h=l:o(l.semver,p.semver,s)&&(p=l)}),h.operator===a||h.operator===c||(!p.operator||p.operator===a)&&i(t,p.semver))return!1;if(p.operator===c&&o(t,p.semver))return!1}return!0};Eo.exports=up});var vo=R((Iw,xo)=>{"use strict";var lp=Jr(),dp=(t,e,r)=>lp(t,e,">",r);xo.exports=dp});var bo=R((Ow,Co)=>{"use strict";var fp=Jr(),pp=(t,e,r)=>fp(t,e,"<",r);Co.exports=pp});var So=R((kw,Ro)=>{"use strict";var Fo=xe(),hp=(t,e,r)=>(t=new Fo(t,r),e=new Fo(e,r),t.intersects(e,r));Ro.exports=hp});var Ao=R((Tw,_o)=>{"use strict";var mp=hr(),gp=Ee();_o.exports=(t,e,r)=>{let s=[],n=null,i=null,o=t.sort((d,h)=>gp(d,h,r));for(let d of o)mp(d,e,r)?(i=d,n||(n=d)):(i&&s.push([n,i]),i=null,n=null);n&&s.push([n,null]);let a=[];for(let[d,h]of s)d===h?a.push(d):!h&&d===o[0]?a.push("*"):h?d===o[0]?a.push(`<=${h}`):a.push(`${d} - ${h}`):a.push(`>=${d}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length<u.length?c:e}});var Po=R((Pw,To)=>{"use strict";var $o=xe(),Ls=fr(),{ANY:Ns}=Ls,mr=hr(),Ms=Ee(),Dp=(t,e,r={})=>{if(t===e)return!0;t=new $o(t,r),e=new $o(e,r);let s=!1;e:for(let n of t.set){for(let i of e.set){let o=wp(n,i,r);if(s=s||o!==null,o)continue e}if(s)return!1}return!0},yp=[new Ls(">=0.0.0-0")],Io=[new Ls(">=0.0.0")],wp=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Ns){if(e.length===1&&e[0].semver===Ns)return!0;r.includePrerelease?t=yp:t=Io}if(e.length===1&&e[0].semver===Ns){if(r.includePrerelease)return!0;e=Io}let s=new Set,n,i;for(let l of t)l.operator===">"||l.operator===">="?n=Oo(n,l,r):l.operator==="<"||l.operator==="<="?i=ko(i,l,r):s.add(l.semver);if(s.size>1)return null;let o;if(n&&i){if(o=Ms(n.semver,i.semver,r),o>0)return null;if(o===0&&(n.operator!==">="||i.operator!=="<="))return null}for(let l of s){if(n&&!mr(l,String(n),r)||i&&!mr(l,String(i),r))return null;for(let g of e)if(!mr(l,String(g),r))return!1;return!0}let a,c,u,d,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,p=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;h&&h.prerelease.length===1&&i.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let l of e){if(d=d||l.operator===">"||l.operator===">=",u=u||l.operator==="<"||l.operator==="<=",n){if(p&&l.semver.prerelease&&l.semver.prerelease.length&&l.semver.major===p.major&&l.semver.minor===p.minor&&l.semver.patch===p.patch&&(p=!1),l.operator===">"||l.operator===">="){if(a=Oo(n,l,r),a===l&&a!==n)return!1}else if(n.operator===">="&&!mr(n.semver,String(l),r))return!1}if(i){if(h&&l.semver.prerelease&&l.semver.prerelease.length&&l.semver.major===h.major&&l.semver.minor===h.minor&&l.semver.patch===h.patch&&(h=!1),l.operator==="<"||l.operator==="<="){if(c=ko(i,l,r),c===l&&c!==i)return!1}else if(i.operator==="<="&&!mr(i.semver,String(l),r))return!1}if(!l.operator&&(i||n)&&o!==0)return!1}return!(n&&u&&!i&&o!==0||i&&d&&!n&&o!==0||p||h)},Oo=(t,e,r)=>{if(!t)return e;let s=Ms(t.semver,e.semver,r);return s>0?t:s<0||e.operator===">"&&t.operator===">="?e:t},ko=(t,e,r)=>{if(!t)return e;let s=Ms(t.semver,e.semver,r);return s<0?t:s>0||e.operator==="<"&&t.operator==="<="?e:t};To.exports=Dp});var Bs=R((Nw,Mo)=>{"use strict";var js=jt(),No=ur(),Ep=te(),Lo=Cs(),xp=vt(),vp=ci(),Cp=li(),bp=pi(),Fp=gi(),Rp=yi(),Sp=Ei(),_p=vi(),Ap=bi(),$p=Ee(),Ip=_i(),Op=$i(),kp=qr(),Tp=Ti(),Pp=Ni(),Np=dr(),Lp=Ur(),Mp=Rs(),jp=Ss(),Bp=zr(),Wp=Vr(),qp=_s(),Up=Vi(),zp=fr(),Vp=xe(),Gp=hr(),Hp=oo(),Jp=co(),Zp=lo(),Yp=ho(),Xp=go(),Kp=Jr(),Qp=vo(),eh=bo(),th=So(),rh=Ao(),sh=Po();Mo.exports={parse:xp,valid:vp,clean:Cp,inc:bp,diff:Fp,major:Rp,minor:Sp,patch:_p,prerelease:Ap,compare:$p,rcompare:Ip,compareLoose:Op,compareBuild:kp,sort:Tp,rsort:Pp,gt:Np,lt:Lp,eq:Mp,neq:jp,gte:Bp,lte:Wp,cmp:qp,coerce:Up,Comparator:zp,Range:Vp,satisfies:Gp,toComparators:Hp,maxSatisfying:Jp,minSatisfying:Zp,minVersion:Yp,validRange:Xp,outside:Kp,gtr:Qp,ltr:eh,intersects:th,simplifyRange:rh,subset:sh,SemVer:Ep,re:js.re,src:js.src,tokens:js.t,SEMVER_SPEC_VERSION:No.SEMVER_SPEC_VERSION,RELEASE_TYPES:No.RELEASE_TYPES,compareIdentifiers:Lo.compareIdentifiers,rcompareIdentifiers:Lo.rcompareIdentifiers}});var as=R((iv,tc)=>{var mn=[],ec=0,se=(t,e)=>{ec>=e&&mn.push(t)};se.WARN=1;se.INFO=2;se.DEBUG=3;se.reset=()=>{mn=[]};se.setDebugLevel=t=>{ec=t};se.warn=t=>se(t,se.WARN);se.info=t=>se(t,se.INFO);se.debug=t=>se(t,se.DEBUG);se.debugMessages=()=>mn;tc.exports=se});var sc=R((ov,rc)=>{"use strict";rc.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var ic=R((av,nc)=>{"use strict";var Zm=sc();nc.exports=t=>typeof t=="string"?t.replace(Zm(),""):t});var ac=R((cv,gn)=>{"use strict";var oc=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);gn.exports=oc;gn.exports.default=oc});var uc=R((uv,cc)=>{"use strict";cc.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var dc=R((lv,Dn)=>{"use strict";var Ym=ic(),Xm=ac(),Km=uc(),lc=t=>{if(typeof t!="string"||t.length===0||(t=Ym(t),t.length===0))return 0;t=t.replace(Km()," ");let e=0;for(let r=0;r<t.length;r++){let s=t.codePointAt(r);s<=31||s>=127&&s<=159||s>=768&&s<=879||(s>65535&&r++,e+=Xm(s)?2:1)}return e};Dn.exports=lc;Dn.exports.default=lc});var yn=R((dv,mc)=>{var fc=dc();function cs(t){return t?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function Pe(t){let e=cs();return(""+t).replace(e,"").split(`
|
|
6
|
-
`).reduce(function(n,i){return
|
|
7
|
-
`);let n=r?ag:cg;for(let i=0;i<e.length;i++)s.push.apply(s,n(t,e[i]));return s}function lg(t){let e={},r=[];for(let s=0;s<t.length;s++){let n=tg(e,t[s]);e=eg(n);let i=Object.assign({},e);r.push(
|
|
8
|
-
`)!=-1,s=this._styles,n=s.length;n--;){var i=St[s[n]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(gg,function(o){return i.close+o+i.open}))}return e}j.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){j[r]=function(s){if(typeof t[r]=="object"){var n=s;for(var i in t[r])n=j[t[r][i]](n);return n}return j[t[r]](s)}})(e)};function xg(){var t={};return Object.keys(
|
|
9
|
-
`))}wrapLines(e){let r=me.colorizeLines(e);return this.href?r.map(s=>me.hyperlink(this.href,s)):r}init(e){let r=this.x,s=this.y;this.widths=e.colWidths.slice(r,r+this.colSpan),this.heights=e.rowHeights.slice(s,s+this.rowSpan),this.width=this.widths.reduce(
|
|
5
|
+
var Au=Object.create;var ps=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Iu=Object.getOwnPropertyNames;var Ou=Object.getPrototypeOf,ku=Object.prototype.hasOwnProperty;var On=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Tu=(t,e)=>{for(var r in e)ps(t,r,{get:e[r],enumerable:!0})},Pu=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Iu(e))!ku.call(t,n)&&n!==r&&ps(t,n,{get:()=>e[n],enumerable:!(s=$u(e,n))||s.enumerable});return t};var At=(t,e,r)=>(r=t!=null?Au(Ou(t)):{},Pu(e||!t||!t.__esModule?ps(r,"default",{value:t,enumerable:!0}):r,t));var lr=R((Hy,Zn)=>{"use strict";var cd="2.0.0",ud=Number.MAX_SAFE_INTEGER||9007199254740991,ld=16,dd=250,fd=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Zn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:ld,MAX_SAFE_BUILD_LENGTH:dd,MAX_SAFE_INTEGER:ud,RELEASE_TYPES:fd,SEMVER_SPEC_VERSION:cd,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var dr=R((Jy,Yn)=>{"use strict";var pd=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Yn.exports=pd});var Bt=R((Te,Xn)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:xs,MAX_SAFE_BUILD_LENGTH:hd,MAX_LENGTH:md}=lr(),gd=dr();Te=Xn.exports={};var Dd=Te.re=[],yd=Te.safeRe=[],b=Te.src=[],wd=Te.safeSrc=[],F=Te.t={},Ed=0,vs="[a-zA-Z0-9-]",xd=[["\\s",1],["\\d",md],[vs,hd]],vd=t=>{for(let[e,r]of xd)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},k=(t,e,r)=>{let s=vd(e),n=Ed++;gd(t,n,e),F[t]=n,b[n]=e,wd[n]=s,Dd[n]=new RegExp(e,r?"g":void 0),yd[n]=new RegExp(s,r?"g":void 0)};k("NUMERICIDENTIFIER","0|[1-9]\\d*");k("NUMERICIDENTIFIERLOOSE","\\d+");k("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${vs}*`);k("MAINVERSION",`(${b[F.NUMERICIDENTIFIER]})\\.(${b[F.NUMERICIDENTIFIER]})\\.(${b[F.NUMERICIDENTIFIER]})`);k("MAINVERSIONLOOSE",`(${b[F.NUMERICIDENTIFIERLOOSE]})\\.(${b[F.NUMERICIDENTIFIERLOOSE]})\\.(${b[F.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASEIDENTIFIER",`(?:${b[F.NONNUMERICIDENTIFIER]}|${b[F.NUMERICIDENTIFIER]})`);k("PRERELEASEIDENTIFIERLOOSE",`(?:${b[F.NONNUMERICIDENTIFIER]}|${b[F.NUMERICIDENTIFIERLOOSE]})`);k("PRERELEASE",`(?:-(${b[F.PRERELEASEIDENTIFIER]}(?:\\.${b[F.PRERELEASEIDENTIFIER]})*))`);k("PRERELEASELOOSE",`(?:-?(${b[F.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[F.PRERELEASEIDENTIFIERLOOSE]})*))`);k("BUILDIDENTIFIER",`${vs}+`);k("BUILD",`(?:\\+(${b[F.BUILDIDENTIFIER]}(?:\\.${b[F.BUILDIDENTIFIER]})*))`);k("FULLPLAIN",`v?${b[F.MAINVERSION]}${b[F.PRERELEASE]}?${b[F.BUILD]}?`);k("FULL",`^${b[F.FULLPLAIN]}$`);k("LOOSEPLAIN",`[v=\\s]*${b[F.MAINVERSIONLOOSE]}${b[F.PRERELEASELOOSE]}?${b[F.BUILD]}?`);k("LOOSE",`^${b[F.LOOSEPLAIN]}$`);k("GTLT","((?:<|>)?=?)");k("XRANGEIDENTIFIERLOOSE",`${b[F.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);k("XRANGEIDENTIFIER",`${b[F.NUMERICIDENTIFIER]}|x|X|\\*`);k("XRANGEPLAIN",`[v=\\s]*(${b[F.XRANGEIDENTIFIER]})(?:\\.(${b[F.XRANGEIDENTIFIER]})(?:\\.(${b[F.XRANGEIDENTIFIER]})(?:${b[F.PRERELEASE]})?${b[F.BUILD]}?)?)?`);k("XRANGEPLAINLOOSE",`[v=\\s]*(${b[F.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[F.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[F.XRANGEIDENTIFIERLOOSE]})(?:${b[F.PRERELEASELOOSE]})?${b[F.BUILD]}?)?)?`);k("XRANGE",`^${b[F.GTLT]}\\s*${b[F.XRANGEPLAIN]}$`);k("XRANGELOOSE",`^${b[F.GTLT]}\\s*${b[F.XRANGEPLAINLOOSE]}$`);k("COERCEPLAIN",`(^|[^\\d])(\\d{1,${xs}})(?:\\.(\\d{1,${xs}}))?(?:\\.(\\d{1,${xs}}))?`);k("COERCE",`${b[F.COERCEPLAIN]}(?:$|[^\\d])`);k("COERCEFULL",b[F.COERCEPLAIN]+`(?:${b[F.PRERELEASE]})?(?:${b[F.BUILD]})?(?:$|[^\\d])`);k("COERCERTL",b[F.COERCE],!0);k("COERCERTLFULL",b[F.COERCEFULL],!0);k("LONETILDE","(?:~>?)");k("TILDETRIM",`(\\s*)${b[F.LONETILDE]}\\s+`,!0);Te.tildeTrimReplace="$1~";k("TILDE",`^${b[F.LONETILDE]}${b[F.XRANGEPLAIN]}$`);k("TILDELOOSE",`^${b[F.LONETILDE]}${b[F.XRANGEPLAINLOOSE]}$`);k("LONECARET","(?:\\^)");k("CARETTRIM",`(\\s*)${b[F.LONECARET]}\\s+`,!0);Te.caretTrimReplace="$1^";k("CARET",`^${b[F.LONECARET]}${b[F.XRANGEPLAIN]}$`);k("CARETLOOSE",`^${b[F.LONECARET]}${b[F.XRANGEPLAINLOOSE]}$`);k("COMPARATORLOOSE",`^${b[F.GTLT]}\\s*(${b[F.LOOSEPLAIN]})$|^$`);k("COMPARATOR",`^${b[F.GTLT]}\\s*(${b[F.FULLPLAIN]})$|^$`);k("COMPARATORTRIM",`(\\s*)${b[F.GTLT]}\\s*(${b[F.LOOSEPLAIN]}|${b[F.XRANGEPLAIN]})`,!0);Te.comparatorTrimReplace="$1$2$3";k("HYPHENRANGE",`^\\s*(${b[F.XRANGEPLAIN]})\\s+-\\s+(${b[F.XRANGEPLAIN]})\\s*$`);k("HYPHENRANGELOOSE",`^\\s*(${b[F.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[F.XRANGEPLAINLOOSE]})\\s*$`);k("STAR","(<|>)?=?\\s*\\*");k("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");k("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Lr=R((Zy,Kn)=>{"use strict";var Cd=Object.freeze({loose:!0}),bd=Object.freeze({}),Fd=t=>t?typeof t!="object"?Cd:t:bd;Kn.exports=Fd});var Cs=R((Yy,ti)=>{"use strict";var Qn=/^[0-9]+$/,ei=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=Qn.test(t),s=Qn.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:t<e?-1:1},Rd=(t,e)=>ei(e,t);ti.exports={compareIdentifiers:ei,rcompareIdentifiers:Rd}});var te=R((Xy,si)=>{"use strict";var Mr=dr(),{MAX_LENGTH:ri,MAX_SAFE_INTEGER:jr}=lr(),{safeRe:Br,t:Wr}=Bt(),Sd=Lr(),{compareIdentifiers:bs}=Cs(),Fs=class t{constructor(e,r){if(r=Sd(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>ri)throw new TypeError(`version is longer than ${ri} characters`);Mr("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?Br[Wr.LOOSE]:Br[Wr.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>jr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>jr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>jr||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<jr)return i}return n}):this.prerelease=[],this.build=s[5]?s[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(Mr("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 s=this.prerelease[r],n=e.prerelease[r];if(Mr("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return bs(s,n)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let s=this.build[r],n=e.build[r];if(Mr("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return bs(s,n)}while(++r)}inc(e,r,s){if(e.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?Br[Wr.PRERELEASELOOSE]:Br[Wr.PRERELEASE]);if(!n||n[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,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);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 n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];s===!1&&(i=[r]),bs(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};si.exports=Fs});var vt=R((Ky,ii)=>{"use strict";var ni=te(),_d=(t,e,r=!1)=>{if(t instanceof ni)return t;try{return new ni(t,e)}catch(s){if(!r)return null;throw s}};ii.exports=_d});var ai=R((Qy,oi)=>{"use strict";var Ad=vt(),$d=(t,e)=>{let r=Ad(t,e);return r?r.version:null};oi.exports=$d});var ui=R((ew,ci)=>{"use strict";var Id=vt(),Od=(t,e)=>{let r=Id(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};ci.exports=Od});var fi=R((tw,di)=>{"use strict";var li=te(),kd=(t,e,r,s,n)=>{typeof r=="string"&&(n=s,s=r,r=void 0);try{return new li(t instanceof li?t.version:t,r).inc(e,s,n).version}catch{return null}};di.exports=kd});var mi=R((rw,hi)=>{"use strict";var pi=vt(),Td=(t,e)=>{let r=pi(t,null,!0),s=pi(e,null,!0),n=r.compare(s);if(n===0)return null;let i=n>0,o=i?r:s,a=i?s:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let d=c?"pre":"";return r.major!==s.major?d+"major":r.minor!==s.minor?d+"minor":r.patch!==s.patch?d+"patch":"prerelease"};hi.exports=Td});var Di=R((sw,gi)=>{"use strict";var Pd=te(),Nd=(t,e)=>new Pd(t,e).major;gi.exports=Nd});var wi=R((nw,yi)=>{"use strict";var Ld=te(),Md=(t,e)=>new Ld(t,e).minor;yi.exports=Md});var xi=R((iw,Ei)=>{"use strict";var jd=te(),Bd=(t,e)=>new jd(t,e).patch;Ei.exports=Bd});var Ci=R((ow,vi)=>{"use strict";var Wd=vt(),qd=(t,e)=>{let r=Wd(t,e);return r&&r.prerelease.length?r.prerelease:null};vi.exports=qd});var Ee=R((aw,Fi)=>{"use strict";var bi=te(),Ud=(t,e,r)=>new bi(t,r).compare(new bi(e,r));Fi.exports=Ud});var Si=R((cw,Ri)=>{"use strict";var zd=Ee(),Vd=(t,e,r)=>zd(e,t,r);Ri.exports=Vd});var Ai=R((uw,_i)=>{"use strict";var Gd=Ee(),Hd=(t,e)=>Gd(t,e,!0);_i.exports=Hd});var qr=R((lw,Ii)=>{"use strict";var $i=te(),Jd=(t,e,r)=>{let s=new $i(t,r),n=new $i(e,r);return s.compare(n)||s.compareBuild(n)};Ii.exports=Jd});var ki=R((dw,Oi)=>{"use strict";var Zd=qr(),Yd=(t,e)=>t.sort((r,s)=>Zd(r,s,e));Oi.exports=Yd});var Pi=R((fw,Ti)=>{"use strict";var Xd=qr(),Kd=(t,e)=>t.sort((r,s)=>Xd(s,r,e));Ti.exports=Kd});var fr=R((pw,Ni)=>{"use strict";var Qd=Ee(),ef=(t,e,r)=>Qd(t,e,r)>0;Ni.exports=ef});var Ur=R((hw,Li)=>{"use strict";var tf=Ee(),rf=(t,e,r)=>tf(t,e,r)<0;Li.exports=rf});var Rs=R((mw,Mi)=>{"use strict";var sf=Ee(),nf=(t,e,r)=>sf(t,e,r)===0;Mi.exports=nf});var Ss=R((gw,ji)=>{"use strict";var of=Ee(),af=(t,e,r)=>of(t,e,r)!==0;ji.exports=af});var zr=R((Dw,Bi)=>{"use strict";var cf=Ee(),uf=(t,e,r)=>cf(t,e,r)>=0;Bi.exports=uf});var Vr=R((yw,Wi)=>{"use strict";var lf=Ee(),df=(t,e,r)=>lf(t,e,r)<=0;Wi.exports=df});var _s=R((ww,qi)=>{"use strict";var ff=Rs(),pf=Ss(),hf=fr(),mf=zr(),gf=Ur(),Df=Vr(),yf=(t,e,r,s)=>{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 ff(t,r,s);case"!=":return pf(t,r,s);case">":return hf(t,r,s);case">=":return mf(t,r,s);case"<":return gf(t,r,s);case"<=":return Df(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};qi.exports=yf});var zi=R((Ew,Ui)=>{"use strict";var wf=te(),Ef=vt(),{safeRe:Gr,t:Hr}=Bt(),xf=(t,e)=>{if(t instanceof wf)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?Gr[Hr.COERCEFULL]:Gr[Hr.COERCE]);else{let c=e.includePrerelease?Gr[Hr.COERCERTLFULL]:Gr[Hr.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Ef(`${s}.${n}.${i}${o}${a}`,e)};Ui.exports=xf});var Gi=R((xw,Vi)=>{"use strict";var As=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 n=this.map.keys().next().value;this.delete(n)}this.map.set(e,r)}return this}};Vi.exports=As});var xe=R((vw,Yi)=>{"use strict";var vf=/\s+/g,$s=class t{constructor(e,r){if(r=bf(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Is)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(vf," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!Ji(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&If(n[0])){this.set=[n];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 s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let s=((this.options.includePrerelease&&Af)|(this.options.loose&&$f))+":"+e,n=Hi.get(s);if(n)return n;let i=this.options.loose,o=i?ne[re.HYPHENRANGELOOSE]:ne[re.HYPHENRANGE];e=e.replace(o,Wf(this.options.includePrerelease)),W("hyphen replace",e),e=e.replace(ne[re.COMPARATORTRIM],Rf),W("comparator trim",e),e=e.replace(ne[re.TILDETRIM],Sf),W("tilde trim",e),e=e.replace(ne[re.CARETTRIM],_f),W("caret trim",e);let a=e.split(" ").map(h=>Of(h,this.options)).join(" ").split(/\s+/).map(h=>Bf(h,this.options));i&&(a=a.filter(h=>(W("loose invalid filter",h,this.options),!!h.match(ne[re.COMPARATORLOOSE])))),W("range list",a);let c=new Map,u=a.map(h=>new Is(h,this.options));for(let h of u){if(Ji(h))return[h];c.set(h.value,h)}c.size>1&&c.has("")&&c.delete("");let d=[...c.values()];return Hi.set(s,d),d}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>Zi(s,r)&&e.set.some(n=>Zi(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Ff(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(qf(this.set[r],e,this.options))return!0;return!1}};Yi.exports=$s;var Cf=Gi(),Hi=new Cf,bf=Lr(),Is=pr(),W=dr(),Ff=te(),{safeRe:ne,t:re,comparatorTrimReplace:Rf,tildeTrimReplace:Sf,caretTrimReplace:_f}=Bt(),{FLAG_INCLUDE_PRERELEASE:Af,FLAG_LOOSE:$f}=lr(),Ji=t=>t.value==="<0.0.0-0",If=t=>t.value==="",Zi=(t,e)=>{let r=!0,s=t.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,e)),n=s.pop();return r},Of=(t,e)=>(t=t.replace(ne[re.BUILD],""),W("comp",t,e),t=Pf(t,e),W("caret",t),t=kf(t,e),W("tildes",t),t=Lf(t,e),W("xrange",t),t=jf(t,e),W("stars",t),t),ie=t=>!t||t.toLowerCase()==="x"||t==="*",kf=(t,e)=>t.trim().split(/\s+/).map(r=>Tf(r,e)).join(" "),Tf=(t,e)=>{let r=e.loose?ne[re.TILDELOOSE]:ne[re.TILDE];return t.replace(r,(s,n,i,o,a)=>{W("tilde",t,s,n,i,o,a);let c;return ie(n)?c="":ie(i)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:ie(o)?c=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(W("replaceTilde pr",a),c=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):c=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,W("tilde return",c),c})},Pf=(t,e)=>t.trim().split(/\s+/).map(r=>Nf(r,e)).join(" "),Nf=(t,e)=>{W("caret",t,e);let r=e.loose?ne[re.CARETLOOSE]:ne[re.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(n,i,o,a,c)=>{W("caret",t,n,i,o,a,c);let u;return ie(i)?u="":ie(o)?u=`>=${i}.0.0${s} <${+i+1}.0.0-0`:ie(a)?i==="0"?u=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:c?(W("replaceCaret pr",c),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(W("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),W("caret return",u),u})},Lf=(t,e)=>(W("replaceXRanges",t,e),t.split(/\s+/).map(r=>Mf(r,e)).join(" ")),Mf=(t,e)=>{t=t.trim();let r=e.loose?ne[re.XRANGELOOSE]:ne[re.XRANGE];return t.replace(r,(s,n,i,o,a,c)=>{W("xRange",t,s,n,i,o,a,c);let u=ie(i),d=u||ie(o),h=d||ie(a),p=h;return n==="="&&p&&(n=""),c=e.includePrerelease?"-0":"",u?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&p?(d&&(o=0),a=0,n===">"?(n=">=",d?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",d?i=+i+1:o=+o+1),n==="<"&&(c="-0"),s=`${n+i}.${o}.${a}${c}`):d?s=`>=${i}.0.0${c} <${+i+1}.0.0-0`:h&&(s=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),W("xRange return",s),s})},jf=(t,e)=>(W("replaceStars",t,e),t.trim().replace(ne[re.STAR],"")),Bf=(t,e)=>(W("replaceGTE0",t,e),t.trim().replace(ne[e.includePrerelease?re.GTE0PRE:re.GTE0],"")),Wf=t=>(e,r,s,n,i,o,a,c,u,d,h,p)=>(ie(s)?r="":ie(n)?r=`>=${s}.0.0${t?"-0":""}`:ie(i)?r=`>=${s}.${n}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,ie(u)?c="":ie(d)?c=`<${+u+1}.0.0-0`:ie(h)?c=`<${u}.${+d+1}.0-0`:p?c=`<=${u}.${d}.${h}-${p}`:t?c=`<${u}.${d}.${+h+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),qf=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(W(t[s].semver),t[s].semver!==Is.ANY&&t[s].semver.prerelease.length>0){let n=t[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var pr=R((Cw,ro)=>{"use strict";var hr=Symbol("SemVer ANY"),Ts=class t{static get ANY(){return hr}constructor(e,r){if(r=Xi(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),ks("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===hr?this.value="":this.value=this.operator+this.semver.version,ks("comp",this)}parse(e){let r=this.options.loose?Ki[Qi.COMPARATORLOOSE]:Ki[Qi.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new eo(s[2],this.options.loose):this.semver=hr}toString(){return this.value}test(e){if(ks("Comparator.test",e,this.options.loose),this.semver===hr||e===hr)return!0;if(typeof e=="string")try{e=new eo(e,this.options)}catch{return!1}return Os(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 to(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new to(this.value,r).test(e.semver):(r=Xi(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("=")||Os(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Os(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};ro.exports=Ts;var Xi=Lr(),{safeRe:Ki,t:Qi}=Bt(),Os=_s(),ks=dr(),eo=te(),to=xe()});var mr=R((bw,so)=>{"use strict";var Uf=xe(),zf=(t,e,r)=>{try{e=new Uf(e,r)}catch{return!1}return e.test(t)};so.exports=zf});var io=R((Fw,no)=>{"use strict";var Vf=xe(),Gf=(t,e)=>new Vf(t,e).set.map(r=>r.map(s=>s.value).join(" ").trim().split(" "));no.exports=Gf});var ao=R((Rw,oo)=>{"use strict";var Hf=te(),Jf=xe(),Zf=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Jf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===-1)&&(s=o,n=new Hf(s,r))}),s};oo.exports=Zf});var uo=R((Sw,co)=>{"use strict";var Yf=te(),Xf=xe(),Kf=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Xf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===1)&&(s=o,n=new Yf(s,r))}),s};co.exports=Kf});var po=R((_w,fo)=>{"use strict";var Ps=te(),Qf=xe(),lo=fr(),ep=(t,e)=>{t=new Qf(t,e);let r=new Ps("0.0.0");if(t.test(r)||(r=new Ps("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let n=t.set[s],i=null;n.forEach(o=>{let a=new Ps(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||lo(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||lo(r,i))&&(r=i)}return r&&t.test(r)?r:null};fo.exports=ep});var mo=R((Aw,ho)=>{"use strict";var tp=xe(),rp=(t,e)=>{try{return new tp(t,e).range||"*"}catch{return null}};ho.exports=rp});var Jr=R(($w,wo)=>{"use strict";var sp=te(),yo=pr(),{ANY:np}=yo,ip=xe(),op=mr(),go=fr(),Do=Ur(),ap=Vr(),cp=zr(),up=(t,e,r,s)=>{t=new sp(t,s),e=new ip(e,s);let n,i,o,a,c;switch(r){case">":n=go,i=ap,o=Do,a=">",c=">=";break;case"<":n=Do,i=cp,o=go,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(op(t,e,s))return!1;for(let u=0;u<e.set.length;++u){let d=e.set[u],h=null,p=null;if(d.forEach(l=>{l.semver===np&&(l=new yo(">=0.0.0")),h=h||l,p=p||l,n(l.semver,h.semver,s)?h=l:o(l.semver,p.semver,s)&&(p=l)}),h.operator===a||h.operator===c||(!p.operator||p.operator===a)&&i(t,p.semver))return!1;if(p.operator===c&&o(t,p.semver))return!1}return!0};wo.exports=up});var xo=R((Iw,Eo)=>{"use strict";var lp=Jr(),dp=(t,e,r)=>lp(t,e,">",r);Eo.exports=dp});var Co=R((Ow,vo)=>{"use strict";var fp=Jr(),pp=(t,e,r)=>fp(t,e,"<",r);vo.exports=pp});var Ro=R((kw,Fo)=>{"use strict";var bo=xe(),hp=(t,e,r)=>(t=new bo(t,r),e=new bo(e,r),t.intersects(e,r));Fo.exports=hp});var _o=R((Tw,So)=>{"use strict";var mp=mr(),gp=Ee();So.exports=(t,e,r)=>{let s=[],n=null,i=null,o=t.sort((d,h)=>gp(d,h,r));for(let d of o)mp(d,e,r)?(i=d,n||(n=d)):(i&&s.push([n,i]),i=null,n=null);n&&s.push([n,null]);let a=[];for(let[d,h]of s)d===h?a.push(d):!h&&d===o[0]?a.push("*"):h?d===o[0]?a.push(`<=${h}`):a.push(`${d} - ${h}`):a.push(`>=${d}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length<u.length?c:e}});var To=R((Pw,ko)=>{"use strict";var Ao=xe(),Ls=pr(),{ANY:Ns}=Ls,gr=mr(),Ms=Ee(),Dp=(t,e,r={})=>{if(t===e)return!0;t=new Ao(t,r),e=new Ao(e,r);let s=!1;e:for(let n of t.set){for(let i of e.set){let o=wp(n,i,r);if(s=s||o!==null,o)continue e}if(s)return!1}return!0},yp=[new Ls(">=0.0.0-0")],$o=[new Ls(">=0.0.0")],wp=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Ns){if(e.length===1&&e[0].semver===Ns)return!0;r.includePrerelease?t=yp:t=$o}if(e.length===1&&e[0].semver===Ns){if(r.includePrerelease)return!0;e=$o}let s=new Set,n,i;for(let l of t)l.operator===">"||l.operator===">="?n=Io(n,l,r):l.operator==="<"||l.operator==="<="?i=Oo(i,l,r):s.add(l.semver);if(s.size>1)return null;let o;if(n&&i){if(o=Ms(n.semver,i.semver,r),o>0)return null;if(o===0&&(n.operator!==">="||i.operator!=="<="))return null}for(let l of s){if(n&&!gr(l,String(n),r)||i&&!gr(l,String(i),r))return null;for(let g of e)if(!gr(l,String(g),r))return!1;return!0}let a,c,u,d,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,p=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;h&&h.prerelease.length===1&&i.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let l of e){if(d=d||l.operator===">"||l.operator===">=",u=u||l.operator==="<"||l.operator==="<=",n){if(p&&l.semver.prerelease&&l.semver.prerelease.length&&l.semver.major===p.major&&l.semver.minor===p.minor&&l.semver.patch===p.patch&&(p=!1),l.operator===">"||l.operator===">="){if(a=Io(n,l,r),a===l&&a!==n)return!1}else if(n.operator===">="&&!gr(n.semver,String(l),r))return!1}if(i){if(h&&l.semver.prerelease&&l.semver.prerelease.length&&l.semver.major===h.major&&l.semver.minor===h.minor&&l.semver.patch===h.patch&&(h=!1),l.operator==="<"||l.operator==="<="){if(c=Oo(i,l,r),c===l&&c!==i)return!1}else if(i.operator==="<="&&!gr(i.semver,String(l),r))return!1}if(!l.operator&&(i||n)&&o!==0)return!1}return!(n&&u&&!i&&o!==0||i&&d&&!n&&o!==0||p||h)},Io=(t,e,r)=>{if(!t)return e;let s=Ms(t.semver,e.semver,r);return s>0?t:s<0||e.operator===">"&&t.operator===">="?e:t},Oo=(t,e,r)=>{if(!t)return e;let s=Ms(t.semver,e.semver,r);return s<0?t:s>0||e.operator==="<"&&t.operator==="<="?e:t};ko.exports=Dp});var Bs=R((Nw,Lo)=>{"use strict";var js=Bt(),Po=lr(),Ep=te(),No=Cs(),xp=vt(),vp=ai(),Cp=ui(),bp=fi(),Fp=mi(),Rp=Di(),Sp=wi(),_p=xi(),Ap=Ci(),$p=Ee(),Ip=Si(),Op=Ai(),kp=qr(),Tp=ki(),Pp=Pi(),Np=fr(),Lp=Ur(),Mp=Rs(),jp=Ss(),Bp=zr(),Wp=Vr(),qp=_s(),Up=zi(),zp=pr(),Vp=xe(),Gp=mr(),Hp=io(),Jp=ao(),Zp=uo(),Yp=po(),Xp=mo(),Kp=Jr(),Qp=xo(),eh=Co(),th=Ro(),rh=_o(),sh=To();Lo.exports={parse:xp,valid:vp,clean:Cp,inc:bp,diff:Fp,major:Rp,minor:Sp,patch:_p,prerelease:Ap,compare:$p,rcompare:Ip,compareLoose:Op,compareBuild:kp,sort:Tp,rsort:Pp,gt:Np,lt:Lp,eq:Mp,neq:jp,gte:Bp,lte:Wp,cmp:qp,coerce:Up,Comparator:zp,Range:Vp,satisfies:Gp,toComparators:Hp,maxSatisfying:Jp,minSatisfying:Zp,minVersion:Yp,validRange:Xp,outside:Kp,gtr:Qp,ltr:eh,intersects:th,simplifyRange:rh,subset:sh,SemVer:Ep,re:js.re,src:js.src,tokens:js.t,SEMVER_SPEC_VERSION:Po.SEMVER_SPEC_VERSION,RELEASE_TYPES:Po.RELEASE_TYPES,compareIdentifiers:No.compareIdentifiers,rcompareIdentifiers:No.rcompareIdentifiers}});var as=R((iv,ec)=>{var mn=[],Qa=0,se=(t,e)=>{Qa>=e&&mn.push(t)};se.WARN=1;se.INFO=2;se.DEBUG=3;se.reset=()=>{mn=[]};se.setDebugLevel=t=>{Qa=t};se.warn=t=>se(t,se.WARN);se.info=t=>se(t,se.INFO);se.debug=t=>se(t,se.DEBUG);se.debugMessages=()=>mn;ec.exports=se});var rc=R((ov,tc)=>{"use strict";tc.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var nc=R((av,sc)=>{"use strict";var Zm=rc();sc.exports=t=>typeof t=="string"?t.replace(Zm(),""):t});var oc=R((cv,gn)=>{"use strict";var ic=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);gn.exports=ic;gn.exports.default=ic});var cc=R((uv,ac)=>{"use strict";ac.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var lc=R((lv,Dn)=>{"use strict";var Ym=nc(),Xm=oc(),Km=cc(),uc=t=>{if(typeof t!="string"||t.length===0||(t=Ym(t),t.length===0))return 0;t=t.replace(Km()," ");let e=0;for(let r=0;r<t.length;r++){let s=t.codePointAt(r);s<=31||s>=127&&s<=159||s>=768&&s<=879||(s>65535&&r++,e+=Xm(s)?2:1)}return e};Dn.exports=uc;Dn.exports.default=uc});var yn=R((dv,hc)=>{var dc=lc();function cs(t){return t?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function Pe(t){let e=cs();return(""+t).replace(e,"").split(`
|
|
6
|
+
`).reduce(function(n,i){return dc(i)>n?dc(i):n},0)}function Er(t,e){return Array(e+1).join(t)}function Qm(t,e,r,s){let n=Pe(t);if(e+1>=n){let i=e-n;switch(s){case"right":{t=Er(r,i)+t;break}case"center":{let o=Math.ceil(i/2),a=i-o;t=Er(r,a)+t+Er(r,o);break}default:{t=t+Er(r,i);break}}}return t}var Xt={};function xr(t,e,r){e="\x1B["+e+"m",r="\x1B["+r+"m",Xt[e]={set:t,to:!0},Xt[r]={set:t,to:!1},Xt[t]={on:e,off:r}}xr("bold",1,22);xr("italics",3,23);xr("underline",4,24);xr("inverse",7,27);xr("strikethrough",9,29);function fc(t,e){let r=e[1]?parseInt(e[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){t.lastForegroundAdded=e[0];return}if(r>=40&&r<=49||r>=100&&r<=107){t.lastBackgroundAdded=e[0];return}if(r===0){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&delete t[n];return}let s=Xt[e[0]];s&&(t[s.set]=s.to)}function eg(t){let e=cs(!0),r=e.exec(t),s={};for(;r!==null;)fc(s,r),r=e.exec(t);return s}function pc(t,e){let r=t.lastBackgroundAdded,s=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(n){t[n]&&(e+=Xt[n].off)}),r&&r!="\x1B[49m"&&(e+="\x1B[49m"),s&&s!="\x1B[39m"&&(e+="\x1B[39m"),e}function tg(t,e){let r=t.lastBackgroundAdded,s=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(n){t[n]&&(e=Xt[n].on+e)}),r&&r!="\x1B[49m"&&(e=r+e),s&&s!="\x1B[39m"&&(e=s+e),e}function rg(t,e){if(t.length===Pe(t))return t.substr(0,e);for(;Pe(t)>e;)t=t.slice(0,-1);return t}function sg(t,e){let r=cs(!0),s=t.split(cs()),n=0,i=0,o="",a,c={};for(;i<e;){a=r.exec(t);let u=s[n];if(n++,i+Pe(u)>e&&(u=rg(u,e-i)),o+=u,i+=Pe(u),i<e){if(!a)break;o+=a[0],fc(c,a)}}return pc(c,o)}function ng(t,e,r){if(r=r||"\u2026",Pe(t)<=e)return t;e-=Pe(r);let n=sg(t,e);n+=r;let i="\x1B]8;;\x07";return t.includes(i)&&!n.includes(i)&&(n+=i),n}function ig(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function og(t,e){t=t||{},e=e||ig();let r=Object.assign({},e,t);return r.chars=Object.assign({},e.chars,t.chars),r.style=Object.assign({},e.style,t.style),r}function ag(t,e){let r=[],s=e.split(/(\s+)/g),n=[],i=0,o;for(let a=0;a<s.length;a+=2){let c=s[a],u=i+Pe(c);i>0&&o&&(u+=o.length),u>t?(i!==0&&r.push(n.join("")),n=[c],i=Pe(c)):(n.push(o||"",c),i=u),o=s[a+1]}return i&&r.push(n.join("")),r}function cg(t,e){let r=[],s="";function n(o,a){for(s.length&&a&&(s+=a),s+=o;s.length>t;)r.push(s.slice(0,t)),s=s.slice(t)}let i=e.split(/(\s+)/g);for(let o=0;o<i.length;o+=2)n(i[o],o&&i[o-1]);return s.length&&r.push(s),r}function ug(t,e,r=!0){let s=[];e=e.split(`
|
|
7
|
+
`);let n=r?ag:cg;for(let i=0;i<e.length;i++)s.push.apply(s,n(t,e[i]));return s}function lg(t){let e={},r=[];for(let s=0;s<t.length;s++){let n=tg(e,t[s]);e=eg(n);let i=Object.assign({},e);r.push(pc(i,n))}return r}function dg(t,e){return["\x1B]","8",";",";",t||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}hc.exports={strlen:Pe,repeat:Er,pad:Qm,truncate:ng,mergeOptions:og,wordWrap:ug,colorizeLines:lg,hyperlink:dg}});var yc=R((fv,Dc)=>{var gc={};Dc.exports=gc;var mc={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(mc).forEach(function(t){var e=mc[t],r=gc[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var Ec=R((pv,wc)=>{"use strict";wc.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),s=/^-{1,2}/.test(t)?"":"--",n=e.indexOf(s+t);return n!==-1&&(r===-1?!0:n<r)}});var vc=R((hv,xc)=>{"use strict";var fg=On("os"),Ae=Ec(),oe=process.env,Kt=void 0;Ae("no-color")||Ae("no-colors")||Ae("color=false")?Kt=!1:(Ae("color")||Ae("colors")||Ae("color=true")||Ae("color=always"))&&(Kt=!0);"FORCE_COLOR"in oe&&(Kt=oe.FORCE_COLOR.length===0||parseInt(oe.FORCE_COLOR,10)!==0);function pg(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function hg(t){if(Kt===!1)return 0;if(Ae("color=16m")||Ae("color=full")||Ae("color=truecolor"))return 3;if(Ae("color=256"))return 2;if(t&&!t.isTTY&&Kt!==!0)return 0;var e=Kt?1:0;if(process.platform==="win32"){var r=fg.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in oe)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(n){return n in oe})||oe.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in oe)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(oe.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in oe){var s=parseInt((oe.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(oe.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(oe.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(oe.TERM)||"COLORTERM"in oe?1:(oe.TERM==="dumb",e)}function wn(t){var e=hg(t);return pg(e)}xc.exports={supportsColor:wn,stdout:wn(process.stdout),stderr:wn(process.stderr)}});var bc=R((mv,Cc)=>{Cc.exports=function(e,r){var s="";e=e||"Run the trap, drop the bass",e=e.split("");var n={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(i){i=i.toLowerCase();var o=n[i]||[" "],a=Math.floor(Math.random()*o.length);typeof n[i]<"u"?s+=n[i][a]:s+=i}),s}});var Rc=R((gv,Fc)=>{Fc.exports=function(e,r){e=e||" he is here ";var s={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},n=[].concat(s.up,s.down,s.mid);function i(c){var u=Math.floor(Math.random()*c);return u}function o(c){var u=!1;return n.filter(function(d){u=d===c}),u}function a(c,u){var d="",h,p;u=u||{},u.up=typeof u.up<"u"?u.up:!0,u.mid=typeof u.mid<"u"?u.mid:!0,u.down=typeof u.down<"u"?u.down:!0,u.size=typeof u.size<"u"?u.size:"maxi",c=c.split("");for(p in c)if(!o(p)){switch(d=d+c[p],h={up:0,down:0,mid:0},u.size){case"mini":h.up=i(8),h.mid=i(2),h.down=i(8);break;case"maxi":h.up=i(16)+3,h.mid=i(4)+1,h.down=i(64)+3;break;default:h.up=i(8)+1,h.mid=i(6)/2,h.down=i(8)+1;break}var l=["up","mid","down"];for(var g in l)for(var w=l[g],x=0;x<=h[w];x++)u[w]&&(d=d+s[w][i(s[w].length)])}return d}return a(e,r)}});var _c=R((Dv,Sc)=>{Sc.exports=function(t){return function(e,r,s){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var $c=R((yv,Ac)=>{Ac.exports=function(t){return function(e,r,s){return r%2===0?e:t.inverse(e)}}});var Oc=R((wv,Ic)=>{Ic.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,s,n){return r===" "?r:t[e[s++%e.length]](r)}}});var Tc=R((Ev,kc)=>{kc.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,s,n){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var Bc=R((vv,jc)=>{var j={};jc.exports=j;j.themes={};var mg=On("util"),St=j.styles=yc(),Nc=Object.defineProperties,gg=new RegExp(/[\r\n]+/g);j.supportsColor=vc().supportsColor;typeof j.enabled>"u"&&(j.enabled=j.supportsColor()!==!1);j.enable=function(){j.enabled=!0};j.disable=function(){j.enabled=!1};j.stripColors=j.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var xv=j.stylize=function(e,r){if(!j.enabled)return e+"";var s=St[r];return!s&&r in j?j[r](e):s.open+e+s.close},Dg=/[|\\{}()[\]^$+*?.]/g,yg=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Dg,"\\$&")};function Lc(t){var e=function r(){return Eg.apply(r,arguments)};return e._styles=t,e.__proto__=wg,e}var Mc=(function(){var t={};return St.grey=St.gray,Object.keys(St).forEach(function(e){St[e].closeRe=new RegExp(yg(St[e].close),"g"),t[e]={get:function(){return Lc(this._styles.concat(e))}}}),t})(),wg=Nc(function(){},Mc);function Eg(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:mg.inspect(o)}).join(" ");if(!j.enabled||!e)return e;for(var r=e.indexOf(`
|
|
8
|
+
`)!=-1,s=this._styles,n=s.length;n--;){var i=St[s[n]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(gg,function(o){return i.close+o+i.open}))}return e}j.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){j[r]=function(s){if(typeof t[r]=="object"){var n=s;for(var i in t[r])n=j[t[r][i]](n);return n}return j[t[r]](s)}})(e)};function xg(){var t={};return Object.keys(Mc).forEach(function(e){t[e]={get:function(){return Lc([e])}}}),t}var vg=function(e,r){var s=r.split("");return s=s.map(e),s.join("")};j.trap=bc();j.zalgo=Rc();j.maps={};j.maps.america=_c()(j);j.maps.zebra=$c()(j);j.maps.rainbow=Oc()(j);j.maps.random=Tc()(j);for(Pc in j.maps)(function(t){j[t]=function(e){return vg(j.maps[t],e)}})(Pc);var Pc;Nc(j,xg())});var qc=R((Cv,Wc)=>{var Cg=Bc();Wc.exports=Cg});var Gc=R((bv,us)=>{var{info:bg,debug:Vc}=as(),me=yn(),xn=class t{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","bigint","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let r=e.content;if(["boolean","number","bigint","string"].indexOf(typeof r)!==-1)this.content=String(r);else if(!r)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof r);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,r){this.cells=r;let s=this.options.chars||{},n=e.chars,i=this.chars={};Rg.forEach(function(c){En(s,n,c,i)}),this.truncate=this.options.truncate||e.truncate;let o=this.options.style=this.options.style||{},a=e.style;En(o,a,"padding-left",this),En(o,a,"padding-right",this),this.head=o.head||a.head,this.border=o.border||a.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=me.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){let r=e.wordWrap||e.textWrap,{wordWrap:s=r}=this.options;if(this.fixedWidth&&s){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let o=1;for(;o<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+o],o++}let{wrapOnWordBoundary:n=!0}=e,{wrapOnWordBoundary:i=n}=this.options;return this.wrapLines(me.wordWrap(this.fixedWidth,this.content,i))}return this.wrapLines(this.content.split(`
|
|
9
|
+
`))}wrapLines(e){let r=me.colorizeLines(e);return this.href?r.map(s=>me.hyperlink(this.href,s)):r}init(e){let r=this.x,s=this.y;this.widths=e.colWidths.slice(r,r+this.colSpan),this.heights=e.rowHeights.slice(s,s+this.rowSpan),this.width=this.widths.reduce(zc,-1),this.height=this.heights.reduce(zc,-1),this.hAlign=this.options.hAlign||e.colAligns[r],this.vAlign=this.options.vAlign||e.rowAligns[s],this.drawRight=r+this.colSpan==e.colWidths.length}draw(e,r){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let s=me.truncate(this.content,10,this.truncate);e||bg(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${s}`);let n=Math.max(this.height-this.lines.length,0),i;switch(this.vAlign){case"center":i=Math.ceil(n/2);break;case"bottom":i=n;break;default:i=0}if(e<i||e>=i+this.lines.length)return this.drawEmpty(this.drawRight,r);let o=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-i,this.drawRight,o,r)}drawTop(e){let r=[];return this.cells?this.widths.forEach(function(s,n){r.push(this._topLeftChar(n)),r.push(me.repeat(this.chars[this.y==0?"top":"mid"],s))},this):(r.push(this._topLeftChar(0)),r.push(me.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&r.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",r.join(""))}_topLeftChar(e){let r=this.x+e,s;if(this.y==0)s=r==0?"topLeft":e==0?"topMid":"top";else if(r==0)s="leftMid";else if(s=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][r]instanceof t.ColSpanCell&&(s=e==0?"topMid":"mid"),e==0)){let i=1;for(;this.cells[this.y][r-i]instanceof t.ColSpanCell;)i++;this.cells[this.y][r-i]instanceof t.RowSpanCell&&(s="leftMid")}return this.chars[s]}wrapWithStyleColors(e,r){if(this[e]&&this[e].length)try{let s=qc();for(let n=this[e].length-1;n>=0;n--)s=s[this[e][n]];return s(r)}catch{return r}else return r}drawLine(e,r,s,n){let i=this.chars[this.x==0?"left":"middle"];if(this.x&&n&&this.cells){let p=this.cells[this.y+n][this.x-1];for(;p instanceof vr;)p=this.cells[p.y][p.x-1];p instanceof Cr||(i=this.chars.rightMid)}let o=me.repeat(" ",this.paddingLeft),a=r?this.chars.right:"",c=me.repeat(" ",this.paddingRight),u=this.lines[e],d=this.width-(this.paddingLeft+this.paddingRight);s&&(u+=this.truncate||"\u2026");let h=me.truncate(u,d,this.truncate);return h=me.pad(h,d," ",this.hAlign),h=o+h+c,this.stylizeLine(i,h,a)}stylizeLine(e,r,s){return e=this.wrapWithStyleColors("border",e),s=this.wrapWithStyleColors("border",s),this.y===0&&(r=this.wrapWithStyleColors("head",r)),e+r+s}drawBottom(e){let r=this.chars[this.x==0?"bottomLeft":"bottomMid"],s=me.repeat(this.chars.bottom,this.width),n=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",r+s+n)}drawEmpty(e,r){let s=this.chars[this.x==0?"left":"middle"];if(this.x&&r&&this.cells){let o=this.cells[this.y+r][this.x-1];for(;o instanceof vr;)o=this.cells[o.y][o.x-1];o instanceof Cr||(s=this.chars.rightMid)}let n=e?this.chars.right:"",i=me.repeat(" ",this.width);return this.stylizeLine(s,i,n)}},vr=class{constructor(){}draw(e){return typeof e=="number"&&Vc(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},Cr=class{constructor(e){this.originalCell=e}init(e){let r=this.y,s=this.originalCell.y;this.cellOffset=r-s,this.offset=Fg(e.rowHeights,s,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(Vc(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}};function Uc(...t){return t.filter(e=>e!=null).shift()}function En(t,e,r,s){let n=r.split("-");n.length>1?(n[1]=n[1].charAt(0).toUpperCase()+n[1].substr(1),n=n.join(""),s[n]=Uc(t[n],t[r],e[n],e[r])):s[r]=Uc(t[r],e[r])}function Fg(t,e,r){let s=t[e];for(let n=1;n<r;n++)s+=1+t[e+n];return s}function zc(t,e){return t+e+1}var Rg=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];us.exports=xn;us.exports.ColSpanCell=vr;us.exports.RowSpanCell=Cr});var Zc=R((Fv,Jc)=>{var{warn:Sg,debug:_g}=as(),vn=Gc(),{ColSpanCell:Ag,RowSpanCell:$g}=vn;(function(){function t(l,g){return l[g]>0?t(l,g+1):g}function e(l){let g={};l.forEach(function(w,x){let A=0;w.forEach(function($){$.y=x,$.x=x?t(g,A):A;let L=$.rowSpan||1,q=$.colSpan||1;if(L>1)for(let U=0;U<q;U++)g[$.x+U]=L;A=$.x+q}),Object.keys(g).forEach($=>{g[$]--,g[$]<1&&delete g[$]})})}function r(l){let g=0;return l.forEach(function(w){w.forEach(function(x){g=Math.max(g,x.x+(x.colSpan||1))})}),g}function s(l){return l.length}function n(l,g){let w=l.y,x=l.y-1+(l.rowSpan||1),A=g.y,$=g.y-1+(g.rowSpan||1),L=!(w>$||A>x),q=l.x,U=l.x-1+(l.colSpan||1),Le=g.x,N=g.x-1+(g.colSpan||1),G=!(q>N||Le>U);return L&&G}function i(l,g,w){let x=Math.min(l.length-1,w),A={x:g,y:w};for(let $=0;$<=x;$++){let L=l[$];for(let q=0;q<L.length;q++)if(n(A,L[q]))return!0}return!1}function o(l,g,w,x){for(let A=w;A<x;A++)if(i(l,A,g))return!1;return!0}function a(l){l.forEach(function(g,w){g.forEach(function(x){for(let A=1;A<x.rowSpan;A++){let $=new $g(x);$.x=x.x,$.y=x.y+A,$.colSpan=x.colSpan,u($,l[w+A])}})})}function c(l){for(let g=l.length-1;g>=0;g--){let w=l[g];for(let x=0;x<w.length;x++){let A=w[x];for(let $=1;$<A.colSpan;$++){let L=new Ag;L.x=A.x+$,L.y=A.y,w.splice(x+1,0,L)}}}}function u(l,g){let w=0;for(;w<g.length&&g[w].x<l.x;)w++;g.splice(w,0,l)}function d(l){let g=s(l),w=r(l);_g(`Max rows: ${g}; Max cols: ${w}`);for(let x=0;x<g;x++)for(let A=0;A<w;A++)if(!i(l,A,x)){let $={x:A,y:x,colSpan:1,rowSpan:1};for(A++;A<w&&!i(l,A,x);)$.colSpan++,A++;let L=x+1;for(;L<g&&o(l,L,$.x,$.x+$.colSpan);)$.rowSpan++,L++;let q=new vn($);q.x=$.x,q.y=$.y,Sg(`Missing cell at ${q.y}-${q.x}.`),u(q,l[x])}}function h(l){return l.map(function(g){if(!Array.isArray(g)){let w=Object.keys(g)[0];g=g[w],Array.isArray(g)?(g=g.slice(),g.unshift(w)):g=[w,g]}return g.map(function(w){return new vn(w)})})}function p(l){let g=h(l);return e(g),d(g),a(g),c(g),g}Jc.exports={makeTableLayout:p,layoutTable:e,addRowSpanCells:a,maxWidth:r,fillInTable:d,computeWidths:Hc("colSpan","desiredWidth","x",1),computeHeights:Hc("rowSpan","desiredHeight","y",1)}})();function Hc(t,e,r,s){return function(n,i){let o=[],a=[],c={};i.forEach(function(u){u.forEach(function(d){(d[t]||1)>1?a.push(d):o[d[r]]=Math.max(o[d[r]]||0,d[e]||0,s)})}),n.forEach(function(u,d){typeof u=="number"&&(o[d]=u)});for(let u=a.length-1;u>=0;u--){let d=a[u],h=d[t],p=d[r],l=o[p],g=typeof n[p]=="number"?0:1;if(typeof l=="number")for(let w=1;w<h;w++)l+=1+o[p+w],typeof n[p+w]!="number"&&g++;else l=e==="desiredWidth"?d.desiredWidth-1:1,(!c[p]||c[p]<l)&&(c[p]=l);if(d[e]>l){let w=0;for(;g>0&&d[e]>l;){if(typeof n[p+w]!="number"){let x=Math.round((d[e]-l)/g);l+=x,o[p+w]+=x,g--}w++}}}Object.assign(n,o,c);for(let u=0;u<n.length;u++)n[u]=Math.max(s,n[u]||0)}}});var Xc=R((Rv,Yc)=>{var Ve=as(),Ig=yn(),Cn=Zc(),ls=class extends Array{constructor(e){super();let r=Ig.mergeOptions(e);if(Object.defineProperty(this,"options",{value:r,enumerable:r.debug}),r.debug){switch(typeof r.debug){case"boolean":Ve.setDebugLevel(Ve.WARN);break;case"number":Ve.setDebugLevel(r.debug);break;case"string":Ve.setDebugLevel(parseInt(r.debug,10));break;default:Ve.setDebugLevel(Ve.WARN),Ve.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof r.debug}`)}Object.defineProperty(this,"messages",{get(){return Ve.debugMessages()}})}}toString(){let e=this,r=this.options.head&&this.options.head.length;r?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let s=Cn.makeTableLayout(e);s.forEach(function(i){i.forEach(function(o){o.mergeTableOptions(this.options,s)},this)},this),Cn.computeWidths(this.options.colWidths,s),Cn.computeHeights(this.options.rowHeights,s),s.forEach(function(i){i.forEach(function(o){o.init(this.options)},this)},this);let n=[];for(let i=0;i<s.length;i++){let o=s[i],a=this.options.rowHeights[i];(i===0||!this.options.style.compact||i==1&&r)&&bn(o,"top",n);for(let c=0;c<a;c++)bn(o,c,n);i+1==s.length&&bn(o,"bottom",n)}return n.join(`
|
|
10
10
|
`)}get width(){return this.toString().split(`
|
|
11
|
-
`)[0].length}};ls.reset=()=>Ve.reset();function bn(t,e,r){let s=[];t.forEach(function(i){s.push(i.draw(e))});let n=s.join("");n.length&&r.push(n)}Xc.exports=ls});var Cr=R((Sv,Qc)=>{Qc.exports=Kc()});import{command as Fe,subcommands as pD,run as hD,positional as sr,option as In,string as Ge,optional as Fr,flag as On}from"cmd-ts";import{writeFile as ta,mkdir as ra,rm as sa}from"node:fs/promises";import na from"ora";import{access as ch,constants as uh,readFile as zo}from"node:fs/promises";import{join as Bt}from"node:path";import{homedir as lh}from"node:os";import{select as dh}from"@inquirer/prompts";import At from"chalk";var D={SUCCESS:0,VALIDATION_ERROR:1,IO_ERROR:2,DEPENDENCY_ERROR:3,AUTHENTICATION_ERROR:4,USER_CANCELLED:130},m=class t extends Error{constructor(r,s){super(r);this.exitCode=s;this.name="CLIError",Error.captureStackTrace(this,t)}};function hs(t,e){let r=At.red("Error:"),s=e?` ${At.yellow(e)} failed:`:"";return`${r}${s} ${t.message}`}function $t(t){return`${At.yellow("Warning:")} ${t}`}function K(t){return At.dim(t)}function S(t){return At.cyan(t)}function H(t){return At.cyan.bold(t)}function Tn(t){return t instanceof m?t.exitCode:D.VALIDATION_ERROR}import{promises as Xe}from"node:fs";import Ke from"node:path";import ar from"fs-extra";var f={};Tu(f,{BRAND:()=>al,DIRTY:()=>nt,EMPTY_PATH:()=>ju,INVALID:()=>I,NEVER:()=>Vl,OK:()=>ee,ParseStatus:()=>Q,Schema:()=>P,ZodAny:()=>Ze,ZodArray:()=>qe,ZodBigInt:()=>ot,ZodBoolean:()=>at,ZodBranded:()=>ir,ZodCatch:()=>yt,ZodDate:()=>ct,ZodDefault:()=>Dt,ZodDiscriminatedUnion:()=>_r,ZodEffects:()=>we,ZodEnum:()=>mt,ZodError:()=>ce,ZodFirstPartyTypeKind:()=>O,ZodFunction:()=>$r,ZodIntersection:()=>ft,ZodIssueCode:()=>y,ZodLazy:()=>pt,ZodLiteral:()=>ht,ZodMap:()=>Nt,ZodNaN:()=>Mt,ZodNativeEnum:()=>gt,ZodNever:()=>Se,ZodNull:()=>lt,ZodNullable:()=>ke,ZodNumber:()=>it,ZodObject:()=>ue,ZodOptional:()=>De,ZodParsedType:()=>C,ZodPipeline:()=>or,ZodPromise:()=>Ye,ZodReadonly:()=>wt,ZodRecord:()=>Ar,ZodSchema:()=>P,ZodSet:()=>Lt,ZodString:()=>Je,ZodSymbol:()=>Tt,ZodTransformer:()=>we,ZodTuple:()=>Oe,ZodType:()=>P,ZodUndefined:()=>ut,ZodUnion:()=>dt,ZodUnknown:()=>We,ZodVoid:()=>Pt,addIssueToContext:()=>E,any:()=>gl,array:()=>El,bigint:()=>dl,boolean:()=>Vn,coerce:()=>zl,custom:()=>qn,date:()=>fl,datetimeRegex:()=>Bn,defaultErrorMap:()=>je,discriminatedUnion:()=>bl,effect:()=>Nl,enum:()=>kl,function:()=>$l,getErrorMap:()=>It,getParsedType:()=>Ie,instanceof:()=>ul,intersection:()=>Fl,isAborted:()=>Rr,isAsync:()=>Ot,isDirty:()=>Sr,isValid:()=>He,late:()=>cl,lazy:()=>Il,literal:()=>Ol,makeIssue:()=>nr,map:()=>_l,nan:()=>ll,nativeEnum:()=>Tl,never:()=>yl,null:()=>ml,nullable:()=>Ml,number:()=>zn,object:()=>xl,objectUtil:()=>ms,oboolean:()=>Ul,onumber:()=>ql,optional:()=>Ll,ostring:()=>Wl,pipeline:()=>Bl,preprocess:()=>jl,promise:()=>Pl,quotelessJson:()=>Nu,record:()=>Sl,set:()=>Al,setErrorMap:()=>Mu,strictObject:()=>vl,string:()=>Un,symbol:()=>pl,transformer:()=>Nl,tuple:()=>Rl,undefined:()=>hl,union:()=>Cl,unknown:()=>Dl,util:()=>M,void:()=>wl});var M;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},t.getValidEnumValues=n=>{let i=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),o={};for(let a of i)o[a]=n[a];return t.objectValues(o)},t.objectValues=n=>t.objectKeys(n).map(function(i){return n[i]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},t.find=(n,i)=>{for(let o of n)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=s,t.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(M||(M={}));var ms;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ms||(ms={}));var C=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ie=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}};var y=M.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nu=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ce=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},s={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let a=s,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return n(this),s}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};ce.create=t=>new ce(t);var Lu=(t,e)=>{let r;switch(t.code){case y.invalid_type:t.received===C.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,M.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${M.joinValues(t.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${M.joinValues(t.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${M.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:M.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=e.defaultError,M.assertNever(t)}return{message:r}},je=Lu;var Pn=je;function Mu(t){Pn=t}function It(){return Pn}var nr=t=>{let{data:e,path:r,errorMaps:s,issueData:n}=t,i=[...r,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=s.filter(u=>!!u).slice().reverse();for(let u of c)a=u(o,{data:e,defaultError:a}).message;return{...n,path:i,message:a}},ju=[];function E(t,e){let r=It(),s=nr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===je?void 0:je].filter(n=>!!n)});t.common.issues.push(s)}var Q=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let s=[];for(let n of r){if(n.status==="aborted")return I;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let n of r){let i=await n.key,o=await n.value;s.push({key:i,value:o})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let n of r){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return I;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[i.value]=o.value)}return{status:e.value,value:s}}},I=Object.freeze({status:"aborted"}),nt=t=>({status:"dirty",value:t}),ee=t=>({status:"valid",value:t}),Rr=t=>t.status==="aborted",Sr=t=>t.status==="dirty",He=t=>t.status==="valid",Ot=t=>typeof Promise<"u"&&t instanceof Promise;var _;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(_||(_={}));var ye=class{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Nn=(t,e)=>{if(He(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ce(t.common.issues);return this._error=r,this._error}}};function T(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,a)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??s??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var P=class{get description(){return this._def.description}_getType(e){return Ie(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Q,ctx:{common:e.parent.common,data:e.data,parsedType:Ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ot(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){let s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Nn(s,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return He(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>He(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){let s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){let s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(Ot(n)?n:Promise.resolve(n));return Nn(s,i)}refine(e,r){let s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let o=e(n),a=()=>i.addIssue({code:y.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new we({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return De.create(this,this._def)}nullable(){return ke.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return Ye.create(this,this._def)}or(e){return dt.create([this,e],this._def)}and(e){return ft.create(this,e,this._def)}transform(e){return new we({...T(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Dt({...T(this._def),innerType:this,defaultValue:r,typeName:O.ZodDefault})}brand(){return new ir({typeName:O.ZodBranded,type:this,...T(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new yt({...T(this._def),innerType:this,catchValue:r,typeName:O.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return or.create(this,e)}readonly(){return wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bu=/^c[^\s-]{8,}$/i,Wu=/^[0-9a-z]+$/,qu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Uu=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zu=/^[a-z0-9_-]{21}$/i,Vu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ju="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gs,Zu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Yu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Xu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ku=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,el=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tl=new RegExp(`^${Mn}$`);function jn(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function rl(t){return new RegExp(`^${jn(t)}$`)}function Bn(t){let e=`${Mn}T${jn(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function sl(t,e){return!!((e==="v4"||!e)&&Zu.test(t)||(e==="v6"||!e)&&Xu.test(t))}function nl(t,e){if(!Vu.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function il(t,e){return!!((e==="v4"||!e)&&Yu.test(t)||(e==="v6"||!e)&&Ku.test(t))}var Je=class t extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_type,expected:C.string,received:i.parsedType}),I}let s=new Q,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(n=this._getOrReturnCtx(e,n),o?E(n,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&E(n,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")Hu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"email",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")gs||(gs=new RegExp(Ju,"u")),gs.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"emoji",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")Uu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"uuid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")zu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"nanoid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")Bu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cuid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Wu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cuid2",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")qu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"ulid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),E(n,{validation:"url",code:y.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"regex",code:y.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?Bn(i).test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?tl.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?rl(i).test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?Gu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"duration",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?sl(e.data,i.version)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"ip",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?nl(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"jwt",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?il(e.data,i.version)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cidr",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Qu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"base64",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?el.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"base64url",code:y.invalid_string,message:i.message}),s.dirty()):M.assertNever(i);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:y.invalid_string,..._.errToObj(s)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,..._.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,..._.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,..._.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._.errToObj(r)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Je.create=t=>new Je({checks:[],typeName:O.ZodString,coerce:t?.coerce??!1,...T(t)});function ol(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,i=Number.parseInt(t.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return i%o/10**n}var it=class t extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_type,expected:C.number,received:i.parsedType}),I}let s,n=new Q;for(let i of this._def.checks)i.kind==="int"?M.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?ol(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{code:y.not_finite,message:i.message}),n.dirty()):M.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:_.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&M.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}};it.create=t=>new it({checks:[],typeName:O.ZodNumber,coerce:t?.coerce||!1,...T(t)});var ot=class t extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let s,n=new Q;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):M.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return E(r,{code:y.invalid_type,expected:C.bigint,received:r.parsedType}),I}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:_.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};ot.create=t=>new ot({checks:[],typeName:O.ZodBigInt,coerce:t?.coerce??!1,...T(t)});var at=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.boolean,received:s.parsedType}),I}return ee(e.data)}};at.create=t=>new at({typeName:O.ZodBoolean,coerce:t?.coerce||!1,...T(t)});var ct=class t extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_type,expected:C.date,received:i.parsedType}),I}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_date}),I}let s=new Q,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):M.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ct.create=t=>new ct({checks:[],coerce:t?.coerce||!1,typeName:O.ZodDate,...T(t)});var Tt=class extends P{_parse(e){if(this._getType(e)!==C.symbol){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.symbol,received:s.parsedType}),I}return ee(e.data)}};Tt.create=t=>new Tt({typeName:O.ZodSymbol,...T(t)});var ut=class extends P{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.undefined,received:s.parsedType}),I}return ee(e.data)}};ut.create=t=>new ut({typeName:O.ZodUndefined,...T(t)});var lt=class extends P{_parse(e){if(this._getType(e)!==C.null){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.null,received:s.parsedType}),I}return ee(e.data)}};lt.create=t=>new lt({typeName:O.ZodNull,...T(t)});var Ze=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Ze.create=t=>new Ze({typeName:O.ZodAny,...T(t)});var We=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};We.create=t=>new We({typeName:O.ZodUnknown,...T(t)});var Se=class extends P{_parse(e){let r=this._getOrReturnCtx(e);return E(r,{code:y.invalid_type,expected:C.never,received:r.parsedType}),I}};Se.create=t=>new Se({typeName:O.ZodNever,...T(t)});var Pt=class extends P{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.void,received:s.parsedType}),I}return ee(e.data)}};Pt.create=t=>new Pt({typeName:O.ZodVoid,...T(t)});var qe=class t extends P{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==C.array)return E(r,{code:y.invalid_type,expected:C.array,received:r.parsedType}),I;if(n.exactLength!==null){let o=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(o||a)&&(E(r,{code:o?y.too_big:y.too_small,minimum:a?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(E(r,{code:y.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(E(r,{code:y.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>n.type._parseAsync(new ye(r,o,r.path,a)))).then(o=>Q.mergeArray(s,o));let i=[...r.data].map((o,a)=>n.type._parseSync(new ye(r,o,r.path,a)));return Q.mergeArray(s,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:_.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:_.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:_.toString(r)}})}nonempty(e){return this.min(1,e)}};qe.create=(t,e)=>new qe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...T(e)});function kt(t){if(t instanceof ue){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=De.create(kt(s))}return new ue({...t._def,shape:()=>e})}else return t instanceof qe?new qe({...t._def,type:kt(t.element)}):t instanceof De?De.create(kt(t.unwrap())):t instanceof ke?ke.create(kt(t.unwrap())):t instanceof Oe?Oe.create(t.items.map(e=>kt(e))):t}var ue=class t extends P{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=M.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==C.object){let u=this._getOrReturnCtx(e);return E(u,{code:y.invalid_type,expected:C.object,received:u.parsedType}),I}let{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Se&&this._def.unknownKeys==="strip"))for(let u in n.data)o.includes(u)||a.push(u);let c=[];for(let u of o){let d=i[u],h=n.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ye(n,h,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Se){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")a.length>0&&(E(n,{code:y.unrecognized_keys,keys:a}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let h=n.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ye(n,h,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let h=await d.key,p=await d.value;u.push({key:h,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>Q.mergeObjectSync(s,u)):Q.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let n=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:_.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let s of M.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let s of M.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}deepPartial(){return kt(this)}partial(e){let r={};for(let s of M.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let s of M.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof De;)i=i._def.innerType;r[s]=i}return new t({...this._def,shape:()=>r})}keyof(){return Wn(M.objectKeys(this.shape))}};ue.create=(t,e)=>new ue({shape:()=>t,unknownKeys:"strip",catchall:Se.create(),typeName:O.ZodObject,...T(e)});ue.strictCreate=(t,e)=>new ue({shape:()=>t,unknownKeys:"strict",catchall:Se.create(),typeName:O.ZodObject,...T(e)});ue.lazycreate=(t,e)=>new ue({shape:t,unknownKeys:"strip",catchall:Se.create(),typeName:O.ZodObject,...T(e)});var dt=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new ce(a.ctx.common.issues));return E(r,{code:y.invalid_union,unionErrors:o}),I}if(r.common.async)return Promise.all(s.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let c of s){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(c=>new ce(c));return E(r,{code:y.invalid_union,unionErrors:a}),I}}get options(){return this._def.options}};dt.create=(t,e)=>new dt({options:t,typeName:O.ZodUnion,...T(e)});var Be=t=>t instanceof pt?Be(t.schema):t instanceof we?Be(t.innerType()):t instanceof ht?[t.value]:t instanceof mt?t.options:t instanceof gt?M.objectValues(t.enum):t instanceof Dt?Be(t._def.innerType):t instanceof ut?[void 0]:t instanceof lt?[null]:t instanceof De?[void 0,...Be(t.unwrap())]:t instanceof ke?[null,...Be(t.unwrap())]:t instanceof ir||t instanceof wt?Be(t.unwrap()):t instanceof yt?Be(t._def.innerType):[],_r=class t extends P{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return E(r,{code:y.invalid_type,expected:C.object,received:r.parsedType}),I;let s=this.discriminator,n=r.data[s],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(E(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),I)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let n=new Map;for(let i of r){let o=Be(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,i)}}return new t({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...T(s)})}};function Ds(t,e){let r=Ie(t),s=Ie(e);if(t===e)return{valid:!0,data:t};if(r===C.object&&s===C.object){let n=M.objectKeys(e),i=M.objectKeys(t).filter(a=>n.indexOf(a)!==-1),o={...t,...e};for(let a of i){let c=Ds(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===C.array&&s===C.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],c=Ds(o,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===C.date&&s===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ft=class extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=(i,o)=>{if(Rr(i)||Rr(o))return I;let a=Ds(i.value,o.value);return a.valid?((Sr(i)||Sr(o))&&r.dirty(),{status:r.value,value:a.data}):(E(s,{code:y.invalid_intersection_types}),I)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ft.create=(t,e,r)=>new ft({left:t,right:e,typeName:O.ZodIntersection,...T(r)});var Oe=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.array)return E(s,{code:y.invalid_type,expected:C.array,received:s.parsedType}),I;if(s.data.length<this._def.items.length)return E(s,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),I;!this._def.rest&&s.data.length>this._def.items.length&&(E(s,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...s.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new ye(s,o,s.path,a)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>Q.mergeArray(r,o)):Q.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Oe.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oe({items:t,typeName:O.ZodTuple,rest:null,...T(e)})};var Ar=class t extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.object)return E(s,{code:y.invalid_type,expected:C.object,received:s.parsedType}),I;let n=[],i=this._def.keyType,o=this._def.valueType;for(let a in s.data)n.push({key:i._parse(new ye(s,a,s.path,a)),value:o._parse(new ye(s,s.data[a],s.path,a)),alwaysSet:a in s.data});return s.common.async?Q.mergeObjectAsync(r,n):Q.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof P?new t({keyType:e,valueType:r,typeName:O.ZodRecord,...T(s)}):new t({keyType:Je.create(),valueType:e,typeName:O.ZodRecord,...T(r)})}},Nt=class extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.map)return E(s,{code:y.invalid_type,expected:C.map,received:s.parsedType}),I;let n=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([a,c],u)=>({key:n._parse(new ye(s,a,s.path,[u,"key"])),value:i._parse(new ye(s,c,s.path,[u,"value"]))}));if(s.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return I;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of o){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return I;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};Nt.create=(t,e,r)=>new Nt({valueType:e,keyType:t,typeName:O.ZodMap,...T(r)});var Lt=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.set)return E(s,{code:y.invalid_type,expected:C.set,received:s.parsedType}),I;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(E(s,{code:y.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(E(s,{code:y.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function o(c){let u=new Set;for(let d of c){if(d.status==="aborted")return I;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...s.data.values()].map((c,u)=>i._parse(new ye(s,c,s.path,u)));return s.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:_.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:_.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Lt.create=(t,e)=>new Lt({valueType:t,minSize:null,maxSize:null,typeName:O.ZodSet,...T(e)});var $r=class t extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.function)return E(r,{code:y.invalid_type,expected:C.function,received:r.parsedType}),I;function s(a,c){return nr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,It(),je].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function n(a,c){return nr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,It(),je].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Ye){let a=this;return ee(async function(...c){let u=new ce([]),d=await a._def.args.parseAsync(c,i).catch(l=>{throw u.addIssue(s(c,l)),u}),h=await Reflect.apply(o,this,d);return await a._def.returns._def.type.parseAsync(h,i).catch(l=>{throw u.addIssue(n(h,l)),u})})}else{let a=this;return ee(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new ce([s(c,u.error)]);let d=Reflect.apply(o,this,u.data),h=a._def.returns.safeParse(d,i);if(!h.success)throw new ce([n(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Oe.create(e).rest(We.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new t({args:e||Oe.create([]).rest(We.create()),returns:r||We.create(),typeName:O.ZodFunction,...T(s)})}},pt=class extends P{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};pt.create=(t,e)=>new pt({getter:t,typeName:O.ZodLazy,...T(e)});var ht=class extends P{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return E(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),I}return{status:"valid",value:e.data}}get value(){return this._def.value}};ht.create=(t,e)=>new ht({value:t,typeName:O.ZodLiteral,...T(e)});function Wn(t,e){return new mt({values:t,typeName:O.ZodEnum,...T(e)})}var mt=class t extends P{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return E(r,{expected:M.joinValues(s),received:r.parsedType,code:y.invalid_type}),I}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return E(r,{received:r.data,code:y.invalid_enum_value,options:s}),I}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}};mt.create=Wn;var gt=class extends P{_parse(e){let r=M.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==C.string&&s.parsedType!==C.number){let n=M.objectValues(r);return E(s,{expected:M.joinValues(n),received:s.parsedType,code:y.invalid_type}),I}if(this._cache||(this._cache=new Set(M.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=M.objectValues(r);return E(s,{received:s.data,code:y.invalid_enum_value,options:n}),I}return ee(e.data)}get enum(){return this._def.values}};gt.create=(t,e)=>new gt({values:t,typeName:O.ZodNativeEnum,...T(e)});var Ye=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.promise&&r.common.async===!1)return E(r,{code:y.invalid_type,expected:C.promise,received:r.parsedType}),I;let s=r.parsedType===C.promise?r.data:Promise.resolve(r.data);return ee(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ye.create=(t,e)=>new Ye({type:t,typeName:O.ZodPromise,...T(e)});var we=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:o=>{E(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return I;let c=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return c.status==="aborted"?I:c.status==="dirty"?nt(c.value):r.value==="dirty"?nt(c.value):c});{if(r.value==="aborted")return I;let a=this._def.schema._parseSync({data:o,path:s.path,parent:s});return a.status==="aborted"?I:a.status==="dirty"?nt(a.value):r.value==="dirty"?nt(a.value):a}}if(n.type==="refinement"){let o=a=>{let c=n.refinement(a,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?I:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?I:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!He(o))return I;let a=n.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>He(o)?Promise.resolve(n.transform(o.value,i)).then(a=>({status:r.value,value:a})):I);M.assertNever(n)}};we.create=(t,e,r)=>new we({schema:t,typeName:O.ZodEffects,effect:e,...T(r)});we.createWithPreprocess=(t,e,r)=>new we({schema:e,effect:{type:"preprocess",transform:t},typeName:O.ZodEffects,...T(r)});var De=class extends P{_parse(e){return this._getType(e)===C.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};De.create=(t,e)=>new De({innerType:t,typeName:O.ZodOptional,...T(e)});var ke=class extends P{_parse(e){return this._getType(e)===C.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ke.create=(t,e)=>new ke({innerType:t,typeName:O.ZodNullable,...T(e)});var Dt=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return r.parsedType===C.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Dt.create=(t,e)=>new Dt({innerType:t,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});var yt=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ot(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ce(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ce(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};yt.create=(t,e)=>new yt({innerType:t,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});var Mt=class extends P{_parse(e){if(this._getType(e)!==C.nan){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.nan,received:s.parsedType}),I}return{status:"valid",value:e.data}}};Mt.create=t=>new Mt({typeName:O.ZodNaN,...T(t)});var al=Symbol("zod_brand"),ir=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}},or=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?I:i.status==="dirty"?(r.dirty(),nt(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?I:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new t({in:e,out:r,typeName:O.ZodPipeline})}},wt=class extends P{_parse(e){let r=this._def.innerType._parse(e),s=n=>(He(n)&&(n.value=Object.freeze(n.value)),n);return Ot(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}};wt.create=(t,e)=>new wt({innerType:t,typeName:O.ZodReadonly,...T(e)});function Ln(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function qn(t,e={},r){return t?Ze.create().superRefine((s,n)=>{let i=t(s);if(i instanceof Promise)return i.then(o=>{if(!o){let a=Ln(e,s),c=a.fatal??r??!0;n.addIssue({code:"custom",...a,fatal:c})}});if(!i){let o=Ln(e,s),a=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:a})}}):Ze.create()}var cl={object:ue.lazycreate},O;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(O||(O={}));var ul=(t,e={message:`Input not instance of ${t.name}`})=>qn(r=>r instanceof t,e),Un=Je.create,zn=it.create,ll=Mt.create,dl=ot.create,Vn=at.create,fl=ct.create,pl=Tt.create,hl=ut.create,ml=lt.create,gl=Ze.create,Dl=We.create,yl=Se.create,wl=Pt.create,El=qe.create,xl=ue.create,vl=ue.strictCreate,Cl=dt.create,bl=_r.create,Fl=ft.create,Rl=Oe.create,Sl=Ar.create,_l=Nt.create,Al=Lt.create,$l=$r.create,Il=pt.create,Ol=ht.create,kl=mt.create,Tl=gt.create,Pl=Ye.create,Nl=we.create,Ll=De.create,Ml=ke.create,jl=we.createWithPreprocess,Bl=or.create,Wl=()=>Un().optional(),ql=()=>zn().optional(),Ul=()=>Vn().optional(),zl={string:(t=>Je.create({...t,coerce:!0})),number:(t=>it.create({...t,coerce:!0})),boolean:(t=>at.create({...t,coerce:!0})),bigint:(t=>ot.create({...t,coerce:!0})),date:(t=>ct.create({...t,coerce:!0}))};var Vl=I;import{promises as Yl}from"node:fs";import{join as Xl,isAbsolute as Kl,normalize as Ql}from"node:path";var Ir=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),type:f.enum(["spec","power"]).default("spec"),description:f.string().optional(),deps:f.record(f.string().regex(/^[a-z0-9-]+$/,"Dependency name must be lowercase alphanumeric with hyphens"),f.string().regex(/^\d+\.\d+\.\d+$/,"Dependency version must be exact semver")).default({}),files:f.array(f.string()).min(1,"Files array cannot be empty"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>").optional(),agent:f.object({purpose:f.string(),tags:f.array(f.string()).optional()}).optional()});var Gl=f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Key must be name@version"),Hl=f.string().refine(t=>t.length===0?!1:(t.startsWith("file:")||t.startsWith("/")||/^[a-zA-Z]:\\/.test(t)||t.startsWith("./")||t.startsWith("../"),!0),"Source must be a non-empty file URL or local path"),Jl=f.object({source:Hl,hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>")}),Gn=f.record(Gl,Jl);var Zl=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>"),source:f.string().url("Source must be a valid URL"),deps:f.array(f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Dependency must be in format name@version"))}),Dy=f.object({createdAt:f.string().datetime("createdAt must be ISO-8601 format"),entries:f.array(Zl)});function Or(t){try{return Ir.parse(t)}catch(e){if(e instanceof f.ZodError){let r=e.errors.map(s=>`${s.path.length>0?`${s.path.join(".")}: `:""}${s.message}`);throw new Error(`Manifest validation failed:
|
|
11
|
+
`)[0].length}};ls.reset=()=>Ve.reset();function bn(t,e,r){let s=[];t.forEach(function(i){s.push(i.draw(e))});let n=s.join("");n.length&&r.push(n)}Yc.exports=ls});var br=R((Sv,Kc)=>{Kc.exports=Xc()});import{command as Fe,subcommands as pD,run as hD,positional as _t,option as Su,string as Ge,optional as nr,flag as In}from"cmd-ts";import{writeFile as ea,mkdir as ta,rm as ra}from"node:fs/promises";import sa from"ora";import{access as ch,constants as uh,readFile as Uo}from"node:fs/promises";import{join as Wt}from"node:path";import{homedir as lh}from"node:os";import{select as dh}from"@inquirer/prompts";import $t from"chalk";var D={SUCCESS:0,VALIDATION_ERROR:1,IO_ERROR:2,DEPENDENCY_ERROR:3,AUTHENTICATION_ERROR:4,USER_CANCELLED:130},m=class t extends Error{constructor(r,s){super(r);this.exitCode=s;this.name="CLIError",Error.captureStackTrace(this,t)}};function hs(t,e){let r=$t.red("Error:"),s=e?` ${$t.yellow(e)} failed:`:"";return`${r}${s} ${t.message}`}function It(t){return`${$t.yellow("Warning:")} ${t}`}function K(t){return $t.dim(t)}function S(t){return $t.cyan(t)}function H(t){return $t.cyan.bold(t)}function kn(t){return t instanceof m?t.exitCode:D.VALIDATION_ERROR}import{promises as Xe}from"node:fs";import Ke from"node:path";import cr from"fs-extra";var f={};Tu(f,{BRAND:()=>al,DIRTY:()=>nt,EMPTY_PATH:()=>ju,INVALID:()=>I,NEVER:()=>Vl,OK:()=>ee,ParseStatus:()=>Q,Schema:()=>P,ZodAny:()=>Ze,ZodArray:()=>qe,ZodBigInt:()=>ot,ZodBoolean:()=>at,ZodBranded:()=>or,ZodCatch:()=>yt,ZodDate:()=>ct,ZodDefault:()=>Dt,ZodDiscriminatedUnion:()=>_r,ZodEffects:()=>we,ZodEnum:()=>mt,ZodError:()=>ce,ZodFirstPartyTypeKind:()=>O,ZodFunction:()=>$r,ZodIntersection:()=>ft,ZodIssueCode:()=>y,ZodLazy:()=>pt,ZodLiteral:()=>ht,ZodMap:()=>Lt,ZodNaN:()=>jt,ZodNativeEnum:()=>gt,ZodNever:()=>Se,ZodNull:()=>lt,ZodNullable:()=>ke,ZodNumber:()=>it,ZodObject:()=>ue,ZodOptional:()=>De,ZodParsedType:()=>C,ZodPipeline:()=>ar,ZodPromise:()=>Ye,ZodReadonly:()=>wt,ZodRecord:()=>Ar,ZodSchema:()=>P,ZodSet:()=>Mt,ZodString:()=>Je,ZodSymbol:()=>Pt,ZodTransformer:()=>we,ZodTuple:()=>Oe,ZodType:()=>P,ZodUndefined:()=>ut,ZodUnion:()=>dt,ZodUnknown:()=>We,ZodVoid:()=>Nt,addIssueToContext:()=>E,any:()=>gl,array:()=>El,bigint:()=>dl,boolean:()=>zn,coerce:()=>zl,custom:()=>Wn,date:()=>fl,datetimeRegex:()=>jn,defaultErrorMap:()=>je,discriminatedUnion:()=>bl,effect:()=>Nl,enum:()=>kl,function:()=>$l,getErrorMap:()=>Ot,getParsedType:()=>Ie,instanceof:()=>ul,intersection:()=>Fl,isAborted:()=>Rr,isAsync:()=>kt,isDirty:()=>Sr,isValid:()=>He,late:()=>cl,lazy:()=>Il,literal:()=>Ol,makeIssue:()=>ir,map:()=>_l,nan:()=>ll,nativeEnum:()=>Tl,never:()=>yl,null:()=>ml,nullable:()=>Ml,number:()=>Un,object:()=>xl,objectUtil:()=>ms,oboolean:()=>Ul,onumber:()=>ql,optional:()=>Ll,ostring:()=>Wl,pipeline:()=>Bl,preprocess:()=>jl,promise:()=>Pl,quotelessJson:()=>Nu,record:()=>Sl,set:()=>Al,setErrorMap:()=>Mu,strictObject:()=>vl,string:()=>qn,symbol:()=>pl,transformer:()=>Nl,tuple:()=>Rl,undefined:()=>hl,union:()=>Cl,unknown:()=>Dl,util:()=>M,void:()=>wl});var M;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},t.getValidEnumValues=n=>{let i=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),o={};for(let a of i)o[a]=n[a];return t.objectValues(o)},t.objectValues=n=>t.objectKeys(n).map(function(i){return n[i]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},t.find=(n,i)=>{for(let o of n)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=s,t.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(M||(M={}));var ms;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ms||(ms={}));var C=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ie=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}};var y=M.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nu=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ce=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},s={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(r(o));else{let a=s,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return n(this),s}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};ce.create=t=>new ce(t);var Lu=(t,e)=>{let r;switch(t.code){case y.invalid_type:t.received===C.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,M.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${M.joinValues(t.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${M.joinValues(t.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${M.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:M.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=e.defaultError,M.assertNever(t)}return{message:r}},je=Lu;var Tn=je;function Mu(t){Tn=t}function Ot(){return Tn}var ir=t=>{let{data:e,path:r,errorMaps:s,issueData:n}=t,i=[...r,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let a="",c=s.filter(u=>!!u).slice().reverse();for(let u of c)a=u(o,{data:e,defaultError:a}).message;return{...n,path:i,message:a}},ju=[];function E(t,e){let r=Ot(),s=ir({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===je?void 0:je].filter(n=>!!n)});t.common.issues.push(s)}var Q=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let s=[];for(let n of r){if(n.status==="aborted")return I;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let n of r){let i=await n.key,o=await n.value;s.push({key:i,value:o})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let n of r){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return I;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[i.value]=o.value)}return{status:e.value,value:s}}},I=Object.freeze({status:"aborted"}),nt=t=>({status:"dirty",value:t}),ee=t=>({status:"valid",value:t}),Rr=t=>t.status==="aborted",Sr=t=>t.status==="dirty",He=t=>t.status==="valid",kt=t=>typeof Promise<"u"&&t instanceof Promise;var _;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(_||(_={}));var ye=class{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Pn=(t,e)=>{if(He(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ce(t.common.issues);return this._error=r,this._error}}};function T(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,a)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??s??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var P=class{get description(){return this._def.description}_getType(e){return Ie(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Q,ctx:{common:e.parent.common,data:e.data,parsedType:Ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(kt(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){let s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Pn(s,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return He(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>He(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){let s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){let s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)},n=this._parse({data:e,path:s.path,parent:s}),i=await(kt(n)?n:Promise.resolve(n));return Pn(s,i)}refine(e,r){let s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let o=e(n),a=()=>i.addIssue({code:y.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new we({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return De.create(this,this._def)}nullable(){return ke.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return Ye.create(this,this._def)}or(e){return dt.create([this,e],this._def)}and(e){return ft.create(this,e,this._def)}transform(e){return new we({...T(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Dt({...T(this._def),innerType:this,defaultValue:r,typeName:O.ZodDefault})}brand(){return new or({typeName:O.ZodBranded,type:this,...T(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new yt({...T(this._def),innerType:this,catchValue:r,typeName:O.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ar.create(this,e)}readonly(){return wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bu=/^c[^\s-]{8,}$/i,Wu=/^[0-9a-z]+$/,qu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Uu=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zu=/^[a-z0-9_-]{21}$/i,Vu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ju="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gs,Zu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Yu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Xu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ku=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,el=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ln="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tl=new RegExp(`^${Ln}$`);function Mn(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function rl(t){return new RegExp(`^${Mn(t)}$`)}function jn(t){let e=`${Ln}T${Mn(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function sl(t,e){return!!((e==="v4"||!e)&&Zu.test(t)||(e==="v6"||!e)&&Xu.test(t))}function nl(t,e){if(!Vu.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function il(t,e){return!!((e==="v4"||!e)&&Yu.test(t)||(e==="v6"||!e)&&Ku.test(t))}var Je=class t extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_type,expected:C.string,received:i.parsedType}),I}let s=new Q,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(n=this._getOrReturnCtx(e,n),o?E(n,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&E(n,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")Hu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"email",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")gs||(gs=new RegExp(Ju,"u")),gs.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"emoji",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")Uu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"uuid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")zu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"nanoid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")Bu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cuid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")Wu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cuid2",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")qu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"ulid",code:y.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),E(n,{validation:"url",code:y.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"regex",code:y.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?jn(i).test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?tl.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?rl(i).test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:y.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?Gu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"duration",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?sl(e.data,i.version)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"ip",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?nl(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"jwt",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?il(e.data,i.version)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"cidr",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Qu.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"base64",code:y.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?el.test(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{validation:"base64url",code:y.invalid_string,message:i.message}),s.dirty()):M.assertNever(i);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:y.invalid_string,..._.errToObj(s)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,..._.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,..._.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,..._.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._.errToObj(r)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Je.create=t=>new Je({checks:[],typeName:O.ZodString,coerce:t?.coerce??!1,...T(t)});function ol(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,i=Number.parseInt(t.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return i%o/10**n}var it=class t extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_type,expected:C.number,received:i.parsedType}),I}let s,n=new Q;for(let i of this._def.checks)i.kind==="int"?M.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?ol(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),E(s,{code:y.not_finite,message:i.message}),n.dirty()):M.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:_.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&M.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}};it.create=t=>new it({checks:[],typeName:O.ZodNumber,coerce:t?.coerce||!1,...T(t)});var ot=class t extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let s,n=new Q;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),E(s,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):M.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return E(r,{code:y.invalid_type,expected:C.bigint,received:r.parsedType}),I}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:_.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};ot.create=t=>new ot({checks:[],typeName:O.ZodBigInt,coerce:t?.coerce??!1,...T(t)});var at=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.boolean,received:s.parsedType}),I}return ee(e.data)}};at.create=t=>new at({typeName:O.ZodBoolean,coerce:t?.coerce||!1,...T(t)});var ct=class t extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_type,expected:C.date,received:i.parsedType}),I}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return E(i,{code:y.invalid_date}),I}let s=new Q,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),E(n,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):M.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};ct.create=t=>new ct({checks:[],coerce:t?.coerce||!1,typeName:O.ZodDate,...T(t)});var Pt=class extends P{_parse(e){if(this._getType(e)!==C.symbol){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.symbol,received:s.parsedType}),I}return ee(e.data)}};Pt.create=t=>new Pt({typeName:O.ZodSymbol,...T(t)});var ut=class extends P{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.undefined,received:s.parsedType}),I}return ee(e.data)}};ut.create=t=>new ut({typeName:O.ZodUndefined,...T(t)});var lt=class extends P{_parse(e){if(this._getType(e)!==C.null){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.null,received:s.parsedType}),I}return ee(e.data)}};lt.create=t=>new lt({typeName:O.ZodNull,...T(t)});var Ze=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Ze.create=t=>new Ze({typeName:O.ZodAny,...T(t)});var We=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};We.create=t=>new We({typeName:O.ZodUnknown,...T(t)});var Se=class extends P{_parse(e){let r=this._getOrReturnCtx(e);return E(r,{code:y.invalid_type,expected:C.never,received:r.parsedType}),I}};Se.create=t=>new Se({typeName:O.ZodNever,...T(t)});var Nt=class extends P{_parse(e){if(this._getType(e)!==C.undefined){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.void,received:s.parsedType}),I}return ee(e.data)}};Nt.create=t=>new Nt({typeName:O.ZodVoid,...T(t)});var qe=class t extends P{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==C.array)return E(r,{code:y.invalid_type,expected:C.array,received:r.parsedType}),I;if(n.exactLength!==null){let o=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(o||a)&&(E(r,{code:o?y.too_big:y.too_small,minimum:a?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(E(r,{code:y.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(E(r,{code:y.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>n.type._parseAsync(new ye(r,o,r.path,a)))).then(o=>Q.mergeArray(s,o));let i=[...r.data].map((o,a)=>n.type._parseSync(new ye(r,o,r.path,a)));return Q.mergeArray(s,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:_.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:_.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:_.toString(r)}})}nonempty(e){return this.min(1,e)}};qe.create=(t,e)=>new qe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...T(e)});function Tt(t){if(t instanceof ue){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=De.create(Tt(s))}return new ue({...t._def,shape:()=>e})}else return t instanceof qe?new qe({...t._def,type:Tt(t.element)}):t instanceof De?De.create(Tt(t.unwrap())):t instanceof ke?ke.create(Tt(t.unwrap())):t instanceof Oe?Oe.create(t.items.map(e=>Tt(e))):t}var ue=class t extends P{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=M.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==C.object){let u=this._getOrReturnCtx(e);return E(u,{code:y.invalid_type,expected:C.object,received:u.parsedType}),I}let{status:s,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Se&&this._def.unknownKeys==="strip"))for(let u in n.data)o.includes(u)||a.push(u);let c=[];for(let u of o){let d=i[u],h=n.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ye(n,h,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Se){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")a.length>0&&(E(n,{code:y.unrecognized_keys,keys:a}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let h=n.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ye(n,h,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let h=await d.key,p=await d.value;u.push({key:h,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>Q.mergeObjectSync(s,u)):Q.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let n=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:_.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let s of M.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let s of M.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}deepPartial(){return Tt(this)}partial(e){let r={};for(let s of M.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let s of M.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof De;)i=i._def.innerType;r[s]=i}return new t({...this._def,shape:()=>r})}keyof(){return Bn(M.objectKeys(this.shape))}};ue.create=(t,e)=>new ue({shape:()=>t,unknownKeys:"strip",catchall:Se.create(),typeName:O.ZodObject,...T(e)});ue.strictCreate=(t,e)=>new ue({shape:()=>t,unknownKeys:"strict",catchall:Se.create(),typeName:O.ZodObject,...T(e)});ue.lazycreate=(t,e)=>new ue({shape:t,unknownKeys:"strip",catchall:Se.create(),typeName:O.ZodObject,...T(e)});var dt=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new ce(a.ctx.common.issues));return E(r,{code:y.invalid_union,unionErrors:o}),I}if(r.common.async)return Promise.all(s.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let c of s){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(c=>new ce(c));return E(r,{code:y.invalid_union,unionErrors:a}),I}}get options(){return this._def.options}};dt.create=(t,e)=>new dt({options:t,typeName:O.ZodUnion,...T(e)});var Be=t=>t instanceof pt?Be(t.schema):t instanceof we?Be(t.innerType()):t instanceof ht?[t.value]:t instanceof mt?t.options:t instanceof gt?M.objectValues(t.enum):t instanceof Dt?Be(t._def.innerType):t instanceof ut?[void 0]:t instanceof lt?[null]:t instanceof De?[void 0,...Be(t.unwrap())]:t instanceof ke?[null,...Be(t.unwrap())]:t instanceof or||t instanceof wt?Be(t.unwrap()):t instanceof yt?Be(t._def.innerType):[],_r=class t extends P{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return E(r,{code:y.invalid_type,expected:C.object,received:r.parsedType}),I;let s=this.discriminator,n=r.data[s],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(E(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),I)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let n=new Map;for(let i of r){let o=Be(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,i)}}return new t({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...T(s)})}};function Ds(t,e){let r=Ie(t),s=Ie(e);if(t===e)return{valid:!0,data:t};if(r===C.object&&s===C.object){let n=M.objectKeys(e),i=M.objectKeys(t).filter(a=>n.indexOf(a)!==-1),o={...t,...e};for(let a of i){let c=Ds(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===C.array&&s===C.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],c=Ds(o,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===C.date&&s===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ft=class extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=(i,o)=>{if(Rr(i)||Rr(o))return I;let a=Ds(i.value,o.value);return a.valid?((Sr(i)||Sr(o))&&r.dirty(),{status:r.value,value:a.data}):(E(s,{code:y.invalid_intersection_types}),I)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ft.create=(t,e,r)=>new ft({left:t,right:e,typeName:O.ZodIntersection,...T(r)});var Oe=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.array)return E(s,{code:y.invalid_type,expected:C.array,received:s.parsedType}),I;if(s.data.length<this._def.items.length)return E(s,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),I;!this._def.rest&&s.data.length>this._def.items.length&&(E(s,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...s.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new ye(s,o,s.path,a)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>Q.mergeArray(r,o)):Q.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Oe.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oe({items:t,typeName:O.ZodTuple,rest:null,...T(e)})};var Ar=class t extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.object)return E(s,{code:y.invalid_type,expected:C.object,received:s.parsedType}),I;let n=[],i=this._def.keyType,o=this._def.valueType;for(let a in s.data)n.push({key:i._parse(new ye(s,a,s.path,a)),value:o._parse(new ye(s,s.data[a],s.path,a)),alwaysSet:a in s.data});return s.common.async?Q.mergeObjectAsync(r,n):Q.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof P?new t({keyType:e,valueType:r,typeName:O.ZodRecord,...T(s)}):new t({keyType:Je.create(),valueType:e,typeName:O.ZodRecord,...T(r)})}},Lt=class extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.map)return E(s,{code:y.invalid_type,expected:C.map,received:s.parsedType}),I;let n=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([a,c],u)=>({key:n._parse(new ye(s,a,s.path,[u,"key"])),value:i._parse(new ye(s,c,s.path,[u,"value"]))}));if(s.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return I;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of o){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return I;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};Lt.create=(t,e,r)=>new Lt({valueType:e,keyType:t,typeName:O.ZodMap,...T(r)});var Mt=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==C.set)return E(s,{code:y.invalid_type,expected:C.set,received:s.parsedType}),I;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(E(s,{code:y.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(E(s,{code:y.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function o(c){let u=new Set;for(let d of c){if(d.status==="aborted")return I;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...s.data.values()].map((c,u)=>i._parse(new ye(s,c,s.path,u)));return s.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:_.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:_.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Mt.create=(t,e)=>new Mt({valueType:t,minSize:null,maxSize:null,typeName:O.ZodSet,...T(e)});var $r=class t extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.function)return E(r,{code:y.invalid_type,expected:C.function,received:r.parsedType}),I;function s(a,c){return ir({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ot(),je].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function n(a,c){return ir({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ot(),je].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Ye){let a=this;return ee(async function(...c){let u=new ce([]),d=await a._def.args.parseAsync(c,i).catch(l=>{throw u.addIssue(s(c,l)),u}),h=await Reflect.apply(o,this,d);return await a._def.returns._def.type.parseAsync(h,i).catch(l=>{throw u.addIssue(n(h,l)),u})})}else{let a=this;return ee(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new ce([s(c,u.error)]);let d=Reflect.apply(o,this,u.data),h=a._def.returns.safeParse(d,i);if(!h.success)throw new ce([n(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Oe.create(e).rest(We.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,s){return new t({args:e||Oe.create([]).rest(We.create()),returns:r||We.create(),typeName:O.ZodFunction,...T(s)})}},pt=class extends P{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};pt.create=(t,e)=>new pt({getter:t,typeName:O.ZodLazy,...T(e)});var ht=class extends P{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return E(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),I}return{status:"valid",value:e.data}}get value(){return this._def.value}};ht.create=(t,e)=>new ht({value:t,typeName:O.ZodLiteral,...T(e)});function Bn(t,e){return new mt({values:t,typeName:O.ZodEnum,...T(e)})}var mt=class t extends P{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return E(r,{expected:M.joinValues(s),received:r.parsedType,code:y.invalid_type}),I}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return E(r,{received:r.data,code:y.invalid_enum_value,options:s}),I}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}};mt.create=Bn;var gt=class extends P{_parse(e){let r=M.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==C.string&&s.parsedType!==C.number){let n=M.objectValues(r);return E(s,{expected:M.joinValues(n),received:s.parsedType,code:y.invalid_type}),I}if(this._cache||(this._cache=new Set(M.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=M.objectValues(r);return E(s,{received:s.data,code:y.invalid_enum_value,options:n}),I}return ee(e.data)}get enum(){return this._def.values}};gt.create=(t,e)=>new gt({values:t,typeName:O.ZodNativeEnum,...T(e)});var Ye=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.promise&&r.common.async===!1)return E(r,{code:y.invalid_type,expected:C.promise,received:r.parsedType}),I;let s=r.parsedType===C.promise?r.data:Promise.resolve(r.data);return ee(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ye.create=(t,e)=>new Ye({type:t,typeName:O.ZodPromise,...T(e)});var we=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:o=>{E(s,o),o.fatal?r.abort():r.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return I;let c=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return c.status==="aborted"?I:c.status==="dirty"?nt(c.value):r.value==="dirty"?nt(c.value):c});{if(r.value==="aborted")return I;let a=this._def.schema._parseSync({data:o,path:s.path,parent:s});return a.status==="aborted"?I:a.status==="dirty"?nt(a.value):r.value==="dirty"?nt(a.value):a}}if(n.type==="refinement"){let o=a=>{let c=n.refinement(a,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?I:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?I:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!He(o))return I;let a=n.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>He(o)?Promise.resolve(n.transform(o.value,i)).then(a=>({status:r.value,value:a})):I);M.assertNever(n)}};we.create=(t,e,r)=>new we({schema:t,typeName:O.ZodEffects,effect:e,...T(r)});we.createWithPreprocess=(t,e,r)=>new we({schema:e,effect:{type:"preprocess",transform:t},typeName:O.ZodEffects,...T(r)});var De=class extends P{_parse(e){return this._getType(e)===C.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};De.create=(t,e)=>new De({innerType:t,typeName:O.ZodOptional,...T(e)});var ke=class extends P{_parse(e){return this._getType(e)===C.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ke.create=(t,e)=>new ke({innerType:t,typeName:O.ZodNullable,...T(e)});var Dt=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return r.parsedType===C.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Dt.create=(t,e)=>new Dt({innerType:t,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});var yt=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return kt(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ce(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ce(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};yt.create=(t,e)=>new yt({innerType:t,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});var jt=class extends P{_parse(e){if(this._getType(e)!==C.nan){let s=this._getOrReturnCtx(e);return E(s,{code:y.invalid_type,expected:C.nan,received:s.parsedType}),I}return{status:"valid",value:e.data}}};jt.create=t=>new jt({typeName:O.ZodNaN,...T(t)});var al=Symbol("zod_brand"),or=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}},ar=class t extends P{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?I:i.status==="dirty"?(r.dirty(),nt(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?I:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new t({in:e,out:r,typeName:O.ZodPipeline})}},wt=class extends P{_parse(e){let r=this._def.innerType._parse(e),s=n=>(He(n)&&(n.value=Object.freeze(n.value)),n);return kt(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}};wt.create=(t,e)=>new wt({innerType:t,typeName:O.ZodReadonly,...T(e)});function Nn(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Wn(t,e={},r){return t?Ze.create().superRefine((s,n)=>{let i=t(s);if(i instanceof Promise)return i.then(o=>{if(!o){let a=Nn(e,s),c=a.fatal??r??!0;n.addIssue({code:"custom",...a,fatal:c})}});if(!i){let o=Nn(e,s),a=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:a})}}):Ze.create()}var cl={object:ue.lazycreate},O;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(O||(O={}));var ul=(t,e={message:`Input not instance of ${t.name}`})=>Wn(r=>r instanceof t,e),qn=Je.create,Un=it.create,ll=jt.create,dl=ot.create,zn=at.create,fl=ct.create,pl=Pt.create,hl=ut.create,ml=lt.create,gl=Ze.create,Dl=We.create,yl=Se.create,wl=Nt.create,El=qe.create,xl=ue.create,vl=ue.strictCreate,Cl=dt.create,bl=_r.create,Fl=ft.create,Rl=Oe.create,Sl=Ar.create,_l=Lt.create,Al=Mt.create,$l=$r.create,Il=pt.create,Ol=ht.create,kl=mt.create,Tl=gt.create,Pl=Ye.create,Nl=we.create,Ll=De.create,Ml=ke.create,jl=we.createWithPreprocess,Bl=ar.create,Wl=()=>qn().optional(),ql=()=>Un().optional(),Ul=()=>zn().optional(),zl={string:(t=>Je.create({...t,coerce:!0})),number:(t=>it.create({...t,coerce:!0})),boolean:(t=>at.create({...t,coerce:!0})),bigint:(t=>ot.create({...t,coerce:!0})),date:(t=>ct.create({...t,coerce:!0}))};var Vl=I;import{promises as Yl}from"node:fs";import{join as Xl,isAbsolute as Kl,normalize as Ql}from"node:path";var Ir=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),type:f.enum(["spec","power"]).default("spec"),description:f.string().optional(),deps:f.record(f.string().regex(/^[a-z0-9-]+$/,"Dependency name must be lowercase alphanumeric with hyphens"),f.string().regex(/^\d+\.\d+\.\d+$/,"Dependency version must be exact semver")).default({}),files:f.array(f.string()).min(1,"Files array cannot be empty"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>").optional(),agent:f.object({purpose:f.string(),tags:f.array(f.string()).optional()}).optional()});var Gl=f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Key must be name@version"),Hl=f.string().refine(t=>t.length===0?!1:(t.startsWith("file:")||t.startsWith("/")||/^[a-zA-Z]:\\/.test(t)||t.startsWith("./")||t.startsWith("../"),!0),"Source must be a non-empty file URL or local path"),Jl=f.object({source:Hl,hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>")}),Vn=f.record(Gl,Jl);var Zl=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>"),source:f.string().url("Source must be a valid URL"),deps:f.array(f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Dependency must be in format name@version"))}),Dy=f.object({createdAt:f.string().datetime("createdAt must be ISO-8601 format"),entries:f.array(Zl)});function Or(t){try{return Ir.parse(t)}catch(e){if(e instanceof f.ZodError){let r=e.errors.map(s=>`${s.path.length>0?`${s.path.join(".")}: `:""}${s.message}`);throw new Error(`Manifest validation failed:
|
|
12
12
|
${r.join(`
|
|
13
|
-
`)}`)}throw e}}function kr(t){let e=new Set;for(let r of t){if(r.includes(".."))throw new Error(`Path traversal not allowed: ${r}`);if(Kl(r)||/^[A-Za-z]:\\/.test(r))throw new Error(`Absolute paths not allowed: ${r}`);let s=Ql(r).replace(/\\/g,"/");if(e.has(s))throw new Error(`Duplicate file path: ${r}`);e.add(s)}}async function
|
|
14
|
-
`;await Xe.writeFile(i,o,"utf-8")}};import{promises as ws}from"node:fs";import
|
|
13
|
+
`)}`)}throw e}}function kr(t){let e=new Set;for(let r of t){if(r.includes(".."))throw new Error(`Path traversal not allowed: ${r}`);if(Kl(r)||/^[A-Za-z]:\\/.test(r))throw new Error(`Absolute paths not allowed: ${r}`);let s=Ql(r).replace(/\\/g,"/");if(e.has(s))throw new Error(`Duplicate file path: ${r}`);e.add(s)}}async function Gn(t,e){let r=[];for(let s of t){let n=Xl(e,s);try{await Yl.access(n)}catch{r.push(s)}}if(r.length>0)throw new Error(`Files not found: ${r.join(", ")}`)}function ed(t){if(t.includes(".."))throw new Error(`Path traversal not allowed: ${t}`);return t.replace(/\\/g,"/")}function Et(t,e){let r=Ke.resolve(t).replace(/\\/g,"/"),s=Ke.resolve(e).replace(/\\/g,"/");if(!r.startsWith(s))throw new Error(`Path escapes registry boundaries: ${t}`)}var Qe=class{paths;rootPath;constructor(e="~/.spectrl/registry"){this.rootPath=ed(e),this.paths={root:this.rootPath,spec:(r,s)=>`${this.rootPath}/${r}/${s}`.replace(/\\/g,"/"),files:(r,s)=>`${this.rootPath}/${r}/${s}/files`.replace(/\\/g,"/"),manifest:(r,s)=>`${this.rootPath}/${r}/${s}/spectrl.json`.replace(/\\/g,"/")}}async exists(e,r){let s=this.paths.spec(e,r);Et(s,this.rootPath);try{return(await Xe.stat(s)).isDirectory()}catch(n){if(n.code==="ENOENT")return!1;throw n}}async getManifest(e,r){let s=this.paths.manifest(e,r);Et(s,this.rootPath);try{let n=await Xe.readFile(s,"utf-8"),i=JSON.parse(n);return Or(i)}catch(n){throw n.code==="ENOENT"?new Error(`Manifest not found: ${e}@${r}`):n}}async list(){let e=[];try{await Xe.access(this.rootPath)}catch{return e}let r=await Xe.readdir(this.rootPath,{withFileTypes:!0});for(let s of r){if(!s.isDirectory())continue;let n=s.name,i=Ke.join(this.rootPath,n);try{let o=await Xe.readdir(i,{withFileTypes:!0});for(let a of o)a.isDirectory()&&e.push({name:n,version:a.name})}catch{}}return e}async listVersions(e){let r=Ke.join(this.rootPath,e);try{return(await Xe.readdir(r,{withFileTypes:!0})).filter(i=>i.isDirectory()).map(i=>i.name).filter(i=>/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(i))}catch(s){if(s.code==="ENOENT")return[];throw s}}async remove(e,r){if(!await this.exists(e,r))throw new Error(`Spec ${e}@${r} not found in registry`);let s=this.paths.spec(e,r);Et(s,this.rootPath),await cr.remove(s);let n=Ke.join(this.rootPath,e);(await Xe.readdir(n)).length===0&&await cr.remove(n)}async publish(e,r){if(kr(e.files),await this.exists(e.name,e.version))throw new Error(`Spec ${e.name}@${e.version} already exists in registry. Bump version to publish changes.`);let s=this.paths.spec(e.name,e.version),n=this.paths.files(e.name,e.version);Et(s,this.rootPath),Et(n,this.rootPath),await cr.ensureDir(n);for(let a of e.files){let c=Ke.join(r,a),u=Ke.join(n,a);Et(u,this.rootPath),await cr.ensureDir(Ke.dirname(u)),await cr.copy(c,u,{overwrite:!0,errorOnExist:!1,preserveTimestamps:!1})}let i=this.paths.manifest(e.name,e.version);Et(i,this.rootPath);let o=`${JSON.stringify(e,null,2)}
|
|
14
|
+
`;await Xe.writeFile(i,o,"utf-8")}};import{promises as ws}from"node:fs";import ur from"node:path";var Tr=Symbol("singleComment"),Hn=Symbol("multiComment");function td(){return""}function rd(t,e,r){return t.slice(e,r).replace(/[^ \t\r\n]/g," ")}function sd(t,e){let r=e-1,s=0;for(;t[r]==="\\";)r-=1,s+=1;return!!(s%2)}var nd={trailingCommas:!1,whitespace:!0};function ys(t,e=nd){if(typeof t!="string")throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof t}\``);let{trailingCommas:r=!1,whitespace:s=!0}=e,n=s?rd:td,i=!1,o=!1,a=0,c="",u="",d=-1;for(let p=0;p<t.length;p++){let l=t[p],g=t[p+1];if(l&&(!o&&l==='"'&&(sd(t,p)||(i=!i)),!i))if(!o&&l+g==="//")c+=t.slice(a,p),a=p,o=Tr,p++;else if(o===Tr&&l+g===`\r
|
|
15
15
|
`){p++,o=!1,c+=n(t,a,p),a=p;continue}else if(o===Tr&&l===`
|
|
16
|
-
`)o=!1,c+=n(t,a,p),a=p;else if(!o&&l+g==="/*"){c+=t.slice(a,p),a=p,o=
|
|
17
|
-
`&&(c+=t.slice(a,p),a=p,d=-1):l===","&&(u+=c+t.slice(a,p),c="",a=p,d=p))}let h=o===Tr?n(t,a):t.slice(a);return u+c+h}function
|
|
16
|
+
`)o=!1,c+=n(t,a,p),a=p;else if(!o&&l+g==="/*"){c+=t.slice(a,p),a=p,o=Hn,p++;continue}else if(o===Hn&&l+g==="*/"){p++,o=!1,c+=n(t,a,p+1),a=p+1;continue}else r&&!o&&(d!==-1?l==="}"||l==="]"?(c+=t.slice(a,p),u+=n(c,0,1)+c.slice(1),c="",a=p,d=-1):l!==" "&&l!==" "&&l!=="\r"&&l!==`
|
|
17
|
+
`&&(c+=t.slice(a,p),a=p,d=-1):l===","&&(u+=c+t.slice(a,p),c="",a=p,d=p))}let h=o===Tr?n(t,a):t.slice(a);return u+c+h}function Jn(t,e){try{return JSON.parse(t)}catch{return JSON.parse(ys(t,{...e,trailingCommas:!0}))}}function xt(t){try{return Jn(t)}catch(e){throw new Error(`JSONC parse error: ${e instanceof Error?e.message:String(e)}`)}}var pe=class extends Error{exitCode;constructor(e,r){super(e),this.exitCode=r,this.name="ResolverError"}},Pr=class{async loadIndex(e){try{let r=await ws.readFile(e,"utf-8"),s=JSON.parse(r);return Vn.parse(s)}catch(r){throw this.isFileNotFoundError(r)?new pe(`Index file not found: ${e}`,1):r}}isFileNotFoundError(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}async readManifestFromSource(e,r){let s;if(e.startsWith("file://")?s=e.slice(7):e.startsWith("file:")?s=e.slice(5):s=e,!ur.isAbsolute(s)){let n=r||process.cwd();s=ur.resolve(n,s)}try{let n;try{n=await ws.readFile(ur.join(s,"spectrl.jsonc"),"utf-8")}catch{n=await ws.readFile(ur.join(s,"spectrl.json"),"utf-8")}let i=xt(n);return Ir.parse(i)}catch(n){throw this.isFileNotFoundError(n)?new pe(`Missing source for ${e}`,1):new pe(`Failed to read manifest from source: ${e}`,1)}}async resolveClosureFromIndex(e){let r=await this.loadIndex(e),s=Object.keys(r).sort(),n=/^([a-z0-9-]+)@(\d+\.\d+\.\d+)$/,i=new Map;for(let l of s){let g=l.match(n);if(!g)throw new pe(`Invalid index key: ${l}`,1);let[,w,x]=g;i.set(l,{name:w,version:x})}let o=new Map,a=ur.dirname(e);for(let l of s){let g=i.get(l);if(!g)throw new pe(`Internal error: missing parsed key ${l}`,1);let{name:w,version:x}=g,A=r[l];if(!A||!A.source)throw new pe(`Missing source for ${l}`,1);let $=await this.readManifestFromSource(A.source,a);if($.name!==w||$.version!==x)throw new pe(`Manifest mismatch for ${l}: found ${$.name}@${$.version}`,1);o.set(l,{manifest:$,source:A.source})}let c=new Map;for(let[l,{manifest:g}]of o){let w=Object.entries(g.deps).map(([x,A])=>`${x}@${A}`).sort();for(let x of w)if(!r[x])throw new pe(`Missing dependency: ${x}. Add it to .spectrl/spectrl-index.json`,3);c.set(l,w)}let u=(l,g,w)=>{g.add(l),w.add(l);let x=c.get(l)||[];for(let A of x)if(g.has(A)){if(w.has(A))throw new pe(`Cyclic dependency detected: ${l} \u2192 ${A}`,3)}else if(u(A,g,w))return!0;return w.delete(l),!1},d=new Set;for(let l of s)d.has(l)||u(l,d,new Set);let h=[];for(let[l,{manifest:g,source:w}]of o){let x=Object.entries(g.deps).map(([A,$])=>`${A}@${$}`).sort();h.push({name:g.name,version:g.version,source:w,deps:x})}let p=h.map(l=>({node:l,key:`${l.name}@${l.version}`}));return p.sort((l,g)=>l.key.localeCompare(g.key)),p.map(l=>l.node)}};import{createHash as id}from"node:crypto";function Nr(t){let{manifest:e,fileContents:r}=t,s=id("sha256"),n=ad(e);s.update(n,"utf8");let i=Object.keys(r).sort();for(let o of i){let a=r[o];s.update(o,"utf8");let c=od(a);s.update(c,"utf8")}return`sha256:${s.digest("hex")}`}function od(t){return t.replace(/\r\n/g,`
|
|
18
18
|
`).replace(/\r/g,`
|
|
19
|
-
`)}function ad(t){let{hash:e,...r}=t;return Es(r)}function Es(t){return t===null||typeof t!="object"?JSON.stringify(t):Array.isArray(t)?`[${t.map(Es).join(",")}]`:`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Es(t[r])}`).join(",")}}`}var
|
|
19
|
+
`)}function ad(t){let{hash:e,...r}=t;return Es(r)}function Es(t){return t===null||typeof t!="object"?JSON.stringify(t):Array.isArray(t)?`[${t.map(Es).join(",")}]`:`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Es(t[r])}`).join(",")}}`}var Mo=At(Bs(),1);function jo(t,e){return Mo.default.compare(t,e)}import{promises as Bo}from"node:fs";import{join as nh}from"node:path";var ih="spectrl.jsonc",oh="spectrl.json",ah=[ih,oh];async function Wo(t){for(let e of ah){let r=nh(t,e);try{return await Bo.access(r),r}catch{}}throw new Error(`No manifest found in ${t} (looked for spectrl.jsonc, spectrl.json)`)}async function qo(t){let e=await Wo(t),r=await Bo.readFile(e,"utf-8");return xt(r)}async function Ue(t){try{return await ch(t,uh.F_OK),!0}catch{return!1}}async function zo(t,e){if(await Ue(t))throw new m(`File already exists: ${t}`,D.VALIDATION_ERROR)}function le(t){return Wt(t,".spectrl","spectrl-index.json")}function Ws(t){return Wt(t,".spectrl")}function qt(){return Wt(lh(),".spectrl","registry")}function Ut(t,e,r){return`${t}/${e}@${r}`}function Zr(t,e,r){return`${t}-${e}@${r}`}function Yr(t,e,r,s){return Wt(t,".spectrl","specs",Zr(e,r,s))}function Vo(t){return typeof t=="object"&&t!==null&&"code"in t&&typeof t.code=="string"}function Dr(t){return t instanceof Error}async function Go(t){let e;try{e=await qo(t)}catch(r){if(r instanceof m)throw r;let s=Dr(r)?r.message:"Unknown error";throw s.includes("No manifest found")?new m(s,D.IO_ERROR):s.startsWith("JSONC parse error")?new m(`Invalid JSON in manifest: ${s}`,D.VALIDATION_ERROR):new m(`Failed to read manifest: ${s}`,D.IO_ERROR)}try{return Or(e)}catch(r){let s=Dr(r)?r.message:"Unknown validation error";throw new m(s,D.VALIDATION_ERROR)}}function Ho(t){try{kr(t)}catch(e){let r=Dr(e)?e.message:"Invalid file paths";throw new m(r,D.VALIDATION_ERROR)}}async function Jo(t,e){try{await Gn(t,e)}catch(r){let s=Dr(r)?r.message:"Files not found";throw new m(s,D.IO_ERROR)}}async function qs(t,e=!0,r){try{let s=r?.yesLabel||"Yes",n=r?.noLabel||"No";return await dh({message:t,choices:[{name:s,value:!0},{name:n,value:!1}],default:e})}catch{return}}var v={log(t){console.log(t)},error(t){console.error(t)}},fh=`
|
|
20
20
|
# Spectrl local registry
|
|
21
21
|
# Track index and lock files, but ignore downloaded specs (like node_modules)
|
|
22
22
|
.spectrl/specs/
|
|
23
|
-
`;async function ph(t){let e=
|
|
23
|
+
`;async function ph(t){let e=Wt(t,".gitignore");try{return(await Uo(e,"utf-8")).includes(".spectrl/")}catch(r){return Vo(r)&&r.code==="ENOENT",!1}}async function Us(t){let e=Wt(t,".gitignore");if(await ph(t))return!1;try{let r="";try{r=await Uo(e,"utf-8")}catch(i){if(!Vo(i)||i.code!=="ENOENT")throw i}let s=r;r.length>0&&!r.endsWith(`
|
|
24
24
|
`)&&(s+=`
|
|
25
|
-
`),s+=fh;let{writeFile:n}=await import("node:fs/promises");return await n(e,s,"utf-8"),!0}catch(r){let s=
|
|
25
|
+
`),s+=fh;let{writeFile:n}=await import("node:fs/promises");return await n(e,s,"utf-8"),!0}catch(r){let s=Dr(r)?r.message:"Failed to update .gitignore";throw new m(`Failed to configure .gitignore: ${s}`,D.IO_ERROR)}}import{readFile as Ko,writeFile as Qo}from"node:fs/promises";import{join as zs}from"node:path";var Xr="<!-- Added by Spectrl -->",Zo=`# AI Assistant Instructions for Spectrl
|
|
26
26
|
|
|
27
27
|
## What is Spectrl?
|
|
28
28
|
|
|
@@ -99,35 +99,35 @@ Once a clarification is made, remember it \u2014 don't ask the same question twi
|
|
|
99
99
|
|
|
100
100
|
- **Catalog first** \xB7 **Lazy-load** \xB7 **Specs = context** \xB7 **Powers = instructions**
|
|
101
101
|
- **Never guess** \xB7 **Human decides** \xB7 **Cite sources** \xB7 **Remember context** \xB7 **Flag but follow**
|
|
102
|
-
`;function
|
|
103
|
-
${
|
|
102
|
+
`;function Yo(){return`${Xr}
|
|
103
|
+
${Zo}`}function Xo(){return`
|
|
104
104
|
|
|
105
105
|
---
|
|
106
106
|
|
|
107
107
|
${Xr}
|
|
108
|
-
${
|
|
109
|
-
`;await
|
|
110
|
-
This command will be removed in a future version.`));let r=
|
|
111
|
-
`;await ta(i,a,"utf-8"),await oa(t,e,r),r.text="Configuring .gitignore";let u=await Us(t)?" and configured .gitignore":" (.gitignore already configured)";r.succeed(`Initialized project index at ${S(".spectrl/spectrl-index.json")}${u}`)}catch(i){if(r.stop(),n&&i instanceof m&&i.exitCode===D.USER_CANCELLED)try{await sa(s,{recursive:!0,force:!0})}catch{}throw i}}async function oa(t,e,r){if(e.skipAgents)return;if(e.forceAgents){let i=await Vs(t);if(i.exists)if(i.hasMarker)r.text="Initializing project",v.log(K("\u2713 AGENTS.md already contains Spectrl instructions"));else{r.text="Updating AGENTS.md";try{await Hs(t),r.text="Initializing project",v.log(K("\u2713 Added Spectrl instructions to AGENTS.md"))}catch{r.text="Initializing project",v.log($t("Failed to update AGENTS.md (non-critical)"))}}else{r.text="Creating AGENTS.md";try{await Gs(t),r.text="Initializing project",v.log(K("\u2713 Created AGENTS.md"))}catch{r.text="Initializing project",v.log($t("Failed to create AGENTS.md (non-critical)"))}}return}let s=await Vs(t);if(!s.exists){r.stop();let i=await qs("Create AGENTS.md to configure AI assistants?",!0,{yesLabel:"Yes (recommended)",noLabel:"No"});if(i===void 0)throw new m("Initialization cancelled by user",D.USER_CANCELLED);if(r.start("Initializing project"),i){r.text="Creating AGENTS.md";try{await Gs(t),r.text="Initializing project",v.log(K("\u2713 Created AGENTS.md"))}catch{r.text="Initializing project",v.log($t("Failed to create AGENTS.md (non-critical)"))}}else v.log(K("\u2139 Skipped AGENTS.md creation")),v.log(K("AI assistants won't automatically consult specs. You can create AGENTS.md manually later."));return}if(s.hasMarker){r.text="Initializing project",v.log(K("\u2713 AGENTS.md already contains Spectrl instructions"));return}r.stop();let n=await qs("AGENTS.md found. Append Spectrl instructions to the bottom?",!0,{yesLabel:"Yes (recommended)",noLabel:"No"});if(n===void 0)throw new m("Initialization cancelled by user",D.USER_CANCELLED);if(r.start("Initializing project"),n){r.text="Updating AGENTS.md";try{await Hs(t),r.text="Initializing project",v.log(K("\u2713 Added Spectrl instructions to AGENTS.md"))}catch{r.text="Initializing project",v.log($t("Failed to update AGENTS.md (non-critical)"))}}else v.log(K("\u2139 Skipped AGENTS.md update")),v.log(K("You can add Spectrl instructions manually if needed"))}import{readFile as ha}from"node:fs/promises";import{join as ma}from"node:path";import Nh from"ora";import{select as Lh}from"@inquirer/prompts";import Js from"keytar";import aa from"node-machine-id";import{createCipheriv as hh,createDecipheriv as mh,randomBytes as ca,pbkdf2Sync as ua}from"node:crypto";import{existsSync as Zs,mkdirSync as gh,readFileSync as Dh,writeFileSync as yh,unlinkSync as wh,chmodSync as Eh}from"node:fs";import{homedir as xh}from"node:os";import{join as la}from"node:path";var Ys="spectrl",Xs="github-token",Ks=la(xh(),".spectrl"),Ut=la(Ks,".auth"),vh=f.object({salt:f.string().length(64),iv:f.string().length(32),encrypted:f.string().min(1)}),ve=class{async store(e){try{await Js.setPassword(Ys,Xs,e)}catch{this.storeEncrypted(e)}}async get(){try{return await Js.getPassword(Ys,Xs)}catch{return this.getEncrypted()}}async delete(){try{await Js.deletePassword(Ys,Xs)}catch{}this.deleteEncrypted()}storeEncrypted(e){try{Zs(Ks)||gh(Ks,{recursive:!0});let r=ca(32),s=ca(16),n=aa.machineIdSync(),i=ua(n,r,1e5,32,"sha256"),o=hh("aes-256-cbc",i,s),a=o.update(e,"utf8","hex");a+=o.final("hex");let c=JSON.stringify({salt:r.toString("hex"),iv:s.toString("hex"),encrypted:a});yh(Ut,c,{encoding:"utf8"}),Eh(Ut,384)}catch(r){throw new Error(`Failed to store token: ${r instanceof Error?r.message:"Unknown error"}`)}}getEncrypted(){try{if(!Zs(Ut))return null;let e=Dh(Ut,"utf8"),r=JSON.parse(e),s=vh.safeParse(r);if(!s.success)return null;let{salt:n,iv:i,encrypted:o}=s.data,a=aa.machineIdSync(),c=ua(a,Buffer.from(n,"hex"),1e5,32,"sha256"),u=mh("aes-256-cbc",c,Buffer.from(i,"hex")),d=u.update(o,"hex","utf8");return d+=u.final("utf8"),d}catch{return null}}deleteEncrypted(){try{Zs(Ut)&&wh(Ut)}catch{}}};import{config as Ch}from"dotenv";import{fileURLToPath as bh}from"node:url";import{dirname as Fh,join as Rh}from"node:path";var Sh=bh(import.meta.url),_h=Fh(Sh);process.env.NODE_ENV!=="test"&&!process.env.VITEST&&Ch({path:Rh(_h,"../../.env"),override:!1,quiet:!0});function Ct(){let t=process.env.API_URL;if(t)return t;let e="https://bpleokxqv5.execute-api.eu-north-1.amazonaws.com/prod";if(e)return e;throw new Error("Registry API URL is not configured. Please contact support or reinstall the CLI.")}var _E=f.object({device_code:f.string(),user_code:f.string(),verification_uri:f.string(),expires_in:f.number(),interval:f.number()}),AE=f.object({token:f.string(),username:f.string()}),$E=f.object({status:f.string()}),IE=f.object({error:f.string(),message:f.string().optional()}),Ah=f.object({manifest:f.record(f.string(),f.unknown()),files:f.record(f.string(),f.string())}),$h=f.object({message:f.string(),url:f.string(),specId:f.string(),version:f.string()}),Ih=f.object({specId:f.string(),description:f.string().optional(),tags:f.array(f.string()).optional(),version:f.string(),publishedAt:f.string()}),Oh=f.object({results:f.array(Ih),count:f.number()}),kh=f.object({version:f.string(),description:f.string().optional(),tags:f.array(f.string()).optional(),publishedAt:f.string(),s3Path:f.string(),hash:f.string(),downloads:f.number().optional()}),Th=f.object({specId:f.string(),username:f.string(),specName:f.string(),versions:f.array(kh)}),Ph=f.object({message:f.string()}),V=class extends Error{constructor(r,s,n){super(r);this.statusCode=s;this.response=n;this.name="ApiError"}};async function Qr(t,e={}){let{maxAttempts:r=3,initialDelayMs:s=1e3,maxDelayMs:n=1e4,backoffMultiplier:i=2}=e,o,a=s;for(let c=1;c<=r;c++)try{return await t()}catch(u){if(o=u instanceof Error?u:new Error(String(u)),u instanceof V&&u.statusCode&&u.statusCode<500)throw u;if(c===r)throw o;await new Promise(d=>setTimeout(d,a)),a=Math.min(a*i,n)}throw o||new Error("Retry failed")}async function da(t,e,r){return Qr(async()=>{let s={manifest:e,files:r},n=Ah.safeParse(s);if(!n.success)throw new V(`Invalid request data: ${n.error.message}`,void 0,s);let i=await fetch(`${Ct()}/publish`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n.data)});if(!i.ok){let c=await i.text();throw new V(`Failed to publish spec: ${c}`,i.status,c)}let o=await i.json(),a=$h.safeParse(o);if(!a.success)throw new V("Invalid API response format after publishing.",i.status,o);return a.data})}async function fa(t){return Qr(async()=>{let e=await fetch(`${Ct()}/search?q=${encodeURIComponent(t)}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok){let n=await e.text();throw new V(`Failed to search specs: ${n}`,e.status,n)}let r=await e.json(),s=Oh.safeParse(r);if(!s.success)throw new V("Invalid API response format. Expected search results but received unexpected data.",e.status,r);return s.data})}async function bt(t,e){return Qr(async()=>{let r=await fetch(`${Ct()}/specs/${t}/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let i=await r.text();throw new V(`Failed to get spec: ${i}`,r.status,i)}let s=await r.json(),n=Th.safeParse(s);if(!n.success)throw new V("Invalid API response format when fetching spec metadata.",r.status,s);return n.data})}async function pa(t,e,r,s){return Qr(async()=>{let n=await fetch(`${Ct()}/specs/${e}/${r}/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!n.ok){let a=await n.text();throw new V(`Failed to unpublish spec: ${a}`,n.status,a)}let i=await n.json(),o=Ph.safeParse(i);if(!o.success)throw new V("Invalid API response format after unpublishing.",n.status,i);return o.data})}function Mh(t,e){if(!t.description||t.description.trim()==="")throw e.stop(),new m('Manifest must include a non-empty "description" field for publishing',D.VALIDATION_ERROR);if(!t.files.includes("index.md"))throw e.stop(),new m('Manifest "files" array must include "index.md" for publishing',D.VALIDATION_ERROR);t.agent?(t.agent.purpose||e.warn('Missing "agent.purpose" \u2014 add a purpose for better discoverability'),(!t.agent.tags||t.agent.tags.length===0)&&e.warn('Missing "agent.tags" \u2014 add tags for better discoverability')):e.warn('Missing "agent" field \u2014 add agent metadata for better discoverability')}async function jh(t,e){let r=Object.entries(t.deps);if(r.length===0)return;let s=new Qe(e??Wt());for(let[n,i]of r){let o;try{o=await s.getManifest(n,i)}catch{continue}let a=o.type??"spec";if(a!==t.type)throw new m(`Dependency "${n}@${i}" is a ${a} but "${t.name}" is a ${t.type} \u2014 cross-type dependencies are not allowed`,D.VALIDATION_ERROR)}}async function ga(t,e){let r=Nh({text:"Publishing spec",spinner:"line"}).start();try{r.text="Validating manifest";let s=await Ho(t);Jo(s.files),await Zo(s.files,t),Mh(s,r),await jh(s,e),r.stop();let n=await Lh({message:"Where do you want to publish?",choices:[{name:"Local registry (~/.spectrl/registry/)",value:"local",description:"Publish to your local registry (private)"},{name:"Public registry (registry.spectrl.dev)",value:"public",description:"Publish to the public registry (requires authentication)"}],default:"local"});r.start(),n==="local"?await Bh(t,s,e,r):await Wh(t,s,r)}catch(s){throw r.stop(),s instanceof m?s:s instanceof Error?new m(s.message,D.IO_ERROR):new m("Unknown error during publish",D.IO_ERROR)}}async function Bh(t,e,r,s){s.text="Reading tracked files";let n={};for(let c of e.files){let u=ma(t,c);try{n[c]=await ha(u,"utf-8")}catch{throw new m(`Failed to read file: ${c}`,D.IO_ERROR)}}s.text="Computing hash";let i=Nr({manifest:e,fileContents:n}),o={...e,hash:i};s.text="Writing to registry",await new Qe(r??Wt()).publish(o,t),s.succeed(`Published ${S(e.name)}@${S(e.version)} to local registry with hash ${S(i.substring(0,12))}`)}async function Wh(t,e,r){r.text="Checking authentication";let n=await new ve().get();if(!n)throw r.stop(),new m(`You need to login first. Run: ${H("spectrl login")}`,D.AUTHENTICATION_ERROR);let i={...e};i.agent||(r.text="Auto-populating agent field",i={...e,agent:{purpose:i.description||"",tags:[]}}),r.text="Reading tracked files";let o={};for(let a of e.files){let c=ma(t,a);try{let u=await ha(c,"utf-8");o[a]=u}catch{throw new m(`Failed to read file: ${a}`,D.IO_ERROR)}}r.text="Publishing to public registry";try{let a={...i},c=await da(n,a,o);r.succeed(`Published ${S(c.specId)}@${S(c.version)} to public registry`),console.log(`
|
|
108
|
+
${Zo}`}async function Vs(t){let e=zs(t,"AGENTS.md");if(!await Ue(e))return{exists:!1};try{return{exists:!0,hasMarker:(await Ko(e,"utf-8")).includes(Xr)}}catch{return{exists:!1}}}async function Gs(t){let e=zs(t,"AGENTS.md"),r=Yo();try{await Qo(e,r,"utf-8")}catch(s){let n=s instanceof Error?s.message:"Unknown error";throw new m(`Failed to create AGENTS.md: ${n}`,D.IO_ERROR)}}async function Hs(t){let e=zs(t,"AGENTS.md");try{let r=await Ko(e,"utf-8");r=r.trimEnd();let s=r+Xo();await Qo(e,s,"utf-8")}catch(r){let s=r instanceof Error?r.message:"Unknown error";throw new m(`Failed to append to AGENTS.md: ${s}`,D.IO_ERROR)}}async function Kr(t,e={}){let r=le(t);if(await Ue(r))return{wasInitialized:!1};let s=Ws(t),n=e.spinner??sa({spinner:"line"}),i=!e.spinner;i?n.start("Initializing project"):n.text="Initializing spectrl in this project";try{await ta(s,{recursive:!0});let a=`${JSON.stringify({},null,2)}
|
|
109
|
+
`;await ea(r,a,"utf-8");let c=e.skipAgents??!process.stdin.isTTY;await ia(t,{skipAgents:c},n),n.text="Configuring .gitignore",await Us(t);let u="Initialized spectrl in this project";return i?n.succeed(u):v.log(K(`\u2713 ${u}`)),{wasInitialized:!0}}catch(o){if(o instanceof m&&o.exitCode===D.USER_CANCELLED)try{await ra(s,{recursive:!0,force:!0})}catch{}throw i&&n.stop(),o}}async function na(t,e={}){v.log(It(`Note: "spectrl init" is deprecated. "spectrl install" now auto-initializes when needed.
|
|
110
|
+
This command will be removed in a future version.`));let r=sa({text:"Initializing project",spinner:"line"}).start(),s=Ws(t),n=!1;try{if(e.skipAgents&&e.forceAgents)throw r.stop(),new m("Cannot use both --skip-agents and --force-agents",D.VALIDATION_ERROR);let i=le(t);await zo(i),await ta(s,{recursive:!0}),n=!0;let a=`${JSON.stringify({},null,2)}
|
|
111
|
+
`;await ea(i,a,"utf-8"),await ia(t,e,r),r.text="Configuring .gitignore";let u=await Us(t)?" and configured .gitignore":" (.gitignore already configured)";r.succeed(`Initialized project index at ${S(".spectrl/spectrl-index.json")}${u}`)}catch(i){if(r.stop(),n&&i instanceof m&&i.exitCode===D.USER_CANCELLED)try{await ra(s,{recursive:!0,force:!0})}catch{}throw i}}async function ia(t,e,r){if(e.skipAgents)return;if(e.forceAgents){let i=await Vs(t);if(i.exists)if(i.hasMarker)r.text="Initializing project",v.log(K("\u2713 AGENTS.md already contains Spectrl instructions"));else{r.text="Updating AGENTS.md";try{await Hs(t),r.text="Initializing project",v.log(K("\u2713 Added Spectrl instructions to AGENTS.md"))}catch{r.text="Initializing project",v.log(It("Failed to update AGENTS.md (non-critical)"))}}else{r.text="Creating AGENTS.md";try{await Gs(t),r.text="Initializing project",v.log(K("\u2713 Created AGENTS.md"))}catch{r.text="Initializing project",v.log(It("Failed to create AGENTS.md (non-critical)"))}}return}let s=await Vs(t);if(!s.exists){r.stop();let i=await qs("Create AGENTS.md to configure AI assistants?",!0,{yesLabel:"Yes (recommended)",noLabel:"No"});if(i===void 0)throw new m("Initialization cancelled by user",D.USER_CANCELLED);if(r.start("Initializing project"),i){r.text="Creating AGENTS.md";try{await Gs(t),r.text="Initializing project",v.log(K("\u2713 Created AGENTS.md"))}catch{r.text="Initializing project",v.log(It("Failed to create AGENTS.md (non-critical)"))}}else v.log(K("\u2139 Skipped AGENTS.md creation")),v.log(K("AI assistants won't automatically consult specs. You can create AGENTS.md manually later."));return}if(s.hasMarker){r.text="Initializing project",v.log(K("\u2713 AGENTS.md already contains Spectrl instructions"));return}r.stop();let n=await qs("AGENTS.md found. Append Spectrl instructions to the bottom?",!0,{yesLabel:"Yes (recommended)",noLabel:"No"});if(n===void 0)throw new m("Initialization cancelled by user",D.USER_CANCELLED);if(r.start("Initializing project"),n){r.text="Updating AGENTS.md";try{await Hs(t),r.text="Initializing project",v.log(K("\u2713 Added Spectrl instructions to AGENTS.md"))}catch{r.text="Initializing project",v.log(It("Failed to update AGENTS.md (non-critical)"))}}else v.log(K("\u2139 Skipped AGENTS.md update")),v.log(K("You can add Spectrl instructions manually if needed"))}import{readFile as pa}from"node:fs/promises";import{join as ha}from"node:path";import Nh from"ora";import{select as Lh}from"@inquirer/prompts";import Js from"keytar";import oa from"node-machine-id";import{createCipheriv as hh,createDecipheriv as mh,randomBytes as aa,pbkdf2Sync as ca}from"node:crypto";import{existsSync as Zs,mkdirSync as gh,readFileSync as Dh,writeFileSync as yh,unlinkSync as wh,chmodSync as Eh}from"node:fs";import{homedir as xh}from"node:os";import{join as ua}from"node:path";var Ys="spectrl",Xs="github-token",Ks=ua(xh(),".spectrl"),zt=ua(Ks,".auth"),vh=f.object({salt:f.string().length(64),iv:f.string().length(32),encrypted:f.string().min(1)}),ve=class{async store(e){try{await Js.setPassword(Ys,Xs,e)}catch{this.storeEncrypted(e)}}async get(){try{return await Js.getPassword(Ys,Xs)}catch{return this.getEncrypted()}}async delete(){try{await Js.deletePassword(Ys,Xs)}catch{}this.deleteEncrypted()}storeEncrypted(e){try{Zs(Ks)||gh(Ks,{recursive:!0});let r=aa(32),s=aa(16),n=oa.machineIdSync(),i=ca(n,r,1e5,32,"sha256"),o=hh("aes-256-cbc",i,s),a=o.update(e,"utf8","hex");a+=o.final("hex");let c=JSON.stringify({salt:r.toString("hex"),iv:s.toString("hex"),encrypted:a});yh(zt,c,{encoding:"utf8"}),Eh(zt,384)}catch(r){throw new Error(`Failed to store token: ${r instanceof Error?r.message:"Unknown error"}`)}}getEncrypted(){try{if(!Zs(zt))return null;let e=Dh(zt,"utf8"),r=JSON.parse(e),s=vh.safeParse(r);if(!s.success)return null;let{salt:n,iv:i,encrypted:o}=s.data,a=oa.machineIdSync(),c=ca(a,Buffer.from(n,"hex"),1e5,32,"sha256"),u=mh("aes-256-cbc",c,Buffer.from(i,"hex")),d=u.update(o,"hex","utf8");return d+=u.final("utf8"),d}catch{return null}}deleteEncrypted(){try{Zs(zt)&&wh(zt)}catch{}}};import{config as Ch}from"dotenv";import{fileURLToPath as bh}from"node:url";import{dirname as Fh,join as Rh}from"node:path";var Sh=bh(import.meta.url),_h=Fh(Sh);process.env.NODE_ENV!=="test"&&!process.env.VITEST&&Ch({path:Rh(_h,"../../.env"),override:!1,quiet:!0});function Ct(){let t=process.env.API_URL;if(t)return t;let e="https://bpleokxqv5.execute-api.eu-north-1.amazonaws.com/prod";if(e)return e;throw new Error("Registry API URL is not configured. Please contact support or reinstall the CLI.")}var _E=f.object({device_code:f.string(),user_code:f.string(),verification_uri:f.string(),expires_in:f.number(),interval:f.number()}),AE=f.object({token:f.string(),username:f.string()}),$E=f.object({status:f.string()}),IE=f.object({error:f.string(),message:f.string().optional()}),Ah=f.object({manifest:f.record(f.string(),f.unknown()),files:f.record(f.string(),f.string())}),$h=f.object({message:f.string(),url:f.string(),specId:f.string(),version:f.string()}),Ih=f.object({specId:f.string(),description:f.string().optional(),tags:f.array(f.string()).optional(),version:f.string(),publishedAt:f.string()}),Oh=f.object({results:f.array(Ih),count:f.number()}),kh=f.object({version:f.string(),description:f.string().optional(),tags:f.array(f.string()).optional(),publishedAt:f.string(),s3Path:f.string(),hash:f.string(),downloads:f.number().optional()}),Th=f.object({specId:f.string(),username:f.string(),specName:f.string(),versions:f.array(kh)}),Ph=f.object({message:f.string()}),V=class extends Error{constructor(r,s,n){super(r);this.statusCode=s;this.response=n;this.name="ApiError"}};async function Qr(t,e={}){let{maxAttempts:r=3,initialDelayMs:s=1e3,maxDelayMs:n=1e4,backoffMultiplier:i=2}=e,o,a=s;for(let c=1;c<=r;c++)try{return await t()}catch(u){if(o=u instanceof Error?u:new Error(String(u)),u instanceof V&&u.statusCode&&u.statusCode<500)throw u;if(c===r)throw o;await new Promise(d=>setTimeout(d,a)),a=Math.min(a*i,n)}throw o||new Error("Retry failed")}async function la(t,e,r){return Qr(async()=>{let s={manifest:e,files:r},n=Ah.safeParse(s);if(!n.success)throw new V(`Invalid request data: ${n.error.message}`,void 0,s);let i=await fetch(`${Ct()}/publish`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n.data)});if(!i.ok){let c=await i.text();throw new V(`Failed to publish spec: ${c}`,i.status,c)}let o=await i.json(),a=$h.safeParse(o);if(!a.success)throw new V("Invalid API response format after publishing.",i.status,o);return a.data})}async function da(t){return Qr(async()=>{let e=await fetch(`${Ct()}/search?q=${encodeURIComponent(t)}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok){let n=await e.text();throw new V(`Failed to search specs: ${n}`,e.status,n)}let r=await e.json(),s=Oh.safeParse(r);if(!s.success)throw new V("Invalid API response format. Expected search results but received unexpected data.",e.status,r);return s.data})}async function bt(t,e){return Qr(async()=>{let r=await fetch(`${Ct()}/specs/${t}/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok){let i=await r.text();throw new V(`Failed to get spec: ${i}`,r.status,i)}let s=await r.json(),n=Th.safeParse(s);if(!n.success)throw new V("Invalid API response format when fetching spec metadata.",r.status,s);return n.data})}async function fa(t,e,r,s){return Qr(async()=>{let n=await fetch(`${Ct()}/specs/${e}/${r}/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!n.ok){let a=await n.text();throw new V(`Failed to unpublish spec: ${a}`,n.status,a)}let i=await n.json(),o=Ph.safeParse(i);if(!o.success)throw new V("Invalid API response format after unpublishing.",n.status,i);return o.data})}function Mh(t,e){if(!t.description||t.description.trim()==="")throw e.stop(),new m('Manifest must include a non-empty "description" field for publishing',D.VALIDATION_ERROR);if(!t.files.includes("index.md"))throw e.stop(),new m('Manifest "files" array must include "index.md" for publishing',D.VALIDATION_ERROR);t.agent?(t.agent.purpose||e.warn('Missing "agent.purpose" \u2014 add a purpose for better discoverability'),(!t.agent.tags||t.agent.tags.length===0)&&e.warn('Missing "agent.tags" \u2014 add tags for better discoverability')):e.warn('Missing "agent" field \u2014 add agent metadata for better discoverability')}async function jh(t,e){let r=Object.entries(t.deps);if(r.length===0)return;let s=new Qe(e??qt());for(let[n,i]of r){let o;try{o=await s.getManifest(n,i)}catch{continue}let a=o.type??"spec";if(a!==t.type)throw new m(`Dependency "${n}@${i}" is a ${a} but "${t.name}" is a ${t.type} \u2014 cross-type dependencies are not allowed`,D.VALIDATION_ERROR)}}async function ma(t,e){let r=Nh({text:"Publishing spec",spinner:"line"}).start();try{r.text="Validating manifest";let s=await Go(t);Ho(s.files),await Jo(s.files,t),Mh(s,r),await jh(s,e),r.stop();let n=await Lh({message:"Where do you want to publish?",choices:[{name:"Local registry (~/.spectrl/registry/)",value:"local",description:"Publish to your local registry (private)"},{name:"Public registry (spectrl.pro)",value:"public",description:"Publish to the public registry (requires authentication)"}],default:"local"});r.start(),n==="local"?await Bh(t,s,e,r):await Wh(t,s,r)}catch(s){throw r.stop(),s instanceof m?s:s instanceof Error?new m(s.message,D.IO_ERROR):new m("Unknown error during publish",D.IO_ERROR)}}async function Bh(t,e,r,s){s.text="Reading tracked files";let n={};for(let c of e.files){let u=ha(t,c);try{n[c]=await pa(u,"utf-8")}catch{throw new m(`Failed to read file: ${c}`,D.IO_ERROR)}}s.text="Computing hash";let i=Nr({manifest:e,fileContents:n}),o={...e,hash:i};s.text="Writing to registry",await new Qe(r??qt()).publish(o,t),s.succeed(`Published ${S(e.name)}@${S(e.version)} to local registry with hash ${S(i.substring(0,12))}`)}async function Wh(t,e,r){r.text="Checking authentication";let n=await new ve().get();if(!n)throw r.stop(),new m(`You need to login first. Run: ${H("spectrl login")}`,D.AUTHENTICATION_ERROR);let i={...e};i.agent||(r.text="Auto-populating agent field",i={...e,agent:{purpose:i.description||"",tags:[]}}),r.text="Reading tracked files";let o={};for(let a of e.files){let c=ha(t,a);try{let u=await pa(c,"utf-8");o[a]=u}catch{throw new m(`Failed to read file: ${a}`,D.IO_ERROR)}}r.text="Publishing to public registry";try{let a={...i},c=await la(n,a,o);r.succeed(`Published ${S(c.specId)}@${S(c.version)} to public registry`),console.log(`
|
|
112
112
|
\u{1F517} ${c.url}
|
|
113
|
-
`)}catch(a){throw a instanceof Error?new m(`Failed to publish to public registry: ${a.message}`,D.IO_ERROR):a}}import{promises as z}from"node:fs";import{dirname as
|
|
113
|
+
`)}catch(a){throw a instanceof Error?new m(`Failed to publish to public registry: ${a.message}`,D.IO_ERROR):a}}import{promises as z}from"node:fs";import{dirname as Vt,join as B,resolve as ya}from"node:path";import J from"fs-extra";import ts from"ora";import{select as Zh}from"@inquirer/prompts";var et=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),type:f.enum(["spec","power"]).default("spec"),description:f.string().optional(),deps:f.record(f.string().regex(/^[a-z0-9-]+$/,"Dependency name must be lowercase alphanumeric with hyphens"),f.string().regex(/^\d+\.\d+\.\d+$/,"Dependency version must be exact semver")).default({}),files:f.array(f.string()).min(1,"Files array cannot be empty"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>").optional(),agent:f.object({purpose:f.string(),tags:f.array(f.string()).optional()}).optional()});var qh=f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Key must be name@version"),Uh=f.string().refine(t=>t.length===0?!1:(t.startsWith("file:")||t.startsWith("/")||/^[a-zA-Z]:\\/.test(t)||t.startsWith("./")||t.startsWith("../"),!0),"Source must be a non-empty file URL or local path"),zh=f.object({source:Uh,hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>")}),GE=f.record(qh,zh);var Vh=f.object({name:f.string().regex(/^[a-z0-9-]+$/,"Name must be lowercase alphanumeric with hyphens"),version:f.string().regex(/^\d+\.\d+\.\d+$/,"Version must be semver compliant (x.y.z)"),hash:f.string().regex(/^sha256:[a-f0-9]{64}$/,"Hash must be in format sha256:<64 hex chars>"),source:f.string().url("Source must be a valid URL"),deps:f.array(f.string().regex(/^[a-z0-9-]+@\d+\.\d+\.\d+$/,"Dependency must be in format name@version"))}),ZE=f.object({createdAt:f.string().datetime("createdAt must be ISO-8601 format"),entries:f.array(Vh)});var Ft={username:/^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$/,name:/^[a-z0-9](?:[a-z0-9-]{0,98}[a-z0-9])?$/,version:/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/};function _e(t){if(!t||typeof t!="string")throw new Error("Spec reference must be a non-empty string");let e=t.trim();if(e.length===0)throw new Error("Spec reference must be a non-empty string");return e.includes("/")?Hh(e):Gh(e)}function Gh(t){let e=t.indexOf("@");if(e===-1){let n=t;if(!Ft.name.test(n))throw new Error(`Invalid spec name: ${n}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);return{name:n,isPublic:!1}}let r=t.slice(0,e),s=t.slice(e+1);if(!Ft.name.test(r))throw new Error(`Invalid spec name: ${r}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);if(!Ft.version.test(s))throw new Error(`Invalid version: ${s}. Must be valid semver (e.g., 1.0.0) with no leading zeros`);return{name:r,version:s,isPublic:!1}}function Hh(t){let e=t.indexOf("/");if(e===-1||e===0||e===t.length-1)throw new Error(`Invalid public spec reference: ${t}. Must be in format username/spec or username/spec@version`);let r=t.slice(0,e),s=t.slice(e+1);if(!Ft.username.test(r))throw new Error(`Invalid username: ${r}. Must be lowercase alphanumeric with hyphens, 1-39 characters`);let n=s.indexOf("@");if(n===-1){let a=s;if(!Ft.name.test(a))throw new Error(`Invalid spec name: ${a}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);return{username:r,name:a,isPublic:!0}}let i=s.slice(0,n),o=s.slice(n+1);if(!Ft.name.test(i))throw new Error(`Invalid spec name: ${i}. Must be lowercase alphanumeric with hyphens, 1-100 characters`);if(!Ft.version.test(o))throw new Error(`Invalid version: ${o}. Must be valid semver (e.g., 1.0.0) with no leading zeros`);return{username:r,name:i,version:o,isPublic:!0}}import{promises as es}from"node:fs";import{join as tt}from"node:path";import Jh from"fs-extra";function ga(t){let e=["<!-- Auto-generated by Spectrl. Do not edit manually. -->","","# Spectrl Catalog",""].join(`
|
|
114
114
|
`);if(t.length===0)return`${e}| Name | Version | Type | Description | When to Use |
|
|
115
115
|
| ---- | ------- | ---- | ----------- | ----------- |
|
|
116
116
|
`;let r={name:Math.max(4,...t.map(a=>a.name.length)),version:Math.max(7,...t.map(a=>a.version.length)),type:Math.max(4,...t.map(a=>a.type.length)),description:Math.max(11,...t.map(a=>a.description.length)),purpose:Math.max(11,...t.map(a=>a.purpose.length))},s=(a,c)=>a.padEnd(c),n=`| ${s("Name",r.name)} | ${s("Version",r.version)} | ${s("Type",r.type)} | ${s("Description",r.description)} | ${s("When to Use",r.purpose)} |`,i=`| ${"-".repeat(r.name)} | ${"-".repeat(r.version)} | ${"-".repeat(r.type)} | ${"-".repeat(r.description)} | ${"-".repeat(r.purpose)} |`,o=t.map(a=>`| ${s(a.name,r.name)} | ${s(a.version,r.version)} | ${s(a.type,r.type)} | ${s(a.description,r.description)} | ${s(a.purpose,r.purpose)} |`);return[e,n,i,...o,""].join(`
|
|
117
|
-
`)}async function
|
|
117
|
+
`)}async function Da(t){let e=tt(t,".spectrl"),r=tt(e,"spectrl-index.json"),s;try{let a=await es.readFile(r,"utf-8");s=JSON.parse(a)}catch(a){if(a.code==="ENOENT"){let c=tt(e,"catalog.md");await Jh.ensureDir(e),await es.writeFile(c,ga([]),"utf-8");return}throw new m(`Failed to read project index: ${a.message}`,D.IO_ERROR)}if(typeof s!="object"||s===null||Array.isArray(s))throw new m("Invalid project index format",D.VALIDATION_ERROR);let n=Object.keys(s),i=[];for(let a of n){let c=tt(e,"specs"),u=[tt(c,a),tt(c,a.replace("/","-"))],d=s[a];if(d&&typeof d=="object"&&"source"in d&&typeof d.source=="string"){let L=d.source;!L.startsWith("http://")&&!L.startsWith("https://")&&u.push(L)}let h=null;for(let L of u){let q=tt(L,"spectrl.json");try{let U=await es.readFile(q,"utf-8");h=JSON.parse(U);break}catch{}}if(h===null){console.warn(`[spectrl] Warning: could not read manifest for ${a}, skipping in catalog`);continue}let p=et.safeParse(h);if(!p.success){console.warn(`[spectrl] Warning: invalid manifest for ${a}: ${p.error.issues[0].message}, skipping in catalog`);continue}let l=p.data,g=a.lastIndexOf("@"),w=g!==-1?a.slice(0,g):a,x=g!==-1?a.slice(g+1):l.version,A=l.description??"",$=l.agent?.purpose??A;i.push({name:w,version:x,type:l.type,description:A,purpose:$})}let o=tt(e,"catalog.md");try{await es.writeFile(o,ga(i),"utf-8")}catch(a){throw new m(`Failed to generate catalog: ${a.message}`,D.IO_ERROR)}}async function yr(t){try{await Da(t)}catch(e){console.warn(`[spectrl] Warning: catalog generation failed: ${e instanceof Error?e.message:String(e)}`)}}function wa(){return process.env.REGISTRY_URL||"https://d12j78i0x57g1k.cloudfront.net"}async function xa(t,e,r,s,n){try{let i=le(n),o=await z.readFile(i,"utf-8"),a=JSON.parse(o);if(r){let c=`${t}@${e}`;if(a[c])return{hasCollision:!0,existingType:"local",existingPath:B(n,".spectrl","specs",c),existingKey:c}}else for(let c of Object.keys(a))if(c.includes("/")){let u=c.split("/");if(u.length===2&&u[1]===`${t}@${e}`){let d=u[0];return{hasCollision:!0,existingType:"public",existingPath:B(n,".spectrl","specs",`${d}-${t}@${e}`),existingKey:c}}}return{hasCollision:!1,existingType:null,existingPath:null,existingKey:null}}catch{return{hasCollision:!1,existingType:null,existingPath:null,existingKey:null}}}async function Yh(t,e,r,s){return await Zh({message:`Warning: A ${t} spec '${r}' already exists.
|
|
118
118
|
Installing ${e} spec '${s}' may cause confusion in dependency resolution.
|
|
119
119
|
|
|
120
|
-
What would you like to do?`,choices:[{name:`Replace ${t} spec with ${e} spec`,value:"replace",description:`Remove '${r}' and install '${s}'`},{name:"Cancel installation",value:"cancel",description:"Keep existing spec and abort"}],default:"cancel"})}async function
|
|
121
|
-
`),D.VALIDATION_ERROR);if(await Yh(t.existingType,r,t.existingKey,e)==="cancel")throw new m("Installation cancelled by user",D.USER_CANCELLED);let i=ts({text:`Removing existing ${t.existingType} spec '${t.existingKey}'`,spinner:"line"}).start();try{await
|
|
122
|
-
`,"utf-8")}i.succeed(`Removed ${t.existingType} spec '${t.existingKey}'`)}catch(o){throw i.fail("Failed to remove existing spec"),new m(`Failed to remove existing spec: ${o instanceof Error?o.message:String(o)}`,D.IO_ERROR)}}function Xh(){return process.platform==="win32"?"junction":"dir"}async function
|
|
120
|
+
What would you like to do?`,choices:[{name:`Replace ${t} spec with ${e} spec`,value:"replace",description:`Remove '${r}' and install '${s}'`},{name:"Cancel installation",value:"cancel",description:"Keep existing spec and abort"}],default:"cancel"})}async function va(t,e,r,s){if(!t.hasCollision||!t.existingType||!t.existingKey||!t.existingPath)return;if(!process.stdin.isTTY)throw new m(["Spec name collision detected",` ${t.existingType==="local"?"Local":"Public"} spec '${t.existingKey}' already exists`,` Attempted to install ${r} spec '${e}'`,"","This collision will cause ambiguity in dependency resolution.","","To resolve:",` 1. Remove the ${t.existingType} spec: spectrl uninstall ${t.existingKey}`,` 2. Or remove the ${r} spec from your index`," 3. Then retry the installation"].join(`
|
|
121
|
+
`),D.VALIDATION_ERROR);if(await Yh(t.existingType,r,t.existingKey,e)==="cancel")throw new m("Installation cancelled by user",D.USER_CANCELLED);let i=ts({text:`Removing existing ${t.existingType} spec '${t.existingKey}'`,spinner:"line"}).start();try{await Gt(t.existingPath);let o=le(s),a=await z.readFile(o,"utf-8"),c=JSON.parse(a);if(t.existingKey in c){let u={...c};delete u[t.existingKey],await z.writeFile(o,`${JSON.stringify(u,null,2)}
|
|
122
|
+
`,"utf-8")}i.succeed(`Removed ${t.existingType} spec '${t.existingKey}'`)}catch(o){throw i.fail("Failed to remove existing spec"),new m(`Failed to remove existing spec: ${o instanceof Error?o.message:String(o)}`,D.IO_ERROR)}}function Xh(){return process.platform==="win32"?"junction":"dir"}async function Ca(t,e){try{if(!(await J.lstat(t)).isSymbolicLink())return{exists:!0,isSymlink:!1,isCorrect:!1};let n=await J.readlink(t),i=ya(Vt(t),n),o=ya(e);return{exists:!0,isSymlink:!0,isCorrect:i===o}}catch(r){if(r.code==="ENOENT")return{exists:!1,isSymlink:!1,isCorrect:!1};throw r}}async function Gt(t){try{(await J.lstat(t)).isSymbolicLink()?await J.unlink(t):await J.remove(t)}catch(e){let r=e;if(r.code!=="ENOENT")throw new m(`Failed to remove existing path ${t}: ${r.message}`,D.IO_ERROR)}}function Kh(){return process.env.SPECTRL_USE_COPY==="1"}async function Ea(t,e,r){try{await J.ensureDir(e);let s=B(Vt(t),"spectrl.json"),n=B(e,"spectrl.json");await J.copy(s,n);let i=new Set;for(let o of r.files){let a=B(e,o);i.add(Vt(a))}for(let o of i)await J.ensureDir(o);for(let o of r.files){let a=B(t,o),c=B(e,o);await J.copy(a,c)}}catch(s){let n=s;throw new m(`Failed to copy files from registry: ${n.message}`,D.IO_ERROR)}}async function ba(t,e,r,s){if(Kh())return s.info("Using file copy mode (SPECTRL_USE_COPY=1)"),await Ea(t,e,r),"copy";if(!await J.pathExists(t))throw new m(`Registry path not found: ${t}
|
|
123
123
|
|
|
124
|
-
Has this spec been published? Run: ${H("spectrl publish")}`,D.DEPENDENCY_ERROR);try{await J.ensureDir(
|
|
125
|
-
`,"utf-8"),await
|
|
126
|
-
`,"utf-8")}catch(N){o.warn("Failed to update index, rolling back installation...");try{await J.remove(p)}catch{}throw new m(`Failed to update project index: ${N.message}`,D.IO_ERROR)}o.succeed(`Installed ${S(d)} from public registry at ${S(`.spectrl/specs/${Zr(r,s,c)}`)}`),await
|
|
127
|
-
`,"utf-8"),await
|
|
128
|
-
`,"utf-8")}catch(G){i.warn("Failed to update index, rolling back installation...");try{await
|
|
124
|
+
Has this spec been published? Run: ${H("spectrl publish")}`,D.DEPENDENCY_ERROR);try{await J.ensureDir(Vt(e))}catch(i){let o=i;throw new m(`Failed to create parent directory for symlink: ${o.message}`,D.IO_ERROR)}try{let i=Xh();return await J.symlink(t,e,i),"symlink"}catch(i){let o=i;if(o.code==="EPERM"){s.warn("Permission denied creating symlink. Windows: Enable Developer Mode or run as Administrator. Falling back to file copy...");try{await Gt(e)}catch{}return await Ea(t,e,r),"copy"}throw new m(`Failed to create symlink: ${o.message}`,D.IO_ERROR)}}function Fa(t,e){let r;return t.startsWith("file://")?r=t.slice(7):t.startsWith("file:")?r=t.slice(5):r=t,r.startsWith("/")||(r=B(e,r)),r}async function Qh(t,e){if(t.startsWith("https://")||t.startsWith("http://"))try{let s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status}`);let n=await s.json(),i=et.safeParse(n);if(!i.success)throw new Error(`Invalid manifest format: ${i.error.issues[0].message}`);let o=i.data,a=new URL(t),c=`${a.protocol}//${a.host}`,u=a.pathname.split("/");u.pop();let d=u.join("/"),h={};for(let p of o.files){let l=`${c}${d}/files/${p}`,g=await fetch(l);if(!g.ok)throw new Error(`Failed to download ${p}: HTTP ${g.status}`);h[p]=await g.text()}return{manifest:o,fileContents:h}}catch(s){throw s instanceof Error?new m(`Failed to read files from ${t}: ${s.message}`,D.IO_ERROR):s}let r=Fa(t,e);try{let s=B(r,"spectrl.jsonc"),n=B(r,"spectrl.json"),i;try{i=await z.readFile(s,"utf-8")}catch{i=await z.readFile(n,"utf-8")}let o=xt(i),a=et.safeParse(o);if(!a.success)throw new Error(`Invalid manifest in ${r}: ${a.error.issues[0].message}`);let c=a.data,u=B(r,"files"),d=!1;try{d=(await z.stat(u)).isDirectory()}catch{d=!1}let h={};for(let p of c.files){let l=d?B(r,"files",p):B(r,p);h[p]=await z.readFile(l,"utf-8")}return{manifest:c,fileContents:h}}catch(s){throw s instanceof Error?new m(`Failed to read files from ${t}: ${s.message}`,D.IO_ERROR):s}}async function em(t,e){let r=await e.listVersions(t);if(r.length===0)throw new m(`Spec ${S(t)} not found in registry`,D.DEPENDENCY_ERROR);return r.sort((n,i)=>jo(i,n))[0]}async function Qs(t,e){let{username:r,name:s,version:n}=t,{cwd:i}=e,o=ts({text:`Resolving ${S(`${r}/${s}`)}`,spinner:"line"}).start();try{await Kr(i,{skipAgents:!process.stdin.isTTY,spinner:o}),o.text=`Fetching ${S(`${r}/${s}`)} from public registry`;let a;try{a=await bt(r,s)}catch(N){throw N instanceof V&&N.statusCode===404?new m(`Spec ${S(`${r}/${s}`)} not found in public registry`,D.DEPENDENCY_ERROR):N}let c=n||a.versions[0]?.version;if(!c)throw new m(`No versions available for ${S(`${r}/${s}`)}`,D.DEPENDENCY_ERROR);let u=a.versions.find(N=>N.version===c);if(!u)throw new m(`Version ${S(c)} not found for ${S(`${r}/${s}`)}`,D.DEPENDENCY_ERROR);let d=Ut(r,s,c);o.text=`Found ${S(d)}`,o.stop();let h=await xa(s,c,!0,r,i);await va(h,d,"public",i),o.start(`Installing ${S(d)}`);let p=Yr(i,r,s,c),l=B(p,"spectrl.json");try{let N=await z.readFile(l,"utf-8"),G=JSON.parse(N),Y=et.safeParse(G);if(!Y.success)throw new Error("Invalid manifest");if(Y.data.hash===u.hash){o.succeed(`${S(d)} already installed at ${S(`.spectrl/specs/${Zr(r,s,c)}`)}`);let fe=le(i),X={};try{let Re=await z.readFile(fe,"utf-8");X=JSON.parse(Re)}catch(Re){if(Re.code!=="ENOENT")throw Re}let ae=`${wa()}/${u.s3Path}/spectrl.json`;X[d]={source:ae,hash:u.hash};let ge=JSON.stringify(X,null,2);await z.writeFile(fe,`${ge}
|
|
125
|
+
`,"utf-8"),await yr(i);return}}catch(N){if(N.code!=="ENOENT")throw N}o.text=`Downloading ${S(d)} manifest`;let g=wa(),w=`${g}/${u.s3Path}/spectrl.json`,x;try{x=await fetch(w)}catch(N){throw new m(`Failed to download manifest: ${N instanceof Error?N.message:String(N)}`,D.IO_ERROR)}if(!x.ok)throw new m(`Failed to download manifest: HTTP ${x.status}`,D.IO_ERROR);let A=await x.json(),$=et.safeParse(A);if(!$.success)throw new m(`Downloaded manifest is invalid: ${$.error.issues[0].message}`,D.VALIDATION_ERROR);let L=$.data,q={...L,hash:u.hash};await J.ensureDir(p),await z.writeFile(l,JSON.stringify(q,null,2),"utf-8"),o.text=`Downloading ${S(d)} files (${L.files.length} files)`;for(let N of L.files){let G=`${g}/${u.s3Path}/files/${N}`,Y;try{Y=await fetch(G)}catch(X){throw new m(`Failed to download file ${N}: ${X instanceof Error?X.message:String(X)}`,D.IO_ERROR)}if(!Y.ok)throw new m(`Failed to download file ${N}: HTTP ${Y.status}`,D.IO_ERROR);let Me=await Y.text(),fe=B(p,N);await J.ensureDir(Vt(fe)),await z.writeFile(fe,Me,"utf-8")}o.text="Updating project index";let U=le(i),Le={};try{let N=await z.readFile(U,"utf-8");Le=JSON.parse(N)}catch(N){if(N.code!=="ENOENT")throw new m(`Failed to read project index: ${N.message}`,D.IO_ERROR)}Le[d]={source:w,hash:u.hash};try{let N=JSON.stringify(Le,null,2);await z.writeFile(U,`${N}
|
|
126
|
+
`,"utf-8")}catch(N){o.warn("Failed to update index, rolling back installation...");try{await J.remove(p)}catch{}throw new m(`Failed to update project index: ${N.message}`,D.IO_ERROR)}o.succeed(`Installed ${S(d)} from public registry at ${S(`.spectrl/specs/${Zr(r,s,c)}`)}`),await yr(i)}catch(a){throw o.stop(),a instanceof m?a:a instanceof V?new m(`API error: ${a.message}`,a.statusCode&&a.statusCode>=500?D.IO_ERROR:D.DEPENDENCY_ERROR):a instanceof Error?new m(a.message,D.IO_ERROR):new m("Unknown error during install",D.IO_ERROR)}}async function Ra(t,e){try{let{cwd:r,registry:s}=e;await Kr(r,{skipAgents:!process.stdin.isTTY});let n;try{n=_e(t)}catch(o){throw new m(`Invalid spec reference format: ${t}. ${o instanceof Error?o.message:String(o)}`,D.VALIDATION_ERROR)}if(n.isPublic&&n.username)return await Qs({username:n.username,name:n.name,version:n.version},{cwd:r});let i=ts({text:`Installing ${S(t)}`,spinner:"line"}).start();try{let{name:o,version:a}=n,c=new Qe(s??qt());a||(i.text=`Resolving ${S(o)}...`,a=await em(o,c),i.text=`Resolved ${S(o)} to version ${S(a)}`);let u=`${o}@${a}`;i.stop();let d=await xa(o,a,!1,void 0,r);if(await va(d,u,"local",r),i.start(`Installing ${S(u)}`),i.text=`Looking up ${S(u)} in registry`,!await c.exists(o,a))throw new m(`Spec ${S(u)} not found in registry`,D.DEPENDENCY_ERROR);i.text=`Reading manifest for ${S(u)}`;let p=await c.getManifest(o,a);if(!p.hash)throw new m(`Manifest for ${u} is missing hash`,D.VALIDATION_ERROR);let l=c.paths.files(o,a),g=B(r,".spectrl","specs",u);i.text=`Checking ${S(u)}`;let w=await Ca(g,l);if(w.exists&&w.isSymlink&&w.isCorrect){i.succeed(`${S(u)} already installed at ${S(`.spectrl/specs/${u}`)}`),i.text="Updating project index";let G=B(r,".spectrl","spectrl-index.json"),Y={};try{let X=await z.readFile(G,"utf-8");Y=JSON.parse(X)}catch(X){if(X.code!=="ENOENT")throw X}let Me=c.paths.spec(o,a);Y[u]={source:Me,hash:p.hash};let fe=JSON.stringify(Y,null,2);await z.writeFile(G,`${fe}
|
|
127
|
+
`,"utf-8"),await yr(r);return}let x=!1;w.exists&&(w.isSymlink?i.text=`Updating symlink for ${S(u)}`:(i.text=`Upgrading ${S(u)} from copied files to symlink`,x=!0),await Gt(g)),i.text=`Installing ${S(u)}`;let A=await ba(l,g,p,i);if(!await J.pathExists(g))throw new m(`Installation verification failed: ${g} does not exist after installation`,D.IO_ERROR);i.text="Updating project index";let L=B(r,".spectrl","spectrl-index.json"),q={};try{let G=await z.readFile(L,"utf-8");q=JSON.parse(G)}catch(G){if(G.code!=="ENOENT")throw new m(`Failed to read project index: ${G.message}`,D.IO_ERROR)}let U=c.paths.spec(o,a);q[u]={source:U,hash:p.hash};try{let G=JSON.stringify(q,null,2);await z.writeFile(L,`${G}
|
|
128
|
+
`,"utf-8")}catch(G){i.warn("Failed to update index, rolling back installation...");try{await Gt(g)}catch{}throw new m(`Failed to update project index: ${G.message}`,D.IO_ERROR)}let Le=A==="symlink"?"symlink":"copied files",N=x?"Upgraded":"Installed";i.succeed(`${N} ${S(u)} using ${Le} at ${S(`.spectrl/specs/${u}`)}`),await yr(r)}catch(o){throw i.stop(),o instanceof m?o:o instanceof Error?new m(o.message,D.IO_ERROR):new m("Unknown error during install",D.IO_ERROR)}}catch(r){throw r instanceof m?r:r instanceof Error?new m(r.message,D.IO_ERROR):new m("Unknown error during install",D.IO_ERROR)}}async function Sa(t){let e=ts({text:"Installing specs",spinner:"line"}).start();try{let{cwd:r,registry:s}=t;await Kr(r,{skipAgents:!process.stdin.isTTY,spinner:e}),e.text="Resolving dependencies";let n=le(r),i=B(r,".spectrl","spectrl-index.json"),a=await new Pr().resolveClosureFromIndex(i);if(a.length===0){e.info("No specs to install");return}let c={total:a.length,symlinked:0,copied:0,upgraded:0,skipped:0};e.text=`Resolving ${c.total} spec(s)`;let u=new Qe(s??qt()),d=[],h=B(r,".spectrl"),p={};try{let x=await z.readFile(n,"utf-8");p=JSON.parse(x)}catch(x){if(x.code!=="ENOENT")throw x}for(let x of a){let{name:A,version:$,source:L,deps:q}=x,U=`${A}@${$}`;e.text=`Processing ${S(U)}`;let Le=L.startsWith("https://")||L.startsWith("http://"),{manifest:N,fileContents:G}=await Qh(L,h),Y=Nr({manifest:N,fileContents:G});if(Le){let Me=U.split("/"),fe=Me.length>1?B(r,".spectrl","specs",`${Me[0]}-${Me[1]}`):B(r,".spectrl","specs",U),X=B(fe,"spectrl.json"),$e=!1;try{let ae=await z.readFile(X,"utf-8"),ge=JSON.parse(ae),Re=et.safeParse(ge);Re.success&&Re.data.hash===Y&&($e=!0,c.skipped++)}catch{}if(!$e){await J.ensureDir(fe),await z.writeFile(X,JSON.stringify(N,null,2),"utf-8");for(let ae of N.files){let ge=B(fe,ae);await J.ensureDir(Vt(ge)),await z.writeFile(ge,G[ae],"utf-8")}c.copied++}p[U]={source:L,hash:Y}}else{if(await u.exists(A,$)){if((await u.getManifest(A,$)).hash!==Y)throw new m(`Integrity breach: hash mismatch for ${U}`,D.IO_ERROR)}else{let ge={...N,hash:Y},Re=Fa(L,h);await u.publish(ge,Re)}let fe=u.paths.spec(A,$),X=u.paths.files(A,$),$e=B(r,".spectrl","specs",U);e.text=`Checking ${S(U)}`;let ae=await Ca($e,X);if(ae.exists&&ae.isSymlink&&ae.isCorrect)c.skipped++;else{let ge=!1;ae.exists&&!ae.isSymlink?(e.text=`Upgrading ${S(U)} from copied files to symlink`,await Gt($e),ge=!0):ae.exists&&!ae.isCorrect?(e.text=`Updating symlink for ${S(U)}`,await Gt($e)):e.text=`Creating symlink for ${S(U)}`;let Re=await ba(X,$e,N,e);if(!await J.pathExists($e))throw new m(`Installation verification failed: ${$e} does not exist after installation`,D.IO_ERROR);ge?c.upgraded++:Re==="symlink"?c.symlinked++:c.copied++}p[U]={source:fe,hash:Y}}d.push({name:A,version:$,hash:Y,source:L,deps:q})}e.text="Updating project index";try{let x=JSON.stringify(p,null,2);await z.writeFile(n,`${x}
|
|
129
129
|
`,"utf-8")}catch(x){throw new m(`Failed to update project index: ${x.message}`,D.IO_ERROR)}e.text="Writing lock file",d.sort((x,A)=>{let $=`${x.name}@${x.version}`,L=`${A.name}@${A.version}`;return $.localeCompare(L)});let l={createdAt:new Date().toISOString(),entries:d},g=B(r,".spectrl","lock.json");try{await z.writeFile(g,`${JSON.stringify(l,null,2)}
|
|
130
|
-
`,"utf-8")}catch(x){throw new m(`Failed to write lock file: ${x.message}`,D.IO_ERROR)}let w=[];c.symlinked>0&&w.push(`${c.symlinked} symlinked`),c.copied>0&&w.push(`${c.copied} copied`),c.upgraded>0&&w.push(`${c.upgraded} upgraded`),c.skipped>0&&w.push(`${c.skipped} skipped`),e.succeed(`Processed ${c.total} spec(s) (${w.join(", ")}), lock file written`),await
|
|
130
|
+
`,"utf-8")}catch(x){throw new m(`Failed to write lock file: ${x.message}`,D.IO_ERROR)}let w=[];c.symlinked>0&&w.push(`${c.symlinked} symlinked`),c.copied>0&&w.push(`${c.copied} copied`),c.upgraded>0&&w.push(`${c.upgraded} upgraded`),c.skipped>0&&w.push(`${c.skipped} skipped`),e.succeed(`Processed ${c.total} spec(s) (${w.join(", ")}), lock file written`),await yr(r)}catch(r){if(e.stop(),r instanceof pe){let s=r.exitCode===3?D.DEPENDENCY_ERROR:D.VALIDATION_ERROR;throw new m(r.message,s)}throw r instanceof m?r:r instanceof Error?new m(r.message,D.IO_ERROR):new m("Unknown error during install",D.IO_ERROR)}}import{writeFile as _a,mkdir as tm}from"node:fs/promises";import{join as en}from"node:path";import rm from"ora";function sm(t,e){return`{
|
|
131
131
|
"name": "${t}",
|
|
132
132
|
"version": "${e}",
|
|
133
133
|
"type": "spec",
|
|
@@ -211,23 +211,23 @@ Before publishing, verify:
|
|
|
211
211
|
- [ ] Edge cases or exceptions are called out explicitly
|
|
212
212
|
- [ ] The \`description\` field in spectrl.jsonc is filled in
|
|
213
213
|
- [ ] The \`agent.purpose\` field explains *when* to activate this power
|
|
214
|
-
`;async function
|
|
215
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as $m}from"node:util";import{execFile as Im}from"node:child_process";var Om=$m(Im),
|
|
214
|
+
`;async function Aa(t,e,r="spec",s="0.1.0",n){let i=rm({text:`Creating new ${r}`,spinner:"line"}).start();try{if(!/^[a-z0-9-]+$/.test(t))throw new m("Name must be lowercase alphanumeric with hyphens",D.VALIDATION_ERROR);let o=en(e,t);if(await Ue(o))throw new m(`Directory already exists: ${t}`,D.VALIDATION_ERROR);i.text=`Creating directory ${t}`,await tm(o,{recursive:!0});let a=r==="power"?nm(t,s):sm(t,s),c=en(o,"spectrl.jsonc");await _a(c,a,"utf-8");let u=r==="power"?om:im,d=en(o,"index.md");await _a(d,u,"utf-8"),i.succeed(`Created new ${r} ${S(t)} at ${S(`${t}/spectrl.jsonc`)}`)}catch(o){throw i.stop(),o}}import rt from"chalk";import Ga from"node:process";import Ha from"node:path";import{fileURLToPath as Mm}from"node:url";import jm from"node:child_process";import Bm,{constants as Wm}from"node:fs/promises";import{promisify as Dm}from"node:util";import ym from"node:child_process";import on,{constants as Pa}from"node:fs/promises";import Oa from"node:process";import dm from"node:os";import fm from"node:fs";import um from"node:fs";import $a from"node:fs";var tn;function am(){try{return $a.statSync("/.dockerenv"),!0}catch{return!1}}function cm(){try{return $a.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function rn(){return tn===void 0&&(tn=am()||cm()),tn}var sn,lm=()=>{try{return um.statSync("/run/.containerenv"),!0}catch{return!1}};function Ht(){return sn===void 0&&(sn=lm()||rn()),sn}var Ia=()=>{if(Oa.platform!=="linux")return!1;if(dm.release().toLowerCase().includes("microsoft"))return!Ht();try{return fm.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ht():!1}catch{return!1}},ze=Oa.env.__IS_WSL_TEST__?Ia:Ia();import ka from"node:process";import{Buffer as pm}from"node:buffer";import{promisify as hm}from"node:util";import mm from"node:child_process";var gm=hm(mm.execFile),nn=()=>`${ka.env.SYSTEMROOT||ka.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var he=async(t,e={})=>{let{powerShellPath:r,...s}=e,n=he.encodeCommand(t);return gm(r??nn(),[...he.argumentsPrefix,n],{encoding:"utf8",...s})};he.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];he.encodeCommand=t=>pm.from(t,"utf16le").toString("base64");he.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`;var wm=Dm(ym.execFile),Em=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",s=!1;try{await on.access(r,Pa.F_OK),s=!0}catch{}if(!s)return t;let n=await on.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),xm=async()=>`${await Em()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,rs=ze?xm:nn,Ta,Na=async()=>(Ta??=(async()=>{try{let t=await rs();return await on.access(t,Pa.X_OK),!0}catch{return!1}})(),Ta),La=async()=>{let t=await rs(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await he(e,{powerShellPath:t});return r.trim()},Ma=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await wm("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}};function Rt(t,e,r){let s=n=>Object.defineProperty(t,e,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let n=r();return s(n),n},set(n){s(n)}}),t}import{promisify as km}from"node:util";import dn from"node:process";import{execFile as Tm}from"node:child_process";import{promisify as vm}from"node:util";import Cm from"node:process";import{execFile as bm}from"node:child_process";var Fm=vm(bm);async function an(){if(Cm.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await Fm("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}import Rm from"node:process";import{promisify as Sm}from"node:util";import{execFile as _m,execFileSync as i0}from"node:child_process";var Am=Sm(_m);async function ja(t,{humanReadableOutput:e=!0,signal:r}={}){if(Rm.platform!=="darwin")throw new Error("macOS only");let s=e?[]:["-ss"],n={};r&&(n.signal=r);let{stdout:i}=await Am("osascript",["-e",t,s],n);return i.trim()}async function cn(t){return ja(`tell application "Finder" to set app_path to application file id "${t}" as string
|
|
215
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as $m}from"node:util";import{execFile as Im}from"node:child_process";var Om=$m(Im),Ba={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},un=new Map(Object.entries(Ba)),ss=class extends Error{};async function ln(t=Om){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new ss(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:s}=r.groups,n=Ba[s];if(!n)throw new ss(`Unknown browser ID: ${s}`);return n}var Pm=km(Tm),Nm=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function fn(){if(dn.platform==="darwin"){let t=await an();return{name:await cn(t),id:t}}if(dn.platform==="linux"){let{stdout:t}=await Pm("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:Nm(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(dn.platform==="win32")return ln();throw new Error("Only macOS, Linux, and Windows are supported")}import pn from"node:process";var Lm=!!(pn.env.SSH_CONNECTION||pn.env.SSH_CLIENT||pn.env.SSH_TTY),Wa=Lm;var ns=Symbol("fallbackAttempt"),hn=import.meta.url?Ha.dirname(Mm(import.meta.url)):"",qa=Ha.join(hn,"xdg-open"),{platform:Jt,arch:Ua}=Ga,za=async(t,e)=>{if(t.length===0)return;let r=[];for(let s of t)try{return await e(s)}catch(n){r.push(n)}throw new AggregateError(r,"Failed to open in all supported apps")},is=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[ns]===!0;if(delete t[ns],Array.isArray(t.app))return za(t.app,u=>is({...t,app:u,[ns]:!0}));let{name:r,arguments:s=[]}=t.app??{};if(s=[...s],Array.isArray(r))return za(r,u=>is({...t,app:{name:u,arguments:s},[ns]:!0}));if(r==="browser"||r==="browserPrivate"){let u={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},d={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},h;if(ze){let p=await La();h=un.get(p)??{}}else h=await fn();if(h.id in u){let p=u[h.id.toLowerCase()];if(r==="browserPrivate"){if(p==="safari")throw new Error("Safari doesn't support opening in private mode via command line");s.push(d[p])}return is({...t,app:{name:Zt[p],arguments:s}})}throw new Error(`${h.name} is not supported as a default browser`)}let n,i=[],o={},a=!1;if(ze&&!Ht()&&!Wa&&!r&&(a=await Na()),Jt==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(Jt==="win32"||a){n=await rs(),i.push(...he.argumentsPrefix),ze||(o.windowsVerbatimArguments=!0),ze&&t.target&&(t.target=await Ma(t.target));let u=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&u.push("-Wait"),r?(u.push(he.escapeArgument(r)),t.target&&s.push(t.target)):t.target&&u.push(he.escapeArgument(t.target)),s.length>0&&(s=s.map(d=>he.escapeArgument(d)),u.push("-ArgumentList",s.join(","))),t.target=he.encodeCommand(u.join(" ")),t.wait||(o.stdio="ignore")}else{if(r)n=r;else{let u=!hn||hn==="/",d=!1;try{await Bm.access(qa,Wm.X_OK),d=!0}catch{}n=Ga.versions.electron??(Jt==="android"||u||!d)?"xdg-open":qa}s.length>0&&i.push(...s),t.wait||(o.stdio="ignore",o.detached=!0)}Jt==="darwin"&&s.length>0&&i.push("--args",...s),t.target&&i.push(t.target);let c=jm.spawn(n,i,o);return t.wait?new Promise((u,d)=>{c.once("error",d),c.once("close",h=>{if(!t.allowNonzeroExitCode&&h!==0){d(new Error(`Exited with code ${h}`));return}u(c)})}):e?new Promise((u,d)=>{c.once("error",d),c.once("spawn",()=>{c.once("close",h=>{if(c.off("error",d),h!==0){d(new Error(`Exited with code ${h}`));return}c.unref(),u(c)})})}):(c.unref(),new Promise((u,d)=>{c.once("error",d),c.once("spawn",()=>{c.off("error",d),u(c)})}))},qm=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return is({...e,target:t})};function Va(t){if(typeof t=="string"||Array.isArray(t))return t;let{[Ua]:e}=t;if(!e)throw new Error(`${Ua} is not supported`);return e}function wr({[Jt]:t},{wsl:e}={}){if(e&&ze)return Va(e);if(!t)throw new Error(`${Jt} is not supported`);return Va(t)}var Zt={browser:"browser",browserPrivate:"browserPrivate"};Rt(Zt,"chrome",()=>wr({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Rt(Zt,"brave",()=>wr({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));Rt(Zt,"firefox",()=>wr({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Rt(Zt,"edge",()=>wr({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Rt(Zt,"safari",()=>wr({darwin:"Safari"}));var Ja=qm;var Um=f.object({device_code:f.string(),user_code:f.string(),verification_uri:f.string(),expires_in:f.number(),interval:f.number()}),zm=f.object({token:f.string(),username:f.string()}),Vm=f.object({error:f.string().optional(),message:f.string().optional(),status:f.string().optional()});async function Za(){let t=new ve;v.log(K(K(`Initiating GitHub authentication...
|
|
216
216
|
`)));try{let e=await fetch(`${Ct()}/auth/device/init`,{method:"POST"});if(!e.ok)throw v.error("Failed to initiate authentication"),new Error("Device flow initialization failed");let r=await e.json(),s=Um.safeParse(r);if(!s.success)throw v.error("Invalid response from authentication server"),console.error(rt.dim("Validation error:"),s.error.message),new Error("Device flow initialization failed");let{device_code:n,user_code:i,verification_uri:o,expires_in:a,interval:c}=s.data;console.log(rt.bold(`Please visit: ${rt.cyan(o)}`)),console.log(rt.bold(`
|
|
217
217
|
Enter code: ${rt.green(i)}
|
|
218
218
|
`)),v.log(K(`Opening browser...
|
|
219
|
-
`)),await
|
|
220
|
-
\u2713 Logged in as ${rt.bold(w)}`)));return}if(h.status!==202&&h.status===400){let p=await h.json(),l=Vm.safeParse(p),g=l.success&&(l.data.message||l.data.error)||"Unknown error";throw v.error(`Authentication failed: ${g}`),new Error("Authentication failed")}}throw v.error("Authentication timed out"),new Error("Authentication timed out")}catch(e){throw e instanceof Error?e:new Error("Authentication failed")}}import Gm from"chalk";async function
|
|
221
|
-
`),D.VALIDATION_ERROR);let{username:r,name:s,version:n}=e,i=
|
|
219
|
+
`)),await Ja(o);let d=Date.now()+a*1e3;for(v.log(K("Waiting for authorization..."));Date.now()<d;){await new Promise(p=>setTimeout(p,c*1e3));let h=await fetch(`${Ct()}/auth/device/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:n})});if(h.status===200){let p=await h.json(),l=zm.safeParse(p);if(!l.success)throw v.error("Invalid response from server"),console.error(rt.dim("Validation error:"),l.error.message),new Error("Missing token or username in response");let{token:g,username:w}=l.data;await t.store(g),v.log(K(rt.green(`
|
|
220
|
+
\u2713 Logged in as ${rt.bold(w)}`)));return}if(h.status!==202&&h.status===400){let p=await h.json(),l=Vm.safeParse(p),g=l.success&&(l.data.message||l.data.error)||"Unknown error";throw v.error(`Authentication failed: ${g}`),new Error("Authentication failed")}}throw v.error("Authentication timed out"),new Error("Authentication timed out")}catch(e){throw e instanceof Error?e:new Error("Authentication failed")}}import Gm from"chalk";async function Ya(){await new ve().delete(),v.log(Gm.green("\u2713 Logged out"))}import Yt from"chalk";var Hm=f.object({login:f.string()});async function Xa(){let e=await new ve().get();if(!e){console.log(Yt.dim("Not logged in")),console.log(`Run: ${H("spectrl login")}`);return}try{let r=await fetch("https://api.github.com/user",{headers:{Authorization:`Bearer ${e}`}});if(!r.ok){console.log(Yt.yellow("Token invalid")),console.log(`Run: ${H("spectrl login")}`);return}let s=await r.json(),n=Hm.safeParse(s);if(!n.success){console.log(Yt.red("\u2717 Invalid response from GitHub API")),console.log(`Run: ${H("spectrl login")}`);return}let i=n.data;console.log(Yt.green(`Logged in as ${Yt.bold(i.login)}`))}catch{console.log(Yt.red("\u2717 Failed to verify token")),console.log(`Run: ${H("spectrl login")}`)}}import os from"chalk";import{select as Jm}from"@inquirer/prompts";async function Ka(t){try{let e;try{e=_e(t)}catch(u){throw new m(`Invalid spec reference: ${u instanceof Error?u.message:String(u)}`,D.VALIDATION_ERROR)}if(!e.isPublic||!e.username)throw new m("Unpublish only works with public specs. Use format: username/spec@version",D.VALIDATION_ERROR);if(!e.version)throw new m(["Version is required for unpublish","",`Usage: spectrl unpublish ${S(`${e.username}/${e.name}@<version>`)}`,"","Example: spectrl unpublish alice/api-spec@1.0.0"].join(`
|
|
221
|
+
`),D.VALIDATION_ERROR);let{username:r,name:s,version:n}=e,i=Ut(r,s,n),a=await new ve().get();if(!a)throw new m(`You need to login first to unpublish specs
|
|
222
222
|
|
|
223
|
-
Run: ${H("spectrl login")}`,D.AUTHENTICATION_ERROR);if(v.log(""),v.log(os.yellow(`\u26A0\uFE0F This will permanently delete ${S(i)} from the public registry.`)),v.log(""),!await Jm({message:"Are you sure you want to continue?",choices:[{name:"No, cancel",value:!1,description:"Keep the spec and abort"},{name:`Yes, delete ${i}`,value:!0,description:"Permanently remove this version from the registry"}],default:!1})){v.log(os.dim("Cancelled"));return}v.log(""),v.log(os.dim(`Unpublishing ${S(i)}...`));try{let u=await
|
|
224
|
-
`),D.AUTHENTICATION_ERROR):u.statusCode===404?new m(`Spec version ${S(i)} not found in the registry`,D.DEPENDENCY_ERROR):new m(`Failed to unpublish: ${u.message}`,D.IO_ERROR):u}}catch(e){throw e instanceof m?e:new m(`Unpublish failed: ${e instanceof Error?e.message:String(e)}`,D.IO_ERROR)}}var
|
|
223
|
+
Run: ${H("spectrl login")}`,D.AUTHENTICATION_ERROR);if(v.log(""),v.log(os.yellow(`\u26A0\uFE0F This will permanently delete ${S(i)} from the public registry.`)),v.log(""),!await Jm({message:"Are you sure you want to continue?",choices:[{name:"No, cancel",value:!1,description:"Keep the spec and abort"},{name:`Yes, delete ${i}`,value:!0,description:"Permanently remove this version from the registry"}],default:!1})){v.log(os.dim("Cancelled"));return}v.log(""),v.log(os.dim(`Unpublishing ${S(i)}...`));try{let u=await fa(a,r,s,n);v.log(""),v.log(os.green(`\u2713 ${u.message}`)),v.log("")}catch(u){throw u instanceof V?u.statusCode===401||u.statusCode===403?new m(["Authentication failed","","Your token may have expired or you may not have permission to unpublish this spec.","","Try logging in again: spectrl login"].join(`
|
|
224
|
+
`),D.AUTHENTICATION_ERROR):u.statusCode===404?new m(`Spec version ${S(i)} not found in the registry`,D.DEPENDENCY_ERROR):new m(`Failed to unpublish: ${u.message}`,D.IO_ERROR):u}}catch(e){throw e instanceof m?e:new m(`Unpublish failed: ${e instanceof Error?e.message:String(e)}`,D.IO_ERROR)}}var Qc=At(br(),1),ds=At(Bs(),1);import Z from"chalk";import{promises as eu}from"node:fs";import Og from"fs-extra";async function Fn(t){try{let e=le(t),r=await eu.readFile(e,"utf-8");return JSON.parse(r)}catch(e){throw e.code==="ENOENT"?new m(`Project not initialized
|
|
225
225
|
|
|
226
|
-
Run: ${H("spectrl init")}`,D.VALIDATION_ERROR):new m(`Failed to read project index: ${e instanceof Error?e.message:String(e)}`,D.IO_ERROR)}}async function kg(t){let e=await Fn(t),r=[],s=Object.entries(e).filter(([n,i])=>i.source.startsWith("https://")||i.source.startsWith("http://"));if(s.length===0)return[];for(let[n]of s)try{let i=_e(n);if(!i.isPublic||!i.username||!i.version)continue;let{username:o,name:a,version:c}=i,u=await bt(o,a);if(u.versions.length===0)continue;let d=u.versions[0].version;ds.default.valid(c)&&ds.default.valid(d)&&ds.default.gt(d,c)&&r.push({specKey:n,username:o,name:a,currentVersion:c,latestVersion:d})}catch{}return r}async function Rn(t,e,r,s){let n=await Fn(s),i=Object.keys(n).filter(o=>{let a=_e(o);return a.isPublic&&a.username===t&&a.name===e});if(await Qs({username:t,name:e,version:r},{cwd:s}),i.length>0){let o=le(s),a=await Fn(s);for(let c of i){if(c===
|
|
227
|
-
`,"utf-8")}}async function
|
|
226
|
+
Run: ${H("spectrl init")}`,D.VALIDATION_ERROR):new m(`Failed to read project index: ${e instanceof Error?e.message:String(e)}`,D.IO_ERROR)}}async function kg(t){let e=await Fn(t),r=[],s=Object.entries(e).filter(([n,i])=>i.source.startsWith("https://")||i.source.startsWith("http://"));if(s.length===0)return[];for(let[n]of s)try{let i=_e(n);if(!i.isPublic||!i.username||!i.version)continue;let{username:o,name:a,version:c}=i,u=await bt(o,a);if(u.versions.length===0)continue;let d=u.versions[0].version;ds.default.valid(c)&&ds.default.valid(d)&&ds.default.gt(d,c)&&r.push({specKey:n,username:o,name:a,currentVersion:c,latestVersion:d})}catch{}return r}async function Rn(t,e,r,s){let n=await Fn(s),i=Object.keys(n).filter(o=>{let a=_e(o);return a.isPublic&&a.username===t&&a.name===e});if(await Qs({username:t,name:e,version:r},{cwd:s}),i.length>0){let o=le(s),a=await Fn(s);for(let c of i){if(c===Ut(t,e,r))continue;delete a[c];let u=_e(c);if(u.version){let d=Yr(s,t,e,u.version);try{await Og.remove(d)}catch{}}}await eu.writeFile(o,`${JSON.stringify(a,null,2)}
|
|
227
|
+
`,"utf-8")}}async function tu(t,e={}){let r=e.cwd||process.cwd();try{if(t)return await Tg(t,r);v.log(Z.dim(`Checking for updates...
|
|
228
228
|
`));let s=await kg(r);if(s.length===0){v.log(Z.green(`\u2713 All specs are up to date
|
|
229
229
|
`));return}v.log(Z.bold(`Updates available:
|
|
230
|
-
`));let n=new
|
|
230
|
+
`));let n=new Qc.default({head:[Z.cyan("Spec"),Z.cyan("Installed"),Z.cyan("Latest")],colWidths:[30,15,15],style:{head:[],border:["dim"]}});for(let{username:i,name:o,currentVersion:a,latestVersion:c}of s)n.push([Z.bold(`${i}/${o}`),Z.yellow(a),Z.green(c)]);if(v.log(n.toString()),v.log(""),v.log(Z.dim("Run 'spectrl update <spec>' to update a specific spec")),v.log(Z.dim(`Run 'spectrl update --all' to update all specs
|
|
231
231
|
`)),e.all){v.log(Z.bold(`Updating all specs...
|
|
232
232
|
`));for(let{username:i,name:o,latestVersion:a}of s)v.log(Z.dim(`Updating ${S(`${i}/${o}`)}...`)),await Rn(i,o,a,r);v.log(""),v.log(Z.green(`\u2713 Updated ${s.length} spec${s.length===1?"":"s"}
|
|
233
233
|
`))}}catch(s){throw s instanceof m?s:new m(`Update failed: ${s instanceof Error?s.message:String(s)}`,D.IO_ERROR)}}async function Tg(t,e){try{let r=_e(t);if(!r.isPublic||!r.username)throw new m("Update only works with public specs. Use format: username/spec or username/spec@version",D.VALIDATION_ERROR);let{username:s,name:n,version:i}=r;if(i){v.log(Z.dim(`Updating to ${S(`${s}/${n}@${i}`)}...
|
|
@@ -235,22 +235,22 @@ Run: ${H("spectrl init")}`,D.VALIDATION_ERROR):new m(`Failed to read project ind
|
|
|
235
235
|
`));return}v.log(Z.dim(`Fetching latest version of ${S(`${s}/${n}`)}...
|
|
236
236
|
`));try{let o=await bt(s,n);if(o.versions.length===0)throw new m(`No versions available for ${S(`${s}/${n}`)}`,D.DEPENDENCY_ERROR);let a=o.versions[0].version;v.log(Z.dim(`Updating to ${S(`${s}/${n}@${a}`)}...
|
|
237
237
|
`)),await Rn(s,n,a,e),v.log(""),v.log(Z.green(`\u2713 Updated to ${S(`${s}/${n}@${a}`)}
|
|
238
|
-
`))}catch(o){throw o instanceof V&&o.statusCode===404?new m(`Spec ${S(`${s}/${n}`)} not found in public registry`,D.DEPENDENCY_ERROR):o}}catch(r){throw r instanceof m?r:new m(`Update failed: ${r instanceof Error?r.message:String(r)}`,D.IO_ERROR)}}var
|
|
238
|
+
`))}catch(o){throw o instanceof V&&o.statusCode===404?new m(`Spec ${S(`${s}/${n}`)} not found in public registry`,D.DEPENDENCY_ERROR):o}}catch(r){throw r instanceof m?r:new m(`Update failed: ${r instanceof Error?r.message:String(r)}`,D.IO_ERROR)}}var ru=At(br(),1);import Ce from"chalk";async function su(t){if(!t||t.trim().length===0)throw new m("Search query cannot be empty",D.VALIDATION_ERROR);try{let e=await da(t.trim());if(e.results.length===0){console.log(Ce.yellow(`
|
|
239
239
|
No specs found`)),console.log(Ce.dim("Try a different search term or browse all specs")),console.log(`Example: ${H("spectrl search api")}
|
|
240
240
|
`);return}let r=e.results.length;console.log(Ce.bold(`
|
|
241
241
|
Found ${r} spec${r===1?"":"s"} matching "${t}":
|
|
242
|
-
`));let s=new
|
|
242
|
+
`));let s=new ru.default({head:[Ce.cyan("Spec"),Ce.cyan("Description"),Ce.cyan("Tags"),Ce.cyan("Version")],colWidths:[35,40,18,10],wordWrap:!0,style:{head:[],border:["dim"]}});for(let n of e.results){let i=n.specId||Ce.dim("unknown"),o=n.description||Ce.dim("No description"),a=n.tags&&n.tags.length>0?n.tags.join(", "):Ce.dim("none"),c=n.version||Ce.dim("unknown");s.push([Ce.bold(i),o,a,c])}console.log(s.toString()),console.log(`
|
|
243
243
|
Install with: ${H("spectrl install <spec>")}`),console.log(`Example: ${H("spectrl install alice/api-spec")}
|
|
244
|
-
`)}catch(e){throw e instanceof m?e:e instanceof Error?new m(`Search failed: ${e.message}`,D.IO_ERROR):new m("Unknown error during search",D.IO_ERROR)}}var bu=_t(Cr(),1);import st from"chalk";var Pg=Math.pow(10,8)*24*60*60*1e3,qv=-Pg;var br=43200,Sn=1440;var Ng=3600;var iu=Ng*24,Uv=iu*7,Lg=iu*365.2425,Mg=Lg/12,zv=Mg*3,_n=Symbol.for("constructDateFrom");function Kt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&_n in t?t[_n](e):t instanceof Date?new t.constructor(e):new Date(e)}function de(t,e){return Kt(e||t,t)}var jg={};function ou(){return jg}function An(t){let e=de(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function Qt(t,...e){let r=Kt.bind(null,t||e.find(s=>typeof s=="object"));return e.map(r)}function er(t,e){let r=+de(t)-+de(e);return r<0?-1:r>0?1:r}function au(t){return Kt(t,Date.now())}function cu(t,e,r){let[s,n]=Qt(r?.in,t,e),i=s.getFullYear()-n.getFullYear(),o=s.getMonth()-n.getMonth();return i*12+o}function uu(t){return e=>{let s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function lu(t,e){return+de(t)-+de(e)}function du(t,e){let r=de(t,e?.in);return r.setHours(23,59,59,999),r}function fu(t,e){let r=de(t,e?.in),s=r.getMonth();return r.setFullYear(r.getFullYear(),s+1,0),r.setHours(23,59,59,999),r}function pu(t,e){let r=de(t,e?.in);return+du(r,e)==+fu(r,e)}function hu(t,e,r){let[s,n,i]=Qt(r?.in,t,t,e),o=er(n,i),a=Math.abs(cu(n,i));if(a<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*a);let c=er(n,i)===-o;pu(s)&&a===1&&er(s,i)===1&&(c=!1);let u=o*(a-+c);return u===0?0:u}function mu(t,e,r){let s=lu(t,e)/1e3;return uu(r?.roundingMethod)(s)}var Bg={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},gu=(t,e,r)=>{let s,n=Bg[t];return typeof n=="string"?s=n:e===1?s=n.one:s=n.other.replace("{{count}}",e.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function fs(t){return(e={})=>{let r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}var Wg={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qg={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ug={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Du={date:fs({formats:Wg,defaultWidth:"full"}),time:fs({formats:qg,defaultWidth:"full"}),dateTime:fs({formats:Ug,defaultWidth:"full"})};var zg={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},yu=(t,e,r,s)=>zg[t];function tr(t){return(e,r)=>{let s=r?.context?String(r.context):"standalone",n;if(s==="formatting"&&t.formattingValues){let o=t.defaultFormattingWidth||t.defaultWidth,a=r?.width?String(r.width):o;n=t.formattingValues[a]||t.formattingValues[o]}else{let o=t.defaultWidth,a=r?.width?String(r.width):t.defaultWidth;n=t.values[a]||t.values[o]}let i=t.argumentCallback?t.argumentCallback(e):e;return n[i]}}var Vg={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Gg={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Hg={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Jg={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Zg={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Yg={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Xg=(t,e)=>{let r=Number(t),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},wu={ordinalNumber:Xg,era:tr({values:Vg,defaultWidth:"wide"}),quarter:tr({values:Gg,defaultWidth:"wide",argumentCallback:t=>t-1}),month:tr({values:Hg,defaultWidth:"wide"}),day:tr({values:Jg,defaultWidth:"wide"}),dayPeriod:tr({values:Zg,defaultWidth:"wide",formattingValues:Yg,defaultFormattingWidth:"wide"})};function rr(t){return(e,r={})=>{let s=r.width,n=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],i=e.match(n);if(!i)return null;let o=i[0],a=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(a)?Qg(a,h=>h.test(o)):Kg(a,h=>h.test(o)),u;u=t.valueCallback?t.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;let d=e.slice(o.length);return{value:u,rest:d}}}function Kg(t,e){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function Qg(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function Eu(t){return(e,r={})=>{let s=e.match(t.matchPattern);if(!s)return null;let n=s[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;let a=e.slice(n.length);return{value:o,rest:a}}}var eD=/^(\d+)(th|st|nd|rd)?/i,tD=/\d+/i,rD={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},sD={any:[/^b/i,/^(a|c)/i]},nD={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},iD={any:[/1/i,/2/i,/3/i,/4/i]},oD={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},aD={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},cD={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uD={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},lD={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},dD={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},xu={ordinalNumber:Eu({matchPattern:eD,parsePattern:tD,valueCallback:t=>parseInt(t,10)}),era:rr({matchPatterns:rD,defaultMatchWidth:"wide",parsePatterns:sD,defaultParseWidth:"any"}),quarter:rr({matchPatterns:nD,defaultMatchWidth:"wide",parsePatterns:iD,defaultParseWidth:"any",valueCallback:t=>t+1}),month:rr({matchPatterns:oD,defaultMatchWidth:"wide",parsePatterns:aD,defaultParseWidth:"any"}),day:rr({matchPatterns:cD,defaultMatchWidth:"wide",parsePatterns:uD,defaultParseWidth:"any"}),dayPeriod:rr({matchPatterns:lD,defaultMatchWidth:"any",parsePatterns:dD,defaultParseWidth:"any"})};var $n={code:"en-US",formatDistance:gu,formatLong:Du,formatRelative:yu,localize:wu,match:xu,options:{weekStartsOn:0,firstWeekContainsDate:1}};function vu(t,e,r){let s=ou(),n=r?.locale??s.locale??$n,i=2520,o=er(t,e);if(isNaN(o))throw new RangeError("Invalid time value");let a=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:o}),[c,u]=Qt(r?.in,...o>0?[e,t]:[t,e]),d=mu(u,c),h=(An(u)-An(c))/1e3,p=Math.round((d-h)/60),l;if(p<2)return r?.includeSeconds?d<5?n.formatDistance("lessThanXSeconds",5,a):d<10?n.formatDistance("lessThanXSeconds",10,a):d<20?n.formatDistance("lessThanXSeconds",20,a):d<40?n.formatDistance("halfAMinute",0,a):d<60?n.formatDistance("lessThanXMinutes",1,a):n.formatDistance("xMinutes",1,a):p===0?n.formatDistance("lessThanXMinutes",1,a):n.formatDistance("xMinutes",p,a);if(p<45)return n.formatDistance("xMinutes",p,a);if(p<90)return n.formatDistance("aboutXHours",1,a);if(p<Sn){let g=Math.round(p/60);return n.formatDistance("aboutXHours",g,a)}else{if(p<i)return n.formatDistance("xDays",1,a);if(p<br){let g=Math.round(p/Sn);return n.formatDistance("xDays",g,a)}else if(p<br*2)return l=Math.round(p/br),n.formatDistance("aboutXMonths",l,a)}if(l=hu(u,c),l<12){let g=Math.round(p/br);return n.formatDistance("xMonths",g,a)}else{let g=l%12,w=Math.trunc(l/12);return g<3?n.formatDistance("aboutXYears",w,a):g<9?n.formatDistance("overXYears",w,a):n.formatDistance("almostXYears",w+1,a)}}function Cu(t,e){return vu(t,au(t),e)}async function Fu(t){let e;try{e=_e(t)}catch(r){throw r instanceof Error?new m(`Invalid spec reference: ${r.message}`,D.VALIDATION_ERROR):new m("Invalid spec reference format",D.VALIDATION_ERROR)}if(!e.isPublic||!e.username)throw new m("Info command requires a public spec reference (username/spec)",D.VALIDATION_ERROR);try{let r=await bt(e.username,e.name);if(console.log(st.bold.cyan(`
|
|
244
|
+
`)}catch(e){throw e instanceof m?e:e instanceof Error?new m(`Search failed: ${e.message}`,D.IO_ERROR):new m("Unknown error during search",D.IO_ERROR)}}var Cu=At(br(),1);import st from"chalk";var Pg=Math.pow(10,8)*24*60*60*1e3,qv=-Pg;var Fr=43200,Sn=1440;var Ng=3600;var nu=Ng*24,Uv=nu*7,Lg=nu*365.2425,Mg=Lg/12,zv=Mg*3,_n=Symbol.for("constructDateFrom");function Qt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&_n in t?t[_n](e):t instanceof Date?new t.constructor(e):new Date(e)}function de(t,e){return Qt(e||t,t)}var jg={};function iu(){return jg}function An(t){let e=de(t),r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),+t-+r}function er(t,...e){let r=Qt.bind(null,t||e.find(s=>typeof s=="object"));return e.map(r)}function tr(t,e){let r=+de(t)-+de(e);return r<0?-1:r>0?1:r}function ou(t){return Qt(t,Date.now())}function au(t,e,r){let[s,n]=er(r?.in,t,e),i=s.getFullYear()-n.getFullYear(),o=s.getMonth()-n.getMonth();return i*12+o}function cu(t){return e=>{let s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function uu(t,e){return+de(t)-+de(e)}function lu(t,e){let r=de(t,e?.in);return r.setHours(23,59,59,999),r}function du(t,e){let r=de(t,e?.in),s=r.getMonth();return r.setFullYear(r.getFullYear(),s+1,0),r.setHours(23,59,59,999),r}function fu(t,e){let r=de(t,e?.in);return+lu(r,e)==+du(r,e)}function pu(t,e,r){let[s,n,i]=er(r?.in,t,t,e),o=tr(n,i),a=Math.abs(au(n,i));if(a<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*a);let c=tr(n,i)===-o;fu(s)&&a===1&&tr(s,i)===1&&(c=!1);let u=o*(a-+c);return u===0?0:u}function hu(t,e,r){let s=uu(t,e)/1e3;return cu(r?.roundingMethod)(s)}var Bg={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},mu=(t,e,r)=>{let s,n=Bg[t];return typeof n=="string"?s=n:e===1?s=n.one:s=n.other.replace("{{count}}",e.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+s:s+" ago":s};function fs(t){return(e={})=>{let r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}var Wg={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qg={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ug={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gu={date:fs({formats:Wg,defaultWidth:"full"}),time:fs({formats:qg,defaultWidth:"full"}),dateTime:fs({formats:Ug,defaultWidth:"full"})};var zg={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Du=(t,e,r,s)=>zg[t];function rr(t){return(e,r)=>{let s=r?.context?String(r.context):"standalone",n;if(s==="formatting"&&t.formattingValues){let o=t.defaultFormattingWidth||t.defaultWidth,a=r?.width?String(r.width):o;n=t.formattingValues[a]||t.formattingValues[o]}else{let o=t.defaultWidth,a=r?.width?String(r.width):t.defaultWidth;n=t.values[a]||t.values[o]}let i=t.argumentCallback?t.argumentCallback(e):e;return n[i]}}var Vg={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Gg={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Hg={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Jg={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Zg={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Yg={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Xg=(t,e)=>{let r=Number(t),s=r%100;if(s>20||s<10)switch(s%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},yu={ordinalNumber:Xg,era:rr({values:Vg,defaultWidth:"wide"}),quarter:rr({values:Gg,defaultWidth:"wide",argumentCallback:t=>t-1}),month:rr({values:Hg,defaultWidth:"wide"}),day:rr({values:Jg,defaultWidth:"wide"}),dayPeriod:rr({values:Zg,defaultWidth:"wide",formattingValues:Yg,defaultFormattingWidth:"wide"})};function sr(t){return(e,r={})=>{let s=r.width,n=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],i=e.match(n);if(!i)return null;let o=i[0],a=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(a)?Qg(a,h=>h.test(o)):Kg(a,h=>h.test(o)),u;u=t.valueCallback?t.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;let d=e.slice(o.length);return{value:u,rest:d}}}function Kg(t,e){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function Qg(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function wu(t){return(e,r={})=>{let s=e.match(t.matchPattern);if(!s)return null;let n=s[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;let a=e.slice(n.length);return{value:o,rest:a}}}var eD=/^(\d+)(th|st|nd|rd)?/i,tD=/\d+/i,rD={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},sD={any:[/^b/i,/^(a|c)/i]},nD={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},iD={any:[/1/i,/2/i,/3/i,/4/i]},oD={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},aD={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},cD={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uD={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},lD={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},dD={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Eu={ordinalNumber:wu({matchPattern:eD,parsePattern:tD,valueCallback:t=>parseInt(t,10)}),era:sr({matchPatterns:rD,defaultMatchWidth:"wide",parsePatterns:sD,defaultParseWidth:"any"}),quarter:sr({matchPatterns:nD,defaultMatchWidth:"wide",parsePatterns:iD,defaultParseWidth:"any",valueCallback:t=>t+1}),month:sr({matchPatterns:oD,defaultMatchWidth:"wide",parsePatterns:aD,defaultParseWidth:"any"}),day:sr({matchPatterns:cD,defaultMatchWidth:"wide",parsePatterns:uD,defaultParseWidth:"any"}),dayPeriod:sr({matchPatterns:lD,defaultMatchWidth:"any",parsePatterns:dD,defaultParseWidth:"any"})};var $n={code:"en-US",formatDistance:mu,formatLong:gu,formatRelative:Du,localize:yu,match:Eu,options:{weekStartsOn:0,firstWeekContainsDate:1}};function xu(t,e,r){let s=iu(),n=r?.locale??s.locale??$n,i=2520,o=tr(t,e);if(isNaN(o))throw new RangeError("Invalid time value");let a=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:o}),[c,u]=er(r?.in,...o>0?[e,t]:[t,e]),d=hu(u,c),h=(An(u)-An(c))/1e3,p=Math.round((d-h)/60),l;if(p<2)return r?.includeSeconds?d<5?n.formatDistance("lessThanXSeconds",5,a):d<10?n.formatDistance("lessThanXSeconds",10,a):d<20?n.formatDistance("lessThanXSeconds",20,a):d<40?n.formatDistance("halfAMinute",0,a):d<60?n.formatDistance("lessThanXMinutes",1,a):n.formatDistance("xMinutes",1,a):p===0?n.formatDistance("lessThanXMinutes",1,a):n.formatDistance("xMinutes",p,a);if(p<45)return n.formatDistance("xMinutes",p,a);if(p<90)return n.formatDistance("aboutXHours",1,a);if(p<Sn){let g=Math.round(p/60);return n.formatDistance("aboutXHours",g,a)}else{if(p<i)return n.formatDistance("xDays",1,a);if(p<Fr){let g=Math.round(p/Sn);return n.formatDistance("xDays",g,a)}else if(p<Fr*2)return l=Math.round(p/Fr),n.formatDistance("aboutXMonths",l,a)}if(l=pu(u,c),l<12){let g=Math.round(p/Fr);return n.formatDistance("xMonths",g,a)}else{let g=l%12,w=Math.trunc(l/12);return g<3?n.formatDistance("aboutXYears",w,a):g<9?n.formatDistance("overXYears",w,a):n.formatDistance("almostXYears",w+1,a)}}function vu(t,e){return xu(t,ou(t),e)}async function bu(t){let e;try{e=_e(t)}catch(r){throw r instanceof Error?new m(`Invalid spec reference: ${r.message}`,D.VALIDATION_ERROR):new m("Invalid spec reference format",D.VALIDATION_ERROR)}if(!e.isPublic||!e.username)throw new m("Info command requires a public spec reference (username/spec)",D.VALIDATION_ERROR);try{let r=await bt(e.username,e.name);if(console.log(st.bold.cyan(`
|
|
245
245
|
${r.specId}`)),r.versions.length>0&&r.versions[0].description&&console.log(r.versions[0].description),r.versions.length>0&&r.versions[0].tags&&r.versions[0].tags.length>0&&console.log(st.dim(`
|
|
246
246
|
Tags: ${r.versions[0].tags.join(", ")}`)),r.versions.length===0)console.log(st.yellow(`
|
|
247
247
|
No versions available`));else{console.log(st.bold(`
|
|
248
|
-
Versions:`));let s=new
|
|
248
|
+
Versions:`));let s=new Cu.default({head:[st.cyan("Version"),st.cyan("Published"),st.cyan("Downloads")],colWidths:[12,30,15],style:{head:[],border:["dim"]}});for(let n of r.versions){let i=new Date(n.publishedAt),o=vu(i,{addSuffix:!0}),a=`${i.toISOString().split("T")[0]} (${o})`,c=n.downloads?.toString()||"0";s.push([st.bold(n.version),a,c])}console.log(s.toString())}console.log(`
|
|
249
249
|
Install latest: ${H(`spectrl install ${r.specId}`)}`),console.log(`Install specific: ${H(`spectrl install ${r.specId}@<version>`)}
|
|
250
|
-
`)}catch(r){throw r instanceof m?r:r instanceof V?r.statusCode===404?new m(`Spec not found: ${e.username}/${e.name}`,D.IO_ERROR):new m(`Failed to get spec info: ${r.message}`,D.IO_ERROR):r instanceof Error?new m(`Failed to get spec info: ${r.message}`,D.IO_ERROR):new m("Unknown error while fetching spec info",D.IO_ERROR)}}var
|
|
250
|
+
`)}catch(r){throw r instanceof m?r:r instanceof V?r.statusCode===404?new m(`Spec not found: ${e.username}/${e.name}`,D.IO_ERROR):new m(`Failed to get spec info: ${r.message}`,D.IO_ERROR):r instanceof Error?new m(`Failed to get spec info: ${r.message}`,D.IO_ERROR):new m("Unknown error while fetching spec info",D.IO_ERROR)}}var Fu=At(br(),1);import be from"chalk";import{promises as fD}from"node:fs";async function Ru(t={}){let e=t.cwd||process.cwd();try{let r=le(e);if(!await Ue(r))throw new m('Project not initialized. Run "spectrl init" to set up dependency management.',D.VALIDATION_ERROR);let s=await fD.readFile(r,"utf-8"),n=JSON.parse(s),i=Object.entries(n);if(i.length===0){console.log(be.yellow(`
|
|
251
251
|
No specs installed`)),console.log(be.dim("Install a spec with: spectrl install <spec>")),console.log(be.dim(`Example: spectrl install alice/api-spec
|
|
252
252
|
`));return}console.log(be.bold(`
|
|
253
253
|
Installed specs:
|
|
254
|
-
`));let o=new
|
|
254
|
+
`));let o=new Fu.default({head:[be.cyan("Spec"),be.cyan("Version"),be.cyan("Source")],colWidths:[35,12,12],style:{head:[],border:["dim"]}});for(let[c,u]of i){let h=u.source.startsWith("https://")||u.source.startsWith("http://")?be.blue("public"):be.green("local"),p=c.lastIndexOf("@"),l,g;p!==-1?(l=c.substring(0,p),g=c.substring(p+1)):(l=c,g=be.dim("unknown")),o.push([be.bold(l),g,h])}console.log(o.toString());let a=i.length;console.log(be.dim(`
|
|
255
255
|
${a} spec${a===1?"":"s"} installed
|
|
256
|
-
`))}catch(r){throw r instanceof m?r:r instanceof SyntaxError?new m('Project index is corrupted. Try running "spectrl init" to reinitialize.',D.VALIDATION_ERROR):r instanceof Error?new m(`Failed to read project index: ${r.message}`,D.IO_ERROR):new m("Unknown error while listing specs",D.IO_ERROR)}}import Ne from"chalk";import{readFileSync as mD}from"node:fs";import{fileURLToPath as gD}from"node:url";import{dirname as DD,join as yD}from"node:path";var wD=DD(gD(import.meta.url)),ED=JSON.parse(mD(yD(wD,"../package.json"),"utf-8")),_u=ED.version,xD=Fe({name:"init",description:"Initialize a new project with a local spec index",args:{skipAgents:
|
|
256
|
+
`))}catch(r){throw r instanceof m?r:r instanceof SyntaxError?new m('Project index is corrupted. Try running "spectrl init" to reinitialize.',D.VALIDATION_ERROR):r instanceof Error?new m(`Failed to read project index: ${r.message}`,D.IO_ERROR):new m("Unknown error while listing specs",D.IO_ERROR)}}import Ne from"chalk";import{readFileSync as mD}from"node:fs";import{fileURLToPath as gD}from"node:url";import{dirname as DD,join as yD}from"node:path";var wD=DD(gD(import.meta.url)),ED=JSON.parse(mD(yD(wD,"../package.json"),"utf-8")),_u=ED.version,xD=Fe({name:"init",description:"Initialize a new project with a local spec index",args:{skipAgents:In({long:"skip-agents",description:"Skip AGENTS.md creation/update entirely",defaultValue:()=>!1}),forceAgents:In({long:"force-agents",description:"Force overwrite AGENTS.md with fresh template",defaultValue:()=>!1})},handler:async t=>{await na(process.cwd(),{skipAgents:t.skipAgents,forceAgents:t.forceAgents})}}),vD=Fe({name:"publish",description:"Publish a spec to the local registry",args:{},handler:async()=>{await ma(process.cwd())}}),CD=Fe({name:"install",description:"Install specs using symlinks to the registry. Creates links from .spectrl/specs/{name}@{version}/ to the registry. On Windows, uses junction points (no admin required). Falls back to file copying if symlinks fail.",args:{specRef:_t({type:nr(Ge),displayName:"spec",description:"Optional spec reference (name@version) to install from registry"})},handler:async t=>{t.specRef?await Ra(t.specRef,{cwd:process.cwd()}):await Sa({cwd:process.cwd()})}}),bD=Fe({name:"new",description:"Create a new spec or power (defaults to spec). Usage: spectrl new [spec|power] <name>",args:{first:_t({type:nr(Ge),displayName:"type-or-name",description:"Content type (spec|power) or name if type is omitted"}),second:_t({type:nr(Ge),displayName:"name",description:"Name (if first arg is the type)"}),version:Su({type:nr(Ge),long:"version",description:"Initial version (default: 0.1.0)",defaultValue:()=>"0.1.0"}),description:Su({type:nr(Ge),long:"description",description:"Description"})},handler:async t=>{let e="spec",r;if(t.first==="spec"||t.first==="power")e=t.first,r=t.second;else if(t.first)r=t.first;else{let{select:s}=await import("@inquirer/prompts");e=await s({message:"What do you want to create?",choices:[{value:"spec",name:"Spec",description:"Structured knowledge \u2014 a PRD, TDD, ADR, or any document agents can consume"},{value:"power",name:"Power",description:"Agent instructions \u2014 reusable workflow rules that steer how an agent behaves"}]})}if(!r){let{input:s}=await import("@inquirer/prompts");r=await s({message:`${e==="power"?"Power":"Spec"} name (lowercase, hyphens ok):`,validate:n=>n.trim()?/^[a-z0-9-]+$/.test(n.trim())?!0:"Must be lowercase alphanumeric with hyphens":"Name is required"}),r=r.trim()}await Aa(r,process.cwd(),e,t.version,t.description)}}),FD=Fe({name:"login",description:"Authenticate with GitHub to access the public registry",args:{},handler:async()=>{await Za()}}),RD=Fe({name:"logout",description:"Remove stored GitHub authentication token",args:{},handler:async()=>{await Ya()}}),SD=Fe({name:"whoami",description:"Show current authenticated GitHub user",args:{},handler:async()=>{await Xa()}}),_D=Fe({name:"unpublish",description:"Remove a spec version from the public registry (requires authentication)",args:{specRef:_t({type:Ge,displayName:"spec",description:"Spec reference in format username/spec@version"})},handler:async t=>{await Ka(t.specRef)}}),AD=Fe({name:"update",description:"Check for and install updates for public specs",args:{specRef:_t({type:nr(Ge),displayName:"spec",description:"Optional spec reference to update (username/spec or username/spec@version)"}),all:In({long:"all",description:"Update all specs with available updates",defaultValue:()=>!1})},handler:async t=>{await tu(t.specRef,{all:t.all,cwd:process.cwd()})}}),$D=Fe({name:"search",description:"Search for specs in the public registry",args:{query:_t({type:Ge,displayName:"query",description:"Search query (keywords, tags, or spec names)"})},handler:async t=>{await su(t.query)}}),ID=Fe({name:"info",description:"Show detailed information about a spec from the public registry",args:{specRef:_t({type:Ge,displayName:"spec",description:"Spec reference in format username/spec"})},handler:async t=>{await bu(t.specRef)}}),OD=Fe({name:"list",description:"Show all installed specs (local and public)",args:{},handler:async()=>{await Ru({cwd:process.cwd()})}}),kD=pD({name:"spectrl",description:"Local-first spec registry",version:_u,cmds:{init:xD,new:bD,publish:vD,install:CD,login:FD,logout:RD,whoami:SD,unpublish:_D,update:AD,search:$D,info:ID,list:OD}});function TD(){let t=[["init","Initialize a new project with a local spec index"],["new","Create a new spec with a manifest template"],["publish","Publish a spec to the local registry"],["install","Install specs from the registry into .spectrl/specs/"],["login","Authenticate with GitHub to access the public registry"],["logout","Remove stored GitHub authentication token"],["whoami","Show current authenticated GitHub user"],["unpublish","Remove a spec version from the public registry"],["update","Check for and install updates for public specs"],["search","Search for specs in the public registry"],["info","Show detailed information about a spec"],["list","Show all installed specs (local and public)"]],e=Math.max(...t.map(([r])=>r.length))+2;v.log(""),v.log(` ${Ne.bold("spectrl")} ${Ne.dim(`v${_u}`)} ${Ne.dim("\xB7")} Local-first spec registry`),v.log(""),v.log(` ${Ne.dim("Usage:")} spectrl ${Ne.cyan("<command>")} ${Ne.dim("[options]")}`),v.log(""),v.log(` ${Ne.dim("Commands:")}`),v.log("");for(let[r,s]of t)v.log(` ${Ne.cyan(r.padEnd(e))}${Ne.dim(s)}`);v.log(""),v.log(` Run ${Ne.cyan("spectrl <command> --help")} for command-specific options.`),v.log("")}async function PD(){let t=process.argv.slice(2);(t.length===0||t[0]==="--help"||t[0]==="-h")&&(TD(),process.exit(t.length===0?1:0));try{await hD(kD,t)}catch(e){e instanceof m&&(v.error(hs(e)),process.exit(e.exitCode)),e instanceof Error&&(v.error(hs(e)),process.exit(kn(e))),v.error("Unknown error occurred"),process.exit(1)}}PD();process.stdout.isTTY&&!process.env.NO_COLOR&&(process.env.FORCE_COLOR=process.env.FORCE_COLOR??"3");
|