@upstart.gg/sdk 0.0.92 → 0.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/node/cli/api.js +2 -1
  2. package/dist/node/cli/api.js.map +1 -0
  3. package/dist/node/cli/commands/build/cmd-build.js +1 -0
  4. package/dist/node/cli/commands/build/cmd-build.js.map +1 -0
  5. package/dist/node/cli/commands/login/cmd-login.js +2 -1
  6. package/dist/node/cli/commands/login/cmd-login.js.map +1 -0
  7. package/dist/node/cli/commands/logout/cmd-logout.js +1 -0
  8. package/dist/node/cli/commands/logout/cmd-logout.js.map +1 -0
  9. package/dist/node/cli/commands/publish/cmd-publish.js +3 -2
  10. package/dist/node/cli/commands/publish/cmd-publish.js.map +1 -0
  11. package/dist/node/cli/commands/publish/parse-gitignore.js +1 -0
  12. package/dist/node/cli/commands/publish/parse-gitignore.js.map +1 -0
  13. package/dist/node/cli/commands/publish/uploader.js +2 -1
  14. package/dist/node/cli/commands/publish/uploader.js.map +1 -0
  15. package/dist/node/cli/constants.js +1 -0
  16. package/dist/node/cli/constants.js.map +1 -0
  17. package/dist/node/cli/is-logged-in.js +3 -2
  18. package/dist/node/cli/is-logged-in.js.map +1 -0
  19. package/dist/node/cli/program.js +3 -2
  20. package/dist/node/cli/program.js.map +1 -0
  21. package/dist/node/cli/store.js +1 -0
  22. package/dist/node/cli/store.js.map +1 -0
  23. package/dist/node/cli/types.js +1 -0
  24. package/dist/node/cli/types.js.map +1 -0
  25. package/dist/node/cli/utils.js +1 -0
  26. package/dist/node/cli/utils.js.map +1 -0
  27. package/dist/node/shared/config.d.ts.map +1 -1
  28. package/dist/node/shared/config.js +5 -4
  29. package/dist/node/shared/config.js.map +1 -0
  30. package/dist/node/shared/logger.js +2 -1
  31. package/dist/node/shared/logger.js.map +1 -0
  32. package/dist/shared/chunk-6LDLGZUM.js +3 -0
  33. package/dist/shared/{chunk-CP2GSNLX.js → chunk-LUJOZWSF.js} +1 -1
  34. package/dist/shared/chunk-YY6DANZF.js +3 -0
  35. package/dist/shared/datasources/external/json/schema.d.ts +6 -0
  36. package/dist/shared/datasources/external/json/schema.d.ts.map +1 -0
  37. package/dist/shared/datasources/schemas.d.ts +640 -16
  38. package/dist/shared/datasources/schemas.d.ts.map +1 -1
  39. package/dist/shared/datasources/schemas.js +1 -1
  40. package/dist/shared/datasources/types.d.ts +1316 -40
  41. package/dist/shared/datasources/types.d.ts.map +1 -1
  42. package/dist/shared/datasources/types.js +1 -1
  43. package/dist/shared/datasources.d.ts +1 -53
  44. package/dist/shared/datasources.d.ts.map +1 -1
  45. package/dist/shared/datasources.js +1 -1
  46. package/dist/shared/page.d.ts +1914 -12
  47. package/dist/shared/page.d.ts.map +1 -1
  48. package/dist/shared/page.js +1 -1
  49. package/dist/shared/template.d.ts +637 -4
  50. package/dist/shared/template.d.ts.map +1 -1
  51. package/dist/shared/template.js +1 -1
  52. package/package.json +4 -7
  53. package/dist/shared/chunk-7XRTVY2Z.js +0 -3
  54. package/dist/shared/chunk-HC4I5B3L.js +0 -3
