dsh-edge 0.2.0-alpha.1 → 0.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # last confirmed-consistent state. Both languages carry equal authority.
3
3
  # After editing either side, update both and re-record every pair with:
4
4
  # pnpm run doc-pairs -- --write
5
- README.md: 2cdcc21fdc945df3c383eed524fb2df503766875
6
- README.zh.md: 56dc7792454f44a2da07e9a2fc87bd3c68592531
5
+ README.md: 6677bc90acde245bf00f9cacf27c800c1320caf3
6
+ README.zh.md: 899072d815abafe399c8561999a07c8c3cb12474
package/README.md CHANGED
@@ -166,11 +166,13 @@ Stable deployments use `npx dsh-edge@latest upgrade`. The Edge settings page der
166
166
 
167
167
  The installer asks for the runtime before the account. The recommended `Free — Direct Shell` mode works on Workers Free and can use a detected Cloudflare account, open Cloudflare sign-in or registration, or create a temporary account without login. `Isolated — Dynamic Worker` requires Workers Paid and therefore offers only a detected or newly authenticated account. Cloudflare does not expose a reliable local entitlement check for Worker Loader, so an isolated install lets Cloudflare authorize the upload and turns a rejection into a choice between enabling Workers Paid and using direct mode.
168
168
 
169
- The remaining prompts select a Worker name, generate or accept the owner access key, collect the DeepSeek API key through hidden input, and show a final cost summary. A temporary-account install also asks the user to accept Cloudflare's Terms of Service and Privacy Policy explicitly. An existing Worker is never overwritten without confirmation. The installer passes both credentials through a mode-`0600` temporary secrets file and gives Wrangler only an allowlisted runtime environment plus the Cloudflare authentication selected for that command; unrelated ambient keys, tokens, passwords, secrets, and Node injection options do not reach the child. It removes the secret file after the command and discovers the resulting URL from Wrangler's structured output. Deployment output is hidden behind one progress indicator by default; add `--verbose` to either command to inspect Wrangler diagnostics. It does not probe the public Worker after upload. Instead, it prints the URL, owner access key, and concrete next steps; a temporary account also receives a bearer claim URL that must be claimed within 60 minutes to retain the Worker and its data. A rejected upload is reported as not installed and, when Wrangler created a temporary account first, still prints its claim URL without presenting the unused owner key as active. If upload succeeds but output parsing, claim-URL extraction, interruption handling, or local cleanup prevents a normal handoff, a recovery card still prints the active owner key and any known URLs before the command exits unsuccessfully. The installation uploads directly through Wrangler and does not create or bind a GitHub repository, Cloudflare Builds project, or source-build pipeline.
169
+ The remaining prompts select a Worker name, generate or accept the owner access key, collect the DeepSeek API key through hidden input, and show a final cost summary. A temporary-account install also asks the user to accept Cloudflare's Terms of Service and Privacy Policy explicitly. An existing Worker is never overwritten without confirmation. The installer passes both credentials through a mode-`0600` temporary secrets file and gives Wrangler only an allowlisted runtime environment plus the Cloudflare authentication selected for that command; unrelated ambient keys, tokens, passwords, secrets, and Node injection options do not reach the child. It removes the secret file after the command and discovers the resulting URL from Wrangler's structured output. Deployment output is hidden behind one progress indicator by default; add `--verbose` to either command to inspect Wrangler diagnostics.
170
+
171
+ After an accepted upload, a second progress indicator observes the public `/api/health` route for at most 45 seconds without sending either credential or following redirects. It accepts only the exact packaged version and selected runtime. A matching response produces a ready card. Cloudflare propagation, challenge, placeholder, transport, and older-release responses remain pending; expiry still exits successfully and tells the owner to wait briefly and refresh. This observation does not call DeepSeek or touch Durable Object state. The final card prints the URL, owner access key, and concrete next steps; a temporary account also receives a bearer claim URL that must be claimed within 60 minutes to retain the Worker and its data. A rejected upload is reported as not installed and, when Wrangler created a temporary account first, still prints its claim URL without presenting the unused owner key as active. If upload succeeds but output parsing, claim-URL extraction, interruption handling, activation interruption, or local cleanup prevents a normal handoff, a recovery card still prints the active owner key and any known URLs before the command exits unsuccessfully. The installation uploads directly through Wrangler and does not create or bind a GitHub repository, Cloudflare Builds project, or source-build pipeline.
170
172
 
171
173
  Contributors working from a checkout can reproduce the two release artifacts locally with `pnpm --filter dsh-edge bundle:direct` and `pnpm --filter dsh-edge bundle:isolated`. The first command also enforces the compressed-size budget.
172
174
 
173
- Contributors can replay the complete Free temporary-account journey without a key or network call. This example runs the shipped bin, real prompts, Wrangler subprocess, structured deployment-output parsing, and final handoff while replacing only the external Cloudflare command:
175
+ Contributors can replay the complete Free temporary-account journey without a key or network call. This example runs the shipped bin, real prompts, Wrangler subprocess, structured deployment-output parsing, public-activation observation, and final handoff while replacing the external Cloudflare boundaries:
174
176
 
175
177
  ```sh
176
178
  pnpm --filter dsh-edge example:install
package/README.zh.md CHANGED
@@ -166,11 +166,13 @@ npx dsh-edge@next upgrade
166
166
 
167
167
  安装器会先询问运行时,再询问账户。推荐的 `Free — Direct Shell` 模式可在 Workers Free 上运行,并可使用检测到的 Cloudflare 账户、打开 Cloudflare 登录或注册,也可在不登录的情况下创建临时账户。`Isolated — Dynamic Worker` 需要 Workers Paid,因此只提供已检测到或新认证的账户。Cloudflare 没有提供可靠的本地 Worker Loader entitlement 检查;isolated 安装会由 Cloudflare 对上传进行授权,并在被拒绝时提示启用 Workers Paid 或改用 direct 模式。
168
168
 
169
- 后续提示会选择 Worker 名称、生成或接收 owner access key、通过隐藏输入收集 DeepSeek API key,并显示最终费用摘要。临时账户安装还会要求用户明确接受 Cloudflare 服务条款与隐私政策。安装器绝不会在未经确认时覆盖现有 Worker。两项 credential 会通过权限模式为 `0600` 的临时 secret 文件传给 Wrangler;Wrangler 子进程只会收到 allowlist 内的运行时环境变量和当前命令选中的 Cloudflare authentication,其他 ambient key、token、password、secret 与 Node 注入选项不会进入子进程。命令结束后临时 secret 文件会被删除,安装器从 Wrangler 结构化输出中取得最终 URL。默认情况下,部署输出会收敛到一个进度提示;在任一命令后添加 `--verbose` 可以查看 Wrangler 诊断。上传后它不会探测公开 Worker,而是直接输出 URL、owner access key 与明确的下一步;临时账户还会收到一个 bearer claim URL,必须在 60 分钟内认领才能保留 Worker 及其数据。上传被拒绝时,安装器会明确报告未安装;如果 Wrangler 已经创建临时账户,仍会输出其 claim URL,但不会把尚未生效的 owner key 显示为 active。如果上传成功,但输出解析、claim URL 提取、中断处理或本地清理导致正常交接无法完成,命令仍会在按失败退出前通过恢复卡片输出已生效的 owner key 与当时已知的 URL。安装过程直接通过 Wrangler 上传,不会创建或绑定 GitHub 仓库、Cloudflare Builds 项目或源码构建流水线。
169
+ 后续提示会选择 Worker 名称、生成或接收 owner access key、通过隐藏输入收集 DeepSeek API key,并显示最终费用摘要。临时账户安装还会要求用户明确接受 Cloudflare 服务条款与隐私政策。安装器绝不会在未经确认时覆盖现有 Worker。两项 credential 会通过权限模式为 `0600` 的临时 secret 文件传给 Wrangler;Wrangler 子进程只会收到 allowlist 内的运行时环境变量和当前命令选中的 Cloudflare authentication,其他 ambient key、token、password、secret 与 Node 注入选项不会进入子进程。命令结束后临时 secret 文件会被删除,安装器从 Wrangler 结构化输出中取得最终 URL。默认情况下,部署输出会收敛到一个进度提示;在任一命令后添加 `--verbose` 可以查看 Wrangler 诊断。
170
+
171
+ 上传被接受后,第二个进度提示会在不发送任一 credential 且不跟随重定向的前提下,最多观察公开 `/api/health` 路由 45 秒。它只接受当前 package 的精确版本和所选 runtime。匹配的 response 会产生 ready 卡片;Cloudflare propagation、challenge、占位页、传输错误与旧 release response 都保持 pending,观察到期仍以成功退出,并提示 owner 稍后刷新。该观察不会调用 DeepSeek,也不会访问 Durable Object 状态。最终卡片会输出 URL、owner access key 与明确的下一步;临时账户还会收到一个 bearer claim URL,必须在 60 分钟内认领才能保留 Worker 及其数据。上传被拒绝时,安装器会明确报告未安装;如果 Wrangler 已经创建临时账户,仍会输出其 claim URL,但不会把尚未生效的 owner key 显示为 active。如果上传成功,但输出解析、claim URL 提取、中断处理、激活观察中断或本地清理导致正常交接无法完成,命令仍会在按失败退出前通过恢复卡片输出已生效的 owner key 与当时已知的 URL。安装过程直接通过 Wrangler 上传,不会创建或绑定 GitHub 仓库、Cloudflare Builds 项目或源码构建流水线。
170
172
 
171
173
  从 checkout 开发的贡献者可以用 `pnpm --filter dsh-edge bundle:direct` 和 `pnpm --filter dsh-edge bundle:isolated` 在本地复现两种 release artifact。第一条命令还会执行压缩体积预算检查。
172
174
 
173
- 贡献者可以在没有 key 且不发起网络请求的情况下重放完整的 Free 临时账户流程。这个 example 会运行实际交付的 bin、真实 prompt、Wrangler 子进程、结构化部署输出解析与最终交接,只替换外部 Cloudflare command:
175
+ 贡献者可以在没有 key 且不发起网络请求的情况下重放完整的 Free 临时账户流程。这个 example 会运行实际交付的 bin、真实 prompt、Wrangler 子进程、结构化部署输出解析、公开激活观察与最终交接,并替换外部 Cloudflare 边界:
174
176
 
175
177
  ```sh
176
178
  pnpm --filter dsh-edge example:install
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-edge",
3
- "version": "0.2.0-alpha.1",
3
+ "version": "0.2.0-alpha.2",
4
4
  "description": "Run DeepSeek Harness on Cloudflare Workers as an independent community project",
5
5
  "author": "pawaca",
6
6
  "license": "MIT",
