@prismatic-io/prism 7.3.1-rc.1 → 7.3.1-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -64889,7 +64889,7 @@ ${n.data}
|
|
|
64889
64889
|
comments: "Provide headers to the SOAP client",
|
|
64890
64890
|
default: '{}'
|
|
64891
64891
|
}`]}}`}]),o.addVariableStatement({declarationKind:kje.VariableDeclarationKind.Const,declarations:[{name:e.key,initializer:`action(${p.print()})`}],isExported:!0}),c.remove()},NNo=async(e,{actionFile:n,definitionDirectory:o})=>{n.addImportDeclaration({moduleSpecifier:`../${o}/index`,namedImports:e})},PNo=async(e,{actionFile:n})=>{n.addImportDeclaration({moduleSpecifier:"./inputs",namedImports:e})},REi=async(e)=>{let{actionFile:n,inputsFile:o}=e,c=UEi(e),p=Nye(Object.entries(c).flatMap(([R,X])=>{return rft(X,(g0)=>g0.getName()).map((g0)=>FNo(R,g0,e))}),({key:R})=>R),g=p.flatMap(({actionObject:R})=>R.inputs).filter(({shouldImport:R})=>R).flatMap(({properties:R})=>R),T=Nye(rft(g,(R)=>R.propertyName.toLowerCase()),(R)=>R.propertyName);await YEi(e,T),o.organizeImports(),o.formatText(),await o.save();let N=p.map(({service:R})=>R),I=Nye(IGe(N));await NNo(I,e);let q=T.map(({propertyName:R})=>R);await PNo(q,e);let W=p.map((R)=>bNo(R,e));await Promise.all(W);let G=Nye(p.map(({key:R})=>R));n.addExportAssignment({isExportEquals:!1,expression:`{${G.join(`,
|
|
64892
|
-
`)}}`}),n.organizeImports(),n.formatText(),await n.save()};var $Ei=async({projectRoot:e,projectTemplateName:n,projectTemplatePath:o})=>{let c=VEi(e,n,o),{componentProject:p}=c;await REi(c),p.getSourceFile(t3e.join(e,"src","index.test.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","actions.test.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","client.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","connections.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","dataSources.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","dataSources.test.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","triggers.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","triggers.test.ts"))?.delete(),await p.save()};var W4t={"@prismatic-io/eslint-config-spectral":"2.1.0","@types/jest":"29.5.14","copy-webpack-plugin":"13.0.0",eslint:"9.24.0",jest:"29.7.0","ts-jest":"29.3.2","ts-loader":"9.5.2",typescript:"5.8.3",webpack:"5.99.5","webpack-cli":"6.0.1"};var ZCi=Qm(PBt(),1);var lCi=Qm(iCi(),1);var Ije=(e)=>{if(typeof e!=="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var JNo={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Bje=(e)=>e.replace(/[[\]\\-]/g,"\\$&"),KNo=(e)=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),rCi=(e)=>e.join(""),aCi=(e,n)=>{let o=n;if(e.charAt(o)!=="[")throw new Error("not in a brace expression");let c=[],p=[],g=o+1,T=!1,N=!1,I=!1,q=!1,W=o,G="";e:while(g<e.length){let g0=e.charAt(g);if((g0==="!"||g0==="^")&&g===o+1){q=!0,g++;continue}if(g0==="]"&&T&&!I){W=g+1;break}if(T=!0,g0==="\\"){if(!I){I=!0,g++;continue}}if(g0==="["&&!I){for(let[D0,[k0,F0,V0]]of Object.entries(JNo))if(e.startsWith(D0,g)){if(G)return["$.",!1,e.length-o,!0];if(g+=D0.length,V0)p.push(k0);else c.push(k0);N=N||F0;continue e}}if(I=!1,G){if(g0>G)c.push(Bje(G)+"-"+Bje(g0));else if(g0===G)c.push(Bje(g0));G="",g++;continue}if(e.startsWith("-]",g+1)){c.push(Bje(g0+"-")),g+=2;continue}if(e.startsWith("-",g+1)){G=g0,g+=2;continue}c.push(Bje(g0)),g++}if(W<g)return["",!1,0,!1];if(!c.length&&!p.length)return["$.",!1,e.length-o,!0];if(p.length===0&&c.length===1&&/^\\?.$/.test(c[0])&&!q){let g0=c[0].length===2?c[0].slice(-1):c[0];return[KNo(g0),!1,W-o,!1]}let R="["+(q?"^":"")+rCi(c)+"]",X="["+(q?"":"^")+rCi(p)+"]";return[c.length&&p.length?"("+R+"|"+X+")":c.length?R:X,N,W-o,!0]};var rj0=(e,{windowsPathsNoEscape:n=!1}={})=>{return n?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var zNo=new Set(["!","?","+","*","@"]),oCi=(e)=>zNo.has(e),WNo="(?!(?:^|/)\\.\\.?(?:$|/))",V4t="(?!\\.)",VNo=new Set(["[","."]),UNo=new Set(["..","."]),QNo=new Set("().*{}+?[]^$\\!"),YNo=(e)=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),MZt="[^/]",uCi=MZt+"*?",sCi=MZt+"+?";class xh0{type;#e;#t;#n=!1;#i=[];#r;#a;#o;#s=!1;#c;#u;#p=!1;constructor(e,n,o={}){if(this.type=e,e)this.#t=!0;if(this.#r=n,this.#e=this.#r?this.#r.#e:this,this.#c=this.#e===this?o:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e==="!"&&!this.#e.#s)this.#o.push(this);this.#a=this.#r?this.#r.#i.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#i){if(typeof e==="string")continue;if(e.type||e.hasMagic)return this.#t=!0}return this.#t}toString(){if(this.#u!==void 0)return this.#u;if(!this.type)return this.#u=this.#i.map((e)=>String(e)).join("");else return this.#u=this.type+"("+this.#i.map((e)=>String(e)).join("|")+")"}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let e;while(e=this.#o.pop()){if(e.type!=="!")continue;let n=e,o=n.#r;while(o){for(let c=n.#a+1;!o.type&&c<o.#i.length;c++)for(let p of e.#i){if(typeof p==="string")throw new Error("string part in extglob AST??");p.copyIn(o.#i[c])}n=o,o=n.#r}}return this}push(...e){for(let n of e){if(n==="")continue;if(typeof n!=="string"&&!(n instanceof xh0&&n.#r===this))throw new Error("invalid part: "+n);this.#i.push(n)}}toJSON(){let e=this.type===null?this.#i.slice().map((n)=>typeof n==="string"?n:n.toJSON()):[this.type,...this.#i.map((n)=>n.toJSON())];if(this.isStart()&&!this.type)e.unshift([]);if(this.isEnd()&&(this===this.#e||this.#e.#s&&this.#r?.type==="!"))e.push({});return e}isStart(){if(this.#e===this)return!0;if(!this.#r?.isStart())return!1;if(this.#a===0)return!0;let e=this.#r;for(let n=0;n<this.#a;n++){let o=e.#i[n];if(!(o instanceof xh0&&o.type==="!"))return!1}return!0}isEnd(){if(this.#e===this)return!0;if(this.#r?.type==="!")return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();let e=this.#r?this.#r.#i.length:0;return this.#a===e-1}copyIn(e){if(typeof e==="string")this.push(e);else this.push(e.clone(this))}clone(e){let n=new xh0(this.type,e);for(let o of this.#i)n.copyIn(o);return n}static#g(e,n,o,c){let p=!1,g=!1,T=-1,N=!1;if(n.type===null){let R=o,X="";while(R<e.length){let l0=e.charAt(R++);if(p||l0==="\\"){p=!p,X+=l0;continue}if(g){if(R===T+1){if(l0==="^"||l0==="!")N=!0}else if(l0==="]"&&!(R===T+2&&N))g=!1;X+=l0;continue}else if(l0==="["){g=!0,T=R,N=!1,X+=l0;continue}if(!c.noext&&oCi(l0)&&e.charAt(R)==="("){n.push(X),X="";let g0=new xh0(l0,n);R=xh0.#g(e,g0,R,c),n.push(g0);continue}X+=l0}return n.push(X),R}let I=o+1,q=new xh0(null,n),W=[],G="";while(I<e.length){let R=e.charAt(I++);if(p||R==="\\"){p=!p,G+=R;continue}if(g){if(I===T+1){if(R==="^"||R==="!")N=!0}else if(R==="]"&&!(I===T+2&&N))g=!1;G+=R;continue}else if(R==="["){g=!0,T=I,N=!1,G+=R;continue}if(oCi(R)&&e.charAt(I)==="("){q.push(G),G="";let X=new xh0(R,q);q.push(X),I=xh0.#g(e,X,I,c);continue}if(R==="|"){q.push(G),G="",W.push(q),q=new xh0(null,n);continue}if(R===")"){if(G===""&&n.#i.length===0)n.#p=!0;return q.push(G),G="",n.push(...W,q),I}G+=R}return n.type=null,n.#t=void 0,n.#i=[e.substring(o-1)],I}static fromGlob(e,n={}){let o=new xh0(null,void 0,n);return xh0.#g(e,o,0,n),o}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[n,o,c,p]=this.toRegExpSource();if(!(c||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return o;let T=(this.#c.nocase?"i":"")+(p?"u":"");return Object.assign(new RegExp(`^${n}$`,T),{_src:n,_glob:e})}get options(){return this.#c}toRegExpSource(e){let n=e??!!this.#c.dot;if(this.#e===this)this.#y();if(!this.type){let N=this.isStart()&&this.isEnd(),I=this.#i.map((R)=>{let[X,l0,g0,D0]=typeof R==="string"?xh0.#D(R,this.#t,N):R.toRegExpSource(e);return this.#t=this.#t||g0,this.#n=this.#n||D0,X}).join(""),q="";if(this.isStart()){if(typeof this.#i[0]==="string"){if(!(this.#i.length===1&&UNo.has(this.#i[0]))){let X=VNo,l0=n&&X.has(I.charAt(0))||I.startsWith("\\.")&&X.has(I.charAt(2))||I.startsWith("\\.\\.")&&X.has(I.charAt(4)),g0=!n&&!e&&X.has(I.charAt(0));q=l0?WNo:g0?V4t:""}}}let W="";if(this.isEnd()&&this.#e.#s&&this.#r?.type==="!")W="(?:$|\\/)";return[q+I+W,rj0(I),this.#t=!!this.#t,this.#n]}let o=this.type==="*"||this.type==="+",c=this.type==="!"?"(?:(?!(?:":"(?:",p=this.#_(n);if(this.isStart()&&this.isEnd()&&!p&&this.type!=="!"){let N=this.toString();return this.#i=[N],this.type=null,this.#t=void 0,[N,rj0(this.toString()),!1,!1]}let g=!o||e||n||!V4t?"":this.#_(!0);if(g===p)g="";if(g)p=`(?:${p})(?:${g})*?`;let T="";if(this.type==="!"&&this.#p)T=(this.isStart()&&!n?V4t:"")+sCi;else{let N=this.type==="!"?"))"+(this.isStart()&&!n&&!e?V4t:"")+uCi+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&g?")":this.type==="*"&&g?")?":`)${this.type}`;T=c+p+N}return[T,rj0(p),this.#t=!!this.#t,this.#n]}#_(e){return this.#i.map((n)=>{if(typeof n==="string")throw new Error("string type in extglob ast??");let[o,c,p,g]=n.toRegExpSource(e);return this.#n=this.#n||g,o}).filter((n)=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#D(e,n,o=!1){let c=!1,p="",g=!1;for(let T=0;T<e.length;T++){let N=e.charAt(T);if(c){c=!1,p+=(QNo.has(N)?"\\":"")+N;continue}if(N==="\\"){if(T===e.length-1)p+="\\\\";else c=!0;continue}if(N==="["){let[I,q,W,G]=aCi(e,T);if(W){p+=I,g=g||q,T+=W-1,n=n||G;continue}}if(N==="*"){if(o&&e==="*")p+=sCi;else p+=uCi;n=!0;continue}if(N==="?"){p+=MZt,n=!0;continue}p+=YNo(N)}return[p,rj0(e),!!n,g]}}var kWe=(e,{windowsPathsNoEscape:n=!1}={})=>{return n?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&")};var dT0=(e,n,o={})=>{if(Ije(n),!o.nocomment&&n.charAt(0)==="#")return!1;return new fU0(n,o).match(e)},ZNo=/^\*+([^+@!?\*\[\(]*)$/,RNo=(e)=>(n)=>!n.startsWith(".")&&n.endsWith(e),$No=(e)=>(n)=>n.endsWith(e),GNo=(e)=>{return e=e.toLowerCase(),(n)=>!n.startsWith(".")&&n.toLowerCase().endsWith(e)},HNo=(e)=>{return e=e.toLowerCase(),(n)=>n.toLowerCase().endsWith(e)},XNo=/^\*+\.\*+$/,jNo=(e)=>!e.startsWith(".")&&e.includes("."),ePo=(e)=>e!=="."&&e!==".."&&e.includes("."),tPo=/^\.\*+$/,nPo=(e)=>e!=="."&&e!==".."&&e.startsWith("."),iPo=/^\*+$/,rPo=(e)=>e.length!==0&&!e.startsWith("."),aPo=(e)=>e.length!==0&&e!=="."&&e!=="..",oPo=/^\?+([^+@!?\*\[\(]*)?$/,uPo=([e,n=""])=>{let o=_Ci([e]);if(!n)return o;return n=n.toLowerCase(),(c)=>o(c)&&c.toLowerCase().endsWith(n)},sPo=([e,n=""])=>{let o=dCi([e]);if(!n)return o;return n=n.toLowerCase(),(c)=>o(c)&&c.toLowerCase().endsWith(n)},cPo=([e,n=""])=>{let o=dCi([e]);return!n?o:(c)=>o(c)&&c.endsWith(n)},fPo=([e,n=""])=>{let o=_Ci([e]);return!n?o:(c)=>o(c)&&c.endsWith(n)},_Ci=([e])=>{let n=e.length;return(o)=>o.length===n&&!o.startsWith(".")},dCi=([e])=>{let n=e.length;return(o)=>o.length===n&&o!=="."&&o!==".."},pCi=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",cCi={win32:{sep:"\\"},posix:{sep:"/"}},lPo=pCi==="win32"?cCi.win32.sep:cCi.posix.sep;dT0.sep=lPo;var Dh0=Symbol("globstar **");dT0.GLOBSTAR=Dh0;var _Po="[^/]",dPo=_Po+"*?",pPo="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",mPo="(?:(?!(?:\\/|^)\\.).)*?",vPo=(e,n={})=>(o)=>dT0(o,e,n);dT0.filter=vPo;var cU0=(e,n={})=>Object.assign({},e,n),gPo=(e)=>{if(!e||typeof e!=="object"||!Object.keys(e).length)return dT0;let n=dT0;return Object.assign((c,p,g={})=>n(c,p,cU0(e,g)),{Minimatch:class c extends n.Minimatch{constructor(p,g={}){super(p,cU0(e,g))}static defaults(p){return n.defaults(cU0(e,p)).Minimatch}},AST:class c extends n.AST{constructor(p,g,T={}){super(p,g,cU0(e,T))}static fromGlob(p,g={}){return n.AST.fromGlob(p,cU0(e,g))}},unescape:(c,p={})=>n.unescape(c,cU0(e,p)),escape:(c,p={})=>n.escape(c,cU0(e,p)),filter:(c,p={})=>n.filter(c,cU0(e,p)),defaults:(c)=>n.defaults(cU0(e,c)),makeRe:(c,p={})=>n.makeRe(c,cU0(e,p)),braceExpand:(c,p={})=>n.braceExpand(c,cU0(e,p)),match:(c,p,g={})=>n.match(c,p,cU0(e,g)),sep:n.sep,GLOBSTAR:Dh0})};dT0.defaults=gPo;var mCi=(e,n={})=>{if(Ije(e),n.nobrace||!/\{(?:(?!\{).)*\}/.test(e))return[e];return lCi.default(e)};dT0.braceExpand=mCi;var hPo=(e,n={})=>new fU0(e,n).makeRe();dT0.makeRe=hPo;var xPo=(e,n,o={})=>{let c=new fU0(n,o);if(e=e.filter((p)=>c.match(p)),c.options.nonull&&!e.length)e.push(n);return e};dT0.match=xPo;var fCi=/[?*]|[+@!]\(.*?\)|\[|\]/,DPo=(e)=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class fU0{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,n={}){if(Ije(e),n=n||{},this.options=n,this.pattern=e,this.platform=n.platform||pCi,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!=="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug)this.debug=(...p)=>console.error(...p);this.debug(this.pattern,this.globSet);let o=this.globSet.map((p)=>this.slashSplit(p));this.globParts=this.preprocess(o),this.debug(this.pattern,this.globParts);let c=this.globParts.map((p,g,T)=>{if(this.isWindows&&this.windowsNoMagicRoot){let N=p[0]===""&&p[1]===""&&(p[2]==="?"||!fCi.test(p[2]))&&!fCi.test(p[3]),I=/^[a-z]:/i.test(p[0]);if(N)return[...p.slice(0,4),...p.slice(4).map((q)=>this.parse(q))];else if(I)return[p[0],...p.slice(1).map((q)=>this.parse(q))]}return p.map((N)=>this.parse(N))});if(this.debug(this.pattern,c),this.set=c.filter((p)=>p.indexOf(!1)===-1),this.isWindows)for(let p=0;p<this.set.length;p++){let g=this.set[p];if(g[0]===""&&g[1]===""&&this.globParts[p][2]==="?"&&typeof g[3]==="string"&&/^[a-z]:$/i.test(g[3]))g[2]="?"}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar){for(let o=0;o<e.length;o++)for(let c=0;c<e[o].length;c++)if(e[o][c]==="**")e[o][c]="*"}let{optimizationLevel:n=1}=this.options;if(n>=2)e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e);else if(n>=1)e=this.levelOneOptimize(e);else e=this.adjascentGlobstarOptimize(e);return e}adjascentGlobstarOptimize(e){return e.map((n)=>{let o=-1;while((o=n.indexOf("**",o+1))!==-1){let c=o;while(n[c+1]==="**")c++;if(c!==o)n.splice(o,c-o)}return n})}levelOneOptimize(e){return e.map((n)=>{return n=n.reduce((o,c)=>{let p=o[o.length-1];if(c==="**"&&p==="**")return o;if(c===".."){if(p&&p!==".."&&p!=="."&&p!=="**")return o.pop(),o}return o.push(c),o},[]),n.length===0?[""]:n})}levelTwoFileOptimize(e){if(!Array.isArray(e))e=this.slashSplit(e);let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let c=1;c<e.length-1;c++){let p=e[c];if(c===1&&p===""&&e[0]==="")continue;if(p==="."||p==="")n=!0,e.splice(c,1),c--}if(e[0]==="."&&e.length===2&&(e[1]==="."||e[1]===""))n=!0,e.pop()}let o=0;while((o=e.indexOf("..",o+1))!==-1){let c=e[o-1];if(c&&c!=="."&&c!==".."&&c!=="**")n=!0,e.splice(o-1,2),o-=2}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let o of e){let c=-1;while((c=o.indexOf("**",c+1))!==-1){let g=c;while(o[g+1]==="**")g++;if(g>c)o.splice(c+1,g-c);let T=o[c+1],N=o[c+2],I=o[c+3];if(T!=="..")continue;if(!N||N==="."||N===".."||!I||I==="."||I==="..")continue;n=!0,o.splice(c,1);let q=o.slice(0);q[c]="**",e.push(q),c--}if(!this.preserveMultipleSlashes){for(let g=1;g<o.length-1;g++){let T=o[g];if(g===1&&T===""&&o[0]==="")continue;if(T==="."||T==="")n=!0,o.splice(g,1),g--}if(o[0]==="."&&o.length===2&&(o[1]==="."||o[1]===""))n=!0,o.pop()}let p=0;while((p=o.indexOf("..",p+1))!==-1){let g=o[p-1];if(g&&g!=="."&&g!==".."&&g!=="**"){n=!0;let N=p===1&&o[p+1]==="**"?["."]:[];if(o.splice(p-1,2,...N),o.length===0)o.push("");p-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let o=n+1;o<e.length;o++){let c=this.partsMatch(e[n],e[o],!this.preserveMultipleSlashes);if(c){e[n]=[],e[o]=c;break}}return e.filter((n)=>n.length)}partsMatch(e,n,o=!1){let c=0,p=0,g=[],T="";while(c<e.length&&p<n.length)if(e[c]===n[p])g.push(T==="b"?n[p]:e[c]),c++,p++;else if(o&&e[c]==="**"&&n[p]===e[c+1])g.push(e[c]),c++;else if(o&&n[p]==="**"&&e[c]===n[p+1])g.push(n[p]),p++;else if(e[c]==="*"&&n[p]&&(this.options.dot||!n[p].startsWith("."))&&n[p]!=="**"){if(T==="b")return!1;T="a",g.push(e[c]),c++,p++}else if(n[p]==="*"&&e[c]&&(this.options.dot||!e[c].startsWith("."))&&e[c]!=="**"){if(T==="a")return!1;T="b",g.push(n[p]),c++,p++}else return!1;return e.length===n.length&&g}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,o=0;for(let c=0;c<e.length&&e.charAt(c)==="!";c++)n=!n,o++;if(o)this.pattern=e.slice(o);this.negate=n}matchOne(e,n,o=!1){let c=this.options;if(this.isWindows){let l0=typeof e[0]==="string"&&/^[a-z]:$/i.test(e[0]),g0=!l0&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),D0=typeof n[0]==="string"&&/^[a-z]:$/i.test(n[0]),k0=!D0&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]==="string"&&/^[a-z]:$/i.test(n[3]),F0=g0?3:l0?0:void 0,V0=k0?3:D0?0:void 0;if(typeof F0==="number"&&typeof V0==="number"){let[Q0,le]=[e[F0],n[V0]];if(Q0.toLowerCase()===le.toLowerCase()){if(n[V0]=Q0,V0>F0)n=n.slice(V0);else if(F0>V0)e=e.slice(F0)}}}let{optimizationLevel:p=1}=this.options;if(p>=2)e=this.levelTwoFileOptimize(e);this.debug("matchOne",this,{file:e,pattern:n}),this.debug("matchOne",e.length,n.length);for(var g=0,T=0,N=e.length,I=n.length;g<N&&T<I;g++,T++){this.debug("matchOne loop");var q=n[T],W=e[g];if(this.debug(n,q,W),q===!1)return!1;if(q===Dh0){this.debug("GLOBSTAR",[n,q,W]);var G=g,R=T+1;if(R===I){this.debug("** at the end");for(;g<N;g++)if(e[g]==="."||e[g]===".."||!c.dot&&e[g].charAt(0)===".")return!1;return!0}while(G<N){var X=e[G];if(this.debug(`
|
|
64892
|
+
`)}}`}),n.organizeImports(),n.formatText(),await n.save()};var $Ei=async({projectRoot:e,projectTemplateName:n,projectTemplatePath:o})=>{let c=VEi(e,n,o),{componentProject:p}=c;await REi(c),p.getSourceFile(t3e.join(e,"src","index.test.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","actions.test.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","client.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","connections.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","dataSources.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","dataSources.test.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","triggers.ts"))?.delete(),p.getSourceFile(t3e.join(e,"src","triggers.test.ts"))?.delete(),await p.save()};var W4t={"@prismatic-io/eslint-config-spectral":"2.1.0","@types/jest":"29.5.14","copy-webpack-plugin":"13.0.0",eslint:"^8.57.1",jest:"29.7.0","ts-jest":"29.3.2","ts-loader":"9.5.2",typescript:"5.8.3",webpack:"5.99.5","webpack-cli":"6.0.1"};var ZCi=Qm(PBt(),1);var lCi=Qm(iCi(),1);var Ije=(e)=>{if(typeof e!=="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var JNo={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Bje=(e)=>e.replace(/[[\]\\-]/g,"\\$&"),KNo=(e)=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),rCi=(e)=>e.join(""),aCi=(e,n)=>{let o=n;if(e.charAt(o)!=="[")throw new Error("not in a brace expression");let c=[],p=[],g=o+1,T=!1,N=!1,I=!1,q=!1,W=o,G="";e:while(g<e.length){let g0=e.charAt(g);if((g0==="!"||g0==="^")&&g===o+1){q=!0,g++;continue}if(g0==="]"&&T&&!I){W=g+1;break}if(T=!0,g0==="\\"){if(!I){I=!0,g++;continue}}if(g0==="["&&!I){for(let[D0,[k0,F0,V0]]of Object.entries(JNo))if(e.startsWith(D0,g)){if(G)return["$.",!1,e.length-o,!0];if(g+=D0.length,V0)p.push(k0);else c.push(k0);N=N||F0;continue e}}if(I=!1,G){if(g0>G)c.push(Bje(G)+"-"+Bje(g0));else if(g0===G)c.push(Bje(g0));G="",g++;continue}if(e.startsWith("-]",g+1)){c.push(Bje(g0+"-")),g+=2;continue}if(e.startsWith("-",g+1)){G=g0,g+=2;continue}c.push(Bje(g0)),g++}if(W<g)return["",!1,0,!1];if(!c.length&&!p.length)return["$.",!1,e.length-o,!0];if(p.length===0&&c.length===1&&/^\\?.$/.test(c[0])&&!q){let g0=c[0].length===2?c[0].slice(-1):c[0];return[KNo(g0),!1,W-o,!1]}let R="["+(q?"^":"")+rCi(c)+"]",X="["+(q?"":"^")+rCi(p)+"]";return[c.length&&p.length?"("+R+"|"+X+")":c.length?R:X,N,W-o,!0]};var rj0=(e,{windowsPathsNoEscape:n=!1}={})=>{return n?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var zNo=new Set(["!","?","+","*","@"]),oCi=(e)=>zNo.has(e),WNo="(?!(?:^|/)\\.\\.?(?:$|/))",V4t="(?!\\.)",VNo=new Set(["[","."]),UNo=new Set(["..","."]),QNo=new Set("().*{}+?[]^$\\!"),YNo=(e)=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),MZt="[^/]",uCi=MZt+"*?",sCi=MZt+"+?";class xh0{type;#e;#t;#n=!1;#i=[];#r;#a;#o;#s=!1;#c;#u;#p=!1;constructor(e,n,o={}){if(this.type=e,e)this.#t=!0;if(this.#r=n,this.#e=this.#r?this.#r.#e:this,this.#c=this.#e===this?o:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e==="!"&&!this.#e.#s)this.#o.push(this);this.#a=this.#r?this.#r.#i.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#i){if(typeof e==="string")continue;if(e.type||e.hasMagic)return this.#t=!0}return this.#t}toString(){if(this.#u!==void 0)return this.#u;if(!this.type)return this.#u=this.#i.map((e)=>String(e)).join("");else return this.#u=this.type+"("+this.#i.map((e)=>String(e)).join("|")+")"}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let e;while(e=this.#o.pop()){if(e.type!=="!")continue;let n=e,o=n.#r;while(o){for(let c=n.#a+1;!o.type&&c<o.#i.length;c++)for(let p of e.#i){if(typeof p==="string")throw new Error("string part in extglob AST??");p.copyIn(o.#i[c])}n=o,o=n.#r}}return this}push(...e){for(let n of e){if(n==="")continue;if(typeof n!=="string"&&!(n instanceof xh0&&n.#r===this))throw new Error("invalid part: "+n);this.#i.push(n)}}toJSON(){let e=this.type===null?this.#i.slice().map((n)=>typeof n==="string"?n:n.toJSON()):[this.type,...this.#i.map((n)=>n.toJSON())];if(this.isStart()&&!this.type)e.unshift([]);if(this.isEnd()&&(this===this.#e||this.#e.#s&&this.#r?.type==="!"))e.push({});return e}isStart(){if(this.#e===this)return!0;if(!this.#r?.isStart())return!1;if(this.#a===0)return!0;let e=this.#r;for(let n=0;n<this.#a;n++){let o=e.#i[n];if(!(o instanceof xh0&&o.type==="!"))return!1}return!0}isEnd(){if(this.#e===this)return!0;if(this.#r?.type==="!")return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();let e=this.#r?this.#r.#i.length:0;return this.#a===e-1}copyIn(e){if(typeof e==="string")this.push(e);else this.push(e.clone(this))}clone(e){let n=new xh0(this.type,e);for(let o of this.#i)n.copyIn(o);return n}static#g(e,n,o,c){let p=!1,g=!1,T=-1,N=!1;if(n.type===null){let R=o,X="";while(R<e.length){let l0=e.charAt(R++);if(p||l0==="\\"){p=!p,X+=l0;continue}if(g){if(R===T+1){if(l0==="^"||l0==="!")N=!0}else if(l0==="]"&&!(R===T+2&&N))g=!1;X+=l0;continue}else if(l0==="["){g=!0,T=R,N=!1,X+=l0;continue}if(!c.noext&&oCi(l0)&&e.charAt(R)==="("){n.push(X),X="";let g0=new xh0(l0,n);R=xh0.#g(e,g0,R,c),n.push(g0);continue}X+=l0}return n.push(X),R}let I=o+1,q=new xh0(null,n),W=[],G="";while(I<e.length){let R=e.charAt(I++);if(p||R==="\\"){p=!p,G+=R;continue}if(g){if(I===T+1){if(R==="^"||R==="!")N=!0}else if(R==="]"&&!(I===T+2&&N))g=!1;G+=R;continue}else if(R==="["){g=!0,T=I,N=!1,G+=R;continue}if(oCi(R)&&e.charAt(I)==="("){q.push(G),G="";let X=new xh0(R,q);q.push(X),I=xh0.#g(e,X,I,c);continue}if(R==="|"){q.push(G),G="",W.push(q),q=new xh0(null,n);continue}if(R===")"){if(G===""&&n.#i.length===0)n.#p=!0;return q.push(G),G="",n.push(...W,q),I}G+=R}return n.type=null,n.#t=void 0,n.#i=[e.substring(o-1)],I}static fromGlob(e,n={}){let o=new xh0(null,void 0,n);return xh0.#g(e,o,0,n),o}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[n,o,c,p]=this.toRegExpSource();if(!(c||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return o;let T=(this.#c.nocase?"i":"")+(p?"u":"");return Object.assign(new RegExp(`^${n}$`,T),{_src:n,_glob:e})}get options(){return this.#c}toRegExpSource(e){let n=e??!!this.#c.dot;if(this.#e===this)this.#y();if(!this.type){let N=this.isStart()&&this.isEnd(),I=this.#i.map((R)=>{let[X,l0,g0,D0]=typeof R==="string"?xh0.#D(R,this.#t,N):R.toRegExpSource(e);return this.#t=this.#t||g0,this.#n=this.#n||D0,X}).join(""),q="";if(this.isStart()){if(typeof this.#i[0]==="string"){if(!(this.#i.length===1&&UNo.has(this.#i[0]))){let X=VNo,l0=n&&X.has(I.charAt(0))||I.startsWith("\\.")&&X.has(I.charAt(2))||I.startsWith("\\.\\.")&&X.has(I.charAt(4)),g0=!n&&!e&&X.has(I.charAt(0));q=l0?WNo:g0?V4t:""}}}let W="";if(this.isEnd()&&this.#e.#s&&this.#r?.type==="!")W="(?:$|\\/)";return[q+I+W,rj0(I),this.#t=!!this.#t,this.#n]}let o=this.type==="*"||this.type==="+",c=this.type==="!"?"(?:(?!(?:":"(?:",p=this.#_(n);if(this.isStart()&&this.isEnd()&&!p&&this.type!=="!"){let N=this.toString();return this.#i=[N],this.type=null,this.#t=void 0,[N,rj0(this.toString()),!1,!1]}let g=!o||e||n||!V4t?"":this.#_(!0);if(g===p)g="";if(g)p=`(?:${p})(?:${g})*?`;let T="";if(this.type==="!"&&this.#p)T=(this.isStart()&&!n?V4t:"")+sCi;else{let N=this.type==="!"?"))"+(this.isStart()&&!n&&!e?V4t:"")+uCi+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&g?")":this.type==="*"&&g?")?":`)${this.type}`;T=c+p+N}return[T,rj0(p),this.#t=!!this.#t,this.#n]}#_(e){return this.#i.map((n)=>{if(typeof n==="string")throw new Error("string type in extglob ast??");let[o,c,p,g]=n.toRegExpSource(e);return this.#n=this.#n||g,o}).filter((n)=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#D(e,n,o=!1){let c=!1,p="",g=!1;for(let T=0;T<e.length;T++){let N=e.charAt(T);if(c){c=!1,p+=(QNo.has(N)?"\\":"")+N;continue}if(N==="\\"){if(T===e.length-1)p+="\\\\";else c=!0;continue}if(N==="["){let[I,q,W,G]=aCi(e,T);if(W){p+=I,g=g||q,T+=W-1,n=n||G;continue}}if(N==="*"){if(o&&e==="*")p+=sCi;else p+=uCi;n=!0;continue}if(N==="?"){p+=MZt,n=!0;continue}p+=YNo(N)}return[p,rj0(e),!!n,g]}}var kWe=(e,{windowsPathsNoEscape:n=!1}={})=>{return n?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&")};var dT0=(e,n,o={})=>{if(Ije(n),!o.nocomment&&n.charAt(0)==="#")return!1;return new fU0(n,o).match(e)},ZNo=/^\*+([^+@!?\*\[\(]*)$/,RNo=(e)=>(n)=>!n.startsWith(".")&&n.endsWith(e),$No=(e)=>(n)=>n.endsWith(e),GNo=(e)=>{return e=e.toLowerCase(),(n)=>!n.startsWith(".")&&n.toLowerCase().endsWith(e)},HNo=(e)=>{return e=e.toLowerCase(),(n)=>n.toLowerCase().endsWith(e)},XNo=/^\*+\.\*+$/,jNo=(e)=>!e.startsWith(".")&&e.includes("."),ePo=(e)=>e!=="."&&e!==".."&&e.includes("."),tPo=/^\.\*+$/,nPo=(e)=>e!=="."&&e!==".."&&e.startsWith("."),iPo=/^\*+$/,rPo=(e)=>e.length!==0&&!e.startsWith("."),aPo=(e)=>e.length!==0&&e!=="."&&e!=="..",oPo=/^\?+([^+@!?\*\[\(]*)?$/,uPo=([e,n=""])=>{let o=_Ci([e]);if(!n)return o;return n=n.toLowerCase(),(c)=>o(c)&&c.toLowerCase().endsWith(n)},sPo=([e,n=""])=>{let o=dCi([e]);if(!n)return o;return n=n.toLowerCase(),(c)=>o(c)&&c.toLowerCase().endsWith(n)},cPo=([e,n=""])=>{let o=dCi([e]);return!n?o:(c)=>o(c)&&c.endsWith(n)},fPo=([e,n=""])=>{let o=_Ci([e]);return!n?o:(c)=>o(c)&&c.endsWith(n)},_Ci=([e])=>{let n=e.length;return(o)=>o.length===n&&!o.startsWith(".")},dCi=([e])=>{let n=e.length;return(o)=>o.length===n&&o!=="."&&o!==".."},pCi=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",cCi={win32:{sep:"\\"},posix:{sep:"/"}},lPo=pCi==="win32"?cCi.win32.sep:cCi.posix.sep;dT0.sep=lPo;var Dh0=Symbol("globstar **");dT0.GLOBSTAR=Dh0;var _Po="[^/]",dPo=_Po+"*?",pPo="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",mPo="(?:(?!(?:\\/|^)\\.).)*?",vPo=(e,n={})=>(o)=>dT0(o,e,n);dT0.filter=vPo;var cU0=(e,n={})=>Object.assign({},e,n),gPo=(e)=>{if(!e||typeof e!=="object"||!Object.keys(e).length)return dT0;let n=dT0;return Object.assign((c,p,g={})=>n(c,p,cU0(e,g)),{Minimatch:class c extends n.Minimatch{constructor(p,g={}){super(p,cU0(e,g))}static defaults(p){return n.defaults(cU0(e,p)).Minimatch}},AST:class c extends n.AST{constructor(p,g,T={}){super(p,g,cU0(e,T))}static fromGlob(p,g={}){return n.AST.fromGlob(p,cU0(e,g))}},unescape:(c,p={})=>n.unescape(c,cU0(e,p)),escape:(c,p={})=>n.escape(c,cU0(e,p)),filter:(c,p={})=>n.filter(c,cU0(e,p)),defaults:(c)=>n.defaults(cU0(e,c)),makeRe:(c,p={})=>n.makeRe(c,cU0(e,p)),braceExpand:(c,p={})=>n.braceExpand(c,cU0(e,p)),match:(c,p,g={})=>n.match(c,p,cU0(e,g)),sep:n.sep,GLOBSTAR:Dh0})};dT0.defaults=gPo;var mCi=(e,n={})=>{if(Ije(e),n.nobrace||!/\{(?:(?!\{).)*\}/.test(e))return[e];return lCi.default(e)};dT0.braceExpand=mCi;var hPo=(e,n={})=>new fU0(e,n).makeRe();dT0.makeRe=hPo;var xPo=(e,n,o={})=>{let c=new fU0(n,o);if(e=e.filter((p)=>c.match(p)),c.options.nonull&&!e.length)e.push(n);return e};dT0.match=xPo;var fCi=/[?*]|[+@!]\(.*?\)|\[|\]/,DPo=(e)=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class fU0{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,n={}){if(Ije(e),n=n||{},this.options=n,this.pattern=e,this.platform=n.platform||pCi,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!=="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug)this.debug=(...p)=>console.error(...p);this.debug(this.pattern,this.globSet);let o=this.globSet.map((p)=>this.slashSplit(p));this.globParts=this.preprocess(o),this.debug(this.pattern,this.globParts);let c=this.globParts.map((p,g,T)=>{if(this.isWindows&&this.windowsNoMagicRoot){let N=p[0]===""&&p[1]===""&&(p[2]==="?"||!fCi.test(p[2]))&&!fCi.test(p[3]),I=/^[a-z]:/i.test(p[0]);if(N)return[...p.slice(0,4),...p.slice(4).map((q)=>this.parse(q))];else if(I)return[p[0],...p.slice(1).map((q)=>this.parse(q))]}return p.map((N)=>this.parse(N))});if(this.debug(this.pattern,c),this.set=c.filter((p)=>p.indexOf(!1)===-1),this.isWindows)for(let p=0;p<this.set.length;p++){let g=this.set[p];if(g[0]===""&&g[1]===""&&this.globParts[p][2]==="?"&&typeof g[3]==="string"&&/^[a-z]:$/i.test(g[3]))g[2]="?"}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar){for(let o=0;o<e.length;o++)for(let c=0;c<e[o].length;c++)if(e[o][c]==="**")e[o][c]="*"}let{optimizationLevel:n=1}=this.options;if(n>=2)e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e);else if(n>=1)e=this.levelOneOptimize(e);else e=this.adjascentGlobstarOptimize(e);return e}adjascentGlobstarOptimize(e){return e.map((n)=>{let o=-1;while((o=n.indexOf("**",o+1))!==-1){let c=o;while(n[c+1]==="**")c++;if(c!==o)n.splice(o,c-o)}return n})}levelOneOptimize(e){return e.map((n)=>{return n=n.reduce((o,c)=>{let p=o[o.length-1];if(c==="**"&&p==="**")return o;if(c===".."){if(p&&p!==".."&&p!=="."&&p!=="**")return o.pop(),o}return o.push(c),o},[]),n.length===0?[""]:n})}levelTwoFileOptimize(e){if(!Array.isArray(e))e=this.slashSplit(e);let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let c=1;c<e.length-1;c++){let p=e[c];if(c===1&&p===""&&e[0]==="")continue;if(p==="."||p==="")n=!0,e.splice(c,1),c--}if(e[0]==="."&&e.length===2&&(e[1]==="."||e[1]===""))n=!0,e.pop()}let o=0;while((o=e.indexOf("..",o+1))!==-1){let c=e[o-1];if(c&&c!=="."&&c!==".."&&c!=="**")n=!0,e.splice(o-1,2),o-=2}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let o of e){let c=-1;while((c=o.indexOf("**",c+1))!==-1){let g=c;while(o[g+1]==="**")g++;if(g>c)o.splice(c+1,g-c);let T=o[c+1],N=o[c+2],I=o[c+3];if(T!=="..")continue;if(!N||N==="."||N===".."||!I||I==="."||I==="..")continue;n=!0,o.splice(c,1);let q=o.slice(0);q[c]="**",e.push(q),c--}if(!this.preserveMultipleSlashes){for(let g=1;g<o.length-1;g++){let T=o[g];if(g===1&&T===""&&o[0]==="")continue;if(T==="."||T==="")n=!0,o.splice(g,1),g--}if(o[0]==="."&&o.length===2&&(o[1]==="."||o[1]===""))n=!0,o.pop()}let p=0;while((p=o.indexOf("..",p+1))!==-1){let g=o[p-1];if(g&&g!=="."&&g!==".."&&g!=="**"){n=!0;let N=p===1&&o[p+1]==="**"?["."]:[];if(o.splice(p-1,2,...N),o.length===0)o.push("");p-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let o=n+1;o<e.length;o++){let c=this.partsMatch(e[n],e[o],!this.preserveMultipleSlashes);if(c){e[n]=[],e[o]=c;break}}return e.filter((n)=>n.length)}partsMatch(e,n,o=!1){let c=0,p=0,g=[],T="";while(c<e.length&&p<n.length)if(e[c]===n[p])g.push(T==="b"?n[p]:e[c]),c++,p++;else if(o&&e[c]==="**"&&n[p]===e[c+1])g.push(e[c]),c++;else if(o&&n[p]==="**"&&e[c]===n[p+1])g.push(n[p]),p++;else if(e[c]==="*"&&n[p]&&(this.options.dot||!n[p].startsWith("."))&&n[p]!=="**"){if(T==="b")return!1;T="a",g.push(e[c]),c++,p++}else if(n[p]==="*"&&e[c]&&(this.options.dot||!e[c].startsWith("."))&&e[c]!=="**"){if(T==="a")return!1;T="b",g.push(n[p]),c++,p++}else return!1;return e.length===n.length&&g}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,o=0;for(let c=0;c<e.length&&e.charAt(c)==="!";c++)n=!n,o++;if(o)this.pattern=e.slice(o);this.negate=n}matchOne(e,n,o=!1){let c=this.options;if(this.isWindows){let l0=typeof e[0]==="string"&&/^[a-z]:$/i.test(e[0]),g0=!l0&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),D0=typeof n[0]==="string"&&/^[a-z]:$/i.test(n[0]),k0=!D0&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]==="string"&&/^[a-z]:$/i.test(n[3]),F0=g0?3:l0?0:void 0,V0=k0?3:D0?0:void 0;if(typeof F0==="number"&&typeof V0==="number"){let[Q0,le]=[e[F0],n[V0]];if(Q0.toLowerCase()===le.toLowerCase()){if(n[V0]=Q0,V0>F0)n=n.slice(V0);else if(F0>V0)e=e.slice(F0)}}}let{optimizationLevel:p=1}=this.options;if(p>=2)e=this.levelTwoFileOptimize(e);this.debug("matchOne",this,{file:e,pattern:n}),this.debug("matchOne",e.length,n.length);for(var g=0,T=0,N=e.length,I=n.length;g<N&&T<I;g++,T++){this.debug("matchOne loop");var q=n[T],W=e[g];if(this.debug(n,q,W),q===!1)return!1;if(q===Dh0){this.debug("GLOBSTAR",[n,q,W]);var G=g,R=T+1;if(R===I){this.debug("** at the end");for(;g<N;g++)if(e[g]==="."||e[g]===".."||!c.dot&&e[g].charAt(0)===".")return!1;return!0}while(G<N){var X=e[G];if(this.debug(`
|
|
64893
64893
|
globstar while`,e,G,n,R,X),this.matchOne(e.slice(G),n.slice(R),o))return this.debug("globstar found match!",G,N,X),!0;else{if(X==="."||X===".."||!c.dot&&X.charAt(0)==="."){this.debug("dot detected!",e,G,n,R);break}this.debug("globstar swallow a segment, and continue"),G++}}if(o){if(this.debug(`
|
|
64894
64894
|
>>> no match, partial?`,e,G,n,R),G===N)return!0}return!1}let l0;if(typeof q==="string")l0=W===q,this.debug("string match",q,W,l0);else l0=q.test(W),this.debug("pattern match",q,W,l0);if(!l0)return!1}if(g===N&&T===I)return!0;else if(g===N)return o;else if(T===I)return g===N-1&&e[g]==="";else throw new Error("wtf?")}braceExpand(){return mCi(this.pattern,this.options)}parse(e){Ije(e);let n=this.options;if(e==="**")return Dh0;if(e==="")return"";let o,c=null;if(o=e.match(iPo))c=n.dot?aPo:rPo;else if(o=e.match(ZNo))c=(n.nocase?n.dot?HNo:GNo:n.dot?$No:RNo)(o[1]);else if(o=e.match(oPo))c=(n.nocase?n.dot?sPo:uPo:n.dot?cPo:fPo)(o);else if(o=e.match(XNo))c=n.dot?ePo:jNo;else if(o=e.match(tPo))c=nPo;let p=xh0.fromGlob(e,this.options).toMMPattern();if(c&&typeof p==="object")Reflect.defineProperty(p,"test",{value:c});return p}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,o=n.noglobstar?dPo:n.dot?pPo:mPo,c=new Set(n.nocase?["i"]:[]),p=e.map((N)=>{let I=N.map((q)=>{if(q instanceof RegExp)for(let W of q.flags.split(""))c.add(W);return typeof q==="string"?DPo(q):q===Dh0?Dh0:q._src});return I.forEach((q,W)=>{let G=I[W+1],R=I[W-1];if(q!==Dh0||R===Dh0)return;if(R===void 0)if(G!==void 0&&G!==Dh0)I[W+1]="(?:\\/|"+o+"\\/)?"+G;else I[W]=o;else if(G===void 0)I[W-1]=R+"(?:\\/|"+o+")?";else if(G!==Dh0)I[W-1]=R+"(?:\\/|\\/"+o+"\\/)"+G,I[W+1]=Dh0}),I.filter((q)=>q!==Dh0).join("/")}).join("|"),[g,T]=e.length>1?["(?:",")"]:["",""];if(p="^"+g+p+T+"$",this.negate)p="^(?!"+p+").+$";try{this.regexp=new RegExp(p,[...c].join(""))}catch(N){this.regexp=!1}return this.regexp}slashSplit(e){if(this.preserveMultipleSlashes)return e.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(e))return["",...e.split(/\/+/)];else return e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let o=this.options;if(this.isWindows)e=e.split("\\").join("/");let c=this.slashSplit(e);this.debug(this.pattern,"split",c);let p=this.set;this.debug(this.pattern,"set",p);let g=c[c.length-1];if(!g)for(let T=c.length-2;!g&&T>=0;T--)g=c[T];for(let T=0;T<p.length;T++){let N=p[T],I=c;if(o.matchBase&&N.length===1)I=[g];if(this.matchOne(I,N,n)){if(o.flipNegate)return!0;return!this.negate}}if(o.flipNegate)return!1;return this.negate}static defaults(e){return dT0.defaults(e).Minimatch}}dT0.AST=xh0;dT0.Minimatch=fU0;dT0.escape=kWe;dT0.unescape=rj0;import{fileURLToPath as XPo}from"node:url";var OWe=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,gCi=new Set,LZt=typeof process==="object"&&!!process?process:{},hCi=(e,n,o,c)=>{typeof LZt.emitWarning==="function"?LZt.emitWarning(e,n,o,c):console.error(`[${o}] ${n}: ${e}`)},U4t=globalThis.AbortController,vCi=globalThis.AbortSignal;if(typeof U4t==="undefined"){vCi=class o{onabort;_onabort=[];reason;aborted=!1;addEventListener(c,p){this._onabort.push(p)}},U4t=class o{constructor(){n()}signal=new vCi;abort(c){if(this.signal.aborted)return;this.signal.reason=c,this.signal.aborted=!0;for(let p of this.signal._onabort)p(c);this.signal.onabort?.(c)}};let e=LZt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",n=()=>{if(!e)return;e=!1,hCi("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",n)}}var yPo=(e)=>!gCi.has(e),O1s=Symbol("type"),dEe=(e)=>e&&e===Math.floor(e)&&e>0&&isFinite(e),xCi=(e)=>!dEe(e)?null:e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Mje:null;class Mje extends Array{constructor(e){super(e);this.fill(0)}}class IWe{heap;length;static#e=!1;static create(e){let n=xCi(e);if(!n)return[];IWe.#e=!0;let o=new IWe(e,n);return IWe.#e=!1,o}constructor(e,n){if(!IWe.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class Lje{#e;#t;#n;#i;#r;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#o;#s;#c;#u;#p;#y;#g;#_;#D;#d;#h;#E;#S;#m;#A;#l;static unsafeExposeInternals(e){return{starts:e.#E,ttls:e.#S,sizes:e.#h,keyMap:e.#s,keyList:e.#c,valList:e.#u,next:e.#p,prev:e.#y,get head(){return e.#g},get tail(){return e.#_},free:e.#D,isBackgroundFetch:(n)=>e.#x(n),backgroundFetch:(n,o,c,p)=>e.#I(n,o,c,p),moveToTail:(n)=>e.#O(n),indexes:(n)=>e.#N(n),rindexes:(n)=>e.#P(n),isStale:(n)=>e.#T(n)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#o}get size(){return this.#a}get fetchMethod(){return this.#r}get dispose(){return this.#n}get disposeAfter(){return this.#i}constructor(e){let{max:n=0,ttl:o,ttlResolution:c=1,ttlAutopurge:p,updateAgeOnGet:g,updateAgeOnHas:T,allowStale:N,dispose:I,disposeAfter:q,noDisposeOnSet:W,noUpdateTTL:G,maxSize:R=0,maxEntrySize:X=0,sizeCalculation:l0,fetchMethod:g0,noDeleteOnFetchRejection:D0,noDeleteOnStaleGet:k0,allowStaleOnFetchRejection:F0,allowStaleOnFetchAbort:V0,ignoreFetchAbort:Q0}=e;if(n!==0&&!dEe(n))throw new TypeError("max option must be a nonnegative integer");let le=n?xCi(n):Array;if(!le)throw new Error("invalid max value: "+n);if(this.#e=n,this.#t=R,this.maxEntrySize=X||this.#t,this.sizeCalculation=l0,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw new TypeError("sizeCalculation set to non-function")}if(g0!==void 0&&typeof g0!=="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#r=g0,this.#A=!!g0,this.#s=new Map,this.#c=new Array(n).fill(void 0),this.#u=new Array(n).fill(void 0),this.#p=new le(n),this.#y=new le(n),this.#g=0,this.#_=0,this.#D=IWe.create(n),this.#a=0,this.#o=0,typeof I==="function")this.#n=I;if(typeof q==="function")this.#i=q,this.#d=[];else this.#i=void 0,this.#d=void 0;if(this.#m=!!this.#n,this.#l=!!this.#i,this.noDisposeOnSet=!!W,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!D0,this.allowStaleOnFetchRejection=!!F0,this.allowStaleOnFetchAbort=!!V0,this.ignoreFetchAbort=!!Q0,this.maxEntrySize!==0){if(this.#t!==0){if(!dEe(this.#t))throw new TypeError("maxSize must be a positive integer if specified")}if(!dEe(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#b()}if(this.allowStale=!!N,this.noDeleteOnStaleGet=!!k0,this.updateAgeOnGet=!!g,this.updateAgeOnHas=!!T,this.ttlResolution=dEe(c)||c===0?c:1,this.ttlAutopurge=!!p,this.ttl=o||0,this.ttl){if(!dEe(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#v()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){if(yPo("LRU_CACHE_UNBOUNDED"))gCi.add("LRU_CACHE_UNBOUNDED"),hCi("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",Lje)}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#v(){let e=new Mje(this.#e),n=new Mje(this.#e);this.#S=e,this.#E=n,this.#f=(p,g,T=OWe.now())=>{if(n[p]=g!==0?T:0,e[p]=g,g!==0&&this.ttlAutopurge){let N=setTimeout(()=>{if(this.#T(p))this.delete(this.#c[p])},g+1);if(N.unref)N.unref()}},this.#F=(p)=>{n[p]=e[p]!==0?OWe.now():0},this.#w=(p,g)=>{if(e[g]){let T=e[g],N=n[g];if(!T||!N)return;p.ttl=T,p.start=N,p.now=o||c();let I=p.now-N;p.remainingTTL=T-I}};let o=0,c=()=>{let p=OWe.now();if(this.ttlResolution>0){o=p;let g=setTimeout(()=>o=0,this.ttlResolution);if(g.unref)g.unref()}return p};this.getRemainingTTL=(p)=>{let g=this.#s.get(p);if(g===void 0)return 0;let T=e[g],N=n[g];if(!T||!N)return 1/0;let I=(o||c())-N;return T-I},this.#T=(p)=>{let g=n[p],T=e[p];return!!T&&!!g&&(o||c())-g>T}}#F=()=>{};#w=()=>{};#f=()=>{};#T=()=>!1;#b(){let e=new Mje(this.#e);this.#o=0,this.#h=e,this.#C=(n)=>{this.#o-=e[n],e[n]=0},this.#M=(n,o,c,p)=>{if(this.#x(o))return 0;if(!dEe(c))if(p){if(typeof p!=="function")throw new TypeError("sizeCalculation must be a function");if(c=p(o,n),!dEe(c))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return c},this.#B=(n,o,c)=>{if(e[n]=o,this.#t){let p=this.#t-e[n];while(this.#o>p)this.#k(!0)}if(this.#o+=e[n],c)c.entrySize=o,c.totalCalculatedSize=this.#o}}#C=(e)=>{};#B=(e,n,o)=>{};#M=(e,n,o,c)=>{if(o||c)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#N({allowStale:e=this.allowStale}={}){if(this.#a)for(let n=this.#_;;){if(!this.#L(n))break;if(e||!this.#T(n))yield n;if(n===this.#g)break;else n=this.#y[n]}}*#P({allowStale:e=this.allowStale}={}){if(this.#a)for(let n=this.#g;;){if(!this.#L(n))break;if(e||!this.#T(n))yield n;if(n===this.#_)break;else n=this.#p[n]}}#L(e){return e!==void 0&&this.#s.get(this.#c[e])===e}*entries(){for(let e of this.#N())if(this.#u[e]!==void 0&&this.#c[e]!==void 0&&!this.#x(this.#u[e]))yield[this.#c[e],this.#u[e]]}*rentries(){for(let e of this.#P())if(this.#u[e]!==void 0&&this.#c[e]!==void 0&&!this.#x(this.#u[e]))yield[this.#c[e],this.#u[e]]}*keys(){for(let e of this.#N()){let n=this.#c[e];if(n!==void 0&&!this.#x(this.#u[e]))yield n}}*rkeys(){for(let e of this.#P()){let n=this.#c[e];if(n!==void 0&&!this.#x(this.#u[e]))yield n}}*values(){for(let e of this.#N())if(this.#u[e]!==void 0&&!this.#x(this.#u[e]))yield this.#u[e]}*rvalues(){for(let e of this.#P())if(this.#u[e]!==void 0&&!this.#x(this.#u[e]))yield this.#u[e]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,n={}){for(let o of this.#N()){let c=this.#u[o],p=this.#x(c)?c.__staleWhileFetching:c;if(p===void 0)continue;if(e(p,this.#c[o],this))return this.get(this.#c[o],n)}}forEach(e,n=this){for(let o of this.#N()){let c=this.#u[o],p=this.#x(c)?c.__staleWhileFetching:c;if(p===void 0)continue;e.call(n,p,this.#c[o],this)}}rforEach(e,n=this){for(let o of this.#P()){let c=this.#u[o],p=this.#x(c)?c.__staleWhileFetching:c;if(p===void 0)continue;e.call(n,p,this.#c[o],this)}}purgeStale(){let e=!1;for(let n of this.#P({allowStale:!0}))if(this.#T(n))this.delete(this.#c[n]),e=!0;return e}info(e){let n=this.#s.get(e);if(n===void 0)return;let o=this.#u[n],c=this.#x(o)?o.__staleWhileFetching:o;if(c===void 0)return;let p={value:c};if(this.#S&&this.#E){let g=this.#S[n],T=this.#E[n];if(g&&T){let N=g-(OWe.now()-T);p.ttl=N,p.start=Date.now()}}if(this.#h)p.size=this.#h[n];return p}dump(){let e=[];for(let n of this.#N({allowStale:!0})){let o=this.#c[n],c=this.#u[n],p=this.#x(c)?c.__staleWhileFetching:c;if(p===void 0||o===void 0)continue;let g={value:p};if(this.#S&&this.#E){g.ttl=this.#S[n];let T=OWe.now()-this.#E[n];g.start=Math.floor(Date.now()-T)}if(this.#h)g.size=this.#h[n];e.unshift([o,g])}return e}load(e){this.clear();for(let[n,o]of e){if(o.start){let c=Date.now()-o.start;o.start=OWe.now()-c}this.set(n,o.value,o)}}set(e,n,o={}){if(n===void 0)return this.delete(e),this;let{ttl:c=this.ttl,start:p,noDisposeOnSet:g=this.noDisposeOnSet,sizeCalculation:T=this.sizeCalculation,status:N}=o,{noUpdateTTL:I=this.noUpdateTTL}=o,q=this.#M(e,n,o.size||0,T);if(this.maxEntrySize&&q>this.maxEntrySize){if(N)N.set="miss",N.maxEntrySizeExceeded=!0;return this.delete(e),this}let W=this.#a===0?void 0:this.#s.get(e);if(W===void 0){if(W=this.#a===0?this.#_:this.#D.length!==0?this.#D.pop():this.#a===this.#e?this.#k(!1):this.#a,this.#c[W]=e,this.#u[W]=n,this.#s.set(e,W),this.#p[this.#_]=W,this.#y[W]=this.#_,this.#_=W,this.#a++,this.#B(W,q,N),N)N.set="add";I=!1}else{this.#O(W);let G=this.#u[W];if(n!==G){if(this.#A&&this.#x(G)){G.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:R}=G;if(R!==void 0&&!g){if(this.#m)this.#n?.(R,e,"set");if(this.#l)this.#d?.push([R,e,"set"])}}else if(!g){if(this.#m)this.#n?.(G,e,"set");if(this.#l)this.#d?.push([G,e,"set"])}if(this.#C(W),this.#B(W,q,N),this.#u[W]=n,N){N.set="replace";let R=G&&this.#x(G)?G.__staleWhileFetching:G;if(R!==void 0)N.oldValue=R}}else if(N)N.set="update"}if(c!==0&&!this.#S)this.#v();if(this.#S){if(!I)this.#f(W,c,p);if(N)this.#w(N,W)}if(!g&&this.#l&&this.#d){let G=this.#d,R;while(R=G?.shift())this.#i?.(...R)}return this}pop(){try{while(this.#a){let e=this.#u[this.#g];if(this.#k(!0),this.#x(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#l&&this.#d){let e=this.#d,n;while(n=e?.shift())this.#i?.(...n)}}}#k(e){let n=this.#g,o=this.#c[n],c=this.#u[n];if(this.#A&&this.#x(c))c.__abortController.abort(new Error("evicted"));else if(this.#m||this.#l){if(this.#m)this.#n?.(c,o,"evict");if(this.#l)this.#d?.push([c,o,"evict"])}if(this.#C(n),e)this.#c[n]=void 0,this.#u[n]=void 0,this.#D.push(n);if(this.#a===1)this.#g=this.#_=0,this.#D.length=0;else this.#g=this.#p[n];return this.#s.delete(o),this.#a--,n}has(e,n={}){let{updateAgeOnHas:o=this.updateAgeOnHas,status:c}=n,p=this.#s.get(e);if(p!==void 0){let g=this.#u[p];if(this.#x(g)&&g.__staleWhileFetching===void 0)return!1;if(!this.#T(p)){if(o)this.#F(p);if(c)c.has="hit",this.#w(c,p);return!0}else if(c)c.has="stale",this.#w(c,p)}else if(c)c.has="miss";return!1}peek(e,n={}){let{allowStale:o=this.allowStale}=n,c=this.#s.get(e);if(c===void 0||!o&&this.#T(c))return;let p=this.#u[c];return this.#x(p)?p.__staleWhileFetching:p}#I(e,n,o,c){let p=n===void 0?void 0:this.#u[n];if(this.#x(p))return p;let g=new U4t,{signal:T}=o;T?.addEventListener("abort",()=>g.abort(T.reason),{signal:g.signal});let N={signal:g.signal,options:o,context:c},I=(l0,g0=!1)=>{let{aborted:D0}=g.signal,k0=o.ignoreFetchAbort&&l0!==void 0;if(o.status)if(D0&&!g0){if(o.status.fetchAborted=!0,o.status.fetchError=g.signal.reason,k0)o.status.fetchAbortIgnored=!0}else o.status.fetchResolved=!0;if(D0&&!k0&&!g0)return W(g.signal.reason);let F0=R;if(this.#u[n]===R)if(l0===void 0)if(F0.__staleWhileFetching)this.#u[n]=F0.__staleWhileFetching;else this.delete(e);else{if(o.status)o.status.fetchUpdated=!0;this.set(e,l0,N.options)}return l0},q=(l0)=>{if(o.status)o.status.fetchRejected=!0,o.status.fetchError=l0;return W(l0)},W=(l0)=>{let{aborted:g0}=g.signal,D0=g0&&o.allowStaleOnFetchAbort,k0=D0||o.allowStaleOnFetchRejection,F0=k0||o.noDeleteOnFetchRejection,V0=R;if(this.#u[n]===R){if(!F0||V0.__staleWhileFetching===void 0)this.delete(e);else if(!D0)this.#u[n]=V0.__staleWhileFetching}if(k0){if(o.status&&V0.__staleWhileFetching!==void 0)o.status.returnedStale=!0;return V0.__staleWhileFetching}else if(V0.__returned===V0)throw l0},G=(l0,g0)=>{let D0=this.#r?.(e,p,N);if(D0&&D0 instanceof Promise)D0.then((k0)=>l0(k0===void 0?void 0:k0),g0);g.signal.addEventListener("abort",()=>{if(!o.ignoreFetchAbort||o.allowStaleOnFetchAbort){if(l0(void 0),o.allowStaleOnFetchAbort)l0=(k0)=>I(k0,!0)}})};if(o.status)o.status.fetchDispatched=!0;let R=new Promise(G).then(I,q),X=Object.assign(R,{__abortController:g,__staleWhileFetching:p,__returned:void 0});if(n===void 0)this.set(e,X,{...N.options,status:void 0}),n=this.#s.get(e);else this.#u[n]=X;return X}#x(e){if(!this.#A)return!1;let n=e;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof U4t}async fetch(e,n={}){let{allowStale:o=this.allowStale,updateAgeOnGet:c=this.updateAgeOnGet,noDeleteOnStaleGet:p=this.noDeleteOnStaleGet,ttl:g=this.ttl,noDisposeOnSet:T=this.noDisposeOnSet,size:N=0,sizeCalculation:I=this.sizeCalculation,noUpdateTTL:q=this.noUpdateTTL,noDeleteOnFetchRejection:W=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:G=this.allowStaleOnFetchRejection,ignoreFetchAbort:R=this.ignoreFetchAbort,allowStaleOnFetchAbort:X=this.allowStaleOnFetchAbort,context:l0,forceRefresh:g0=!1,status:D0,signal:k0}=n;if(!this.#A){if(D0)D0.fetch="get";return this.get(e,{allowStale:o,updateAgeOnGet:c,noDeleteOnStaleGet:p,status:D0})}let F0={allowStale:o,updateAgeOnGet:c,noDeleteOnStaleGet:p,ttl:g,noDisposeOnSet:T,size:N,sizeCalculation:I,noUpdateTTL:q,noDeleteOnFetchRejection:W,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:X,ignoreFetchAbort:R,status:D0,signal:k0},V0=this.#s.get(e);if(V0===void 0){if(D0)D0.fetch="miss";let Q0=this.#I(e,V0,F0,l0);return Q0.__returned=Q0}else{let Q0=this.#u[V0];if(this.#x(Q0)){let ye=o&&Q0.__staleWhileFetching!==void 0;if(D0){if(D0.fetch="inflight",ye)D0.returnedStale=!0}return ye?Q0.__staleWhileFetching:Q0.__returned=Q0}let le=this.#T(V0);if(!g0&&!le){if(D0)D0.fetch="hit";if(this.#O(V0),c)this.#F(V0);if(D0)this.#w(D0,V0);return Q0}let tt=this.#I(e,V0,F0,l0),Te=tt.__staleWhileFetching!==void 0&&o;if(D0){if(D0.fetch=le?"stale":"refresh",Te&&le)D0.returnedStale=!0}return Te?tt.__staleWhileFetching:tt.__returned=tt}}get(e,n={}){let{allowStale:o=this.allowStale,updateAgeOnGet:c=this.updateAgeOnGet,noDeleteOnStaleGet:p=this.noDeleteOnStaleGet,status:g}=n,T=this.#s.get(e);if(T!==void 0){let N=this.#u[T],I=this.#x(N);if(g)this.#w(g,T);if(this.#T(T)){if(g)g.get="stale";if(!I){if(!p)this.delete(e);if(g&&o)g.returnedStale=!0;return o?N:void 0}else{if(g&&o&&N.__staleWhileFetching!==void 0)g.returnedStale=!0;return o?N.__staleWhileFetching:void 0}}else{if(g)g.get="hit";if(I)return N.__staleWhileFetching;if(this.#O(T),c)this.#F(T);return N}}else if(g)g.get="miss"}#q(e,n){this.#y[n]=e,this.#p[e]=n}#O(e){if(e!==this.#_){if(e===this.#g)this.#g=this.#p[e];else this.#q(this.#y[e],this.#p[e]);this.#q(this.#_,e),this.#_=e}}delete(e){let n=!1;if(this.#a!==0){let o=this.#s.get(e);if(o!==void 0)if(n=!0,this.#a===1)this.clear();else{this.#C(o);let c=this.#u[o];if(this.#x(c))c.__abortController.abort(new Error("deleted"));else if(this.#m||this.#l){if(this.#m)this.#n?.(c,e,"delete");if(this.#l)this.#d?.push([c,e,"delete"])}if(this.#s.delete(e),this.#c[o]=void 0,this.#u[o]=void 0,o===this.#_)this.#_=this.#y[o];else if(o===this.#g)this.#g=this.#p[o];else{let p=this.#y[o];this.#p[p]=this.#p[o];let g=this.#p[o];this.#y[g]=this.#y[o]}this.#a--,this.#D.push(o)}}if(this.#l&&this.#d?.length){let o=this.#d,c;while(c=o?.shift())this.#i?.(...c)}return n}clear(){for(let e of this.#P({allowStale:!0})){let n=this.#u[e];if(this.#x(n))n.__abortController.abort(new Error("deleted"));else{let o=this.#c[e];if(this.#m)this.#n?.(n,o,"delete");if(this.#l)this.#d?.push([n,o,"delete"])}}if(this.#s.clear(),this.#u.fill(void 0),this.#c.fill(void 0),this.#S&&this.#E)this.#S.fill(0),this.#E.fill(0);if(this.#h)this.#h.fill(0);if(this.#g=0,this.#_=0,this.#D.length=0,this.#o=0,this.#a=0,this.#l&&this.#d){let e=this.#d,n;while(n=e?.shift())this.#i?.(...n)}}}import{posix as kPo,win32 as ZZt}from"node:path";import{fileURLToPath as OPo}from"node:url";import{lstatSync as IPo,readdir as BPo,readdirSync as MPo,readlinkSync as LPo,realpathSync as qPo}from"fs";import*as JPo from"node:fs";import{lstat as zPo,readdir as WPo,readlink as VPo,realpath as UPo}from"node:fs/promises";import{EventEmitter as VZt}from"node:events";import TCi from"node:stream";import{StringDecoder as EPo}from"node:string_decoder";var DCi=typeof process==="object"&&process?process:{stdout:null,stderr:null},CPo=(e)=>!!e&&typeof e==="object"&&(e instanceof aMe||e instanceof TCi||TPo(e)||SPo(e)),TPo=(e)=>!!e&&typeof e==="object"&&e instanceof VZt&&typeof e.pipe==="function"&&e.pipe!==TCi.Writable.prototype.pipe,SPo=(e)=>!!e&&typeof e==="object"&&e instanceof VZt&&typeof e.write==="function"&&typeof e.end==="function",n3e=Symbol("EOF"),i3e=Symbol("maybeEmitEnd"),pEe=Symbol("emittedEnd"),Q4t=Symbol("emittingEnd"),qje=Symbol("emittedError"),Y4t=Symbol("closed"),yCi=Symbol("read"),Z4t=Symbol("flush"),ECi=Symbol("flushChunk"),aj0=Symbol("encoding"),BWe=Symbol("decoder"),Lv0=Symbol("flowing"),Jje=Symbol("paused"),MWe=Symbol("resume"),qv0=Symbol("buffer"),pT0=Symbol("pipes"),Jv0=Symbol("bufferLength"),qZt=Symbol("bufferPush"),R4t=Symbol("bufferShift"),RD0=Symbol("objectMode"),h20=Symbol("destroyed"),JZt=Symbol("error"),KZt=Symbol("emitData"),CCi=Symbol("emitEnd"),zZt=Symbol("emitEnd2"),Lue=Symbol("async"),WZt=Symbol("abort"),$4t=Symbol("aborted"),Kje=Symbol("signal"),rMe=Symbol("dataListeners"),bM0=Symbol("discarded"),zje=(e)=>Promise.resolve().then(e),APo=(e)=>e(),wPo=(e)=>e==="end"||e==="finish"||e==="prefinish",FPo=(e)=>e instanceof ArrayBuffer||!!e&&typeof e==="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,bPo=(e)=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e);class UZt{src;dest;opts;ondrain;constructor(e,n,o){this.src=e,this.dest=n,this.opts=o,this.ondrain=()=>e[MWe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class SCi extends UZt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,n,o){super(e,n,o);this.proxyErrors=(c)=>n.emit("error",c),e.on("error",this.proxyErrors)}}var NPo=(e)=>!!e.objectMode,PPo=(e)=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer";class aMe extends VZt{[Lv0]=!1;[Jje]=!1;[pT0]=[];[qv0]=[];[RD0];[aj0];[Lue];[BWe];[n3e]=!1;[pEe]=!1;[Q4t]=!1;[Y4t]=!1;[qje]=null;[Jv0]=0;[h20]=!1;[Kje];[$4t]=!1;[rMe]=0;[bM0]=!1;writable=!0;readable=!0;constructor(...e){let n=e[0]||{};super();if(n.objectMode&&typeof n.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(NPo(n))this[RD0]=!0,this[aj0]=null;else if(PPo(n))this[aj0]=n.encoding,this[RD0]=!1;else this[RD0]=!1,this[aj0]=null;if(this[Lue]=!!n.async,this[BWe]=this[aj0]?new EPo(this[aj0]):null,n&&n.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[qv0]});if(n&&n.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[pT0]});let{signal:o}=n;if(o)if(this[Kje]=o,o.aborted)this[WZt]();else o.addEventListener("abort",()=>this[WZt]())}get bufferLength(){return this[Jv0]}get encoding(){return this[aj0]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[RD0]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[Lue]}set["async"](e){this[Lue]=this[Lue]||!!e}[WZt](){this[$4t]=!0,this.emit("abort",this[Kje]?.reason),this.destroy(this[Kje]?.reason)}get aborted(){return this[$4t]}set aborted(e){}write(e,n,o){if(this[$4t])return!1;if(this[n3e])throw new Error("write after end");if(this[h20])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof n==="function")o=n,n="utf8";if(!n)n="utf8";let c=this[Lue]?zje:APo;if(!this[RD0]&&!Buffer.isBuffer(e)){if(bPo(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(FPo(e))e=Buffer.from(e);else if(typeof e!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[RD0]){if(this[Lv0]&&this[Jv0]!==0)this[Z4t](!0);if(this[Lv0])this.emit("data",e);else this[qZt](e);if(this[Jv0]!==0)this.emit("readable");if(o)c(o);return this[Lv0]}if(!e.length){if(this[Jv0]!==0)this.emit("readable");if(o)c(o);return this[Lv0]}if(typeof e==="string"&&!(n===this[aj0]&&!this[BWe]?.lastNeed))e=Buffer.from(e,n);if(Buffer.isBuffer(e)&&this[aj0])e=this[BWe].write(e);if(this[Lv0]&&this[Jv0]!==0)this[Z4t](!0);if(this[Lv0])this.emit("data",e);else this[qZt](e);if(this[Jv0]!==0)this.emit("readable");if(o)c(o);return this[Lv0]}read(e){if(this[h20])return null;if(this[bM0]=!1,this[Jv0]===0||e===0||e&&e>this[Jv0])return this[i3e](),null;if(this[RD0])e=null;if(this[qv0].length>1&&!this[RD0])this[qv0]=[this[aj0]?this[qv0].join(""):Buffer.concat(this[qv0],this[Jv0])];let n=this[yCi](e||null,this[qv0][0]);return this[i3e](),n}[yCi](e,n){if(this[RD0])this[R4t]();else{let o=n;if(e===o.length||e===null)this[R4t]();else if(typeof o==="string")this[qv0][0]=o.slice(e),n=o.slice(0,e),this[Jv0]-=e;else this[qv0][0]=o.subarray(e),n=o.subarray(0,e),this[Jv0]-=e}if(this.emit("data",n),!this[qv0].length&&!this[n3e])this.emit("drain");return n}end(e,n,o){if(typeof e==="function")o=e,e=void 0;if(typeof n==="function")o=n,n="utf8";if(e!==void 0)this.write(e,n);if(o)this.once("end",o);if(this[n3e]=!0,this.writable=!1,this[Lv0]||!this[Jje])this[i3e]();return this}[MWe](){if(this[h20])return;if(!this[rMe]&&!this[pT0].length)this[bM0]=!0;if(this[Jje]=!1,this[Lv0]=!0,this.emit("resume"),this[qv0].length)this[Z4t]();else if(this[n3e])this[i3e]();else this.emit("drain")}resume(){return this[MWe]()}pause(){this[Lv0]=!1,this[Jje]=!0,this[bM0]=!1}get destroyed(){return this[h20]}get flowing(){return this[Lv0]}get paused(){return this[Jje]}[qZt](e){if(this[RD0])this[Jv0]+=1;else this[Jv0]+=e.length;this[qv0].push(e)}[R4t](){if(this[RD0])this[Jv0]-=1;else this[Jv0]-=this[qv0][0].length;return this[qv0].shift()}[Z4t](e=!1){do;while(this[ECi](this[R4t]())&&this[qv0].length);if(!e&&!this[qv0].length&&!this[n3e])this.emit("drain")}[ECi](e){return this.emit("data",e),this[Lv0]}pipe(e,n){if(this[h20])return e;this[bM0]=!1;let o=this[pEe];if(n=n||{},e===DCi.stdout||e===DCi.stderr)n.end=!1;else n.end=n.end!==!1;if(n.proxyErrors=!!n.proxyErrors,o){if(n.end)e.end()}else if(this[pT0].push(!n.proxyErrors?new UZt(this,e,n):new SCi(this,e,n)),this[Lue])zje(()=>this[MWe]());else this[MWe]();return e}unpipe(e){let n=this[pT0].find((o)=>o.dest===e);if(n){if(this[pT0].length===1){if(this[Lv0]&&this[rMe]===0)this[Lv0]=!1;this[pT0]=[]}else this[pT0].splice(this[pT0].indexOf(n),1);n.unpipe()}}addListener(e,n){return this.on(e,n)}on(e,n){let o=super.on(e,n);if(e==="data"){if(this[bM0]=!1,this[rMe]++,!this[pT0].length&&!this[Lv0])this[MWe]()}else if(e==="readable"&&this[Jv0]!==0)super.emit("readable");else if(wPo(e)&&this[pEe])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[qje]){let c=n;if(this[Lue])zje(()=>c.call(this,this[qje]));else c.call(this,this[qje])}return o}removeListener(e,n){return this.off(e,n)}off(e,n){let o=super.off(e,n);if(e==="data"){if(this[rMe]=this.listeners("data").length,this[rMe]===0&&!this[bM0]&&!this[pT0].length)this[Lv0]=!1}return o}removeAllListeners(e){let n=super.removeAllListeners(e);if(e==="data"||e===void 0){if(this[rMe]=0,!this[bM0]&&!this[pT0].length)this[Lv0]=!1}return n}get emittedEnd(){return this[pEe]}[i3e](){if(!this[Q4t]&&!this[pEe]&&!this[h20]&&this[qv0].length===0&&this[n3e]){if(this[Q4t]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Y4t])this.emit("close");this[Q4t]=!1}}emit(e,...n){let o=n[0];if(e!=="error"&&e!=="close"&&e!==h20&&this[h20])return!1;else if(e==="data")return!this[RD0]&&!o?!1:this[Lue]?(zje(()=>this[KZt](o)),!0):this[KZt](o);else if(e==="end")return this[CCi]();else if(e==="close"){if(this[Y4t]=!0,!this[pEe]&&!this[h20])return!1;let p=super.emit("close");return this.removeAllListeners("close"),p}else if(e==="error"){this[qje]=o,super.emit(JZt,o);let p=!this[Kje]||this.listeners("error").length?super.emit("error",o):!1;return this[i3e](),p}else if(e==="resume"){let p=super.emit("resume");return this[i3e](),p}else if(e==="finish"||e==="prefinish"){let p=super.emit(e);return this.removeAllListeners(e),p}let c=super.emit(e,...n);return this[i3e](),c}[KZt](e){for(let o of this[pT0])if(o.dest.write(e)===!1)this.pause();let n=this[bM0]?!1:super.emit("data",e);return this[i3e](),n}[CCi](){if(this[pEe])return!1;return this[pEe]=!0,this.readable=!1,this[Lue]?(zje(()=>this[zZt]()),!0):this[zZt]()}[zZt](){if(this[BWe]){let n=this[BWe].end();if(n){for(let o of this[pT0])o.dest.write(n);if(!this[bM0])super.emit("data",n)}}for(let n of this[pT0])n.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});if(!this[RD0])e.dataLength=0;let n=this.promise();return this.on("data",(o)=>{if(e.push(o),!this[RD0])e.dataLength+=o.length}),await n,e}async concat(){if(this[RD0])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[aj0]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,n)=>{this.on(h20,()=>n(new Error("stream destroyed"))),this.on("error",(o)=>n(o)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[bM0]=!1;let e=!1,n=async()=>{return this.pause(),e=!0,{value:void 0,done:!0}};return{next:()=>{if(e)return n();let c=this.read();if(c!==null)return Promise.resolve({done:!1,value:c});if(this[n3e])return n();let p,g,T=(W)=>{this.off("data",N),this.off("end",I),this.off(h20,q),n(),g(W)},N=(W)=>{this.off("error",T),this.off("end",I),this.off(h20,q),this.pause(),p({value:W,done:!!this[n3e]})},I=()=>{this.off("error",T),this.off("data",N),this.off(h20,q),n(),p({done:!0,value:void 0})},q=()=>T(new Error("stream destroyed"));return new Promise((W,G)=>{g=G,p=W,this.once(h20,q),this.once("error",T),this.once("end",I),this.once("data",N)})},throw:n,return:n,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[bM0]=!1;let e=!1,n=()=>{return this.pause(),this.off(JZt,n),this.off(h20,n),this.off("end",n),e=!0,{done:!0,value:void 0}},o=()=>{if(e)return n();let c=this.read();return c===null?n():{done:!1,value:c}};return this.once("end",n),this.once(JZt,n),this.once(h20,n),{next:o,throw:n,return:n,[Symbol.iterator](){return this}}}destroy(e){if(this[h20]){if(e)this.emit("error",e);else this.emit(h20);return this}this[h20]=!0,this[bM0]=!0,this[qv0].length=0,this[Jv0]=0;let n=this;if(typeof n.close==="function"&&!this[Y4t])n.close();if(e)this.emit("error",e);else this.emit(h20);return this}static get isStream(){return CPo}}var KPo=qPo.native,Vje={lstatSync:IPo,readdir:BPo,readdirSync:MPo,readlinkSync:LPo,realpathSync:KPo,promises:{lstat:zPo,readdir:WPo,readlink:VPo,realpath:UPo}},NCi=(e)=>!e||e===Vje||e===JPo?Vje:{...Vje,...e,promises:{...Vje.promises,...e.promises||{}}},PCi=/^\\\\\?\\([a-z]:)\\?$/i,QPo=(e)=>e.replace(/\//g,"\\").replace(PCi,"$1\\"),YPo=/[\\\/]/,_U0=0,kCi=1,OCi=2,que=4,ICi=6,BCi=8,oMe=10,MCi=12,lU0=15,Wje=~lU0,QZt=16,ACi=32,Uje=64,oj0=128,G4t=256,X4t=512,wCi=Uje|oj0|X4t,ZPo=1023,YZt=(e)=>e.isFile()?BCi:e.isDirectory()?que:e.isSymbolicLink()?oMe:e.isCharacterDevice()?OCi:e.isBlockDevice()?ICi:e.isSocket()?MCi:e.isFIFO()?kCi:_U0,FCi=new Map,Qje=(e)=>{let n=FCi.get(e);if(n)return n;let o=e.normalize("NFKD");return FCi.set(e,o),o},bCi=new Map,H4t=(e)=>{let n=bCi.get(e);if(n)return n;let o=Qje(e.toLowerCase());return bCi.set(e,o),o};class RZt extends Lje{constructor(){super({max:256})}}class LCi extends Lje{constructor(e=16384){super({maxSize:e,sizeCalculation:(n)=>n.length+1})}}var qCi=Symbol("PathScurry setAsCwd");class mT0{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#i;get nlink(){return this.#i}#r;get uid(){return this.#r}#a;get gid(){return this.#a}#o;get rdev(){return this.#o}#s;get blksize(){return this.#s}#c;get ino(){return this.#c}#u;get size(){return this.#u}#p;get blocks(){return this.#p}#y;get atimeMs(){return this.#y}#g;get mtimeMs(){return this.#g}#_;get ctimeMs(){return this.#_}#D;get birthtimeMs(){return this.#D}#d;get atime(){return this.#d}#h;get mtime(){return this.#h}#E;get ctime(){return this.#E}#S;get birthtime(){return this.#S}#m;#A;#l;#v;#F;#w;#f;#T;#b;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,n=_U0,o,c,p,g,T){if(this.name=e,this.#m=p?H4t(e):Qje(e),this.#f=n&ZPo,this.nocase=p,this.roots=c,this.root=o||this,this.#T=g,this.#l=T.fullpath,this.#F=T.relative,this.#w=T.relativePosix,this.parent=T.parent,this.parent)this.#e=this.parent.#e;else this.#e=NCi(T.fs)}depth(){if(this.#A!==void 0)return this.#A;if(!this.parent)return this.#A=0;return this.#A=this.parent.depth()+1}childrenCache(){return this.#T}resolve(e){if(!e)return this;let n=this.getRootString(e),c=e.substring(n.length).split(this.splitSep);return n?this.getRoot(n).#B(c):this.#B(c)}#B(e){let n=this;for(let o of e)n=n.child(o);return n}children(){let e=this.#T.get(this);if(e)return e;let n=Object.assign([],{provisional:0});return this.#T.set(this,n),this.#f&=~QZt,n}child(e,n){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let o=this.children(),c=this.nocase?H4t(e):Qje(e);for(let N of o)if(N.#m===c)return N;let p=this.parent?this.sep:"",g=this.#l?this.#l+p+e:void 0,T=this.newChild(e,_U0,{...n,parent:this,fullpath:g});if(!this.canReaddir())T.#f|=oj0;return o.push(T),T}relative(){if(this.isCWD)return"";if(this.#F!==void 0)return this.#F;let e=this.name,n=this.parent;if(!n)return this.#F=this.name;let o=n.relative();return o+(!o||!n.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#w!==void 0)return this.#w;let e=this.name,n=this.parent;if(!n)return this.#w=this.fullpathPosix();let o=n.relativePosix();return o+(!o||!n.parent?"":"/")+e}fullpath(){if(this.#l!==void 0)return this.#l;let e=this.name,n=this.parent;if(!n)return this.#l=this.name;let c=n.fullpath()+(!n.parent?"":this.sep)+e;return this.#l=c}fullpathPosix(){if(this.#v!==void 0)return this.#v;if(this.sep==="/")return this.#v=this.fullpath();if(!this.parent){let c=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(c))return this.#v=`//?/${c}`;else return this.#v=c}let e=this.parent,n=e.fullpathPosix(),o=n+(!n||!e.parent?"":"/")+this.name;return this.#v=o}isUnknown(){return(this.#f&lU0)===_U0}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#f&lU0)===BCi}isDirectory(){return(this.#f&lU0)===que}isCharacterDevice(){return(this.#f&lU0)===OCi}isBlockDevice(){return(this.#f&lU0)===ICi}isFIFO(){return(this.#f&lU0)===kCi}isSocket(){return(this.#f&lU0)===MCi}isSymbolicLink(){return(this.#f&oMe)===oMe}lstatCached(){return this.#f&ACi?this:void 0}readlinkCached(){return this.#b}realpathCached(){return this.#C}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#b)return!0;if(!this.parent)return!1;let e=this.#f&lU0;return!(e!==_U0&&e!==oMe||this.#f&G4t||this.#f&oj0)}calledReaddir(){return!!(this.#f&QZt)}isENOENT(){return!!(this.#f&oj0)}isNamed(e){return!this.nocase?this.#m===Qje(e):this.#m===H4t(e)}async readlink(){let e=this.#b;if(e)return e;if(!this.canReadlink())return;if(!this.parent)return;try{let n=await this.#e.promises.readlink(this.fullpath()),o=(await this.parent.realpath())?.resolve(n);if(o)return this.#b=o}catch(n){this.#q(n.code);return}}readlinkSync(){let e=this.#b;if(e)return e;if(!this.canReadlink())return;if(!this.parent)return;try{let n=this.#e.readlinkSync(this.fullpath()),o=this.parent.realpathSync()?.resolve(n);if(o)return this.#b=o}catch(n){this.#q(n.code);return}}#M(e){this.#f|=QZt;for(let n=e.provisional;n<e.length;n++){let o=e[n];if(o)o.#N()}}#N(){if(this.#f&oj0)return;this.#f=(this.#f|oj0)&Wje,this.#P()}#P(){let e=this.children();e.provisional=0;for(let n of e)n.#N()}#L(){this.#f|=X4t,this.#k()}#k(){if(this.#f&Uje)return;let e=this.#f;if((e&lU0)===que)e&=Wje;this.#f=e|Uje,this.#P()}#I(e=""){if(e==="ENOTDIR"||e==="EPERM")this.#k();else if(e==="ENOENT")this.#N();else this.children().provisional=0}#x(e=""){if(e==="ENOTDIR")this.parent.#k();else if(e==="ENOENT")this.#N()}#q(e=""){let n=this.#f;if(n|=G4t,e==="ENOENT")n|=oj0;if(e==="EINVAL"||e==="UNKNOWN")n&=Wje;if(this.#f=n,e==="ENOTDIR"&&this.parent)this.parent.#k()}#O(e,n){return this.#U(e,n)||this.#V(e,n)}#V(e,n){let o=YZt(e),c=this.newChild(e.name,o,{parent:this}),p=c.#f&lU0;if(p!==que&&p!==oMe&&p!==_U0)c.#f|=Uje;return n.unshift(c),n.provisional++,c}#U(e,n){for(let o=n.provisional;o<n.length;o++){let c=n[o];if((this.nocase?H4t(e.name):Qje(e.name))!==c.#m)continue;return this.#Q(e,c,o,n)}}#Q(e,n,o,c){let p=n.name;if(n.#f=n.#f&Wje|YZt(e),p!==e.name)n.name=e.name;if(o!==c.provisional){if(o===c.length-1)c.pop();else c.splice(o,1);c.unshift(n)}return c.provisional++,n}async lstat(){if((this.#f&oj0)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#x(e.code)}}lstatSync(){if((this.#f&oj0)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#x(e.code)}}#W(e){let{atime:n,atimeMs:o,birthtime:c,birthtimeMs:p,blksize:g,blocks:T,ctime:N,ctimeMs:I,dev:q,gid:W,ino:G,mode:R,mtime:X,mtimeMs:l0,nlink:g0,rdev:D0,size:k0,uid:F0}=e;this.#d=n,this.#y=o,this.#S=c,this.#D=p,this.#s=g,this.#p=T,this.#E=N,this.#_=I,this.#t=q,this.#a=W,this.#c=G,this.#n=R,this.#h=X,this.#g=l0,this.#i=g0,this.#o=D0,this.#u=k0,this.#r=F0;let V0=YZt(e);if(this.#f=this.#f&Wje|V0|ACi,V0!==_U0&&V0!==que&&V0!==oMe)this.#f|=Uje}#K=[];#z=!1;#Y(e){this.#z=!1;let n=this.#K.slice();this.#K.length=0,n.forEach((o)=>o(null,e))}readdirCB(e,n=!1){if(!this.canReaddir()){if(n)e(null,[]);else queueMicrotask(()=>e(null,[]));return}let o=this.children();if(this.calledReaddir()){let p=o.slice(0,o.provisional);if(n)e(null,p);else queueMicrotask(()=>e(null,p));return}if(this.#K.push(e),this.#z)return;this.#z=!0;let c=this.fullpath();this.#e.readdir(c,{withFileTypes:!0},(p,g)=>{if(p)this.#I(p.code),o.provisional=0;else{for(let T of g)this.#O(T,o);this.#M(o)}this.#Y(o.slice(0,o.provisional));return})}#J;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let n=this.fullpath();if(this.#J)await this.#J;else{let o=()=>{};this.#J=new Promise((c)=>o=c);try{for(let c of await this.#e.promises.readdir(n,{withFileTypes:!0}))this.#O(c,e);this.#M(e)}catch(c){this.#I(c.code),e.provisional=0}this.#J=void 0,o()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let n=this.fullpath();try{for(let o of this.#e.readdirSync(n,{withFileTypes:!0}))this.#O(o,e);this.#M(e)}catch(o){this.#I(o.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#f&wCi)return!1;let e=lU0&this.#f;if(!(e===_U0||e===que||e===oMe))return!1;return!0}shouldWalk(e,n){return(this.#f&que)===que&&!(this.#f&wCi)&&!e.has(this)&&(!n||n(this))}async realpath(){if(this.#C)return this.#C;if((X4t|G4t|oj0)&this.#f)return;try{let e=await this.#e.promises.realpath(this.fullpath());return this.#C=this.resolve(e)}catch(e){this.#L()}}realpathSync(){if(this.#C)return this.#C;if((X4t|G4t|oj0)&this.#f)return;try{let e=this.#e.realpathSync(this.fullpath());return this.#C=this.resolve(e)}catch(e){this.#L()}}[qCi](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let n=new Set([]),o=[],c=this;while(c&&c.parent)n.add(c),c.#F=o.join(this.sep),c.#w=o.join("/"),c=c.parent,o.push("..");c=e;while(c&&c.parent&&!n.has(c))c.#F=void 0,c.#w=void 0,c=c.parent}}class j4t extends mT0{sep="\\";splitSep=YPo;constructor(e,n=_U0,o,c,p,g,T){super(e,n,o,c,p,g,T)}newChild(e,n=_U0,o={}){return new j4t(e,n,this.root,this.roots,this.nocase,this.childrenCache(),o)}getRootString(e){return ZZt.parse(e).root}getRoot(e){if(e=QPo(e.toUpperCase()),e===this.root.name)return this.root;for(let[n,o]of Object.entries(this.roots))if(this.sameRoot(e,n))return this.roots[e]=o;return this.roots[e]=new Yje(e,this).root}sameRoot(e,n=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(PCi,"$1\\"),e===n}}class e3t extends mT0{splitSep="/";sep="/";constructor(e,n=_U0,o,c,p,g,T){super(e,n,o,c,p,g,T)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,n=_U0,o={}){return new e3t(e,n,this.root,this.roots,this.nocase,this.childrenCache(),o)}}class $Zt{root;rootPath;roots;cwd;#e;#t;#n;nocase;#i;constructor(e=process.cwd(),n,o,{nocase:c,childrenCacheSize:p=16384,fs:g=Vje}={}){if(this.#i=NCi(g),e instanceof URL||e.startsWith("file://"))e=OPo(e);let T=n.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(T),this.#e=new RZt,this.#t=new RZt,this.#n=new LCi(p);let N=T.substring(this.rootPath.length).split(o);if(N.length===1&&!N[0])N.pop();if(c===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=c,this.root=this.newRoot(this.#i),this.roots[this.rootPath]=this.root;let I=this.root,q=N.length-1,W=n.sep,G=this.rootPath,R=!1;for(let X of N){let l0=q--;I=I.child(X,{relative:new Array(l0).fill("..").join(W),relativePosix:new Array(l0).fill("..").join("/"),fullpath:G+=(R?"":W)+X}),R=!0}this.cwd=I}depth(e=this.cwd){if(typeof e==="string")e=this.cwd.resolve(e);return e.depth()}childrenCache(){return this.#n}resolve(...e){let n="";for(let p=e.length-1;p>=0;p--){let g=e[p];if(!g||g===".")continue;if(n=n?`${g}/${n}`:g,this.isAbsolute(g))break}let o=this.#e.get(n);if(o!==void 0)return o;let c=this.cwd.resolve(n).fullpath();return this.#e.set(n,c),c}resolvePosix(...e){let n="";for(let p=e.length-1;p>=0;p--){let g=e[p];if(!g||g===".")continue;if(n=n?`${g}/${n}`:g,this.isAbsolute(g))break}let o=this.#t.get(n);if(o!==void 0)return o;let c=this.cwd.resolve(n).fullpathPosix();return this.#t.set(n,c),c}relative(e=this.cwd){if(typeof e==="string")e=this.cwd.resolve(e);return e.relative()}relativePosix(e=this.cwd){if(typeof e==="string")e=this.cwd.resolve(e);return e.relativePosix()}basename(e=this.cwd){if(typeof e==="string")e=this.cwd.resolve(e);return e.name}dirname(e=this.cwd){if(typeof e==="string")e=this.cwd.resolve(e);return(e.parent||e).fullpath()}async readdir(e=this.cwd,n={withFileTypes:!0}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;let{withFileTypes:o}=n;if(!e.canReaddir())return[];else{let c=await e.readdir();return o?c:c.map((p)=>p.name)}}readdirSync(e=this.cwd,n={withFileTypes:!0}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;let{withFileTypes:o=!0}=n;if(!e.canReaddir())return[];else if(o)return e.readdirSync();else return e.readdirSync().map((c)=>c.name)}async lstat(e=this.cwd){if(typeof e==="string")e=this.cwd.resolve(e);return e.lstat()}lstatSync(e=this.cwd){if(typeof e==="string")e=this.cwd.resolve(e);return e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e.withFileTypes,e=this.cwd;let o=await e.readlink();return n?o:o?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e.withFileTypes,e=this.cwd;let o=e.readlinkSync();return n?o:o?.fullpath()}async realpath(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e.withFileTypes,e=this.cwd;let o=await e.realpath();return n?o:o?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:n}={withFileTypes:!1}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e.withFileTypes,e=this.cwd;let o=e.realpathSync();return n?o:o?.fullpath()}async walk(e=this.cwd,n={}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;let{withFileTypes:o=!0,follow:c=!1,filter:p,walkFilter:g}=n,T=[];if(!p||p(e))T.push(o?e:e.fullpath());let N=new Set,I=(W,G)=>{N.add(W),W.readdirCB((R,X)=>{if(R)return G(R);let l0=X.length;if(!l0)return G();let g0=()=>{if(--l0===0)G()};for(let D0 of X){if(!p||p(D0))T.push(o?D0:D0.fullpath());if(c&&D0.isSymbolicLink())D0.realpath().then((k0)=>k0?.isUnknown()?k0.lstat():k0).then((k0)=>k0?.shouldWalk(N,g)?I(k0,g0):g0());else if(D0.shouldWalk(N,g))I(D0,g0);else g0()}},!0)},q=e;return new Promise((W,G)=>{I(q,(R)=>{if(R)return G(R);W(T)})})}walkSync(e=this.cwd,n={}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;let{withFileTypes:o=!0,follow:c=!1,filter:p,walkFilter:g}=n,T=[];if(!p||p(e))T.push(o?e:e.fullpath());let N=new Set([e]);for(let I of N){let q=I.readdirSync();for(let W of q){if(!p||p(W))T.push(o?W:W.fullpath());let G=W;if(W.isSymbolicLink()){if(!(c&&(G=W.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(N,g))N.add(G)}}return T}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,n={}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;return this.stream(e,n)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,n={}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;let{withFileTypes:o=!0,follow:c=!1,filter:p,walkFilter:g}=n;if(!p||p(e))yield o?e:e.fullpath();let T=new Set([e]);for(let N of T){let I=N.readdirSync();for(let q of I){if(!p||p(q))yield o?q:q.fullpath();let W=q;if(q.isSymbolicLink()){if(!(c&&(W=q.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(T,g))T.add(W)}}}stream(e=this.cwd,n={}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;let{withFileTypes:o=!0,follow:c=!1,filter:p,walkFilter:g}=n,T=new aMe({objectMode:!0});if(!p||p(e))T.write(o?e:e.fullpath());let N=new Set,I=[e],q=0,W=()=>{let G=!1;while(!G){let R=I.shift();if(!R){if(q===0)T.end();return}q++,N.add(R);let X=(g0,D0,k0=!1)=>{if(g0)return T.emit("error",g0);if(c&&!k0){let F0=[];for(let V0 of D0)if(V0.isSymbolicLink())F0.push(V0.realpath().then((Q0)=>Q0?.isUnknown()?Q0.lstat():Q0));if(F0.length){Promise.all(F0).then(()=>X(null,D0,!0));return}}for(let F0 of D0)if(F0&&(!p||p(F0))){if(!T.write(o?F0:F0.fullpath()))G=!0}q--;for(let F0 of D0){let V0=F0.realpathCached()||F0;if(V0.shouldWalk(N,g))I.push(V0)}if(G&&!T.flowing)T.once("drain",W);else if(!l0)W()},l0=!0;R.readdirCB(X,!0),l0=!1}};return W(),T}streamSync(e=this.cwd,n={}){if(typeof e==="string")e=this.cwd.resolve(e);else if(!(e instanceof mT0))n=e,e=this.cwd;let{withFileTypes:o=!0,follow:c=!1,filter:p,walkFilter:g}=n,T=new aMe({objectMode:!0}),N=new Set;if(!p||p(e))T.write(o?e:e.fullpath());let I=[e],q=0,W=()=>{let G=!1;while(!G){let R=I.shift();if(!R){if(q===0)T.end();return}q++,N.add(R);let X=R.readdirSync();for(let l0 of X)if(!p||p(l0)){if(!T.write(o?l0:l0.fullpath()))G=!0}q--;for(let l0 of X){let g0=l0;if(l0.isSymbolicLink()){if(!(c&&(g0=l0.realpathSync())))continue;if(g0.isUnknown())g0.lstatSync()}if(g0.shouldWalk(N,g))I.push(g0)}}if(G&&!T.flowing)T.once("drain",W)};return W(),T}chdir(e=this.cwd){let n=this.cwd;this.cwd=typeof e==="string"?this.cwd.resolve(e):e,this.cwd[qCi](n)}}class Yje extends $Zt{sep="\\";constructor(e=process.cwd(),n={}){let{nocase:o=!0}=n;super(e,ZZt,"\\",{...n,nocase:o});this.nocase=o;for(let c=this.cwd;c;c=c.parent)c.nocase=this.nocase}parseRootPath(e){return ZZt.parse(e).root.toUpperCase()}newRoot(e){return new j4t(this.rootPath,que,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}}class Zje extends $Zt{sep="/";constructor(e=process.cwd(),n={}){let{nocase:o=!1}=n;super(e,kPo,"/",{...n,nocase:o});this.nocase=o}parseRootPath(e){return"/"}newRoot(e){return new e3t(this.rootPath,que,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}}class t3t extends Zje{constructor(e=process.cwd(),n={}){let{nocase:o=!0}=n;super(e,{...n,nocase:o})}}var Q1s=process.platform==="win32"?j4t:e3t,JCi=process.platform==="win32"?Yje:process.platform==="darwin"?t3t:Zje;var RPo=(e)=>e.length>=1,$Po=(e)=>e.length>=1;class LWe{#e;#t;#n;length;#i;#r;#a;#o;#s;#c;#u=!0;constructor(e,n,o,c){if(!RPo(e))throw new TypeError("empty pattern list");if(!$Po(n))throw new TypeError("empty glob list");if(n.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,o<0||o>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#t=n,this.#n=o,this.#i=c,this.#n===0){if(this.isUNC()){let[p,g,T,N,...I]=this.#e,[q,W,G,R,...X]=this.#t;if(I[0]==="")I.shift(),X.shift();let l0=[p,g,T,N,""].join("/"),g0=[q,W,G,R,""].join("/");this.#e=[l0,...I],this.#t=[g0,...X],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[p,...g]=this.#e,[T,...N]=this.#t;if(g[0]==="")g.shift(),N.shift();let I=p+"/",q=T+"/";this.#e=[I,...g],this.#t=[q,...N],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]==="string"}isGlobstar(){return this.#e[this.#n]===Dh0}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){if(this.#r!==void 0)return this.#r;if(!this.hasMore())return this.#r=null;return this.#r=new LWe(this.#e,this.#t,this.#n+1,this.#i),this.#r.#c=this.#c,this.#r.#s=this.#s,this.#r.#o=this.#o,this.#r}isUNC(){let e=this.#e;return this.#s!==void 0?this.#s:this.#s=this.#i==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]==="string"&&!!e[2]&&typeof e[3]==="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#o!==void 0?this.#o:this.#o=this.#i==="win32"&&this.#n===0&&this.length>1&&typeof e[0]==="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e==="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#u)}markFollowGlobstar(){if(this.#n===0||!this.isGlobstar()||!this.#u)return!1;return this.#u=!1,!0}}var GPo=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Rje{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:n,nocase:o,noext:c,noglobstar:p,platform:g=GPo}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=g,this.mmopts={dot:!0,nobrace:n,nocase:o,noext:c,noglobstar:p,optimizationLevel:2,platform:g,nocomment:!0,nonegate:!0};for(let T of e)this.add(T)}add(e){let n=new fU0(e,this.mmopts);for(let o=0;o<n.set.length;o++){let c=n.set[o],p=n.globParts[o];if(!c||!p)throw new Error("invalid pattern object");while(c[0]==="."&&p[0]===".")c.shift(),p.shift();let g=new LWe(c,p,0,this.platform),T=new fU0(g.globString(),this.mmopts),N=p[p.length-1]==="**",I=g.isAbsolute();if(I)this.absolute.push(T);else this.relative.push(T);if(N)if(I)this.absoluteChildren.push(T);else this.relativeChildren.push(T)}}ignored(e){let n=e.fullpath(),o=`${n}/`,c=e.relative()||".",p=`${c}/`;for(let g of this.relative)if(g.match(c)||g.match(p))return!0;for(let g of this.absolute)if(g.match(n)||g.match(o))return!0;return!1}childrenIgnored(e){let n=e.fullpath()+"/",o=(e.relative()||".")+"/";for(let c of this.relativeChildren)if(c.match(o))return!0;for(let c of this.absoluteChildren)if(c.match(n))return!0;return!1}}class GZt{store;constructor(e=new Map){this.store=e}copy(){return new GZt(new Map(this.store))}hasWalked(e,n){return this.store.get(e.fullpath())?.has(n.globString())}storeWalked(e,n){let o=e.fullpath(),c=this.store.get(o);if(c)c.add(n.globString());else this.store.set(o,new Set([n.globString()]))}}class KCi{store=new Map;add(e,n,o){let c=(n?2:0)|(o?1:0),p=this.store.get(e);this.store.set(e,p===void 0?c:c&p)}entries(){return[...this.store.entries()].map(([e,n])=>[e,!!(n&2),!!(n&1)])}}class zCi{store=new Map;add(e,n){if(!e.canReaddir())return;let o=this.store.get(e);if(o){if(!o.find((c)=>c.globString()===n.globString()))o.push(n)}else this.store.set(e,[n])}get(e){let n=this.store.get(e);if(!n)throw new Error("attempting to walk unknown path");return n}entries(){return this.keys().map((e)=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter((e)=>e.canReaddir())}}class $je{hasWalkedCache;matches=new KCi;subwalks=new zCi;patterns;follow;dot;opts;constructor(e,n){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=n?n.copy():new GZt}processPatterns(e,n){this.patterns=n;let o=n.map((c)=>[e,c]);for(let[c,p]of o){this.hasWalkedCache.storeWalked(c,p);let g=p.root(),T=p.isAbsolute()&&this.opts.absolute!==!1;if(g){c=c.resolve(g==="/"&&this.opts.root!==void 0?this.opts.root:g);let W=p.rest();if(!W){this.matches.add(c,!0,!1);continue}else p=W}if(c.isENOENT())continue;let N,I,q=!1;while(typeof(N=p.pattern())==="string"&&(I=p.rest()))c=c.resolve(N),p=I,q=!0;if(N=p.pattern(),I=p.rest(),q){if(this.hasWalkedCache.hasWalked(c,p))continue;this.hasWalkedCache.storeWalked(c,p)}if(typeof N==="string"){let W=N===".."||N===""||N===".";this.matches.add(c.resolve(N),T,W);continue}else if(N===Dh0){if(!c.isSymbolicLink()||this.follow||p.checkFollowGlobstar())this.subwalks.add(c,p);let W=I?.pattern(),G=I?.rest();if(!I||(W===""||W===".")&&!G)this.matches.add(c,T,W===""||W===".");else if(W===".."){let R=c.parent||c;if(!G)this.matches.add(R,T,!0);else if(!this.hasWalkedCache.hasWalked(R,G))this.subwalks.add(R,G)}}else if(N instanceof RegExp)this.subwalks.add(c,p)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new $je(this.opts,this.hasWalkedCache)}filterEntries(e,n){let o=this.subwalks.get(e),c=this.child();for(let p of n)for(let g of o){let T=g.isAbsolute(),N=g.pattern(),I=g.rest();if(N===Dh0)c.testGlobstar(p,g,I,T);else if(N instanceof RegExp)c.testRegExp(p,N,I,T);else c.testString(p,N,I,T)}return c}testGlobstar(e,n,o,c){if(this.dot||!e.name.startsWith(".")){if(!n.hasMore())this.matches.add(e,c,!1);if(e.canReaddir()){if(this.follow||!e.isSymbolicLink())this.subwalks.add(e,n);else if(e.isSymbolicLink()){if(o&&n.checkFollowGlobstar())this.subwalks.add(e,o);else if(n.markFollowGlobstar())this.subwalks.add(e,n)}}}if(o){let p=o.pattern();if(typeof p==="string"&&p!==".."&&p!==""&&p!==".")this.testString(e,p,o.rest(),c);else if(p===".."){let g=e.parent||e;this.subwalks.add(g,o)}else if(p instanceof RegExp)this.testRegExp(e,p,o.rest(),c)}}testRegExp(e,n,o,c){if(!n.test(e.name))return;if(!o)this.matches.add(e,c,!1);else this.subwalks.add(e,o)}testString(e,n,o,c){if(!e.isNamed(n))return;if(!o)this.matches.add(e,c,!1);else this.subwalks.add(e,o)}}var HPo=(e,n)=>typeof e==="string"?new Rje([e],n):Array.isArray(e)?new Rje(e,n):e;class HZt{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,n,o){if(this.patterns=e,this.path=n,this.opts=o,this.#n=!o.posix&&o.platform==="win32"?"\\":"/",this.includeChildMatches=o.includeChildMatches!==!1,o.ignore||!this.includeChildMatches){if(this.#t=HPo(o.ignore??[],o),!this.includeChildMatches&&typeof this.#t.add!=="function")throw new Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=o.maxDepth||1/0,o.signal)this.signal=o.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0})}#i(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#r(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e=void 0;while(!this.paused&&(e=this.#e.shift()))e()}onResume(e){if(this.signal?.aborted)return;if(!this.paused)e();else this.#e.push(e)}async matchCheck(e,n){if(n&&this.opts.nodir)return;let o;if(this.opts.realpath){if(o=e.realpathCached()||await e.realpath(),!o)return;e=o}let p=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&p?.isSymbolicLink()){let g=await p.realpath();if(g&&(g.isUnknown()||this.opts.stat))await g.lstat()}return this.matchCheckTest(p,n)}matchCheckTest(e,n){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!n||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#i(e)?e:void 0}matchCheckSync(e,n){if(n&&this.opts.nodir)return;let o;if(this.opts.realpath){if(o=e.realpathCached()||e.realpathSync(),!o)return;e=o}let p=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&p?.isSymbolicLink()){let g=p.realpathSync();if(g&&(g?.isUnknown()||this.opts.stat))g.lstatSync()}return this.matchCheckTest(p,n)}matchFinish(e,n){if(this.#i(e))return;if(!this.includeChildMatches&&this.#t?.add){let p=`${e.relativePosix()}/**`;this.#t.add(p)}let o=this.opts.absolute===void 0?n:this.opts.absolute;this.seen.add(e);let c=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(o){let p=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(p+c)}else{let p=this.opts.posix?e.relativePosix():e.relative(),g=this.opts.dotRelative&&!p.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(!p?"."+c:g+p+c)}}async match(e,n,o){let c=await this.matchCheck(e,o);if(c)this.matchFinish(c,n)}matchSync(e,n,o){let c=this.matchCheckSync(e,o);if(c)this.matchFinish(c,n)}walkCB(e,n,o){if(this.signal?.aborted)o();this.walkCB2(e,n,new $je(this.opts),o)}walkCB2(e,n,o,c){if(this.#r(e))return c();if(this.signal?.aborted)c();if(this.paused){this.onResume(()=>this.walkCB2(e,n,o,c));return}o.processPatterns(e,n);let p=1,g=()=>{if(--p===0)c()};for(let[T,N,I]of o.matches.entries()){if(this.#i(T))continue;p++,this.match(T,N,I).then(()=>g())}for(let T of o.subwalkTargets()){if(this.maxDepth!==1/0&&T.depth()>=this.maxDepth)continue;p++;let N=T.readdirCached();if(T.calledReaddir())this.walkCB3(T,N,o,g);else T.readdirCB((I,q)=>this.walkCB3(T,q,o,g),!0)}g()}walkCB3(e,n,o,c){o=o.filterEntries(e,n);let p=1,g=()=>{if(--p===0)c()};for(let[T,N,I]of o.matches.entries()){if(this.#i(T))continue;p++,this.match(T,N,I).then(()=>g())}for(let[T,N]of o.subwalks.entries())p++,this.walkCB2(T,N,o.child(),g);g()}walkCBSync(e,n,o){if(this.signal?.aborted)o();this.walkCB2Sync(e,n,new $je(this.opts),o)}walkCB2Sync(e,n,o,c){if(this.#r(e))return c();if(this.signal?.aborted)c();if(this.paused){this.onResume(()=>this.walkCB2Sync(e,n,o,c));return}o.processPatterns(e,n);let p=1,g=()=>{if(--p===0)c()};for(let[T,N,I]of o.matches.entries()){if(this.#i(T))continue;this.matchSync(T,N,I)}for(let T of o.subwalkTargets()){if(this.maxDepth!==1/0&&T.depth()>=this.maxDepth)continue;p++;let N=T.readdirSync();this.walkCB3Sync(T,N,o,g)}g()}walkCB3Sync(e,n,o,c){o=o.filterEntries(e,n);let p=1,g=()=>{if(--p===0)c()};for(let[T,N,I]of o.matches.entries()){if(this.#i(T))continue;this.matchSync(T,N,I)}for(let[T,N]of o.subwalks.entries())p++,this.walkCB2Sync(T,N,o.child(),g);g()}}class n3t extends HZt{matches=new Set;constructor(e,n,o){super(e,n,o)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((e,n)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)n(this.signal.reason);else e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class i3t extends HZt{results;constructor(e,n,o){super(e,n,o);this.results=new aMe({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){if(this.results.write(e),!this.results.flowing)this.pause()}stream(){let e=this.path;if(e.isUnknown())e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())});else this.walkCB(e,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var jPo=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class Jue{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,n){if(!n)throw new TypeError("glob options required");if(this.withFileTypes=!!n.withFileTypes,this.signal=n.signal,this.follow=!!n.follow,this.dot=!!n.dot,this.dotRelative=!!n.dotRelative,this.nodir=!!n.nodir,this.mark=!!n.mark,!n.cwd)this.cwd="";else if(n.cwd instanceof URL||n.cwd.startsWith("file://"))n.cwd=XPo(n.cwd);if(this.cwd=n.cwd||"",this.root=n.root,this.magicalBraces=!!n.magicalBraces,this.nobrace=!!n.nobrace,this.noext=!!n.noext,this.realpath=!!n.realpath,this.absolute=n.absolute,this.includeChildMatches=n.includeChildMatches!==!1,this.noglobstar=!!n.noglobstar,this.matchBase=!!n.matchBase,this.maxDepth=typeof n.maxDepth==="number"?n.maxDepth:1/0,this.stat=!!n.stat,this.ignore=n.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e==="string")e=[e];if(this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape)e=e.map((N)=>N.replace(/\\/g,"/"));if(this.matchBase){if(n.noglobstar)throw new TypeError("base matching requires globstar");e=e.map((N)=>N.includes("/")?N:`./**/${N}`)}if(this.pattern=e,this.platform=n.platform||jPo,this.opts={...n,platform:this.platform},n.scurry){if(this.scurry=n.scurry,n.nocase!==void 0&&n.nocase!==n.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let N=n.platform==="win32"?Yje:n.platform==="darwin"?t3t:n.platform?Zje:JCi;this.scurry=new N(this.cwd,{nocase:n.nocase,fs:n.fs})}this.nocase=this.scurry.nocase;let o=this.platform==="darwin"||this.platform==="win32",c={...n,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:o,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},p=this.pattern.map((N)=>new fU0(N,c)),[g,T]=p.reduce((N,I)=>{return N[0].push(...I.set),N[1].push(...I.globParts),N},[[],[]]);this.patterns=g.map((N,I)=>{let q=T[I];if(!q)throw new Error("invalid pattern object");return new LWe(N,q,0,this.platform)})}async walk(){return[...await new n3t(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new n3t(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new i3t(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new i3t(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var XZt=(e,n={})=>{if(!Array.isArray(e))e=[e];for(let o of e)if(new fU0(o,n).hasMagic())return!0;return!1};function a3t(e,n={}){return new Jue(e,n).streamSync()}function VCi(e,n={}){return new Jue(e,n).stream()}function UCi(e,n={}){return new Jue(e,n).walkSync()}async function WCi(e,n={}){return new Jue(e,n).walk()}function o3t(e,n={}){return new Jue(e,n).iterateSync()}function QCi(e,n={}){return new Jue(e,n).iterate()}var eko=a3t,tko=Object.assign(VCi,{sync:a3t}),nko=o3t,iko=Object.assign(QCi,{sync:o3t}),rko=Object.assign(UCi,{stream:a3t,iterate:o3t}),r3t=Object.assign(WCi,{glob:WCi,globSync:UCi,sync:rko,globStream:VCi,stream:tko,globStreamSync:a3t,streamSync:eko,globIterate:QCi,iterate:iko,globIterateSync:o3t,iterateSync:nko,Glob:Jue,hasMagic:XZt,escape:kWe,unescape:rj0});r3t.glob=r3t;import{promises as YCi}from"fs";import*as uMe from"path";var qWe=/^[a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9]$/,u3t=async(e)=>{return await r3t("**/*.ts",{ignore:["**/node_modules/**"],cwd:uMe.dirname(e)})},s3t=async(e,n)=>{await Promise.all(n.map(async(o)=>{let c=await ZCi.default.format(await YCi.readFile(uMe.resolve(uMe.dirname(e),o),"utf-8"),{parser:"typescript"});await YCi.writeFile(uMe.resolve(uMe.dirname(e),o),c)}))};var KMe=Qm(zE(),1);var djt=Qm(gIt(),1);import _jt,{extname as $7u}from"path";var wvt=Qm(Mki(),1);var jki=Qm(hIt(),1),eOi=Qm(Xki(),1),JZo={default:"defaultValue",public:"isPublic",protected:"isProtected",private:"isPrivate",interface:"anInterface",context:"ctx",data:"aData",case:"aCase"},hj0=(e)=>JZo[e]??oU(e.replace(/^([0-9])(.+)?$/,(n,o,c="")=>`${eOi.toWords(o)}${c}`)),Eh0=(e)=>Object.entries(e??{}).reduce((n,[o,c])=>{if(typeof c==="undefined")return n;return{...n,[o]:c}},{}),NEe=(e)=>{if(!e)return"";let n=jki.default(e),[o]=n.split(`
|
|
64895
64895
|
`).filter((p)=>p.trim()!==""),[c]=o.split(/[.!?]/g);return uVe(c)},uVe=(e)=>{if(!e)return"";return`${e}`.replace(/"/g,"\\\"")};var PEe={string:{type:"string",cleanFn:"toString",cleanReturnType:"string",allowOptional:!0},integer:{type:"string",cleanFn:"toNumber",cleanReturnType:"number",allowOptional:!0},number:{type:"string",cleanFn:"toNumber",cleanReturnType:"number",allowOptional:!0},boolean:{type:"boolean",cleanFn:"toBool",cleanReturnType:"boolean",allowOptional:!1}},tOi=(e)=>{if(e?.type==="boolean")return;let n="items"in e&&e.items&&"enum"in e.items?e.items.enum:void 0;if(e?.enum||n)return(e?.enum||n||[]).map((o)=>({label:ib0(o),value:o}));if(e?.allOf?.[0]&&!("$ref"in e?.allOf?.[0]))return(e?.allOf?.[0]?.enum??[]).map((o)=>({label:ib0(o),value:o}));return},sGt=(e,n)=>{if("$ref"in e)throw new Error("$ref nodes are not supported.");let o=e.schema?.type,{type:c,cleanFn:p,cleanReturnType:g,allowOptional:T}=PEe[o]??PEe.string,N=e.required||!T,I=N?`(value): ${g} => util.types.${p}(value)`:`(value): ${g} | undefined => value !== undefined && value !== null ? util.types.${p}(value) : undefined`,{name:q}=e,W=n.has(hj0(q))?hj0(`other ${q}`):hj0(q);return n.add(W),Eh0({upstreamKey:q,key:W,label:ib0(q),type:c,required:N,comments:e.description,default:e.schema?.default,example:e.schema?.example,model:tOi(e.schema),clean:I})},KZo=(e)=>{return bye(e.properties??{},...(e.allOf??[]).map((n)=>n.properties))},zZo=(e,n)=>{let o=new Set(e.required??[]),c=KZo(e);return Object.entries(c).filter(([,p])=>!p.readOnly).map(([p,g])=>{let T=g?.type,N;if(T==="array")N=WZo(g);else N=PEe[T]??PEe.string;let{type:I,cleanFn:q,cleanReturnType:W,allowOptional:G,collection:R}=N,X=o.has(p)||!G,l0;if(T==="array")l0=`(values) => ((values as unknown[]) || []).map((value) => util.types.${q}(value))`;else l0=X?`(value): ${W} => util.types.${q}(value)`:`(value): ${W} | undefined => value !== undefined && value !== null ? util.types.${q}(value) : undefined`;let g0=n.has(hj0(p))?hj0(`other ${p}`):hj0(p);return n.add(g0),Eh0({upstreamKey:p,key:g0,label:ib0(p),type:I,collection:R,required:X,comments:g.description,default:g.default,example:g.example,model:tOi(g),clean:l0})})},nOi=(e,n=[])=>{if(typeof e.requestBody!=="undefined"&&"$ref"in e.requestBody)throw new Error("All refs should be resolved before computing Inputs.");let o=new Set(["connection"]),c=Object.values([...n,...e.parameters??[]].reduce((q,W)=>{if("$ref"in W)return q;return{...q,[W.name]:W}},{})),p=(c??[]).filter((q)=>q.in==="header").map((q)=>sGt(q,o)),g=(c??[]).filter((q)=>q.in==="path").map((q)=>sGt(q,o)),T=(c??[]).filter((q)=>q.in==="query").map((q)=>sGt(q,o)),N=e.requestBody?.content?.["application/json"]?.schema;if(typeof N!=="undefined"&&"$ref"in N)throw new Error("All refs should be resolved before computing Inputs.");let I=N===void 0?[]:zZo(N,o);return{headerInputs:p,pathInputs:g,queryInputs:T,bodyInputs:I,payloadContentType:"application/json"}},WZo=(e)=>{let{items:n}=e;if("type"in n)if(n.type==="object")return{type:"code",language:"json",cleanFn:"toObject"};else{let o=n.type;return{type:o,collection:"valuelist",required:"minimum"in n&&n.minimum,cleanFn:o in PEe?PEe[o].cleanFn:PEe.string.cleanFn}}else return PEe.string};var iOi=(e)=>{let o=(e.startsWith("/")?e.split("/")[1]||"root":e).replace(/^(\d)/,"a$1");return oU(o)};var VZo=(e,n,o,c,p,g)=>{let T=[...o,...c,...p,...g].map(({key:R})=>R).join(", "),N=o.map(({key:R,upstreamKey:X})=>R===X?R:`"${X}": ${R}`).join(", "),I=c.reduce((R,{key:X,upstreamKey:l0})=>R.replace(`{${l0}}`,`{${X}}`),e).replace(/{([^}]+)}/g,(R,X)=>`\${${X}}`),q=p.map(({key:R,upstreamKey:X})=>R===X?R:`"${X}": ${R}`).join(", "),W=g.map(({key:R,upstreamKey:X})=>R===X?R:`"${X}": ${R}`),G=!Qoe(q)||!Qoe(N);return(R)=>R.writeLine(`async (context, { connection, ${T} }) => {`).blankLineIfLastNot().writeLine("const client = createClient(connection);").write("const {data} = await client.").write(n).write("(`").write(I).write("`").conditionalWrite(["post","put","patch"].includes(n),()=>`, { ${W} }`).conditionalWrite(G,()=>", { ").conditionalWrite(!Qoe(q),()=>`params: { ${q} }`).conditionalWrite(!Qoe(q)&&!Qoe(N),()=>", ").conditionalWrite(!Qoe(N),()=>`headers: { ${N} }`).conditionalWrite(G,()=>" } ").write(");").writeLine("return {data};").writeLine("}")},UZo=(e,n,o,c=[])=>{let p=hj0(o.operationId||`${n} ${e}`),{headerInputs:g,pathInputs:T,queryInputs:N,bodyInputs:I}=nOi(o,c),q=iOi(o.tags?.[0]??e),W=[...g,...T,...N,...I].reduce((R,X)=>({...R,[oU(X.key)]:X}),{});return Eh0({key:p,groupTag:q,display:{label:ib0(p),description:o.summary??o.description??"TODO: Description"},inputs:{connection:{label:"Connection",type:"connection",required:!0},...W},perform:VZo(e,n,g,T,N,I)})},QZo=new Set(["get","put","post","delete","options","head","patch","trace"]),rOi=(e,n)=>{let o=n.parameters;return Object.entries(n).filter(([c])=>QZo.has(c)).map(([c,p])=>UZo(e,c,p,o))};var cjt=Qm(Avt(),1),DVi=(e,n)=>{if("$ref"in n)throw new Error("$ref nodes are not supported.");if(n.type==="apiKey"||n.type==="http"&&n.scheme==="bearer")return[Eh0({orderPriority:50,key:oU(e),display:{label:ib0(e),description:NEe(n.description)},inputs:{apiKey:{label:ib0(n.type==="apiKey"?n.name:"Token"),type:"password",required:!0}}})];if(n.type==="http"&&n.scheme==="basic")return[Eh0({orderPriority:1000,key:oU(e),display:{label:ib0(e),description:NEe(n.description)},inputs:{username:{label:"Username",type:"string",required:!0},password:{label:"Password",type:"password",required:!0}}})];if(n.type==="oauth2"){if("authorizationCode"in n.flows){let o=n.flows.authorizationCode,c=o?.scopes&&Object.keys(o.scopes).length>0;return[Eh0({orderPriority:0,key:oU(e),display:{label:"OAuth 2.0",description:""},oauth2Type:cjt.OAuth2Type.AuthorizationCode,inputs:{authorizeUrl:Eh0({label:"Authorization URL",type:"string",required:!0,shown:!o?.authorizationUrl,default:o?.authorizationUrl,comments:"Authorization URL"}),tokenUrl:Eh0({label:"Token URL",type:"string",required:!0,shown:!o?.tokenUrl,default:o?.tokenUrl,comments:"Token URL"}),scopes:Eh0({label:"Scopes",type:"string",required:!0,shown:c,default:c?void 0:"",comments:"Space-delimited scopes"}),clientId:{label:"Client ID",type:"string",required:!0,shown:!0,comments:"Client identifier"},clientSecret:{label:"Client Secret",type:"password",required:!0,shown:!0,comments:"Client secret"}}})]}if("clientCredentials"in n.flows){let o=n.flows.clientCredentials,c=o?.scopes&&Object.keys(o.scopes).length>0;return[Eh0({orderPriority:10,key:oU(e),display:{label:"OAuth 2.0 Client Credentials",description:""},oauth2Type:cjt.OAuth2Type.ClientCredentials,inputs:{tokenUrl:Eh0({label:"Token URL",type:"string",required:!0,shown:!o?.tokenUrl,default:o?.tokenUrl,comments:"Token URL"}),scopes:Eh0({label:"Scopes",type:"string",required:!0,shown:c,default:c?void 0:"",comments:"Space-delimited scopes"}),clientId:{label:"Client ID",type:"string",required:!0,shown:!0,comments:"Client identifier"},clientSecret:{label:"Client Secret",type:"password",required:!0,shown:!0,comments:"Client secret"}}})]}throw new Error("Did not find supported OAuth 2.0 flow.")}throw new Error(`Security scheme '${n.type}' not supported.`)};var M7u=(e)=>{if("basePath"in e)return e?.basePath;if("servers"in e)return e?.servers?.[0]?.url;return},L7u=(e)=>{return Eh0({display:{label:e.info.title,description:e.info.description??`Generated component for ${e.info.title} ${e.info.version}`,iconPath:"icon.png"}})},yVi=async(e)=>{let n=await wvt.dereference.bind(wvt.default)(e),o=L7u(n),c=Object.entries(n.paths??{}).reduce((T,[N,I])=>[...T,...rOi(N,I)],[]),p="components"in n?Object.entries(n.components?.securitySchemes??{}).reduce((T,[N,I])=>[...T,...DVi(N,I)],[]):[],g=M7u(n);if(!g)throw new Error("Failed to identify base path of API.");return{baseUrl:g,component:o,actions:c,connections:p}};var cet=Qm(_Ee(),1);import BVe from"path";var fjt=Qm(Avt(),1);var IVe=Qm(_Ee(),1);import q7u from"path";var J7u=(e,n,{label:o,type:c,comments:p,default:g,example:T,placeholder:N,shown:I,required:q})=>e.writeLine(`${n}: {`).writeLine(`label: "${o}",`).writeLine(`type: "${c}",`).conditionalWriteLine(q!==void 0,`required: ${q},`).conditionalWriteLine(I!==void 0,`shown: ${I},`).conditionalWriteLine(N!==void 0,`placeholder: "${N}",`).conditionalWriteLine(g!==void 0,`default: "${g}",`).conditionalWriteLine(T!==void 0,`example: "${T}",`).conditionalWriteLine(p!==void 0,`comments: "${uVe(p)}",`).writeLine("},"),K7u=({key:e,display:n,oauth2Type:o,inputs:c})=>{let{label:p,description:g,icons:T}=n,N=o===void 0?"connection":"oauth2Connection";return{kind:IVe.StructureKind.VariableDeclaration,name:e,leadingTrivia:(I)=>I.blankLine(),trailingTrivia:(I)=>I.blankLine(),initializer:(I)=>I.writeLine(`${N}({`).writeLine(`key: "${e}",`).write("display: ").block(()=>{I.writeLine(`label: "${p}",`).writeLine(`description: "${uVe(g)}",`).write("icons: ").block(()=>{I.conditionalWriteLine(T?.avatarPath!==void 0,`avatarPath: "${T?.avatarPath}",`).conditionalWriteLine(T?.oauth2ConnectionIconPath!==void 0,`oauth2ConnectionIconPath: "${T?.oauth2ConnectionIconPath}",`)})}).writeLine(",").conditionalWriteLine(o!==void 0,()=>{if(o===fjt.OAuth2Type.AuthorizationCode)return"oauth2Type: OAuth2Type.AuthorizationCode,";if(o===fjt.OAuth2Type.ClientCredentials)return"oauth2Type: OAuth2Type.ClientCredentials,";throw new Error(`Unexpected OAuth2Type: ${o}`)}).write("inputs: ").block(()=>Object.entries(c).forEach(([q,W])=>J7u(I,q,W))).writeLine("})")}},EVi=(e,n)=>{let o=e.createSourceFile(q7u.join("src","connections.ts"),void 0,{scriptKind:IVe.ScriptKind.TS}),c=[];if(n.some(({oauth2Type:I})=>I===void 0))c.push("connection");if(n.some(({oauth2Type:I})=>I!==void 0))c.push("oauth2Connection","OAuth2Type");o.addImportDeclaration({moduleSpecifier:"@prismatic-io/spectral",namedImports:c});for(let I of n)I.key=hj0(I.key);let T=Nye(n,({orderPriority:I})=>I).map(({key:I})=>I),N=n.map(K7u);return o.addVariableStatements(N.map((I)=>({declarationKind:IVe.VariableDeclarationKind.Const,declarations:[I],isExported:!0}))),o.addExportAssignment({isExportEquals:!1,expression:(I)=>I.write("[").write(T.join(", ")).write("]")}),o};import ljt from"path";var HEe=Qm(_Ee(),1);var z7u=(e,n,{label:o,type:c,collection:p,comments:g,clean:T,default:N,example:I,placeholder:q,required:W,model:G})=>e.writeLine(`${n}: input({`).writeLine(`label: "${o}",`).writeLine(`type: "${c}",`).conditionalWriteLine(W!==void 0,`required: ${W},`).conditionalWriteLine(q!==void 0,`placeholder: "${q}",`).conditionalWriteLine(N!==void 0,`default: "${N}",`).conditionalWriteLine(p!==void 0,`collection: "${p}",`).conditionalWriteLine(G!==void 0&&G.length>0,()=>{return`model: [${(G??[]).map(({label:X,value:l0})=>`{label: "${X}", value: "${l0}"}`).join(", ")}],`}).conditionalWriteLine(I!==void 0,`example: "${uVe(I)}",`).conditionalWriteLine(T!==void 0,()=>`clean: ${typeof T==="string"?T:T(e)},`).conditionalWriteLine(g!==void 0,()=>`comments: "${NEe(`${g}`)}",`).writeLine("}),"),W7u=({key:e,display:{label:n,description:o},examplePayload:c,inputs:p,perform:g})=>{let T=oU(e);return{kind:HEe.StructureKind.VariableDeclaration,name:T,leadingTrivia:(N)=>N.blankLine(),trailingTrivia:(N)=>N.blankLine(),initializer:(N)=>{if(N.writeLine("action({").write("display: ").block(()=>{N.writeLine(`label: "${n}",`).writeLine(`description: "${NEe(`${o}`)}",`)}).write(",").write("perform: "),typeof g==="string")N.write(g);else g(N);return N.write(",").write("inputs: ").block(()=>Object.entries(p).forEach(([I,q])=>z7u(N,I,q))).write(",").conditionalWriteLine(c!==void 0,`examplePayload: ${c},`).writeLine("})"),N}}},V7u=(e,n,o)=>{let c=e.createSourceFile(ljt.join("src","actions",`${n}.ts`),void 0,{scriptKind:HEe.ScriptKind.TS});c.addImportDeclarations([{moduleSpecifier:"@prismatic-io/spectral",namedImports:["action","input","util"]},{moduleSpecifier:"../client",namedImports:["createClient"]}]);let p=o.map(W7u);c.addVariableStatements(p.map((T)=>({declarationKind:HEe.VariableDeclarationKind.Const,declarations:[T],isExported:!1})));let g=p.map(({name:T})=>T);return c.addExportAssignment({isExportEquals:!1,expression:(T)=>T.block(()=>g.forEach((N)=>T.writeLine(`${N},`)))}),c},U7u=(e,n)=>{let o=e.createSourceFile(ljt.join("src","actions","index.ts"),void 0,{scriptKind:HEe.ScriptKind.TS});return o.addImportDeclarations([{moduleSpecifier:"@prismatic-io/spectral/dist/clients/http",namedImports:["buildRawRequestAction"]},{moduleSpecifier:"../client",namedImports:["baseUrl"]},...n.map((c)=>({kind:HEe.StructureKind.ImportDeclaration,moduleSpecifier:`./${c}`,defaultImport:c}))]),o.addExportAssignment({isExportEquals:!1,expression:(c)=>c.block(()=>{n.forEach((p)=>c.writeLine(`...${p},`)),c.writeLine("rawRequest: buildRawRequestAction(baseUrl),")})}),o},CVi=(e,n)=>{e.createDirectory(ljt.join("src","actions"));let o=Fbt(n,({groupTag:g})=>g),c=Object.entries(o).map(([g,T])=>V7u(e,g,T)),p=U7u(e,Object.keys(o));return[...c,p]};var Q7u=(e,n,o,{display:{label:c,description:p,iconPath:g}})=>{let T=e.createSourceFile(BVe.join("src","index.ts"),void 0,{scriptKind:cet.ScriptKind.TS});return T.addImportDeclarations([{moduleSpecifier:"@prismatic-io/spectral",namedImports:["component"]},{moduleSpecifier:"@prismatic-io/spectral/dist/clients/http",namedImports:["handleErrors"]},{moduleSpecifier:"./actions",defaultImport:"actions"},{moduleSpecifier:"./connections",defaultImport:"connections"}]),T.addExportAssignment({isExportEquals:!1,expression:(N)=>N.writeLine("component({").writeLine(`key: "${n}",`).conditionalWriteLine(o,"public: true,").conditionalWriteLine(o,`documentationUrl: "https://prismatic.io/docs/components/${n}/",`).writeLine("display: {").writeLine(`label: "${c}",`).writeLine(`description: "${NEe(p)}",`).conditionalWriteLine(o,'category: "Application Connectors",').writeLine(`iconPath: "${g}",`).writeLine("},").writeLine("hooks: { error: handleErrors },").writeLine("actions,").writeLine("connections,").writeLine("})")}),T},Y7u=(e,n,o,[{key:c,inputs:p}])=>{let T=bbt(o,({orderPriority:I})=>I)?.key;return e.createSourceFile(BVe.join("src","component.test.ts"),(I)=>I.writeLine('import { testing } from "@prismatic-io/spectral";').conditionalWriteLine(Boolean(T),`import { ${T} } from "./connections";`).writeLine('import component from ".";').blankLine().writeLine(`describe("${n}", () => {`).writeLine("const harness = testing.createHarness(component);").conditionalWriteLine(Boolean(T),`const connection = harness.connectionValue(${T});`).blankLine().writeLine('it("should invoke action", async () => {').writeLine(`const result = await harness.action("${c}", `).block(()=>{I.conditionalWriteLine(Boolean(T),"connection,"),Object.entries(p).forEach(([q,W])=>{let G=`${W.default}`??null;I.conditionalWriteLine(q!=="connection",`${q}: ${G},`)})}).writeLine(");").writeLine("expect(result?.data).toBeDefined();").writeLine("});").writeLine("});"))},Z7u=(e,n,o)=>{return e.createSourceFile(BVe.join("src","client.ts"),(p)=>p.writeLine('import { Connection, ConnectionError, util } from "@prismatic-io/spectral";').writeLine('import { HttpClient, createClient as createHttpClient } from "@prismatic-io/spectral/dist/clients/http";').writeLine(`import { ${o.map(({key:g})=>g).join(", ")} } from "./connections";`).blankLine().writeLine(`export const baseUrl = "${n}";`).blankLine().writeLine("const toAuthorizationHeaders = (connection: Connection): { Authorization: string } => {").writeLine("const accessToken = util.types.toString(connection.token?.access_token);").writeLine("if (accessToken) {").writeLine("return { Authorization: `Bearer ${accessToken}` };").writeLine("}").blankLine().writeLine("const apiKey = util.types.toString(connection.fields?.apiKey);").writeLine("if (apiKey) {").writeLine("return { Authorization: `Bearer ${apiKey}` };").writeLine("}").blankLine().writeLine("const username = util.types.toString(connection.fields?.username);").writeLine("const password = util.types.toString(connection.fields?.password);").writeLine("if (username && password) {").writeLine('const encoded = Buffer.from(`${username}:${password}`).toString("base64");').writeLine("return { Authorization: `Basic ${encoded}` };").writeLine("}").blankLine().writeLine("throw new Error(").writeLine("`Failed to guess at authorization parameters for Connection: ${connection.key}`").writeLine(");").writeLine("};").blankLine().writeLine("export const createClient = async (connection: Connection): Promise<HttpClient> => {").writeLine(`if (![${o.map(({key:g})=>`${g}.key`).join(", ")}].includes(connection.key)) {`).writeLine("throw new ConnectionError(connection, `Received unexpected connection type: ${connection.key}`);").writeLine("}").blankLine().writeLine("const client = createHttpClient({").writeLine("baseUrl,").writeLine("headers: {").writeLine("...toAuthorizationHeaders(connection),").writeLine('Accept: "application/json",').writeLine("},").writeLine('responseType: "json",').writeLine("});").writeLine("return client;").writeLine("};"),{scriptKind:cet.ScriptKind.TS})},R7u=(e,n,o)=>{e.createDirectory("documentation");let c=e.createSourceFile(BVe.join("documentation","description.mdx"),(g)=>g.writeLine(n.display.description));if(o.length>0)e.createDirectory(BVe.join("documentation","connections"));let p=o.map((g)=>e.createSourceFile(BVe.join("documentation","connections",`${g.key}.mdx`),(T)=>T.blankLine()));return[c,...p]},TVi=async(e,n,{baseUrl:o,component:c,actions:p,connections:g})=>{let T=new cet.Project;if(T.createDirectory("src"),EVi(T,g),CVi(T,p),Z7u(T,o,g),Q7u(T,e,n,c),Y7u(T,e,g,p),n)R7u(T,c,g);return await T.save(),T};class MVe extends KMe.Command{static hidden=!0;static description="Initialize a new Component from a format";static flags={name:KMe.Flags.string({char:"n",description:"Name of the component",required:!0}),icon:KMe.Flags.string({char:"i",description:"Path to png icon for the component"}),openapi:KMe.Flags.string({char:"o",description:"Path to OpenAPI file for the component",required:!0}),public:KMe.Flags.boolean({hidden:!0})};async run(){let{flags:{name:e,icon:n,openapi:o,public:c=!1}}=await this.parse(MVe),p=oU(e),g=["tsconfig.json","webpack.config.js","jest.config.js",_jt.join("assets","icon.png")];await Promise.all(g.map((N)=>E9e(_jt.join("formats",N.endsWith("icon.png")?N:`${N}.ejs`),N)));let T=await yVi(o);if(await TVi(p,c,T),await djt.copy(o,`${p}-openapi-spec${$7u(o)}`),n)await djt.copy(n,_jt.join("assets","icon.png"));this.log(`
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/prism",
|
|
3
|
-
"version": "7.3.1-rc.
|
|
3
|
+
"version": "7.3.1-rc.2",
|
|
4
4
|
"description": "Build, deploy, and support integrations in Prismatic from the comfort of your command line",
|
|
5
5
|
"keywords": ["prismatic", "cli"],
|
|
6
6
|
"homepage": "https://prismatic.io",
|