@@ -1,4 +1,5 @@
1
1
  /*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
2
2
 
3
- import{createLogger as T}from"vite";var g="0.0.92";import i from"chalk";function h(e,t,o=!1){let s=T(e==="debug"?"info":e,{prefix:"[upstart]",allowClearScreen:t});return o&&s.info(i.hex("#7270c6").bold(`\u{1F680} Upstart v${g}
3
+ import{createLogger as T}from"vite";var g="0.0.94";import i from"chalk";function h(e,t,o=!1){let s=T(e==="debug"?"info":e,{prefix:"[upstart]",allowClearScreen:t});return o&&s.info(i.hex("#7270c6").bold(`\u{1F680} Upstart v${g}
4
4
  `)),{...s,success:(r,n)=>s.info(i.green(r),n),error:(r,n)=>s.error(i.red(r),n),warn:(r,n)=>s.warn(i.yellow(r),n),warnOnce:(r,n)=>s.warnOnce(i.yellow(r),n),debug:(r,n)=>{e==="debug"&&s.info(i.gray(r),n)}}}var p=h();var m="upstart-cli";var w=process.env.PUBLIC_UPSTART_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",d=process.env.PUBLIC_UPSTART_API_BASE_URL??"https://api.upstart.gg",A=process.env.PUBLIC_UPSTART_EDITOR_BASE_URL??"https://upstart.gg";import E from"conf";import c from"node:path";import _ from"node:crypto";import a from"node:fs";import{fileURLToPath as L}from"node:url";import z from"chalk";var R=L(new URL(".",import.meta.url)),x=S(),u=new E({projectName:m,encryptionKey:x,clearInvalidConfig:!0});function O(){let e=R;for(;e!==c.parse(e).root;){let t=c.join(e,"node_modules");if(a.existsSync(t))return t;e=c.dirname(e)}return null}function S(){let e=O();if(!e)throw new Error("Could not find nearest node_modules directory.");let t=c.join(e,".enpage-tmp");a.existsSync(t)||a.mkdirSync(t,{recursive:!0,mode:448});let o=c.join(t,".enpage-key");if(!a.existsSync(o)){let r=_.randomBytes(32).toString("hex");return a.writeFileSync(o,r,{mode:384}),r}return a.readFileSync(o,"utf8")}async function J(e,t,o={}){u.get("access_token")&&(o.Authorization=`Bearer ${u.get("access_token")}`);let s=await fetch(l(e),{method:"POST",headers:{"Content-Type":t instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...o},body:t instanceof URLSearchParams?t:JSON.stringify(t)}).catch(r=>{p.error(`Fatal Error requesting API: ${r.message} (${r.cause.code})`),p.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return y(s)}async function K(e,t={}){u.get("access_token")&&(t.Authorization=`Bearer ${u.get("access_token")}`);let o=await fetch(l(e),{headers:t,method:"GET"}).catch(s=>{p.error(`Fatal Error requesting API: ${s.message} (${s.cause.code})`),p.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return y(o)}function l(e){let t=new URL(d.endsWith("/")?d:`${d}/`);return new URL(e,t)}async function y(e){let t=e.headers.get("content-type")?.startsWith("application/json")?await e.json():await e.text();return e.ok?{isSuccess:!0,isError:!1,status:e.status,statusText:e.statusText,data:t}:{isSuccess:!1,isError:!0,status:e.status,statusText:e.statusText,data:t}}export{K as get,J as post};
5
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/node/shared/logger.ts","../../../package.json","../../../src/node/cli/constants.ts","../../../src/node/cli/store.ts","../../../src/node/cli/api.ts"],"sourcesContent":["import {\n createLogger as createLoggerBase,\n type LogLevel,\n type LogOptions,\n type Logger as BaseLogger,\n} from \"vite\";\nimport { version } from \"../../../package.json\";\nimport chalk from \"chalk\";\n\ntype UpstartLoggerLevel = LogLevel | \"debug\";\n\nexport function createLogger(level?: UpstartLoggerLevel, allowClearScreen?: boolean, showVersion = false) {\n // vite logger does not support \"debug\" level\n const logger = createLoggerBase(level === \"debug\" ? \"info\" : level, {\n prefix: \"[upstart]\",\n allowClearScreen,\n });\n\n if (showVersion) {\n logger.info(chalk.hex(\"#7270c6\").bold(`🚀 Upstart v${version}\\n`));\n }\n\n return {\n ...logger,\n success: (message: string, options?: LogOptions) => logger.info(chalk.green(message), options),\n error: (message: string, options?: LogOptions) => logger.error(chalk.red(message), options),\n warn: (message: string, options?: LogOptions) => logger.warn(chalk.yellow(message), options),\n warnOnce: (message: string, options?: LogOptions) => logger.warnOnce(chalk.yellow(message), options),\n debug: (message: string, options?: LogOptions) => {\n if (level === \"debug\") {\n logger.info(chalk.gray(message), options);\n }\n },\n };\n}\n\nexport const logger = createLogger();\n\nexport type Logger = BaseLogger & {\n success: (message: string, options?: LogOptions) => void;\n debug: (message: string, options?: LogOptions) => void;\n};\n","{\n \"name\": \"@upstart.gg/sdk\",\n \"version\": \"0.0.94\",\n \"type\": \"module\",\n \"files\": [\n \"dist\",\n \"env.d.ts\"\n ],\n \"sideEffects\": false,\n \"exports\": {\n \".\": {\n \"import\": \"./dist/shared/index.js\",\n \"types\": \"./dist/shared/index.d.ts\"\n },\n \"./shared/*\": {\n \"types\": \"./dist/shared/*.d.ts\",\n \"import\": \"./dist/shared/*.js\"\n },\n \"./builder/*\": {\n \"import\": \"./dist/node/builder/*.js\"\n },\n \"./cli/*\": {\n \"import\": \"./dist/node/cli/*.js\"\n },\n \"./env.d.ts\": {\n \"types\": \"./env.d.ts\",\n \"require\": \"./env.d.ts\",\n \"import\": \"./env.d.ts\"\n },\n \"./*\": {\n \"types\": \"./dist/shared/*.d.ts\",\n \"import\": \"./dist/shared/*.js\"\n }\n },\n \"dependencies\": {\n \"@date-fns/utc\": \"1.2.0\",\n \"@headlessui/react\": \"2.2.1\",\n \"@inquirer/prompts\": \"5.3.8\",\n \"@radix-ui/react-context-menu\": \"2.2.2\",\n \"@radix-ui/react-toggle-group\": \"1.1.0\",\n \"@radix-ui/themes\": \"3.1.4\",\n \"@sinclair/typebox\": \"0.33.7\",\n \"@upstart.gg/style-system\": \"workspace:*\",\n \"ajv\": \"8.17.1\",\n \"ajv-formats\": \"3.0.1\",\n \"chalk\": \"5.3.0\",\n \"chroma-js\": \"3.1.2\",\n \"commander\": \"12.1.0\",\n \"conf\": \"13.0.1\",\n \"date-fns\": \"3.6.0\",\n \"debug\": \"4.3.6\",\n \"fast-glob\": \"3.3.2\",\n \"form-data\": \"4.0.0\",\n \"get-port\": \"7.1.0\",\n \"htmlparser2\": \"9.1.0\",\n \"http-errors-enhanced\": \"2.0.8\",\n \"immer\": \"10.1.1\",\n \"import-meta-resolve\": \"4.1.0\",\n \"lodash-es\": \"4.17.21\",\n \"nanoid\": \"5.0.7\",\n \"open\": \"10.1.0\",\n \"ora\": \"8.1.0\",\n \"p-queue\": \"8.0.1\",\n \"react-hotkeys-hook\": \"4.5.1\",\n \"react-icons\": \"5.3.0\",\n \"react-selecto\": \"1.26.3\",\n \"rollup-plugin-strip-banner\": \"3.1.0\",\n \"usehooks-ts\": \"3.1.0\",\n \"zundo\": \"2.3.0\",\n \"zustand\": \"4.5.5\"\n },\n \"peerDependencies\": {\n \"@upstart.gg/style-system\": \"workspace:*\",\n \"react\": \"18.3.0-canary-3d9b20132-20240124\",\n \"react-dom\": \"18.3.0-canary-3d9b20132-20240124\"\n },\n \"devDependencies\": {\n \"@cloudflare/workers-types\": \"4.20240806.0\",\n \"@types/chroma-js\": \"2.4.4\",\n \"@types/cli-progress\": \"3.11.6\",\n \"@types/debug\": \"4.1.12\",\n \"@types/express\": \"^4.17.21\",\n \"@types/lodash-es\": \"4.17.12\",\n \"@types/node\": \"^20.14.10\",\n \"@types/react\": \"18.3.3\",\n \"@types/react-dom\": \"^18.3.0\",\n \"@types/sortablejs\": \"1.15.8\",\n \"@vitejs/plugin-react\": \"^4.3.4\",\n \"concurrently\": \"8.2.2\",\n \"express\": \"^4.21.2\",\n \"rimraf\": \"6.0.1\",\n \"tsup\": \"8.2.4\",\n \"vite\": \"5.4.6\",\n \"vite-plugin-dts\": \"4.2.1\",\n \"vite-plugin-image-optimizer\": \"1.1.8\",\n \"vite-plugin-inspect\": \"0.8.7\",\n \"vite-plugin-virtual\": \"0.3.0\",\n \"vite-tsconfig-paths\": \"5.0.1\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:types\": \"tsc --emitDeclarationOnly --declaration --declarationMap\",\n \"dev\": \"NODE_OPTIONS='--max-old-space-size=12384' tsup --watch\",\n \"sizetest\": \"pnpm build && du -sh dist\",\n \"lint\": \"biome check --write . && tsc --noEmit\",\n \"ci:lint\": \"tsc --noEmit\",\n \"test\": \"vitest\",\n \"gen-ia-docs\": \"tsx scripts/generate-ia-docs.ts\"\n },\n \"author\": \"Matthias Etienne\",\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","export const CLI_PROJECT_NAME = \"upstart-cli\";\nexport const CLI_LOGIN_POLL_INTERVAL = 5000; // seconds\nexport const CLI_LOGIN_CLIENT_ID =\n process.env.PUBLIC_UPSTART_OAUTH_CLIENT_ID ?? \"50000000-0000-0000-0000-000000000001\";\n\nexport const API_BASE_URL = process.env.PUBLIC_UPSTART_API_BASE_URL ?? \"https://api.upstart.gg\";\nexport const EDITOR_BASE_URL = process.env.PUBLIC_UPSTART_EDITOR_BASE_URL ?? \"https://upstart.gg\";\nexport const DEFAULT_UPLOAD_MAX_CONCURRENCY = 10;\n\nexport const OAUTH_ENDPOINT_DEVICE_CODE = \"oauth/devicecode\";\nexport const OAUTH_ENDPOINT_TOKEN = \"oauth/token\";\nexport const OAUTH_ENDPOINT_USER_INFO = \"oauth/userinfo\";\n\nexport const API_ENDPOINT_REGISTER_TEMPLATE = \"v1/templates\";\n","import type { CredentialsStore } from \"./types\";\nimport { CLI_PROJECT_NAME, OAUTH_ENDPOINT_USER_INFO } from \"./constants\";\nimport Conf from \"conf\";\nimport path from \"node:path\";\nimport crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { getPackageManager } from \"./utils\";\nimport chalk from \"chalk\";\n\nconst __dirname = fileURLToPath(new URL(\".\", import.meta.url));\nconst key = getKey();\nconst accessStore = new Conf<CredentialsStore>({\n projectName: CLI_PROJECT_NAME,\n encryptionKey: key,\n clearInvalidConfig: true,\n});\n\n/**\n * Get access token or throw error if not found\n */\nexport function getTokenOrThrow() {\n const token = accessStore.get(\"access_token\");\n if (!token) {\n const pkgCmd = getPackageManager();\n throw new Error(\n `Access token not found. Please run ${chalk.cyan(`${pkgCmd} run enpage:login`)} to authenticate.`,\n );\n }\n return token;\n}\n\nfunction findNearestNodeModules(): string | null {\n let currentDir = __dirname;\n while (currentDir !== path.parse(currentDir).root) {\n const nodeModulesPath = path.join(currentDir, \"node_modules\");\n if (fs.existsSync(nodeModulesPath)) {\n return nodeModulesPath;\n }\n currentDir = path.dirname(currentDir);\n }\n return null;\n}\n\nfunction getKey() {\n const nodeModulesPath = findNearestNodeModules();\n if (!nodeModulesPath) {\n throw new Error(\"Could not find nearest node_modules directory.\");\n }\n const tmpSecureStoreDir = path.join(nodeModulesPath, \".enpage-tmp\");\n if (!fs.existsSync(tmpSecureStoreDir)) {\n fs.mkdirSync(tmpSecureStoreDir, { recursive: true, mode: 0o700 });\n }\n const keyPath = path.join(tmpSecureStoreDir, \".enpage-key\");\n if (!fs.existsSync(keyPath)) {\n const key = crypto.randomBytes(32).toString(\"hex\");\n fs.writeFileSync(keyPath, key, { mode: 0o600 });\n return key;\n }\n const key = fs.readFileSync(keyPath, \"utf8\");\n return key;\n}\n\nexport { accessStore };\n","import { logger } from \"../shared/logger\";\nimport { API_BASE_URL } from \"./constants\";\nimport { accessStore } from \"./store\";\n\ntype SuccessResponseWrapper<T> = {\n isSuccess: true;\n isError: false;\n status: number;\n statusText: string;\n data: T;\n};\n\ntype ErrorResponseWrapper<E> = {\n isSuccess: false;\n isError: true;\n status: number;\n statusText: string;\n data: E;\n};\n\ntype ResponseWrapper<T, E> = SuccessResponseWrapper<T> | ErrorResponseWrapper<E>;\n\ntype CommonResponseType = {\n success: boolean;\n};\n\n/**\n *\n * @param pathOrUrl\n * @param data\n * @returns\n */\nexport async function post<\n ResponseType extends CommonResponseType = CommonResponseType,\n ErrorType = { error: string; error_description?: string },\n>(path: string, data: Record<string, unknown> | URLSearchParams, headers: Record<string, string> = {}) {\n if (accessStore.get(\"access_token\")) {\n headers.Authorization = `Bearer ${accessStore.get(\"access_token\")}`;\n }\n const response = await fetch(toURL(path), {\n method: \"POST\",\n headers: {\n \"Content-Type\":\n data instanceof URLSearchParams ? \"application/x-www-form-urlencoded\" : \"application/json\",\n ...headers,\n },\n body: data instanceof URLSearchParams ? data : JSON.stringify(data),\n }).catch((error) => {\n logger.error(`Fatal Error requesting API: ${error.message} (${error.cause.code})`);\n logger.error(`Please check your internet connection and try again, or retry later.`);\n process.exit(1);\n });\n\n return formatResponse<ResponseType, ErrorType>(response);\n}\n\nexport async function get<ResponseType = unknown, ErrorType = { error: string; error_description?: string }>(\n path: string,\n headers: Record<string, string> = {},\n) {\n if (accessStore.get(\"access_token\")) {\n headers.Authorization = `Bearer ${accessStore.get(\"access_token\")}`;\n }\n const response = await fetch(toURL(path), { headers, method: \"GET\" }).catch((error) => {\n logger.error(`Fatal Error requesting API: ${error.message} (${error.cause.code})`);\n logger.error(`Please check your internet connection and try again, or retry later.`);\n process.exit(1);\n });\n return formatResponse<ResponseType, ErrorType>(response);\n}\n\nfunction toURL(path: string) {\n const apiBaseURL = new URL(API_BASE_URL.endsWith(\"/\") ? API_BASE_URL : `${API_BASE_URL}/`);\n return new URL(path, apiBaseURL);\n}\n\nasync function formatResponse<SuccessType, ErrorType>(\n response: Response,\n): Promise<ResponseWrapper<SuccessType, ErrorType>> {\n const data = response.headers.get(\"content-type\")?.startsWith(\"application/json\")\n ? ((await response.json()) as ResponseType)\n : ((await response.text()) as ResponseType);\n\n if (response.ok) {\n return {\n isSuccess: true,\n isError: false,\n status: response.status,\n statusText: response.statusText,\n data: data as SuccessType,\n };\n } else {\n return {\n isSuccess: false,\n isError: true,\n status: response.status,\n statusText: response.statusText,\n data: data as ErrorType,\n };\n }\n}\n"],"mappings":";;AAAA,OACE,gBAAgBA,MAIX,OCHL,IAAAC,EAAW,SDKb,OAAOC,MAAW,QAIX,SAASC,EAAaC,EAA4BC,EAA4BC,EAAc,GAAO,CAExG,IAAMC,EAASC,EAAiBJ,IAAU,QAAU,OAASA,EAAO,CAClE,OAAQ,YACR,iBAAAC,CACF,CAAC,EAED,OAAIC,GACFC,EAAO,KAAKL,EAAM,IAAI,SAAS,EAAE,KAAK,sBAAeO,CAAO;AAAA,CAAI,CAAC,EAG5D,CACL,GAAGF,EACH,QAAS,CAACG,EAAiBC,IAAyBJ,EAAO,KAAKL,EAAM,MAAMQ,CAAO,EAAGC,CAAO,EAC7F,MAAO,CAACD,EAAiBC,IAAyBJ,EAAO,MAAML,EAAM,IAAIQ,CAAO,EAAGC,CAAO,EAC1F,KAAM,CAACD,EAAiBC,IAAyBJ,EAAO,KAAKL,EAAM,OAAOQ,CAAO,EAAGC,CAAO,EAC3F,SAAU,CAACD,EAAiBC,IAAyBJ,EAAO,SAASL,EAAM,OAAOQ,CAAO,EAAGC,CAAO,EACnG,MAAO,CAACD,EAAiBC,IAAyB,CAC5CP,IAAU,SACZG,EAAO,KAAKL,EAAM,KAAKQ,CAAO,EAAGC,CAAO,CAE5C,CACF,CACF,CAEO,IAAMJ,EAASJ,EAAa,EEpC5B,IAAMS,EAAmB,cAEzB,IAAMC,EACX,QAAQ,IAAI,gCAAkC,uCAEnCC,EAAe,QAAQ,IAAI,6BAA+B,yBAC1DC,EAAkB,QAAQ,IAAI,gCAAkC,qBCJ7E,OAAOC,MAAU,OACjB,OAAOC,MAAU,YACjB,OAAOC,MAAY,cACnB,OAAOC,MAAQ,UACf,OAAS,iBAAAC,MAAqB,WAE9B,OAAOC,MAAW,QAElB,IAAMC,EAAYC,EAAc,IAAI,IAAI,IAAK,YAAY,GAAG,CAAC,EACvDC,EAAMC,EAAO,EACbC,EAAc,IAAIC,EAAuB,CAC7C,YAAaC,EACb,cAAeJ,EACf,mBAAoB,EACtB,CAAC,EAgBD,SAASK,GAAwC,CAC/C,IAAIC,EAAaC,EACjB,KAAOD,IAAeE,EAAK,MAAMF,CAAU,EAAE,MAAM,CACjD,IAAMG,EAAkBD,EAAK,KAAKF,EAAY,cAAc,EAC5D,GAAII,EAAG,WAAWD,CAAe,EAC/B,OAAOA,EAETH,EAAaE,EAAK,QAAQF,CAAU,CACtC,CACA,OAAO,IACT,CAEA,SAASK,GAAS,CAChB,IAAMF,EAAkBJ,EAAuB,EAC/C,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,gDAAgD,EAElE,IAAMG,EAAoBJ,EAAK,KAAKC,EAAiB,aAAa,EAC7DC,EAAG,WAAWE,CAAiB,GAClCF,EAAG,UAAUE,EAAmB,CAAE,UAAW,GAAM,KAAM,GAAM,CAAC,EAElE,IAAMC,EAAUL,EAAK,KAAKI,EAAmB,aAAa,EAC1D,GAAI,CAACF,EAAG,WAAWG,CAAO,EAAG,CAC3B,IAAMC,EAAMC,EAAO,YAAY,EAAE,EAAE,SAAS,KAAK,EACjD,OAAAL,EAAG,cAAcG,EAASC,EAAK,CAAE,KAAM,GAAM,CAAC,EACvCA,CACT,CAEA,OADYJ,EAAG,aAAaG,EAAS,MAAM,CAE7C,CC7BA,eAAsBG,EAGpBC,EAAcC,EAAiDC,EAAkC,CAAC,EAAG,CACjGC,EAAY,IAAI,cAAc,IAChCD,EAAQ,cAAgB,UAAUC,EAAY,IAAI,cAAc,CAAC,IAEnE,IAAMC,EAAW,MAAM,MAAMC,EAAML,CAAI,EAAG,CACxC,OAAQ,OACR,QAAS,CACP,eACEC,aAAgB,gBAAkB,oCAAsC,mBAC1E,GAAGC,CACL,EACA,KAAMD,aAAgB,gBAAkBA,EAAO,KAAK,UAAUA,CAAI,CACpE,CAAC,EAAE,MAAOK,GAAU,CAClBC,EAAO,MAAM,+BAA+BD,EAAM,OAAO,KAAKA,EAAM,MAAM,IAAI,GAAG,EACjFC,EAAO,MAAM,sEAAsE,EACnF,QAAQ,KAAK,CAAC,CAChB,CAAC,EAED,OAAOC,EAAwCJ,CAAQ,CACzD,CAEA,eAAsBK,EACpBT,EACAE,EAAkC,CAAC,EACnC,CACIC,EAAY,IAAI,cAAc,IAChCD,EAAQ,cAAgB,UAAUC,EAAY,IAAI,cAAc,CAAC,IAEnE,IAAMC,EAAW,MAAM,MAAMC,EAAML,CAAI,EAAG,CAAE,QAAAE,EAAS,OAAQ,KAAM,CAAC,EAAE,MAAOI,GAAU,CACrFC,EAAO,MAAM,+BAA+BD,EAAM,OAAO,KAAKA,EAAM,MAAM,IAAI,GAAG,EACjFC,EAAO,MAAM,sEAAsE,EACnF,QAAQ,KAAK,CAAC,CAChB,CAAC,EACD,OAAOC,EAAwCJ,CAAQ,CACzD,CAEA,SAASC,EAAML,EAAc,CAC3B,IAAMU,EAAa,IAAI,IAAIC,EAAa,SAAS,GAAG,EAAIA,EAAe,GAAGA,CAAY,GAAG,EACzF,OAAO,IAAI,IAAIX,EAAMU,CAAU,CACjC,CAEA,eAAeF,EACbJ,EACkD,CAClD,IAAMH,EAAOG,EAAS,QAAQ,IAAI,cAAc,GAAG,WAAW,kBAAkB,EAC1E,MAAMA,EAAS,KAAK,EACpB,MAAMA,EAAS,KAAK,EAE1B,OAAIA,EAAS,GACJ,CACL,UAAW,GACX,QAAS,GACT,OAAQA,EAAS,OACjB,WAAYA,EAAS,WACrB,KAAMH,CACR,EAEO,CACL,UAAW,GACX,QAAS,GACT,OAAQG,EAAS,OACjB,WAAYA,EAAS,WACrB,KAAMH,CACR,CAEJ","names":["createLoggerBase","version","chalk","createLogger","level","allowClearScreen","showVersion","logger","createLoggerBase","version","message","options","CLI_PROJECT_NAME","CLI_LOGIN_CLIENT_ID","API_BASE_URL","EDITOR_BASE_URL","Conf","path","crypto","fs","fileURLToPath","chalk","__dirname","fileURLToPath","key","getKey","accessStore","Conf","CLI_PROJECT_NAME","findNearestNodeModules","currentDir","__dirname","path","nodeModulesPath","fs","getKey","tmpSecureStoreDir","keyPath","key","crypto","post","path","data","headers","accessStore","response","toURL","error","logger","formatResponse","get","apiBaseURL","API_BASE_URL"]}
@@ -4,3 +4,4 @@ var Ii=Object.create;var ts=Object.defineProperty;var Wi=Object.getOwnPropertyDe
4
4
  globstar while`,t,u,e,d,g),this.matchOne(t.slice(u),e.slice(d),s))return this.debug("globstar found match!",u,a,g),!0;if(g==="."||g===".."||!r.dot&&g.charAt(0)==="."){this.debug("dot detected!",t,u,e,d);break}this.debug("globstar swallow a segment, and continue"),u++}return!!(s&&(this.debug(`