@@ -0,0 +1,34 @@
1
+ import type { RuntimeMode } from './install.mjs'
2
+
3
+ export interface ActivationObservation {
4
+ attempts: number
5
+ elapsedMs: number
6
+ status: 'pending' | 'ready'
7
+ }
8
+
9
+ export interface ExpectedHealth {
10
+ deploymentId: string
11
+ shell: 'just-bash-direct' | 'just-bash-isolated'
12
+ }
13
+
14
+ export const ACTIVATION_WAIT_MS: number
15
+ export const ACTIVATION_REQUEST_TIMEOUT_MS: number
16
+ export const ACTIVATION_RETRY_MS: number
17
+
18
+ export function observePublicActivation(options: {
19
+ publicUrl: string
20
+ mode: RuntimeMode
21
+ fetchImpl?: typeof fetch
22
+ now?: () => number
23
+ requestTimeoutMs?: number
24
+ retryMs?: number
25
+ signal?: AbortSignal
26
+ sleepImpl?: (
27
+ delay: number,
28
+ value?: undefined,
29
+ options?: { signal?: AbortSignal },
30
+ ) => Promise<unknown>
31
+ waitMs?: number
32
+ }): Promise<ActivationObservation>
33
+
34
+ export function isExpectedHealth(value: unknown, expected: ExpectedHealth): boolean
@@ -0,0 +1,133 @@
1
+ import { setTimeout as sleep } from 'node:timers/promises'
2
+ import edgePackage from '../package.json' with { type: 'json' }
3
+
4
+ export const ACTIVATION_WAIT_MS = 45_000
5
+ export const ACTIVATION_REQUEST_TIMEOUT_MS = 4_000
6
+ export const ACTIVATION_RETRY_MS = 1_500
7
+
8
+ const MAX_HEALTH_BYTES = 64 * 1024
9
+
10
+ /** Observe when Cloudflare serves the exact Worker release without making it an install gate. */
11
+ export async function observePublicActivation({
12
+ publicUrl,
13
+ mode,
14
+ fetchImpl = globalThis.fetch,
15
+ now = Date.now,
16
+ requestTimeoutMs = ACTIVATION_REQUEST_TIMEOUT_MS,
17
+ retryMs = ACTIVATION_RETRY_MS,
18
+ signal,
19
+ sleepImpl = sleep,
20
+ waitMs = ACTIVATION_WAIT_MS,
21
+ } = {}) {
22
+ if (mode !== 'direct' && mode !== 'isolated') throw new Error('A runtime mode is required.')
23
+ if (!Number.isFinite(waitMs) || waitMs < 0) throw new Error('Activation wait must be non-negative.')
24
+ if (!Number.isFinite(requestTimeoutMs) || requestTimeoutMs <= 0) {
25
+ throw new Error('Activation request timeout must be positive.')
26
+ }
27
+ if (!Number.isFinite(retryMs) || retryMs <= 0) throw new Error('Activation retry must be positive.')
28
+ if (typeof fetchImpl !== 'function') throw new Error('Activation observation requires fetch.')
29
+
30
+ const healthUrl = publicHealthUrl(publicUrl)
31
+ const expected = {
32
+ deploymentId: `dsh-edge@${edgePackage.version}/${mode}`,
33
+ shell: mode === 'direct' ? 'just-bash-direct' : 'just-bash-isolated',
34
+ }
35
+ const startedAt = now()
36
+ const deadline = startedAt + waitMs
37
+ let attempts = 0
38
+
39
+ while (true) {
40
+ signal?.throwIfAborted()
41
+ const requestBudget = deadline - now()
42
+ if (requestBudget <= 0) {
43
+ return activationResult('pending', attempts, startedAt, now())
44
+ }
45
+ attempts += 1
46
+ const requestTimeout = AbortSignal.timeout(Math.min(requestTimeoutMs, requestBudget))
47
+ const requestSignal = signal === undefined
48
+ ? requestTimeout
49
+ : AbortSignal.any([signal, requestTimeout])
50
+ try {
51
+ const response = await fetchImpl(healthUrl, {
52
+ headers: {
53
+ accept: 'application/json',
54
+ 'cache-control': 'no-cache',
55
+ },
56
+ redirect: 'manual',
57
+ signal: requestSignal,
58
+ })
59
+ if (response.ok) {
60
+ const health = await readBoundedJson(response, MAX_HEALTH_BYTES)
61
+ if (isExpectedHealth(health, expected)) {
62
+ return activationResult('ready', attempts, startedAt, now())
63
+ }
64
+ } else {
65
+ await response.body?.cancel()
66
+ }
67
+ } catch {
68
+ if (signal?.aborted) signal.throwIfAborted()
69
+ // DNS, routing, challenge, timeout, and placeholder responses are all
70
+ // transient observations until the bounded wait expires.
71
+ }
72
+
73
+ const remaining = deadline - now()
74
+ if (remaining <= 0) return activationResult('pending', attempts, startedAt, now())
75
+ await sleepImpl(Math.min(retryMs, remaining), undefined, { signal })
76
+ }
77
+ }
78
+
79
+ export function isExpectedHealth(value, expected) {
80
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) return false
81
+ return value.ok === true
82
+ && value.service === 'dsh-edge'
83
+ && value.status === 'ready'
84
+ && value.storage === 'durable-object-sqlite-vfs'
85
+ && value.deploymentId === expected.deploymentId
86
+ && value.shell === expected.shell
87
+ && value.version === edgePackage.version
88
+ }
89
+
90
+ function publicHealthUrl(publicUrl) {
91
+ const url = new URL(publicUrl)
92
+ if (url.protocol !== 'https:' || url.username !== '' || url.password !== ''
93
+ || !url.hostname.endsWith('.workers.dev')
94
+ || url.pathname !== '/' || url.search !== '' || url.hash !== '') {
95
+ throw new Error('Activation observation requires a public workers.dev origin.')
96
+ }
97
+ url.pathname = '/api/health'
98
+ return url.href
99
+ }
100
+
101
+ async function readBoundedJson(response, maxBytes) {
102
+ if (response.body === null) return undefined
103
+ const reader = response.body.getReader()
104
+ const decoder = new TextDecoder('utf-8', { fatal: true })
105
+ let bytes = 0
106
+ let source = ''
107
+ try {
108
+ while (true) {
109
+ const { done, value } = await reader.read()
110
+ if (done) break
111
+ bytes += value.byteLength
112
+ if (bytes > maxBytes) {
113
+ await reader.cancel()
114
+ return undefined
115
+ }
116
+ source += decoder.decode(value, { stream: true })
117
+ }
118
+ source += decoder.decode()
119
+ return JSON.parse(source)
120
+ } catch {
121
+ return undefined
122
+ } finally {
123
+ reader.releaseLock()
124
+ }
125
+ }
126
+
127
+ function activationResult(status, attempts, startedAt, finishedAt) {
128
+ return {
129
+ attempts,
130
+ elapsedMs: Math.max(0, finishedAt - startedAt),
131
+ status,
132
+ }
133
+ }
package/scripts/cli.d.mts CHANGED
@@ -10,6 +10,15 @@ export class InstallInterruptedError extends Error {
10
10
 
11
11
  export type InstallerCommand = 'install' | 'upgrade'
12
12
  export function parseCommand(args: string[]): InstallerCommand | 'help' | 'version'
13
+ export function renderInstallerIntro(
14
+ command: InstallerCommand,
15
+ options?: {
16
+ columns?: number
17
+ isTTY?: boolean
18
+ upstreamVersion?: string
19
+ version?: string
20
+ },
21
+ ): string
13
22
  export function createInstallerUi(
14
23
  clack?: typeof import('@clack/prompts'),
15
24
  signal?: AbortSignal,
package/scripts/cli.mjs CHANGED
@@ -5,6 +5,7 @@ import { realpathSync, writeSync } from 'node:fs'
5
5
  import { Writable } from 'node:stream'
6
6
  import { fileURLToPath } from 'node:url'
7
7
  import edgePackage from '../package.json' with { type: 'json' }
8
+ import { observePublicActivation } from './activation.mjs'
8
9
  import {
9
10
  executeWrangler,
10
11
  InstallCancelledError,
@@ -18,6 +19,12 @@ const INTERRUPT_EXIT_CODES = new Map([
18
19
  ['SIGTERM', 143],
19
20
  ])
20
21
  const OUTPUT_DRAIN_TIMEOUT_MS = 1_000
22
+ const HERO_MIN_COLUMNS = 68
23
+ const DSH_EDGE_HERO = String.raw` ____ ____ _ _ _____ ____ ____ _____
24
+ | _ \/ ___|| | | | | ____| _ \ / ___| ____|
25
+ | | | \___ \| |_| |_____| _| | | | | | _| _|
26
+ | |_| |___) | _ |_____| |___| |_| | |_| | |___
27
+ |____/|____/|_| |_| |_____|____/ \____|_____|`
21
28
 
22
29
  export class InstallInterruptedError extends InstallCancelledError {
23
30
  constructor(signal) {
@@ -38,6 +45,25 @@ export function parseCommand(args) {
38
45
  throw usageError()
39
46
  }
40
47
 
48
+ export function renderInstallerIntro(command, {
49
+ columns = 80,
50
+ isTTY = false,
51
+ version = edgePackage.version,
52
+ upstreamVersion = edgePackage.dshEdge.upstreamVersion,
53
+ } = {}) {
54
+ if (!isTTY || columns < HERO_MIN_COLUMNS) {
55
+ return `dsh-edge ${command} · ${version} · Harness ${upstreamVersion}`
56
+ }
57
+ return [
58
+ '',
59
+ DSH_EDGE_HERO,
60
+ '',
61
+ 'DeepSeek Harness on Cloudflare',
62
+ `dsh-edge ${version} · Harness ${upstreamVersion}`,
63
+ `community project · ${command}`,
64
+ ].join('\n')
65
+ }
66
+
41
67
  export function createInstallerUi(
42
68
  clack = prompt,
43
69
  signal,
@@ -54,8 +80,13 @@ export function createInstallerUi(
54
80
  ? clack.note(message, title)
55
81
  : clack.note(message, title, { output })
56
82
  let deploymentSpinner
83
+ let activationSpinner
84
+ const terminal = output ?? process.stdout
57
85
  return {
58
- intro: message => log(clack.intro, message),
86
+ intro: () => log(clack.intro, renderInstallerIntro(command, {
87
+ columns: terminal.columns ?? 80,
88
+ isTTY: terminal.isTTY === true,
89
+ })),
59
90
  step: message => log(clack.log.step, message),
60
91
  async selectRuntime() {
61
92
  return await requireAnswer(await clack.select(withOutput({
@@ -164,6 +195,20 @@ export function createInstallerUi(
164
195
  else deploymentSpinner.error('Cloudflare did not accept the Worker upload.')
165
196
  deploymentSpinner = undefined
166
197
  },
198
+ activationStart(message) {
199
+ activationSpinner = clack.spinner(withOutput({ indicator: 'timer', signal }))
200
+ activationSpinner.start(message)
201
+ },
202
+ activationFinish(result) {
203
+ if (activationSpinner === undefined) return
204
+ if (result?.status === 'ready') activationSpinner.stop('Public URL is ready.')
205
+ else if (result?.status === 'pending') {
206
+ activationSpinner.stop('Worker uploaded; public URL activation is still pending.')
207
+ } else {
208
+ activationSpinner.stop('Stopped waiting for public URL activation.')
209
+ }
210
+ activationSpinner = undefined
211
+ },
167
212
  failedDeployment(result) {
168
213
  note([
169
214
  `Worker: ${result.workerName}`,
@@ -193,6 +238,14 @@ export function createInstallerUi(
193
238
  },
194
239
  success(result) {
195
240
  const lines = [
241
+ ...(result.activation?.status === 'ready'
242
+ ? ['Status: Ready']
243
+ : [
244
+ 'Status: Cloudflare is still activating the public URL.',
245
+ 'First-time workers.dev activation can take about a minute.',
246
+ 'If the URL shows a placeholder, wait a moment and refresh.',
247
+ ]),
248
+ '',
196
249
  `URL: ${result.publicUrl}`,
197
250
  `Owner access key: ${result.ownerSecret}`,
198
251
  ]
@@ -204,6 +257,7 @@ export function createInstallerUi(
204
257
  '1. Claim this temporary account within 60 minutes to keep the Worker and its data.',
205
258
  '2. Open the URL above.',
206
259
  '3. Enter the owner access key when prompted.',
260
+ '4. Save the owner access key for future upgrades.',
207
261
  )
208
262
  } else {
209
263
  lines.push(
@@ -211,10 +265,18 @@ export function createInstallerUi(
211
265
  'Next steps:',
212
266
  '1. Open the URL above.',
213
267
  '2. Enter the owner access key when prompted.',
268
+ '3. Save the owner access key for future upgrades.',
214
269
  )
215
270
  }
216
- note(lines.join('\n'), command === 'upgrade' ? 'dsh-edge upgraded' : 'dsh-edge installed')
217
- log(clack.outro, command === 'upgrade' ? 'Upgrade handoff complete.' : 'Installation handoff complete.')
271
+ const ready = result.activation?.status === 'ready'
272
+ const title = ready
273
+ ? (command === 'upgrade' ? 'dsh-edge upgrade is live' : 'dsh-edge is ready')
274
+ : 'Worker uploaded — activation pending'
275
+ note(lines.join('\n'), title)
276
+ const outro = ready
277
+ ? (command === 'upgrade' ? 'Your dsh-edge upgrade is live.' : 'Your dsh-edge is ready.')
278
+ : `${command === 'upgrade' ? 'Upgrade' : 'Installation'} succeeded; Cloudflare is still activating the public URL.`
279
+ log(clack.outro, outro)
218
280
  },
219
281
  }
220
282
  }
@@ -294,6 +356,7 @@ export async function runInstaller({
294
356
  controller.signal.addEventListener('abort', cancelBlockedOutput)
295
357
  const installOperation = install ?? (options => installEdgeImpl({
296
358
  ...options,
359
+ observeActivation: observePublicActivation,
297
360
  runWrangler: (args, runOptions) => wranglerRunner(args, {
298
361
  ...runOptions,
299
362
  forwardOutput: verbose || (runOptions?.forwardOutput ?? runOptions?.interactive ?? false),
@@ -34,6 +34,8 @@ export interface InstallerUi {
34
34
  acceptTemporaryTerms(): Promise<boolean>
35
35
  deploymentStart?(message: string): void
36
36
  deploymentFinish?(succeeded: boolean): void
37
+ activationStart?(message: string): void
38
+ activationFinish?(result?: import('./activation.mjs').ActivationObservation): void
37
39
  failedDeployment?(result: { claimUrl: string; workerName: string }): void
38
40
  cleanupFailure(message: string): void
39
41
  recovery(result: InstallRecovery): void
@@ -52,6 +54,7 @@ export interface InstallRecovery {
52
54
  }
53
55
 
54
56
  export interface InstallResult {
57
+ activation?: import('./activation.mjs').ActivationObservation
55
58
  publicUrl: string
56
59
  versionId?: string
57
60
  account?: CloudflareAccount
@@ -130,6 +133,11 @@ export function installEdge(options: {
130
133
  environment?: NodeJS.ProcessEnv
131
134
  createTemporaryDirectory?: () => Promise<string>
132
135
  removePath?: typeof import('node:fs/promises').rm
136
+ observeActivation?: (options: {
137
+ publicUrl: string
138
+ mode: RuntimeMode
139
+ signal?: AbortSignal
140
+ }) => Promise<import('./activation.mjs').ActivationObservation>
133
141
  signal?: AbortSignal
134
142
  }): Promise<InstallResult>
135
143
  export function wranglerProcessInvocation(args: string[], options?: {
@@ -327,6 +327,7 @@ export async function installEdge({
327
327
  environment = process.env,
328
328
  createTemporaryDirectory = createPrivateTemporaryDirectory,
329
329
  removePath = rm,
330
+ observeActivation,
330
331
  signal,
331
332
  } = {}) {
332
333
  if (ui === undefined) throw new Error('installEdge requires an installer UI.')
@@ -523,7 +524,7 @@ export async function installEdge({
523
524
  })
524
525
  throw error
525
526
  }
526
- const result = {
527
+ let result = {
527
528
  ...deployment,
528
529
  account,
529
530
  claimUrl,
@@ -532,6 +533,22 @@ export async function installEdge({
532
533
  temporary,
533
534
  workerName,
534
535
  }
536
+ if (observeActivation !== undefined) {
537
+ ui.activationStart?.('Activating the public URL… Cloudflare usually takes 10–30 seconds.')
538
+ try {
539
+ const activation = await observeActivation({
540
+ mode,
541
+ publicUrl: result.publicUrl,
542
+ signal,
543
+ })
544
+ result = { ...result, activation }
545
+ ui.activationFinish?.(activation)
546
+ } catch (error) {
547
+ ui.activationFinish?.()
548
+ ui.recovery(result)
549
+ throw error
550
+ }
551
+ }
535
552
  completedResult = result
536
553
  } catch (error) {
537
554
  primaryError = signal?.aborted ? abortReason(signal, 'Installation interrupted.') : error
@@ -3,6 +3,7 @@ import { spawnSync } from 'node:child_process'
3
3
  import { readFileSync, readdirSync, realpathSync, writeFileSync } from 'node:fs'
4
4
  import { join } from 'node:path'
5
5
  import { fileURLToPath } from 'node:url'
6
+ import { resolvePnpmInvocation } from './pnpm-invocation.mjs'
6
7
 
7
8
  const MIT_TERMS = `Permission is hereby granted, free of charge, to any person obtaining a copy
8
9
  of this software and associated documentation files (the "Software"), to deal
@@ -41,12 +42,15 @@ const packageRoot = fileURLToPath(new URL('../', import.meta.url))
41
42
  const standaloneRoot = join(packageRoot, 'standalone')
42
43
 
43
44
  function bundledComponents() {
44
- const pnpmEntry = process.env.npm_execpath
45
- const command = pnpmEntry === undefined ? 'pnpm' : process.execPath
46
- const args = pnpmEntry === undefined
47
- ? ['--dir', standaloneRoot, 'licenses', 'list', '--prod', '--json']
48
- : [pnpmEntry, '--dir', standaloneRoot, 'licenses', 'list', '--prod', '--json']
49
- const result = spawnSync(command, args, { encoding: 'utf8' })
45
+ const invocation = resolvePnpmInvocation(process.env.npm_execpath ?? 'pnpm', [
46
+ '--dir',
47
+ standaloneRoot,
48
+ 'licenses',
49
+ 'list',
50
+ '--prod',
51
+ '--json',
52
+ ])
53
+ const result = spawnSync(invocation.command, invocation.args, { encoding: 'utf8' })
50
54
  if (result.error !== undefined) throw result.error
51
55
  if (result.status !== 0) {
52
56
  throw new Error(`unable to inventory the standalone production closure:\n${result.stdout}${result.stderr}`)
@@ -0,0 +1,14 @@
1
+ export interface PnpmInvocationOptions {
2
+ nodeExecutable?: string
3
+ }
4
+
5
+ export interface PnpmInvocation {
6
+ command: string
7
+ args: string[]
8
+ }
9
+
10
+ export declare function resolvePnpmInvocation(
11
+ pnpm: string | undefined,
12
+ args: string[],
13
+ options?: PnpmInvocationOptions,
14
+ ): PnpmInvocation
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Resolve a pnpm invocation across JavaScript-entry and standalone installs.
3
+ * @param {string | undefined} pnpm Package-manager path supplied by pnpm.
4
+ * @param {string[]} args Arguments to pass to pnpm.
5
+ * @param {{ nodeExecutable?: string }} [options] Resolution inputs.
6
+ * @returns {{ command: string, args: string[] }} Executable and arguments.
7
+ */
8
+ export function resolvePnpmInvocation(pnpm, args, options = {}) {
9
+ if (pnpm === undefined || pnpm === '') {
10
+ throw new Error('Cannot run pnpm without a package-manager executable.')
11
+ }
12
+
13
+ const nodeExecutable = options.nodeExecutable ?? process.execPath
14
+ if (/\.[cm]?js$/iu.test(pnpm)) {
15
+ return {
16
+ command: nodeExecutable,
17
+ args: [pnpm, ...args],
18
+ }
19
+ }
20
+
21
+ return {
22
+ command: pnpm,
23
+ args,
24
+ }
25
+ }
@@ -673,7 +673,7 @@ ${n}`:""}`}});function oO(e){if(e.url.trim().length===0)throw new Error("url mus
673
673
  button, .button { display: inline-block; box-sizing: border-box; margin-top: 1rem; padding: .75rem 1rem; border: 0; border-radius: .6rem; background: #5a87ff; color: #071022; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
674
674
  .secondary { background: #29314b; color: #edf2ff; }
675
675
  .error { padding: .75rem; border-radius: .5rem; background: #461d2b; color: #ffd6df; }
676
- `}l(oC,"pageStyles");var VS={name:"dsh-edge",version:"0.2.0-alpha.1",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.0-rc.7"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.0-rc.7","@deepseek-ai/dsh-agent-loop":"0.1.0-rc.7","@deepseek-ai/dsh-anonymous-user-id":"0.1.0-rc.7","@deepseek-ai/dsh-brand":"0.1.0-rc.7","@deepseek-ai/dsh-credentials":"0.1.0-rc.7","@deepseek-ai/dsh-host-apiproxy":"0.1.0-rc.7","@deepseek-ai/dsh-launch-environment":"0.1.0-rc.7","@deepseek-ai/dsh-llm":"0.1.0-rc.7","@deepseek-ai/dsh-llm-deepseek":"0.1.0-rc.7","@deepseek-ai/dsh-session":"0.1.0-rc.7","@deepseek-ai/dsh-session-persistence":"0.1.0-rc.7","@deepseek-ai/dsh-session-query":"0.1.0-rc.7","@deepseek-ai/dsh-session-title":"0.1.0-rc.7","@deepseek-ai/dsh-settings":"0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"0.1.0-rc.7","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.0-rc.7","@deepseek-ai/dsh-tool-web":"0.1.0-rc.7","@deepseek-ai/dsh-tools":"0.1.0-rc.7","@deepseek-ai/dsh-web":"0.1.0-rc.7","@deepseek-ai/dsh-web-search-deepseek":"0.1.0-rc.7","just-bash":"3.3.0",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var Gm=VS.version,aC=VS.dshEdge.upstreamVersion;function coe(){return"dsh-edge@0.2.0-alpha.1/direct"}l(coe,"resolveEdgeDeploymentId");function Vm(e){return HO(e.DEEPSEEK_API_KEY),{baseURL:cS(e.DEEPSEEK_BASE_URL),maxTokens:pS(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Id(e.DEEPSEEK_MODEL),reasoningEffort:uS(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:Dm(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dS(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Cd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Vm,"resolveEdgeDeploymentConfig");function uoe(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(uoe,"edgeDeploymentApiKeyConfigured");function doe(e){let t=cS(e),r=new URL(t);return r.search.length===0&&r.hash.length===0?t:(r.search="",r.hash="",r.href)}l(doe,"projectedEdgeBaseURL");function ZS(e){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",deploymentId:coe(),apiKeyConfigured:uoe(e),baseURL:doe(e.DEEPSEEK_BASE_URL),maxTokens:pS(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Id(e.DEEPSEEK_MODEL),reasoningEffort:uS(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:Dm(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dS(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Cd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(ZS,"resolveEdgeDeploymentProfile");function lC(e){Vm(e);let t=ZS(e);return{ok:!0,service:"dsh-edge",storage:t.storage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:Gm,upstreamVersion:aC,status:"ready"}}l(lC,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as dCe}from"cloudflare:workers";var fl=u7(cC());var KS=l((e,t,r)=>{let n=e instanceof RegExp?uC(e,r):e,i=t instanceof RegExp?uC(t,r):t,s=n!==null&&i!=null&&poe(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},"balanced"),uC=l((e,t)=>{let r=t.match(e);return r?r[0]:null},"maybeMatch"),poe=l((e,t,r)=>{let n,i,s,o,a,c=r.indexOf(e),u=r.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(n=[],s=r.length;d>=0&&!a;){if(d===c)n.push(d),c=r.indexOf(e,d+1);else if(n.length===1){let p=n.pop();p!==void 0&&(a=[p,u])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=u),u=r.indexOf(t,d+1);d=c<u&&c>=0?c:u}n.length&&o!==void 0&&(a=[s,o])}return a},"range");var dC="\0SLASH"+Math.random()+"\0",pC="\0OPEN"+Math.random()+"\0",XS="\0CLOSE"+Math.random()+"\0",fC="\0COMMA"+Math.random()+"\0",hC="\0PERIOD"+Math.random()+"\0",foe=new RegExp(dC,"g"),hoe=new RegExp(pC,"g"),moe=new RegExp(XS,"g"),goe=new RegExp(fC,"g"),yoe=new RegExp(hC,"g"),voe=/\\\\/g,woe=/\\{/g,boe=/\\}/g,xoe=/\\,/g,Eoe=/\\\./g,Soe=1e5,koe=4e6;function YS(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(YS,"numeric");function Aoe(e){return e.replace(voe,dC).replace(woe,pC).replace(boe,XS).replace(xoe,fC).replace(Eoe,hC)}l(Aoe,"escapeBraces");function $oe(e){return e.replace(foe,"\\").replace(hoe,"{").replace(moe,"}").replace(goe,",").replace(yoe,".")}l($oe,"unescapeBraces");function mC(e){if(!e)return[""];let t=[],r=KS("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=mC(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}l(mC,"parseCommaParts");function gC(e,t={}){if(!e)return[];let{max:r=Soe,maxLength:n=koe}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),JS(Aoe(e),r,n,!0).map($oe)}l(gC,"expand");function Ioe(e){return"{"+e+"}"}l(Ioe,"embrace");function _oe(e){return/^-?0\d/.test(e)}l(_oe,"isPadded");function Toe(e,t){return e<=t}l(Toe,"lte");function Ooe(e,t){return e>=t}l(Ooe,"gte");function Dd(e,t,r,n,i,s){let o=[],a=0;for(let c=0;c<e.length;c++)for(let u=0;u<r.length;u++){if(o.length>=n)return o;let d=e[c]+t+r[u];if(!(s&&!d)){if(a+d.length>i)return o;o.push(d),a+=d.length}}return o}l(Dd,"combine");function Coe(e,t,r,n){let i=e.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=YS(i[0]),a=YS(i[1]),c=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(YS(i[2])),1):1,d=Toe;a<o&&(u*=-1,d=Ooe);let f=i.some(_oe),h=0;for(let m=o;d(m,a)&&s.length<r;m+=u){let g;if(t)g=String.fromCharCode(m),g==="\\"&&(g="");else if(g=String(m),f){let y=c-g.length;if(y>0){let b=new Array(y+1).join("0");m<0?g="-"+b+g.slice(1):g=b+g}}if(h+g.length>n)break;s.push(g),h+=g.length}return s}l(Coe,"expandSequence");function JS(e,t,r,n){let i=[""],s=!1,o=!0;for(;;){let a=KS("{","}",e);if(!a)return Dd(i,e,[""],t,r,s);let c=a.pre;if(/\$$/.test(c)){if(i=Dd(i,c+"{"+a.body+"}",[""],t,r,s&&!a.post.length),o=!1,!a.post.length)break;e=a.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),p=u||d,f=a.body.indexOf(",")>=0;if(!p&&!f){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+XS+a.post,n=!0;continue}return Dd(i,c+"{"+a.body+"}"+a.post,[""],t,r,s)}o&&(s=n&&!p,o=!1);let h;if(p)h=Coe(a.body,d,t,r);else{let m=mC(a.body);if(m.length===1&&m[0]!==void 0&&(m=JS(m[0],t,r,!1).map(Ioe),m.length===1)){if(i=Dd(i,c+m[0],[""],t,r,s&&!a.post.length),!a.post.length)break;e=a.post;continue}let g=s&&!a.post.length&&!c;for(let b=0;g&&b<i.length;b++)i[b]&&(g=!1);h=[];let y=0;e:for(let b=0;b<m.length;b++){let w=JS(m[b],t,r,!1);for(let x=0;x<w.length;x++){let k=w[x];if(!(g&&!k)){if(h.length>=t||y+k.length>r)break e;h.push(k),y+=k.length}}}}if(i=Dd(i,c,h,t,r,s&&!a.post.length),!a.post.length)break;e=a.post}return i}l(JS,"expand_");var Ld=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Noe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Md=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Roe=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),yC=l(e=>e.join(""),"rangesToString"),vC=l((e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,u=!1,d=r,p="";e:for(;s<e.length;){let g=e.charAt(s);if((g==="!"||g==="^")&&s===r+1){u=!0,s++;continue}if(g==="]"&&o&&!c){d=s+1;break}if(o=!0,g==="\\"&&!c){c=!0,s++;continue}if(g==="["&&!c){for(let[y,[b,w,x]]of Object.entries(Noe))if(e.startsWith(y,s)){if(p)return["$.",!1,e.length-r,!0];s+=y.length,x?i.push(b):n.push(b),a=a||w;continue e}}if(c=!1,p){g>p?n.push(Md(p)+"-"+Md(g)):g===p&&n.push(Md(g)),p="",s++;continue}if(e.startsWith("-]",s+1)){n.push(Md(g+"-")),s+=2;continue}if(e.startsWith("-",s+1)){p=g,s+=2;continue}n.push(Md(g)),s++}if(d<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let g=n[0].length===2?n[0].slice(-1):n[0];return[Roe(g),!1,d-r,!1]}let f="["+(u?"^":"")+yC(n)+"]",h="["+(u?"":"^")+yC(i)+"]";return[n.length&&i.length?"("+f+"|"+h+")":n.length?f:h,a,d-r,!0]},"parseClass");var jo=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var Ln,Poe=new Set(["!","?","+","*","@"]),QS=l(e=>Poe.has(e),"isExtglobType"),wC=l(e=>QS(e.type),"isExtglobAST"),Doe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Loe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Moe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),bC=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Foe="(?!(?:^|/)\\.\\.?(?:$|/))",Km="(?!\\.)",joe=new Set(["[","."]),zoe=new Set(["..","."]),Uoe=new Set("().*{}+?[]^$\\!"),Boe=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),e6="[^/]",xC=e6+"*?",EC=e6+"+?",Woe=0,La=class{static{l(this,"AST")}type;#e;#r;#n=!1;#t=[];#i;#s;#a;#u=!1;#l;#o;#c=!1;id=++Woe;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#i=r,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?n:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,t==="!"&&!this.#e.#u&&this.#a.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#a.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let i=r.#s+1;!n.type&&i<n.#t.length;i++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof Ln&&r.#i===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let t=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let r=0;r<this.#s;r++){let n=t.#t[r];if(!(n instanceof Ln&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new Ln(this.type,t);for(let n of this.#t)r.copyIn(n);return r}static#h(t,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,u=-1,d=!1;if(r.type===null){let g=n,y="";for(;g<t.length;){let b=t.charAt(g++);if(a||b==="\\"){a=!a,y+=b;continue}if(c){g===u+1?(b==="^"||b==="!")&&(d=!0):b==="]"&&!(g===u+2&&d)&&(c=!1),y+=b;continue}else if(b==="["){c=!0,u=g,d=!1,y+=b;continue}if(!i.noext&&QS(b)&&t.charAt(g)==="("&&s<=o){r.push(y),y="";let x=new Ln(b,r);g=Ln.#h(t,x,g,i,s+1),r.push(x);continue}y+=b}return r.push(y),g}let p=n+1,f=new Ln(null,r),h=[],m="";for(;p<t.length;){let g=t.charAt(p++);if(a||g==="\\"){a=!a,m+=g;continue}if(c){p===u+1?(g==="^"||g==="!")&&(d=!0):g==="]"&&!(p===u+2&&d)&&(c=!1),m+=g;continue}else if(g==="["){c=!0,u=p,d=!1,m+=g;continue}if(!i.noext&&QS(g)&&t.charAt(p)==="("&&(s<=o||r&&r.#g(g))){let b=r&&r.#g(g)?0:1;f.push(m),m="";let w=new Ln(g,f);f.push(w),p=Ln.#h(t,w,p,i,s+b);continue}if(g==="|"){f.push(m),m="",h.push(f),f=new Ln(null,r);continue}if(g===")")return m===""&&r.#t.length===0&&(r.#c=!0),f.push(m),m="",r.push(...h,f),p;m+=g}return r.type=null,r.#r=void 0,r.#t=[t.substring(n-1)],p}#O(t){return this.#m(t,Loe)}#m(t,r=Doe){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type,r)}#g(t,r=Moe){return!!r.get(this.type)?.includes(t)}#p(t,r){let n=t.#t[0],i=new Ln(null,n,this.options);i.#t.push(""),n.push(i),this.#E(t,r)}#E(t,r){let n=t.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#i=this);this.#o=void 0}#S(t){return!!bC.get(this.type)?.has(t)}#C(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#S(r.type)}#y(t){let r=bC.get(this.type),n=t.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=i,this.#o=void 0,this.#c=!1}static fromGlob(t,r={}){let n=new Ln(null,void 0,r);return Ln.#h(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#l}toRegExpSource(t){let r=t??!!this.#l.dot;if(this.#e===this&&(this.#f(),this.#x()),!wC(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[m,g,y,b]=typeof h=="string"?Ln.#k(h,this.#r,c):h.toRegExpSource(t);return this.#r=this.#r||y,this.#n=this.#n||b,m}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&zoe.has(this.#t[0]))){let m=joe,g=r&&m.has(u.charAt(0))||u.startsWith("\\.")&&m.has(u.charAt(2))||u.startsWith("\\.\\.")&&m.has(u.charAt(4)),y=!r&&!t&&m.has(u.charAt(0));d=g?Foe:y?Km:""}let p="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(p="(?:$|\\/)"),[d+u+p,jo(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#r=void 0,[c,jo(this.toString()),!1,!1]}let o=!n||t||r||!Km?"":this.#v(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!r?Km:"")+EC;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Km:"")+xC+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,jo(s),this.#r=!!this.#r,this.#n]}#f(){if(wC(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#f(),this.#m(i)?(r=!1,this.#E(i,n)):this.#O(i)?(r=!1,this.#p(i,n)):this.#C(i)&&(r=!1,this.#y(i)))}}while(!r&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#f();this.#o=void 0}#v(t){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(t);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#k(t,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(i){i=!1,s+=(Uoe.has(u)?"\\":"")+u;continue}if(u==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(t)?EC:xC,r=!0;continue}else a=!1;if(u==="\\"){c===t.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[d,p,f,h]=vC(t,c);if(f){s+=d,o=o||p,c+=f-1,r=r||h;continue}}if(u==="?"){s+=e6,r=!0;continue}s+=Boe(u)}return[s,jo(t),!!r,o]}};Ln=La;var t6=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Gr=l((e,t,r={})=>(Ld(t),!r.nocomment&&t.charAt(0)==="#"?!1:new pc(t,r).match(e)),"minimatch"),qoe=/^\*+([^+@!?*[(]*)$/,Hoe=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),Goe=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),Voe=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),Zoe=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),Koe=/^\*+\.\*+$/,Yoe=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),Joe=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),Xoe=/^\.\*+$/,Qoe=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),eae=/^\*+$/,tae=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),rae=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),nae=/^\?+([^+@!?*[(]*)?$/,iae=l(([e,t=""])=>{let r=AC([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocase"),sae=l(([e,t=""])=>{let r=$C([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocaseDot"),oae=l(([e,t=""])=>{let r=$C([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTestDot"),aae=l(([e,t=""])=>{let r=AC([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTest"),AC=l(([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},"qmarksTestNoExt"),$C=l(([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},"qmarksTestNoExtDot"),IC=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",SC={win32:{sep:"\\"},posix:{sep:"/"}},lae=IC==="win32"?SC.win32.sep:SC.posix.sep;Gr.sep=lae;var pn=Symbol("globstar **");Gr.GLOBSTAR=pn;var cae="[^/]",uae=cae+"*?",dae="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",pae="(?:(?!(?:\\/|^)\\.).)*?",fae=l((e,t={})=>r=>Gr(r,e,t),"filter");Gr.filter=fae;var pi=l((e,t={})=>Object.assign({},e,t),"ext"),hae=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Gr;let t=Gr;return Object.assign(l((n,i,s={})=>t(n,i,pi(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(i,s={}){super(i,pi(e,s))}static defaults(i){return t.defaults(pi(e,i)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(i,s,o={}){super(i,s,pi(e,o))}static fromGlob(i,s={}){return t.AST.fromGlob(i,pi(e,s))}},unescape:l((n,i={})=>t.unescape(n,pi(e,i)),"unescape"),escape:l((n,i={})=>t.escape(n,pi(e,i)),"escape"),filter:l((n,i={})=>t.filter(n,pi(e,i)),"filter"),defaults:l(n=>t.defaults(pi(e,n)),"defaults"),makeRe:l((n,i={})=>t.makeRe(n,pi(e,i)),"makeRe"),braceExpand:l((n,i={})=>t.braceExpand(n,pi(e,i)),"braceExpand"),match:l((n,i,s={})=>t.match(n,i,pi(e,s)),"match"),sep:t.sep,GLOBSTAR:pn})},"defaults");Gr.defaults=hae;var _C=l((e,t={})=>(Ld(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:gC(e,{max:t.braceExpandMax})),"braceExpand");Gr.braceExpand=_C;var mae=l((e,t={})=>new pc(e,t).makeRe(),"makeRe");Gr.makeRe=mae;var gae=l((e,t,r={})=>{let n=new pc(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e},"match");Gr.match=gae;var kC=/[?*]|[+@!]\(.*?\)|\[|\]/,yae=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),pc=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){Ld(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||IC,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!kC.test(s[2]))&&!kC.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],u=n[i+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(i,1);let d=n.slice(0);d[i]="**",t.push(d),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(i){t[r]=[],t[n]=i;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,s=0,o=[],a="";for(;i<t.length&&s<r.length;)if(t[i]===r[s])o.push(a==="b"?r[s]:t[i]),i++,s++;else if(n&&t[i]==="**"&&r[s]===t[i+1])o.push(t[i]),i++;else if(n&&r[s]==="**"&&t[i]===r[s+1])o.push(r[s]),s++;else if(t[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(t[i]),i++,s++}else if(r[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return t.length===r.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),d=!u&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),p=c?3:a?0:void 0,f=d?3:u?0:void 0;if(typeof p=="number"&&typeof f=="number"){let[h,m]=[t[p],r[f]];h.toLowerCase()===m.toLowerCase()&&(r[f]=h,s=f,i=p)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(pn)?this.#e(t,r,n,i,s):this.#n(t,r,n,i,s)}#e(t,r,n,i,s){let o=r.indexOf(pn,s),a=r.lastIndexOf(pn),[c,u,d]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(c.length){let w=t.slice(i,i+c.length);if(!this.#n(w,c,n,0,0))return!1;i+=c.length,s+=c.length}let p=0;if(d.length){if(d.length+i>t.length)return!1;let w=t.length-d.length;if(this.#n(t,d,n,w,0))p=d.length;else{if(t[t.length-1]!==""||i+d.length===t.length||(w--,!this.#n(t,d,n,w,0)))return!1;p=d.length+1}}if(!u.length){let w=!!p;for(let x=i;x<t.length-p;x++){let k=String(t[x]);if(w=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return n||w}let f=[[[],0]],h=f[0],m=0,g=[0];for(let w of u)w===pn?(g.push(m),h=[[],0],f.push(h)):(h[0].push(w),m++);let y=f.length-1,b=t.length-p;for(let w of f)w[1]=b-(g[y--]+w[0].length);return!!this.#r(t,f,i,0,n,0,!!p)}#r(t,r,n,i,s,o,a){let c=r[i];if(!c){for(let p=n;p<t.length;p++){a=!0;let f=t[p];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[u,d]=c;for(;n<=d;){if(this.#n(t.slice(0,n+u.length),u,s,n,0)&&o<this.maxGlobstarRecursion){let h=this.#r(t,r,n+u.length,i+1,s,o+1,a);if(h!==!1)return h}let f=t[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#n(t,r,n,i,s){let o,a,c,u;for(o=i,a=s,u=t.length,c=r.length;o<u&&a<c;o++,a++){this.debug("matchOne loop");let d=r[a],p=t[o];if(this.debug(r,d,p),d===!1||d===pn)return!1;let f;if(typeof d=="string"?(f=p===d,this.debug("string match",d,p,f)):(f=d.test(p),this.debug("pattern match",d,p,f)),!f)return!1}if(o===u&&a===c)return!0;if(o===u)return n;if(a===c)return o===u-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return _C(this.pattern,this.options)}parse(t){Ld(t);let r=this.options;if(t==="**")return pn;if(t==="")return"";let n,i=null;(n=t.match(eae))?i=r.dot?rae:tae:(n=t.match(qoe))?i=(r.nocase?r.dot?Zoe:Voe:r.dot?Goe:Hoe)(n[1]):(n=t.match(nae))?i=(r.nocase?r.dot?sae:iae:r.dot?oae:aae)(n):(n=t.match(Koe))?i=r.dot?Joe:Yoe:(n=t.match(Xoe))&&(i=Qoe);let s=La.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?uae:r.dot?dae:pae,i=new Set(r.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(p=>{if(p instanceof RegExp)for(let f of p.flags.split(""))i.add(f);return typeof p=="string"?yae(p):p===pn?pn:p._src});u.forEach((p,f)=>{let h=u[f+1],m=u[f-1];p!==pn||m===pn||(m===void 0?h!==void 0&&h!==pn?u[f+1]="(?:\\/|"+n+"\\/)?"+h:u[f]=n:h===void 0?u[f-1]=m+"(?:\\/|\\/"+n+")?":h!==pn&&(u[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+h,u[f+1]=pn))});let d=u.filter(p=>p!==pn);if(this.partial&&d.length>=1){let p=[];for(let f=1;f<=d.length;f++)p.push(d.slice(0,f).join("/"));return"(?:"+p.join("|")+")"}return d.join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].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,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let c=i;if(n.matchBase&&a.length===1&&(c=[o]),this.matchOne(c,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Gr.defaults(t).Minimatch}};Gr.AST=La;Gr.Minimatch=pc;Gr.escape=t6;Gr.unescape=jo;import{gunzipSync as yce}from"node:zlib";var Fd=class{static{l(this,"Diff")}diff(t,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(t,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,i)}diffWithOptionsObj(t,r,n,i){var s;let o=l(w=>{if(w=this.postProcess(w,n),i){setTimeout(function(){i(w)},0);return}else return w},"done"),a=r.length,c=t.length,u=1,d=a+c;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));let p=(s=n.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+p,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,t,0,n);if(h[0].oldPos+1>=c&&m+1>=a)return o(this.buildValues(h[0].lastComponent,r,t));let g=-1/0,y=1/0,b=l(()=>{for(let w=Math.max(g,-u);w<=Math.min(y,u);w+=2){let x,k=h[w-1],S=h[w+1];k&&(h[w-1]=void 0);let A=!1;if(S){let C=S.oldPos-w;A=S&&0<=C&&C<a}let I=k&&k.oldPos+1<c;if(!A&&!I){h[w]=void 0;continue}if(!I||A&&k.oldPos<S.oldPos?x=this.addToPath(S,!0,!1,0,n):x=this.addToPath(k,!1,!0,1,n),m=this.extractCommon(x,r,t,w,n),x.oldPos+1>=c&&m+1>=a)return o(this.buildValues(x.lastComponent,r,t))||!0;h[w]=x,x.oldPos+1>=c&&(y=Math.min(y,w-1)),m+1>=a&&(g=Math.max(g,w+1))}u++},"execEditLength");if(i)l(function w(){setTimeout(function(){if(u>d||Date.now()>f)return i(void 0);b()||w()},0)},"exec")();else for(;u<=d&&Date.now()<=f;){let w=b();if(w)return w}}addToPath(t,r,n,i,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(t,r,n,i,s){let o=r.length,a=n.length,c=t.oldPos,u=c-i,d=0;for(;u+1<o&&c+1<a&&this.equals(n[c+1],r[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,r,n){return n.comparator?n.comparator(t,r):t===r||!!n.ignoreCase&&t.toLowerCase()===r.toLowerCase()}removeEmpty(t){let r=[];for(let n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r}castInput(t,r){return t}tokenize(t,r){return Array.from(t)}join(t){return t.join("")}postProcess(t,r){return t}get useLongestToken(){return!1}buildValues(t,r,n){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let o=i.length,a=0,c=0,u=0;for(;a<o;a++){let d=i[a];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=r.slice(c,c+d.count);p=p.map(function(f,h){let m=n[u+h];return m.length>f.length?m:f}),d.value=this.join(p)}else d.value=this.join(r.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return i}};var r6=class extends Fd{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=wae}equals(t,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!t.includes(`
676
+ `}l(oC,"pageStyles");var VS={name:"dsh-edge",version:"0.2.0-alpha.2",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.0-rc.7"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.0-rc.7","@deepseek-ai/dsh-agent-loop":"0.1.0-rc.7","@deepseek-ai/dsh-anonymous-user-id":"0.1.0-rc.7","@deepseek-ai/dsh-brand":"0.1.0-rc.7","@deepseek-ai/dsh-credentials":"0.1.0-rc.7","@deepseek-ai/dsh-host-apiproxy":"0.1.0-rc.7","@deepseek-ai/dsh-launch-environment":"0.1.0-rc.7","@deepseek-ai/dsh-llm":"0.1.0-rc.7","@deepseek-ai/dsh-llm-deepseek":"0.1.0-rc.7","@deepseek-ai/dsh-session":"0.1.0-rc.7","@deepseek-ai/dsh-session-persistence":"0.1.0-rc.7","@deepseek-ai/dsh-session-query":"0.1.0-rc.7","@deepseek-ai/dsh-session-title":"0.1.0-rc.7","@deepseek-ai/dsh-settings":"0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"0.1.0-rc.7","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.0-rc.7","@deepseek-ai/dsh-tool-web":"0.1.0-rc.7","@deepseek-ai/dsh-tools":"0.1.0-rc.7","@deepseek-ai/dsh-web":"0.1.0-rc.7","@deepseek-ai/dsh-web-search-deepseek":"0.1.0-rc.7","just-bash":"3.3.0",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var Gm=VS.version,aC=VS.dshEdge.upstreamVersion;function coe(){return"dsh-edge@0.2.0-alpha.2/direct"}l(coe,"resolveEdgeDeploymentId");function Vm(e){return HO(e.DEEPSEEK_API_KEY),{baseURL:cS(e.DEEPSEEK_BASE_URL),maxTokens:pS(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Id(e.DEEPSEEK_MODEL),reasoningEffort:uS(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:Dm(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dS(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Cd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Vm,"resolveEdgeDeploymentConfig");function uoe(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(uoe,"edgeDeploymentApiKeyConfigured");function doe(e){let t=cS(e),r=new URL(t);return r.search.length===0&&r.hash.length===0?t:(r.search="",r.hash="",r.href)}l(doe,"projectedEdgeBaseURL");function ZS(e){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",deploymentId:coe(),apiKeyConfigured:uoe(e),baseURL:doe(e.DEEPSEEK_BASE_URL),maxTokens:pS(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Id(e.DEEPSEEK_MODEL),reasoningEffort:uS(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:Dm(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:dS(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Cd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(ZS,"resolveEdgeDeploymentProfile");function lC(e){Vm(e);let t=ZS(e);return{ok:!0,service:"dsh-edge",storage:t.storage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:Gm,upstreamVersion:aC,status:"ready"}}l(lC,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as dCe}from"cloudflare:workers";var fl=u7(cC());var KS=l((e,t,r)=>{let n=e instanceof RegExp?uC(e,r):e,i=t instanceof RegExp?uC(t,r):t,s=n!==null&&i!=null&&poe(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},"balanced"),uC=l((e,t)=>{let r=t.match(e);return r?r[0]:null},"maybeMatch"),poe=l((e,t,r)=>{let n,i,s,o,a,c=r.indexOf(e),u=r.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(n=[],s=r.length;d>=0&&!a;){if(d===c)n.push(d),c=r.indexOf(e,d+1);else if(n.length===1){let p=n.pop();p!==void 0&&(a=[p,u])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=u),u=r.indexOf(t,d+1);d=c<u&&c>=0?c:u}n.length&&o!==void 0&&(a=[s,o])}return a},"range");var dC="\0SLASH"+Math.random()+"\0",pC="\0OPEN"+Math.random()+"\0",XS="\0CLOSE"+Math.random()+"\0",fC="\0COMMA"+Math.random()+"\0",hC="\0PERIOD"+Math.random()+"\0",foe=new RegExp(dC,"g"),hoe=new RegExp(pC,"g"),moe=new RegExp(XS,"g"),goe=new RegExp(fC,"g"),yoe=new RegExp(hC,"g"),voe=/\\\\/g,woe=/\\{/g,boe=/\\}/g,xoe=/\\,/g,Eoe=/\\\./g,Soe=1e5,koe=4e6;function YS(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(YS,"numeric");function Aoe(e){return e.replace(voe,dC).replace(woe,pC).replace(boe,XS).replace(xoe,fC).replace(Eoe,hC)}l(Aoe,"escapeBraces");function $oe(e){return e.replace(foe,"\\").replace(hoe,"{").replace(moe,"}").replace(goe,",").replace(yoe,".")}l($oe,"unescapeBraces");function mC(e){if(!e)return[""];let t=[],r=KS("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=mC(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}l(mC,"parseCommaParts");function gC(e,t={}){if(!e)return[];let{max:r=Soe,maxLength:n=koe}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),JS(Aoe(e),r,n,!0).map($oe)}l(gC,"expand");function Ioe(e){return"{"+e+"}"}l(Ioe,"embrace");function _oe(e){return/^-?0\d/.test(e)}l(_oe,"isPadded");function Toe(e,t){return e<=t}l(Toe,"lte");function Ooe(e,t){return e>=t}l(Ooe,"gte");function Dd(e,t,r,n,i,s){let o=[],a=0;for(let c=0;c<e.length;c++)for(let u=0;u<r.length;u++){if(o.length>=n)return o;let d=e[c]+t+r[u];if(!(s&&!d)){if(a+d.length>i)return o;o.push(d),a+=d.length}}return o}l(Dd,"combine");function Coe(e,t,r,n){let i=e.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=YS(i[0]),a=YS(i[1]),c=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(YS(i[2])),1):1,d=Toe;a<o&&(u*=-1,d=Ooe);let f=i.some(_oe),h=0;for(let m=o;d(m,a)&&s.length<r;m+=u){let g;if(t)g=String.fromCharCode(m),g==="\\"&&(g="");else if(g=String(m),f){let y=c-g.length;if(y>0){let b=new Array(y+1).join("0");m<0?g="-"+b+g.slice(1):g=b+g}}if(h+g.length>n)break;s.push(g),h+=g.length}return s}l(Coe,"expandSequence");function JS(e,t,r,n){let i=[""],s=!1,o=!0;for(;;){let a=KS("{","}",e);if(!a)return Dd(i,e,[""],t,r,s);let c=a.pre;if(/\$$/.test(c)){if(i=Dd(i,c+"{"+a.body+"}",[""],t,r,s&&!a.post.length),o=!1,!a.post.length)break;e=a.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),p=u||d,f=a.body.indexOf(",")>=0;if(!p&&!f){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+XS+a.post,n=!0;continue}return Dd(i,c+"{"+a.body+"}"+a.post,[""],t,r,s)}o&&(s=n&&!p,o=!1);let h;if(p)h=Coe(a.body,d,t,r);else{let m=mC(a.body);if(m.length===1&&m[0]!==void 0&&(m=JS(m[0],t,r,!1).map(Ioe),m.length===1)){if(i=Dd(i,c+m[0],[""],t,r,s&&!a.post.length),!a.post.length)break;e=a.post;continue}let g=s&&!a.post.length&&!c;for(let b=0;g&&b<i.length;b++)i[b]&&(g=!1);h=[];let y=0;e:for(let b=0;b<m.length;b++){let w=JS(m[b],t,r,!1);for(let x=0;x<w.length;x++){let k=w[x];if(!(g&&!k)){if(h.length>=t||y+k.length>r)break e;h.push(k),y+=k.length}}}}if(i=Dd(i,c,h,t,r,s&&!a.post.length),!a.post.length)break;e=a.post}return i}l(JS,"expand_");var Ld=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Noe={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Md=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Roe=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),yC=l(e=>e.join(""),"rangesToString"),vC=l((e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,u=!1,d=r,p="";e:for(;s<e.length;){let g=e.charAt(s);if((g==="!"||g==="^")&&s===r+1){u=!0,s++;continue}if(g==="]"&&o&&!c){d=s+1;break}if(o=!0,g==="\\"&&!c){c=!0,s++;continue}if(g==="["&&!c){for(let[y,[b,w,x]]of Object.entries(Noe))if(e.startsWith(y,s)){if(p)return["$.",!1,e.length-r,!0];s+=y.length,x?i.push(b):n.push(b),a=a||w;continue e}}if(c=!1,p){g>p?n.push(Md(p)+"-"+Md(g)):g===p&&n.push(Md(g)),p="",s++;continue}if(e.startsWith("-]",s+1)){n.push(Md(g+"-")),s+=2;continue}if(e.startsWith("-",s+1)){p=g,s+=2;continue}n.push(Md(g)),s++}if(d<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let g=n[0].length===2?n[0].slice(-1):n[0];return[Roe(g),!1,d-r,!1]}let f="["+(u?"^":"")+yC(n)+"]",h="["+(u?"":"^")+yC(i)+"]";return[n.length&&i.length?"("+f+"|"+h+")":n.length?f:h,a,d-r,!0]},"parseClass");var jo=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var Ln,Poe=new Set(["!","?","+","*","@"]),QS=l(e=>Poe.has(e),"isExtglobType"),wC=l(e=>QS(e.type),"isExtglobAST"),Doe=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Loe=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Moe=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),bC=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Foe="(?!(?:^|/)\\.\\.?(?:$|/))",Km="(?!\\.)",joe=new Set(["[","."]),zoe=new Set(["..","."]),Uoe=new Set("().*{}+?[]^$\\!"),Boe=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),e6="[^/]",xC=e6+"*?",EC=e6+"+?",Woe=0,La=class{static{l(this,"AST")}type;#e;#r;#n=!1;#t=[];#i;#s;#a;#u=!1;#l;#o;#c=!1;id=++Woe;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#i=r,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?n:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,t==="!"&&!this.#e.#u&&this.#a.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#a.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let i=r.#s+1;!n.type&&i<n.#t.length;i++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof Ln&&r.#i===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let t=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let r=0;r<this.#s;r++){let n=t.#t[r];if(!(n instanceof Ln&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new Ln(this.type,t);for(let n of this.#t)r.copyIn(n);return r}static#h(t,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,u=-1,d=!1;if(r.type===null){let g=n,y="";for(;g<t.length;){let b=t.charAt(g++);if(a||b==="\\"){a=!a,y+=b;continue}if(c){g===u+1?(b==="^"||b==="!")&&(d=!0):b==="]"&&!(g===u+2&&d)&&(c=!1),y+=b;continue}else if(b==="["){c=!0,u=g,d=!1,y+=b;continue}if(!i.noext&&QS(b)&&t.charAt(g)==="("&&s<=o){r.push(y),y="";let x=new Ln(b,r);g=Ln.#h(t,x,g,i,s+1),r.push(x);continue}y+=b}return r.push(y),g}let p=n+1,f=new Ln(null,r),h=[],m="";for(;p<t.length;){let g=t.charAt(p++);if(a||g==="\\"){a=!a,m+=g;continue}if(c){p===u+1?(g==="^"||g==="!")&&(d=!0):g==="]"&&!(p===u+2&&d)&&(c=!1),m+=g;continue}else if(g==="["){c=!0,u=p,d=!1,m+=g;continue}if(!i.noext&&QS(g)&&t.charAt(p)==="("&&(s<=o||r&&r.#g(g))){let b=r&&r.#g(g)?0:1;f.push(m),m="";let w=new Ln(g,f);f.push(w),p=Ln.#h(t,w,p,i,s+b);continue}if(g==="|"){f.push(m),m="",h.push(f),f=new Ln(null,r);continue}if(g===")")return m===""&&r.#t.length===0&&(r.#c=!0),f.push(m),m="",r.push(...h,f),p;m+=g}return r.type=null,r.#r=void 0,r.#t=[t.substring(n-1)],p}#O(t){return this.#m(t,Loe)}#m(t,r=Doe){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type,r)}#g(t,r=Moe){return!!r.get(this.type)?.includes(t)}#p(t,r){let n=t.#t[0],i=new Ln(null,n,this.options);i.#t.push(""),n.push(i),this.#E(t,r)}#E(t,r){let n=t.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#i=this);this.#o=void 0}#S(t){return!!bC.get(this.type)?.has(t)}#C(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#S(r.type)}#y(t){let r=bC.get(this.type),n=t.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=i,this.#o=void 0,this.#c=!1}static fromGlob(t,r={}){let n=new Ln(null,void 0,r);return Ln.#h(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#l}toRegExpSource(t){let r=t??!!this.#l.dot;if(this.#e===this&&(this.#f(),this.#x()),!wC(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[m,g,y,b]=typeof h=="string"?Ln.#k(h,this.#r,c):h.toRegExpSource(t);return this.#r=this.#r||y,this.#n=this.#n||b,m}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&zoe.has(this.#t[0]))){let m=joe,g=r&&m.has(u.charAt(0))||u.startsWith("\\.")&&m.has(u.charAt(2))||u.startsWith("\\.\\.")&&m.has(u.charAt(4)),y=!r&&!t&&m.has(u.charAt(0));d=g?Foe:y?Km:""}let p="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(p="(?:$|\\/)"),[d+u+p,jo(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#r=void 0,[c,jo(this.toString()),!1,!1]}let o=!n||t||r||!Km?"":this.#v(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!r?Km:"")+EC;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Km:"")+xC+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,jo(s),this.#r=!!this.#r,this.#n]}#f(){if(wC(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#f(),this.#m(i)?(r=!1,this.#E(i,n)):this.#O(i)?(r=!1,this.#p(i,n)):this.#C(i)&&(r=!1,this.#y(i)))}}while(!r&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#f();this.#o=void 0}#v(t){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(t);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#k(t,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(i){i=!1,s+=(Uoe.has(u)?"\\":"")+u;continue}if(u==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(t)?EC:xC,r=!0;continue}else a=!1;if(u==="\\"){c===t.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[d,p,f,h]=vC(t,c);if(f){s+=d,o=o||p,c+=f-1,r=r||h;continue}}if(u==="?"){s+=e6,r=!0;continue}s+=Boe(u)}return[s,jo(t),!!r,o]}};Ln=La;var t6=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Gr=l((e,t,r={})=>(Ld(t),!r.nocomment&&t.charAt(0)==="#"?!1:new pc(t,r).match(e)),"minimatch"),qoe=/^\*+([^+@!?*[(]*)$/,Hoe=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),Goe=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),Voe=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),Zoe=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),Koe=/^\*+\.\*+$/,Yoe=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),Joe=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),Xoe=/^\.\*+$/,Qoe=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),eae=/^\*+$/,tae=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),rae=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),nae=/^\?+([^+@!?*[(]*)?$/,iae=l(([e,t=""])=>{let r=AC([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocase"),sae=l(([e,t=""])=>{let r=$C([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocaseDot"),oae=l(([e,t=""])=>{let r=$C([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTestDot"),aae=l(([e,t=""])=>{let r=AC([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTest"),AC=l(([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},"qmarksTestNoExt"),$C=l(([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},"qmarksTestNoExtDot"),IC=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",SC={win32:{sep:"\\"},posix:{sep:"/"}},lae=IC==="win32"?SC.win32.sep:SC.posix.sep;Gr.sep=lae;var pn=Symbol("globstar **");Gr.GLOBSTAR=pn;var cae="[^/]",uae=cae+"*?",dae="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",pae="(?:(?!(?:\\/|^)\\.).)*?",fae=l((e,t={})=>r=>Gr(r,e,t),"filter");Gr.filter=fae;var pi=l((e,t={})=>Object.assign({},e,t),"ext"),hae=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Gr;let t=Gr;return Object.assign(l((n,i,s={})=>t(n,i,pi(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(i,s={}){super(i,pi(e,s))}static defaults(i){return t.defaults(pi(e,i)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(i,s,o={}){super(i,s,pi(e,o))}static fromGlob(i,s={}){return t.AST.fromGlob(i,pi(e,s))}},unescape:l((n,i={})=>t.unescape(n,pi(e,i)),"unescape"),escape:l((n,i={})=>t.escape(n,pi(e,i)),"escape"),filter:l((n,i={})=>t.filter(n,pi(e,i)),"filter"),defaults:l(n=>t.defaults(pi(e,n)),"defaults"),makeRe:l((n,i={})=>t.makeRe(n,pi(e,i)),"makeRe"),braceExpand:l((n,i={})=>t.braceExpand(n,pi(e,i)),"braceExpand"),match:l((n,i,s={})=>t.match(n,i,pi(e,s)),"match"),sep:t.sep,GLOBSTAR:pn})},"defaults");Gr.defaults=hae;var _C=l((e,t={})=>(Ld(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:gC(e,{max:t.braceExpandMax})),"braceExpand");Gr.braceExpand=_C;var mae=l((e,t={})=>new pc(e,t).makeRe(),"makeRe");Gr.makeRe=mae;var gae=l((e,t,r={})=>{let n=new pc(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e},"match");Gr.match=gae;var kC=/[?*]|[+@!]\(.*?\)|\[|\]/,yae=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),pc=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){Ld(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||IC,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!kC.test(s[2]))&&!kC.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],u=n[i+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(i,1);let d=n.slice(0);d[i]="**",t.push(d),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(i){t[r]=[],t[n]=i;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,s=0,o=[],a="";for(;i<t.length&&s<r.length;)if(t[i]===r[s])o.push(a==="b"?r[s]:t[i]),i++,s++;else if(n&&t[i]==="**"&&r[s]===t[i+1])o.push(t[i]),i++;else if(n&&r[s]==="**"&&t[i]===r[s+1])o.push(r[s]),s++;else if(t[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(t[i]),i++,s++}else if(r[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return t.length===r.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),d=!u&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),p=c?3:a?0:void 0,f=d?3:u?0:void 0;if(typeof p=="number"&&typeof f=="number"){let[h,m]=[t[p],r[f]];h.toLowerCase()===m.toLowerCase()&&(r[f]=h,s=f,i=p)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(pn)?this.#e(t,r,n,i,s):this.#n(t,r,n,i,s)}#e(t,r,n,i,s){let o=r.indexOf(pn,s),a=r.lastIndexOf(pn),[c,u,d]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(c.length){let w=t.slice(i,i+c.length);if(!this.#n(w,c,n,0,0))return!1;i+=c.length,s+=c.length}let p=0;if(d.length){if(d.length+i>t.length)return!1;let w=t.length-d.length;if(this.#n(t,d,n,w,0))p=d.length;else{if(t[t.length-1]!==""||i+d.length===t.length||(w--,!this.#n(t,d,n,w,0)))return!1;p=d.length+1}}if(!u.length){let w=!!p;for(let x=i;x<t.length-p;x++){let k=String(t[x]);if(w=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return n||w}let f=[[[],0]],h=f[0],m=0,g=[0];for(let w of u)w===pn?(g.push(m),h=[[],0],f.push(h)):(h[0].push(w),m++);let y=f.length-1,b=t.length-p;for(let w of f)w[1]=b-(g[y--]+w[0].length);return!!this.#r(t,f,i,0,n,0,!!p)}#r(t,r,n,i,s,o,a){let c=r[i];if(!c){for(let p=n;p<t.length;p++){a=!0;let f=t[p];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[u,d]=c;for(;n<=d;){if(this.#n(t.slice(0,n+u.length),u,s,n,0)&&o<this.maxGlobstarRecursion){let h=this.#r(t,r,n+u.length,i+1,s,o+1,a);if(h!==!1)return h}let f=t[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#n(t,r,n,i,s){let o,a,c,u;for(o=i,a=s,u=t.length,c=r.length;o<u&&a<c;o++,a++){this.debug("matchOne loop");let d=r[a],p=t[o];if(this.debug(r,d,p),d===!1||d===pn)return!1;let f;if(typeof d=="string"?(f=p===d,this.debug("string match",d,p,f)):(f=d.test(p),this.debug("pattern match",d,p,f)),!f)return!1}if(o===u&&a===c)return!0;if(o===u)return n;if(a===c)return o===u-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return _C(this.pattern,this.options)}parse(t){Ld(t);let r=this.options;if(t==="**")return pn;if(t==="")return"";let n,i=null;(n=t.match(eae))?i=r.dot?rae:tae:(n=t.match(qoe))?i=(r.nocase?r.dot?Zoe:Voe:r.dot?Goe:Hoe)(n[1]):(n=t.match(nae))?i=(r.nocase?r.dot?sae:iae:r.dot?oae:aae)(n):(n=t.match(Koe))?i=r.dot?Joe:Yoe:(n=t.match(Xoe))&&(i=Qoe);let s=La.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?uae:r.dot?dae:pae,i=new Set(r.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(p=>{if(p instanceof RegExp)for(let f of p.flags.split(""))i.add(f);return typeof p=="string"?yae(p):p===pn?pn:p._src});u.forEach((p,f)=>{let h=u[f+1],m=u[f-1];p!==pn||m===pn||(m===void 0?h!==void 0&&h!==pn?u[f+1]="(?:\\/|"+n+"\\/)?"+h:u[f]=n:h===void 0?u[f-1]=m+"(?:\\/|\\/"+n+")?":h!==pn&&(u[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+h,u[f+1]=pn))});let d=u.filter(p=>p!==pn);if(this.partial&&d.length>=1){let p=[];for(let f=1;f<=d.length;f++)p.push(d.slice(0,f).join("/"));return"(?:"+p.join("|")+")"}return d.join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].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,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let c=i;if(n.matchBase&&a.length===1&&(c=[o]),this.matchOne(c,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Gr.defaults(t).Minimatch}};Gr.AST=La;Gr.Minimatch=pc;Gr.escape=t6;Gr.unescape=jo;import{gunzipSync as yce}from"node:zlib";var Fd=class{static{l(this,"Diff")}diff(t,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(t,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,i)}diffWithOptionsObj(t,r,n,i){var s;let o=l(w=>{if(w=this.postProcess(w,n),i){setTimeout(function(){i(w)},0);return}else return w},"done"),a=r.length,c=t.length,u=1,d=a+c;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));let p=(s=n.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+p,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,t,0,n);if(h[0].oldPos+1>=c&&m+1>=a)return o(this.buildValues(h[0].lastComponent,r,t));let g=-1/0,y=1/0,b=l(()=>{for(let w=Math.max(g,-u);w<=Math.min(y,u);w+=2){let x,k=h[w-1],S=h[w+1];k&&(h[w-1]=void 0);let A=!1;if(S){let C=S.oldPos-w;A=S&&0<=C&&C<a}let I=k&&k.oldPos+1<c;if(!A&&!I){h[w]=void 0;continue}if(!I||A&&k.oldPos<S.oldPos?x=this.addToPath(S,!0,!1,0,n):x=this.addToPath(k,!1,!0,1,n),m=this.extractCommon(x,r,t,w,n),x.oldPos+1>=c&&m+1>=a)return o(this.buildValues(x.lastComponent,r,t))||!0;h[w]=x,x.oldPos+1>=c&&(y=Math.min(y,w-1)),m+1>=a&&(g=Math.max(g,w+1))}u++},"execEditLength");if(i)l(function w(){setTimeout(function(){if(u>d||Date.now()>f)return i(void 0);b()||w()},0)},"exec")();else for(;u<=d&&Date.now()<=f;){let w=b();if(w)return w}}addToPath(t,r,n,i,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(t,r,n,i,s){let o=r.length,a=n.length,c=t.oldPos,u=c-i,d=0;for(;u+1<o&&c+1<a&&this.equals(n[c+1],r[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,r,n){return n.comparator?n.comparator(t,r):t===r||!!n.ignoreCase&&t.toLowerCase()===r.toLowerCase()}removeEmpty(t){let r=[];for(let n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r}castInput(t,r){return t}tokenize(t,r){return Array.from(t)}join(t){return t.join("")}postProcess(t,r){return t}get useLongestToken(){return!1}buildValues(t,r,n){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let o=i.length,a=0,c=0,u=0;for(;a<o;a++){let d=i[a];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=r.slice(c,c+d.count);p=p.map(function(f,h){let m=n[u+h];return m.length>f.length?m:f}),d.value=this.join(p)}else d.value=this.join(r.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return i}};var r6=class extends Fd{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=wae}equals(t,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!t.includes(`
677
677
  `))&&(t=t.trim()),(!n.newlineIsToken||!r.includes(`
678
678
  `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(t.endsWith(`
679
679
  `)&&(t=t.slice(0,-1)),r.endsWith(`
@@ -673,7 +673,7 @@ ${i}`:""}`}});function iA(e){if(e.url.trim().length===0)throw new Error("url mus
673
673
  button, .button { display: inline-block; box-sizing: border-box; margin-top: 1rem; padding: .75rem 1rem; border: 0; border-radius: .6rem; background: #5a87ff; color: #071022; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
674
674
  .secondary { background: #29314b; color: #edf2ff; }
675
675
  .error { padding: .75rem; border-radius: .5rem; background: #461d2b; color: #ffd6df; }
676
- `}l(i_,"pageStyles");var Cw={name:"dsh-edge",version:"0.2.0-alpha.1",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.0-rc.7"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.0-rc.7","@deepseek-ai/dsh-agent-loop":"0.1.0-rc.7","@deepseek-ai/dsh-anonymous-user-id":"0.1.0-rc.7","@deepseek-ai/dsh-brand":"0.1.0-rc.7","@deepseek-ai/dsh-credentials":"0.1.0-rc.7","@deepseek-ai/dsh-host-apiproxy":"0.1.0-rc.7","@deepseek-ai/dsh-launch-environment":"0.1.0-rc.7","@deepseek-ai/dsh-llm":"0.1.0-rc.7","@deepseek-ai/dsh-llm-deepseek":"0.1.0-rc.7","@deepseek-ai/dsh-session":"0.1.0-rc.7","@deepseek-ai/dsh-session-persistence":"0.1.0-rc.7","@deepseek-ai/dsh-session-query":"0.1.0-rc.7","@deepseek-ai/dsh-session-title":"0.1.0-rc.7","@deepseek-ai/dsh-settings":"0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"0.1.0-rc.7","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.0-rc.7","@deepseek-ai/dsh-tool-web":"0.1.0-rc.7","@deepseek-ai/dsh-tools":"0.1.0-rc.7","@deepseek-ai/dsh-web":"0.1.0-rc.7","@deepseek-ai/dsh-web-search-deepseek":"0.1.0-rc.7","just-bash":"3.3.0",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var yp=Cw.version,s_=Cw.dshEdge.upstreamVersion;function jX(){return"dsh-edge@0.2.0-alpha.1/isolated"}l(jX,"resolveEdgeDeploymentId");function vp(e){return WA(e.DEEPSEEK_API_KEY),{baseURL:Hv(e.DEEPSEEK_BASE_URL),maxTokens:Zv(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:vc(e.DEEPSEEK_MODEL),reasoningEffort:Gv(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:ap(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Vv(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Ec(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(vp,"resolveEdgeDeploymentConfig");function FX(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(FX,"edgeDeploymentApiKeyConfigured");function UX(e){let t=Hv(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}l(UX,"projectedEdgeBaseURL");function Nw(e){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",deploymentId:jX(),apiKeyConfigured:FX(e),baseURL:UX(e.DEEPSEEK_BASE_URL),maxTokens:Zv(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:vc(e.DEEPSEEK_MODEL),reasoningEffort:Gv(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:ap(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Vv(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Ec(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Nw,"resolveEdgeDeploymentProfile");function a_(e){vp(e);let t=Nw(e);return{ok:!0,service:"dsh-edge",storage:t.storage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:yp,upstreamVersion:s_,status:"ready"}}l(a_,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as fxe}from"cloudflare:workers";var $a=o4(o_(),1);var Tw=l((e,t,n)=>{let i=e instanceof RegExp?l_(e,n):e,r=t instanceof RegExp?l_(t,n):t,s=i!==null&&r!=null&&zX(i,r,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+i.length,s[1]),post:n.slice(s[1]+r.length)}},"balanced"),l_=l((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),zX=l((e,t,n)=>{let i,r,s,a,o,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(i=[],s=n.length;d>=0&&!o;){if(d===c)i.push(d),c=n.indexOf(e,d+1);else if(i.length===1){let f=i.pop();f!==void 0&&(o=[f,u])}else r=i.pop(),r!==void 0&&r<s&&(s=r,a=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}i.length&&a!==void 0&&(o=[s,a])}return o},"range");var c_="\0SLASH"+Math.random()+"\0",u_="\0OPEN"+Math.random()+"\0",Pw="\0CLOSE"+Math.random()+"\0",d_="\0COMMA"+Math.random()+"\0",f_="\0PERIOD"+Math.random()+"\0",BX=new RegExp(c_,"g"),WX=new RegExp(u_,"g"),qX=new RegExp(Pw,"g"),HX=new RegExp(d_,"g"),GX=new RegExp(f_,"g"),VX=/\\\\/g,ZX=/\\{/g,KX=/\\}/g,XX=/\\,/g,JX=/\\\./g,QX=1e5,YX=4e6;function Ow(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(Ow,"numeric");function eJ(e){return e.replace(VX,c_).replace(ZX,u_).replace(KX,Pw).replace(XX,d_).replace(JX,f_)}l(eJ,"escapeBraces");function tJ(e){return e.replace(BX,"\\").replace(WX,"{").replace(qX,"}").replace(HX,",").replace(GX,".")}l(tJ,"unescapeBraces");function p_(e){if(!e)return[""];let t=[],n=Tw("{","}",e);if(!n)return e.split(",");let{pre:i,body:r,post:s}=n,a=i.split(",");a[a.length-1]+="{"+r+"}";let o=p_(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),t.push.apply(t,a),t}l(p_,"parseCommaParts");function h_(e,t={}){if(!e)return[];let{max:n=QX,maxLength:i=YX}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Rw(eJ(e),n,i,!0).map(tJ)}l(h_,"expand");function nJ(e){return"{"+e+"}"}l(nJ,"embrace");function rJ(e){return/^-?0\d/.test(e)}l(rJ,"isPadded");function iJ(e,t){return e<=t}l(iJ,"lte");function sJ(e,t){return e>=t}l(sJ,"gte");function _c(e,t,n,i,r,s){let a=[],o=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(a.length>=i)return a;let d=e[c]+t+n[u];if(!(s&&!d)){if(o+d.length>r)return a;a.push(d),o+=d.length}}return a}l(_c,"combine");function aJ(e,t,n,i){let r=e.split(/\.\./),s=[];if(r[0]===void 0||r[1]===void 0)return s;let a=Ow(r[0]),o=Ow(r[1]),c=Math.max(r[0].length,r[1].length),u=r.length===3&&r[2]!==void 0?Math.max(Math.abs(Ow(r[2])),1):1,d=iJ;o<a&&(u*=-1,d=sJ);let p=r.some(rJ),h=0;for(let g=a;d(g,o)&&s.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),p){let v=c-y.length;if(v>0){let b=new Array(v+1).join("0");g<0?y="-"+b+y.slice(1):y=b+y}}if(h+y.length>i)break;s.push(y),h+=y.length}return s}l(aJ,"expandSequence");function Rw(e,t,n,i){let r=[""],s=!1,a=!0;for(;;){let o=Tw("{","}",e);if(!o)return _c(r,e,[""],t,n,s);let c=o.pre;if(/\$$/.test(c)){if(r=_c(r,c+"{"+o.body+"}",[""],t,n,s&&!o.post.length),a=!1,!o.post.length)break;e=o.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),f=u||d,p=o.body.indexOf(",")>=0;if(!f&&!p){if(o.post.match(/,(?!,).*\}/)){e=o.pre+"{"+o.body+Pw+o.post,i=!0;continue}return _c(r,c+"{"+o.body+"}"+o.post,[""],t,n,s)}a&&(s=i&&!f,a=!1);let h;if(f)h=aJ(o.body,d,t,n);else{let g=p_(o.body);if(g.length===1&&g[0]!==void 0&&(g=Rw(g[0],t,n,!1).map(nJ),g.length===1)){if(r=_c(r,c+g[0],[""],t,n,s&&!o.post.length),!o.post.length)break;e=o.post;continue}let y=s&&!o.post.length&&!c;for(let b=0;y&&b<r.length;b++)r[b]&&(y=!1);h=[];let v=0;e:for(let b=0;b<g.length;b++){let E=Rw(g[b],t,n,!1);for(let S=0;S<E.length;S++){let _=E[S];if(!(y&&!_)){if(h.length>=t||v+_.length>n)break e;h.push(_),v+=_.length}}}}if(r=_c(r,c,h,t,n,s&&!o.post.length),!o.post.length)break;e=o.post}return r}l(Rw,"expand_");var $c=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var oJ={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Ic=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),lJ=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),m_=l(e=>e.join(""),"rangesToString"),g_=l((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let i=[],r=[],s=n+1,a=!1,o=!1,c=!1,u=!1,d=n,f="";e:for(;s<e.length;){let y=e.charAt(s);if((y==="!"||y==="^")&&s===n+1){u=!0,s++;continue}if(y==="]"&&a&&!c){d=s+1;break}if(a=!0,y==="\\"&&!c){c=!0,s++;continue}if(y==="["&&!c){for(let[v,[b,E,S]]of Object.entries(oJ))if(e.startsWith(v,s)){if(f)return["$.",!1,e.length-n,!0];s+=v.length,S?r.push(b):i.push(b),o=o||E;continue e}}if(c=!1,f){y>f?i.push(Ic(f)+"-"+Ic(y)):y===f&&i.push(Ic(y)),f="",s++;continue}if(e.startsWith("-]",s+1)){i.push(Ic(y+"-")),s+=2;continue}if(e.startsWith("-",s+1)){f=y,s+=2;continue}i.push(Ic(y)),s++}if(d<s)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-n,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let y=i[0].length===2?i[0].slice(-1):i[0];return[lJ(y),!1,d-n,!1]}let p="["+(u?"^":"")+m_(i)+"]",h="["+(u?"":"^")+m_(r)+"]";return[i.length&&r.length?"("+p+"|"+h+")":i.length?p:h,o,d-n,!0]},"parseClass");var ws=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var tr,cJ=new Set(["!","?","+","*","@"]),Dw=l(e=>cJ.has(e),"isExtglobType"),y_=l(e=>Dw(e.type),"isExtglobAST"),uJ=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),dJ=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fJ=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),v_=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),pJ="(?!(?:^|/)\\.\\.?(?:$|/))",bp="(?!\\.)",hJ=new Set(["[","."]),mJ=new Set(["..","."]),gJ=new Set("().*{}+?[]^$\\!"),yJ=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Lw="[^/]",w_=Lw+"*?",b_=Lw+"+?",vJ=0,ua=class{static{l(this,"AST")}type;#e;#n;#r=!1;#t=[];#i;#s;#o;#u=!1;#l;#a;#c=!1;id=++vJ;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,i={}){this.type=t,t&&(this.#n=!0),this.#i=n,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?i:this.#e.#l,this.#o=this.#e===this?[]:this.#e.#o,t==="!"&&!this.#e.#u&&this.#o.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#a=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#o.pop();){if(t.type!=="!")continue;let n=t,i=n.#i;for(;i;){for(let r=n.#s+1;!i.type&&r<i.#t.length;r++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(i.#t[r])}n=i,i=n.#i}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof tr&&n.#i===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let n=0;n<this.#s;n++){let i=t.#t[n];if(!(i instanceof tr&&i.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new tr(this.type,t);for(let i of this.#t)n.copyIn(i);return n}static#h(t,n,i,r,s){let a=r.maxExtglobRecursion??2,o=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=i,v="";for(;y<t.length;){let b=t.charAt(y++);if(o||b==="\\"){o=!o,v+=b;continue}if(c){y===u+1?(b==="^"||b==="!")&&(d=!0):b==="]"&&!(y===u+2&&d)&&(c=!1),v+=b;continue}else if(b==="["){c=!0,u=y,d=!1,v+=b;continue}if(!r.noext&&Dw(b)&&t.charAt(y)==="("&&s<=a){n.push(v),v="";let S=new tr(b,n);y=tr.#h(t,S,y,r,s+1),n.push(S);continue}v+=b}return n.push(v),y}let f=i+1,p=new tr(null,n),h=[],g="";for(;f<t.length;){let y=t.charAt(f++);if(o||y==="\\"){o=!o,g+=y;continue}if(c){f===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(f===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=f,d=!1,g+=y;continue}if(!r.noext&&Dw(y)&&t.charAt(f)==="("&&(s<=a||n&&n.#g(y))){let b=n&&n.#g(y)?0:1;p.push(g),g="";let E=new tr(y,p);p.push(E),f=tr.#h(t,E,f,r,s+b);continue}if(y==="|"){p.push(g),g="",h.push(p),p=new tr(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),p.push(g),g="",n.push(...h,p),f;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(i-1)],f}#N(t){return this.#m(t,dJ)}#m(t,n=uJ){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let i=t.#t[0];return!i||typeof i!="object"||i.type===null?!1:this.#g(i.type,n)}#g(t,n=fJ){return!!n.get(this.type)?.includes(t)}#f(t,n){let i=t.#t[0],r=new tr(null,i,this.options);r.#t.push(""),i.push(r),this.#E(t,n)}#E(t,n){let i=t.#t[0];this.#t.splice(n,1,...i.#t);for(let r of i.#t)typeof r=="object"&&(r.#i=this);this.#a=void 0}#S(t){return!!v_.get(this.type)?.has(t)}#T(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#S(n.type)}#y(t){let n=v_.get(this.type),i=t.#t[0],r=n?.get(i.type);if(!r)return!1;this.#t=i.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=r,this.#a=void 0,this.#c=!1}static fromGlob(t,n={}){let i=new tr(null,void 0,n);return tr.#h(t,i,0,n,0),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,i,r,s]=this.toRegExpSource();if(!(r||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let o=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,o),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#p(),this.#x()),!y_(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[g,y,v,b]=typeof h=="string"?tr.#k(h,this.#n,c):h.toRegExpSource(t);return this.#n=this.#n||v,this.#r=this.#r||b,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&mJ.has(this.#t[0]))){let g=hJ,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),v=!n&&!t&&g.has(u.charAt(0));d=y?pJ:v?bp:""}let f="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(f="(?:$|\\/)"),[d+u+f,ws(u),this.#n=!!this.#n,this.#r]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,ws(this.toString()),!1,!1]}let a=!i||t||n||!bp?"":this.#v(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let o="";if(this.type==="!"&&this.#c)o=(this.isStart()&&!n?bp:"")+b_;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?bp:"")+w_+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=r+s+c}return[o,ws(s),this.#n=!!this.#n,this.#r]}#p(){if(y_(this)){let t=0,n=!1;do{n=!0;for(let i=0;i<this.#t.length;i++){let r=this.#t[i];typeof r=="object"&&(r.#p(),this.#m(r)?(n=!1,this.#E(r,i)):this.#N(r)?(n=!1,this.#f(r,i)):this.#T(r)&&(n=!1,this.#y(r)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#a=void 0}#v(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[i,r,s,a]=n.toRegExpSource(t);return this.#r=this.#r||a,i}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#k(t,n,i=!1){let r=!1,s="",a=!1,o=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(r){r=!1,s+=(gJ.has(u)?"\\":"")+u;continue}if(u==="*"){if(o)continue;o=!0,s+=i&&/^[*]+$/.test(t)?b_:w_,n=!0;continue}else o=!1;if(u==="\\"){c===t.length-1?s+="\\\\":r=!0;continue}if(u==="["){let[d,f,p,h]=g_(t,c);if(p){s+=d,a=a||f,c+=p-1,n=n||h;continue}}if(u==="?"){s+=Lw,n=!0;continue}s+=yJ(u)}return[s,ws(t),!!n,a]}};tr=ua;var Mw=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var yn=l((e,t,n={})=>($c(t),!n.nocomment&&t.charAt(0)==="#"?!1:new Io(t,n).match(e)),"minimatch"),wJ=/^\*+([^+@!?*[(]*)$/,bJ=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),xJ=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),EJ=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),SJ=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),kJ=/^\*+\.\*+$/,AJ=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),_J=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),$J=/^\.\*+$/,IJ=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),CJ=/^\*+$/,NJ=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),TJ=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),OJ=/^\?+([^+@!?*[(]*)?$/,RJ=l(([e,t=""])=>{let n=S_([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),PJ=l(([e,t=""])=>{let n=k_([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),DJ=l(([e,t=""])=>{let n=k_([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTestDot"),LJ=l(([e,t=""])=>{let n=S_([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTest"),S_=l(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),k_=l(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),A_=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",x_={win32:{sep:"\\"},posix:{sep:"/"}},MJ=A_==="win32"?x_.win32.sep:x_.posix.sep;yn.sep=MJ;var Rn=Symbol("globstar **");yn.GLOBSTAR=Rn;var jJ="[^/]",FJ=jJ+"*?",UJ="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",zJ="(?:(?!(?:\\/|^)\\.).)*?",BJ=l((e,t={})=>n=>yn(n,e,t),"filter");yn.filter=BJ;var Er=l((e,t={})=>Object.assign({},e,t),"ext"),WJ=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return yn;let t=yn;return Object.assign(l((i,r,s={})=>t(i,r,Er(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(r,s={}){super(r,Er(e,s))}static defaults(r){return t.defaults(Er(e,r)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(r,s,a={}){super(r,s,Er(e,a))}static fromGlob(r,s={}){return t.AST.fromGlob(r,Er(e,s))}},unescape:l((i,r={})=>t.unescape(i,Er(e,r)),"unescape"),escape:l((i,r={})=>t.escape(i,Er(e,r)),"escape"),filter:l((i,r={})=>t.filter(i,Er(e,r)),"filter"),defaults:l(i=>t.defaults(Er(e,i)),"defaults"),makeRe:l((i,r={})=>t.makeRe(i,Er(e,r)),"makeRe"),braceExpand:l((i,r={})=>t.braceExpand(i,Er(e,r)),"braceExpand"),match:l((i,r,s={})=>t.match(i,r,Er(e,s)),"match"),sep:t.sep,GLOBSTAR:Rn})},"defaults");yn.defaults=WJ;var __=l((e,t={})=>($c(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:h_(e,{max:t.braceExpandMax})),"braceExpand");yn.braceExpand=__;var qJ=l((e,t={})=>new Io(e,t).makeRe(),"makeRe");yn.makeRe=qJ;var HJ=l((e,t,n={})=>{let i=new Io(t,n);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e},"match");yn.match=HJ;var E_=/[?*]|[+@!]\(.*?\)|\[|\]/,GJ=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Io=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){$c(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||A_,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let r=this.globParts.map((s,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!E_.test(s[2]))&&!E_.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,r),this.set=r.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i of t)for(let r=0;r<i.length;r++)i[r]==="**"&&(i[r]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let r=i;for(;n[r+1]==="**";)r++;r!==i&&n.splice(i,r-i)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((i,r)=>{let s=i[i.length-1];return r==="**"&&s==="**"?i:r===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(i.pop(),i):(i.push(r),i)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let s=t[r];r===1&&s===""&&t[0]===""||(s==="."||s==="")&&(n=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let r=t[i-1];r&&r!=="."&&r!==".."&&r!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(n=!0,t.splice(i-1,2),i-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let a=r;for(;i[a+1]==="**";)a++;a>r&&i.splice(r+1,a-r);let o=i[r+1],c=i[r+2],u=i[r+3];if(o!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,i.splice(r,1);let d=i.slice(0);d[r]="**",t.push(d),r--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let o=i[a];a===1&&o===""&&i[0]===""||(o==="."||o==="")&&(n=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(n=!0,i.pop())}let s=0;for(;(s=i.indexOf("..",s+1))!==-1;){let a=i[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){n=!0;let c=s===1&&i[s+1]==="**"?["."]:[];i.splice(s-1,2,...c),i.length===0&&i.push(""),s-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let i=n+1;i<t.length;i++){let r=this.partsMatch(t[n],t[i],!this.preserveMultipleSlashes);if(r){t[n]=[],t[i]=r;break}}return t.filter(n=>n.length)}partsMatch(t,n,i=!1){let r=0,s=0,a=[],o="";for(;r<t.length&&s<n.length;)if(t[r]===n[s])a.push(o==="b"?n[s]:t[r]),r++,s++;else if(i&&t[r]==="**"&&n[s]===t[r+1])a.push(t[r]),r++;else if(i&&n[s]==="**"&&t[r]===n[s+1])a.push(n[s]),s++;else if(t[r]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(o==="b")return!1;o="a",a.push(t[r]),r++,s++}else if(n[s]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(o==="a")return!1;o="b",a.push(n[s]),r++,s++}else return!1;return t.length===n.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,i=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)n=!n,i++;i&&(this.pattern=t.slice(i)),this.negate=n}matchOne(t,n,i=!1){let r=0,s=0;if(this.isWindows){let o=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!o&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),f=c?3:o?0:void 0,p=d?3:u?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[h,g]=[t[f],n[p]];h.toLowerCase()===g.toLowerCase()&&(n[p]=h,s=p,r=f)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(Rn)?this.#e(t,n,i,r,s):this.#r(t,n,i,r,s)}#e(t,n,i,r,s){let a=n.indexOf(Rn,s),o=n.lastIndexOf(Rn),[c,u,d]=i?[n.slice(s,a),n.slice(a+1),[]]:[n.slice(s,a),n.slice(a+1,o),n.slice(o+1)];if(c.length){let E=t.slice(r,r+c.length);if(!this.#r(E,c,i,0,0))return!1;r+=c.length,s+=c.length}let f=0;if(d.length){if(d.length+r>t.length)return!1;let E=t.length-d.length;if(this.#r(t,d,i,E,0))f=d.length;else{if(t[t.length-1]!==""||r+d.length===t.length||(E--,!this.#r(t,d,i,E,0)))return!1;f=d.length+1}}if(!u.length){let E=!!f;for(let S=r;S<t.length-f;S++){let _=String(t[S]);if(E=!0,_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return i||E}let p=[[[],0]],h=p[0],g=0,y=[0];for(let E of u)E===Rn?(y.push(g),h=[[],0],p.push(h)):(h[0].push(E),g++);let v=p.length-1,b=t.length-f;for(let E of p)E[1]=b-(y[v--]+E[0].length);return!!this.#n(t,p,r,0,i,0,!!f)}#n(t,n,i,r,s,a,o){let c=n[r];if(!c){for(let f=i;f<t.length;f++){o=!0;let p=t[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return o}let[u,d]=c;for(;i<=d;){if(this.#r(t.slice(0,i+u.length),u,s,i,0)&&a<this.maxGlobstarRecursion){let h=this.#n(t,n,i+u.length,r+1,s,a+1,o);if(h!==!1)return h}let p=t[i];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;i++}return s||null}#r(t,n,i,r,s){let a,o,c,u;for(a=r,o=s,u=t.length,c=n.length;a<u&&o<c;a++,o++){this.debug("matchOne loop");let d=n[o],f=t[a];if(this.debug(n,d,f),d===!1||d===Rn)return!1;let p;if(typeof d=="string"?(p=f===d,this.debug("string match",d,f,p)):(p=d.test(f),this.debug("pattern match",d,f,p)),!p)return!1}if(a===u&&o===c)return!0;if(a===u)return i;if(o===c)return a===u-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return __(this.pattern,this.options)}parse(t){$c(t);let n=this.options;if(t==="**")return Rn;if(t==="")return"";let i,r=null;(i=t.match(CJ))?r=n.dot?TJ:NJ:(i=t.match(wJ))?r=(n.nocase?n.dot?SJ:EJ:n.dot?xJ:bJ)(i[1]):(i=t.match(OJ))?r=(n.nocase?n.dot?PJ:RJ:n.dot?DJ:LJ)(i):(i=t.match(kJ))?r=n.dot?_J:AJ:(i=t.match($J))&&(r=IJ);let s=ua.fromGlob(t,this.options).toMMPattern();return r&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:r}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?FJ:n.dot?UJ:zJ,r=new Set(n.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))r.add(p);return typeof f=="string"?GJ(f):f===Rn?Rn:f._src});u.forEach((f,p)=>{let h=u[p+1],g=u[p-1];f!==Rn||g===Rn||(g===void 0?h!==void 0&&h!==Rn?u[p+1]="(?:\\/|"+i+"\\/)?"+h:u[p]=i:h===void 0?u[p-1]=g+"(?:\\/|\\/"+i+")?":h!==Rn&&(u[p-1]=g+"(?:\\/|\\/"+i+"\\/)"+h,u[p+1]=Rn))});let d=u.filter(f=>f!==Rn);if(this.partial&&d.length>=1){let f=[];for(let p=1;p<=d.length;p++)f.push(d.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];s="^"+a+s+o+"$",this.partial&&(s="^(?:\\/|"+a+s.slice(1,-1)+o+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...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,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let s=this.set;this.debug(this.pattern,"set",s);let a=r[r.length-1];if(!a)for(let o=r.length-2;!a&&o>=0;o--)a=r[o];for(let o of s){let c=r;if(i.matchBase&&o.length===1&&(c=[a]),this.matchOne(c,o,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return yn.defaults(t).Minimatch}};yn.AST=ua;yn.Minimatch=Io;yn.escape=Mw;yn.unescape=ws;import{gunzipSync as dee}from"node:zlib";var Cc=class{static{l(this,"Diff")}diff(t,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);let s=this.castInput(t,i),a=this.castInput(n,i),o=this.removeEmpty(this.tokenize(s,i)),c=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,c,i,r)}diffWithOptionsObj(t,n,i,r){var s;let a=l(E=>{if(E=this.postProcess(E,i),r){setTimeout(function(){r(E)},0);return}else return E},"done"),o=n.length,c=t.length,u=1,d=o+c;i.maxEditLength!=null&&(d=Math.min(d,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],n,t,0,i);if(h[0].oldPos+1>=c&&g+1>=o)return a(this.buildValues(h[0].lastComponent,n,t));let y=-1/0,v=1/0,b=l(()=>{for(let E=Math.max(y,-u);E<=Math.min(v,u);E+=2){let S,_=h[E-1],k=h[E+1];_&&(h[E-1]=void 0);let A=!1;if(k){let F=k.oldPos-E;A=k&&0<=F&&F<o}let O=_&&_.oldPos+1<c;if(!A&&!O){h[E]=void 0;continue}if(!O||A&&_.oldPos<k.oldPos?S=this.addToPath(k,!0,!1,0,i):S=this.addToPath(_,!1,!0,1,i),g=this.extractCommon(S,n,t,E,i),S.oldPos+1>=c&&g+1>=o)return a(this.buildValues(S.lastComponent,n,t))||!0;h[E]=S,S.oldPos+1>=c&&(v=Math.min(v,E-1)),g+1>=o&&(y=Math.max(y,E+1))}u++},"execEditLength");if(r)l(function E(){setTimeout(function(){if(u>d||Date.now()>p)return r(void 0);b()||E()},0)},"exec")();else for(;u<=d&&Date.now()<=p;){let E=b();if(E)return E}}addToPath(t,n,i,r,s){let a=t.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===i?{oldPos:t.oldPos+r,lastComponent:{count:a.count+1,added:n,removed:i,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:a}}}extractCommon(t,n,i,r,s){let a=n.length,o=i.length,c=t.oldPos,u=c-r,d=0;for(;u+1<a&&c+1<o&&this.equals(i[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){let r=[],s;for(;t;)r.push(t),s=t.previousComponent,delete t.previousComponent,t=s;r.reverse();let a=r.length,o=0,c=0,u=0;for(;o<a;o++){let d=r[o];if(d.removed)d.value=this.join(i.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(p,h){let g=i[u+h];return g.length>p.length?g:p}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return r}};var jw=class extends Cc{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=ZJ}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
676
+ `}l(i_,"pageStyles");var Cw={name:"dsh-edge",version:"0.2.0-alpha.2",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.0-rc.7"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.0-rc.7","@deepseek-ai/dsh-agent-loop":"0.1.0-rc.7","@deepseek-ai/dsh-anonymous-user-id":"0.1.0-rc.7","@deepseek-ai/dsh-brand":"0.1.0-rc.7","@deepseek-ai/dsh-credentials":"0.1.0-rc.7","@deepseek-ai/dsh-host-apiproxy":"0.1.0-rc.7","@deepseek-ai/dsh-launch-environment":"0.1.0-rc.7","@deepseek-ai/dsh-llm":"0.1.0-rc.7","@deepseek-ai/dsh-llm-deepseek":"0.1.0-rc.7","@deepseek-ai/dsh-session":"0.1.0-rc.7","@deepseek-ai/dsh-session-persistence":"0.1.0-rc.7","@deepseek-ai/dsh-session-query":"0.1.0-rc.7","@deepseek-ai/dsh-session-title":"0.1.0-rc.7","@deepseek-ai/dsh-settings":"0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"0.1.0-rc.7","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.0-rc.7","@deepseek-ai/dsh-tool-web":"0.1.0-rc.7","@deepseek-ai/dsh-tools":"0.1.0-rc.7","@deepseek-ai/dsh-web":"0.1.0-rc.7","@deepseek-ai/dsh-web-search-deepseek":"0.1.0-rc.7","just-bash":"3.3.0",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var yp=Cw.version,s_=Cw.dshEdge.upstreamVersion;function jX(){return"dsh-edge@0.2.0-alpha.2/isolated"}l(jX,"resolveEdgeDeploymentId");function vp(e){return WA(e.DEEPSEEK_API_KEY),{baseURL:Hv(e.DEEPSEEK_BASE_URL),maxTokens:Zv(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:vc(e.DEEPSEEK_MODEL),reasoningEffort:Gv(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:ap(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Vv(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Ec(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(vp,"resolveEdgeDeploymentConfig");function FX(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(FX,"edgeDeploymentApiKeyConfigured");function UX(e){let t=Hv(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}l(UX,"projectedEdgeBaseURL");function Nw(e){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",deploymentId:jX(),apiKeyConfigured:FX(e),baseURL:UX(e.DEEPSEEK_BASE_URL),maxTokens:Zv(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:vc(e.DEEPSEEK_MODEL),reasoningEffort:Gv(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:ap(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Vv(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Ec(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Nw,"resolveEdgeDeploymentProfile");function a_(e){vp(e);let t=Nw(e);return{ok:!0,service:"dsh-edge",storage:t.storage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:yp,upstreamVersion:s_,status:"ready"}}l(a_,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as fxe}from"cloudflare:workers";var $a=o4(o_(),1);var Tw=l((e,t,n)=>{let i=e instanceof RegExp?l_(e,n):e,r=t instanceof RegExp?l_(t,n):t,s=i!==null&&r!=null&&zX(i,r,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+i.length,s[1]),post:n.slice(s[1]+r.length)}},"balanced"),l_=l((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),zX=l((e,t,n)=>{let i,r,s,a,o,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(i=[],s=n.length;d>=0&&!o;){if(d===c)i.push(d),c=n.indexOf(e,d+1);else if(i.length===1){let f=i.pop();f!==void 0&&(o=[f,u])}else r=i.pop(),r!==void 0&&r<s&&(s=r,a=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}i.length&&a!==void 0&&(o=[s,a])}return o},"range");var c_="\0SLASH"+Math.random()+"\0",u_="\0OPEN"+Math.random()+"\0",Pw="\0CLOSE"+Math.random()+"\0",d_="\0COMMA"+Math.random()+"\0",f_="\0PERIOD"+Math.random()+"\0",BX=new RegExp(c_,"g"),WX=new RegExp(u_,"g"),qX=new RegExp(Pw,"g"),HX=new RegExp(d_,"g"),GX=new RegExp(f_,"g"),VX=/\\\\/g,ZX=/\\{/g,KX=/\\}/g,XX=/\\,/g,JX=/\\\./g,QX=1e5,YX=4e6;function Ow(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(Ow,"numeric");function eJ(e){return e.replace(VX,c_).replace(ZX,u_).replace(KX,Pw).replace(XX,d_).replace(JX,f_)}l(eJ,"escapeBraces");function tJ(e){return e.replace(BX,"\\").replace(WX,"{").replace(qX,"}").replace(HX,",").replace(GX,".")}l(tJ,"unescapeBraces");function p_(e){if(!e)return[""];let t=[],n=Tw("{","}",e);if(!n)return e.split(",");let{pre:i,body:r,post:s}=n,a=i.split(",");a[a.length-1]+="{"+r+"}";let o=p_(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),t.push.apply(t,a),t}l(p_,"parseCommaParts");function h_(e,t={}){if(!e)return[];let{max:n=QX,maxLength:i=YX}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Rw(eJ(e),n,i,!0).map(tJ)}l(h_,"expand");function nJ(e){return"{"+e+"}"}l(nJ,"embrace");function rJ(e){return/^-?0\d/.test(e)}l(rJ,"isPadded");function iJ(e,t){return e<=t}l(iJ,"lte");function sJ(e,t){return e>=t}l(sJ,"gte");function _c(e,t,n,i,r,s){let a=[],o=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(a.length>=i)return a;let d=e[c]+t+n[u];if(!(s&&!d)){if(o+d.length>r)return a;a.push(d),o+=d.length}}return a}l(_c,"combine");function aJ(e,t,n,i){let r=e.split(/\.\./),s=[];if(r[0]===void 0||r[1]===void 0)return s;let a=Ow(r[0]),o=Ow(r[1]),c=Math.max(r[0].length,r[1].length),u=r.length===3&&r[2]!==void 0?Math.max(Math.abs(Ow(r[2])),1):1,d=iJ;o<a&&(u*=-1,d=sJ);let p=r.some(rJ),h=0;for(let g=a;d(g,o)&&s.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),p){let v=c-y.length;if(v>0){let b=new Array(v+1).join("0");g<0?y="-"+b+y.slice(1):y=b+y}}if(h+y.length>i)break;s.push(y),h+=y.length}return s}l(aJ,"expandSequence");function Rw(e,t,n,i){let r=[""],s=!1,a=!0;for(;;){let o=Tw("{","}",e);if(!o)return _c(r,e,[""],t,n,s);let c=o.pre;if(/\$$/.test(c)){if(r=_c(r,c+"{"+o.body+"}",[""],t,n,s&&!o.post.length),a=!1,!o.post.length)break;e=o.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),f=u||d,p=o.body.indexOf(",")>=0;if(!f&&!p){if(o.post.match(/,(?!,).*\}/)){e=o.pre+"{"+o.body+Pw+o.post,i=!0;continue}return _c(r,c+"{"+o.body+"}"+o.post,[""],t,n,s)}a&&(s=i&&!f,a=!1);let h;if(f)h=aJ(o.body,d,t,n);else{let g=p_(o.body);if(g.length===1&&g[0]!==void 0&&(g=Rw(g[0],t,n,!1).map(nJ),g.length===1)){if(r=_c(r,c+g[0],[""],t,n,s&&!o.post.length),!o.post.length)break;e=o.post;continue}let y=s&&!o.post.length&&!c;for(let b=0;y&&b<r.length;b++)r[b]&&(y=!1);h=[];let v=0;e:for(let b=0;b<g.length;b++){let E=Rw(g[b],t,n,!1);for(let S=0;S<E.length;S++){let _=E[S];if(!(y&&!_)){if(h.length>=t||v+_.length>n)break e;h.push(_),v+=_.length}}}}if(r=_c(r,c,h,t,n,s&&!o.post.length),!o.post.length)break;e=o.post}return r}l(Rw,"expand_");var $c=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var oJ={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Ic=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),lJ=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),m_=l(e=>e.join(""),"rangesToString"),g_=l((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let i=[],r=[],s=n+1,a=!1,o=!1,c=!1,u=!1,d=n,f="";e:for(;s<e.length;){let y=e.charAt(s);if((y==="!"||y==="^")&&s===n+1){u=!0,s++;continue}if(y==="]"&&a&&!c){d=s+1;break}if(a=!0,y==="\\"&&!c){c=!0,s++;continue}if(y==="["&&!c){for(let[v,[b,E,S]]of Object.entries(oJ))if(e.startsWith(v,s)){if(f)return["$.",!1,e.length-n,!0];s+=v.length,S?r.push(b):i.push(b),o=o||E;continue e}}if(c=!1,f){y>f?i.push(Ic(f)+"-"+Ic(y)):y===f&&i.push(Ic(y)),f="",s++;continue}if(e.startsWith("-]",s+1)){i.push(Ic(y+"-")),s+=2;continue}if(e.startsWith("-",s+1)){f=y,s+=2;continue}i.push(Ic(y)),s++}if(d<s)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-n,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let y=i[0].length===2?i[0].slice(-1):i[0];return[lJ(y),!1,d-n,!1]}let p="["+(u?"^":"")+m_(i)+"]",h="["+(u?"":"^")+m_(r)+"]";return[i.length&&r.length?"("+p+"|"+h+")":i.length?p:h,o,d-n,!0]},"parseClass");var ws=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var tr,cJ=new Set(["!","?","+","*","@"]),Dw=l(e=>cJ.has(e),"isExtglobType"),y_=l(e=>Dw(e.type),"isExtglobAST"),uJ=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),dJ=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fJ=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),v_=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),pJ="(?!(?:^|/)\\.\\.?(?:$|/))",bp="(?!\\.)",hJ=new Set(["[","."]),mJ=new Set(["..","."]),gJ=new Set("().*{}+?[]^$\\!"),yJ=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Lw="[^/]",w_=Lw+"*?",b_=Lw+"+?",vJ=0,ua=class{static{l(this,"AST")}type;#e;#n;#r=!1;#t=[];#i;#s;#o;#u=!1;#l;#a;#c=!1;id=++vJ;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,i={}){this.type=t,t&&(this.#n=!0),this.#i=n,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?i:this.#e.#l,this.#o=this.#e===this?[]:this.#e.#o,t==="!"&&!this.#e.#u&&this.#o.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#a=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#o.pop();){if(t.type!=="!")continue;let n=t,i=n.#i;for(;i;){for(let r=n.#s+1;!i.type&&r<i.#t.length;r++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(i.#t[r])}n=i,i=n.#i}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof tr&&n.#i===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let n=0;n<this.#s;n++){let i=t.#t[n];if(!(i instanceof tr&&i.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new tr(this.type,t);for(let i of this.#t)n.copyIn(i);return n}static#h(t,n,i,r,s){let a=r.maxExtglobRecursion??2,o=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=i,v="";for(;y<t.length;){let b=t.charAt(y++);if(o||b==="\\"){o=!o,v+=b;continue}if(c){y===u+1?(b==="^"||b==="!")&&(d=!0):b==="]"&&!(y===u+2&&d)&&(c=!1),v+=b;continue}else if(b==="["){c=!0,u=y,d=!1,v+=b;continue}if(!r.noext&&Dw(b)&&t.charAt(y)==="("&&s<=a){n.push(v),v="";let S=new tr(b,n);y=tr.#h(t,S,y,r,s+1),n.push(S);continue}v+=b}return n.push(v),y}let f=i+1,p=new tr(null,n),h=[],g="";for(;f<t.length;){let y=t.charAt(f++);if(o||y==="\\"){o=!o,g+=y;continue}if(c){f===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(f===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=f,d=!1,g+=y;continue}if(!r.noext&&Dw(y)&&t.charAt(f)==="("&&(s<=a||n&&n.#g(y))){let b=n&&n.#g(y)?0:1;p.push(g),g="";let E=new tr(y,p);p.push(E),f=tr.#h(t,E,f,r,s+b);continue}if(y==="|"){p.push(g),g="",h.push(p),p=new tr(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),p.push(g),g="",n.push(...h,p),f;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(i-1)],f}#N(t){return this.#m(t,dJ)}#m(t,n=uJ){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let i=t.#t[0];return!i||typeof i!="object"||i.type===null?!1:this.#g(i.type,n)}#g(t,n=fJ){return!!n.get(this.type)?.includes(t)}#f(t,n){let i=t.#t[0],r=new tr(null,i,this.options);r.#t.push(""),i.push(r),this.#E(t,n)}#E(t,n){let i=t.#t[0];this.#t.splice(n,1,...i.#t);for(let r of i.#t)typeof r=="object"&&(r.#i=this);this.#a=void 0}#S(t){return!!v_.get(this.type)?.has(t)}#T(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#S(n.type)}#y(t){let n=v_.get(this.type),i=t.#t[0],r=n?.get(i.type);if(!r)return!1;this.#t=i.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=r,this.#a=void 0,this.#c=!1}static fromGlob(t,n={}){let i=new tr(null,void 0,n);return tr.#h(t,i,0,n,0),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,i,r,s]=this.toRegExpSource();if(!(r||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let o=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,o),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#p(),this.#x()),!y_(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[g,y,v,b]=typeof h=="string"?tr.#k(h,this.#n,c):h.toRegExpSource(t);return this.#n=this.#n||v,this.#r=this.#r||b,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&mJ.has(this.#t[0]))){let g=hJ,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),v=!n&&!t&&g.has(u.charAt(0));d=y?pJ:v?bp:""}let f="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(f="(?:$|\\/)"),[d+u+f,ws(u),this.#n=!!this.#n,this.#r]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,ws(this.toString()),!1,!1]}let a=!i||t||n||!bp?"":this.#v(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let o="";if(this.type==="!"&&this.#c)o=(this.isStart()&&!n?bp:"")+b_;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?bp:"")+w_+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=r+s+c}return[o,ws(s),this.#n=!!this.#n,this.#r]}#p(){if(y_(this)){let t=0,n=!1;do{n=!0;for(let i=0;i<this.#t.length;i++){let r=this.#t[i];typeof r=="object"&&(r.#p(),this.#m(r)?(n=!1,this.#E(r,i)):this.#N(r)?(n=!1,this.#f(r,i)):this.#T(r)&&(n=!1,this.#y(r)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#a=void 0}#v(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[i,r,s,a]=n.toRegExpSource(t);return this.#r=this.#r||a,i}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#k(t,n,i=!1){let r=!1,s="",a=!1,o=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(r){r=!1,s+=(gJ.has(u)?"\\":"")+u;continue}if(u==="*"){if(o)continue;o=!0,s+=i&&/^[*]+$/.test(t)?b_:w_,n=!0;continue}else o=!1;if(u==="\\"){c===t.length-1?s+="\\\\":r=!0;continue}if(u==="["){let[d,f,p,h]=g_(t,c);if(p){s+=d,a=a||f,c+=p-1,n=n||h;continue}}if(u==="?"){s+=Lw,n=!0;continue}s+=yJ(u)}return[s,ws(t),!!n,a]}};tr=ua;var Mw=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var yn=l((e,t,n={})=>($c(t),!n.nocomment&&t.charAt(0)==="#"?!1:new Io(t,n).match(e)),"minimatch"),wJ=/^\*+([^+@!?*[(]*)$/,bJ=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),xJ=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),EJ=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),SJ=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),kJ=/^\*+\.\*+$/,AJ=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),_J=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),$J=/^\.\*+$/,IJ=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),CJ=/^\*+$/,NJ=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),TJ=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),OJ=/^\?+([^+@!?*[(]*)?$/,RJ=l(([e,t=""])=>{let n=S_([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),PJ=l(([e,t=""])=>{let n=k_([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),DJ=l(([e,t=""])=>{let n=k_([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTestDot"),LJ=l(([e,t=""])=>{let n=S_([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTest"),S_=l(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),k_=l(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),A_=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",x_={win32:{sep:"\\"},posix:{sep:"/"}},MJ=A_==="win32"?x_.win32.sep:x_.posix.sep;yn.sep=MJ;var Rn=Symbol("globstar **");yn.GLOBSTAR=Rn;var jJ="[^/]",FJ=jJ+"*?",UJ="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",zJ="(?:(?!(?:\\/|^)\\.).)*?",BJ=l((e,t={})=>n=>yn(n,e,t),"filter");yn.filter=BJ;var Er=l((e,t={})=>Object.assign({},e,t),"ext"),WJ=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return yn;let t=yn;return Object.assign(l((i,r,s={})=>t(i,r,Er(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(r,s={}){super(r,Er(e,s))}static defaults(r){return t.defaults(Er(e,r)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(r,s,a={}){super(r,s,Er(e,a))}static fromGlob(r,s={}){return t.AST.fromGlob(r,Er(e,s))}},unescape:l((i,r={})=>t.unescape(i,Er(e,r)),"unescape"),escape:l((i,r={})=>t.escape(i,Er(e,r)),"escape"),filter:l((i,r={})=>t.filter(i,Er(e,r)),"filter"),defaults:l(i=>t.defaults(Er(e,i)),"defaults"),makeRe:l((i,r={})=>t.makeRe(i,Er(e,r)),"makeRe"),braceExpand:l((i,r={})=>t.braceExpand(i,Er(e,r)),"braceExpand"),match:l((i,r,s={})=>t.match(i,r,Er(e,s)),"match"),sep:t.sep,GLOBSTAR:Rn})},"defaults");yn.defaults=WJ;var __=l((e,t={})=>($c(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:h_(e,{max:t.braceExpandMax})),"braceExpand");yn.braceExpand=__;var qJ=l((e,t={})=>new Io(e,t).makeRe(),"makeRe");yn.makeRe=qJ;var HJ=l((e,t,n={})=>{let i=new Io(t,n);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e},"match");yn.match=HJ;var E_=/[?*]|[+@!]\(.*?\)|\[|\]/,GJ=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Io=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){$c(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||A_,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let r=this.globParts.map((s,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!E_.test(s[2]))&&!E_.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,r),this.set=r.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i of t)for(let r=0;r<i.length;r++)i[r]==="**"&&(i[r]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let r=i;for(;n[r+1]==="**";)r++;r!==i&&n.splice(i,r-i)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((i,r)=>{let s=i[i.length-1];return r==="**"&&s==="**"?i:r===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(i.pop(),i):(i.push(r),i)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let s=t[r];r===1&&s===""&&t[0]===""||(s==="."||s==="")&&(n=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let r=t[i-1];r&&r!=="."&&r!==".."&&r!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(n=!0,t.splice(i-1,2),i-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let a=r;for(;i[a+1]==="**";)a++;a>r&&i.splice(r+1,a-r);let o=i[r+1],c=i[r+2],u=i[r+3];if(o!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,i.splice(r,1);let d=i.slice(0);d[r]="**",t.push(d),r--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let o=i[a];a===1&&o===""&&i[0]===""||(o==="."||o==="")&&(n=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(n=!0,i.pop())}let s=0;for(;(s=i.indexOf("..",s+1))!==-1;){let a=i[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){n=!0;let c=s===1&&i[s+1]==="**"?["."]:[];i.splice(s-1,2,...c),i.length===0&&i.push(""),s-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let i=n+1;i<t.length;i++){let r=this.partsMatch(t[n],t[i],!this.preserveMultipleSlashes);if(r){t[n]=[],t[i]=r;break}}return t.filter(n=>n.length)}partsMatch(t,n,i=!1){let r=0,s=0,a=[],o="";for(;r<t.length&&s<n.length;)if(t[r]===n[s])a.push(o==="b"?n[s]:t[r]),r++,s++;else if(i&&t[r]==="**"&&n[s]===t[r+1])a.push(t[r]),r++;else if(i&&n[s]==="**"&&t[r]===n[s+1])a.push(n[s]),s++;else if(t[r]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(o==="b")return!1;o="a",a.push(t[r]),r++,s++}else if(n[s]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(o==="a")return!1;o="b",a.push(n[s]),r++,s++}else return!1;return t.length===n.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,i=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)n=!n,i++;i&&(this.pattern=t.slice(i)),this.negate=n}matchOne(t,n,i=!1){let r=0,s=0;if(this.isWindows){let o=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!o&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),f=c?3:o?0:void 0,p=d?3:u?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[h,g]=[t[f],n[p]];h.toLowerCase()===g.toLowerCase()&&(n[p]=h,s=p,r=f)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(Rn)?this.#e(t,n,i,r,s):this.#r(t,n,i,r,s)}#e(t,n,i,r,s){let a=n.indexOf(Rn,s),o=n.lastIndexOf(Rn),[c,u,d]=i?[n.slice(s,a),n.slice(a+1),[]]:[n.slice(s,a),n.slice(a+1,o),n.slice(o+1)];if(c.length){let E=t.slice(r,r+c.length);if(!this.#r(E,c,i,0,0))return!1;r+=c.length,s+=c.length}let f=0;if(d.length){if(d.length+r>t.length)return!1;let E=t.length-d.length;if(this.#r(t,d,i,E,0))f=d.length;else{if(t[t.length-1]!==""||r+d.length===t.length||(E--,!this.#r(t,d,i,E,0)))return!1;f=d.length+1}}if(!u.length){let E=!!f;for(let S=r;S<t.length-f;S++){let _=String(t[S]);if(E=!0,_==="."||_===".."||!this.options.dot&&_.startsWith("."))return!1}return i||E}let p=[[[],0]],h=p[0],g=0,y=[0];for(let E of u)E===Rn?(y.push(g),h=[[],0],p.push(h)):(h[0].push(E),g++);let v=p.length-1,b=t.length-f;for(let E of p)E[1]=b-(y[v--]+E[0].length);return!!this.#n(t,p,r,0,i,0,!!f)}#n(t,n,i,r,s,a,o){let c=n[r];if(!c){for(let f=i;f<t.length;f++){o=!0;let p=t[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return o}let[u,d]=c;for(;i<=d;){if(this.#r(t.slice(0,i+u.length),u,s,i,0)&&a<this.maxGlobstarRecursion){let h=this.#n(t,n,i+u.length,r+1,s,a+1,o);if(h!==!1)return h}let p=t[i];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;i++}return s||null}#r(t,n,i,r,s){let a,o,c,u;for(a=r,o=s,u=t.length,c=n.length;a<u&&o<c;a++,o++){this.debug("matchOne loop");let d=n[o],f=t[a];if(this.debug(n,d,f),d===!1||d===Rn)return!1;let p;if(typeof d=="string"?(p=f===d,this.debug("string match",d,f,p)):(p=d.test(f),this.debug("pattern match",d,f,p)),!p)return!1}if(a===u&&o===c)return!0;if(a===u)return i;if(o===c)return a===u-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return __(this.pattern,this.options)}parse(t){$c(t);let n=this.options;if(t==="**")return Rn;if(t==="")return"";let i,r=null;(i=t.match(CJ))?r=n.dot?TJ:NJ:(i=t.match(wJ))?r=(n.nocase?n.dot?SJ:EJ:n.dot?xJ:bJ)(i[1]):(i=t.match(OJ))?r=(n.nocase?n.dot?PJ:RJ:n.dot?DJ:LJ)(i):(i=t.match(kJ))?r=n.dot?_J:AJ:(i=t.match($J))&&(r=IJ);let s=ua.fromGlob(t,this.options).toMMPattern();return r&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:r}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?FJ:n.dot?UJ:zJ,r=new Set(n.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))r.add(p);return typeof f=="string"?GJ(f):f===Rn?Rn:f._src});u.forEach((f,p)=>{let h=u[p+1],g=u[p-1];f!==Rn||g===Rn||(g===void 0?h!==void 0&&h!==Rn?u[p+1]="(?:\\/|"+i+"\\/)?"+h:u[p]=i:h===void 0?u[p-1]=g+"(?:\\/|\\/"+i+")?":h!==Rn&&(u[p-1]=g+"(?:\\/|\\/"+i+"\\/)"+h,u[p+1]=Rn))});let d=u.filter(f=>f!==Rn);if(this.partial&&d.length>=1){let f=[];for(let p=1;p<=d.length;p++)f.push(d.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];s="^"+a+s+o+"$",this.partial&&(s="^(?:\\/|"+a+s.slice(1,-1)+o+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...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,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let s=this.set;this.debug(this.pattern,"set",s);let a=r[r.length-1];if(!a)for(let o=r.length-2;!a&&o>=0;o--)a=r[o];for(let o of s){let c=r;if(i.matchBase&&o.length===1&&(c=[a]),this.matchOne(c,o,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return yn.defaults(t).Minimatch}};yn.AST=ua;yn.Minimatch=Io;yn.escape=Mw;yn.unescape=ws;import{gunzipSync as dee}from"node:zlib";var Cc=class{static{l(this,"Diff")}diff(t,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);let s=this.castInput(t,i),a=this.castInput(n,i),o=this.removeEmpty(this.tokenize(s,i)),c=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,c,i,r)}diffWithOptionsObj(t,n,i,r){var s;let a=l(E=>{if(E=this.postProcess(E,i),r){setTimeout(function(){r(E)},0);return}else return E},"done"),o=n.length,c=t.length,u=1,d=o+c;i.maxEditLength!=null&&(d=Math.min(d,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],n,t,0,i);if(h[0].oldPos+1>=c&&g+1>=o)return a(this.buildValues(h[0].lastComponent,n,t));let y=-1/0,v=1/0,b=l(()=>{for(let E=Math.max(y,-u);E<=Math.min(v,u);E+=2){let S,_=h[E-1],k=h[E+1];_&&(h[E-1]=void 0);let A=!1;if(k){let F=k.oldPos-E;A=k&&0<=F&&F<o}let O=_&&_.oldPos+1<c;if(!A&&!O){h[E]=void 0;continue}if(!O||A&&_.oldPos<k.oldPos?S=this.addToPath(k,!0,!1,0,i):S=this.addToPath(_,!1,!0,1,i),g=this.extractCommon(S,n,t,E,i),S.oldPos+1>=c&&g+1>=o)return a(this.buildValues(S.lastComponent,n,t))||!0;h[E]=S,S.oldPos+1>=c&&(v=Math.min(v,E-1)),g+1>=o&&(y=Math.max(y,E+1))}u++},"execEditLength");if(r)l(function E(){setTimeout(function(){if(u>d||Date.now()>p)return r(void 0);b()||E()},0)},"exec")();else for(;u<=d&&Date.now()<=p;){let E=b();if(E)return E}}addToPath(t,n,i,r,s){let a=t.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===i?{oldPos:t.oldPos+r,lastComponent:{count:a.count+1,added:n,removed:i,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:a}}}extractCommon(t,n,i,r,s){let a=n.length,o=i.length,c=t.oldPos,u=c-r,d=0;for(;u+1<a&&c+1<o&&this.equals(i[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){let r=[],s;for(;t;)r.push(t),s=t.previousComponent,delete t.previousComponent,t=s;r.reverse();let a=r.length,o=0,c=0,u=0;for(;o<a;o++){let d=r[o];if(d.removed)d.value=this.join(i.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(p,h){let g=i[u+h];return g.length>p.length?g:p}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return r}};var jw=class extends Cc{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=ZJ}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
677
677
  `))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
678
678
  `))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
679
679
  `)&&(t=t.slice(0,-1)),n.endsWith(`