@fnet/cli 1.13.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fbin/index.js +1 -1
- package/dist/fnet/index.4gymwzqb.js +1 -0
- package/dist/fnet/index.5r21wfyc.js +1 -0
- package/dist/fnet/index.js +9 -9
- package/dist/fnet/index.kanz1359.js +2 -0
- package/dist/fnet/index.kjw4nv5z.js +1 -0
- package/dist/fnet/index.n7q2w82x.js +1 -0
- package/dist/{fnode/index.c8qd1bz3.js → fnet/index.pj3wr582.js} +1 -1
- package/dist/fnet/index.r3cben5x.js +1 -0
- package/dist/fnet/index.sbphkm7x.js +1 -0
- package/dist/{fnode/index.e6g5y0zg.js → fnet/index.wmeh7jrw.js} +1 -1
- package/dist/fnet/index.xym49mp3.js +1 -0
- package/dist/fnet/index.ydv6st7k.js +1 -0
- package/dist/fnode/index.05n3mvs9.js +2 -0
- package/dist/fnode/index.22v7wtt0.js +2 -0
- package/dist/fnode/{index.dtp0a202.js → index.3ay4fp2s.js} +1 -1
- package/dist/fnode/index.6g3j97vm.js +1 -0
- package/dist/fnode/{index.q61zqpb9.js → index.782edcjp.js} +1 -1
- package/dist/fnode/index.7cqahb2f.js +1 -0
- package/dist/fnode/index.fy1xwqp2.js +1 -0
- package/dist/fnode/index.js +2 -2
- package/dist/fnode/index.kswhzt5n.js +1 -0
- package/dist/fnode/{index.1k1sj9qs.js → index.q9ghzdn2.js} +3 -3
- package/dist/fnode/index.r4xke6yy.js +1 -0
- package/dist/fnode/index.w4cz5r8m.js +1 -0
- package/dist/fnode/index.wd23pxn8.js +1 -0
- package/dist/fnode/index.xvyybysy.js +1 -0
- package/dist/fnode/index.z9232w6h.js +1 -0
- package/dist/frun/index.js +1 -1
- package/dist/fservice/index.js +1 -1
- package/package.json +5 -9
- package/readme.md +240 -191
- package/scripts/postinstall.js +19 -4
- package/template/deploy/to-docker/aws/Dockerfile.njk +114 -0
- package/template/deploy/to-docker/aws/build.sh.njk +127 -0
- package/template/deploy/to-docker/docker/Dockerfile.njk +67 -0
- package/template/deploy/to-docker/docker/build.sh.njk +48 -0
- package/template/deploy/to-docker/gcloud/Dockerfile.njk +69 -0
- package/template/deploy/to-docker/gcloud/build.sh.njk +39 -0
- package/template/deploy/to-docker/podman/Dockerfile.njk +69 -0
- package/template/deploy/to-docker/podman/build.sh.njk +44 -0
- package/template/deploy/to-electron/mac/entitlements.plist.njk +18 -0
- package/template/deploy/to-electron/main.js.njk +37 -0
- package/template/deploy/to-electron/package.json.njk +36 -0
- package/template/deploy/to-electron/src/index.html.njk +23 -0
- package/template/deploy/to-ios-app/fnet/index.html.njk +23 -0
- package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/AppIcon.appiconset/Contents.json +112 -0
- package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/Contents.json +6 -0
- package/template/deploy/to-ios-app/fnet-ios-app/Assets.xcassets/launch-images.imageset/Contents.json +23 -0
- package/template/deploy/to-ios-app/fnet-ios-app/ContentView.swift +32 -0
- package/template/deploy/to-ios-app/fnet-ios-app/Info.plist +10 -0
- package/template/deploy/to-ios-app/fnet-ios-app/LaunchScreen.storyboard +26 -0
- package/template/deploy/to-ios-app/fnet-ios-app/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
- package/template/deploy/to-ios-app/fnet-ios-app/WebView.swift +42 -0
- package/template/deploy/to-ios-app/fnet-ios-app/fnet_ios_appApp.swift +17 -0
- package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/project.pbxproj.njk +417 -0
- package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/deploy/to-ios-app/fnet-ios-app.xcodeproj/xcshareddata/xcschemes/fnet-ios-app.xcscheme +77 -0
- package/template/deploy/to-macos-app/fnet/index.html.njk +23 -0
- package/template/deploy/to-macos-app/fnet-macos-app/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/template/deploy/to-macos-app/fnet-macos-app/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
- package/template/deploy/to-macos-app/fnet-macos-app/Assets.xcassets/Contents.json +6 -0
- package/template/deploy/to-macos-app/fnet-macos-app/ContentView.swift +13 -0
- package/template/deploy/to-macos-app/fnet-macos-app/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
- package/template/deploy/to-macos-app/fnet-macos-app/WebView.swift +30 -0
- package/template/deploy/to-macos-app/fnet-macos-app/fnet_macos_app.entitlements +16 -0
- package/template/deploy/to-macos-app/fnet-macos-app/fnet_macos_appApp.swift +17 -0
- package/template/deploy/to-macos-app/fnet-macos-app.xcodeproj/project.pbxproj.njk +396 -0
- package/template/deploy/to-macos-app/fnet-macos-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/template/deploy/to-macos-app/fnet-macos-app.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/deploy/to-nextjs/app/layout.tsx.njk +13 -0
- package/template/deploy/to-nextjs/app/page.tsx.njk +28 -0
- package/template/deploy/to-nextjs/next-env.d.ts +5 -0
- package/template/deploy/to-nextjs/package.json.njk +20 -0
- package/template/deploy/to-nextjs/tsconfig.json +34 -0
- package/template/deploy/to-pyip/package/__init__.py.njk +4 -0
- package/template/deploy/to-pyip/package/cli/__init__.py.njk +3 -0
- package/template/deploy/to-pyip/package/cli/index.py.njk +24 -0
- package/template/deploy/to-pyip/package/lib/__init__.py.njk +3 -0
- package/template/deploy/to-pyip/pyproject.toml +3 -0
- package/template/deploy/to-pyip/setup.py.njk +32 -0
- package/template/deploy/to-rust/Cargo.toml.njk +16 -0
- package/template/deploy/to-rust/src/main.rs.njk +112 -0
- package/template/deploy/to-webos/appinfo.json.njk +14 -0
- package/template/deploy/to-webos/index.html.njk +39 -0
- package/template/deploy/to-webos/webOSTVjs-1.2.10/LICENSE-2.0.txt +202 -0
- package/template/deploy/to-webos/webOSTVjs-1.2.10/webOSTV-dev.js +1 -0
- package/template/deploy/to-webos/webOSTVjs-1.2.10/webOSTV.js +1 -0
- package/dist/fnet/index.06vbpwcx.js +0 -1
- package/dist/fnet/index.26r88tdp.js +0 -1
- package/dist/fnet/index.2g93a9kt.js +0 -1
- package/dist/fnet/index.61jdafta.js +0 -1
- package/dist/fnet/index.80hh5mtp.js +0 -1
- package/dist/fnet/index.a2mbqyxe.js +0 -1
- package/dist/fnet/index.gywx3fae.js +0 -1
- package/dist/fnet/index.gza1frda.js +0 -1
- package/dist/fnet/index.r2gf0b3s.js +0 -1
- package/dist/fnet/index.rfysmk2b.js +0 -2
- package/dist/fnode/index.5f1kfz9t.js +0 -1
- package/dist/fnode/index.7ev6y63q.js +0 -1
- package/dist/fnode/index.a4q2w1yd.js +0 -1
- package/dist/fnode/index.btj5x5s4.js +0 -1
- package/dist/fnode/index.n1598ffs.js +0 -1
- package/dist/fnode/index.ng6w9cac.js +0 -1
- package/dist/fnode/index.r8s8r2n7.js +0 -2
- package/dist/fnode/index.xc08sjp4.js +0 -1
- package/dist/fnode/index.zb59076q.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import j from"node:path";import v from"node:fs";import E from"node:os";import{fileURLToPath as F}from"node:url";var G=j.dirname(F(import.meta.url)),H=process.cwd(),I=j.resolve(E.homedir(),".fnet"),J=j.dirname(process.execPath);function K(q){let z=j.resolve(H,q);if(v.existsSync(z))return z;let A=j.resolve(G,"../..",q);if(v.existsSync(A))return A;let B=j.resolve(J,"../share/fnet",q);if(v.existsSync(B))return B;let C=j.resolve(I,q);if(v.existsSync(C))return C;throw Error(`Template path not found: ${q}`)}
|
|
2
|
+
export{K as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as i}from"./index.kanz1359.js";import"./index.drbq51nw.js";import F from"@fnet/config";import o from"node:fs";import c from"@fnet/shelljs";import B from"@flownet/lib-render-templates-dir";import N from"node:path";var q=async({atom:y,params:n,config:$,src:g,dest:v})=>{if(n.name=n.name||"electron",n.entry=n.entry||"app/electron",n.id=n.id||"com.example.electron",n.version=n.version||"0.1.0",n.title=n.title||y?.doc?.title||n.name||y?.doc?.name||"Electron App",n.package_name=n.package_name||n.name,n.author=n.author||y?.doc?.author||"Flownet",n.description=n.description||y?.doc?.description||"Electron App built with Flownet",n.vendor=n.vendor||"flownet.ai",n.include_css=y?.doc?.features?.css_options?.extract===!0,n.bundle_name=y?.doc?.bundleName,n.package_dir=n.package_dir||`./.package/${n.name}`,n.package_dir=N.resolve(v,n.package_dir),o.existsSync(n.package_dir))o.rmSync(n.package_dir,{recursive:!0});if(n.out_dir=n.out_dir||`./.out/${n.name}`,n.out_dir=N.resolve(v,n.out_dir),o.existsSync(n.out_dir))o.rmSync(n.out_dir,{recursive:!0});let C=i("./template/deploy/to-electron");if(!o.existsSync(C))throw Error(`${C} doesn't exist`);if(!g||!o.existsSync(g))throw Error(`${g} doesn't exists`);let V=N.resolve(g,"./dist");if(!o.existsSync(V))throw Error(`${V} doesn't exists`);if(!v||!o.existsSync(v))throw Error(`${v} doesn't exists`);let E=N.resolve(v,n.out_dir);if(!o.existsSync(E))o.mkdirSync(E,{recursive:!0});let b=N.resolve(g,n.package_dir);if(!o.existsSync(b))o.mkdirSync(b,{recursive:!0});await B({dir:C,outDir:E,context:{atom:y,params:n,config:$},copyUnmatchedAlso:!0});let x=N.resolve(E,"./src");if(!o.existsSync(x))o.mkdirSync(x,{recursive:!0});let w=await c(`cp -a ${V} ${x}`);if(w.code!==0)throw Error("Couldn't copy project dist files.");if(w=await c("npm install",{cwd:E}),w.code!==0)throw Error("Couldn't install dependencies.");if(w=await c("npm run dist",{cwd:E}),w.code!==0)throw Error("Couldn't build project.")};import z from"lodash.clonedeep";import G from"semver";async function H({atom:y,target:n,onProgress:$,projectDir:g,dependencies:v,context:C,yamlTarget:V}){if($)await $({message:"Deploying it as electron package."});let b=n?.config?await F({name:n.config,dir:g,optional:!0,transferEnv:!1,tags:C.tags}):void 0,x=G.inc(n.version||"0.1.0","patch");n.version=x,V.set("version",x);let w=z(n.params);w.dependencies=z(v);let A={atom:y,params:w,config:b?.config,src:g,dest:g};return{deployer:await q(A)}}export{H as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as U}from"./index.kanz1359.js";import{f as Z}from"./index.drbq51nw.js";import _ from"@fnet/config";import v from"node:fs";import G from"@fnet/shelljs";import Q from"@flownet/lib-render-templates-dir";import x from"node:path";var W=async({atom:N,params:y,config:b,src:k,dest:V})=>{let{nanoid:L}=await import("nanoid");if(y.name=y.name||"docker",y.id=y.id||"com.example.docker",y.version=y.version||"0.1.0",y.image_base=y.image_base||"node:22-alpine",y.image_name=y.image_name||y.name,y.template=y.template||"docker",y.title=y.title||N?.doc?.title||y.name||N?.doc?.name||"Docker Image",y.package_name=y.package_name||y.name,y.author=y.author||N?.doc?.author||"Flownet",y.description=y.description||N?.doc?.description||"Docker Image built with Flownet",y.vendor=y.vendor||"flownet.ai",y.package_dir=y.package_dir||`./.package/${y.name}`,y.package_dir=x.resolve(V,y.package_dir),v.existsSync(y.package_dir))v.rmSync(y.package_dir,{recursive:!0});y.out_dir=y.out_dir||`./.out/${y.name}`,y.out_dir=x.resolve(V,y.out_dir);let A=U(`./template/deploy/to-docker/${y.template}`);if(!v.existsSync(A))throw Error(`${A} doesn't exist`);if(!k||!v.existsSync(k))throw Error(`${k} doesn't exists`);let H=x.resolve(k,"./dist");if(!v.existsSync(H))throw Error(`${H} doesn't exists`);if(!V||!v.existsSync(V))throw Error(`${V} doesn't exists`);let n=x.resolve(V,y.out_dir);if(!v.existsSync(n))v.mkdirSync(n,{recursive:!0});let z=x.resolve(k,y.package_dir);if(!v.existsSync(z))v.mkdirSync(z,{recursive:!0});let B=async($,O)=>{if($&&Array.isArray($)){let M=x.resolve(O,"files");if(!v.existsSync(M))v.mkdirSync(M,{recursive:!0});for(let E of $){if(!E.path)throw Error('Each file must have a "path" property.');let Y=`${L()}-${x.basename(E.path)}`,K=x.resolve(M,Y);if(E.srcfile){let C=x.resolve(k,E.srcfile);if(!v.existsSync(C))throw Error(`Source file ${C} does not exist.`);v.copyFileSync(C,K),delete E.content,delete E.base64}else if(E.content)v.writeFileSync(K,E.content,"utf8");else if(E.base64){let C=Buffer.from(E.base64,"base64");v.writeFileSync(K,C)}else throw Error('Each file must have either "srcfile", "content", or "base64" property.');E.srcfile=x.relative(O,K)}}};if(await B(b?.files,n),await B(y?.files,n),await Q({dir:A,outDir:n,context:{atom:N,params:y,config:b},copyUnmatchedAlso:!0,overwriteExisting:!0}),y.additional_template_dir){let $=x.resolve(y.additional_template_dir);if(!v.existsSync($))throw Error(`${$} doesn't exist`);await Q({dir:$,outDir:n,context:{atom:N,params:y,config:b},copyUnmatchedAlso:!0,overwriteExisting:!0})}let w=await G(`cp -a ${H} ${n}`);if(w.code!==0)throw Error(`Couldn't copy project dist files: ${w.stderr}`);if(w=await G(`cp -a ${x.resolve(k,"package.json")} ${n}`),w.code!==0)throw Error(`Couldn't copy project package.json : ${w.stderr}`);if(v.existsSync(x.resolve(k,"package-lock.json"))){if(w=await G(`cp -a ${x.resolve(k,"package-lock.json")} ${n}`),w.code!==0)throw Error(`Couldn't copy project package-lock.json: ${w.stderr}`)}if(v.existsSync(x.resolve(k,"bun.lock"))){if(w=await G(`cp -a ${x.resolve(k,"bun.lock")} ${n}`),w.code!==0)throw Error(`Couldn't copy project bun.lock: ${w.stderr}`)}if(w=await G("bash build.sh",{cwd:n}),w.code!==0)throw Error(`Couldn't build project: ${w.stderr}`)};import X from"lodash.clonedeep";import q from"semver";async function g({atom:N,target:y,onProgress:b,projectDir:k,dependencies:V,context:L,yamlTarget:A}){if(b)await b({message:"Deploying it as docker package."});let n=y?.config?await _({name:y.config,dir:k,optional:!0,transferEnv:!1,tags:L.tags}):void 0,z=q.inc(y.version||"0.1.0","patch");y.params.version=z,y.version=z,A.set("version",z);let B=X(y.params);B.dependencies=X(V);let w={atom:N,params:B,config:n?.config,src:k,dest:k};return{deployer:await W(w)}}export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{existsSync as c}from"node:fs";import{delimiter as f,join as i}from"node:path";var m=(t)=>{let r=process.env.PATH||"",s=process.platform==="win32"?(process.env.PATHEXT||".EXE;.CMD;.BAT;.COM").split(";"):[""],n=r.split(f);for(let p of n)for(let e of s){let o=i(p,process.platform==="win32"?t+e:t);if(c(o))return o}return null};
|
|
2
|
-
export{m as
|
|
2
|
+
export{m as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as Q}from"./index.kanz1359.js";import"./index.drbq51nw.js";import T from"@fnet/config";import y from"node:fs";import K from"@fnet/shelljs";import _ from"@flownet/lib-create-ios-icons";import g from"@flownet/lib-create-ios-launch-screens";import k from"@flownet/lib-render-templates-dir";import O from"node:path";import L from"@fnet/xcode-cert-inspector";var U=async({atom:w,params:n,config:$,src:A,dest:N})=>{let H=(await L()).find((V)=>V.certificateType==="Development"&&V.platforms.includes("macOS"))?.teamID;if(n.name=n.name||"macos-app",n.entry=n.entry||"app/macos",n.id=n.id||"com.example.macos-app",n.version=n.version||"0.1.0",n.title=n.title||w?.doc?.title||n.name||w?.doc?.name||"macOS App",n.package_name=n.package_name||n.name,n.author=n.author||w?.doc?.author||"Flownet",n.description=n.description||w?.doc?.description||"macOS App built with Flownet",n.vendor=n.vendor||"flownet.ai",n.include_css=w?.doc?.features?.css_options?.extract===!0,n.bundle_name=w?.doc?.bundleName,n.package_dir=n.package_dir||`./.package/${n.name}`,n.package_dir=O.resolve(N,n.package_dir),n.code_sign_identity=n.code_sign_identity||"Apple Development",n.code_sign_style=n.code_sign_style||"Automatic",n.development_team=n.development_team||H,n.product_bundle_identifier=n.product_bundle_identifier||n.id,n.product_name=n.product_name||n.name,y.existsSync(n.package_dir))y.rmSync(n.package_dir,{recursive:!0});if(n.out_dir=n.out_dir||`./.out/${n.name}`,n.out_dir=O.resolve(N,n.out_dir),y.existsSync(n.out_dir))y.rmSync(n.out_dir,{recursive:!0});let E=Q("./template/deploy/to-macos-app");if(!y.existsSync(E))throw Error(`${E} doesn't exist`);if(!A||!y.existsSync(A))throw Error(`${A} doesn't exists`);let x=O.resolve(A,"./dist");if(!y.existsSync(x))throw Error(`${x} doesn't exists`);if(!N||!y.existsSync(N))throw Error(`${N} doesn't exists`);let v=O.resolve(N,n.out_dir);if(!y.existsSync(v))y.mkdirSync(v,{recursive:!0});let q=O.resolve(A,n.package_dir);if(!y.existsSync(q))y.mkdirSync(q,{recursive:!0});await k({dir:E,outDir:v,context:{atom:w,params:n,config:$},copyUnmatchedAlso:!0});let z=O.resolve(v,"./fnet");if(!y.existsSync(z))y.mkdirSync(z,{recursive:!0});let B=await K(`cp -a ${x} ${z}`);if(B.code!==0)throw Error("Couldnt copy project dist files.");let X=O.resolve(v,"./fnet-macos-app/Assets.xcassets/AppIcon.appiconset");await _({text:n.id,dir:X,platform:"macos"});let Y=O.resolve(v,"./fnet-macos-app/Assets.xcassets/launch-images.imageset");await g({text:n.id,dir:Y,sizes:[{width:1242,height:2688},{width:1536,height:2048},{width:2048,height:1536}]});let Z=[{build:"Debug",sdk:"macosx"},{build:"Release",sdk:"macosx"}];for(let V of Z){let M="xcodebuild";if(M+=" -project fnet-macos-app.xcodeproj",M+=" -scheme fnet-macos-app",M+=` -configuration ${V.build}`,M+=` -sdk ${V.sdk}`,M+=" -allowProvisioningUpdates",M+=" build",M+=" DSTROOT=./dist",M+=" SYMROOT=./dist",B=await K(`${M}`,{cwd:v}),B.code!==0)throw Error(`Couldn't build project: ${B.stderr}`)}};import W from"lodash.clonedeep";import J from"semver";async function P({atom:w,target:n,onProgress:$,projectDir:A,dependencies:N,context:F,yamlTarget:G}){if($)await $({message:"Deploying it as macos-app package."});let E=n?.config?await T({name:n.config,dir:A,optional:!0,transferEnv:!1,tags:F.tags}):void 0,x=J.inc(n.version||"0.1.0","patch");n.params.version=x,n.version=x,G.set("version",x);let v=W(n.params);v.dependencies=W(N);let q={atom:w,params:v,config:E?.config,src:A,dest:A};return{deployer:await U(q)}}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as K}from"./index.kanz1359.js";import"./index.drbq51nw.js";import Q from"@fnet/config";import w from"node:fs";import J from"@flownet/lib-render-templates-dir";import O from"@fnet/auto-conda-env";import $ from"node:path";var L=async({atom:I,params:o,config:G,src:q,dest:x})=>{if(o.name=o.name||"pyip",o.version=o.version||"0.1.0",o.package_name=o.package_name||o.name,o.bin_name=o.bin_name||o.package_name,o.package_dir=o.package_dir||`./.package/${o.name}`,o.package_dir=$.resolve(x,o.package_dir),o.dependencies=o.dependencies||[],w.existsSync(o.package_dir))w.rmSync(o.package_dir,{recursive:!0});if(o.out_dir=o.out_dir||`./.out/${o.name}`,o.out_dir=$.resolve(x,o.out_dir),w.existsSync(o.out_dir))w.rmSync(o.out_dir,{recursive:!0});let C=K("./template/deploy/to-pyip");if(!w.existsSync(C))throw Error(`${C} doesn't exist`);if(!q||!w.existsSync(q))throw Error(`${q} doesn't exists`);if(!x||!w.existsSync(x))throw Error(`${x} doesn't exists`);let F=$.resolve($.join(q,"src","default"));if(!w.existsSync(F))throw Error(`${F} doesn't exists`);let V=$.resolve(x,o.out_dir);if(!w.existsSync(V))w.mkdirSync(V,{recursive:!0});let H=$.resolve(q,o.package_dir);if(!w.existsSync(H))w.mkdirSync(H,{recursive:!0});let B={atom:I,params:o,config:G};await J({dir:C,outDir:V,context:B,unmatched:!0});let z=$.resolve(V,"package");if(!w.existsSync(z))w.mkdirSync(z,{recursive:!0});await J({dir:F,outDir:$.join(z,"lib"),context:B,unmatched:!0,ignore:["__pycache__/**","__init__.py"],follow:!0}),w.renameSync(z,$.resolve(V,o.package_name)),z=$.resolve(V,o.package_name);let N=await O({pythonVersion:"3.12",packages:[{package:"twine"}]}),y;if(y=await N.runBin("pip",["install","-e","."],{wdir:V}),y?.errors)throw Error(y.errors.format());if(y=await N.runBin("pip",["show","-f",o.package_name]),y?.errors)throw Error(y.errors.format());if(y=await N.runBin("pip",["list"]),y?.errors)throw Error(y.errors.format());if(y=await N.runBin(o.bin_name,["--help"]),y?.errors)throw Error(y.errors.format());if(y=await N.runCode(`from ${o.package_name}.lib import default; print(default);`),y?.errors)throw Error(y.errors.format());if(y=await N.runCode(`from ${o.package_name} import default; print(default);`),y?.errors)throw Error(y.errors.format());if(y=await N.runCode(`from ${o.package_name} import main; print(main);`),y?.errors)throw Error(y.errors.format());if(y=await N.runBin("pip",["uninstall",o.package_name,"-y"]),y?.errors)throw Error(y.errors.format());if(y=await N.runFile($.join(V,"setup.py"),["sdist","bdist_wheel"],{wdir:V}),y?.errors)throw Error(y.errors.format());if(y=await N.runBin("twine",["upload","dist/*"],{wdir:V}),y?.errors)throw Error(y.errors.format())};import M from"lodash.clonedeep";import U from"semver";async function W({atom:I,target:o,onProgress:G,projectDir:q,dependencies:x,context:C,yamlTarget:F}){if(G)await G({message:"Deploying it as pypi package."});let H=o?.config?await Q({name:o.config,dir:q,optional:!0,transferEnv:!1,tags:C.tags}):void 0,B=U.inc(o.version||"0.1.0","patch");o.params.version=B,o.version=B,F.set("version",B);let z=M(o.params);z.dependencies=M(x);let N={atom:I,params:z,config:H?.config,src:q,dest:q};return{deployer:await L(N)}}export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as _}from"./index.pj3wr582.js";import{c as Z}from"./index.kanz1359.js";import"./index.drbq51nw.js";import A from"node:fs";import E from"node:path";import u from"semver";import Y from"@fnet/shelljs";import v from"@fnet/config";import w from"@fnet/object-from-schema";import b from"yaml";import{fileURLToPath as F}from"node:url";var h=E.dirname(F(import.meta.url)),m=process.cwd();async function T({atom:y,setProgress:$,context:B,deploymentProject:L,deploymentProjectTarget:z,yamlTarget:R}){await $({message:"Deploying it as npm package."});let G=B.projectDir,H=E.resolve(G,"package.json"),V=A.readFileSync(H),q=JSON.parse(V);q.name=z.params.name,q.version=u.inc(z.version,"patch");let I=z.params.bin?.name||z.params.bin;if(z.params.bin?.enabled!==!1&&I&&typeof I==="string")q.bin={[I]:"dist/cli/esm/index.js"};delete q.scripts,delete q.devDependencies,q.scripts={serve:"npx serve ."},A.writeFileSync(H,JSON.stringify(q,null,"\t"));let W=z.config||"npm",K=(await v({name:W,dir:B.projectDir,tags:B.tags,optional:!0}))?.data;if(!K){let M=Z("./template/schemas/to-npm.yaml"),X=await w({schema:M,tags:B.tags}),U=B.project.projectDir,Q=E.resolve(U,".fnet");if(!A.existsSync(Q))A.mkdirSync(Q);A.writeFileSync(E.resolve(Q,`${W}.fnet`),b.stringify(X)),K=X}if(A.writeFileSync(E.resolve(G,".npmrc"),`//registry.npmjs.org/:_authToken=${K.env.NPM_TOKEN}`),z.dryRun===!0)return;if(_("bun")){if((await Y("bun publish --access public",{cwd:G})).code!==0)throw Error("Couldnt publish to npm")}else if((await Y("npm publish --access public",{cwd:G})).code!==0)throw Error("Couldnt publish to npm");A.writeFileSync(H,V),L.isDirty=!0,z.version=q.version,R.set("version",q.version)}export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as q}from"./index.kanz1359.js";import"./index.drbq51nw.js";import G from"@fnet/config";import o from"node:fs";import b from"@fnet/shelljs";import F from"@flownet/lib-render-templates-dir";import i from"node:path";var z=async({atom:y,params:n,config:V,src:v,dest:w})=>{if(n.name=n.name||"rust",n.entry=n.entry||"app/esm",n.version=n.version||"0.1.0",n.title=n.title||y?.doc?.title||n.name||y?.doc?.name||"Rust App",n.package_name=n.package_name||n.name,n.author=n.author||y?.doc?.author||"Flownet",n.description=n.description||y?.doc?.description||"Rust App built with Flownet",n.vendor=n.vendor||"flownet.ai",n.include_css=y?.doc?.features?.css_options?.extract===!0,n.bundle_name=y?.doc?.bundleName,n.package_dir=n.package_dir||`./.package/${n.name}`,n.package_dir=i.resolve(w,n.package_dir),o.existsSync(n.package_dir))o.rmSync(n.package_dir,{recursive:!0});if(n.out_dir=n.out_dir||`./.out/${n.name}`,n.out_dir=i.resolve(w,n.out_dir),o.existsSync(n.out_dir))o.rmSync(n.out_dir,{recursive:!0});let C=q("./template/deploy/to-rust");if(!o.existsSync(C))throw Error(`${C} doesn't exist`);if(!v||!o.existsSync(v))throw Error(`${v} doesn't exists`);let E=i.resolve(i.join(v,"dist",n.entry));if(!o.existsSync(E))throw Error(`${E} doesn't exists`);if(!w||!o.existsSync(w))throw Error(`${w} doesn't exists`);let x=i.resolve(w,n.out_dir);if(!o.existsSync(x))o.mkdirSync(x,{recursive:!0});let $=i.resolve(v,n.package_dir);if(!o.existsSync($))o.mkdirSync($,{recursive:!0});await F({dir:C,outDir:x,context:{atom:y,params:n,config:V},copyUnmatchedAlso:!0});let N=i.resolve(x,"./dist");if(!o.existsSync(N))o.mkdirSync(N,{recursive:!0});let g=await b(`cp -a ${E}/** ${N}`);if(g.code!==0)throw Error("Couldn't copy project dist files.");if(g=await b("cargo build",{cwd:x}),g.code!==0)throw Error("Couldn't build project.");if(g=await b("cargo build --release",{cwd:x}),g.code!==0)throw Error("Couldn't build project.")};import A from"lodash.clonedeep";import H from"semver";async function I({atom:y,target:n,onProgress:V,projectDir:v,dependencies:w,context:C,yamlTarget:E}){if(V)await V({message:"Deploying it as Rust package."});let $=n?.config?await G({name:n.config,dir:v,optional:!0,transferEnv:!1,tags:C.tags}):void 0,N=H.inc(n.version||"0.1.0","patch");n.params.version=N,n.version=N,E.set("version",N);let g=A(n.params);g.dependencies=A(w);let B={atom:y,params:g,config:$?.config,src:v,dest:v};return{deployer:await z(B)}}export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index.kanz1359.js";import"./index.drbq51nw.js";import F from"@fnet/config";import o from"node:fs";import b from"@fnet/shelljs";import B from"@flownet/lib-render-templates-dir";import E from"node:path";var q=async({atom:y,params:n,config:V,src:i,dest:x})=>{if(n.name=n.name||"nextjs",n.entry=n.entry||"app/esm",n.id=n.id||"com.example.nextjs",n.version=n.version||"0.1.0",n.title=n.title||y?.doc?.title||n.name||y?.doc?.name||"NextJs App",n.package_name=n.package_name||n.name,n.author=n.author||y?.doc?.author||"Flownet",n.description=n.description||y?.doc?.description||"NextJs App built with Flownet",n.vendor=n.vendor||"flownet.ai",n.include_css=y?.doc?.features?.css_options?.extract===!0,n.bundle_name=y?.doc?.bundleName,n.package_dir=n.package_dir||`./.package/${n.name}`,n.package_dir=E.resolve(x,n.package_dir),o.existsSync(n.package_dir))o.rmSync(n.package_dir,{recursive:!0});if(n.out_dir=n.out_dir||`./.out/${n.name}`,n.out_dir=E.resolve(x,n.out_dir),o.existsSync(n.out_dir))o.rmSync(n.out_dir,{recursive:!0});let f=c("./template/deploy/to-nextjs");if(!o.existsSync(f))throw Error(`${f} doesn't exist`);if(!i||!o.existsSync(i))throw Error(`${i} doesn't exists`);let C=E.resolve(i,"./dist");if(!o.existsSync(C))throw Error(`${C} doesn't exists`);if(!x||!o.existsSync(x))throw Error(`${x} doesn't exists`);let g=E.resolve(x,n.out_dir);if(!o.existsSync(g))o.mkdirSync(g,{recursive:!0});let $=E.resolve(i,n.package_dir);if(!o.existsSync($))o.mkdirSync($,{recursive:!0});if(n.dependencies=n.dependencies||[],!n.dependencies.find((v)=>v.package==="next"))n.dependencies.push({package:"next",version:"^13.5"});if(!n.dependencies.find((v)=>v.package==="react"))n.dependencies.push({package:"react",version:"^18.2"});if(!n.dependencies.find((v)=>v.package==="react-dom"))n.dependencies.push({package:"react-dom",version:"^18.2"});await B({dir:f,outDir:g,context:{atom:y,params:n,config:V},copyUnmatchedAlso:!0});let N=await b(`cp -a ${C} ${g}`);if(N.code!==0)throw Error("Couldn't copy project dist files.");if(N=await b("npm install && npm run build",{cwd:g}),N.code!==0)throw Error("Couldn't build project.")};import z from"lodash.clonedeep";import G from"semver";async function H({atom:y,target:n,onProgress:V,projectDir:i,dependencies:x,context:f,yamlTarget:C}){if(V)await V({message:"Deploying it as nextjs package."});let $=n?.config?await F({name:n.config,dir:i,optional:!0,transferEnv:!1,tags:f.tags}):void 0,N=G.inc(n.version||"0.1.0","patch");n.params.version=N,n.version=N,C.set("version",N);let v=z(n.params);v.dependencies=z(x);let A={atom:y,params:v,config:$?.config,src:i,dest:i};return{deployer:await q(A)}}export{H as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{existsSync as c}from"node:fs";import{delimiter as f,join as i}from"node:path";var m=(t)=>{let r=process.env.PATH||"",s=process.platform==="win32"?(process.env.PATHEXT||".EXE;.CMD;.BAT;.COM").split(";"):[""],n=r.split(f);for(let p of n)for(let e of s){let o=i(p,process.platform==="win32"?t+e:t);if(c(o))return o}return null};
|
|
2
|
+
export{m as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import j from"node:path";import v from"node:fs";import E from"node:os";import{fileURLToPath as F}from"node:url";var G=j.dirname(F(import.meta.url)),H=process.cwd(),I=j.resolve(E.homedir(),".fnet"),J=j.dirname(process.execPath);function K(q){let z=j.resolve(H,q);if(v.existsSync(z))return z;let A=j.resolve(G,"../..",q);if(v.existsSync(A))return A;let B=j.resolve(J,"../share/fnet",q);if(v.existsSync(B))return B;let C=j.resolve(I,q);if(v.existsSync(C))return C;throw Error(`Template path not found: ${q}`)}
|
|
2
|
+
export{K as g};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as A,b,c as v,d as w}from"./index.
|
|
1
|
+
import{a as A,b,c as v,d as w}from"./index.782edcjp.js";import"./index.5qbcx2y3.js";import K from"node:fs";import T from"node:path";import f from"node:os";async function U(I){let{atom:q,context:z,setProgress:H}=I;H("Initializing features..."),q.doc.features=q.doc.features||{};let _=q.doc.features;if(_.cli===!1)_.cli={enabled:!1};else if(_.cli===!0)_.cli={enabled:!0};else _.cli={enabled:!0};_.cli.enabled=_.cli.enabled===!0&&(q.doc.features.form_enabled===!1||_.cli.extend===!0||_.cli.enabled===!0)}async function V({atom:I,packageDependencies:q,packageDevDependencies:z,setProgress:H}){H("Initializing dependencies")}import Z from"node:fs";import $ from"node:path";import l from"@flownet/lib-render-templates-dir";async function W({atom:I,setProgress:q,context:z,packageDependencies:H}){if(I.doc.features.cli.enabled!==!0)return;await q({message:"Creating cli."});let _={atom:I,packageDependencies:H},N=z.templateDir,M=$.join(z.projectDir,"src","cli");if(!Z.existsSync(M))Z.mkdirSync(M,{recursive:!0});await l({pattern:["index.py.njk","__init__.py.njk"],dir:$.join(N,"src","cli"),outDir:M,context:_})}import Q from"node:path";import G from"@fnet/auto-conda-env";import u from"@flownet/lib-render-templates-dir";async function X(I){let{setProgress:q,atom:z,context:H}=I;q({message:"Installing Python packages"});let _=H.projectDir,N=await G({pythonVersion:"3.12",packages:[{package:"fnet-import-parser",version:"0.1.9"}]}),{errors:M,result:F}=await N.runBin("fnet_import_parser",["--entry_file",Q.join(_,"src","default","index.py")],{captureName:"result"});if(M)throw Error(M.format());let y=JSON.parse(F.items[0].stdout).required["third-party"]?.map((J)=>{return{package:J.metadata?.package||J.path,version:J.metadata?.version||void 0,channel:J.metadata?.channel||void 0}})||[],S=z.doc.dependencies||[];for(let J of y)if(!S.some((R)=>R.package===J.package))S.push(J);let E=Q.join(_,".conda"),Y=await G({envDir:E,pythonVersion:z.doc.features.runtime.version||"3.12",packages:S});H.pythonEnv=Y,I.packageDependencies=S;let L=z.doc.features.render?.dirs||[];for(let J of L)J.dir=Q.resolve(_,J.dir),J.outDir=Q.resolve(_,J.outDir),await u(J);let O={params:{}};O.params.package_name=z.doc.name,O.params.version="0.1.0",O.params.bin_name=z.doc.name,O.params.python_requires=z.doc.features.runtime.version||">=3.12",O.params.dependencies=S,O.params.scripts=JSON.stringify({cli:`PYTHONPATH='${Q.join("src")}' '${Q.relative(H.projectDir,Y.pythonBin)}' '${Q.join("src","cli","index.py")}'`}),await u({pattern:["setup.py.njk","package.json.njk","pyproject.toml.njk"],dir:H.templateDir,outDir:H.projectDir,context:O})}class B extends b{async initRuntime(){await U(this.apiContext),await V(this.apiContext),await this.initLibraryDirPython(),await this.initNunjucks(),await this.initLibsPython()}async initLibraryDirPython(){this.setProgress({message:"Initializing library directory."});let I=this.context.projectDir;this.setProgress({message:"Cleaning project directory."});let q=A({dir:I,ignore:[".cache","node_modules",".conda",".bin",".dev"],absolute:!0});for(let _ of q)K.rmSync(_,{recursive:!0,force:!0});this.setProgress({message:"Creating project directory."});let z=I;if(!K.existsSync(z))K.mkdirSync(z,{recursive:!0});if(z=T.join(I,"src"),!K.existsSync(z))K.mkdirSync(z,{recursive:!0});z=T.join(I,"src","default");let H=this.context.projectSrcDir;if(!K.existsSync(z))try{if(f.platform()==="win32")K.symlinkSync(H,z,"junction");else K.symlinkSync(H,z,"dir")}catch(_){throw Error(`Couldn't create symlink. Error: ${_.message}`)}if(z=T.join(I,".dev"),!K.existsSync(z))K.mkdirSync(z,{recursive:!0})}async initLibsPython(){this.setProgress({message:"Initializing external libs."});let I=this.atom;I.protocol="src:",I.doc.dependencies=I.doc.dependencies||[],I.name=I.doc.name;let q=[{name:this.atom.doc.name,type:"atom",parent_id:this.atom.parent_id,atom:I}];this.libs=q}async createAtomLibFilesPython({libs:I}){await this.setProgress({message:"Creating external lib files."});let q=I.filter((z)=>z.type==="atom");for(let z=0;z<q.length;z++){let _=q[z].atom;if(_.protocol==="src:"){let N=T.resolve(this.context.projectSrcDir,`${_.fileName||_.name}.py`);if(!K.existsSync(N)){K.mkdirSync(T.dirname(N),{recursive:!0});let M=`def default():
|
|
2
2
|
`;M+=` print("Hello world!")
|
|
3
3
|
`,K.writeFileSync(N,M,"utf8")}}}}async build(){try{if(this.fileMode){if(await this.createAtomLibFilesPython({libs:this.libs}),await this.createProjectYaml(),await w(this.apiContext),await v(this.apiContext),await W(this.apiContext),this.buildMode){if(await X(this.apiContext),this.deployMode)await this.deploy()}}await this._cache_set(this.buildKey,{status:"COMPLETED"})}catch(I){throw await this._cache_set(this.buildKey,{status:"FAILED",message:I.message||I}),console.log(I),I}}}var qz=B;export{qz as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as U}from"./index.22v7wtt0.js";import{j as Z}from"./index.5qbcx2y3.js";import _ from"@fnet/config";import v from"node:fs";import G from"@fnet/shelljs";import Q from"@flownet/lib-render-templates-dir";import x from"node:path";var W=async({atom:N,params:y,config:b,src:k,dest:V})=>{let{nanoid:L}=await import("nanoid");if(y.name=y.name||"docker",y.id=y.id||"com.example.docker",y.version=y.version||"0.1.0",y.image_base=y.image_base||"node:22-alpine",y.image_name=y.image_name||y.name,y.template=y.template||"docker",y.title=y.title||N?.doc?.title||y.name||N?.doc?.name||"Docker Image",y.package_name=y.package_name||y.name,y.author=y.author||N?.doc?.author||"Flownet",y.description=y.description||N?.doc?.description||"Docker Image built with Flownet",y.vendor=y.vendor||"flownet.ai",y.package_dir=y.package_dir||`./.package/${y.name}`,y.package_dir=x.resolve(V,y.package_dir),v.existsSync(y.package_dir))v.rmSync(y.package_dir,{recursive:!0});y.out_dir=y.out_dir||`./.out/${y.name}`,y.out_dir=x.resolve(V,y.out_dir);let A=U(`./template/deploy/to-docker/${y.template}`);if(!v.existsSync(A))throw Error(`${A} doesn't exist`);if(!k||!v.existsSync(k))throw Error(`${k} doesn't exists`);let H=x.resolve(k,"./dist");if(!v.existsSync(H))throw Error(`${H} doesn't exists`);if(!V||!v.existsSync(V))throw Error(`${V} doesn't exists`);let n=x.resolve(V,y.out_dir);if(!v.existsSync(n))v.mkdirSync(n,{recursive:!0});let z=x.resolve(k,y.package_dir);if(!v.existsSync(z))v.mkdirSync(z,{recursive:!0});let B=async($,O)=>{if($&&Array.isArray($)){let M=x.resolve(O,"files");if(!v.existsSync(M))v.mkdirSync(M,{recursive:!0});for(let E of $){if(!E.path)throw Error('Each file must have a "path" property.');let Y=`${L()}-${x.basename(E.path)}`,K=x.resolve(M,Y);if(E.srcfile){let C=x.resolve(k,E.srcfile);if(!v.existsSync(C))throw Error(`Source file ${C} does not exist.`);v.copyFileSync(C,K),delete E.content,delete E.base64}else if(E.content)v.writeFileSync(K,E.content,"utf8");else if(E.base64){let C=Buffer.from(E.base64,"base64");v.writeFileSync(K,C)}else throw Error('Each file must have either "srcfile", "content", or "base64" property.');E.srcfile=x.relative(O,K)}}};if(await B(b?.files,n),await B(y?.files,n),await Q({dir:A,outDir:n,context:{atom:N,params:y,config:b},copyUnmatchedAlso:!0,overwriteExisting:!0}),y.additional_template_dir){let $=x.resolve(y.additional_template_dir);if(!v.existsSync($))throw Error(`${$} doesn't exist`);await Q({dir:$,outDir:n,context:{atom:N,params:y,config:b},copyUnmatchedAlso:!0,overwriteExisting:!0})}let w=await G(`cp -a ${H} ${n}`);if(w.code!==0)throw Error(`Couldn't copy project dist files: ${w.stderr}`);if(w=await G(`cp -a ${x.resolve(k,"package.json")} ${n}`),w.code!==0)throw Error(`Couldn't copy project package.json : ${w.stderr}`);if(v.existsSync(x.resolve(k,"package-lock.json"))){if(w=await G(`cp -a ${x.resolve(k,"package-lock.json")} ${n}`),w.code!==0)throw Error(`Couldn't copy project package-lock.json: ${w.stderr}`)}if(v.existsSync(x.resolve(k,"bun.lock"))){if(w=await G(`cp -a ${x.resolve(k,"bun.lock")} ${n}`),w.code!==0)throw Error(`Couldn't copy project bun.lock: ${w.stderr}`)}if(w=await G("bash build.sh",{cwd:n}),w.code!==0)throw Error(`Couldn't build project: ${w.stderr}`)};import X from"lodash.clonedeep";import q from"semver";async function g({atom:N,target:y,onProgress:b,projectDir:k,dependencies:V,context:L,yamlTarget:A}){if(b)await b({message:"Deploying it as docker package."});let n=y?.config?await _({name:y.config,dir:k,optional:!0,transferEnv:!1,tags:L.tags}):void 0,z=q.inc(y.version||"0.1.0","patch");y.params.version=z,y.version=z,A.set("version",z);let B=X(y.params);B.dependencies=X(V);let w={atom:N,params:B,config:n?.config,src:k,dest:k};return{deployer:await W(w)}}export{g as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{h as gQ,i as U8,j as P}from"./index.5qbcx2y3.js";var M8=U8((_5,C8)=>{C8.exports=B8;function B8(Q,X,$){if(Q instanceof RegExp)Q=z8(Q,$);if(X instanceof RegExp)X=z8(X,$);var Z=w8(Q,X,$);return Z&&{start:Z[0],end:Z[1],pre:$.slice(0,Z[0]),body:$.slice(Z[0]+Q.length,Z[1]),post:$.slice(Z[1]+X.length)}}function z8(Q,X){var $=X.match(Q);return $?$[0]:null}B8.range=w8;function w8(Q,X,$){var Z,J,V,q,_,Y=$.indexOf(Q),H=$.indexOf(X,Y+1),K=Y;if(Y>=0&&H>0){if(Q===X)return[Y,H];Z=[],V=$.length;while(K>=0&&!_){if(K==Y)Z.push(K),Y=$.indexOf(Q,K+1);else if(Z.length==1)_=[Z.pop(),H];else{if(J=Z.pop(),J<V)V=J,q=H;H=$.indexOf(X,K+1)}K=Y<H&&Y>=0?Y:H}if(Z.length)_=[V,q]}return _}});var v8=U8((Y5,N8)=>{var R8=M8();N8.exports=vQ;var A8="\x00SLASH"+Math.random()+"\x00",I8="\x00OPEN"+Math.random()+"\x00",a0="\x00CLOSE"+Math.random()+"\x00",L8="\x00COMMA"+Math.random()+"\x00",O8="\x00PERIOD"+Math.random()+"\x00";function r0(Q){return parseInt(Q,10)==Q?parseInt(Q,10):Q.charCodeAt(0)}function FQ(Q){return Q.split("\\\\").join(A8).split("\\{").join(I8).split("\\}").join(a0).split("\\,").join(L8).split("\\.").join(O8)}function NQ(Q){return Q.split(A8).join("\\").split(I8).join("{").split(a0).join("}").split(L8).join(",").split(O8).join(".")}function F8(Q){if(!Q)return[""];var X=[],$=R8("{","}",Q);if(!$)return Q.split(",");var{pre:Z,body:J,post:V}=$,q=Z.split(",");q[q.length-1]+="{"+J+"}";var _=F8(V);if(V.length)q[q.length-1]+=_.shift(),q.push.apply(q,_);return X.push.apply(X,q),X}function vQ(Q){if(!Q)return[];if(Q.substr(0,2)==="{}")Q="\\{\\}"+Q.substr(2);return W0(FQ(Q),!0).map(NQ)}function PQ(Q){return"{"+Q+"}"}function DQ(Q){return/^-?0\d/.test(Q)}function kQ(Q,X){return Q<=X}function SQ(Q,X){return Q>=X}function W0(Q,X){var $=[],Z=R8("{","}",Q);if(!Z)return[Q];var J=Z.pre,V=Z.post.length?W0(Z.post,!1):[""];if(/\$$/.test(Z.pre))for(var q=0;q<V.length;q++){var _=J+"{"+Z.body+"}"+V[q];$.push(_)}else{var Y=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(Z.body),H=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(Z.body),K=Y||H,G=Z.body.indexOf(",")>=0;if(!K&&!G){if(Z.post.match(/,.*\}/))return Q=Z.pre+"{"+Z.body+a0+Z.post,W0(Q);return[Q]}var W;if(K)W=Z.body.split(/\.\./);else if(W=F8(Z.body),W.length===1){if(W=W0(W[0],!1).map(PQ),W.length===1)return V.map(function(OQ){return Z.pre+W[0]+OQ})}var z;if(K){var j=r0(W[0]),U=r0(W[1]),B=Math.max(W[0].length,W[1].length),C=W.length==3?Math.abs(r0(W[2])):1,M=kQ,w=U<j;if(w)C*=-1,M=SQ;var R=W.some(DQ);z=[];for(var b=j;M(b,U);b+=C){var F;if(H){if(F=String.fromCharCode(b),F==="\\")F=""}else if(F=String(b),R){var e=B-F.length;if(e>0){var J0=Array(e+1).join("0");if(b<0)F="-"+J0+F.slice(1);else F=J0+F}}z.push(F)}}else{z=[];for(var y=0;y<W.length;y++)z.push.apply(z,W0(W[y],!1))}for(var y=0;y<z.length;y++)for(var q=0;q<V.length;q++){var _=J+z[y]+V[q];if(!X||K||_)$.push(_)}}return $}});var E8=gQ(v8(),1);var G0=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var TQ={"[: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]},j0=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),bQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),P8=(Q)=>Q.join(""),D8=(Q,X)=>{let $=X;if(Q.charAt($)!=="[")throw Error("not in a brace expression");let Z=[],J=[],V=$+1,q=!1,_=!1,Y=!1,H=!1,K=$,G="";Q:while(V<Q.length){let U=Q.charAt(V);if((U==="!"||U==="^")&&V===$+1){H=!0,V++;continue}if(U==="]"&&q&&!Y){K=V+1;break}if(q=!0,U==="\\"){if(!Y){Y=!0,V++;continue}}if(U==="["&&!Y){for(let[B,[C,M,w]]of Object.entries(TQ))if(Q.startsWith(B,V)){if(G)return["$.",!1,Q.length-$,!0];if(V+=B.length,w)J.push(C);else Z.push(C);_=_||M;continue Q}}if(Y=!1,G){if(U>G)Z.push(j0(G)+"-"+j0(U));else if(U===G)Z.push(j0(U));G="",V++;continue}if(Q.startsWith("-]",V+1)){Z.push(j0(U+"-")),V+=2;continue}if(Q.startsWith("-",V+1)){G=U,V+=2;continue}Z.push(j0(U)),V++}if(K<V)return["",!1,0,!1];if(!Z.length&&!J.length)return["$.",!1,Q.length-$,!0];if(J.length===0&&Z.length===1&&/^\\?.$/.test(Z[0])&&!H){let U=Z[0].length===2?Z[0].slice(-1):Z[0];return[bQ(U),!1,K-$,!1]}let W="["+(H?"^":"")+P8(Z)+"]",z="["+(H?"":"^")+P8(J)+"]";return[Z.length&&J.length?"("+W+"|"+z+")":Z.length?W:z,_,K-$,!0]};var g=(Q,{windowsPathsNoEscape:X=!1}={})=>{return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")};var uQ=new Set(["!","?","+","*","@"]),k8=(Q)=>uQ.has(Q),EQ="(?!(?:^|/)\\.\\.?(?:$|/))",P0="(?!\\.)",xQ=new Set(["[","."]),mQ=new Set(["..","."]),fQ=new Set("().*{}+?[]^$\\!"),yQ=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),s0="[^/]",S8=s0+"*?",T8=s0+"+?";class N{type;#Q;#X;#$=!1;#J=[];#q;#M;#U;#_=!1;#H;#Y;#K=!1;constructor(Q,X,$={}){if(this.type=Q,Q)this.#X=!0;if(this.#q=X,this.#Q=this.#q?this.#q.#Q:this,this.#H=this.#Q===this?$:this.#Q.#H,this.#U=this.#Q===this?[]:this.#Q.#U,Q==="!"&&!this.#Q.#_)this.#U.push(this);this.#M=this.#q?this.#q.#J.length:0}get hasMagic(){if(this.#X!==void 0)return this.#X;for(let Q of this.#J){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#X=!0}return this.#X}toString(){if(this.#Y!==void 0)return this.#Y;if(!this.type)return this.#Y=this.#J.map((Q)=>String(Q)).join("");else return this.#Y=this.type+"("+this.#J.map((Q)=>String(Q)).join("|")+")"}#Z(){if(this!==this.#Q)throw Error("should only call on root");if(this.#_)return this;this.toString(),this.#_=!0;let Q;while(Q=this.#U.pop()){if(Q.type!=="!")continue;let X=Q,$=X.#q;while($){for(let Z=X.#M+1;!$.type&&Z<$.#J.length;Z++)for(let J of Q.#J){if(typeof J==="string")throw Error("string part in extglob AST??");J.copyIn($.#J[Z])}X=$,$=X.#q}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof N&&X.#q===this))throw Error("invalid part: "+X);this.#J.push(X)}}toJSON(){let Q=this.type===null?this.#J.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#J.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#_&&this.#q?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#q?.isStart())return!1;if(this.#M===0)return!0;let Q=this.#q;for(let X=0;X<this.#M;X++){let $=Q.#J[X];if(!($ instanceof N&&$.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#q?.type==="!")return!0;if(!this.#q?.isEnd())return!1;if(!this.type)return this.#q?.isEnd();let Q=this.#q?this.#q.#J.length:0;return this.#M===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new N(this.type,Q);for(let $ of this.#J)X.copyIn($);return X}static#G(Q,X,$,Z){let J=!1,V=!1,q=-1,_=!1;if(X.type===null){let W=$,z="";while(W<Q.length){let j=Q.charAt(W++);if(J||j==="\\"){J=!J,z+=j;continue}if(V){if(W===q+1){if(j==="^"||j==="!")_=!0}else if(j==="]"&&!(W===q+2&&_))V=!1;z+=j;continue}else if(j==="["){V=!0,q=W,_=!1,z+=j;continue}if(!Z.noext&&k8(j)&&Q.charAt(W)==="("){X.push(z),z="";let U=new N(j,X);W=N.#G(Q,U,W,Z),X.push(U);continue}z+=j}return X.push(z),W}let Y=$+1,H=new N(null,X),K=[],G="";while(Y<Q.length){let W=Q.charAt(Y++);if(J||W==="\\"){J=!J,G+=W;continue}if(V){if(Y===q+1){if(W==="^"||W==="!")_=!0}else if(W==="]"&&!(Y===q+2&&_))V=!1;G+=W;continue}else if(W==="["){V=!0,q=Y,_=!1,G+=W;continue}if(k8(W)&&Q.charAt(Y)==="("){H.push(G),G="";let z=new N(W,H);H.push(z),Y=N.#G(Q,z,Y,Z);continue}if(W==="|"){H.push(G),G="",K.push(H),H=new N(null,X);continue}if(W===")"){if(G===""&&X.#J.length===0)X.#K=!0;return H.push(G),G="",X.push(...K,H),Y}G+=W}return X.type=null,X.#X=void 0,X.#J=[Q.substring($-1)],Y}static fromGlob(Q,X={}){let $=new N(null,void 0,X);return N.#G(Q,$,0,X),$}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,$,Z,J]=this.toRegExpSource();if(!(Z||this.#X||this.#H.nocase&&!this.#H.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return $;let q=(this.#H.nocase?"i":"")+(J?"u":"");return Object.assign(new RegExp(`^${X}$`,q),{_src:X,_glob:Q})}get options(){return this.#H}toRegExpSource(Q){let X=Q??!!this.#H.dot;if(this.#Q===this)this.#Z();if(!this.type){let _=this.isStart()&&this.isEnd(),Y=this.#J.map((W)=>{let[z,j,U,B]=typeof W==="string"?N.#j(W,this.#X,_):W.toRegExpSource(Q);return this.#X=this.#X||U,this.#$=this.#$||B,z}).join(""),H="";if(this.isStart()){if(typeof this.#J[0]==="string"){if(!(this.#J.length===1&&mQ.has(this.#J[0]))){let z=xQ,j=X&&z.has(Y.charAt(0))||Y.startsWith("\\.")&&z.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&z.has(Y.charAt(4)),U=!X&&!Q&&z.has(Y.charAt(0));H=j?EQ:U?P0:""}}}let K="";if(this.isEnd()&&this.#Q.#_&&this.#q?.type==="!")K="(?:$|\\/)";return[H+Y+K,g(Y),this.#X=!!this.#X,this.#$]}let $=this.type==="*"||this.type==="+",Z=this.type==="!"?"(?:(?!(?:":"(?:",J=this.#B(X);if(this.isStart()&&this.isEnd()&&!J&&this.type!=="!"){let _=this.toString();return this.#J=[_],this.type=null,this.#X=void 0,[_,g(this.toString()),!1,!1]}let V=!$||Q||X||!P0?"":this.#B(!0);if(V===J)V="";if(V)J=`(?:${J})(?:${V})*?`;let q="";if(this.type==="!"&&this.#K)q=(this.isStart()&&!X?P0:"")+T8;else{let _=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?P0:"")+S8+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&V?")":this.type==="*"&&V?")?":`)${this.type}`;q=Z+J+_}return[q,g(J),this.#X=!!this.#X,this.#$]}#B(Q){return this.#J.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[$,Z,J,V]=X.toRegExpSource(Q);return this.#$=this.#$||V,$}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#j(Q,X,$=!1){let Z=!1,J="",V=!1;for(let q=0;q<Q.length;q++){let _=Q.charAt(q);if(Z){Z=!1,J+=(fQ.has(_)?"\\":"")+_;continue}if(_==="\\"){if(q===Q.length-1)J+="\\\\";else Z=!0;continue}if(_==="["){let[Y,H,K,G]=D8(Q,q);if(K){J+=Y,V=V||H,q+=K-1,X=X||G;continue}}if(_==="*"){if($&&Q==="*")J+=T8;else J+=S8;X=!0;continue}if(_==="?"){J+=s0,X=!0;continue}J+=yQ(_)}return[J,g(Q),!!X,V]}}var V0=(Q,{windowsPathsNoEscape:X=!1}={})=>{return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var k=(Q,X,$={})=>{if(G0(X),!$.nocomment&&X.charAt(0)==="#")return!1;return new x(X,$).match(Q)},hQ=/^\*+([^+@!?\*\[\(]*)$/,dQ=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),cQ=(Q)=>(X)=>X.endsWith(Q),lQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},oQ=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},pQ=/^\*+\.\*+$/,iQ=(Q)=>!Q.startsWith(".")&&Q.includes("."),nQ=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),rQ=/^\.\*+$/,aQ=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),sQ=/^\*+$/,eQ=(Q)=>Q.length!==0&&!Q.startsWith("."),tQ=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",QX=/^\?+([^+@!?\*\[\(]*)?$/,XX=([Q,X=""])=>{let $=x8([Q]);if(!X)return $;return X=X.toLowerCase(),(Z)=>$(Z)&&Z.toLowerCase().endsWith(X)},$X=([Q,X=""])=>{let $=m8([Q]);if(!X)return $;return X=X.toLowerCase(),(Z)=>$(Z)&&Z.toLowerCase().endsWith(X)},ZX=([Q,X=""])=>{let $=m8([Q]);return!X?$:(Z)=>$(Z)&&Z.endsWith(X)},JX=([Q,X=""])=>{let $=x8([Q]);return!X?$:(Z)=>$(Z)&&Z.endsWith(X)},x8=([Q])=>{let X=Q.length;return($)=>$.length===X&&!$.startsWith(".")},m8=([Q])=>{let X=Q.length;return($)=>$.length===X&&$!=="."&&$!==".."},f8=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",b8={win32:{sep:"\\"},posix:{sep:"/"}},VX=f8==="win32"?b8.win32.sep:b8.posix.sep;k.sep=VX;var v=Symbol("globstar **");k.GLOBSTAR=v;var qX="[^/]",_X=qX+"*?",YX="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",KX="(?:(?!(?:\\/|^)\\.).)*?",HX=(Q,X={})=>($)=>k($,Q,X);k.filter=HX;var E=(Q,X={})=>Object.assign({},Q,X),WX=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return k;let X=k;return Object.assign((Z,J,V={})=>X(Z,J,E(Q,V)),{Minimatch:class extends X.Minimatch{constructor(J,V={}){super(J,E(Q,V))}static defaults(J){return X.defaults(E(Q,J)).Minimatch}},AST:class extends X.AST{constructor(J,V,q={}){super(J,V,E(Q,q))}static fromGlob(J,V={}){return X.AST.fromGlob(J,E(Q,V))}},unescape:(Z,J={})=>X.unescape(Z,E(Q,J)),escape:(Z,J={})=>X.escape(Z,E(Q,J)),filter:(Z,J={})=>X.filter(Z,E(Q,J)),defaults:(Z)=>X.defaults(E(Q,Z)),makeRe:(Z,J={})=>X.makeRe(Z,E(Q,J)),braceExpand:(Z,J={})=>X.braceExpand(Z,E(Q,J)),match:(Z,J,V={})=>X.match(Z,J,E(Q,V)),sep:X.sep,GLOBSTAR:v})};k.defaults=WX;var y8=(Q,X={})=>{if(G0(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return E8.default(Q)};k.braceExpand=y8;var GX=(Q,X={})=>new x(Q,X).makeRe();k.makeRe=GX;var jX=(Q,X,$={})=>{let Z=new x(X,$);if(Q=Q.filter((J)=>Z.match(J)),Z.options.nonull&&!Q.length)Q.push(X);return Q};k.match=jX;var u8=/[?*]|[+@!]\(.*?\)|\[|\]/,zX=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class x{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Q,X={}){if(G0(Q),X=X||{},this.options=X,this.pattern=Q,this.platform=X.platform||f8,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.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 Q of this.set)for(let X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...J)=>console.error(...J);this.debug(this.pattern,this.globSet);let $=this.globSet.map((J)=>this.slashSplit(J));this.globParts=this.preprocess($),this.debug(this.pattern,this.globParts);let Z=this.globParts.map((J,V,q)=>{if(this.isWindows&&this.windowsNoMagicRoot){let _=J[0]===""&&J[1]===""&&(J[2]==="?"||!u8.test(J[2]))&&!u8.test(J[3]),Y=/^[a-z]:/i.test(J[0]);if(_)return[...J.slice(0,4),...J.slice(4).map((H)=>this.parse(H))];else if(Y)return[J[0],...J.slice(1).map((H)=>this.parse(H))]}return J.map((_)=>this.parse(_))});if(this.debug(this.pattern,Z),this.set=Z.filter((J)=>J.indexOf(!1)===-1),this.isWindows)for(let J=0;J<this.set.length;J++){let V=this.set[J];if(V[0]===""&&V[1]===""&&this.globParts[J][2]==="?"&&typeof V[3]==="string"&&/^[a-z]:$/i.test(V[3]))V[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let $=0;$<Q.length;$++)for(let Z=0;Z<Q[$].length;Z++)if(Q[$][Z]==="**")Q[$][Z]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let $=-1;while(($=X.indexOf("**",$+1))!==-1){let Z=$;while(X[Z+1]==="**")Z++;if(Z!==$)X.splice($,Z-$)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce(($,Z)=>{let J=$[$.length-1];if(Z==="**"&&J==="**")return $;if(Z===".."){if(J&&J!==".."&&J!=="."&&J!=="**")return $.pop(),$}return $.push(Z),$},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let Z=1;Z<Q.length-1;Z++){let J=Q[Z];if(Z===1&&J===""&&Q[0]==="")continue;if(J==="."||J==="")X=!0,Q.splice(Z,1),Z--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let $=0;while(($=Q.indexOf("..",$+1))!==-1){let Z=Q[$-1];if(Z&&Z!=="."&&Z!==".."&&Z!=="**")X=!0,Q.splice($-1,2),$-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let $ of Q){let Z=-1;while((Z=$.indexOf("**",Z+1))!==-1){let V=Z;while($[V+1]==="**")V++;if(V>Z)$.splice(Z+1,V-Z);let q=$[Z+1],_=$[Z+2],Y=$[Z+3];if(q!=="..")continue;if(!_||_==="."||_===".."||!Y||Y==="."||Y==="..")continue;X=!0,$.splice(Z,1);let H=$.slice(0);H[Z]="**",Q.push(H),Z--}if(!this.preserveMultipleSlashes){for(let V=1;V<$.length-1;V++){let q=$[V];if(V===1&&q===""&&$[0]==="")continue;if(q==="."||q==="")X=!0,$.splice(V,1),V--}if($[0]==="."&&$.length===2&&($[1]==="."||$[1]===""))X=!0,$.pop()}let J=0;while((J=$.indexOf("..",J+1))!==-1){let V=$[J-1];if(V&&V!=="."&&V!==".."&&V!=="**"){X=!0;let _=J===1&&$[J+1]==="**"?["."]:[];if($.splice(J-1,2,..._),$.length===0)$.push("");J-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let $=X+1;$<Q.length;$++){let Z=this.partsMatch(Q[X],Q[$],!this.preserveMultipleSlashes);if(Z){Q[X]=[],Q[$]=Z;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,$=!1){let Z=0,J=0,V=[],q="";while(Z<Q.length&&J<X.length)if(Q[Z]===X[J])V.push(q==="b"?X[J]:Q[Z]),Z++,J++;else if($&&Q[Z]==="**"&&X[J]===Q[Z+1])V.push(Q[Z]),Z++;else if($&&X[J]==="**"&&Q[Z]===X[J+1])V.push(X[J]),J++;else if(Q[Z]==="*"&&X[J]&&(this.options.dot||!X[J].startsWith("."))&&X[J]!=="**"){if(q==="b")return!1;q="a",V.push(Q[Z]),Z++,J++}else if(X[J]==="*"&&Q[Z]&&(this.options.dot||!Q[Z].startsWith("."))&&Q[Z]!=="**"){if(q==="a")return!1;q="b",V.push(X[J]),Z++,J++}else return!1;return Q.length===X.length&&V}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,$=0;for(let Z=0;Z<Q.length&&Q.charAt(Z)==="!";Z++)X=!X,$++;if($)this.pattern=Q.slice($);this.negate=X}matchOne(Q,X,$=!1){let Z=this.options;if(this.isWindows){let j=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),U=!j&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),B=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),C=!B&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),M=U?3:j?0:void 0,w=C?3:B?0:void 0;if(typeof M==="number"&&typeof w==="number"){let[R,b]=[Q[M],X[w]];if(R.toLowerCase()===b.toLowerCase()){if(X[w]=R,w>M)X=X.slice(w);else if(M>w)Q=Q.slice(M)}}}let{optimizationLevel:J=1}=this.options;if(J>=2)Q=this.levelTwoFileOptimize(Q);this.debug("matchOne",this,{file:Q,pattern:X}),this.debug("matchOne",Q.length,X.length);for(var V=0,q=0,_=Q.length,Y=X.length;V<_&&q<Y;V++,q++){this.debug("matchOne loop");var H=X[q],K=Q[V];if(this.debug(X,H,K),H===!1)return!1;if(H===v){this.debug("GLOBSTAR",[X,H,K]);var G=V,W=q+1;if(W===Y){this.debug("** at the end");for(;V<_;V++)if(Q[V]==="."||Q[V]===".."||!Z.dot&&Q[V].charAt(0)===".")return!1;return!0}while(G<_){var z=Q[G];if(this.debug(`
|
|
2
2
|
globstar while`,Q,G,X,W,z),this.matchOne(Q.slice(G),X.slice(W),$))return this.debug("globstar found match!",G,_,z),!0;else{if(z==="."||z===".."||!Z.dot&&z.charAt(0)==="."){this.debug("dot detected!",Q,G,X,W);break}this.debug("globstar swallow a segment, and continue"),G++}}if($){if(this.debug(`
|
|
3
|
-
>>> no match, partial?`,Q,G,X,W),G===_)return!0}return!1}let j;if(typeof H==="string")j=K===H,this.debug("string match",H,K,j);else j=H.test(K),this.debug("pattern match",H,K,j);if(!j)return!1}if(V===_&&q===Y)return!0;else if(V===_)return $;else if(q===Y)return V===_-1&&Q[V]==="";else throw Error("wtf?")}braceExpand(){return y8(this.pattern,this.options)}parse(Q){G0(Q);let X=this.options;if(Q==="**")return v;if(Q==="")return"";let $,Z=null;if($=Q.match(sQ))Z=X.dot?tQ:eQ;else if($=Q.match(hQ))Z=(X.nocase?X.dot?oQ:lQ:X.dot?cQ:dQ)($[1]);else if($=Q.match(QX))Z=(X.nocase?X.dot?$X:XX:X.dot?ZX:JX)($);else if($=Q.match(pQ))Z=X.dot?nQ:iQ;else if($=Q.match(rQ))Z=aQ;let J=N.fromGlob(Q,this.options).toMMPattern();if(Z&&typeof J==="object")Reflect.defineProperty(J,"test",{value:Z});return J}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,$=X.noglobstar?_X:X.dot?YX:KX,Z=new Set(X.nocase?["i"]:[]),J=Q.map((_)=>{let Y=_.map((H)=>{if(H instanceof RegExp)for(let K of H.flags.split(""))Z.add(K);return typeof H==="string"?zX(H):H===v?v:H._src});return Y.forEach((H,K)=>{let G=Y[K+1],W=Y[K-1];if(H!==v||W===v)return;if(W===void 0)if(G!==void 0&&G!==v)Y[K+1]="(?:\\/|"+$+"\\/)?"+G;else Y[K]=$;else if(G===void 0)Y[K-1]=W+"(?:\\/|"+$+")?";else if(G!==v)Y[K-1]=W+"(?:\\/|\\/"+$+"\\/)"+G,Y[K+1]=v}),Y.filter((H)=>H!==v).join("/")}).join("|"),[V,q]=Q.length>1?["(?:",")"]:["",""];if(J="^"+V+J+q+"$",this.negate)J="^(?!"+J+").+$";try{this.regexp=new RegExp(J,[...Z].join(""))}catch(_){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let $=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let Z=this.slashSplit(Q);this.debug(this.pattern,"split",Z);let J=this.set;this.debug(this.pattern,"set",J);let V=Z[Z.length-1];if(!V)for(let q=Z.length-2;!V&&q>=0;q--)V=Z[q];for(let q=0;q<J.length;q++){let _=J[q],Y=Z;if($.matchBase&&_.length===1)Y=[V];if(this.matchOne(Y,_,X)){if($.flipNegate)return!0;return!this.negate}}if($.flipNegate)return!1;return this.negate}static defaults(Q){return k.defaults(Q).Minimatch}}k.AST=N;k.Minimatch=x;k.escape=V0;k.unescape=g;import{fileURLToPath as pX}from"node:url";var q0=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,h8=new Set,e0=typeof process==="object"&&!!process?process:{},d8=(Q,X,$,Z)=>{typeof e0.emitWarning==="function"?e0.emitWarning(Q,X,$,Z):console.error(`[${$}] ${X}: ${Q}`)},D0=globalThis.AbortController,g8=globalThis.AbortSignal;if(typeof D0>"u"){g8=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,J){this._onabort.push(J)}},D0=class{constructor(){X()}signal=new g8;abort(Z){if(this.signal.aborted)return;this.signal.reason=Z,this.signal.aborted=!0;for(let J of this.signal._onabort)J(Z);this.signal.onabort?.(Z)}};let Q=e0.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{if(!Q)return;Q=!1,d8("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",X)}}var UX=(Q)=>!h8.has(Q),O5=Symbol("type"),r=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),c8=(Q)=>!r(Q)?null:Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?z0:null;class z0 extends Array{constructor(Q){super(Q);this.fill(0)}}class _0{heap;length;static#Q=!1;static create(Q){let X=c8(Q);if(!X)return[];_0.#Q=!0;let $=new _0(Q,X);return _0.#Q=!1,$}constructor(Q,X){if(!_0.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new X(Q),this.length=0}push(Q){this.heap[this.length++]=Q}pop(){return this.heap[--this.length]}}class U0{#Q;#X;#$;#J;#q;#M;#U;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#_;#H;#Y;#K;#Z;#G;#B;#j;#z;#w;#R;#P;#L;#I;#A;#N;#C;#k;static unsafeExposeInternals(Q){return{starts:Q.#L,ttls:Q.#I,sizes:Q.#P,keyMap:Q.#Y,keyList:Q.#K,valList:Q.#Z,next:Q.#G,prev:Q.#B,get head(){return Q.#j},get tail(){return Q.#z},free:Q.#w,isBackgroundFetch:(X)=>Q.#W(X),backgroundFetch:(X,$,Z,J)=>Q.#E(X,$,Z,J),moveToTail:(X)=>Q.#f(X),indexes:(X)=>Q.#v(X),rindexes:(X)=>Q.#D(X),isStale:(X)=>Q.#F(X)}}get max(){return this.#Q}get maxSize(){return this.#X}get calculatedSize(){return this.#H}get size(){return this.#_}get fetchMethod(){return this.#M}get memoMethod(){return this.#U}get dispose(){return this.#$}get onInsert(){return this.#J}get disposeAfter(){return this.#q}constructor(Q){let{max:X=0,ttl:$,ttlResolution:Z=1,ttlAutopurge:J,updateAgeOnGet:V,updateAgeOnHas:q,allowStale:_,dispose:Y,onInsert:H,disposeAfter:K,noDisposeOnSet:G,noUpdateTTL:W,maxSize:z=0,maxEntrySize:j=0,sizeCalculation:U,fetchMethod:B,memoMethod:C,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:b,ignoreFetchAbort:F}=Q;if(X!==0&&!r(X))throw TypeError("max option must be a nonnegative integer");let e=X?c8(X):Array;if(!e)throw Error("invalid max value: "+X);if(this.#Q=X,this.#X=z,this.maxEntrySize=j||this.#X,this.sizeCalculation=U,this.sizeCalculation){if(!this.#X&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#U=C,B!==void 0&&typeof B!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#M=B,this.#N=!!B,this.#Y=new Map,this.#K=Array(X).fill(void 0),this.#Z=Array(X).fill(void 0),this.#G=new e(X),this.#B=new e(X),this.#j=0,this.#z=0,this.#w=_0.create(X),this.#_=0,this.#H=0,typeof Y==="function")this.#$=Y;if(typeof H==="function")this.#J=H;if(typeof K==="function")this.#q=K,this.#R=[];else this.#q=void 0,this.#R=void 0;if(this.#A=!!this.#$,this.#k=!!this.#J,this.#C=!!this.#q,this.noDisposeOnSet=!!G,this.noUpdateTTL=!!W,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!F,this.maxEntrySize!==0){if(this.#X!==0){if(!r(this.#X))throw TypeError("maxSize must be a positive integer if specified")}if(!r(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#g()}if(this.allowStale=!!_,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!V,this.updateAgeOnHas=!!q,this.ttlResolution=r(Z)||Z===0?Z:1,this.ttlAutopurge=!!J,this.ttl=$||0,this.ttl){if(!r(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#V()}if(this.#Q===0&&this.ttl===0&&this.#X===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#X){if(UX("LRU_CACHE_UNBOUNDED"))h8.add("LRU_CACHE_UNBOUNDED"),d8("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",U0)}}getRemainingTTL(Q){return this.#Y.has(Q)?1/0:0}#V(){let Q=new z0(this.#Q),X=new z0(this.#Q);this.#I=Q,this.#L=X,this.#S=(J,V,q=q0.now())=>{if(X[J]=V!==0?q:0,Q[J]=V,V!==0&&this.ttlAutopurge){let _=setTimeout(()=>{if(this.#F(J))this.#T(this.#K[J],"expire")},V+1);if(_.unref)_.unref()}},this.#b=(J)=>{X[J]=Q[J]!==0?q0.now():0},this.#O=(J,V)=>{if(Q[V]){let q=Q[V],_=X[V];if(!q||!_)return;J.ttl=q,J.start=_,J.now=$||Z();let Y=J.now-_;J.remainingTTL=q-Y}};let $=0,Z=()=>{let J=q0.now();if(this.ttlResolution>0){$=J;let V=setTimeout(()=>$=0,this.ttlResolution);if(V.unref)V.unref()}return J};this.getRemainingTTL=(J)=>{let V=this.#Y.get(J);if(V===void 0)return 0;let q=Q[V],_=X[V];if(!q||!_)return 1/0;let Y=($||Z())-_;return q-Y},this.#F=(J)=>{let V=X[J],q=Q[J];return!!q&&!!V&&($||Z())-V>q}}#b=()=>{};#O=()=>{};#S=()=>{};#F=()=>!1;#g(){let Q=new z0(this.#Q);this.#H=0,this.#P=Q,this.#u=(X)=>{this.#H-=Q[X],Q[X]=0},this.#h=(X,$,Z,J)=>{if(this.#W($))return 0;if(!r(Z))if(J){if(typeof J!=="function")throw TypeError("sizeCalculation must be a function");if(Z=J($,X),!r(Z))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Z},this.#x=(X,$,Z)=>{if(Q[X]=$,this.#X){let J=this.#X-Q[X];while(this.#H>J)this.#m(!0)}if(this.#H+=Q[X],Z)Z.entrySize=$,Z.totalCalculatedSize=this.#H}}#u=(Q)=>{};#x=(Q,X,$)=>{};#h=(Q,X,$,Z)=>{if($||Z)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#v({allowStale:Q=this.allowStale}={}){if(this.#_)for(let X=this.#z;;){if(!this.#d(X))break;if(Q||!this.#F(X))yield X;if(X===this.#j)break;else X=this.#B[X]}}*#D({allowStale:Q=this.allowStale}={}){if(this.#_)for(let X=this.#j;;){if(!this.#d(X))break;if(Q||!this.#F(X))yield X;if(X===this.#z)break;else X=this.#G[X]}}#d(Q){return Q!==void 0&&this.#Y.get(this.#K[Q])===Q}*entries(){for(let Q of this.#v())if(this.#Z[Q]!==void 0&&this.#K[Q]!==void 0&&!this.#W(this.#Z[Q]))yield[this.#K[Q],this.#Z[Q]]}*rentries(){for(let Q of this.#D())if(this.#Z[Q]!==void 0&&this.#K[Q]!==void 0&&!this.#W(this.#Z[Q]))yield[this.#K[Q],this.#Z[Q]]}*keys(){for(let Q of this.#v()){let X=this.#K[Q];if(X!==void 0&&!this.#W(this.#Z[Q]))yield X}}*rkeys(){for(let Q of this.#D()){let X=this.#K[Q];if(X!==void 0&&!this.#W(this.#Z[Q]))yield X}}*values(){for(let Q of this.#v())if(this.#Z[Q]!==void 0&&!this.#W(this.#Z[Q]))yield this.#Z[Q]}*rvalues(){for(let Q of this.#D())if(this.#Z[Q]!==void 0&&!this.#W(this.#Z[Q]))yield this.#Z[Q]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Q,X={}){for(let $ of this.#v()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;if(Q(J,this.#K[$],this))return this.get(this.#K[$],X)}}forEach(Q,X=this){for(let $ of this.#v()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;Q.call(X,J,this.#K[$],this)}}rforEach(Q,X=this){for(let $ of this.#D()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;Q.call(X,J,this.#K[$],this)}}purgeStale(){let Q=!1;for(let X of this.#D({allowStale:!0}))if(this.#F(X))this.#T(this.#K[X],"expire"),Q=!0;return Q}info(Q){let X=this.#Y.get(Q);if(X===void 0)return;let $=this.#Z[X],Z=this.#W($)?$.__staleWhileFetching:$;if(Z===void 0)return;let J={value:Z};if(this.#I&&this.#L){let V=this.#I[X],q=this.#L[X];if(V&&q){let _=V-(q0.now()-q);J.ttl=_,J.start=Date.now()}}if(this.#P)J.size=this.#P[X];return J}dump(){let Q=[];for(let X of this.#v({allowStale:!0})){let $=this.#K[X],Z=this.#Z[X],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0||$===void 0)continue;let V={value:J};if(this.#I&&this.#L){V.ttl=this.#I[X];let q=q0.now()-this.#L[X];V.start=Math.floor(Date.now()-q)}if(this.#P)V.size=this.#P[X];Q.unshift([$,V])}return Q}load(Q){this.clear();for(let[X,$]of Q){if($.start){let Z=Date.now()-$.start;$.start=q0.now()-Z}this.set(X,$.value,$)}}set(Q,X,$={}){if(X===void 0)return this.delete(Q),this;let{ttl:Z=this.ttl,start:J,noDisposeOnSet:V=this.noDisposeOnSet,sizeCalculation:q=this.sizeCalculation,status:_}=$,{noUpdateTTL:Y=this.noUpdateTTL}=$,H=this.#h(Q,X,$.size||0,q);if(this.maxEntrySize&&H>this.maxEntrySize){if(_)_.set="miss",_.maxEntrySizeExceeded=!0;return this.#T(Q,"set"),this}let K=this.#_===0?void 0:this.#Y.get(Q);if(K===void 0){if(K=this.#_===0?this.#z:this.#w.length!==0?this.#w.pop():this.#_===this.#Q?this.#m(!1):this.#_,this.#K[K]=Q,this.#Z[K]=X,this.#Y.set(Q,K),this.#G[this.#z]=K,this.#B[K]=this.#z,this.#z=K,this.#_++,this.#x(K,H,_),_)_.set="add";if(Y=!1,this.#k)this.#J?.(X,Q,"add")}else{this.#f(K);let G=this.#Z[K];if(X!==G){if(this.#N&&this.#W(G)){G.__abortController.abort(Error("replaced"));let{__staleWhileFetching:W}=G;if(W!==void 0&&!V){if(this.#A)this.#$?.(W,Q,"set");if(this.#C)this.#R?.push([W,Q,"set"])}}else if(!V){if(this.#A)this.#$?.(G,Q,"set");if(this.#C)this.#R?.push([G,Q,"set"])}if(this.#u(K),this.#x(K,H,_),this.#Z[K]=X,_){_.set="replace";let W=G&&this.#W(G)?G.__staleWhileFetching:G;if(W!==void 0)_.oldValue=W}}else if(_)_.set="update";if(this.#k)this.onInsert?.(X,Q,X===G?"update":"replace")}if(Z!==0&&!this.#I)this.#V();if(this.#I){if(!Y)this.#S(K,Z,J);if(_)this.#O(_,K)}if(!V&&this.#C&&this.#R){let G=this.#R,W;while(W=G?.shift())this.#q?.(...W)}return this}pop(){try{while(this.#_){let Q=this.#Z[this.#j];if(this.#m(!0),this.#W(Q)){if(Q.__staleWhileFetching)return Q.__staleWhileFetching}else if(Q!==void 0)return Q}}finally{if(this.#C&&this.#R){let Q=this.#R,X;while(X=Q?.shift())this.#q?.(...X)}}}#m(Q){let X=this.#j,$=this.#K[X],Z=this.#Z[X];if(this.#N&&this.#W(Z))Z.__abortController.abort(Error("evicted"));else if(this.#A||this.#C){if(this.#A)this.#$?.(Z,$,"evict");if(this.#C)this.#R?.push([Z,$,"evict"])}if(this.#u(X),Q)this.#K[X]=void 0,this.#Z[X]=void 0,this.#w.push(X);if(this.#_===1)this.#j=this.#z=0,this.#w.length=0;else this.#j=this.#G[X];return this.#Y.delete($),this.#_--,X}has(Q,X={}){let{updateAgeOnHas:$=this.updateAgeOnHas,status:Z}=X,J=this.#Y.get(Q);if(J!==void 0){let V=this.#Z[J];if(this.#W(V)&&V.__staleWhileFetching===void 0)return!1;if(!this.#F(J)){if($)this.#b(J);if(Z)Z.has="hit",this.#O(Z,J);return!0}else if(Z)Z.has="stale",this.#O(Z,J)}else if(Z)Z.has="miss";return!1}peek(Q,X={}){let{allowStale:$=this.allowStale}=X,Z=this.#Y.get(Q);if(Z===void 0||!$&&this.#F(Z))return;let J=this.#Z[Z];return this.#W(J)?J.__staleWhileFetching:J}#E(Q,X,$,Z){let J=X===void 0?void 0:this.#Z[X];if(this.#W(J))return J;let V=new D0,{signal:q}=$;q?.addEventListener("abort",()=>V.abort(q.reason),{signal:V.signal});let _={signal:V.signal,options:$,context:Z},Y=(j,U=!1)=>{let{aborted:B}=V.signal,C=$.ignoreFetchAbort&&j!==void 0;if($.status)if(B&&!U){if($.status.fetchAborted=!0,$.status.fetchError=V.signal.reason,C)$.status.fetchAbortIgnored=!0}else $.status.fetchResolved=!0;if(B&&!C&&!U)return K(V.signal.reason);let M=W;if(this.#Z[X]===W)if(j===void 0)if(M.__staleWhileFetching)this.#Z[X]=M.__staleWhileFetching;else this.#T(Q,"fetch");else{if($.status)$.status.fetchUpdated=!0;this.set(Q,j,_.options)}return j},H=(j)=>{if($.status)$.status.fetchRejected=!0,$.status.fetchError=j;return K(j)},K=(j)=>{let{aborted:U}=V.signal,B=U&&$.allowStaleOnFetchAbort,C=B||$.allowStaleOnFetchRejection,M=C||$.noDeleteOnFetchRejection,w=W;if(this.#Z[X]===W){if(!M||w.__staleWhileFetching===void 0)this.#T(Q,"fetch");else if(!B)this.#Z[X]=w.__staleWhileFetching}if(C){if($.status&&w.__staleWhileFetching!==void 0)$.status.returnedStale=!0;return w.__staleWhileFetching}else if(w.__returned===w)throw j},G=(j,U)=>{let B=this.#M?.(Q,J,_);if(B&&B instanceof Promise)B.then((C)=>j(C===void 0?void 0:C),U);V.signal.addEventListener("abort",()=>{if(!$.ignoreFetchAbort||$.allowStaleOnFetchAbort){if(j(void 0),$.allowStaleOnFetchAbort)j=(C)=>Y(C,!0)}})};if($.status)$.status.fetchDispatched=!0;let W=new Promise(G).then(Y,H),z=Object.assign(W,{__abortController:V,__staleWhileFetching:J,__returned:void 0});if(X===void 0)this.set(Q,z,{..._.options,status:void 0}),X=this.#Y.get(Q);else this.#Z[X]=z;return z}#W(Q){if(!this.#N)return!1;let X=Q;return!!X&&X instanceof Promise&&X.hasOwnProperty("__staleWhileFetching")&&X.__abortController instanceof D0}async fetch(Q,X={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Z=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,ttl:V=this.ttl,noDisposeOnSet:q=this.noDisposeOnSet,size:_=0,sizeCalculation:Y=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:K=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:G=this.allowStaleOnFetchRejection,ignoreFetchAbort:W=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:j,forceRefresh:U=!1,status:B,signal:C}=X;if(!this.#N){if(B)B.fetch="get";return this.get(Q,{allowStale:$,updateAgeOnGet:Z,noDeleteOnStaleGet:J,status:B})}let M={allowStale:$,updateAgeOnGet:Z,noDeleteOnStaleGet:J,ttl:V,noDisposeOnSet:q,size:_,sizeCalculation:Y,noUpdateTTL:H,noDeleteOnFetchRejection:K,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:z,ignoreFetchAbort:W,status:B,signal:C},w=this.#Y.get(Q);if(w===void 0){if(B)B.fetch="miss";let R=this.#E(Q,w,M,j);return R.__returned=R}else{let R=this.#Z[w];if(this.#W(R)){let y=$&&R.__staleWhileFetching!==void 0;if(B){if(B.fetch="inflight",y)B.returnedStale=!0}return y?R.__staleWhileFetching:R.__returned=R}let b=this.#F(w);if(!U&&!b){if(B)B.fetch="hit";if(this.#f(w),Z)this.#b(w);if(B)this.#O(B,w);return R}let F=this.#E(Q,w,M,j),J0=F.__staleWhileFetching!==void 0&&$;if(B){if(B.fetch=b?"stale":"refresh",J0&&b)B.returnedStale=!0}return J0?F.__staleWhileFetching:F.__returned=F}}async forceFetch(Q,X={}){let $=await this.fetch(Q,X);if($===void 0)throw Error("fetch() returned undefined");return $}memo(Q,X={}){let $=this.#U;if(!$)throw Error("no memoMethod provided to constructor");let{context:Z,forceRefresh:J,...V}=X,q=this.get(Q,V);if(!J&&q!==void 0)return q;let _=$(Q,q,{options:V,context:Z});return this.set(Q,_,V),_}get(Q,X={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Z=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,status:V}=X,q=this.#Y.get(Q);if(q!==void 0){let _=this.#Z[q],Y=this.#W(_);if(V)this.#O(V,q);if(this.#F(q)){if(V)V.get="stale";if(!Y){if(!J)this.#T(Q,"expire");if(V&&$)V.returnedStale=!0;return $?_:void 0}else{if(V&&$&&_.__staleWhileFetching!==void 0)V.returnedStale=!0;return $?_.__staleWhileFetching:void 0}}else{if(V)V.get="hit";if(Y)return _.__staleWhileFetching;if(this.#f(q),Z)this.#b(q);return _}}else if(V)V.get="miss"}#c(Q,X){this.#B[X]=Q,this.#G[Q]=X}#f(Q){if(Q!==this.#z){if(Q===this.#j)this.#j=this.#G[Q];else this.#c(this.#B[Q],this.#G[Q]);this.#c(this.#z,Q),this.#z=Q}}delete(Q){return this.#T(Q,"delete")}#T(Q,X){let $=!1;if(this.#_!==0){let Z=this.#Y.get(Q);if(Z!==void 0)if($=!0,this.#_===1)this.#y(X);else{this.#u(Z);let J=this.#Z[Z];if(this.#W(J))J.__abortController.abort(Error("deleted"));else if(this.#A||this.#C){if(this.#A)this.#$?.(J,Q,X);if(this.#C)this.#R?.push([J,Q,X])}if(this.#Y.delete(Q),this.#K[Z]=void 0,this.#Z[Z]=void 0,Z===this.#z)this.#z=this.#B[Z];else if(Z===this.#j)this.#j=this.#G[Z];else{let V=this.#B[Z];this.#G[V]=this.#G[Z];let q=this.#G[Z];this.#B[q]=this.#B[Z]}this.#_--,this.#w.push(Z)}}if(this.#C&&this.#R?.length){let Z=this.#R,J;while(J=Z?.shift())this.#q?.(...J)}return $}clear(){return this.#y("delete")}#y(Q){for(let X of this.#D({allowStale:!0})){let $=this.#Z[X];if(this.#W($))$.__abortController.abort(Error("deleted"));else{let Z=this.#K[X];if(this.#A)this.#$?.($,Z,Q);if(this.#C)this.#R?.push([$,Z,Q])}}if(this.#Y.clear(),this.#Z.fill(void 0),this.#K.fill(void 0),this.#I&&this.#L)this.#I.fill(0),this.#L.fill(0);if(this.#P)this.#P.fill(0);if(this.#j=0,this.#z=0,this.#w.length=0,this.#H=0,this.#_=0,this.#C&&this.#R){let X=this.#R,$;while($=X?.shift())this.#q?.(...$)}}}import{posix as NX,win32 as Y8}from"node:path";import{fileURLToPath as vX}from"node:url";import{lstatSync as PX,readdir as DX,readdirSync as kX,readlinkSync as SX,realpathSync as TX}from"fs";import*as bX from"node:fs";import{lstat as EX,readdir as xX,readlink as mX,realpath as fX}from"node:fs/promises";import{EventEmitter as J8}from"node:events";import n8 from"node:stream";import{StringDecoder as BX}from"node:string_decoder";var l8=typeof process==="object"&&process?process:{stdout:null,stderr:null},wX=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof Q0||Q instanceof n8||CX(Q)||MX(Q)),CX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof J8&&typeof Q.pipe==="function"&&Q.pipe!==n8.Writable.prototype.pipe,MX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof J8&&typeof Q.write==="function"&&typeof Q.end==="function",i=Symbol("EOF"),n=Symbol("maybeEmitEnd"),a=Symbol("emittedEnd"),k0=Symbol("emittingEnd"),B0=Symbol("emittedError"),S0=Symbol("closed"),o8=Symbol("read"),T0=Symbol("flush"),p8=Symbol("flushChunk"),h=Symbol("encoding"),Y0=Symbol("decoder"),I=Symbol("flowing"),w0=Symbol("paused"),K0=Symbol("resume"),L=Symbol("buffer"),S=Symbol("pipes"),O=Symbol("bufferLength"),t0=Symbol("bufferPush"),b0=Symbol("bufferShift"),D=Symbol("objectMode"),A=Symbol("destroyed"),Q8=Symbol("error"),X8=Symbol("emitData"),i8=Symbol("emitEnd"),$8=Symbol("emitEnd2"),c=Symbol("async"),Z8=Symbol("abort"),u0=Symbol("aborted"),C0=Symbol("signal"),t=Symbol("dataListeners"),u=Symbol("discarded"),M0=(Q)=>Promise.resolve().then(Q),RX=(Q)=>Q(),AX=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",IX=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,LX=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class V8{src;dest;opts;ondrain;constructor(Q,X,$){this.src=Q,this.dest=X,this.opts=$,this.ondrain=()=>Q[K0](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class r8 extends V8{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,$){super(Q,X,$);this.proxyErrors=(Z)=>X.emit("error",Z),Q.on("error",this.proxyErrors)}}var OX=(Q)=>!!Q.objectMode,FX=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class Q0 extends J8{[I]=!1;[w0]=!1;[S]=[];[L]=[];[D];[h];[c];[Y0];[i]=!1;[a]=!1;[k0]=!1;[S0]=!1;[B0]=null;[O]=0;[A]=!1;[C0];[u0]=!1;[t]=0;[u]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(OX(X))this[D]=!0,this[h]=null;else if(FX(X))this[h]=X.encoding,this[D]=!1;else this[D]=!1,this[h]=null;if(this[c]=!!X.async,this[Y0]=this[h]?new BX(this[h]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[L]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[S]});let{signal:$}=X;if($)if(this[C0]=$,$.aborted)this[Z8]();else $.addEventListener("abort",()=>this[Z8]())}get bufferLength(){return this[O]}get encoding(){return this[h]}set encoding(Q){throw Error("Encoding must be set at instantiation time")}setEncoding(Q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[D]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[c]}set["async"](Q){this[c]=this[c]||!!Q}[Z8](){this[u0]=!0,this.emit("abort",this[C0]?.reason),this.destroy(this[C0]?.reason)}get aborted(){return this[u0]}set aborted(Q){}write(Q,X,$){if(this[u0])return!1;if(this[i])throw Error("write after end");if(this[A])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")$=X,X="utf8";if(!X)X="utf8";let Z=this[c]?M0:RX;if(!this[D]&&!Buffer.isBuffer(Q)){if(LX(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(IX(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[D]){if(this[I]&&this[O]!==0)this[T0](!0);if(this[I])this.emit("data",Q);else this[t0](Q);if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}if(!Q.length){if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}if(typeof Q==="string"&&!(X===this[h]&&!this[Y0]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[h])Q=this[Y0].write(Q);if(this[I]&&this[O]!==0)this[T0](!0);if(this[I])this.emit("data",Q);else this[t0](Q);if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}read(Q){if(this[A])return null;if(this[u]=!1,this[O]===0||Q===0||Q&&Q>this[O])return this[n](),null;if(this[D])Q=null;if(this[L].length>1&&!this[D])this[L]=[this[h]?this[L].join(""):Buffer.concat(this[L],this[O])];let X=this[o8](Q||null,this[L][0]);return this[n](),X}[o8](Q,X){if(this[D])this[b0]();else{let $=X;if(Q===$.length||Q===null)this[b0]();else if(typeof $==="string")this[L][0]=$.slice(Q),X=$.slice(0,Q),this[O]-=Q;else this[L][0]=$.subarray(Q),X=$.subarray(0,Q),this[O]-=Q}if(this.emit("data",X),!this[L].length&&!this[i])this.emit("drain");return X}end(Q,X,$){if(typeof Q==="function")$=Q,Q=void 0;if(typeof X==="function")$=X,X="utf8";if(Q!==void 0)this.write(Q,X);if($)this.once("end",$);if(this[i]=!0,this.writable=!1,this[I]||!this[w0])this[n]();return this}[K0](){if(this[A])return;if(!this[t]&&!this[S].length)this[u]=!0;if(this[w0]=!1,this[I]=!0,this.emit("resume"),this[L].length)this[T0]();else if(this[i])this[n]();else this.emit("drain")}resume(){return this[K0]()}pause(){this[I]=!1,this[w0]=!0,this[u]=!1}get destroyed(){return this[A]}get flowing(){return this[I]}get paused(){return this[w0]}[t0](Q){if(this[D])this[O]+=1;else this[O]+=Q.length;this[L].push(Q)}[b0](){if(this[D])this[O]-=1;else this[O]-=this[L][0].length;return this[L].shift()}[T0](Q=!1){do;while(this[p8](this[b0]())&&this[L].length);if(!Q&&!this[L].length&&!this[i])this.emit("drain")}[p8](Q){return this.emit("data",Q),this[I]}pipe(Q,X){if(this[A])return Q;this[u]=!1;let $=this[a];if(X=X||{},Q===l8.stdout||Q===l8.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,$){if(X.end)Q.end()}else if(this[S].push(!X.proxyErrors?new V8(this,Q,X):new r8(this,Q,X)),this[c])M0(()=>this[K0]());else this[K0]();return Q}unpipe(Q){let X=this[S].find(($)=>$.dest===Q);if(X){if(this[S].length===1){if(this[I]&&this[t]===0)this[I]=!1;this[S]=[]}else this[S].splice(this[S].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let $=super.on(Q,X);if(Q==="data"){if(this[u]=!1,this[t]++,!this[S].length&&!this[I])this[K0]()}else if(Q==="readable"&&this[O]!==0)super.emit("readable");else if(AX(Q)&&this[a])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[B0]){let Z=X;if(this[c])M0(()=>Z.call(this,this[B0]));else Z.call(this,this[B0])}return $}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let $=super.off(Q,X);if(Q==="data"){if(this[t]=this.listeners("data").length,this[t]===0&&!this[u]&&!this[S].length)this[I]=!1}return $}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[t]=0,!this[u]&&!this[S].length)this[I]=!1}return X}get emittedEnd(){return this[a]}[n](){if(!this[k0]&&!this[a]&&!this[A]&&this[L].length===0&&this[i]){if(this[k0]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[S0])this.emit("close");this[k0]=!1}}emit(Q,...X){let $=X[0];if(Q!=="error"&&Q!=="close"&&Q!==A&&this[A])return!1;else if(Q==="data")return!this[D]&&!$?!1:this[c]?(M0(()=>this[X8]($)),!0):this[X8]($);else if(Q==="end")return this[i8]();else if(Q==="close"){if(this[S0]=!0,!this[a]&&!this[A])return!1;let J=super.emit("close");return this.removeAllListeners("close"),J}else if(Q==="error"){this[B0]=$,super.emit(Q8,$);let J=!this[C0]||this.listeners("error").length?super.emit("error",$):!1;return this[n](),J}else if(Q==="resume"){let J=super.emit("resume");return this[n](),J}else if(Q==="finish"||Q==="prefinish"){let J=super.emit(Q);return this.removeAllListeners(Q),J}let Z=super.emit(Q,...X);return this[n](),Z}[X8](Q){for(let $ of this[S])if($.dest.write(Q)===!1)this.pause();let X=this[u]?!1:super.emit("data",Q);return this[n](),X}[i8](){if(this[a])return!1;return this[a]=!0,this.readable=!1,this[c]?(M0(()=>this[$8]()),!0):this[$8]()}[$8](){if(this[Y0]){let X=this[Y0].end();if(X){for(let $ of this[S])$.dest.write(X);if(!this[u])super.emit("data",X)}}for(let X of this[S])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[D])Q.dataLength=0;let X=this.promise();return this.on("data",($)=>{if(Q.push($),!this[D])Q.dataLength+=$.length}),await X,Q}async concat(){if(this[D])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[h]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(A,()=>X(Error("stream destroyed"))),this.on("error",($)=>X($)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[u]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let Z=this.read();if(Z!==null)return Promise.resolve({done:!1,value:Z});if(this[i])return X();let J,V,q=(K)=>{this.off("data",_),this.off("end",Y),this.off(A,H),X(),V(K)},_=(K)=>{this.off("error",q),this.off("end",Y),this.off(A,H),this.pause(),J({value:K,done:!!this[i]})},Y=()=>{this.off("error",q),this.off("data",_),this.off(A,H),X(),J({done:!0,value:void 0})},H=()=>q(Error("stream destroyed"));return new Promise((K,G)=>{V=G,J=K,this.once(A,H),this.once("error",q),this.once("end",Y),this.once("data",_)})},throw:X,return:X,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[u]=!1;let Q=!1,X=()=>{return this.pause(),this.off(Q8,X),this.off(A,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},$=()=>{if(Q)return X();let Z=this.read();return Z===null?X():{done:!1,value:Z}};return this.once("end",X),this.once(Q8,X),this.once(A,X),{next:$,throw:X,return:X,[Symbol.iterator](){return this}}}destroy(Q){if(this[A]){if(Q)this.emit("error",Q);else this.emit(A);return this}this[A]=!0,this[u]=!0,this[L].length=0,this[O]=0;let X=this;if(typeof X.close==="function"&&!this[S0])X.close();if(Q)this.emit("error",Q);else this.emit(A);return this}static get isStream(){return wX}}var uX=TX.native,A0={lstatSync:PX,readdir:DX,readdirSync:kX,readlinkSync:SX,realpathSync:uX,promises:{lstat:EX,readdir:xX,readlink:mX,realpath:fX}},QQ=(Q)=>!Q||Q===A0||Q===bX?A0:{...A0,...Q,promises:{...A0.promises,...Q.promises||{}}},XQ=/^\\\\\?\\([a-z]:)\\?$/i,yX=(Q)=>Q.replace(/\//g,"\\").replace(XQ,"$1\\"),gX=/[\\\/]/,f=0,$Q=1,ZQ=2,l=4,JQ=6,VQ=8,X0=10,qQ=12,m=15,R0=~m,q8=16,a8=32,I0=64,d=128,E0=256,m0=512,s8=I0|d|m0,hX=1023,_8=(Q)=>Q.isFile()?VQ:Q.isDirectory()?l:Q.isSymbolicLink()?X0:Q.isCharacterDevice()?ZQ:Q.isBlockDevice()?JQ:Q.isSocket()?qQ:Q.isFIFO()?$Q:f,e8=new Map,L0=(Q)=>{let X=e8.get(Q);if(X)return X;let $=Q.normalize("NFKD");return e8.set(Q,$),$},t8=new Map,x0=(Q)=>{let X=t8.get(Q);if(X)return X;let $=L0(Q.toLowerCase());return t8.set(Q,$),$};class K8 extends U0{constructor(){super({max:256})}}class _Q extends U0{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var YQ=Symbol("PathScurry setAsCwd");class T{name;root;roots;parent;nocase;isCWD=!1;#Q;#X;get dev(){return this.#X}#$;get mode(){return this.#$}#J;get nlink(){return this.#J}#q;get uid(){return this.#q}#M;get gid(){return this.#M}#U;get rdev(){return this.#U}#_;get blksize(){return this.#_}#H;get ino(){return this.#H}#Y;get size(){return this.#Y}#K;get blocks(){return this.#K}#Z;get atimeMs(){return this.#Z}#G;get mtimeMs(){return this.#G}#B;get ctimeMs(){return this.#B}#j;get birthtimeMs(){return this.#j}#z;get atime(){return this.#z}#w;get mtime(){return this.#w}#R;get ctime(){return this.#R}#P;get birthtime(){return this.#P}#L;#I;#A;#N;#C;#k;#V;#b;#O;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=f,$,Z,J,V,q){if(this.name=Q,this.#L=J?x0(Q):L0(Q),this.#V=X&hX,this.nocase=J,this.roots=Z,this.root=$||this,this.#b=V,this.#A=q.fullpath,this.#C=q.relative,this.#k=q.relativePosix,this.parent=q.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=QQ(q.fs)}depth(){if(this.#I!==void 0)return this.#I;if(!this.parent)return this.#I=0;return this.#I=this.parent.depth()+1}childrenCache(){return this.#b}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),Z=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#F(Z):this.#F(Z)}#F(Q){let X=this;for(let $ of Q)X=X.child($);return X}children(){let Q=this.#b.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#b.set(this,X),this.#V&=~q8,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let $=this.children(),Z=this.nocase?x0(Q):L0(Q);for(let _ of $)if(_.#L===Z)return _;let J=this.parent?this.sep:"",V=this.#A?this.#A+J+Q:void 0,q=this.newChild(Q,f,{...X,parent:this,fullpath:V});if(!this.canReaddir())q.#V|=d;return $.push(q),q}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let Q=this.name,X=this.parent;if(!X)return this.#C=this.name;let $=X.relative();return $+(!$||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let Q=this.name,X=this.parent;if(!X)return this.#k=this.fullpathPosix();let $=X.relativePosix();return $+(!$||!X.parent?"":"/")+Q}fullpath(){if(this.#A!==void 0)return this.#A;let Q=this.name,X=this.parent;if(!X)return this.#A=this.name;let Z=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#A=Z}fullpathPosix(){if(this.#N!==void 0)return this.#N;if(this.sep==="/")return this.#N=this.fullpath();if(!this.parent){let Z=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(Z))return this.#N=`//?/${Z}`;else return this.#N=Z}let Q=this.parent,X=Q.fullpathPosix(),$=X+(!X||!Q.parent?"":"/")+this.name;return this.#N=$}isUnknown(){return(this.#V&m)===f}isType(Q){return this[`is${Q}`]()}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.#V&m)===VQ}isDirectory(){return(this.#V&m)===l}isCharacterDevice(){return(this.#V&m)===ZQ}isBlockDevice(){return(this.#V&m)===JQ}isFIFO(){return(this.#V&m)===$Q}isSocket(){return(this.#V&m)===qQ}isSymbolicLink(){return(this.#V&X0)===X0}lstatCached(){return this.#V&a8?this:void 0}readlinkCached(){return this.#O}realpathCached(){return this.#S}readdirCached(){let Q=this.children();return Q.slice(0,Q.provisional)}canReadlink(){if(this.#O)return!0;if(!this.parent)return!1;let Q=this.#V&m;return!(Q!==f&&Q!==X0||this.#V&E0||this.#V&d)}calledReaddir(){return!!(this.#V&q8)}isENOENT(){return!!(this.#V&d)}isNamed(Q){return!this.nocase?this.#L===L0(Q):this.#L===x0(Q)}async readlink(){let Q=this.#O;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),$=(await this.parent.realpath())?.resolve(X);if($)return this.#O=$}catch(X){this.#m(X.code);return}}readlinkSync(){let Q=this.#O;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),$=this.parent.realpathSync()?.resolve(X);if($)return this.#O=$}catch(X){this.#m(X.code);return}}#g(Q){this.#V|=q8;for(let X=Q.provisional;X<Q.length;X++){let $=Q[X];if($)$.#u()}}#u(){if(this.#V&d)return;this.#V=(this.#V|d)&R0,this.#x()}#x(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#u()}#h(){this.#V|=m0,this.#v()}#v(){if(this.#V&I0)return;let Q=this.#V;if((Q&m)===l)Q&=R0;this.#V=Q|I0,this.#x()}#D(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#v();else if(Q==="ENOENT")this.#u();else this.children().provisional=0}#d(Q=""){if(Q==="ENOTDIR")this.parent.#v();else if(Q==="ENOENT")this.#u()}#m(Q=""){let X=this.#V;if(X|=E0,Q==="ENOENT")X|=d;if(Q==="EINVAL"||Q==="UNKNOWN")X&=R0;if(this.#V=X,Q==="ENOTDIR"&&this.parent)this.parent.#v()}#E(Q,X){return this.#c(Q,X)||this.#W(Q,X)}#W(Q,X){let $=_8(Q),Z=this.newChild(Q.name,$,{parent:this}),J=Z.#V&m;if(J!==l&&J!==X0&&J!==f)Z.#V|=I0;return X.unshift(Z),X.provisional++,Z}#c(Q,X){for(let $=X.provisional;$<X.length;$++){let Z=X[$];if((this.nocase?x0(Q.name):L0(Q.name))!==Z.#L)continue;return this.#f(Q,Z,$,X)}}#f(Q,X,$,Z){let J=X.name;if(X.#V=X.#V&R0|_8(Q),J!==Q.name)X.name=Q.name;if($!==Z.provisional){if($===Z.length-1)Z.pop();else Z.splice($,1);Z.unshift(X)}return Z.provisional++,X}async lstat(){if((this.#V&d)===0)try{return this.#T(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#d(Q.code)}}lstatSync(){if((this.#V&d)===0)try{return this.#T(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#d(Q.code)}}#T(Q){let{atime:X,atimeMs:$,birthtime:Z,birthtimeMs:J,blksize:V,blocks:q,ctime:_,ctimeMs:Y,dev:H,gid:K,ino:G,mode:W,mtime:z,mtimeMs:j,nlink:U,rdev:B,size:C,uid:M}=Q;this.#z=X,this.#Z=$,this.#P=Z,this.#j=J,this.#_=V,this.#K=q,this.#R=_,this.#B=Y,this.#X=H,this.#M=K,this.#H=G,this.#$=W,this.#w=z,this.#G=j,this.#J=U,this.#U=B,this.#Y=C,this.#q=M;let w=_8(Q);if(this.#V=this.#V&R0|w|a8,w!==f&&w!==l&&w!==X0)this.#V|=I0}#y=[];#o=!1;#p(Q){this.#o=!1;let X=this.#y.slice();this.#y.length=0,X.forEach(($)=>$(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let $=this.children();if(this.calledReaddir()){let J=$.slice(0,$.provisional);if(X)Q(null,J);else queueMicrotask(()=>Q(null,J));return}if(this.#y.push(Q),this.#o)return;this.#o=!0;let Z=this.fullpath();this.#Q.readdir(Z,{withFileTypes:!0},(J,V)=>{if(J)this.#D(J.code),$.provisional=0;else{for(let q of V)this.#E(q,$);this.#g($)}this.#p($.slice(0,$.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#l)await this.#l;else{let $=()=>{};this.#l=new Promise((Z)=>$=Z);try{for(let Z of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#E(Z,Q);this.#g(Q)}catch(Z){this.#D(Z.code),Q.provisional=0}this.#l=void 0,$()}return Q.slice(0,Q.provisional)}readdirSync(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();try{for(let $ of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#E($,Q);this.#g(Q)}catch($){this.#D($.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#V&s8)return!1;let Q=m&this.#V;if(!(Q===f||Q===l||Q===X0))return!1;return!0}shouldWalk(Q,X){return(this.#V&l)===l&&!(this.#V&s8)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#S)return this.#S;if((m0|E0|d)&this.#V)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#S=this.resolve(Q)}catch(Q){this.#h()}}realpathSync(){if(this.#S)return this.#S;if((m0|E0|d)&this.#V)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#S=this.resolve(Q)}catch(Q){this.#h()}}[YQ](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),$=[],Z=this;while(Z&&Z.parent)X.add(Z),Z.#C=$.join(this.sep),Z.#k=$.join("/"),Z=Z.parent,$.push("..");Z=Q;while(Z&&Z.parent&&!X.has(Z))Z.#C=void 0,Z.#k=void 0,Z=Z.parent}}class f0 extends T{sep="\\";splitSep=gX;constructor(Q,X=f,$,Z,J,V,q){super(Q,X,$,Z,J,V,q)}newChild(Q,X=f,$={}){return new f0(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),$)}getRootString(Q){return Y8.parse(Q).root}getRoot(Q){if(Q=yX(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,$]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=$;return this.roots[Q]=new O0(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(XQ,"$1\\"),Q===X}}class y0 extends T{splitSep="/";sep="/";constructor(Q,X=f,$,Z,J,V,q){super(Q,X,$,Z,J,V,q)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=f,$={}){return new y0(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),$)}}class H8{root;rootPath;roots;cwd;#Q;#X;#$;nocase;#J;constructor(Q=process.cwd(),X,$,{nocase:Z,childrenCacheSize:J=16384,fs:V=A0}={}){if(this.#J=QQ(V),Q instanceof URL||Q.startsWith("file://"))Q=vX(Q);let q=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(q),this.#Q=new K8,this.#X=new K8,this.#$=new _Q(J);let _=q.substring(this.rootPath.length).split($);if(_.length===1&&!_[0])_.pop();if(Z===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Z,this.root=this.newRoot(this.#J),this.roots[this.rootPath]=this.root;let Y=this.root,H=_.length-1,K=X.sep,G=this.rootPath,W=!1;for(let z of _){let j=H--;Y=Y.child(z,{relative:Array(j).fill("..").join(K),relativePosix:Array(j).fill("..").join("/"),fullpath:G+=(W?"":K)+z}),W=!0}this.cwd=Y}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#$}resolve(...Q){let X="";for(let J=Q.length-1;J>=0;J--){let V=Q[J];if(!V||V===".")continue;if(X=X?`${V}/${X}`:V,this.isAbsolute(V))break}let $=this.#Q.get(X);if($!==void 0)return $;let Z=this.cwd.resolve(X).fullpath();return this.#Q.set(X,Z),Z}resolvePosix(...Q){let X="";for(let J=Q.length-1;J>=0;J--){let V=Q[J];if(!V||V===".")continue;if(X=X?`${V}/${X}`:V,this.isAbsolute(V))break}let $=this.#X.get(X);if($!==void 0)return $;let Z=this.cwd.resolve(X).fullpathPosix();return this.#X.set(X,Z),Z}relative(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relative()}relativePosix(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relativePosix()}basename(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.name}dirname(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return(Q.parent||Q).fullpath()}async readdir(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$}=X;if(!Q.canReaddir())return[];else{let Z=await Q.readdir();return $?Z:Z.map((J)=>J.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0}=X;if(!Q.canReaddir())return[];else if($)return Q.readdirSync();else return Q.readdirSync().map((Z)=>Z.name)}async lstat(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstat()}lstatSync(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstatSync()}async readlink(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=await Q.readlink();return X?$:$?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=Q.readlinkSync();return X?$:$?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=await Q.realpath();return X?$:$?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=Q.realpathSync();return X?$:$?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=[];if(!J||J(Q))q.push($?Q:Q.fullpath());let _=new Set,Y=(K,G)=>{_.add(K),K.readdirCB((W,z)=>{if(W)return G(W);let j=z.length;if(!j)return G();let U=()=>{if(--j===0)G()};for(let B of z){if(!J||J(B))q.push($?B:B.fullpath());if(Z&&B.isSymbolicLink())B.realpath().then((C)=>C?.isUnknown()?C.lstat():C).then((C)=>C?.shouldWalk(_,V)?Y(C,U):U());else if(B.shouldWalk(_,V))Y(B,U);else U()}},!0)},H=Q;return new Promise((K,G)=>{Y(H,(W)=>{if(W)return G(W);K(q)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=[];if(!J||J(Q))q.push($?Q:Q.fullpath());let _=new Set([Q]);for(let Y of _){let H=Y.readdirSync();for(let K of H){if(!J||J(K))q.push($?K:K.fullpath());let G=K;if(K.isSymbolicLink()){if(!(Z&&(G=K.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(_,V))_.add(G)}}return q}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X;if(!J||J(Q))yield $?Q:Q.fullpath();let q=new Set([Q]);for(let _ of q){let Y=_.readdirSync();for(let H of Y){if(!J||J(H))yield $?H:H.fullpath();let K=H;if(H.isSymbolicLink()){if(!(Z&&(K=H.realpathSync())))continue;if(K.isUnknown())K.lstatSync()}if(K.shouldWalk(q,V))q.add(K)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=new Q0({objectMode:!0});if(!J||J(Q))q.write($?Q:Q.fullpath());let _=new Set,Y=[Q],H=0,K=()=>{let G=!1;while(!G){let W=Y.shift();if(!W){if(H===0)q.end();return}H++,_.add(W);let z=(U,B,C=!1)=>{if(U)return q.emit("error",U);if(Z&&!C){let M=[];for(let w of B)if(w.isSymbolicLink())M.push(w.realpath().then((R)=>R?.isUnknown()?R.lstat():R));if(M.length){Promise.all(M).then(()=>z(null,B,!0));return}}for(let M of B)if(M&&(!J||J(M))){if(!q.write($?M:M.fullpath()))G=!0}H--;for(let M of B){let w=M.realpathCached()||M;if(w.shouldWalk(_,V))Y.push(w)}if(G&&!q.flowing)q.once("drain",K);else if(!j)K()},j=!0;W.readdirCB(z,!0),j=!1}};return K(),q}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=new Q0({objectMode:!0}),_=new Set;if(!J||J(Q))q.write($?Q:Q.fullpath());let Y=[Q],H=0,K=()=>{let G=!1;while(!G){let W=Y.shift();if(!W){if(H===0)q.end();return}H++,_.add(W);let z=W.readdirSync();for(let j of z)if(!J||J(j)){if(!q.write($?j:j.fullpath()))G=!0}H--;for(let j of z){let U=j;if(j.isSymbolicLink()){if(!(Z&&(U=j.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(_,V))Y.push(U)}}if(G&&!q.flowing)q.once("drain",K)};return K(),q}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[YQ](X)}}class O0 extends H8{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:$=!0}=X;super(Q,Y8,"\\",{...X,nocase:$});this.nocase=$;for(let Z=this.cwd;Z;Z=Z.parent)Z.nocase=this.nocase}parseRootPath(Q){return Y8.parse(Q).root.toUpperCase()}newRoot(Q){return new f0(this.rootPath,l,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class F0 extends H8{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:$=!1}=X;super(Q,NX,"/",{...X,nocase:$});this.nocase=$}parseRootPath(Q){return"/"}newRoot(Q){return new y0(this.rootPath,l,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class g0 extends F0{constructor(Q=process.cwd(),X={}){let{nocase:$=!0}=X;super(Q,{...X,nocase:$})}}var x5=process.platform==="win32"?f0:y0,KQ=process.platform==="win32"?O0:process.platform==="darwin"?g0:F0;var dX=(Q)=>Q.length>=1,cX=(Q)=>Q.length>=1;class H0{#Q;#X;#$;length;#J;#q;#M;#U;#_;#H;#Y=!0;constructor(Q,X,$,Z){if(!dX(Q))throw TypeError("empty pattern list");if(!cX(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,$<0||$>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#X=X,this.#$=$,this.#J=Z,this.#$===0){if(this.isUNC()){let[J,V,q,_,...Y]=this.#Q,[H,K,G,W,...z]=this.#X;if(Y[0]==="")Y.shift(),z.shift();let j=[J,V,q,_,""].join("/"),U=[H,K,G,W,""].join("/");this.#Q=[j,...Y],this.#X=[U,...z],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[J,...V]=this.#Q,[q,..._]=this.#X;if(V[0]==="")V.shift(),_.shift();let Y=J+"/",H=q+"/";this.#Q=[Y,...V],this.#X=[H,..._],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#$]}isString(){return typeof this.#Q[this.#$]==="string"}isGlobstar(){return this.#Q[this.#$]===v}isRegExp(){return this.#Q[this.#$]instanceof RegExp}globString(){return this.#M=this.#M||(this.#$===0?this.isAbsolute()?this.#X[0]+this.#X.slice(1).join("/"):this.#X.join("/"):this.#X.slice(this.#$).join("/"))}hasMore(){return this.length>this.#$+1}rest(){if(this.#q!==void 0)return this.#q;if(!this.hasMore())return this.#q=null;return this.#q=new H0(this.#Q,this.#X,this.#$+1,this.#J),this.#q.#H=this.#H,this.#q.#_=this.#_,this.#q.#U=this.#U,this.#q}isUNC(){let Q=this.#Q;return this.#_!==void 0?this.#_:this.#_=this.#J==="win32"&&this.#$===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#U!==void 0?this.#U:this.#U=this.#J==="win32"&&this.#$===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#H!==void 0?this.#H:this.#H=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#$===0?Q:""}checkFollowGlobstar(){return!(this.#$===0||!this.isGlobstar()||!this.#Y)}markFollowGlobstar(){if(this.#$===0||!this.isGlobstar()||!this.#Y)return!1;return this.#Y=!1,!0}}var lX=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class N0{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:$,noext:Z,noglobstar:J,platform:V=lX}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=V,this.mmopts={dot:!0,nobrace:X,nocase:$,noext:Z,noglobstar:J,optimizationLevel:2,platform:V,nocomment:!0,nonegate:!0};for(let q of Q)this.add(q)}add(Q){let X=new x(Q,this.mmopts);for(let $=0;$<X.set.length;$++){let Z=X.set[$],J=X.globParts[$];if(!Z||!J)throw Error("invalid pattern object");while(Z[0]==="."&&J[0]===".")Z.shift(),J.shift();let V=new H0(Z,J,0,this.platform),q=new x(V.globString(),this.mmopts),_=J[J.length-1]==="**",Y=V.isAbsolute();if(Y)this.absolute.push(q);else this.relative.push(q);if(_)if(Y)this.absoluteChildren.push(q);else this.relativeChildren.push(q)}}ignored(Q){let X=Q.fullpath(),$=`${X}/`,Z=Q.relative()||".",J=`${Z}/`;for(let V of this.relative)if(V.match(Z)||V.match(J))return!0;for(let V of this.absolute)if(V.match(X)||V.match($))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",$=(Q.relative()||".")+"/";for(let Z of this.relativeChildren)if(Z.match($))return!0;for(let Z of this.absoluteChildren)if(Z.match(X))return!0;return!1}}class W8{store;constructor(Q=new Map){this.store=Q}copy(){return new W8(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let $=Q.fullpath(),Z=this.store.get($);if(Z)Z.add(X.globString());else this.store.set($,new Set([X.globString()]))}}class HQ{store=new Map;add(Q,X,$){let Z=(X?2:0)|($?1:0),J=this.store.get(Q);this.store.set(Q,J===void 0?Z:Z&J)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class WQ{store=new Map;add(Q,X){if(!Q.canReaddir())return;let $=this.store.get(Q);if($){if(!$.find((Z)=>Z.globString()===X.globString()))$.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class v0{hasWalkedCache;matches=new HQ;subwalks=new WQ;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new W8}processPatterns(Q,X){this.patterns=X;let $=X.map((Z)=>[Q,Z]);for(let[Z,J]of $){this.hasWalkedCache.storeWalked(Z,J);let V=J.root(),q=J.isAbsolute()&&this.opts.absolute!==!1;if(V){Z=Z.resolve(V==="/"&&this.opts.root!==void 0?this.opts.root:V);let K=J.rest();if(!K){this.matches.add(Z,!0,!1);continue}else J=K}if(Z.isENOENT())continue;let _,Y,H=!1;while(typeof(_=J.pattern())==="string"&&(Y=J.rest()))Z=Z.resolve(_),J=Y,H=!0;if(_=J.pattern(),Y=J.rest(),H){if(this.hasWalkedCache.hasWalked(Z,J))continue;this.hasWalkedCache.storeWalked(Z,J)}if(typeof _==="string"){let K=_===".."||_===""||_===".";this.matches.add(Z.resolve(_),q,K);continue}else if(_===v){if(!Z.isSymbolicLink()||this.follow||J.checkFollowGlobstar())this.subwalks.add(Z,J);let K=Y?.pattern(),G=Y?.rest();if(!Y||(K===""||K===".")&&!G)this.matches.add(Z,q,K===""||K===".");else if(K===".."){let W=Z.parent||Z;if(!G)this.matches.add(W,q,!0);else if(!this.hasWalkedCache.hasWalked(W,G))this.subwalks.add(W,G)}}else if(_ instanceof RegExp)this.subwalks.add(Z,J)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new v0(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let $=this.subwalks.get(Q),Z=this.child();for(let J of X)for(let V of $){let q=V.isAbsolute(),_=V.pattern(),Y=V.rest();if(_===v)Z.testGlobstar(J,V,Y,q);else if(_ instanceof RegExp)Z.testRegExp(J,_,Y,q);else Z.testString(J,_,Y,q)}return Z}testGlobstar(Q,X,$,Z){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,Z,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if($&&X.checkFollowGlobstar())this.subwalks.add(Q,$);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if($){let J=$.pattern();if(typeof J==="string"&&J!==".."&&J!==""&&J!==".")this.testString(Q,J,$.rest(),Z);else if(J===".."){let V=Q.parent||Q;this.subwalks.add(V,$)}else if(J instanceof RegExp)this.testRegExp(Q,J,$.rest(),Z)}}testRegExp(Q,X,$,Z){if(!X.test(Q.name))return;if(!$)this.matches.add(Q,Z,!1);else this.subwalks.add(Q,$)}testString(Q,X,$,Z){if(!Q.isNamed(X))return;if(!$)this.matches.add(Q,Z,!1);else this.subwalks.add(Q,$)}}var oX=(Q,X)=>typeof Q==="string"?new N0([Q],X):Array.isArray(Q)?new N0(Q,X):Q;class G8{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#X;#$;signal;maxDepth;includeChildMatches;constructor(Q,X,$){if(this.patterns=Q,this.path=X,this.opts=$,this.#$=!$.posix&&$.platform==="win32"?"\\":"/",this.includeChildMatches=$.includeChildMatches!==!1,$.ignore||!this.includeChildMatches){if(this.#X=oX($.ignore??[],$),!this.includeChildMatches&&typeof this.#X.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=$.maxDepth||1/0,$.signal)this.signal=$.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#J(Q){return this.seen.has(Q)||!!this.#X?.ignored?.(Q)}#q(Q){return!!this.#X?.childrenIgnored?.(Q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Q=void 0;while(!this.paused&&(Q=this.#Q.shift()))Q()}onResume(Q){if(this.signal?.aborted)return;if(!this.paused)Q();else this.#Q.push(Q)}async matchCheck(Q,X){if(X&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Q.realpathCached()||await Q.realpath(),!$)return;Q=$}let J=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&J?.isSymbolicLink()){let V=await J.realpath();if(V&&(V.isUnknown()||this.opts.stat))await V.lstat()}return this.matchCheckTest(J,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#J(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Q.realpathCached()||Q.realpathSync(),!$)return;Q=$}let J=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&J?.isSymbolicLink()){let V=J.realpathSync();if(V&&(V?.isUnknown()||this.opts.stat))V.lstatSync()}return this.matchCheckTest(J,X)}matchFinish(Q,X){if(this.#J(Q))return;if(!this.includeChildMatches&&this.#X?.add){let J=`${Q.relativePosix()}/**`;this.#X.add(J)}let $=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let Z=this.opts.mark&&Q.isDirectory()?this.#$:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if($){let J=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit(J+Z)}else{let J=this.opts.posix?Q.relativePosix():Q.relative(),V=this.opts.dotRelative&&!J.startsWith(".."+this.#$)?"."+this.#$:"";this.matchEmit(!J?"."+Z:V+J+Z)}}async match(Q,X,$){let Z=await this.matchCheck(Q,$);if(Z)this.matchFinish(Z,X)}matchSync(Q,X,$){let Z=this.matchCheckSync(Q,$);if(Z)this.matchFinish(Z,X)}walkCB(Q,X,$){if(this.signal?.aborted)$();this.walkCB2(Q,X,new v0(this.opts),$)}walkCB2(Q,X,$,Z){if(this.#q(Q))return Z();if(this.signal?.aborted)Z();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,$,Z));return}$.processPatterns(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;J++,this.match(q,_,Y).then(()=>V())}for(let q of $.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;J++;let _=q.readdirCached();if(q.calledReaddir())this.walkCB3(q,_,$,V);else q.readdirCB((Y,H)=>this.walkCB3(q,H,$,V),!0)}V()}walkCB3(Q,X,$,Z){$=$.filterEntries(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;J++,this.match(q,_,Y).then(()=>V())}for(let[q,_]of $.subwalks.entries())J++,this.walkCB2(q,_,$.child(),V);V()}walkCBSync(Q,X,$){if(this.signal?.aborted)$();this.walkCB2Sync(Q,X,new v0(this.opts),$)}walkCB2Sync(Q,X,$,Z){if(this.#q(Q))return Z();if(this.signal?.aborted)Z();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,$,Z));return}$.processPatterns(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;this.matchSync(q,_,Y)}for(let q of $.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;J++;let _=q.readdirSync();this.walkCB3Sync(q,_,$,V)}V()}walkCB3Sync(Q,X,$,Z){$=$.filterEntries(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;this.matchSync(q,_,Y)}for(let[q,_]of $.subwalks.entries())J++,this.walkCB2Sync(q,_,$.child(),V);V()}}class h0 extends G8{matches=new Set;constructor(Q,X,$){super(Q,X,$)}matchEmit(Q){this.matches.add(Q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Q,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(this.signal.reason);else Q(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 d0 extends G8{results;constructor(Q,X,$){super(Q,X,$);this.results=new Q0({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Q){if(this.results.write(Q),!this.results.flowing)this.pause()}stream(){let Q=this.path;if(Q.isUnknown())Q.lstat().then(()=>{this.walkCB(Q,this.patterns,()=>this.results.end())});else this.walkCB(Q,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 iX=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class o{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(Q,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=pX(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((_)=>_.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((_)=>_.includes("/")?_:`./**/${_}`)}if(this.pattern=Q,this.platform=X.platform||iX,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let _=X.platform==="win32"?O0:X.platform==="darwin"?g0:X.platform?F0:KQ;this.scurry=new _(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let $=this.platform==="darwin"||this.platform==="win32",Z={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:$,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},J=this.pattern.map((_)=>new x(_,Z)),[V,q]=J.reduce((_,Y)=>{return _[0].push(...Y.set),_[1].push(...Y.globParts),_},[[],[]]);this.patterns=V.map((_,Y)=>{let H=q[Y];if(!H)throw Error("invalid pattern object");return new H0(_,H,0,this.platform)})}async walk(){return[...await new h0(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 h0(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 d0(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 d0(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 j8=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let $ of Q)if(new x($,X).hasMagic())return!0;return!1};function c0(Q,X={}){return new o(Q,X).streamSync()}function zQ(Q,X={}){return new o(Q,X).stream()}function l0(Q,X={}){return new o(Q,X).walkSync()}async function GQ(Q,X={}){return new o(Q,X).walk()}function o0(Q,X={}){return new o(Q,X).iterateSync()}function UQ(Q,X={}){return new o(Q,X).iterate()}var nX=c0,rX=Object.assign(zQ,{sync:c0}),aX=o0,sX=Object.assign(UQ,{sync:o0}),eX=Object.assign(l0,{stream:c0,iterate:o0}),jQ=Object.assign(GQ,{glob:GQ,globSync:l0,sync:eX,globStream:zQ,stream:rX,globStreamSync:c0,streamSync:nX,globIterate:UQ,iterate:sX,globIterateSync:o0,iterateSync:aX,Glob:o,hasMagic:j8,escape:V0,unescape:g});jQ.glob=jQ;import tX from"node:path";var BQ=({dir:Q,pattern:X="*",nodir:$=!1,dot:Z=!0,ignore:J=[],absolute:V=!1,matchBase:q=!1,follow:_=!1})=>{if(Q=Q||process.cwd(),Q=tX.resolve(Q),X&&!Array.isArray(X))X=[X];else X=X||["*"];if(J&&!Array.isArray(J))J=[J];else J=J||[];return l0(X,{cwd:Q,nodir:$,dot:Z,ignore:J,absolute:V,matchBase:q,follow:_})};import p from"node:fs";import i0 from"node:path";import{randomUUID as Q5}from"node:crypto";import X5 from"yaml";import $5 from"nunjucks";import Z5 from"chalk";import{Atom as $0}from"@flownet/lib-atom-api-js";import J5 from"@fnet/config";import{Api as p0}from"@flownet/lib-atom-api-js";class wQ{init({config:Q,accessToken:X}){return new Promise(($,Z)=>{if(p0.set_api_url(Q.data.url),X){p0.set_req_token(X),$(X);return}fetch(`${Q.data.issuer}/protocol/openid-connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(Q.data.grant.params)}).then(async(J)=>{if(!J.ok)throw Error(await J.text());return J.json()}).then((J)=>{p0.set_req_token(J.access_token),$(J.access_token)}).catch((J)=>{p0.set_req_token(),Z(J)})})}}var CQ=async(Q)=>{let{atom:X,packageDependencies:$,context:Z,deploymentProjectTarget:J,setProgress:V,deploymentProject:q,yamlTarget:_}=Q;if(J.enabled!==!0)return;let Y=J.type;try{if(Y==="lib")await(await import("./index.rmg5mgw9.js")).default({...Q});else if(Y==="red")await(await import("./index.gxm60tqk.js")).default({...Q});else if(Y==="npm")await(await import("./index.e6g5y0zg.js")).default({...Q});else if(Y==="gcs")await(await import("./index.zhpbpxhe.js")).default({...Q});else if(Y==="gitlab")await(await import("./index.w9hzkjf2.js")).default({...Q});else if(Y==="fnet-package")await(await import("./index.j1ner1yd.js")).default({...Q});else if(Y==="fnet-form")await(await import("./index.5p4zde7t.js")).default({...Q});else if(Y==="fnet-node")await(await import("./index.vsqseyhf.js")).default({...Q});else if(Y==="fnet-flow")await(await import("./index.3968nzbd.js")).default({...Q});else if(Y==="nextjs")await(await import("./index.n1598ffs.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="webos")await(await import("./index.5f1kfz9t.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="electron")await(await import("./index.xc08sjp4.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="docker")await(await import("./index.a4q2w1yd.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="ios")await(await import("./index.ng6w9cac.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="macos")await(await import("./index.btj5x5s4.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="rust")await(await import("./index.7ev6y63q.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="pypi")await(await import("./index.zb59076q.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else{console.warn(`No deployer found for type: ${Y}`);return}}catch(H){throw console.error(`Error during deployment for type "${Y}":`,H),H}};class MQ{#Q;#X;#$;#J;#q;#M;#U;#_;#H;#Y;#K;#Z;#G;#B;#j;#z;#w;constructor(Q){this.#Q=new wQ,this.#X=Q,this.#M=[],this.#U=[],this._expire_ttl=3600,this._expire_ttl_short=300,this.#w={packageDependencies:this.#M,packageDevDependencies:this.#U,setProgress:this.setProgress.bind(this),context:this.#X,Atom:$0,registerToPackageManager:this.registerToPackageManager.bind(this)}}get apiContext(){return this.#w}get context(){return this.#X}get atom(){return this.#$}get libs(){return this.#q}set libs(Q){this.#q=Q}get fileMode(){return this.#B}get buildMode(){return this.#j}get deployMode(){return this.#z}async _cache_set(Q,X,$){}async initAuth(){if(!this.#X.id)return;this.#_=await this.#Q.init({config:this.#Z}),this.#w.atomAccessToken=this.#_}async initLibrary(){let Q=this.#X.id;this.#$=this.#X.project?.libraryAtom||await $0.get({id:Q});let X=this.#$.doc.bundleName;X=X||(this.#$.doc.name||"").toUpperCase().replace(/[^A-Z0-9]/g,"_"),this.#$.doc.bundleName=X,this.#$.type=this.#$.type||"workflow.lib",this.#w.atom=this.#$}async initLibraryDir(){this.setProgress({message:"Initializing library directory."});let Q=this.#X.projectDir;this.setProgress({message:"Cleaning project directory."});let X=BQ({dir:Q,ignore:[".cache","node_modules",".conda",".bin",".dev"],absolute:!0});for(let Z of X)p.rmSync(Z,{recursive:!0,force:!0});this.setProgress({message:"Creating project directory."});let $=Q;if(!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,"src"),!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,"src","default"),!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,".dev"),!p.existsSync($))p.mkdirSync($,{recursive:!0})}async initNunjucks(){this.setProgress({message:"Initializing nunjucks."});let Q=this.#X.templateDir;this.#J=$5.configure(Q,{watch:!1,dev:!0}),this.#w.njEnv=this.#J}async createProjectYaml(){await this.setProgress({message:"Creating fnode.yaml"});let{content:$,...Z}=this.#$.doc,J=this.#X.projectDir,V=i0.resolve(J,"fnode.yaml");p.writeFileSync(V,X5.stringify(Z),"utf8")}async deploy(){if(await this.setProgress({message:"Deploying."}),this.#X.project?.devops){let Q=[this.#X.project?.devops];for(let X=0;X<Q.length;X++){let $=Q[X];if(await this.deployProject({deploymentProject:$}),$.isDirty===!0)await $.save()}}else if(this.#$.id){let Q=await $0.list({type:"library.deploy",parent_id:this.#$.id});for(let X=0;X<Q.length;X++){let $=Q[X];if(await this.deployProject({deploymentProject:$}),$.isDirty===!0)$=await $0.update($,{id:$.id})}}}async deployProject(Q){let{deploymentProject:X}=Q,{yamlDocument:$}=X;if(X.doc.targets&&Array.isArray(X.doc.targets))throw Error("Deployment project targets are deprecated. Please update targets in the yaml file.");let Z=Object.keys(X.doc||{}),J=$||{};for(let V=0;V<Z.length;V++){let q=X.doc[Z[V]];q.name=Z[V];let _=J.get(Z[V]);await CQ({...this.#w,deploymentProject:X,deploymentProjectTarget:q,yamlTarget:_})}}async registerToPackageManager(Q){let{target:X,packageJSON:$}=Q;if(!this.#X.id)return;let Z=await $0.first({name:X.params.name,parent_id:this.#Z.env.ATOM_PACKAGES_ID});if(!Z)Z=await $0.create({parent_id:this.#Z.env.ATOM_PACKAGES_ID,doc:{name:X.params.name,type:"pm",versions:[{v:$.version}]}});else Z.doc.versions.splice(0,0,{v:$.version}),await $0.update(Z,{id:Z.id})}async setProgress(Q){let X=typeof Q==="string"?Q:Q?.message;console.log(Z5.blue(X)),await this._cache_set(this.#Y,{status:"IN_PROGRESS",message:X})}async init(){this.#H=this.#X.buildId||Q5(),this.#w.buildId=this.#H,this.#G=this.#X.mode,this.#B=["all","deploy","build","file"].includes(this.#G),this.#j=["all","deploy","build"].includes(this.#G),this.#z=["all","deploy"].includes(this.#G),this.#K=this.#X.protocol,this.#Y="BUILD:"+this.#H,this.#Z=(await J5({optional:!0,name:this.#X.atomConfig||"atom",dir:this.#X.projectDir,tags:this.#X.tags}))?.data;try{await this.setProgress({message:"Initialization started."}),await this.initAuth(),await this.initLibrary(),await this.initRuntime()}catch(Q){throw await this._cache_set(this.#Y,{status:"FAILED",message:Q?.message||Q}),Q}}async initRuntime(){throw Error("initRuntime method must be implemented by runtime-specific builder")}async build(){throw Error("build method must be implemented by runtime-specific builder")}}var k6=MQ;import RQ from"node:fs";import AQ from"node:path";import IQ from"nunjucks";async function V5({atom:Q,setProgress:X,context:$,packageDependencies:Z}){await X({message:"Creating .gitignore"});let J={atom:Q,packageDependencies:Z},V=$.templateDir,_=IQ.compile(RQ.readFileSync(AQ.resolve(V,".gitignore.njk"),"utf8"),IQ.configure(V)).render(J),Y=$.projectDir,H=AQ.resolve(Y,".gitignore");RQ.writeFileSync(H,_,"utf8")}import n0 from"nunjucks";import s from"node:fs";import Z0 from"node:path";import LQ from"@fnet/yaml";async function q5({atom:Q,context:X,setProgress:$,Atom:Z}){if(await $({message:"Creating readme.md"}),X.project?.readme){let q=X.projectDir,_={content:X.project.readme.doc.content},Y=Z0.resolve(X.project.projectDir,"fnet/how-to.md");if(s.existsSync(Y)){let U=s.readFileSync(Y,"utf8");_.howto=U}let H=Z0.resolve(X.project.projectDir,"fnet/input.yaml");if(s.existsSync(H)){let U=await LQ({file:H,tags:X.tags});_.input=U.content}let K=Z0.resolve(X.project.projectDir,"fnet/output.yaml");if(s.existsSync(K)){let U=await LQ({file:K,tags:X.tags});_.output=U.content}let G=X.templateDir,z=n0.compile(s.readFileSync(Z0.resolve(G,"readme.md.njk"),"utf8"),n0.configure(G)).render(_),j=Z0.resolve(q,"readme.md");s.writeFileSync(j,z,"utf8")}else if(Q.id){let q=await Z.first({type:"wiki",parent_id:Q.id});if(!q||q.doc?.["content-type"]!=="markdown")return;let{content:_,...Y}=q.doc,H={content:_},K=X.templateDir,W=n0.compile(s.readFileSync(Z0.resolve(K,"readme.md.njk"),"utf8"),n0.configure(K)).render(H),z=X.projectDir,j=Z0.resolve(z,"readme.md");s.writeFileSync(j,W,"utf8")}}
|
|
3
|
+
>>> no match, partial?`,Q,G,X,W),G===_)return!0}return!1}let j;if(typeof H==="string")j=K===H,this.debug("string match",H,K,j);else j=H.test(K),this.debug("pattern match",H,K,j);if(!j)return!1}if(V===_&&q===Y)return!0;else if(V===_)return $;else if(q===Y)return V===_-1&&Q[V]==="";else throw Error("wtf?")}braceExpand(){return y8(this.pattern,this.options)}parse(Q){G0(Q);let X=this.options;if(Q==="**")return v;if(Q==="")return"";let $,Z=null;if($=Q.match(sQ))Z=X.dot?tQ:eQ;else if($=Q.match(hQ))Z=(X.nocase?X.dot?oQ:lQ:X.dot?cQ:dQ)($[1]);else if($=Q.match(QX))Z=(X.nocase?X.dot?$X:XX:X.dot?ZX:JX)($);else if($=Q.match(pQ))Z=X.dot?nQ:iQ;else if($=Q.match(rQ))Z=aQ;let J=N.fromGlob(Q,this.options).toMMPattern();if(Z&&typeof J==="object")Reflect.defineProperty(J,"test",{value:Z});return J}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,$=X.noglobstar?_X:X.dot?YX:KX,Z=new Set(X.nocase?["i"]:[]),J=Q.map((_)=>{let Y=_.map((H)=>{if(H instanceof RegExp)for(let K of H.flags.split(""))Z.add(K);return typeof H==="string"?zX(H):H===v?v:H._src});return Y.forEach((H,K)=>{let G=Y[K+1],W=Y[K-1];if(H!==v||W===v)return;if(W===void 0)if(G!==void 0&&G!==v)Y[K+1]="(?:\\/|"+$+"\\/)?"+G;else Y[K]=$;else if(G===void 0)Y[K-1]=W+"(?:\\/|"+$+")?";else if(G!==v)Y[K-1]=W+"(?:\\/|\\/"+$+"\\/)"+G,Y[K+1]=v}),Y.filter((H)=>H!==v).join("/")}).join("|"),[V,q]=Q.length>1?["(?:",")"]:["",""];if(J="^"+V+J+q+"$",this.negate)J="^(?!"+J+").+$";try{this.regexp=new RegExp(J,[...Z].join(""))}catch(_){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let $=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let Z=this.slashSplit(Q);this.debug(this.pattern,"split",Z);let J=this.set;this.debug(this.pattern,"set",J);let V=Z[Z.length-1];if(!V)for(let q=Z.length-2;!V&&q>=0;q--)V=Z[q];for(let q=0;q<J.length;q++){let _=J[q],Y=Z;if($.matchBase&&_.length===1)Y=[V];if(this.matchOne(Y,_,X)){if($.flipNegate)return!0;return!this.negate}}if($.flipNegate)return!1;return this.negate}static defaults(Q){return k.defaults(Q).Minimatch}}k.AST=N;k.Minimatch=x;k.escape=V0;k.unescape=g;import{fileURLToPath as pX}from"node:url";var q0=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,h8=new Set,e0=typeof process==="object"&&!!process?process:{},d8=(Q,X,$,Z)=>{typeof e0.emitWarning==="function"?e0.emitWarning(Q,X,$,Z):console.error(`[${$}] ${X}: ${Q}`)},D0=globalThis.AbortController,g8=globalThis.AbortSignal;if(typeof D0>"u"){g8=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,J){this._onabort.push(J)}},D0=class{constructor(){X()}signal=new g8;abort(Z){if(this.signal.aborted)return;this.signal.reason=Z,this.signal.aborted=!0;for(let J of this.signal._onabort)J(Z);this.signal.onabort?.(Z)}};let Q=e0.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{if(!Q)return;Q=!1,d8("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",X)}}var UX=(Q)=>!h8.has(Q),O5=Symbol("type"),r=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),c8=(Q)=>!r(Q)?null:Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?z0:null;class z0 extends Array{constructor(Q){super(Q);this.fill(0)}}class _0{heap;length;static#Q=!1;static create(Q){let X=c8(Q);if(!X)return[];_0.#Q=!0;let $=new _0(Q,X);return _0.#Q=!1,$}constructor(Q,X){if(!_0.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new X(Q),this.length=0}push(Q){this.heap[this.length++]=Q}pop(){return this.heap[--this.length]}}class U0{#Q;#X;#$;#J;#q;#M;#U;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#_;#H;#Y;#K;#Z;#G;#B;#j;#z;#w;#R;#P;#L;#I;#A;#N;#C;#k;static unsafeExposeInternals(Q){return{starts:Q.#L,ttls:Q.#I,sizes:Q.#P,keyMap:Q.#Y,keyList:Q.#K,valList:Q.#Z,next:Q.#G,prev:Q.#B,get head(){return Q.#j},get tail(){return Q.#z},free:Q.#w,isBackgroundFetch:(X)=>Q.#W(X),backgroundFetch:(X,$,Z,J)=>Q.#E(X,$,Z,J),moveToTail:(X)=>Q.#f(X),indexes:(X)=>Q.#v(X),rindexes:(X)=>Q.#D(X),isStale:(X)=>Q.#F(X)}}get max(){return this.#Q}get maxSize(){return this.#X}get calculatedSize(){return this.#H}get size(){return this.#_}get fetchMethod(){return this.#M}get memoMethod(){return this.#U}get dispose(){return this.#$}get onInsert(){return this.#J}get disposeAfter(){return this.#q}constructor(Q){let{max:X=0,ttl:$,ttlResolution:Z=1,ttlAutopurge:J,updateAgeOnGet:V,updateAgeOnHas:q,allowStale:_,dispose:Y,onInsert:H,disposeAfter:K,noDisposeOnSet:G,noUpdateTTL:W,maxSize:z=0,maxEntrySize:j=0,sizeCalculation:U,fetchMethod:B,memoMethod:C,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:b,ignoreFetchAbort:F}=Q;if(X!==0&&!r(X))throw TypeError("max option must be a nonnegative integer");let e=X?c8(X):Array;if(!e)throw Error("invalid max value: "+X);if(this.#Q=X,this.#X=z,this.maxEntrySize=j||this.#X,this.sizeCalculation=U,this.sizeCalculation){if(!this.#X&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#U=C,B!==void 0&&typeof B!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#M=B,this.#N=!!B,this.#Y=new Map,this.#K=Array(X).fill(void 0),this.#Z=Array(X).fill(void 0),this.#G=new e(X),this.#B=new e(X),this.#j=0,this.#z=0,this.#w=_0.create(X),this.#_=0,this.#H=0,typeof Y==="function")this.#$=Y;if(typeof H==="function")this.#J=H;if(typeof K==="function")this.#q=K,this.#R=[];else this.#q=void 0,this.#R=void 0;if(this.#A=!!this.#$,this.#k=!!this.#J,this.#C=!!this.#q,this.noDisposeOnSet=!!G,this.noUpdateTTL=!!W,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!b,this.ignoreFetchAbort=!!F,this.maxEntrySize!==0){if(this.#X!==0){if(!r(this.#X))throw TypeError("maxSize must be a positive integer if specified")}if(!r(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#g()}if(this.allowStale=!!_,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!V,this.updateAgeOnHas=!!q,this.ttlResolution=r(Z)||Z===0?Z:1,this.ttlAutopurge=!!J,this.ttl=$||0,this.ttl){if(!r(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#V()}if(this.#Q===0&&this.ttl===0&&this.#X===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#X){if(UX("LRU_CACHE_UNBOUNDED"))h8.add("LRU_CACHE_UNBOUNDED"),d8("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",U0)}}getRemainingTTL(Q){return this.#Y.has(Q)?1/0:0}#V(){let Q=new z0(this.#Q),X=new z0(this.#Q);this.#I=Q,this.#L=X,this.#S=(J,V,q=q0.now())=>{if(X[J]=V!==0?q:0,Q[J]=V,V!==0&&this.ttlAutopurge){let _=setTimeout(()=>{if(this.#F(J))this.#T(this.#K[J],"expire")},V+1);if(_.unref)_.unref()}},this.#b=(J)=>{X[J]=Q[J]!==0?q0.now():0},this.#O=(J,V)=>{if(Q[V]){let q=Q[V],_=X[V];if(!q||!_)return;J.ttl=q,J.start=_,J.now=$||Z();let Y=J.now-_;J.remainingTTL=q-Y}};let $=0,Z=()=>{let J=q0.now();if(this.ttlResolution>0){$=J;let V=setTimeout(()=>$=0,this.ttlResolution);if(V.unref)V.unref()}return J};this.getRemainingTTL=(J)=>{let V=this.#Y.get(J);if(V===void 0)return 0;let q=Q[V],_=X[V];if(!q||!_)return 1/0;let Y=($||Z())-_;return q-Y},this.#F=(J)=>{let V=X[J],q=Q[J];return!!q&&!!V&&($||Z())-V>q}}#b=()=>{};#O=()=>{};#S=()=>{};#F=()=>!1;#g(){let Q=new z0(this.#Q);this.#H=0,this.#P=Q,this.#u=(X)=>{this.#H-=Q[X],Q[X]=0},this.#h=(X,$,Z,J)=>{if(this.#W($))return 0;if(!r(Z))if(J){if(typeof J!=="function")throw TypeError("sizeCalculation must be a function");if(Z=J($,X),!r(Z))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return Z},this.#x=(X,$,Z)=>{if(Q[X]=$,this.#X){let J=this.#X-Q[X];while(this.#H>J)this.#m(!0)}if(this.#H+=Q[X],Z)Z.entrySize=$,Z.totalCalculatedSize=this.#H}}#u=(Q)=>{};#x=(Q,X,$)=>{};#h=(Q,X,$,Z)=>{if($||Z)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#v({allowStale:Q=this.allowStale}={}){if(this.#_)for(let X=this.#z;;){if(!this.#d(X))break;if(Q||!this.#F(X))yield X;if(X===this.#j)break;else X=this.#B[X]}}*#D({allowStale:Q=this.allowStale}={}){if(this.#_)for(let X=this.#j;;){if(!this.#d(X))break;if(Q||!this.#F(X))yield X;if(X===this.#z)break;else X=this.#G[X]}}#d(Q){return Q!==void 0&&this.#Y.get(this.#K[Q])===Q}*entries(){for(let Q of this.#v())if(this.#Z[Q]!==void 0&&this.#K[Q]!==void 0&&!this.#W(this.#Z[Q]))yield[this.#K[Q],this.#Z[Q]]}*rentries(){for(let Q of this.#D())if(this.#Z[Q]!==void 0&&this.#K[Q]!==void 0&&!this.#W(this.#Z[Q]))yield[this.#K[Q],this.#Z[Q]]}*keys(){for(let Q of this.#v()){let X=this.#K[Q];if(X!==void 0&&!this.#W(this.#Z[Q]))yield X}}*rkeys(){for(let Q of this.#D()){let X=this.#K[Q];if(X!==void 0&&!this.#W(this.#Z[Q]))yield X}}*values(){for(let Q of this.#v())if(this.#Z[Q]!==void 0&&!this.#W(this.#Z[Q]))yield this.#Z[Q]}*rvalues(){for(let Q of this.#D())if(this.#Z[Q]!==void 0&&!this.#W(this.#Z[Q]))yield this.#Z[Q]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(Q,X={}){for(let $ of this.#v()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;if(Q(J,this.#K[$],this))return this.get(this.#K[$],X)}}forEach(Q,X=this){for(let $ of this.#v()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;Q.call(X,J,this.#K[$],this)}}rforEach(Q,X=this){for(let $ of this.#D()){let Z=this.#Z[$],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0)continue;Q.call(X,J,this.#K[$],this)}}purgeStale(){let Q=!1;for(let X of this.#D({allowStale:!0}))if(this.#F(X))this.#T(this.#K[X],"expire"),Q=!0;return Q}info(Q){let X=this.#Y.get(Q);if(X===void 0)return;let $=this.#Z[X],Z=this.#W($)?$.__staleWhileFetching:$;if(Z===void 0)return;let J={value:Z};if(this.#I&&this.#L){let V=this.#I[X],q=this.#L[X];if(V&&q){let _=V-(q0.now()-q);J.ttl=_,J.start=Date.now()}}if(this.#P)J.size=this.#P[X];return J}dump(){let Q=[];for(let X of this.#v({allowStale:!0})){let $=this.#K[X],Z=this.#Z[X],J=this.#W(Z)?Z.__staleWhileFetching:Z;if(J===void 0||$===void 0)continue;let V={value:J};if(this.#I&&this.#L){V.ttl=this.#I[X];let q=q0.now()-this.#L[X];V.start=Math.floor(Date.now()-q)}if(this.#P)V.size=this.#P[X];Q.unshift([$,V])}return Q}load(Q){this.clear();for(let[X,$]of Q){if($.start){let Z=Date.now()-$.start;$.start=q0.now()-Z}this.set(X,$.value,$)}}set(Q,X,$={}){if(X===void 0)return this.delete(Q),this;let{ttl:Z=this.ttl,start:J,noDisposeOnSet:V=this.noDisposeOnSet,sizeCalculation:q=this.sizeCalculation,status:_}=$,{noUpdateTTL:Y=this.noUpdateTTL}=$,H=this.#h(Q,X,$.size||0,q);if(this.maxEntrySize&&H>this.maxEntrySize){if(_)_.set="miss",_.maxEntrySizeExceeded=!0;return this.#T(Q,"set"),this}let K=this.#_===0?void 0:this.#Y.get(Q);if(K===void 0){if(K=this.#_===0?this.#z:this.#w.length!==0?this.#w.pop():this.#_===this.#Q?this.#m(!1):this.#_,this.#K[K]=Q,this.#Z[K]=X,this.#Y.set(Q,K),this.#G[this.#z]=K,this.#B[K]=this.#z,this.#z=K,this.#_++,this.#x(K,H,_),_)_.set="add";if(Y=!1,this.#k)this.#J?.(X,Q,"add")}else{this.#f(K);let G=this.#Z[K];if(X!==G){if(this.#N&&this.#W(G)){G.__abortController.abort(Error("replaced"));let{__staleWhileFetching:W}=G;if(W!==void 0&&!V){if(this.#A)this.#$?.(W,Q,"set");if(this.#C)this.#R?.push([W,Q,"set"])}}else if(!V){if(this.#A)this.#$?.(G,Q,"set");if(this.#C)this.#R?.push([G,Q,"set"])}if(this.#u(K),this.#x(K,H,_),this.#Z[K]=X,_){_.set="replace";let W=G&&this.#W(G)?G.__staleWhileFetching:G;if(W!==void 0)_.oldValue=W}}else if(_)_.set="update";if(this.#k)this.onInsert?.(X,Q,X===G?"update":"replace")}if(Z!==0&&!this.#I)this.#V();if(this.#I){if(!Y)this.#S(K,Z,J);if(_)this.#O(_,K)}if(!V&&this.#C&&this.#R){let G=this.#R,W;while(W=G?.shift())this.#q?.(...W)}return this}pop(){try{while(this.#_){let Q=this.#Z[this.#j];if(this.#m(!0),this.#W(Q)){if(Q.__staleWhileFetching)return Q.__staleWhileFetching}else if(Q!==void 0)return Q}}finally{if(this.#C&&this.#R){let Q=this.#R,X;while(X=Q?.shift())this.#q?.(...X)}}}#m(Q){let X=this.#j,$=this.#K[X],Z=this.#Z[X];if(this.#N&&this.#W(Z))Z.__abortController.abort(Error("evicted"));else if(this.#A||this.#C){if(this.#A)this.#$?.(Z,$,"evict");if(this.#C)this.#R?.push([Z,$,"evict"])}if(this.#u(X),Q)this.#K[X]=void 0,this.#Z[X]=void 0,this.#w.push(X);if(this.#_===1)this.#j=this.#z=0,this.#w.length=0;else this.#j=this.#G[X];return this.#Y.delete($),this.#_--,X}has(Q,X={}){let{updateAgeOnHas:$=this.updateAgeOnHas,status:Z}=X,J=this.#Y.get(Q);if(J!==void 0){let V=this.#Z[J];if(this.#W(V)&&V.__staleWhileFetching===void 0)return!1;if(!this.#F(J)){if($)this.#b(J);if(Z)Z.has="hit",this.#O(Z,J);return!0}else if(Z)Z.has="stale",this.#O(Z,J)}else if(Z)Z.has="miss";return!1}peek(Q,X={}){let{allowStale:$=this.allowStale}=X,Z=this.#Y.get(Q);if(Z===void 0||!$&&this.#F(Z))return;let J=this.#Z[Z];return this.#W(J)?J.__staleWhileFetching:J}#E(Q,X,$,Z){let J=X===void 0?void 0:this.#Z[X];if(this.#W(J))return J;let V=new D0,{signal:q}=$;q?.addEventListener("abort",()=>V.abort(q.reason),{signal:V.signal});let _={signal:V.signal,options:$,context:Z},Y=(j,U=!1)=>{let{aborted:B}=V.signal,C=$.ignoreFetchAbort&&j!==void 0;if($.status)if(B&&!U){if($.status.fetchAborted=!0,$.status.fetchError=V.signal.reason,C)$.status.fetchAbortIgnored=!0}else $.status.fetchResolved=!0;if(B&&!C&&!U)return K(V.signal.reason);let M=W;if(this.#Z[X]===W)if(j===void 0)if(M.__staleWhileFetching)this.#Z[X]=M.__staleWhileFetching;else this.#T(Q,"fetch");else{if($.status)$.status.fetchUpdated=!0;this.set(Q,j,_.options)}return j},H=(j)=>{if($.status)$.status.fetchRejected=!0,$.status.fetchError=j;return K(j)},K=(j)=>{let{aborted:U}=V.signal,B=U&&$.allowStaleOnFetchAbort,C=B||$.allowStaleOnFetchRejection,M=C||$.noDeleteOnFetchRejection,w=W;if(this.#Z[X]===W){if(!M||w.__staleWhileFetching===void 0)this.#T(Q,"fetch");else if(!B)this.#Z[X]=w.__staleWhileFetching}if(C){if($.status&&w.__staleWhileFetching!==void 0)$.status.returnedStale=!0;return w.__staleWhileFetching}else if(w.__returned===w)throw j},G=(j,U)=>{let B=this.#M?.(Q,J,_);if(B&&B instanceof Promise)B.then((C)=>j(C===void 0?void 0:C),U);V.signal.addEventListener("abort",()=>{if(!$.ignoreFetchAbort||$.allowStaleOnFetchAbort){if(j(void 0),$.allowStaleOnFetchAbort)j=(C)=>Y(C,!0)}})};if($.status)$.status.fetchDispatched=!0;let W=new Promise(G).then(Y,H),z=Object.assign(W,{__abortController:V,__staleWhileFetching:J,__returned:void 0});if(X===void 0)this.set(Q,z,{..._.options,status:void 0}),X=this.#Y.get(Q);else this.#Z[X]=z;return z}#W(Q){if(!this.#N)return!1;let X=Q;return!!X&&X instanceof Promise&&X.hasOwnProperty("__staleWhileFetching")&&X.__abortController instanceof D0}async fetch(Q,X={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Z=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,ttl:V=this.ttl,noDisposeOnSet:q=this.noDisposeOnSet,size:_=0,sizeCalculation:Y=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:K=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:G=this.allowStaleOnFetchRejection,ignoreFetchAbort:W=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:j,forceRefresh:U=!1,status:B,signal:C}=X;if(!this.#N){if(B)B.fetch="get";return this.get(Q,{allowStale:$,updateAgeOnGet:Z,noDeleteOnStaleGet:J,status:B})}let M={allowStale:$,updateAgeOnGet:Z,noDeleteOnStaleGet:J,ttl:V,noDisposeOnSet:q,size:_,sizeCalculation:Y,noUpdateTTL:H,noDeleteOnFetchRejection:K,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:z,ignoreFetchAbort:W,status:B,signal:C},w=this.#Y.get(Q);if(w===void 0){if(B)B.fetch="miss";let R=this.#E(Q,w,M,j);return R.__returned=R}else{let R=this.#Z[w];if(this.#W(R)){let y=$&&R.__staleWhileFetching!==void 0;if(B){if(B.fetch="inflight",y)B.returnedStale=!0}return y?R.__staleWhileFetching:R.__returned=R}let b=this.#F(w);if(!U&&!b){if(B)B.fetch="hit";if(this.#f(w),Z)this.#b(w);if(B)this.#O(B,w);return R}let F=this.#E(Q,w,M,j),J0=F.__staleWhileFetching!==void 0&&$;if(B){if(B.fetch=b?"stale":"refresh",J0&&b)B.returnedStale=!0}return J0?F.__staleWhileFetching:F.__returned=F}}async forceFetch(Q,X={}){let $=await this.fetch(Q,X);if($===void 0)throw Error("fetch() returned undefined");return $}memo(Q,X={}){let $=this.#U;if(!$)throw Error("no memoMethod provided to constructor");let{context:Z,forceRefresh:J,...V}=X,q=this.get(Q,V);if(!J&&q!==void 0)return q;let _=$(Q,q,{options:V,context:Z});return this.set(Q,_,V),_}get(Q,X={}){let{allowStale:$=this.allowStale,updateAgeOnGet:Z=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,status:V}=X,q=this.#Y.get(Q);if(q!==void 0){let _=this.#Z[q],Y=this.#W(_);if(V)this.#O(V,q);if(this.#F(q)){if(V)V.get="stale";if(!Y){if(!J)this.#T(Q,"expire");if(V&&$)V.returnedStale=!0;return $?_:void 0}else{if(V&&$&&_.__staleWhileFetching!==void 0)V.returnedStale=!0;return $?_.__staleWhileFetching:void 0}}else{if(V)V.get="hit";if(Y)return _.__staleWhileFetching;if(this.#f(q),Z)this.#b(q);return _}}else if(V)V.get="miss"}#c(Q,X){this.#B[X]=Q,this.#G[Q]=X}#f(Q){if(Q!==this.#z){if(Q===this.#j)this.#j=this.#G[Q];else this.#c(this.#B[Q],this.#G[Q]);this.#c(this.#z,Q),this.#z=Q}}delete(Q){return this.#T(Q,"delete")}#T(Q,X){let $=!1;if(this.#_!==0){let Z=this.#Y.get(Q);if(Z!==void 0)if($=!0,this.#_===1)this.#y(X);else{this.#u(Z);let J=this.#Z[Z];if(this.#W(J))J.__abortController.abort(Error("deleted"));else if(this.#A||this.#C){if(this.#A)this.#$?.(J,Q,X);if(this.#C)this.#R?.push([J,Q,X])}if(this.#Y.delete(Q),this.#K[Z]=void 0,this.#Z[Z]=void 0,Z===this.#z)this.#z=this.#B[Z];else if(Z===this.#j)this.#j=this.#G[Z];else{let V=this.#B[Z];this.#G[V]=this.#G[Z];let q=this.#G[Z];this.#B[q]=this.#B[Z]}this.#_--,this.#w.push(Z)}}if(this.#C&&this.#R?.length){let Z=this.#R,J;while(J=Z?.shift())this.#q?.(...J)}return $}clear(){return this.#y("delete")}#y(Q){for(let X of this.#D({allowStale:!0})){let $=this.#Z[X];if(this.#W($))$.__abortController.abort(Error("deleted"));else{let Z=this.#K[X];if(this.#A)this.#$?.($,Z,Q);if(this.#C)this.#R?.push([$,Z,Q])}}if(this.#Y.clear(),this.#Z.fill(void 0),this.#K.fill(void 0),this.#I&&this.#L)this.#I.fill(0),this.#L.fill(0);if(this.#P)this.#P.fill(0);if(this.#j=0,this.#z=0,this.#w.length=0,this.#H=0,this.#_=0,this.#C&&this.#R){let X=this.#R,$;while($=X?.shift())this.#q?.(...$)}}}import{posix as NX,win32 as Y8}from"node:path";import{fileURLToPath as vX}from"node:url";import{lstatSync as PX,readdir as DX,readdirSync as kX,readlinkSync as SX,realpathSync as TX}from"fs";import*as bX from"node:fs";import{lstat as EX,readdir as xX,readlink as mX,realpath as fX}from"node:fs/promises";import{EventEmitter as J8}from"node:events";import n8 from"node:stream";import{StringDecoder as BX}from"node:string_decoder";var l8=typeof process==="object"&&process?process:{stdout:null,stderr:null},wX=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof Q0||Q instanceof n8||CX(Q)||MX(Q)),CX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof J8&&typeof Q.pipe==="function"&&Q.pipe!==n8.Writable.prototype.pipe,MX=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof J8&&typeof Q.write==="function"&&typeof Q.end==="function",i=Symbol("EOF"),n=Symbol("maybeEmitEnd"),a=Symbol("emittedEnd"),k0=Symbol("emittingEnd"),B0=Symbol("emittedError"),S0=Symbol("closed"),o8=Symbol("read"),T0=Symbol("flush"),p8=Symbol("flushChunk"),h=Symbol("encoding"),Y0=Symbol("decoder"),I=Symbol("flowing"),w0=Symbol("paused"),K0=Symbol("resume"),L=Symbol("buffer"),S=Symbol("pipes"),O=Symbol("bufferLength"),t0=Symbol("bufferPush"),b0=Symbol("bufferShift"),D=Symbol("objectMode"),A=Symbol("destroyed"),Q8=Symbol("error"),X8=Symbol("emitData"),i8=Symbol("emitEnd"),$8=Symbol("emitEnd2"),c=Symbol("async"),Z8=Symbol("abort"),u0=Symbol("aborted"),C0=Symbol("signal"),t=Symbol("dataListeners"),u=Symbol("discarded"),M0=(Q)=>Promise.resolve().then(Q),RX=(Q)=>Q(),AX=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",IX=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,LX=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class V8{src;dest;opts;ondrain;constructor(Q,X,$){this.src=Q,this.dest=X,this.opts=$,this.ondrain=()=>Q[K0](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class r8 extends V8{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,$){super(Q,X,$);this.proxyErrors=(Z)=>X.emit("error",Z),Q.on("error",this.proxyErrors)}}var OX=(Q)=>!!Q.objectMode,FX=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class Q0 extends J8{[I]=!1;[w0]=!1;[S]=[];[L]=[];[D];[h];[c];[Y0];[i]=!1;[a]=!1;[k0]=!1;[S0]=!1;[B0]=null;[O]=0;[A]=!1;[C0];[u0]=!1;[t]=0;[u]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(OX(X))this[D]=!0,this[h]=null;else if(FX(X))this[h]=X.encoding,this[D]=!1;else this[D]=!1,this[h]=null;if(this[c]=!!X.async,this[Y0]=this[h]?new BX(this[h]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[L]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[S]});let{signal:$}=X;if($)if(this[C0]=$,$.aborted)this[Z8]();else $.addEventListener("abort",()=>this[Z8]())}get bufferLength(){return this[O]}get encoding(){return this[h]}set encoding(Q){throw Error("Encoding must be set at instantiation time")}setEncoding(Q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[D]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[c]}set["async"](Q){this[c]=this[c]||!!Q}[Z8](){this[u0]=!0,this.emit("abort",this[C0]?.reason),this.destroy(this[C0]?.reason)}get aborted(){return this[u0]}set aborted(Q){}write(Q,X,$){if(this[u0])return!1;if(this[i])throw Error("write after end");if(this[A])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")$=X,X="utf8";if(!X)X="utf8";let Z=this[c]?M0:RX;if(!this[D]&&!Buffer.isBuffer(Q)){if(LX(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(IX(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[D]){if(this[I]&&this[O]!==0)this[T0](!0);if(this[I])this.emit("data",Q);else this[t0](Q);if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}if(!Q.length){if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}if(typeof Q==="string"&&!(X===this[h]&&!this[Y0]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[h])Q=this[Y0].write(Q);if(this[I]&&this[O]!==0)this[T0](!0);if(this[I])this.emit("data",Q);else this[t0](Q);if(this[O]!==0)this.emit("readable");if($)Z($);return this[I]}read(Q){if(this[A])return null;if(this[u]=!1,this[O]===0||Q===0||Q&&Q>this[O])return this[n](),null;if(this[D])Q=null;if(this[L].length>1&&!this[D])this[L]=[this[h]?this[L].join(""):Buffer.concat(this[L],this[O])];let X=this[o8](Q||null,this[L][0]);return this[n](),X}[o8](Q,X){if(this[D])this[b0]();else{let $=X;if(Q===$.length||Q===null)this[b0]();else if(typeof $==="string")this[L][0]=$.slice(Q),X=$.slice(0,Q),this[O]-=Q;else this[L][0]=$.subarray(Q),X=$.subarray(0,Q),this[O]-=Q}if(this.emit("data",X),!this[L].length&&!this[i])this.emit("drain");return X}end(Q,X,$){if(typeof Q==="function")$=Q,Q=void 0;if(typeof X==="function")$=X,X="utf8";if(Q!==void 0)this.write(Q,X);if($)this.once("end",$);if(this[i]=!0,this.writable=!1,this[I]||!this[w0])this[n]();return this}[K0](){if(this[A])return;if(!this[t]&&!this[S].length)this[u]=!0;if(this[w0]=!1,this[I]=!0,this.emit("resume"),this[L].length)this[T0]();else if(this[i])this[n]();else this.emit("drain")}resume(){return this[K0]()}pause(){this[I]=!1,this[w0]=!0,this[u]=!1}get destroyed(){return this[A]}get flowing(){return this[I]}get paused(){return this[w0]}[t0](Q){if(this[D])this[O]+=1;else this[O]+=Q.length;this[L].push(Q)}[b0](){if(this[D])this[O]-=1;else this[O]-=this[L][0].length;return this[L].shift()}[T0](Q=!1){do;while(this[p8](this[b0]())&&this[L].length);if(!Q&&!this[L].length&&!this[i])this.emit("drain")}[p8](Q){return this.emit("data",Q),this[I]}pipe(Q,X){if(this[A])return Q;this[u]=!1;let $=this[a];if(X=X||{},Q===l8.stdout||Q===l8.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,$){if(X.end)Q.end()}else if(this[S].push(!X.proxyErrors?new V8(this,Q,X):new r8(this,Q,X)),this[c])M0(()=>this[K0]());else this[K0]();return Q}unpipe(Q){let X=this[S].find(($)=>$.dest===Q);if(X){if(this[S].length===1){if(this[I]&&this[t]===0)this[I]=!1;this[S]=[]}else this[S].splice(this[S].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let $=super.on(Q,X);if(Q==="data"){if(this[u]=!1,this[t]++,!this[S].length&&!this[I])this[K0]()}else if(Q==="readable"&&this[O]!==0)super.emit("readable");else if(AX(Q)&&this[a])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[B0]){let Z=X;if(this[c])M0(()=>Z.call(this,this[B0]));else Z.call(this,this[B0])}return $}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let $=super.off(Q,X);if(Q==="data"){if(this[t]=this.listeners("data").length,this[t]===0&&!this[u]&&!this[S].length)this[I]=!1}return $}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[t]=0,!this[u]&&!this[S].length)this[I]=!1}return X}get emittedEnd(){return this[a]}[n](){if(!this[k0]&&!this[a]&&!this[A]&&this[L].length===0&&this[i]){if(this[k0]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[S0])this.emit("close");this[k0]=!1}}emit(Q,...X){let $=X[0];if(Q!=="error"&&Q!=="close"&&Q!==A&&this[A])return!1;else if(Q==="data")return!this[D]&&!$?!1:this[c]?(M0(()=>this[X8]($)),!0):this[X8]($);else if(Q==="end")return this[i8]();else if(Q==="close"){if(this[S0]=!0,!this[a]&&!this[A])return!1;let J=super.emit("close");return this.removeAllListeners("close"),J}else if(Q==="error"){this[B0]=$,super.emit(Q8,$);let J=!this[C0]||this.listeners("error").length?super.emit("error",$):!1;return this[n](),J}else if(Q==="resume"){let J=super.emit("resume");return this[n](),J}else if(Q==="finish"||Q==="prefinish"){let J=super.emit(Q);return this.removeAllListeners(Q),J}let Z=super.emit(Q,...X);return this[n](),Z}[X8](Q){for(let $ of this[S])if($.dest.write(Q)===!1)this.pause();let X=this[u]?!1:super.emit("data",Q);return this[n](),X}[i8](){if(this[a])return!1;return this[a]=!0,this.readable=!1,this[c]?(M0(()=>this[$8]()),!0):this[$8]()}[$8](){if(this[Y0]){let X=this[Y0].end();if(X){for(let $ of this[S])$.dest.write(X);if(!this[u])super.emit("data",X)}}for(let X of this[S])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[D])Q.dataLength=0;let X=this.promise();return this.on("data",($)=>{if(Q.push($),!this[D])Q.dataLength+=$.length}),await X,Q}async concat(){if(this[D])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[h]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(A,()=>X(Error("stream destroyed"))),this.on("error",($)=>X($)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[u]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let Z=this.read();if(Z!==null)return Promise.resolve({done:!1,value:Z});if(this[i])return X();let J,V,q=(K)=>{this.off("data",_),this.off("end",Y),this.off(A,H),X(),V(K)},_=(K)=>{this.off("error",q),this.off("end",Y),this.off(A,H),this.pause(),J({value:K,done:!!this[i]})},Y=()=>{this.off("error",q),this.off("data",_),this.off(A,H),X(),J({done:!0,value:void 0})},H=()=>q(Error("stream destroyed"));return new Promise((K,G)=>{V=G,J=K,this.once(A,H),this.once("error",q),this.once("end",Y),this.once("data",_)})},throw:X,return:X,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[u]=!1;let Q=!1,X=()=>{return this.pause(),this.off(Q8,X),this.off(A,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},$=()=>{if(Q)return X();let Z=this.read();return Z===null?X():{done:!1,value:Z}};return this.once("end",X),this.once(Q8,X),this.once(A,X),{next:$,throw:X,return:X,[Symbol.iterator](){return this}}}destroy(Q){if(this[A]){if(Q)this.emit("error",Q);else this.emit(A);return this}this[A]=!0,this[u]=!0,this[L].length=0,this[O]=0;let X=this;if(typeof X.close==="function"&&!this[S0])X.close();if(Q)this.emit("error",Q);else this.emit(A);return this}static get isStream(){return wX}}var uX=TX.native,A0={lstatSync:PX,readdir:DX,readdirSync:kX,readlinkSync:SX,realpathSync:uX,promises:{lstat:EX,readdir:xX,readlink:mX,realpath:fX}},QQ=(Q)=>!Q||Q===A0||Q===bX?A0:{...A0,...Q,promises:{...A0.promises,...Q.promises||{}}},XQ=/^\\\\\?\\([a-z]:)\\?$/i,yX=(Q)=>Q.replace(/\//g,"\\").replace(XQ,"$1\\"),gX=/[\\\/]/,f=0,$Q=1,ZQ=2,l=4,JQ=6,VQ=8,X0=10,qQ=12,m=15,R0=~m,q8=16,a8=32,I0=64,d=128,E0=256,m0=512,s8=I0|d|m0,hX=1023,_8=(Q)=>Q.isFile()?VQ:Q.isDirectory()?l:Q.isSymbolicLink()?X0:Q.isCharacterDevice()?ZQ:Q.isBlockDevice()?JQ:Q.isSocket()?qQ:Q.isFIFO()?$Q:f,e8=new Map,L0=(Q)=>{let X=e8.get(Q);if(X)return X;let $=Q.normalize("NFKD");return e8.set(Q,$),$},t8=new Map,x0=(Q)=>{let X=t8.get(Q);if(X)return X;let $=L0(Q.toLowerCase());return t8.set(Q,$),$};class K8 extends U0{constructor(){super({max:256})}}class _Q extends U0{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var YQ=Symbol("PathScurry setAsCwd");class T{name;root;roots;parent;nocase;isCWD=!1;#Q;#X;get dev(){return this.#X}#$;get mode(){return this.#$}#J;get nlink(){return this.#J}#q;get uid(){return this.#q}#M;get gid(){return this.#M}#U;get rdev(){return this.#U}#_;get blksize(){return this.#_}#H;get ino(){return this.#H}#Y;get size(){return this.#Y}#K;get blocks(){return this.#K}#Z;get atimeMs(){return this.#Z}#G;get mtimeMs(){return this.#G}#B;get ctimeMs(){return this.#B}#j;get birthtimeMs(){return this.#j}#z;get atime(){return this.#z}#w;get mtime(){return this.#w}#R;get ctime(){return this.#R}#P;get birthtime(){return this.#P}#L;#I;#A;#N;#C;#k;#V;#b;#O;#S;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=f,$,Z,J,V,q){if(this.name=Q,this.#L=J?x0(Q):L0(Q),this.#V=X&hX,this.nocase=J,this.roots=Z,this.root=$||this,this.#b=V,this.#A=q.fullpath,this.#C=q.relative,this.#k=q.relativePosix,this.parent=q.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=QQ(q.fs)}depth(){if(this.#I!==void 0)return this.#I;if(!this.parent)return this.#I=0;return this.#I=this.parent.depth()+1}childrenCache(){return this.#b}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),Z=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#F(Z):this.#F(Z)}#F(Q){let X=this;for(let $ of Q)X=X.child($);return X}children(){let Q=this.#b.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#b.set(this,X),this.#V&=~q8,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let $=this.children(),Z=this.nocase?x0(Q):L0(Q);for(let _ of $)if(_.#L===Z)return _;let J=this.parent?this.sep:"",V=this.#A?this.#A+J+Q:void 0,q=this.newChild(Q,f,{...X,parent:this,fullpath:V});if(!this.canReaddir())q.#V|=d;return $.push(q),q}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let Q=this.name,X=this.parent;if(!X)return this.#C=this.name;let $=X.relative();return $+(!$||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let Q=this.name,X=this.parent;if(!X)return this.#k=this.fullpathPosix();let $=X.relativePosix();return $+(!$||!X.parent?"":"/")+Q}fullpath(){if(this.#A!==void 0)return this.#A;let Q=this.name,X=this.parent;if(!X)return this.#A=this.name;let Z=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#A=Z}fullpathPosix(){if(this.#N!==void 0)return this.#N;if(this.sep==="/")return this.#N=this.fullpath();if(!this.parent){let Z=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(Z))return this.#N=`//?/${Z}`;else return this.#N=Z}let Q=this.parent,X=Q.fullpathPosix(),$=X+(!X||!Q.parent?"":"/")+this.name;return this.#N=$}isUnknown(){return(this.#V&m)===f}isType(Q){return this[`is${Q}`]()}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.#V&m)===VQ}isDirectory(){return(this.#V&m)===l}isCharacterDevice(){return(this.#V&m)===ZQ}isBlockDevice(){return(this.#V&m)===JQ}isFIFO(){return(this.#V&m)===$Q}isSocket(){return(this.#V&m)===qQ}isSymbolicLink(){return(this.#V&X0)===X0}lstatCached(){return this.#V&a8?this:void 0}readlinkCached(){return this.#O}realpathCached(){return this.#S}readdirCached(){let Q=this.children();return Q.slice(0,Q.provisional)}canReadlink(){if(this.#O)return!0;if(!this.parent)return!1;let Q=this.#V&m;return!(Q!==f&&Q!==X0||this.#V&E0||this.#V&d)}calledReaddir(){return!!(this.#V&q8)}isENOENT(){return!!(this.#V&d)}isNamed(Q){return!this.nocase?this.#L===L0(Q):this.#L===x0(Q)}async readlink(){let Q=this.#O;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),$=(await this.parent.realpath())?.resolve(X);if($)return this.#O=$}catch(X){this.#m(X.code);return}}readlinkSync(){let Q=this.#O;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),$=this.parent.realpathSync()?.resolve(X);if($)return this.#O=$}catch(X){this.#m(X.code);return}}#g(Q){this.#V|=q8;for(let X=Q.provisional;X<Q.length;X++){let $=Q[X];if($)$.#u()}}#u(){if(this.#V&d)return;this.#V=(this.#V|d)&R0,this.#x()}#x(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#u()}#h(){this.#V|=m0,this.#v()}#v(){if(this.#V&I0)return;let Q=this.#V;if((Q&m)===l)Q&=R0;this.#V=Q|I0,this.#x()}#D(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#v();else if(Q==="ENOENT")this.#u();else this.children().provisional=0}#d(Q=""){if(Q==="ENOTDIR")this.parent.#v();else if(Q==="ENOENT")this.#u()}#m(Q=""){let X=this.#V;if(X|=E0,Q==="ENOENT")X|=d;if(Q==="EINVAL"||Q==="UNKNOWN")X&=R0;if(this.#V=X,Q==="ENOTDIR"&&this.parent)this.parent.#v()}#E(Q,X){return this.#c(Q,X)||this.#W(Q,X)}#W(Q,X){let $=_8(Q),Z=this.newChild(Q.name,$,{parent:this}),J=Z.#V&m;if(J!==l&&J!==X0&&J!==f)Z.#V|=I0;return X.unshift(Z),X.provisional++,Z}#c(Q,X){for(let $=X.provisional;$<X.length;$++){let Z=X[$];if((this.nocase?x0(Q.name):L0(Q.name))!==Z.#L)continue;return this.#f(Q,Z,$,X)}}#f(Q,X,$,Z){let J=X.name;if(X.#V=X.#V&R0|_8(Q),J!==Q.name)X.name=Q.name;if($!==Z.provisional){if($===Z.length-1)Z.pop();else Z.splice($,1);Z.unshift(X)}return Z.provisional++,X}async lstat(){if((this.#V&d)===0)try{return this.#T(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#d(Q.code)}}lstatSync(){if((this.#V&d)===0)try{return this.#T(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#d(Q.code)}}#T(Q){let{atime:X,atimeMs:$,birthtime:Z,birthtimeMs:J,blksize:V,blocks:q,ctime:_,ctimeMs:Y,dev:H,gid:K,ino:G,mode:W,mtime:z,mtimeMs:j,nlink:U,rdev:B,size:C,uid:M}=Q;this.#z=X,this.#Z=$,this.#P=Z,this.#j=J,this.#_=V,this.#K=q,this.#R=_,this.#B=Y,this.#X=H,this.#M=K,this.#H=G,this.#$=W,this.#w=z,this.#G=j,this.#J=U,this.#U=B,this.#Y=C,this.#q=M;let w=_8(Q);if(this.#V=this.#V&R0|w|a8,w!==f&&w!==l&&w!==X0)this.#V|=I0}#y=[];#o=!1;#p(Q){this.#o=!1;let X=this.#y.slice();this.#y.length=0,X.forEach(($)=>$(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let $=this.children();if(this.calledReaddir()){let J=$.slice(0,$.provisional);if(X)Q(null,J);else queueMicrotask(()=>Q(null,J));return}if(this.#y.push(Q),this.#o)return;this.#o=!0;let Z=this.fullpath();this.#Q.readdir(Z,{withFileTypes:!0},(J,V)=>{if(J)this.#D(J.code),$.provisional=0;else{for(let q of V)this.#E(q,$);this.#g($)}this.#p($.slice(0,$.provisional));return})}#l;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#l)await this.#l;else{let $=()=>{};this.#l=new Promise((Z)=>$=Z);try{for(let Z of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#E(Z,Q);this.#g(Q)}catch(Z){this.#D(Z.code),Q.provisional=0}this.#l=void 0,$()}return Q.slice(0,Q.provisional)}readdirSync(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();try{for(let $ of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#E($,Q);this.#g(Q)}catch($){this.#D($.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#V&s8)return!1;let Q=m&this.#V;if(!(Q===f||Q===l||Q===X0))return!1;return!0}shouldWalk(Q,X){return(this.#V&l)===l&&!(this.#V&s8)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#S)return this.#S;if((m0|E0|d)&this.#V)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#S=this.resolve(Q)}catch(Q){this.#h()}}realpathSync(){if(this.#S)return this.#S;if((m0|E0|d)&this.#V)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#S=this.resolve(Q)}catch(Q){this.#h()}}[YQ](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),$=[],Z=this;while(Z&&Z.parent)X.add(Z),Z.#C=$.join(this.sep),Z.#k=$.join("/"),Z=Z.parent,$.push("..");Z=Q;while(Z&&Z.parent&&!X.has(Z))Z.#C=void 0,Z.#k=void 0,Z=Z.parent}}class f0 extends T{sep="\\";splitSep=gX;constructor(Q,X=f,$,Z,J,V,q){super(Q,X,$,Z,J,V,q)}newChild(Q,X=f,$={}){return new f0(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),$)}getRootString(Q){return Y8.parse(Q).root}getRoot(Q){if(Q=yX(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,$]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=$;return this.roots[Q]=new O0(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(XQ,"$1\\"),Q===X}}class y0 extends T{splitSep="/";sep="/";constructor(Q,X=f,$,Z,J,V,q){super(Q,X,$,Z,J,V,q)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=f,$={}){return new y0(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),$)}}class H8{root;rootPath;roots;cwd;#Q;#X;#$;nocase;#J;constructor(Q=process.cwd(),X,$,{nocase:Z,childrenCacheSize:J=16384,fs:V=A0}={}){if(this.#J=QQ(V),Q instanceof URL||Q.startsWith("file://"))Q=vX(Q);let q=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(q),this.#Q=new K8,this.#X=new K8,this.#$=new _Q(J);let _=q.substring(this.rootPath.length).split($);if(_.length===1&&!_[0])_.pop();if(Z===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=Z,this.root=this.newRoot(this.#J),this.roots[this.rootPath]=this.root;let Y=this.root,H=_.length-1,K=X.sep,G=this.rootPath,W=!1;for(let z of _){let j=H--;Y=Y.child(z,{relative:Array(j).fill("..").join(K),relativePosix:Array(j).fill("..").join("/"),fullpath:G+=(W?"":K)+z}),W=!0}this.cwd=Y}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#$}resolve(...Q){let X="";for(let J=Q.length-1;J>=0;J--){let V=Q[J];if(!V||V===".")continue;if(X=X?`${V}/${X}`:V,this.isAbsolute(V))break}let $=this.#Q.get(X);if($!==void 0)return $;let Z=this.cwd.resolve(X).fullpath();return this.#Q.set(X,Z),Z}resolvePosix(...Q){let X="";for(let J=Q.length-1;J>=0;J--){let V=Q[J];if(!V||V===".")continue;if(X=X?`${V}/${X}`:V,this.isAbsolute(V))break}let $=this.#X.get(X);if($!==void 0)return $;let Z=this.cwd.resolve(X).fullpathPosix();return this.#X.set(X,Z),Z}relative(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relative()}relativePosix(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relativePosix()}basename(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.name}dirname(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return(Q.parent||Q).fullpath()}async readdir(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$}=X;if(!Q.canReaddir())return[];else{let Z=await Q.readdir();return $?Z:Z.map((J)=>J.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0}=X;if(!Q.canReaddir())return[];else if($)return Q.readdirSync();else return Q.readdirSync().map((Z)=>Z.name)}async lstat(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstat()}lstatSync(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstatSync()}async readlink(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=await Q.readlink();return X?$:$?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=Q.readlinkSync();return X?$:$?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=await Q.realpath();return X?$:$?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q.withFileTypes,Q=this.cwd;let $=Q.realpathSync();return X?$:$?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=[];if(!J||J(Q))q.push($?Q:Q.fullpath());let _=new Set,Y=(K,G)=>{_.add(K),K.readdirCB((W,z)=>{if(W)return G(W);let j=z.length;if(!j)return G();let U=()=>{if(--j===0)G()};for(let B of z){if(!J||J(B))q.push($?B:B.fullpath());if(Z&&B.isSymbolicLink())B.realpath().then((C)=>C?.isUnknown()?C.lstat():C).then((C)=>C?.shouldWalk(_,V)?Y(C,U):U());else if(B.shouldWalk(_,V))Y(B,U);else U()}},!0)},H=Q;return new Promise((K,G)=>{Y(H,(W)=>{if(W)return G(W);K(q)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=[];if(!J||J(Q))q.push($?Q:Q.fullpath());let _=new Set([Q]);for(let Y of _){let H=Y.readdirSync();for(let K of H){if(!J||J(K))q.push($?K:K.fullpath());let G=K;if(K.isSymbolicLink()){if(!(Z&&(G=K.realpathSync())))continue;if(G.isUnknown())G.lstatSync()}if(G.shouldWalk(_,V))_.add(G)}}return q}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X;if(!J||J(Q))yield $?Q:Q.fullpath();let q=new Set([Q]);for(let _ of q){let Y=_.readdirSync();for(let H of Y){if(!J||J(H))yield $?H:H.fullpath();let K=H;if(H.isSymbolicLink()){if(!(Z&&(K=H.realpathSync())))continue;if(K.isUnknown())K.lstatSync()}if(K.shouldWalk(q,V))q.add(K)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=new Q0({objectMode:!0});if(!J||J(Q))q.write($?Q:Q.fullpath());let _=new Set,Y=[Q],H=0,K=()=>{let G=!1;while(!G){let W=Y.shift();if(!W){if(H===0)q.end();return}H++,_.add(W);let z=(U,B,C=!1)=>{if(U)return q.emit("error",U);if(Z&&!C){let M=[];for(let w of B)if(w.isSymbolicLink())M.push(w.realpath().then((R)=>R?.isUnknown()?R.lstat():R));if(M.length){Promise.all(M).then(()=>z(null,B,!0));return}}for(let M of B)if(M&&(!J||J(M))){if(!q.write($?M:M.fullpath()))G=!0}H--;for(let M of B){let w=M.realpathCached()||M;if(w.shouldWalk(_,V))Y.push(w)}if(G&&!q.flowing)q.once("drain",K);else if(!j)K()},j=!0;W.readdirCB(z,!0),j=!1}};return K(),q}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof T))X=Q,Q=this.cwd;let{withFileTypes:$=!0,follow:Z=!1,filter:J,walkFilter:V}=X,q=new Q0({objectMode:!0}),_=new Set;if(!J||J(Q))q.write($?Q:Q.fullpath());let Y=[Q],H=0,K=()=>{let G=!1;while(!G){let W=Y.shift();if(!W){if(H===0)q.end();return}H++,_.add(W);let z=W.readdirSync();for(let j of z)if(!J||J(j)){if(!q.write($?j:j.fullpath()))G=!0}H--;for(let j of z){let U=j;if(j.isSymbolicLink()){if(!(Z&&(U=j.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(_,V))Y.push(U)}}if(G&&!q.flowing)q.once("drain",K)};return K(),q}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[YQ](X)}}class O0 extends H8{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:$=!0}=X;super(Q,Y8,"\\",{...X,nocase:$});this.nocase=$;for(let Z=this.cwd;Z;Z=Z.parent)Z.nocase=this.nocase}parseRootPath(Q){return Y8.parse(Q).root.toUpperCase()}newRoot(Q){return new f0(this.rootPath,l,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class F0 extends H8{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:$=!1}=X;super(Q,NX,"/",{...X,nocase:$});this.nocase=$}parseRootPath(Q){return"/"}newRoot(Q){return new y0(this.rootPath,l,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class g0 extends F0{constructor(Q=process.cwd(),X={}){let{nocase:$=!0}=X;super(Q,{...X,nocase:$})}}var x5=process.platform==="win32"?f0:y0,KQ=process.platform==="win32"?O0:process.platform==="darwin"?g0:F0;var dX=(Q)=>Q.length>=1,cX=(Q)=>Q.length>=1;class H0{#Q;#X;#$;length;#J;#q;#M;#U;#_;#H;#Y=!0;constructor(Q,X,$,Z){if(!dX(Q))throw TypeError("empty pattern list");if(!cX(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,$<0||$>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#X=X,this.#$=$,this.#J=Z,this.#$===0){if(this.isUNC()){let[J,V,q,_,...Y]=this.#Q,[H,K,G,W,...z]=this.#X;if(Y[0]==="")Y.shift(),z.shift();let j=[J,V,q,_,""].join("/"),U=[H,K,G,W,""].join("/");this.#Q=[j,...Y],this.#X=[U,...z],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[J,...V]=this.#Q,[q,..._]=this.#X;if(V[0]==="")V.shift(),_.shift();let Y=J+"/",H=q+"/";this.#Q=[Y,...V],this.#X=[H,..._],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#$]}isString(){return typeof this.#Q[this.#$]==="string"}isGlobstar(){return this.#Q[this.#$]===v}isRegExp(){return this.#Q[this.#$]instanceof RegExp}globString(){return this.#M=this.#M||(this.#$===0?this.isAbsolute()?this.#X[0]+this.#X.slice(1).join("/"):this.#X.join("/"):this.#X.slice(this.#$).join("/"))}hasMore(){return this.length>this.#$+1}rest(){if(this.#q!==void 0)return this.#q;if(!this.hasMore())return this.#q=null;return this.#q=new H0(this.#Q,this.#X,this.#$+1,this.#J),this.#q.#H=this.#H,this.#q.#_=this.#_,this.#q.#U=this.#U,this.#q}isUNC(){let Q=this.#Q;return this.#_!==void 0?this.#_:this.#_=this.#J==="win32"&&this.#$===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#U!==void 0?this.#U:this.#U=this.#J==="win32"&&this.#$===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#H!==void 0?this.#H:this.#H=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#$===0?Q:""}checkFollowGlobstar(){return!(this.#$===0||!this.isGlobstar()||!this.#Y)}markFollowGlobstar(){if(this.#$===0||!this.isGlobstar()||!this.#Y)return!1;return this.#Y=!1,!0}}var lX=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class N0{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:$,noext:Z,noglobstar:J,platform:V=lX}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=V,this.mmopts={dot:!0,nobrace:X,nocase:$,noext:Z,noglobstar:J,optimizationLevel:2,platform:V,nocomment:!0,nonegate:!0};for(let q of Q)this.add(q)}add(Q){let X=new x(Q,this.mmopts);for(let $=0;$<X.set.length;$++){let Z=X.set[$],J=X.globParts[$];if(!Z||!J)throw Error("invalid pattern object");while(Z[0]==="."&&J[0]===".")Z.shift(),J.shift();let V=new H0(Z,J,0,this.platform),q=new x(V.globString(),this.mmopts),_=J[J.length-1]==="**",Y=V.isAbsolute();if(Y)this.absolute.push(q);else this.relative.push(q);if(_)if(Y)this.absoluteChildren.push(q);else this.relativeChildren.push(q)}}ignored(Q){let X=Q.fullpath(),$=`${X}/`,Z=Q.relative()||".",J=`${Z}/`;for(let V of this.relative)if(V.match(Z)||V.match(J))return!0;for(let V of this.absolute)if(V.match(X)||V.match($))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",$=(Q.relative()||".")+"/";for(let Z of this.relativeChildren)if(Z.match($))return!0;for(let Z of this.absoluteChildren)if(Z.match(X))return!0;return!1}}class W8{store;constructor(Q=new Map){this.store=Q}copy(){return new W8(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let $=Q.fullpath(),Z=this.store.get($);if(Z)Z.add(X.globString());else this.store.set($,new Set([X.globString()]))}}class HQ{store=new Map;add(Q,X,$){let Z=(X?2:0)|($?1:0),J=this.store.get(Q);this.store.set(Q,J===void 0?Z:Z&J)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class WQ{store=new Map;add(Q,X){if(!Q.canReaddir())return;let $=this.store.get(Q);if($){if(!$.find((Z)=>Z.globString()===X.globString()))$.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class v0{hasWalkedCache;matches=new HQ;subwalks=new WQ;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new W8}processPatterns(Q,X){this.patterns=X;let $=X.map((Z)=>[Q,Z]);for(let[Z,J]of $){this.hasWalkedCache.storeWalked(Z,J);let V=J.root(),q=J.isAbsolute()&&this.opts.absolute!==!1;if(V){Z=Z.resolve(V==="/"&&this.opts.root!==void 0?this.opts.root:V);let K=J.rest();if(!K){this.matches.add(Z,!0,!1);continue}else J=K}if(Z.isENOENT())continue;let _,Y,H=!1;while(typeof(_=J.pattern())==="string"&&(Y=J.rest()))Z=Z.resolve(_),J=Y,H=!0;if(_=J.pattern(),Y=J.rest(),H){if(this.hasWalkedCache.hasWalked(Z,J))continue;this.hasWalkedCache.storeWalked(Z,J)}if(typeof _==="string"){let K=_===".."||_===""||_===".";this.matches.add(Z.resolve(_),q,K);continue}else if(_===v){if(!Z.isSymbolicLink()||this.follow||J.checkFollowGlobstar())this.subwalks.add(Z,J);let K=Y?.pattern(),G=Y?.rest();if(!Y||(K===""||K===".")&&!G)this.matches.add(Z,q,K===""||K===".");else if(K===".."){let W=Z.parent||Z;if(!G)this.matches.add(W,q,!0);else if(!this.hasWalkedCache.hasWalked(W,G))this.subwalks.add(W,G)}}else if(_ instanceof RegExp)this.subwalks.add(Z,J)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new v0(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let $=this.subwalks.get(Q),Z=this.child();for(let J of X)for(let V of $){let q=V.isAbsolute(),_=V.pattern(),Y=V.rest();if(_===v)Z.testGlobstar(J,V,Y,q);else if(_ instanceof RegExp)Z.testRegExp(J,_,Y,q);else Z.testString(J,_,Y,q)}return Z}testGlobstar(Q,X,$,Z){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,Z,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if($&&X.checkFollowGlobstar())this.subwalks.add(Q,$);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if($){let J=$.pattern();if(typeof J==="string"&&J!==".."&&J!==""&&J!==".")this.testString(Q,J,$.rest(),Z);else if(J===".."){let V=Q.parent||Q;this.subwalks.add(V,$)}else if(J instanceof RegExp)this.testRegExp(Q,J,$.rest(),Z)}}testRegExp(Q,X,$,Z){if(!X.test(Q.name))return;if(!$)this.matches.add(Q,Z,!1);else this.subwalks.add(Q,$)}testString(Q,X,$,Z){if(!Q.isNamed(X))return;if(!$)this.matches.add(Q,Z,!1);else this.subwalks.add(Q,$)}}var oX=(Q,X)=>typeof Q==="string"?new N0([Q],X):Array.isArray(Q)?new N0(Q,X):Q;class G8{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#X;#$;signal;maxDepth;includeChildMatches;constructor(Q,X,$){if(this.patterns=Q,this.path=X,this.opts=$,this.#$=!$.posix&&$.platform==="win32"?"\\":"/",this.includeChildMatches=$.includeChildMatches!==!1,$.ignore||!this.includeChildMatches){if(this.#X=oX($.ignore??[],$),!this.includeChildMatches&&typeof this.#X.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=$.maxDepth||1/0,$.signal)this.signal=$.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#J(Q){return this.seen.has(Q)||!!this.#X?.ignored?.(Q)}#q(Q){return!!this.#X?.childrenIgnored?.(Q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Q=void 0;while(!this.paused&&(Q=this.#Q.shift()))Q()}onResume(Q){if(this.signal?.aborted)return;if(!this.paused)Q();else this.#Q.push(Q)}async matchCheck(Q,X){if(X&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Q.realpathCached()||await Q.realpath(),!$)return;Q=$}let J=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&J?.isSymbolicLink()){let V=await J.realpath();if(V&&(V.isUnknown()||this.opts.stat))await V.lstat()}return this.matchCheckTest(J,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#J(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let $;if(this.opts.realpath){if($=Q.realpathCached()||Q.realpathSync(),!$)return;Q=$}let J=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&J?.isSymbolicLink()){let V=J.realpathSync();if(V&&(V?.isUnknown()||this.opts.stat))V.lstatSync()}return this.matchCheckTest(J,X)}matchFinish(Q,X){if(this.#J(Q))return;if(!this.includeChildMatches&&this.#X?.add){let J=`${Q.relativePosix()}/**`;this.#X.add(J)}let $=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let Z=this.opts.mark&&Q.isDirectory()?this.#$:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if($){let J=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit(J+Z)}else{let J=this.opts.posix?Q.relativePosix():Q.relative(),V=this.opts.dotRelative&&!J.startsWith(".."+this.#$)?"."+this.#$:"";this.matchEmit(!J?"."+Z:V+J+Z)}}async match(Q,X,$){let Z=await this.matchCheck(Q,$);if(Z)this.matchFinish(Z,X)}matchSync(Q,X,$){let Z=this.matchCheckSync(Q,$);if(Z)this.matchFinish(Z,X)}walkCB(Q,X,$){if(this.signal?.aborted)$();this.walkCB2(Q,X,new v0(this.opts),$)}walkCB2(Q,X,$,Z){if(this.#q(Q))return Z();if(this.signal?.aborted)Z();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,$,Z));return}$.processPatterns(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;J++,this.match(q,_,Y).then(()=>V())}for(let q of $.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;J++;let _=q.readdirCached();if(q.calledReaddir())this.walkCB3(q,_,$,V);else q.readdirCB((Y,H)=>this.walkCB3(q,H,$,V),!0)}V()}walkCB3(Q,X,$,Z){$=$.filterEntries(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;J++,this.match(q,_,Y).then(()=>V())}for(let[q,_]of $.subwalks.entries())J++,this.walkCB2(q,_,$.child(),V);V()}walkCBSync(Q,X,$){if(this.signal?.aborted)$();this.walkCB2Sync(Q,X,new v0(this.opts),$)}walkCB2Sync(Q,X,$,Z){if(this.#q(Q))return Z();if(this.signal?.aborted)Z();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,$,Z));return}$.processPatterns(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;this.matchSync(q,_,Y)}for(let q of $.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;J++;let _=q.readdirSync();this.walkCB3Sync(q,_,$,V)}V()}walkCB3Sync(Q,X,$,Z){$=$.filterEntries(Q,X);let J=1,V=()=>{if(--J===0)Z()};for(let[q,_,Y]of $.matches.entries()){if(this.#J(q))continue;this.matchSync(q,_,Y)}for(let[q,_]of $.subwalks.entries())J++,this.walkCB2Sync(q,_,$.child(),V);V()}}class h0 extends G8{matches=new Set;constructor(Q,X,$){super(Q,X,$)}matchEmit(Q){this.matches.add(Q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Q,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(this.signal.reason);else Q(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 d0 extends G8{results;constructor(Q,X,$){super(Q,X,$);this.results=new Q0({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Q){if(this.results.write(Q),!this.results.flowing)this.pause()}stream(){let Q=this.path;if(Q.isUnknown())Q.lstat().then(()=>{this.walkCB(Q,this.patterns,()=>this.results.end())});else this.walkCB(Q,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 iX=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class o{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(Q,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=pX(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((_)=>_.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((_)=>_.includes("/")?_:`./**/${_}`)}if(this.pattern=Q,this.platform=X.platform||iX,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let _=X.platform==="win32"?O0:X.platform==="darwin"?g0:X.platform?F0:KQ;this.scurry=new _(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let $=this.platform==="darwin"||this.platform==="win32",Z={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:$,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},J=this.pattern.map((_)=>new x(_,Z)),[V,q]=J.reduce((_,Y)=>{return _[0].push(...Y.set),_[1].push(...Y.globParts),_},[[],[]]);this.patterns=V.map((_,Y)=>{let H=q[Y];if(!H)throw Error("invalid pattern object");return new H0(_,H,0,this.platform)})}async walk(){return[...await new h0(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 h0(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 d0(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 d0(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 j8=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let $ of Q)if(new x($,X).hasMagic())return!0;return!1};function c0(Q,X={}){return new o(Q,X).streamSync()}function zQ(Q,X={}){return new o(Q,X).stream()}function l0(Q,X={}){return new o(Q,X).walkSync()}async function GQ(Q,X={}){return new o(Q,X).walk()}function o0(Q,X={}){return new o(Q,X).iterateSync()}function UQ(Q,X={}){return new o(Q,X).iterate()}var nX=c0,rX=Object.assign(zQ,{sync:c0}),aX=o0,sX=Object.assign(UQ,{sync:o0}),eX=Object.assign(l0,{stream:c0,iterate:o0}),jQ=Object.assign(GQ,{glob:GQ,globSync:l0,sync:eX,globStream:zQ,stream:rX,globStreamSync:c0,streamSync:nX,globIterate:UQ,iterate:sX,globIterateSync:o0,iterateSync:aX,Glob:o,hasMagic:j8,escape:V0,unescape:g});jQ.glob=jQ;import tX from"node:path";var BQ=({dir:Q,pattern:X="*",nodir:$=!1,dot:Z=!0,ignore:J=[],absolute:V=!1,matchBase:q=!1,follow:_=!1})=>{if(Q=Q||process.cwd(),Q=tX.resolve(Q),X&&!Array.isArray(X))X=[X];else X=X||["*"];if(J&&!Array.isArray(J))J=[J];else J=J||[];return l0(X,{cwd:Q,nodir:$,dot:Z,ignore:J,absolute:V,matchBase:q,follow:_})};import p from"node:fs";import i0 from"node:path";import{randomUUID as Q5}from"node:crypto";import X5 from"yaml";import $5 from"nunjucks";import Z5 from"chalk";import{Atom as $0}from"@flownet/lib-atom-api-js";import J5 from"@fnet/config";import{Api as p0}from"@flownet/lib-atom-api-js";class wQ{init({config:Q,accessToken:X}){return new Promise(($,Z)=>{if(p0.set_api_url(Q.data.url),X){p0.set_req_token(X),$(X);return}fetch(`${Q.data.issuer}/protocol/openid-connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(Q.data.grant.params)}).then(async(J)=>{if(!J.ok)throw Error(await J.text());return J.json()}).then((J)=>{p0.set_req_token(J.access_token),$(J.access_token)}).catch((J)=>{p0.set_req_token(),Z(J)})})}}var CQ=async(Q)=>{let{atom:X,packageDependencies:$,context:Z,deploymentProjectTarget:J,setProgress:V,deploymentProject:q,yamlTarget:_}=Q;if(J.enabled!==!0)return;let Y=J.type;try{if(Y==="lib")await(await import("./index.rmg5mgw9.js")).default({...Q});else if(Y==="red")await(await import("./index.gxm60tqk.js")).default({...Q});else if(Y==="npm")await(await import("./index.wd23pxn8.js")).default({...Q});else if(Y==="gcs")await(await import("./index.zhpbpxhe.js")).default({...Q});else if(Y==="gitlab")await(await import("./index.w9hzkjf2.js")).default({...Q});else if(Y==="fnet-package")await(await import("./index.j1ner1yd.js")).default({...Q});else if(Y==="fnet-form")await(await import("./index.5p4zde7t.js")).default({...Q});else if(Y==="fnet-node")await(await import("./index.vsqseyhf.js")).default({...Q});else if(Y==="fnet-flow")await(await import("./index.3968nzbd.js")).default({...Q});else if(Y==="nextjs")await(await import("./index.r4xke6yy.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="webos")await(await import("./index.z9232w6h.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="electron")await(await import("./index.7cqahb2f.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="docker")await(await import("./index.6g3j97vm.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="ios")await(await import("./index.w4cz5r8m.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="macos")await(await import("./index.kswhzt5n.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="rust")await(await import("./index.fy1xwqp2.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else if(Y==="pypi")await(await import("./index.xvyybysy.js")).default({atom:X,target:J,onProgress:V,projectDir:Z.projectDir,dependencies:$,context:Z,yamlTarget:_}),q.isDirty=!0;else{console.warn(`No deployer found for type: ${Y}`);return}}catch(H){throw console.error(`Error during deployment for type "${Y}":`,H),H}};class MQ{#Q;#X;#$;#J;#q;#M;#U;#_;#H;#Y;#K;#Z;#G;#B;#j;#z;#w;constructor(Q){this.#Q=new wQ,this.#X=Q,this.#M=[],this.#U=[],this._expire_ttl=3600,this._expire_ttl_short=300,this.#w={packageDependencies:this.#M,packageDevDependencies:this.#U,setProgress:this.setProgress.bind(this),context:this.#X,Atom:$0,registerToPackageManager:this.registerToPackageManager.bind(this)}}get apiContext(){return this.#w}get context(){return this.#X}get atom(){return this.#$}get libs(){return this.#q}set libs(Q){this.#q=Q}get fileMode(){return this.#B}get buildMode(){return this.#j}get deployMode(){return this.#z}async _cache_set(Q,X,$){}async initAuth(){if(!this.#X.id)return;this.#_=await this.#Q.init({config:this.#Z}),this.#w.atomAccessToken=this.#_}async initLibrary(){let Q=this.#X.id;this.#$=this.#X.project?.libraryAtom||await $0.get({id:Q});let X=this.#$.doc.bundleName;X=X||(this.#$.doc.name||"").toUpperCase().replace(/[^A-Z0-9]/g,"_"),this.#$.doc.bundleName=X,this.#$.type=this.#$.type||"workflow.lib",this.#w.atom=this.#$}async initLibraryDir(){this.setProgress({message:"Initializing library directory."});let Q=this.#X.projectDir;this.setProgress({message:"Cleaning project directory."});let X=BQ({dir:Q,ignore:[".cache","node_modules",".conda",".bin",".dev"],absolute:!0});for(let Z of X)p.rmSync(Z,{recursive:!0,force:!0});this.setProgress({message:"Creating project directory."});let $=Q;if(!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,"src"),!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,"src","default"),!p.existsSync($))p.mkdirSync($,{recursive:!0});if($=i0.join(Q,".dev"),!p.existsSync($))p.mkdirSync($,{recursive:!0})}async initNunjucks(){this.setProgress({message:"Initializing nunjucks."});let Q=this.#X.templateDir;this.#J=$5.configure(Q,{watch:!1,dev:!0}),this.#w.njEnv=this.#J}async createProjectYaml(){await this.setProgress({message:"Creating fnode.yaml"});let{content:$,...Z}=this.#$.doc,J=this.#X.projectDir,V=i0.resolve(J,"fnode.yaml");p.writeFileSync(V,X5.stringify(Z),"utf8")}async deploy(){if(await this.setProgress({message:"Deploying."}),this.#X.project?.devops){let Q=[this.#X.project?.devops];for(let X=0;X<Q.length;X++){let $=Q[X];if(await this.deployProject({deploymentProject:$}),$.isDirty===!0)await $.save()}}else if(this.#$.id){let Q=await $0.list({type:"library.deploy",parent_id:this.#$.id});for(let X=0;X<Q.length;X++){let $=Q[X];if(await this.deployProject({deploymentProject:$}),$.isDirty===!0)$=await $0.update($,{id:$.id})}}}async deployProject(Q){let{deploymentProject:X}=Q,{yamlDocument:$}=X;if(X.doc.targets&&Array.isArray(X.doc.targets))throw Error("Deployment project targets are deprecated. Please update targets in the yaml file.");let Z=Object.keys(X.doc||{}),J=$||{};for(let V=0;V<Z.length;V++){let q=X.doc[Z[V]];q.name=Z[V];let _=J.get(Z[V]);await CQ({...this.#w,deploymentProject:X,deploymentProjectTarget:q,yamlTarget:_})}}async registerToPackageManager(Q){let{target:X,packageJSON:$}=Q;if(!this.#X.id)return;let Z=await $0.first({name:X.params.name,parent_id:this.#Z.env.ATOM_PACKAGES_ID});if(!Z)Z=await $0.create({parent_id:this.#Z.env.ATOM_PACKAGES_ID,doc:{name:X.params.name,type:"pm",versions:[{v:$.version}]}});else Z.doc.versions.splice(0,0,{v:$.version}),await $0.update(Z,{id:Z.id})}async setProgress(Q){let X=typeof Q==="string"?Q:Q?.message;console.log(Z5.blue(X)),await this._cache_set(this.#Y,{status:"IN_PROGRESS",message:X})}async init(){this.#H=this.#X.buildId||Q5(),this.#w.buildId=this.#H,this.#G=this.#X.mode,this.#B=["all","deploy","build","file"].includes(this.#G),this.#j=["all","deploy","build"].includes(this.#G),this.#z=["all","deploy"].includes(this.#G),this.#K=this.#X.protocol,this.#Y="BUILD:"+this.#H,this.#Z=(await J5({optional:!0,name:this.#X.atomConfig||"atom",dir:this.#X.projectDir,tags:this.#X.tags}))?.data;try{await this.setProgress({message:"Initialization started."}),await this.initAuth(),await this.initLibrary(),await this.initRuntime()}catch(Q){throw await this._cache_set(this.#Y,{status:"FAILED",message:Q?.message||Q}),Q}}async initRuntime(){throw Error("initRuntime method must be implemented by runtime-specific builder")}async build(){throw Error("build method must be implemented by runtime-specific builder")}}var k6=MQ;import RQ from"node:fs";import AQ from"node:path";import IQ from"nunjucks";async function V5({atom:Q,setProgress:X,context:$,packageDependencies:Z}){await X({message:"Creating .gitignore"});let J={atom:Q,packageDependencies:Z},V=$.templateDir,_=IQ.compile(RQ.readFileSync(AQ.resolve(V,".gitignore.njk"),"utf8"),IQ.configure(V)).render(J),Y=$.projectDir,H=AQ.resolve(Y,".gitignore");RQ.writeFileSync(H,_,"utf8")}import n0 from"nunjucks";import s from"node:fs";import Z0 from"node:path";import LQ from"@fnet/yaml";async function q5({atom:Q,context:X,setProgress:$,Atom:Z}){if(await $({message:"Creating readme.md"}),X.project?.readme){let q=X.projectDir,_={content:X.project.readme.doc.content},Y=Z0.resolve(X.project.projectDir,"fnet/how-to.md");if(s.existsSync(Y)){let U=s.readFileSync(Y,"utf8");_.howto=U}let H=Z0.resolve(X.project.projectDir,"fnet/input.yaml");if(s.existsSync(H)){let U=await LQ({file:H,tags:X.tags});_.input=U.content}let K=Z0.resolve(X.project.projectDir,"fnet/output.yaml");if(s.existsSync(K)){let U=await LQ({file:K,tags:X.tags});_.output=U.content}let G=X.templateDir,z=n0.compile(s.readFileSync(Z0.resolve(G,"readme.md.njk"),"utf8"),n0.configure(G)).render(_),j=Z0.resolve(q,"readme.md");s.writeFileSync(j,z,"utf8")}else if(Q.id){let q=await Z.first({type:"wiki",parent_id:Q.id});if(!q||q.doc?.["content-type"]!=="markdown")return;let{content:_,...Y}=q.doc,H={content:_},K=X.templateDir,W=n0.compile(s.readFileSync(Z0.resolve(K,"readme.md.njk"),"utf8"),n0.configure(K)).render(H),z=X.projectDir,j=Z0.resolve(z,"readme.md");s.writeFileSync(j,W,"utf8")}}
|
|
4
4
|
export{BQ as a,k6 as b,V5 as c,q5 as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as i}from"./index.22v7wtt0.js";import"./index.5qbcx2y3.js";import F from"@fnet/config";import o from"node:fs";import c from"@fnet/shelljs";import B from"@flownet/lib-render-templates-dir";import N from"node:path";var q=async({atom:y,params:n,config:$,src:g,dest:v})=>{if(n.name=n.name||"electron",n.entry=n.entry||"app/electron",n.id=n.id||"com.example.electron",n.version=n.version||"0.1.0",n.title=n.title||y?.doc?.title||n.name||y?.doc?.name||"Electron App",n.package_name=n.package_name||n.name,n.author=n.author||y?.doc?.author||"Flownet",n.description=n.description||y?.doc?.description||"Electron App built with Flownet",n.vendor=n.vendor||"flownet.ai",n.include_css=y?.doc?.features?.css_options?.extract===!0,n.bundle_name=y?.doc?.bundleName,n.package_dir=n.package_dir||`./.package/${n.name}`,n.package_dir=N.resolve(v,n.package_dir),o.existsSync(n.package_dir))o.rmSync(n.package_dir,{recursive:!0});if(n.out_dir=n.out_dir||`./.out/${n.name}`,n.out_dir=N.resolve(v,n.out_dir),o.existsSync(n.out_dir))o.rmSync(n.out_dir,{recursive:!0});let C=i("./template/deploy/to-electron");if(!o.existsSync(C))throw Error(`${C} doesn't exist`);if(!g||!o.existsSync(g))throw Error(`${g} doesn't exists`);let V=N.resolve(g,"./dist");if(!o.existsSync(V))throw Error(`${V} doesn't exists`);if(!v||!o.existsSync(v))throw Error(`${v} doesn't exists`);let E=N.resolve(v,n.out_dir);if(!o.existsSync(E))o.mkdirSync(E,{recursive:!0});let b=N.resolve(g,n.package_dir);if(!o.existsSync(b))o.mkdirSync(b,{recursive:!0});await B({dir:C,outDir:E,context:{atom:y,params:n,config:$},copyUnmatchedAlso:!0});let x=N.resolve(E,"./src");if(!o.existsSync(x))o.mkdirSync(x,{recursive:!0});let w=await c(`cp -a ${V} ${x}`);if(w.code!==0)throw Error("Couldn't copy project dist files.");if(w=await c("npm install",{cwd:E}),w.code!==0)throw Error("Couldn't install dependencies.");if(w=await c("npm run dist",{cwd:E}),w.code!==0)throw Error("Couldn't build project.")};import z from"lodash.clonedeep";import G from"semver";async function H({atom:y,target:n,onProgress:$,projectDir:g,dependencies:v,context:C,yamlTarget:V}){if($)await $({message:"Deploying it as electron package."});let b=n?.config?await F({name:n.config,dir:g,optional:!0,transferEnv:!1,tags:C.tags}):void 0,x=G.inc(n.version||"0.1.0","patch");n.version=x,V.set("version",x);let w=z(n.params);w.dependencies=z(v);let A={atom:y,params:w,config:b?.config,src:g,dest:g};return{deployer:await q(A)}}export{H as default};
|