5
5
  >>> no match, partial?`,t,u,e,d),u===a))}let p;if(typeof f=="string"?(p=c===f,this.debug("string match",f,c,p)):(p=f.test(c),this.debug("pattern match",f,c,p)),!p)return!1}if(o===a&&h===l)return!0;if(o===a)return s;if(h===l)return o===a-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Os(this.pattern,this.options)}parse(t){Rt(t);let e=this.options;if(t==="**")return A;if(t==="")return"";let s,r=null;(s=t.match(mr))?r=e.dot?wr:gr:(s=t.match(nr))?r=(e.nocase?e.dot?lr:ar:e.dot?hr:or)(s[1]):(s=t.match(yr))?r=(e.nocase?e.dot?br:Sr:e.dot?Er:vr)(s):(s=t.match(cr))?r=e.dot?ur:fr:(s=t.match(dr))&&(r=pr);let n=ot.fromGlob(t,this.options).toMMPattern();return r&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:r}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?Rr:e.dot?Or:Ar,r=new Set(e.nocase?["i"]:[]),n=t.map(a=>{let l=a.map(f=>{if(f instanceof RegExp)for(let c of f.flags.split(""))r.add(c);return typeof f=="string"?Mr(f):f===A?A:f._src});return l.forEach((f,c)=>{let u=l[c+1],d=l[c-1];f!==A||d===A||(d===void 0?u!==void 0&&u!==A?l[c+1]="(?:\\/|"+s+"\\/)?"+u:l[c]=s:u===void 0?l[c-1]=d+"(?:\\/|"+s+")?":u!==A&&(l[c-1]=d+"(?:\\/|\\/"+s+"\\/)"+u,l[c+1]=A))}),l.filter(f=>f!==A).join("/")}).join("|"),[o,h]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+h+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let n=this.set;this.debug(this.pattern,"set",n);let o=r[r.length-1];if(!o)for(let h=r.length-2;!o&&h>=0;h--)o=r[h];for(let h=0;h<n.length;h++){let a=n[h],l=r;if(s.matchBase&&a.length===1&&(l=[o]),this.matchOne(l,a,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return k.defaults(t).Minimatch}};k.AST=ot;k.Minimatch=_;k.escape=ht;k.unescape=j;import{fileURLToPath as fn}from"node:url";var at=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ns=new Set,ve=typeof process=="object"&&process?process:{},Cs=(i,t,e,s)=>{typeof ve.emitWarning=="function"?ve.emitWarning(i,t,e,s):console.error(`[${e}] ${t}: ${i}`)},Ut=globalThis.AbortController,As=globalThis.AbortSignal;if(typeof Ut>"u"){As=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,r){this._onabort.push(r)}},Ut=class{constructor(){t()}signal=new As;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s)}}};let i=ve.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=!1,Cs("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",t))}}var Fr=i=>!Ns.has(i),Bo=Symbol("type"),Z=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),ks=i=>Z(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?lt:null:null,lt=class extends Array{constructor(t){super(t),this.fill(0)}},xe=class i{heap;length;static#t=!1;static create(t){let e=ks(t);if(!e)return[];i.#t=!0;let s=new i(t,e);return i.#t=!1,s}constructor(t,e){if(!i.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},At=class i{#t;#e;#n;#r;#o;#b;#w;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#f;#a;#l;#s;#u;#y;#p;#m;#A;#g;#N;#v;#E;#S;#R;#d;#k;static unsafeExposeInternals(t){return{starts:t.#v,ttls:t.#E,sizes:t.#N,keyMap:t.#a,keyList:t.#l,valList:t.#s,next:t.#u,prev:t.#y,get head(){return t.#p},get tail(){return t.#m},free:t.#A,isBackgroundFetch:e=>t.#c(e),backgroundFetch:(e,s,r,n)=>t.#L(e,s,r,n),moveToTail:e=>t.#W(e),indexes:e=>t.#O(e),rindexes:e=>t.#C(e),isStale:e=>t.#T(e)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#f}get size(){return this.#h}get fetchMethod(){return this.#b}get memoMethod(){return this.#w}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){let{max:e=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:a,dispose:l,onInsert:f,disposeAfter:c,noDisposeOnSet:u,noUpdateTTL:d,maxSize:g=0,maxEntrySize:p=0,sizeCalculation:w,fetchMethod:m,memoMethod:S,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:x,ignoreFetchAbort:V}=t;if(e!==0&&!Z(e))throw new TypeError("max option must be a nonnegative integer");let it=e?ks(e):Array;if(!it)throw new Error("invalid max value: "+e);if(this.#t=e,this.#e=g,this.maxEntrySize=p||this.#e,this.sizeCalculation=w,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=S,m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#b=m,this.#R=!!m,this.#a=new Map,this.#l=new Array(e).fill(void 0),this.#s=new Array(e).fill(void 0),this.#u=new it(e),this.#y=new it(e),this.#p=0,this.#m=0,this.#A=xe.create(e),this.#h=0,this.#f=0,typeof l=="function"&&(this.#n=l),typeof f=="function"&&(this.#r=f),typeof c=="function"?(this.#o=c,this.#g=[]):(this.#o=void 0,this.#g=void 0),this.#S=!!this.#n,this.#k=!!this.#r,this.#d=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!V,this.maxEntrySize!==0){if(this.#e!==0&&!Z(this.#e))throw new TypeError("maxSize must be a positive integer if specified");if(!Z(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=Z(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!Z(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#i()}if(this.#t===0&&this.ttl===0&&this.#e===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let M="LRU_CACHE_UNBOUNDED";Fr(M)&&(Ns.add(M),Cs("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",M,i))}}getRemainingTTL(t){return this.#a.has(t)?1/0:0}#i(){let t=new lt(this.#t),e=new lt(this.#t);this.#E=t,this.#v=e,this.#D=(n,o,h=at.now())=>{if(e[n]=o!==0?h:0,t[n]=o,o!==0&&this.ttlAutopurge){let a=setTimeout(()=>{this.#T(n)&&this.#M(this.#l[n],"expire")},o+1);a.unref&&a.unref()}},this.#F=n=>{e[n]=t[n]!==0?at.now():0},this.#x=(n,o)=>{if(t[o]){let h=t[o],a=e[o];if(!h||!a)return;n.ttl=h,n.start=a,n.now=s||r();let l=n.now-a;n.remainingTTL=h-l}};let s=0,r=()=>{let n=at.now();if(this.ttlResolution>0){s=n;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return n};this.getRemainingTTL=n=>{let o=this.#a.get(n);if(o===void 0)return 0;let h=t[o],a=e[o];if(!h||!a)return 1/0;let l=(s||r())-a;return h-l},this.#T=n=>{let o=e[n],h=t[n];return!!h&&!!o&&(s||r())-o>h}}#F=()=>{};#x=()=>{};#D=()=>{};#T=()=>!1;#B(){let t=new lt(this.#t);this.#f=0,this.#N=t,this.#_=e=>{this.#f-=t[e],t[e]=0},this.#z=(e,s,r,n)=>{if(this.#c(s))return 0;if(!Z(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,e),!Z(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#P=(e,s,r)=>{if(t[e]=s,this.#e){let n=this.#e-t[e];for(;this.#f>n;)this.#I(!0)}this.#f+=t[e],r&&(r.entrySize=s,r.totalCalculatedSize=this.#f)}}#_=t=>{};#P=(t,e,s)=>{};#z=(t,e,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#O({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#m;!(!this.#U(e)||((t||!this.#T(e))&&(yield e),e===this.#p));)e=this.#y[e]}*#C({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#p;!(!this.#U(e)||((t||!this.#T(e))&&(yield e),e===this.#m));)e=this.#u[e]}#U(t){return t!==void 0&&this.#a.get(this.#l[t])===t}*entries(){for(let t of this.#O())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#c(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*rentries(){for(let t of this.#C())this.#s[t]!==void 0&&this.#l[t]!==void 0&&!this.#c(this.#s[t])&&(yield[this.#l[t],this.#s[t]])}*keys(){for(let t of this.#O()){let e=this.#l[t];e!==void 0&&!this.#c(this.#s[t])&&(yield e)}}*rkeys(){for(let t of this.#C()){let e=this.#l[t];e!==void 0&&!this.#c(this.#s[t])&&(yield e)}}*values(){for(let t of this.#O())this.#s[t]!==void 0&&!this.#c(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#C())this.#s[t]!==void 0&&!this.#c(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let s of this.#O()){let r=this.#s[s],n=this.#c(r)?r.__staleWhileFetching:r;if(n!==void 0&&t(n,this.#l[s],this))return this.get(this.#l[s],e)}}forEach(t,e=this){for(let s of this.#O()){let r=this.#s[s],n=this.#c(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,this.#l[s],this)}}rforEach(t,e=this){for(let s of this.#C()){let r=this.#s[s],n=this.#c(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,this.#l[s],this)}}purgeStale(){let t=!1;for(let e of this.#C({allowStale:!0}))this.#T(e)&&(this.#M(this.#l[e],"expire"),t=!0);return t}info(t){let e=this.#a.get(t);if(e===void 0)return;let s=this.#s[e],r=this.#c(s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(this.#E&&this.#v){let o=this.#E[e],h=this.#v[e];if(o&&h){let a=o-(at.now()-h);n.ttl=a,n.start=Date.now()}}return this.#N&&(n.size=this.#N[e]),n}dump(){let t=[];for(let e of this.#O({allowStale:!0})){let s=this.#l[e],r=this.#s[e],n=this.#c(r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(this.#E&&this.#v){o.ttl=this.#E[e];let h=at.now()-this.#v[e];o.start=Math.floor(Date.now()-h)}this.#N&&(o.size=this.#N[e]),t.unshift([s,o])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let r=Date.now()-s.start;s.start=at.now()-r}this.set(e,s.value,s)}}set(t,e,s={}){if(e===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:a}=s,{noUpdateTTL:l=this.noUpdateTTL}=s,f=this.#z(t,e,s.size||0,h);if(this.maxEntrySize&&f>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#M(t,"set"),this;let c=this.#h===0?void 0:this.#a.get(t);if(c===void 0)c=this.#h===0?this.#m:this.#A.length!==0?this.#A.pop():this.#h===this.#t?this.#I(!1):this.#h,this.#l[c]=t,this.#s[c]=e,this.#a.set(t,c),this.#u[this.#m]=c,this.#y[c]=this.#m,this.#m=c,this.#h++,this.#P(c,f,a),a&&(a.set="add"),l=!1,this.#k&&this.#r?.(e,t,"add");else{this.#W(c);let u=this.#s[c];if(e!==u){if(this.#R&&this.#c(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=u;d!==void 0&&!o&&(this.#S&&this.#n?.(d,t,"set"),this.#d&&this.#g?.push([d,t,"set"]))}else o||(this.#S&&this.#n?.(u,t,"set"),this.#d&&this.#g?.push([u,t,"set"]));if(this.#_(c),this.#P(c,f,a),this.#s[c]=e,a){a.set="replace";let d=u&&this.#c(u)?u.__staleWhileFetching:u;d!==void 0&&(a.oldValue=d)}}else a&&(a.set="update");this.#k&&this.onInsert?.(e,t,e===u?"update":"replace")}if(r!==0&&!this.#E&&this.#i(),this.#E&&(l||this.#D(c,r,n),a&&this.#x(a,c)),!o&&this.#d&&this.#g){let u=this.#g,d;for(;d=u?.shift();)this.#o?.(...d)}return this}pop(){try{for(;this.#h;){let t=this.#s[this.#p];if(this.#I(!0),this.#c(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#d&&this.#g){let t=this.#g,e;for(;e=t?.shift();)this.#o?.(...e)}}}#I(t){let e=this.#p,s=this.#l[e],r=this.#s[e];return this.#R&&this.#c(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#d)&&(this.#S&&this.#n?.(r,s,"evict"),this.#d&&this.#g?.push([r,s,"evict"])),this.#_(e),t&&(this.#l[e]=void 0,this.#s[e]=void 0,this.#A.push(e)),this.#h===1?(this.#p=this.#m=0,this.#A.length=0):this.#p=this.#u[e],this.#a.delete(s),this.#h--,e}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=e,n=this.#a.get(t);if(n!==void 0){let o=this.#s[n];if(this.#c(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#T(n))r&&(r.has="stale",this.#x(r,n));else return s&&this.#F(n),r&&(r.has="hit",this.#x(r,n)),!0}else r&&(r.has="miss");return!1}peek(t,e={}){let{allowStale:s=this.allowStale}=e,r=this.#a.get(t);if(r===void 0||!s&&this.#T(r))return;let n=this.#s[r];return this.#c(n)?n.__staleWhileFetching:n}#L(t,e,s,r){let n=e===void 0?void 0:this.#s[e];if(this.#c(n))return n;let o=new Ut,{signal:h}=s;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let a={signal:o.signal,options:s,context:r},l=(p,w=!1)=>{let{aborted:m}=o.signal,S=s.ignoreFetchAbort&&p!==void 0;if(s.status&&(m&&!w?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,S&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),m&&!S&&!w)return c(o.signal.reason);let b=d;return this.#s[e]===d&&(p===void 0?b.__staleWhileFetching?this.#s[e]=b.__staleWhileFetching:this.#M(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,p,a.options))),p},f=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),c(p)),c=p=>{let{aborted:w}=o.signal,m=w&&s.allowStaleOnFetchAbort,S=m||s.allowStaleOnFetchRejection,b=S||s.noDeleteOnFetchRejection,y=d;if(this.#s[e]===d&&(!b||y.__staleWhileFetching===void 0?this.#M(t,"fetch"):m||(this.#s[e]=y.__staleWhileFetching)),S)return s.status&&y.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),y.__staleWhileFetching;if(y.__returned===y)throw p},u=(p,w)=>{let m=this.#b?.(t,n,a);m&&m instanceof Promise&&m.then(S=>p(S===void 0?void 0:S),w),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=S=>l(S,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(u).then(l,f),g=Object.assign(d,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,g,{...a.options,status:void 0}),e=this.#a.get(t)):this.#s[e]=g,g}#c(t){if(!this.#R)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Ut}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:p,forceRefresh:w=!1,status:m,signal:S}=e;if(!this.#R)return m&&(m.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:m});let b={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h,size:a,sizeCalculation:l,noUpdateTTL:f,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:m,signal:S},y=this.#a.get(t);if(y===void 0){m&&(m.fetch="miss");let E=this.#L(t,y,b,p);return E.__returned=E}else{let E=this.#s[y];if(this.#c(E)){let xt=s&&E.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",xt&&(m.returnedStale=!0)),xt?E.__staleWhileFetching:E.__returned=E}let x=this.#T(y);if(!w&&!x)return m&&(m.fetch="hit"),this.#W(y),r&&this.#F(y),m&&this.#x(m,y),E;let V=this.#L(t,y,b,p),M=V.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=x?"stale":"refresh",M&&x&&(m.returnedStale=!0)),M?V.__staleWhileFetching:V.__returned=V}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=this.#w;if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=e,h=this.get(t,o);if(!n&&h!==void 0)return h;let a=s(t,h,{options:o,context:r});return this.set(t,a,o),a}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,h=this.#a.get(t);if(h!==void 0){let a=this.#s[h],l=this.#c(a);return o&&this.#x(o,h),this.#T(h)?(o&&(o.get="stale"),l?(o&&s&&a.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?a.__staleWhileFetching:void 0):(n||this.#M(t,"expire"),o&&s&&(o.returnedStale=!0),s?a:void 0)):(o&&(o.get="hit"),l?a.__staleWhileFetching:(this.#W(h),r&&this.#F(h),a))}else o&&(o.get="miss")}#$(t,e){this.#y[e]=t,this.#u[t]=e}#W(t){t!==this.#m&&(t===this.#p?this.#p=this.#u[t]:this.#$(this.#y[t],this.#u[t]),this.#$(this.#m,t),this.#m=t)}delete(t){return this.#M(t,"delete")}#M(t,e){let s=!1;if(this.#h!==0){let r=this.#a.get(t);if(r!==void 0)if(s=!0,this.#h===1)this.#j(e);else{this.#_(r);let n=this.#s[r];if(this.#c(n)?n.__abortController.abort(new Error("deleted")):(this.#S||this.#d)&&(this.#S&&this.#n?.(n,t,e),this.#d&&this.#g?.push([n,t,e])),this.#a.delete(t),this.#l[r]=void 0,this.#s[r]=void 0,r===this.#m)this.#m=this.#y[r];else if(r===this.#p)this.#p=this.#u[r];else{let o=this.#y[r];this.#u[o]=this.#u[r];let h=this.#u[r];this.#y[h]=this.#y[r]}this.#h--,this.#A.push(r)}}if(this.#d&&this.#g?.length){let r=this.#g,n;for(;n=r?.shift();)this.#o?.(...n)}return s}clear(){return this.#j("delete")}#j(t){for(let e of this.#C({allowStale:!0})){let s=this.#s[e];if(this.#c(s))s.__abortController.abort(new Error("deleted"));else{let r=this.#l[e];this.#S&&this.#n?.(s,r,t),this.#d&&this.#g?.push([s,r,t])}}if(this.#a.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#E&&this.#v&&(this.#E.fill(0),this.#v.fill(0)),this.#N&&this.#N.fill(0),this.#p=0,this.#m=0,this.#A.length=0,this.#f=0,this.#h=0,this.#d&&this.#g){let e=this.#g,s;for(;s=e?.shift();)this.#o?.(...s)}}};import{posix as Gr,win32 as Fe}from"node:path";import{fileURLToPath as Hr}from"node:url";import{lstatSync as Vr,readdir as qr,readdirSync as Kr,readlinkSync as Yr,realpathSync as Xr}from"fs";import*as Jr from"node:fs";import{lstat as Qr,readdir as tn,readlink as en,realpath as sn}from"node:fs/promises";import{EventEmitter as ke}from"node:events";import Ls from"node:stream";import{StringDecoder as _r}from"node:string_decoder";var Ds=typeof process=="object"&&process?process:{stdout:null,stderr:null},Lr=i=>!!i&&typeof i=="object"&&(i instanceof tt||i instanceof Ls||Pr(i)||Ir(i)),Pr=i=>!!i&&typeof i=="object"&&i instanceof ke&&typeof i.pipe=="function"&&i.pipe!==Ls.Writable.prototype.pipe,Ir=i=>!!i&&typeof i=="object"&&i instanceof ke&&typeof i.write=="function"&&typeof i.end=="function",q=Symbol("EOF"),K=Symbol("maybeEmitEnd"),Q=Symbol("emittedEnd"),$t=Symbol("emittingEnd"),Nt=Symbol("emittedError"),Gt=Symbol("closed"),Ms=Symbol("read"),Ht=Symbol("flush"),Fs=Symbol("flushChunk"),B=Symbol("encoding"),ct=Symbol("decoder"),T=Symbol("flowing"),Ct=Symbol("paused"),ft=Symbol("resume"),R=Symbol("buffer"),D=Symbol("pipes"),O=Symbol("bufferLength"),Te=Symbol("bufferPush"),Vt=Symbol("bufferShift"),N=Symbol("objectMode"),v=Symbol("destroyed"),Re=Symbol("error"),Oe=Symbol("emitData"),_s=Symbol("emitEnd"),Ae=Symbol("emitEnd2"),G=Symbol("async"),Ne=Symbol("abort"),qt=Symbol("aborted"),kt=Symbol("signal"),rt=Symbol("dataListeners"),L=Symbol("discarded"),Dt=i=>Promise.resolve().then(i),Wr=i=>i(),jr=i=>i==="end"||i==="finish"||i==="prefinish",Br=i=>i instanceof ArrayBuffer||!!i&&typeof i=="object"&&i.constructor&&i.constructor.name==="ArrayBuffer"&&i.byteLength>=0,zr=i=>!Buffer.isBuffer(i)&&ArrayBuffer.isView(i),Kt=class{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[ft](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ce=class extends Kt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=r=>e.emit("error",r),t.on("error",this.proxyErrors)}},Ur=i=>!!i.objectMode,$r=i=>!i.objectMode&&!!i.encoding&&i.encoding!=="buffer",tt=class extends ke{[T]=!1;[Ct]=!1;[D]=[];[R]=[];[N];[B];[G];[ct];[q]=!1;[Q]=!1;[$t]=!1;[Gt]=!1;[Nt]=null;[O]=0;[v]=!1;[kt];[qt]=!1;[rt]=0;[L]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Ur(e)?(this[N]=!0,this[B]=null):$r(e)?(this[B]=e.encoding,this[N]=!1):(this[N]=!1,this[B]=null),this[G]=!!e.async,this[ct]=this[B]?new _r(this[B]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[R]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[D]});let{signal:s}=e;s&&(this[kt]=s,s.aborted?this[Ne]():s.addEventListener("abort",()=>this[Ne]()))}get bufferLength(){return this[O]}get encoding(){return this[B]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[N]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[G]}set async(t){this[G]=this[G]||!!t}[Ne](){this[qt]=!0,this.emit("abort",this[kt]?.reason),this.destroy(this[kt]?.reason)}get aborted(){return this[qt]}set aborted(t){}write(t,e,s){if(this[qt])return!1;if(this[q])throw new Error("write after end");if(this[v])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let r=this[G]?Dt:Wr;if(!this[N]&&!Buffer.isBuffer(t)){if(zr(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Br(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[N]?(this[T]&&this[O]!==0&&this[Ht](!0),this[T]?this.emit("data",t):this[Te](t),this[O]!==0&&this.emit("readable"),s&&r(s),this[T]):t.length?(typeof t=="string"&&!(e===this[B]&&!this[ct]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[B]&&(t=this[ct].write(t)),this[T]&&this[O]!==0&&this[Ht](!0),this[T]?this.emit("data",t):this[Te](t),this[O]!==0&&this.emit("readable"),s&&r(s),this[T]):(this[O]!==0&&this.emit("readable"),s&&r(s),this[T])}read(t){if(this[v])return null;if(this[L]=!1,this[O]===0||t===0||t&&t>this[O])return this[K](),null;this[N]&&(t=null),this[R].length>1&&!this[N]&&(this[R]=[this[B]?this[R].join(""):Buffer.concat(this[R],this[O])]);let e=this[Ms](t||null,this[R][0]);return this[K](),e}[Ms](t,e){if(this[N])this[Vt]();else{let s=e;t===s.length||t===null?this[Vt]():typeof s=="string"?(this[R][0]=s.slice(t),e=s.slice(0,t),this[O]-=t):(this[R][0]=s.subarray(t),e=s.subarray(0,t),this[O]-=t)}return this.emit("data",e),!this[R].length&&!this[q]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=void 0),typeof e=="function"&&(s=e,e="utf8"),t!==void 0&&this.write(t,e),s&&this.once("end",s),this[q]=!0,this.writable=!1,(this[T]||!this[Ct])&&this[K](),this}[ft](){this[v]||(!this[rt]&&!this[D].length&&(this[L]=!0),this[Ct]=!1,this[T]=!0,this.emit("resume"),this[R].length?this[Ht]():this[q]?this[K]():this.emit("drain"))}resume(){return this[ft]()}pause(){this[T]=!1,this[Ct]=!0,this[L]=!1}get destroyed(){return this[v]}get flowing(){return this[T]}get paused(){return this[Ct]}[Te](t){this[N]?this[O]+=1:this[O]+=t.length,this[R].push(t)}[Vt](){return this[N]?this[O]-=1:this[O]-=this[R][0].length,this[R].shift()}[Ht](t=!1){do;while(this[Fs](this[Vt]())&&this[R].length);!t&&!this[R].length&&!this[q]&&this.emit("drain")}[Fs](t){return this.emit("data",t),this[T]}pipe(t,e){if(this[v])return t;this[L]=!1;let s=this[Q];return e=e||{},t===Ds.stdout||t===Ds.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[D].push(e.proxyErrors?new Ce(this,t,e):new Kt(this,t,e)),this[G]?Dt(()=>this[ft]()):this[ft]()),t}unpipe(t){let e=this[D].find(s=>s.dest===t);e&&(this[D].length===1?(this[T]&&this[rt]===0&&(this[T]=!1),this[D]=[]):this[D].splice(this[D].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let s=super.on(t,e);if(t==="data")this[L]=!1,this[rt]++,!this[D].length&&!this[T]&&this[ft]();else if(t==="readable"&&this[O]!==0)super.emit("readable");else if(jr(t)&&this[Q])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Nt]){let r=e;this[G]?Dt(()=>r.call(this,this[Nt])):r.call(this,this[Nt])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){let s=super.off(t,e);return t==="data"&&(this[rt]=this.listeners("data").length,this[rt]===0&&!this[L]&&!this[D].length&&(this[T]=!1)),s}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[rt]=0,!this[L]&&!this[D].length&&(this[T]=!1)),e}get emittedEnd(){return this[Q]}[K](){!this[$t]&&!this[Q]&&!this[v]&&this[R].length===0&&this[q]&&(this[$t]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Gt]&&this.emit("close"),this[$t]=!1)}emit(t,...e){let s=e[0];if(t!=="error"&&t!=="close"&&t!==v&&this[v])return!1;if(t==="data")return!this[N]&&!s?!1:this[G]?(Dt(()=>this[Oe](s)),!0):this[Oe](s);if(t==="end")return this[_s]();if(t==="close"){if(this[Gt]=!0,!this[Q]&&!this[v])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[Nt]=s,super.emit(Re,s);let n=!this[kt]||this.listeners("error").length?super.emit("error",s):!1;return this[K](),n}else if(t==="resume"){let n=super.emit("resume");return this[K](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...e);return this[K](),r}[Oe](t){for(let s of this[D])s.dest.write(t)===!1&&this.pause();let e=this[L]?!1:super.emit("data",t);return this[K](),e}[_s](){return this[Q]?!1:(this[Q]=!0,this.readable=!1,this[G]?(Dt(()=>this[Ae]()),!0):this[Ae]())}[Ae](){if(this[ct]){let e=this[ct].end();if(e){for(let s of this[D])s.dest.write(e);this[L]||super.emit("data",e)}}for(let e of this[D])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[N]||(t.dataLength=0);let e=this.promise();return this.on("data",s=>{t.push(s),this[N]||(t.dataLength+=s.length)}),await e,t}async concat(){if(this[N])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[B]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(v,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[L]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[q])return e();let n,o,h=c=>{this.off("data",a),this.off("end",l),this.off(v,f),e(),o(c)},a=c=>{this.off("error",h),this.off("end",l),this.off(v,f),this.pause(),n({value:c,done:!!this[q]})},l=()=>{this.off("error",h),this.off("data",a),this.off(v,f),e(),n({done:!0,value:void 0})},f=()=>h(new Error("stream destroyed"));return new Promise((c,u)=>{o=u,n=c,this.once(v,f),this.once("error",h),this.once("end",l),this.once("data",a)})},throw:e,return:e,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[L]=!1;let t=!1,e=()=>(this.pause(),this.off(Re,e),this.off(v,e),this.off("end",e),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return e();let r=this.read();return r===null?e():{done:!1,value:r}};return this.once("end",e),this.once(Re,e),this.once(v,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this}}}destroy(t){if(this[v])return t?this.emit("error",t):this.emit(v),this;this[v]=!0,this[L]=!0,this[R].length=0,this[O]=0;let e=this;return typeof e.close=="function"&&!this[Gt]&&e.close(),t?this.emit("error",t):this.emit(v),this}static get isStream(){return Lr}};var Zr=Xr.native,Ft={lstatSync:Vr,readdir:qr,readdirSync:Kr,readlinkSync:Yr,realpathSync:Zr,promises:{lstat:Qr,readdir:tn,readlink:en,realpath:sn}},Bs=i=>!i||i===Ft||i===Jr?Ft:{...Ft,...i,promises:{...Ft.promises,...i.promises||{}}},zs=/^\\\\\?\\([a-z]:)\\?$/i,rn=i=>i.replace(/\//g,"\\").replace(zs,"$1\\"),nn=/[\\\/]/,W=0,Us=1,$s=2,H=4,Gs=6,Hs=8,nt=10,Vs=12,I=15,Mt=~I,De=16,Ps=32,_t=64,z=128,Yt=256,Jt=512,Is=_t|z|Jt,on=1023,Me=i=>i.isFile()?Hs:i.isDirectory()?H:i.isSymbolicLink()?nt:i.isCharacterDevice()?$s:i.isBlockDevice()?Gs:i.isSocket()?Vs:i.isFIFO()?Us:W,Ws=new Map,Lt=i=>{let t=Ws.get(i);if(t)return t;let e=i.normalize("NFKD");return Ws.set(i,e),e},js=new Map,Xt=i=>{let t=js.get(i);if(t)return t;let e=Lt(i.toLowerCase());return js.set(i,e),e},Zt=class extends At{constructor(){super({max:256})}},_e=class extends At{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},qs=Symbol("PathScurry setAsCwd"),C=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#b;get gid(){return this.#b}#w;get rdev(){return this.#w}#h;get blksize(){return this.#h}#f;get ino(){return this.#f}#a;get size(){return this.#a}#l;get blocks(){return this.#l}#s;get atimeMs(){return this.#s}#u;get mtimeMs(){return this.#u}#y;get ctimeMs(){return this.#y}#p;get birthtimeMs(){return this.#p}#m;get atime(){return this.#m}#A;get mtime(){return this.#A}#g;get ctime(){return this.#g}#N;get birthtime(){return this.#N}#v;#E;#S;#R;#d;#k;#i;#F;#x;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=W,s,r,n,o,h){this.name=t,this.#v=n?Xt(t):Lt(t),this.#i=e&on,this.nocase=n,this.roots=r,this.root=s||this,this.#F=o,this.#S=h.fullpath,this.#d=h.relative,this.#k=h.relativePosix,this.parent=h.parent,this.parent?this.#t=this.parent.#t:this.#t=Bs(h.fs)}depth(){return this.#E!==void 0?this.#E:this.parent?this.#E=this.parent.depth()+1:this.#E=0}childrenCache(){return this.#F}resolve(t){if(!t)return this;let e=this.getRootString(t),r=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#T(r):this.#T(r)}#T(t){let e=this;for(let s of t)e=e.child(s);return e}children(){let t=this.#F.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#F.set(this,e),this.#i&=~De,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),r=this.nocase?Xt(t):Lt(t);for(let a of s)if(a.#v===r)return a;let n=this.parent?this.sep:"",o=this.#S?this.#S+n+t:void 0,h=this.newChild(t,W,{...e,parent:this,fullpath:o});return this.canReaddir()||(h.#i|=z),s.push(h),h}relative(){if(this.isCWD)return"";if(this.#d!==void 0)return this.#d;let t=this.name,e=this.parent;if(!e)return this.#d=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let t=this.name,e=this.parent;if(!e)return this.#k=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#S!==void 0)return this.#S;let t=this.name,e=this.parent;if(!e)return this.#S=this.name;let r=e.fullpath()+(e.parent?this.sep:"")+t;return this.#S=r}fullpathPosix(){if(this.#R!==void 0)return this.#R;if(this.sep==="/")return this.#R=this.fullpath();if(!this.parent){let r=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(r)?this.#R=`//?/${r}`:this.#R=r}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return this.#R=s}isUnknown(){return(this.#i&I)===W}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&I)===Hs}isDirectory(){return(this.#i&I)===H}isCharacterDevice(){return(this.#i&I)===$s}isBlockDevice(){return(this.#i&I)===Gs}isFIFO(){return(this.#i&I)===Us}isSocket(){return(this.#i&I)===Vs}isSymbolicLink(){return(this.#i&nt)===nt}lstatCached(){return this.#i&Ps?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#D}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let t=this.#i&I;return!(t!==W&&t!==nt||this.#i&Yt||this.#i&z)}calledReaddir(){return!!(this.#i&De)}isENOENT(){return!!(this.#i&z)}isNamed(t){return this.nocase?this.#v===Xt(t):this.#v===Lt(t)}async readlink(){let t=this.#x;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#x=s}catch(e){this.#I(e.code);return}}readlinkSync(){let t=this.#x;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#x=s}catch(e){this.#I(e.code);return}}#B(t){this.#i|=De;for(let e=t.provisional;e<t.length;e++){let s=t[e];s&&s.#_()}}#_(){this.#i&z||(this.#i=(this.#i|z)&Mt,this.#P())}#P(){let t=this.children();t.provisional=0;for(let e of t)e.#_()}#z(){this.#i|=Jt,this.#O()}#O(){if(this.#i&_t)return;let t=this.#i;(t&I)===H&&(t&=Mt),this.#i=t|_t,this.#P()}#C(t=""){t==="ENOTDIR"||t==="EPERM"?this.#O():t==="ENOENT"?this.#_():this.children().provisional=0}#U(t=""){t==="ENOTDIR"?this.parent.#O():t==="ENOENT"&&this.#_()}#I(t=""){let e=this.#i;e|=Yt,t==="ENOENT"&&(e|=z),(t==="EINVAL"||t==="UNKNOWN")&&(e&=Mt),this.#i=e,t==="ENOTDIR"&&this.parent&&this.parent.#O()}#L(t,e){return this.#$(t,e)||this.#c(t,e)}#c(t,e){let s=Me(t),r=this.newChild(t.name,s,{parent:this}),n=r.#i&I;return n!==H&&n!==nt&&n!==W&&(r.#i|=_t),e.unshift(r),e.provisional++,r}#$(t,e){for(let s=e.provisional;s<e.length;s++){let r=e[s];if((this.nocase?Xt(t.name):Lt(t.name))===r.#v)return this.#W(t,r,s,e)}}#W(t,e,s,r){let n=e.name;return e.#i=e.#i&Mt|Me(t),n!==t.name&&(e.name=t.name),s!==r.provisional&&(s===r.length-1?r.pop():r.splice(s,1),r.unshift(e)),r.provisional++,e}async lstat(){if(!(this.#i&z))try{return this.#M(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#U(t.code)}}lstatSync(){if(!(this.#i&z))try{return this.#M(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#U(t.code)}}#M(t){let{atime:e,atimeMs:s,birthtime:r,birthtimeMs:n,blksize:o,blocks:h,ctime:a,ctimeMs:l,dev:f,gid:c,ino:u,mode:d,mtime:g,mtimeMs:p,nlink:w,rdev:m,size:S,uid:b}=t;this.#m=e,this.#s=s,this.#N=r,this.#p=n,this.#h=o,this.#l=h,this.#g=a,this.#y=l,this.#e=f,this.#b=c,this.#f=u,this.#n=d,this.#A=g,this.#u=p,this.#r=w,this.#w=m,this.#a=S,this.#o=b;let y=Me(t);this.#i=this.#i&Mt|y|Ps,y!==W&&y!==H&&y!==nt&&(this.#i|=_t)}#j=[];#H=!1;#V(t){this.#H=!1;let e=this.#j.slice();this.#j.length=0,e.forEach(s=>s(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let n=s.slice(0,s.provisional);e?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#j.push(t),this.#H)return;this.#H=!0;let r=this.fullpath();this.#t.readdir(r,{withFileTypes:!0},(n,o)=>{if(n)this.#C(n.code),s.provisional=0;else{for(let h of o)this.#L(h,s);this.#B(s)}this.#V(s.slice(0,s.provisional))})}#G;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#G)await this.#G;else{let s=()=>{};this.#G=new Promise(r=>s=r);try{for(let r of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#L(r,t);this.#B(t)}catch(r){this.#C(r.code),t.provisional=0}this.#G=void 0,s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of this.#t.readdirSync(e,{withFileTypes:!0}))this.#L(s,t);this.#B(t)}catch(s){this.#C(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#i&Is)return!1;let t=I&this.#i;return t===W||t===H||t===nt}shouldWalk(t,e){return(this.#i&H)===H&&!(this.#i&Is)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#D)return this.#D;if(!((Jt|Yt|z)&this.#i))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#D=this.resolve(t)}catch{this.#z()}}realpathSync(){if(this.#D)return this.#D;if(!((Jt|Yt|z)&this.#i))try{let t=this.#t.realpathSync(this.fullpath());return this.#D=this.resolve(t)}catch{this.#z()}}[qs](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],r=this;for(;r&&r.parent;)e.add(r),r.#d=s.join(this.sep),r.#k=s.join("/"),r=r.parent,s.push("..");for(r=t;r&&r.parent&&!e.has(r);)r.#d=void 0,r.#k=void 0,r=r.parent}},Qt=class i extends C{sep="\\";splitSep=nn;constructor(t,e=W,s,r,n,o,h){super(t,e,s,r,n,o,h)}newChild(t,e=W,s={}){return new i(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return Fe.parse(t).root}getRoot(t){if(t=rn(t.toUpperCase()),t===this.root.name)return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new ut(t,this).root}sameRoot(t,e=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(zs,"$1\\"),t===e}},te=class i extends C{splitSep="/";sep="/";constructor(t,e=W,s,r,n,o,h){super(t,e,s,r,n,o,h)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=W,s={}){return new i(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ee=class{root;rootPath;roots;cwd;#t;#e;#n;nocase;#r;constructor(t=process.cwd(),e,s,{nocase:r,childrenCacheSize:n=16*1024,fs:o=Ft}={}){this.#r=Bs(o),(t instanceof URL||t.startsWith("file://"))&&(t=Hr(t));let h=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(h),this.#t=new Zt,this.#e=new Zt,this.#n=new _e(n);let a=h.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]&&a.pop(),r===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let l=this.root,f=a.length-1,c=e.sep,u=this.rootPath,d=!1;for(let g of a){let p=f--;l=l.child(g,{relative:new Array(p).fill("..").join(c),relativePosix:new Array(p).fill("..").join("/"),fullpath:u+=(d?"":c)+g}),d=!0}this.cwd=l}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#t.get(e);if(s!==void 0)return s;let r=this.cwd.resolve(e).fullpath();return this.#t.set(e,r),r}resolvePosix(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#e.get(e);if(s!==void 0)return s;let r=this.cwd.resolve(e).fullpathPosix();return this.#e.set(e,r),r}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let r=await t.readdir();return s?r:r.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(r=>r.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,h=[];(!n||n(t))&&h.push(s?t:t.fullpath());let a=new Set,l=(c,u)=>{a.add(c),c.readdirCB((d,g)=>{if(d)return u(d);let p=g.length;if(!p)return u();let w=()=>{--p===0&&u()};for(let m of g)(!n||n(m))&&h.push(s?m:m.fullpath()),r&&m.isSymbolicLink()?m.realpath().then(S=>S?.isUnknown()?S.lstat():S).then(S=>S?.shouldWalk(a,o)?l(S,w):w()):m.shouldWalk(a,o)?l(m,w):w()},!0)},f=t;return new Promise((c,u)=>{l(f,d=>{if(d)return u(d);c(h)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,h=[];(!n||n(t))&&h.push(s?t:t.fullpath());let a=new Set([t]);for(let l of a){let f=l.readdirSync();for(let c of f){(!n||n(c))&&h.push(s?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(r&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(a,o)&&a.add(u)}}return h}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e;(!n||n(t))&&(yield s?t:t.fullpath());let h=new Set([t]);for(let a of h){let l=a.readdirSync();for(let f of l){(!n||n(f))&&(yield s?f:f.fullpath());let c=f;if(f.isSymbolicLink()){if(!(r&&(c=f.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(h,o)&&h.add(c)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,h=new tt({objectMode:!0});(!n||n(t))&&h.write(s?t:t.fullpath());let a=new Set,l=[t],f=0,c=()=>{let u=!1;for(;!u;){let d=l.shift();if(!d){f===0&&h.end();return}f++,a.add(d);let g=(w,m,S=!1)=>{if(w)return h.emit("error",w);if(r&&!S){let b=[];for(let y of m)y.isSymbolicLink()&&b.push(y.realpath().then(E=>E?.isUnknown()?E.lstat():E));if(b.length){Promise.all(b).then(()=>g(null,m,!0));return}}for(let b of m)b&&(!n||n(b))&&(h.write(s?b:b.fullpath())||(u=!0));f--;for(let b of m){let y=b.realpathCached()||b;y.shouldWalk(a,o)&&l.push(y)}u&&!h.flowing?h.once("drain",c):p||c()},p=!0;d.readdirCB(g,!0),p=!1}};return c(),h}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof C||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,h=new tt({objectMode:!0}),a=new Set;(!n||n(t))&&h.write(s?t:t.fullpath());let l=[t],f=0,c=()=>{let u=!1;for(;!u;){let d=l.shift();if(!d){f===0&&h.end();return}f++,a.add(d);let g=d.readdirSync();for(let p of g)(!n||n(p))&&(h.write(s?p:p.fullpath())||(u=!0));f--;for(let p of g){let w=p;if(p.isSymbolicLink()){if(!(r&&(w=p.realpathSync())))continue;w.isUnknown()&&w.lstatSync()}w.shouldWalk(a,o)&&l.push(w)}}u&&!h.flowing&&h.once("drain",c)};return c(),h}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[qs](e)}},ut=class extends ee{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,Fe,"\\",{...e,nocase:s}),this.nocase=s;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(t){return Fe.parse(t).root.toUpperCase()}newRoot(t){return new Qt(this.rootPath,H,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},dt=class extends ee{sep="/";constructor(t=process.cwd(),e={}){let{nocase:s=!1}=e;super(t,Gr,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new te(this.rootPath,H,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},Pt=class extends dt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},Zo=process.platform==="win32"?Qt:te,Ks=process.platform==="win32"?ut:process.platform==="darwin"?Pt:dt;var hn=i=>i.length>=1,an=i=>i.length>=1,pt=class i{#t;#e;#n;length;#r;#o;#b;#w;#h;#f;#a=!0;constructor(t,e,s,r){if(!hn(t))throw new TypeError("empty pattern list");if(!an(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#e=e,this.#n=s,this.#r=r,this.#n===0){if(this.isUNC()){let[n,o,h,a,...l]=this.#t,[f,c,u,d,...g]=this.#e;l[0]===""&&(l.shift(),g.shift());let p=[n,o,h,a,""].join("/"),w=[f,c,u,d,""].join("/");this.#t=[p,...l],this.#e=[w,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...o]=this.#t,[h,...a]=this.#e;o[0]===""&&(o.shift(),a.shift());let l=n+"/",f=h+"/";this.#t=[l,...o],this.#e=[f,...a],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===A}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#b=this.#b||(this.#n===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new i(this.#t,this.#e,this.#n+1,this.#r),this.#o.#f=this.#f,this.#o.#h=this.#h,this.#o.#w=this.#w,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#h!==void 0?this.#h:this.#h=this.#r==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#w!==void 0?this.#w:this.#w=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#a)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#a?!1:(this.#a=!1,!0)}};var ln=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",mt=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:r,noglobstar:n,platform:o=ln}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:r,noglobstar:n,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let h of t)this.add(h)}add(t){let e=new _(t,this.mmopts);for(let s=0;s<e.set.length;s++){let r=e.set[s],n=e.globParts[s];if(!r||!n)throw new Error("invalid pattern object");for(;r[0]==="."&&n[0]===".";)r.shift(),n.shift();let o=new pt(r,n,0,this.platform),h=new _(o.globString(),this.mmopts),a=n[n.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(h):this.relative.push(h),a&&(l?this.absoluteChildren.push(h):this.relativeChildren.push(h))}}ignored(t){let e=t.fullpath(),s=`${e}/`,r=t.relative()||".",n=`${r}/`;for(let o of this.relative)if(o.match(r)||o.match(n))return!0;for(let o of this.absolute)if(o.match(e)||o.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let r of this.relativeChildren)if(r.match(s))return!0;for(let r of this.absoluteChildren)if(r.match(e))return!0;return!1}};var Le=class i{store;constructor(t=new Map){this.store=t}copy(){return new i(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),r=this.store.get(s);r?r.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},Pe=class{store=new Map;add(t,e,s){let r=(e?2:0)|(s?1:0),n=this.store.get(t);this.store.set(t,n===void 0?r:r&n)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},Ie=class{store=new Map;add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(r=>r.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},It=class i{hasWalkedCache;matches=new Pe;subwalks=new Ie;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new Le}processPatterns(t,e){this.patterns=e;let s=e.map(r=>[t,r]);for(let[r,n]of s){this.hasWalkedCache.storeWalked(r,n);let o=n.root(),h=n.isAbsolute()&&this.opts.absolute!==!1;if(o){r=r.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let c=n.rest();if(c)n=c;else{this.matches.add(r,!0,!1);continue}}if(r.isENOENT())continue;let a,l,f=!1;for(;typeof(a=n.pattern())=="string"&&(l=n.rest());)r=r.resolve(a),n=l,f=!0;if(a=n.pattern(),l=n.rest(),f){if(this.hasWalkedCache.hasWalked(r,n))continue;this.hasWalkedCache.storeWalked(r,n)}if(typeof a=="string"){let c=a===".."||a===""||a===".";this.matches.add(r.resolve(a),h,c);continue}else if(a===A){(!r.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(r,n);let c=l?.pattern(),u=l?.rest();if(!l||(c===""||c===".")&&!u)this.matches.add(r,h,c===""||c===".");else if(c===".."){let d=r.parent||r;u?this.hasWalkedCache.hasWalked(d,u)||this.subwalks.add(d,u):this.matches.add(d,h,!0)}}else a instanceof RegExp&&this.subwalks.add(r,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new i(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),r=this.child();for(let n of e)for(let o of s){let h=o.isAbsolute(),a=o.pattern(),l=o.rest();a===A?r.testGlobstar(n,o,l,h):a instanceof RegExp?r.testRegExp(n,a,l,h):r.testString(n,a,l,h)}return r}testGlobstar(t,e,s,r){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,r,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let n=s.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,s.rest(),r);else if(n===".."){let o=t.parent||t;this.subwalks.add(o,s)}else n instanceof RegExp&&this.testRegExp(t,n,s.rest(),r)}}testRegExp(t,e,s,r){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}testString(t,e,s,r){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}};var cn=(i,t)=>typeof i=="string"?new mt([i],t):Array.isArray(i)?new mt(i,t):i,se=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#n;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#e=cn(s.ignore??[],s),!this.includeChildMatches&&typeof this.#e.add!="function")){let r="cannot ignore child matches, ignore lacks add() method.";throw new Error(r)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#r(t){return this.seen.has(t)||!!this.#e?.ignored?.(t)}#o(t){return!!this.#e?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let o=await n.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(n,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#r(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let o=n.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(n,e)}matchFinish(t,e){if(this.#r(t))return;if(!this.includeChildMatches&&this.#e?.add){let n=`${t.relativePosix()}/**`;this.#e.add(n)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let r=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let n=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(n+r)}else{let n=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!n.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(n?o+n+r:"."+r)}}async match(t,e,s){let r=await this.matchCheck(t,s);r&&this.matchFinish(r,e)}matchSync(t,e,s){let r=this.matchCheckSync(t,s);r&&this.matchFinish(r,e)}walkCB(t,e,s){this.signal?.aborted&&s(),this.walkCB2(t,e,new It(this.opts),s)}walkCB2(t,e,s,r){if(this.#o(t))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,r));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&r()};for(let[h,a,l]of s.matches.entries())this.#r(h)||(n++,this.match(h,a,l).then(()=>o()));for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let a=h.readdirCached();h.calledReaddir()?this.walkCB3(h,a,s,o):h.readdirCB((l,f)=>this.walkCB3(h,f,s,o),!0)}o()}walkCB3(t,e,s,r){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&r()};for(let[h,a,l]of s.matches.entries())this.#r(h)||(n++,this.match(h,a,l).then(()=>o()));for(let[h,a]of s.subwalks.entries())n++,this.walkCB2(h,a,s.child(),o);o()}walkCBSync(t,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(t,e,new It(this.opts),s)}walkCB2Sync(t,e,s,r){if(this.#o(t))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,r));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&r()};for(let[h,a,l]of s.matches.entries())this.#r(h)||this.matchSync(h,a,l);for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let a=h.readdirSync();this.walkCB3Sync(h,a,s,o)}o()}walkCB3Sync(t,e,s,r){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&r()};for(let[h,a,l]of s.matches.entries())this.#r(h)||this.matchSync(h,a,l);for(let[h,a]of s.subwalks.entries())n++,this.walkCB2Sync(h,a,s.child(),o);o()}},Wt=class extends se{matches=new Set;constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},jt=class extends se{results;constructor(t,e,s){super(t,e,s),this.results=new tt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var un=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",U=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=fn(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(a=>a.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(a=>a.includes("/")?a:`./**/${a}`)}if(this.pattern=t,this.platform=e.platform||un,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let a=e.platform==="win32"?ut:e.platform==="darwin"?Pt:e.platform?dt:Ks;this.scurry=new a(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",r={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(a=>new _(a,r)),[o,h]=n.reduce((a,l)=>(a[0].push(...l.set),a[1].push(...l.globParts),a),[[],[]]);this.patterns=o.map((a,l)=>{let f=h[l];if(!f)throw new Error("invalid pattern object");return new pt(a,f,0,this.platform)})}async walk(){return[...await new Wt(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 Wt(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 jt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new jt(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var We=(i,t={})=>{Array.isArray(i)||(i=[i]);for(let e of i)if(new _(e,t).hasMagic())return!0;return!1};function re(i,t={}){return new U(i,t).streamSync()}function Xs(i,t={}){return new U(i,t).stream()}function ne(i,t={}){return new U(i,t).walkSync()}async function Ys(i,t={}){return new U(i,t).walk()}function oe(i,t={}){return new U(i,t).iterateSync()}function Js(i,t={}){return new U(i,t).iterate()}var dn=re,pn=Object.assign(Xs,{sync:re}),mn=oe,gn=Object.assign(Js,{sync:oe}),wn=Object.assign(ne,{stream:re,iterate:oe}),ie=Object.assign(Ys,{glob:Ys,globSync:ne,sync:wn,globStream:Xs,stream:pn,globStreamSync:re,streamSync:dn,globIterate:Js,iterate:gn,globIterateSync:oe,iterateSync:mn,Glob:U,hasMagic:We,escape:ht,unescape:j});ie.glob=ie;var et=(i,t)=>typeof i>"u"||typeof i===t,Zs=i=>!!i&&typeof i=="object"&&et(i.preserveRoot,"boolean")&&et(i.tmp,"string")&&et(i.maxRetries,"number")&&et(i.retryDelay,"number")&&et(i.backoff,"number")&&et(i.maxBackoff,"number")&&(et(i.glob,"boolean")||i.glob&&typeof i.glob=="object")&&et(i.filter,"function"),Qs=i=>{if(!Zs(i))throw new Error("invalid rimraf options")},ti=i=>{Qs(i);let{glob:t,...e}=i;if(!t)return e;let s=t===!0?i.signal?{signal:i.signal}:{}:i.signal?{signal:i.signal,...t}:t;return{...e,glob:{...s,absolute:!0,withFileTypes:!1}}},ei=(i={})=>ti(i),si=(i={})=>ti(i);import{parse as ii,resolve as yn}from"path";import{inspect as Sn}from"util";var $=process.env.__TESTING_RIMRAF_PLATFORM__||process.platform;var bn=(i,t={})=>{let e=typeof i;if(e!=="string"){let r=i&&e==="object"&&i.constructor,o=`The "path" argument must be of type string. Received ${r&&r.name?`an instance of ${r.name}`:e==="object"?Sn(i):`type ${e} ${i}`}`;throw Object.assign(new TypeError(o),{path:i,code:"ERR_INVALID_ARG_TYPE"})}if(/\0/.test(i)){let r="path must be a string without null bytes";throw Object.assign(new TypeError(r),{path:i,code:"ERR_INVALID_ARG_VALUE"})}i=yn(i);let{root:s}=ii(i);if(i===s&&t.preserveRoot!==!1){let r="refusing to remove root directory without preserveRoot:false";throw Object.assign(new Error(r),{path:i,code:"ERR_PRESERVE_ROOT"})}if($==="win32"){let r=/[*|"<>?:]/,{root:n}=ii(i);if(r.test(i.substring(n.length)))throw Object.assign(new Error("Illegal characters in path."),{path:i,code:"EINVAL"})}return i},Bt=bn;import Y from"fs";import{chmodSync as he,mkdirSync as Ih,renameSync as ni,rmdirSync as gt,rmSync as oi,statSync as hi,lstatSync as wt,unlinkSync as yt}from"fs";import{readdirSync as En}from"fs";var ri=i=>En(i,{withFileTypes:!0}),vn=(i,t)=>new Promise((e,s)=>Y.chmod(i,t,(r,...n)=>r?s(r):e(...n))),xn=(i,t)=>new Promise((e,s)=>Y.mkdir(i,t,(r,n)=>r?s(r):e(n))),Tn=i=>new Promise((t,e)=>Y.readdir(i,{withFileTypes:!0},(s,r)=>s?e(s):t(r))),Rn=(i,t)=>new Promise((e,s)=>Y.rename(i,t,(r,...n)=>r?s(r):e(...n))),On=(i,t)=>new Promise((e,s)=>Y.rm(i,t,(r,...n)=>r?s(r):e(...n))),An=i=>new Promise((t,e)=>Y.rmdir(i,(s,...r)=>s?e(s):t(...r))),Nn=i=>new Promise((t,e)=>Y.stat(i,(s,r)=>s?e(s):t(r))),Cn=i=>new Promise((t,e)=>Y.lstat(i,(s,r)=>s?e(s):t(r))),kn=i=>new Promise((t,e)=>Y.unlink(i,(s,...r)=>s?e(s):t(...r))),F={chmod:vn,mkdir:xn,readdir:Tn,rename:Rn,rm:On,rmdir:An,stat:Nn,lstat:Cn,unlink:kn};import{parse as ai,resolve as li}from"path";var{readdir:Dn}=F,St=i=>Dn(i).catch(t=>t),bt=i=>{try{return ri(i)}catch(t){return t}};var X=async i=>i.catch(t=>{if(t.code!=="ENOENT")throw t}),J=i=>{try{return i()}catch(t){if(t?.code!=="ENOENT")throw t}};var{lstat:Mn,rmdir:Fn,unlink:_n}=F,ae=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await ci(i,t,await Mn(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},le=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return fi(i,t,wt(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},ci=async(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;let s=e.isDirectory()?await St(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!await t.filter(i,e)?!1:(await X(_n(i)),!0)}return!(await Promise.all(s.map(n=>ci(li(i,n.name),t,n)))).reduce((n,o)=>n&&o,!0)||t.preserveRoot===!1&&i===ai(i).root||t.filter&&!await t.filter(i,e)?!1:(await X(Fn(i)),!0)},fi=(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;let s=e.isDirectory()?bt(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!t.filter(i,e)?!1:(J(()=>yt(i)),!0)}let r=!0;for(let n of s){let o=li(i,n.name);r=fi(o,t,n)&&r}return t.preserveRoot===!1&&i===ai(i).root||!r||t.filter&&!t.filter(i,e)?!1:(J(()=>gt(i)),!0)};import{parse as bi,resolve as Ei}from"path";var{chmod:Ln}=F,je=i=>async t=>{try{return await i(t)}catch(e){let s=e;if(s?.code==="ENOENT")return;if(s?.code==="EPERM"){try{await Ln(t,438)}catch(r){if(r?.code==="ENOENT")return;throw e}return await i(t)}throw e}},Be=i=>t=>{try{return i(t)}catch(e){let s=e;if(s?.code==="ENOENT")return;if(s?.code==="EPERM"){try{he(t,438)}catch(r){if(r?.code==="ENOENT")return;throw e}return i(t)}throw e}};var ui=new Set(["EMFILE","ENFILE","EBUSY"]),ze=i=>{let t=async(e,s,r=1,n=0)=>{let o=s.maxBackoff||200,h=s.backoff||1.2,a=s.maxRetries||10,l=0;for(;;)try{return await i(e)}catch(f){let c=f;if(c?.path===e&&c?.code&&ui.has(c.code)){if(r=Math.ceil(r*h),n=r+n,n<o)return new Promise((u,d)=>{setTimeout(()=>{t(e,s,r,n).then(u,d)},r)});if(l<a){l++;continue}}throw f}};return t},Ue=i=>(e,s)=>{let r=s.maxRetries||10,n=0;for(;;)try{return i(e)}catch(o){let h=o;if(h?.path===e&&h?.code&&ui.has(h.code)&&n<r){n++;continue}throw o}};import{basename as $n,parse as ue,resolve as de}from"path";import{tmpdir as fe}from"os";import{parse as ce,resolve as di}from"path";var{stat:Pn}=F,In=i=>{try{return hi(i).isDirectory()}catch{return!1}},Wn=i=>Pn(i).then(t=>t.isDirectory(),()=>!1),jn=async i=>{let{root:t}=ce(i),e=fe(),{root:s}=ce(e);if(t.toLowerCase()===s.toLowerCase())return e;let r=di(t,"/temp");return await Wn(r)?r:t},Bn=i=>{let{root:t}=ce(i),e=fe(),{root:s}=ce(e);if(t.toLowerCase()===s.toLowerCase())return e;let r=di(t,"/temp");return In(r)?r:t},zn=async()=>fe(),Un=()=>fe(),pi=$==="win32"?jn:zn,mi=$==="win32"?Bn:Un;var{lstat:Gn,rename:Hn,unlink:gi,rmdir:Vn,chmod:qn}=F,Si=i=>`.${$n(i)}.${Math.random()}`,Kn=async i=>gi(i).catch(t=>{if(t.code==="EPERM")return qn(i,438).then(()=>gi(i),e=>{if(e.code!=="ENOENT")throw t});if(t.code==="ENOENT")return;throw t}),Yn=i=>{try{yt(i)}catch(t){if(t?.code==="EPERM")try{return he(i,438)}catch(e){if(e?.code==="ENOENT")return;throw t}else if(t?.code==="ENOENT")return;throw t}},pe=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await $e(i,t,await Gn(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},$e=async(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;if(!t.tmp)return $e(i,{...t,tmp:await pi(i)},e);if(i===t.tmp&&ue(i).root!==i)throw new Error("cannot delete temp directory used for deletion");let s=e.isDirectory()?await St(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!await t.filter(i,e)?!1:(await X(wi(i,t.tmp,Kn)),!0)}return!(await Promise.all(s.map(n=>$e(de(i,n.name),t,n)))).reduce((n,o)=>n&&o,!0)||t.preserveRoot===!1&&i===ue(i).root||t.filter&&!await t.filter(i,e)?!1:(await X(wi(i,t.tmp,Vn)),!0)},wi=async(i,t,e)=>{let s=de(t,Si(i));return await Hn(i,s),await e(s)},me=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return Ge(i,t,wt(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},Ge=(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;if(!t.tmp)return Ge(i,{...t,tmp:mi(i)},e);let s=t.tmp;if(i===t.tmp&&ue(i).root!==i)throw new Error("cannot delete temp directory used for deletion");let r=e.isDirectory()?bt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!t.filter(i,e)?!1:(J(()=>yi(i,s,Yn)),!0)}let n=!0;for(let o of r){let h=de(i,o.name);n=Ge(h,t,o)&&n}return!n||t.preserveRoot===!1&&i===ue(i).root||t.filter&&!t.filter(i,e)?!1:(J(()=>yi(i,s,gt)),!0)},yi=(i,t,e)=>{let s=de(t,Si(i));return ni(i,s),e(s)};var{unlink:Xn,rmdir:Jn,lstat:Zn}=F,Qn=ze(je(Xn)),to=Ue(Be(yt)),eo=ze(je(Jn)),so=Ue(Be(gt)),io=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;let{filter:e,...s}=t;try{return await eo(i,s)}catch(r){if(r?.code==="ENOTEMPTY")return await pe(i,s);throw r}},ro=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;let{filter:e,...s}=t;try{return so(i,s)}catch(r){if(r?.code==="ENOTEMPTY")return me(i,s);throw r}},st=Symbol("start"),vi=Symbol("child"),ge=Symbol("finish"),we=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await He(i,t,await Zn(i),st)}catch(e){if(e?.code==="ENOENT")return!0;throw e}},ye=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return Ve(i,t,wt(i),st)}catch(e){if(e?.code==="ENOENT")return!0;throw e}},He=async(i,t,e,s=st)=>{if(t?.signal?.aborted)throw t.signal.reason;let r=e.isDirectory()?await St(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!await t.filter(i,e)?!1:(await X(Qn(i,t)),!0)}let n=s===st?vi:s,o=(await Promise.all(r.map(h=>He(Ei(i,h.name),t,h,n)))).reduce((h,a)=>h&&a,!0);if(s===st)return He(i,t,e,ge);if(s===ge){if(t.preserveRoot===!1&&i===bi(i).root||!o||t.filter&&!await t.filter(i,e))return!1;await X(io(i,t))}return!0},Ve=(i,t,e,s=st)=>{let r=e.isDirectory()?bt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!t.filter(i,e)?!1:(J(()=>to(i,t)),!0)}let n=!0;for(let o of r){let h=s===st?vi:s,a=Ei(i,o.name);n=Ve(a,t,o,h)&&n}if(s===st)return Ve(i,t,e,ge);if(s===ge){if(t.preserveRoot===!1&&i===bi(i).root||!n||t.filter&&!t.filter(i,e))return!1;J(()=>{ro(i,t)})}return!0};var qe=$==="win32"?we:ae,Ke=$==="win32"?ye:le;var{rm:no}=F,Ye=async(i,t)=>(await no(i,{...t,force:!0,recursive:!0}),!0),Xe=(i,t)=>(oi(i,{...t,force:!0,recursive:!0}),!0);var oo=process.env.__TESTING_RIMRAF_NODE_VERSION__||process.version,ho=oo.replace(/^v/,"").split("."),[xi=0,ao=0]=ho.map(i=>parseInt(i,10)),Ti=xi>14||xi===14&&ao>=14,Ri=!Ti||$==="win32"?()=>!1:i=>!i?.signal&&!i?.filter,Oi=!Ti||$==="win32"?()=>!1:i=>!i?.signal&&!i?.filter;var Et=i=>async(t,e)=>{let s=ei(e);return s.glob&&(t=await ie(t,s.glob)),Array.isArray(t)?!!(await Promise.all(t.map(r=>i(Bt(r,s),s)))).reduce((r,n)=>r&&n,!0):!!await i(Bt(t,s),s)},vt=i=>(t,e)=>{let s=si(e);return s.glob&&(t=ne(t,s.glob)),Array.isArray(t)?!!t.map(r=>i(Bt(r,s),s)).reduce((r,n)=>r&&n,!0):!!i(Bt(t,s),s)},Ci=vt(Xe),lo=Object.assign(Et(Ye),{sync:Ci}),ki=vt(Ke),co=Object.assign(Et(qe),{sync:ki}),Di=vt(ye),fo=Object.assign(Et(we),{sync:Di}),Mi=vt(le),uo=Object.assign(Et(ae),{sync:Mi}),Fi=vt(me),po=Object.assign(Et(pe),{sync:Fi}),Je=vt((i,t)=>Oi(t)?Xe(i,t):Ke(i,t)),_i=Je,Ai=Et((i,t)=>Ri(t)?Ye(i,t):qe(i,t)),Ni=Object.assign(Ai,{rimraf:Ai,sync:Je,rimrafSync:Je,manual:co,manualSync:ki,native:lo,nativeSync:Ci,posix:uo,posixSync:Mi,windows:fo,windowsSync:Di,moveRemove:po,moveRemoveSync:Fi});Ni.rimraf=Ni;var Pi=go(new URL(".",import.meta.url)),Qe=Li(Pi,"../builder/vite-config.js"),wo=Li(Pi,"../builder/vite-entry-server.js");async function Ia({options:i,logger:t}){t.info(`Building template...
6
6
  `),i.clean&&_i(mo.join(process.cwd(),"dist"));let e="production";i.ssr==="local"&&(e="development",process.env.NODE_ENV=e),i.ssr?(await Ze({configFile:Qe,customLogger:t,mode:e,logLevel:i.logLevel,clearScreen:i.clearScreen,build:{ssrManifest:!0,emptyOutDir:!0}}),await Ze({configFile:Qe,customLogger:t,mode:e,logLevel:i.logLevel,clearScreen:i.clearScreen,ssr:{target:"webworker"},build:{ssr:wo}})):await Ze({configFile:Qe,customLogger:t,logLevel:i.logLevel,clearScreen:i.clearScreen,build:{emptyOutDir:!0}})}export{Ia as buildTemplate};
7
+ //# sourceMappingURL=cmd-build.js.map