@jayyuen66/dsh-scrapling 0.1.7 → 0.1.8
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/CHANGELOG.md +23 -0
- package/README.md +9 -8
- package/README.zh-CN.md +9 -8
- package/bin/dsh-scrapling.mjs +3 -3
- package/client.js +3 -106
- package/cordis.patch.yml +3 -0
- package/docs/DETAIL.md +3 -3
- package/docs/DETAIL.zh.md +3 -3
- package/host.js +4 -4
- package/package.json +48 -46
- package/py/adapters.py +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,29 @@
|
|
|
6
6
|
标准六类之外的小节(本仓的 `Boundaries` 收各版本的验证范围与能力边界,即哪些平台/档位真跑过、
|
|
7
7
|
哪些只到本地夹具为止)。
|
|
8
8
|
|
|
9
|
+
## 0.1.8
|
|
10
|
+
|
|
11
|
+
宿主开发基线抬到 `0.2.2-rc.1`(支持窗口 `^0.2.1-rc.5 || ^0.2.2-alpha.3` 未变),`engines.node` 地板抬到 `>=24.9.0`;MCP 客户端默认钉版随开发基线走到 `0.2.2-rc.1`,放行名单补上窗口内第三条线;卡片组件改由 shared 的 `./client` 供。工具与设置面不变,需要留意的是 `engines.node` 抬高后 node 22 装不上本包,以及 `setup` / `doctor` 交回的默认钉法变了。
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **shared 抬到 0.2.4**:catalog、生成物与 lockfile 随之同步;shared 新增的普通依赖 `@deepseek-ai/dsh-fs-patch` 由 shared 自己安装,本包不重复声明。
|
|
16
|
+
- **宿主开发基线**:`devDependencies` 的 dsh 家族抬到 `0.2.2-rc.1`,`@deepseek-ai/cordis` 抬到 `4.1.0`,cordis 插件组两枚抬到 `1.1.0`,`@deepseek-ai/schemastery` 抬到 `3.19.0`;`@deepseek-ai/dsh-ptc-runtime` 从 devDependencies 移除(源码与测试都不再引用它)。`engines.dsh` 与 `@deepseek-ai/dsh*` peer 保持 `^0.2.1-rc.5 || ^0.2.2-alpha.3` 未动;`@deepseek-ai/schemastery` 的 peer 放宽为 `^3.18.5 || ^3.18.6-alpha.1`,与两条宿主线各自的实装版本对齐。`engines.node` 由 `>=22.18.0` 抬到 `>=24.9.0`,取值取自宿主自己的地板。
|
|
17
|
+
- **MCP 客户端默认钉版走到 `0.2.2-rc.1`**:`MCP_DEFAULT_CLIENT_PIN` 随开发基线抬版,`MCP_CLIENT_PIN_VALUES` 由三条变四条(`0.2.2-rc.1`、`0.2.2-alpha.3`、`0.2.1-rc.5`、`next`)——默认钉法只覆盖一条线时,停在 alpha.3 或 rc.5 上的部署拿到的安装命令会把宿主对字面 peer 的确切版本校验撞上去,条目「装得上、永不生效」;放行名单的口径因此由「两条宿主线」改为「本包宿主窗口覆盖到的每条线」。MCP server 自述版本同步 `0.1.8`。
|
|
18
|
+
- **卡片组件改由 shared 的 `./client` 供**:`src/settings-card.ts`、`src/runtime-reader.ts` 与 `src/client-entry.ts` 的运行期值导入从 `./lib/card-ui`、`./lib/record` 迁到 `./client`,`build-client.ts` 的外置清单加入 `@jayyuen66/dsh-plugin-shared`,`package.json` 新增 `dsh.bundle.client.external`;`cordis.patch.yml` 因此插入一条**不写 id** 的 `@jayyuen66/dsh-plugin-shared` 组件行(写 id 会在插件页多出一个可关闭的组件,关掉后设置卡失去组件供应)。
|
|
19
|
+
- **CI 的 node 矩阵收敛**:`ci.yml` 的 `node: [22, 24]` 加 macOS 排除改为单格 `node: [24.9]`,`node-version` 由 `24` 改为 `24.9`,与 `engines.node` 同值;`python-version` 仍是 `"3.14"`,与该仓的 Python 地板四处同值(三格 runner 上取得到 3.14)。
|
|
20
|
+
|
|
21
|
+
### Removed
|
|
22
|
+
|
|
23
|
+
- **CDP 端点旋钮(`browserCdpUrl` → 上游 `cdp_url`)撤掉**:Scrapling 0.5.1 把 `cdp_url` 与 `new_context` 收归 `RemoteSession` / `AsyncRemoteSession`,递给非远端会话会 `TypeError`(`engines/_browsers/_validators.py` 的 “cdp_url and new_context require RemoteSession”),而本包没有远端会话模式。留在 `SESSION_ONLY_KEYS` 与 `_DEPLOYMENT_KNOBS` 里等于让同一条文档范围 `>=0.5,<0.6` 里两个上游版本行为分叉:0.5 上能用、0.5.1 上直接把会话构造炸掉。撤的落点:`host.ts` 的 `Config` 字段与 schema 默认、`lib/tools.ts` 的 deployment 两处交回、`py/adapters.py` 的旋钮表与会话键表、探针与 TS 两侧夹具。要接已在运行的 CDP 浏览器,需要的是新增远端会话模式,不是把这枚键偷偷递回去。
|
|
24
|
+
- 随撤的账面:部署值由三十项变**二十九项**(`Config` 现量 79 枚、其中 volatile 50 枚不变),两份 README 的部署表与两份 DETAIL 的计数同改;隐私段那条「绝不进入工具 schema」的名单去掉 `cdpUrl`(该键已不存在,列着它等于让读者去找一个没有的开关)。
|
|
25
|
+
- 门禁侧:`test/contract-scrapling.test.ts` 的驱动覆盖下限由 20 调到 **19**(少发一枚键是预期结果,不是驱动退化,理由写在那张表旁)。这条红是本轮 CI 首次用 0.5.1 跑出来的——本仓 `_env/.venv` 钉的是 `scrapling==0.5`(`py/runtime-requirements.txt` 带哈希),而 CI 的 Python 腿装 `scrapling[rag]>=0.5,<0.6`,两者本来就是两个版本。两侧现在都验过:0.5 与 0.5.1 下 `violations` 均为空集。
|
|
26
|
+
|
|
27
|
+
### Docs
|
|
28
|
+
|
|
29
|
+
- 两份 DETAIL 的「卡上四十九个取值 / Forty-nine card values」改为**五十**:`host.ts` 的 `Config` 接口里标 `Volatile<…>` 的字段现量 50 枚,与两份 README 的卡片表逐键相等(`test/readme-parity.test.ts` 钉的是 README 那侧,DETAIL 这个数字没有门);核对时另有一处坑——用 `grep -c '\.volatile()'` 数会得到 52,因为 `host.ts` 上方那段注释里就写着 `.volatile()` 这个字面量。
|
|
30
|
+
- dsh 徽章由 `^0.2.1-rc.3` 抬到 `^0.2.1-rc.5`,与 `engines.dsh` 首条同值;`cordis.patch.yml` 的注册行由「唯一一行」改写为「两条条目」并说明 shared 那行为何不写 id;`build-client.ts` 的头注释原写「只 import react 与 zod」,与它自己下一行的外置清单(含 shared)矛盾,改为三条并说明内联会得到第二份卡片状态。
|
|
31
|
+
|
|
9
32
|
## 0.1.7
|
|
10
33
|
|
|
11
34
|
宿主支持窗口抬到 `0.2.1-rc.5 || 0.2.2-alpha.3`,MCP 客户端钉版、设置卡取值面与输出预算
|
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/@jayyuen66/dsh-scrapling"><img src="https://img.shields.io/npm/d18m/@jayyuen66/dsh-scrapling?style=flat-square" alt="npm downloads (total)" /></a>
|
|
12
12
|
<a href="https://github.com/JayYuen666/dsh-scrapling/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-scrapling/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
|
|
13
13
|
<img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
|
|
14
|
-
<img src="https://img.shields.io/badge/node-%3E%
|
|
15
|
-
<img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.
|
|
14
|
+
<img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
|
|
15
|
+
<img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.5-658EFF?style=flat-square" alt="dsh" />
|
|
16
16
|
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -75,7 +75,7 @@ dsh plugin --profile web add @jayyuen66/dsh-scrapling
|
|
|
75
75
|
|
|
76
76
|
Remove with `dsh plugin --profile web remove @jayyuen66/dsh-scrapling`. The package is on the public npm registry, so installation needs no credentials and no scoped-registry line.
|
|
77
77
|
|
|
78
|
-
- **Requires Node.js `>=
|
|
78
|
+
- **Requires Node.js `>= 24.9`.** This is an ESM-only package, and the build entry points (`build-client.ts`, `build-host.ts`, `build-cli.ts`) are executed by `node` directly, so the floor has to sit where TypeScript type stripping is on by default (Node 22.18 up). The number itself is the host floor: `0.2.2` hosts declare Node `>= 24.9.0`, and a host below it never starts.
|
|
79
79
|
- **Requires host `dsh` at the `0.2.1-rc.5` or `0.2.2-alpha.3` line.** The requirement the host actually reads is `engines.dsh` (`^0.2.1-rc.5 || ^0.2.2-alpha.3`), and it decides alone; a host on a later line is refused and needs the explicit risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`. The support window rolls: this package is verified against every released host version inside the window at publish time and re-verified once the window moves, so the version number in this bullet is not a standing promise.
|
|
80
80
|
- **Requires Python 3.14+ with Scrapling installed** — named by `pythonBin`, or found by the fixed chain in `lib/runtime.ts` (managed runtime under `dataDir/runtime`, then the repository's `_env/.venv`, then `PATH`). In an installed package the `_env/.venv` leg does not exist, so after `setup --feature core --apply` the interpreter is that managed Python and otherwise the `python3` on your `PATH` (`python` on Windows); whichever one is chosen is logged at load time, and a missing Scrapling reports an error carrying the install line to copy.
|
|
81
81
|
|
|
@@ -130,7 +130,7 @@ dsh-scrapling setup --status
|
|
|
130
130
|
|
|
131
131
|
## <img src="https://api.iconify.design/lucide/plug.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Enabling it in dsh
|
|
132
132
|
|
|
133
|
-
- `dsh.bundle.patch` points at `cordis.patch.yml`,
|
|
133
|
+
- `dsh.bundle.patch` points at `cordis.patch.yml`, which carries **two entries**: `- name: "@jayyuen66/dsh-plugin-shared"` (the supplier of the card components, deliberately **without an `id`** so the plugin page does not list it as a switchable component) and `- id: scrapling` with the **bare package name** — the host scans `dsh.client` on bare package-name entries only.
|
|
134
134
|
- The client half registers two surfaces: the settings card (on the `plugins.bundle.config` slot, keyed by the bundle package name — the host dispatches `entryKey: pkg.name`, so the card renders on this package's detail page) and one result row per tool on `tool.call.toolview`, drawn with the official tool-call view props.
|
|
135
135
|
- The settings namespace is the entry id `scrapling`; precedence is settings-card value > registration-line `config:` > schema default. Setting a field back to its default saves a **clear-override**, not a write of the same value, so a later default change still reaches you.
|
|
136
136
|
- Gate policy and the sidecar environment are snapshotted once when the plugin is applied — **settings changes take effect on the next start**.
|
|
@@ -230,7 +230,8 @@ In `mcp` mode the server runs inside the plugin's own host process and calls the
|
|
|
230
230
|
Connecting dsh needs `@deepseek-ai/dsh-mcp-client`, which this plugin deliberately does not depend on. Pin the build that matches the current host — npm `latest` is older than the host's own line and the host rejects the mismatch:
|
|
231
231
|
|
|
232
232
|
```bash
|
|
233
|
-
dsh plugin --profile <name> add @deepseek-ai/dsh-mcp-client@0.2.2-
|
|
233
|
+
dsh plugin --profile <name> add @deepseek-ai/dsh-mcp-client@0.2.2-rc.1
|
|
234
|
+
# host on the 0.2.2-alpha.3 line: @deepseek-ai/dsh-mcp-client@0.2.2-alpha.3
|
|
234
235
|
# host on the 0.2.1-rc.5 line: @deepseek-ai/dsh-mcp-client@0.2.1-rc.5
|
|
235
236
|
```
|
|
236
237
|
|
|
@@ -264,7 +265,7 @@ dsh-scrapling setup --mode native --apply # a file that deliberately contain
|
|
|
264
265
|
dsh-scrapling doctor --mode mcp --profile <profileDir>
|
|
265
266
|
```
|
|
266
267
|
|
|
267
|
-
`doctor` reads what the profile actually says - `cordis.patch.yml` plus that profile's `package.json` - and prints one line per problem: two entries under `serverName: scrapling`, this plugin's entry next to an official `stdio` one, entries that do not match the mode, an entry whose port disagrees with `--port`, a profile without `@deepseek-ai/dsh-mcp-client` or with it pinned to something other than `0.2.2-alpha.3` / `0.2.1-rc.5` / `next`, and an official entry while `officialMcpEnabled` is off. Exit `0` is "consistent", `1` names at least one problem, `2` is a bad argument. `integrationMode` itself is a plugin setting the CLI cannot read, so `--mode` is the claim being checked and has to match the deployment.
|
|
268
|
+
`doctor` reads what the profile actually says - `cordis.patch.yml` plus that profile's `package.json` - and prints one line per problem: two entries under `serverName: scrapling`, this plugin's entry next to an official `stdio` one, entries that do not match the mode, an entry whose port disagrees with `--port`, a profile without `@deepseek-ai/dsh-mcp-client` or with it pinned to something other than `0.2.2-rc.1` / `0.2.2-alpha.3` / `0.2.1-rc.5` / `next`, and an official entry while `officialMcpEnabled` is off. Exit `0` is "consistent", `1` names at least one problem, `2` is a bad argument. `integrationMode` itself is a plugin setting the CLI cannot read, so `--mode` is the claim being checked and has to match the deployment.
|
|
268
269
|
|
|
269
270
|
`official-mcp` asks for two separate statements before it produces anything: `officialMcpEnabled: true` in the profile and `--accept-risk` on the command line; missing either one prints `OFFICIAL_MCP_DISABLED` / `RISK_NOT_ACCEPTED` and writes nothing. The entry it generates starts `<dataDir>/runtime/venv/bin/scrapling-mcp`, so run `setup --feature mcp --apply` first - see [Runtime packs](#runtime-packs-macos-arm64). When that binary is missing, `setup` prints a line saying so.
|
|
270
271
|
|
|
@@ -306,7 +307,7 @@ Settings live on the **scrapling** card in the plugin detail page, grouped by pu
|
|
|
306
307
|
| --- | --- | --- |
|
|
307
308
|
| `requestTimeoutSeconds` / `maxUrlLength` | `120` / `2048` | Python-side per-request ceiling; URL length cap aligned with the built-in fetch |
|
|
308
309
|
| `allowWriteMethods` | `false` | Whether the model may change state on a remote host at all — see [Security](#security) |
|
|
309
|
-
| `browserExecutablePath` / `
|
|
310
|
+
| `browserExecutablePath` / `browserInitScript` | `""` | Strong capabilities: they hand Chromium a file to execute, or inject a JS file into every page. Deployment config only, unreachable from model input |
|
|
310
311
|
| `browserRealChrome` / `browserDnsOverHttps` | `false` | Use the locally installed Google Chrome; route the browser's DNS over HTTPS (useful with a proxy to avoid DNS leaks) |
|
|
311
312
|
| `recordRequests` / `maxRecordedRequests` | `false` / `100` | Whether browser sessions record network history by default (the model can turn it on per session with `recordNetwork`), and how many entries a session keeps |
|
|
312
313
|
| `sessionStateDir` | `""` | Directory for Playwright-compatible login-state files. The model can only pass a **plain file name**, so the directory stays a deployment decision; empty disables the state save / load pair |
|
|
@@ -359,7 +360,7 @@ Details worth knowing:
|
|
|
359
360
|
- **No port allowlist** (any port allowed by default), matching dsh's own built-in fetch provider.
|
|
360
361
|
- **The crawl re-checks every page twice** before it enters the result set — once against the guard (the final URL may still have landed somewhere private) and once against the start domain, because Scrapling's `allow_domains` is a string comparison over links found in the page, not redirect targets. The crawl session uses `follow_redirects="safe"` so curl_cffi refuses a jump into a private range.
|
|
361
362
|
- **WebSocket coverage depends on the Playwright version.** The guard intercepts handshakes via `route_web_socket`; older builds lack that method, WebSocket is then outside the guard, and the plugin reports that as `websocketGuard` in the handshake capabilities (the startup log prints the probed capabilities) rather than degrading silently.
|
|
362
|
-
- **No code execution from model input.** `page_action`, `page_setup`, `selector_config`, `proxy
|
|
363
|
+
- **No code execution from model input.** `page_action`, `page_setup`, `selector_config`, `proxy` and `executablePath` never appear in any tool schema, and the browser-side network guard is installed by plugin code. The strong browser capabilities and `allowWriteMethods` come only from deployment config.
|
|
363
364
|
- **Write verbs are off by default.** With `allowWriteMethods` off, `method` and `body` are absent from `scrapling_fetch`'s parameter surface, and the sidecar independently refuses a non-GET with `WRITE_DISABLED` — two halves that do not rely on each other. The gate, the proxy decision and `follow_redirects="safe"` bound **where** a request goes, not **what it does once there**; prompt-injected page text can ask for a POST, so turn it on only where the task really is to submit data. `headers` and `cookies` stay available either way — anything handed to them lands in the model context by design.
|
|
364
365
|
- **Prompt-injection scrubbing runs unconditionally** on all three extraction paths; there is no model-facing switch to turn it off.
|
|
365
366
|
|
package/README.zh-CN.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/@jayyuen66/dsh-scrapling"><img src="https://img.shields.io/npm/d18m/@jayyuen66/dsh-scrapling?style=flat-square" alt="npm downloads (total)" /></a>
|
|
12
12
|
<a href="https://github.com/JayYuen666/dsh-scrapling/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-scrapling/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
|
|
13
13
|
<img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
|
|
14
|
-
<img src="https://img.shields.io/badge/node-%3E%
|
|
15
|
-
<img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.
|
|
14
|
+
<img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
|
|
15
|
+
<img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.5-658EFF?style=flat-square" alt="dsh" />
|
|
16
16
|
<a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
@@ -75,7 +75,7 @@ dsh plugin --profile web add @jayyuen66/dsh-scrapling
|
|
|
75
75
|
|
|
76
76
|
卸载用 `dsh plugin --profile web remove @jayyuen66/dsh-scrapling`。包在公共 npm registry 上,安装不需要凭据,也不需要 scoped-registry 配置行。
|
|
77
77
|
|
|
78
|
-
- **需要 Node.js `>=
|
|
78
|
+
- **需要 Node.js `>= 24.9`。** 本包是 ESM-only,且构建入口(`build-client.ts`、`build-host.ts`、`build-cli.ts`)由 `node` 直接执行,所以下限必须落在 TypeScript 类型剥离默认开启的那一侧(Node 22.18 起)。数字本身取自宿主:`0.2.2` 系列宿主声明 Node `>= 24.9.0`,低于它的宿主根本起不来。
|
|
79
79
|
- **需要宿主 `dsh` 处在 `0.2.1-rc.5` 或 `0.2.2-alpha.3` 版本线。** 宿主真正读的是 `engines.dsh`(`^0.2.1-rc.5 || ^0.2.2-alpha.3`),且它**单独决定**;更新版本线的宿主会被拒,需要显式风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证,窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
|
|
80
80
|
- **需要 Python 3.14+ 且装好 Scrapling** —— 由 `pythonBin` 指定,或按 `lib/runtime.ts` 的固定链找到:`dataDir/runtime` 下的托管 runtime → 仓内 `_env/.venv` → `PATH`。装出去的包里没有 `_env/.venv` 这一档,所以跑过 `setup --feature core --apply` 的机器用的是那支托管解释器,没装过就是你 `PATH` 上的 `python3`(Windows 上是 `python`);选中哪一支会在装载时写进日志,缺 Scrapling 时报错里带着可直接照抄的安装命令。
|
|
81
81
|
|
|
@@ -130,7 +130,7 @@ dsh-scrapling setup --status
|
|
|
130
130
|
|
|
131
131
|
## <img src="https://api.iconify.design/lucide/plug.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 在 dsh 里启用
|
|
132
132
|
|
|
133
|
-
- `dsh.bundle.patch` 指向 `cordis.patch.yml
|
|
133
|
+
- `dsh.bundle.patch` 指向 `cordis.patch.yml`,里面是**两条条目**:`- name: "@jayyuen66/dsh-plugin-shared"`(卡片组件的供应行,**刻意不写 `id`**,所以插件页不会把它列成可停用组件)与 `- id: scrapling`,`name` 用**裸包名** —— 宿主只扫裸包名条目的 `dsh.client` 声明。
|
|
134
134
|
- client 半注册两个面:设置卡(坐在 `plugins.bundle.config` 槽上,键是 bundle 包名 —— 宿主按 `entryKey: pkg.name` 派发,所以卡画在本包的详情页上),以及每个工具在 `tool.call.toolview` 上的一行结果,用官方 tool-call 视图 props 画。
|
|
135
135
|
- 设置命名空间就是条目 id `scrapling`;优先级为 设置卡现值 > 注册行 `config:` > schema 默认值。把一项改回默认值保存的是**清除覆盖**而不是写入同一个值,将来默认值变了你这一项也会跟着变。
|
|
136
136
|
- 闸门策略与 sidecar 环境在插件 `apply()` 时取一次快照 —— **设置卡的改动要等下次启动才生效**。
|
|
@@ -230,7 +230,8 @@ dsh-scrapling setup --status
|
|
|
230
230
|
要接进 dsh 需要 `@deepseek-ai/dsh-mcp-client`,本插件刻意不依赖它。装与当期宿主同一条线的版本 —— npm 的 `latest` 比宿主还旧,宿主对不匹配的对端是直接拒绝:
|
|
231
231
|
|
|
232
232
|
```bash
|
|
233
|
-
dsh plugin --profile <名> add @deepseek-ai/dsh-mcp-client@0.2.2-
|
|
233
|
+
dsh plugin --profile <名> add @deepseek-ai/dsh-mcp-client@0.2.2-rc.1
|
|
234
|
+
# 宿主在 0.2.2-alpha.3 线时改用 @deepseek-ai/dsh-mcp-client@0.2.2-alpha.3
|
|
234
235
|
# 宿主在 0.2.1-rc.5 线时改用 @deepseek-ai/dsh-mcp-client@0.2.1-rc.5
|
|
235
236
|
```
|
|
236
237
|
|
|
@@ -264,7 +265,7 @@ dsh-scrapling setup --mode native --apply # 写出的文件里一条条目
|
|
|
264
265
|
dsh-scrapling doctor --mode mcp --profile <profileDir>
|
|
265
266
|
```
|
|
266
267
|
|
|
267
|
-
`doctor` 读的是 profile 自己写下的东西 —— `cordis.patch.yml` 加那份 `package.json` —— 每处问题打一行:`serverName: scrapling` 下有两条例目、本插件的条目与官方 `stdio` 那条并存、条目类型与模式不符、条目的端口与 `--port` 说的不一致、profile 里没有 `@deepseek-ai/dsh-mcp-client` 或它钉的不是 `0.2.2-alpha.3` / `0.2.1-rc.5` / `next`、以及 `officialMcpEnabled` 关着却留着官方条目。退 `0` 是一致,`1` 是至少点出一处,`2` 是参数不对。`integrationMode` 本身是插件设置,CLI 读不到,所以 `--mode` 就是被核对的那一句声明,它必须和部署配置说的是同一件事。
|
|
268
|
+
`doctor` 读的是 profile 自己写下的东西 —— `cordis.patch.yml` 加那份 `package.json` —— 每处问题打一行:`serverName: scrapling` 下有两条例目、本插件的条目与官方 `stdio` 那条并存、条目类型与模式不符、条目的端口与 `--port` 说的不一致、profile 里没有 `@deepseek-ai/dsh-mcp-client` 或它钉的不是 `0.2.2-rc.1` / `0.2.2-alpha.3` / `0.2.1-rc.5` / `next`、以及 `officialMcpEnabled` 关着却留着官方条目。退 `0` 是一致,`1` 是至少点出一处,`2` 是参数不对。`integrationMode` 本身是插件设置,CLI 读不到,所以 `--mode` 就是被核对的那一句声明,它必须和部署配置说的是同一件事。
|
|
268
269
|
|
|
269
270
|
`official-mcp` 要两处分开表态才会产出:profile 里的 `officialMcpEnabled: true`,以及命令行的 `--accept-risk`;缺任何一处只打 `OFFICIAL_MCP_DISABLED` / `RISK_NOT_ACCEPTED`,一个字节都不写。它生成的条目起的是 `<dataDir>/runtime/venv/bin/scrapling-mcp`,所以要先跑 `setup --feature mcp --apply` —— 见[运行时能力包](#运行时能力包macos-arm64)。那枚二进制不存在时,`setup` 会额外打一行说明这条条目现在起不来。
|
|
270
271
|
|
|
@@ -306,7 +307,7 @@ dsh-scrapling doctor --mode mcp --profile <profileDir>
|
|
|
306
307
|
| --- | --- | --- |
|
|
307
308
|
| `requestTimeoutSeconds` / `maxUrlLength` | `120` / `2048` | Python 侧单次请求的硬上限;URL 长度上限与内置抓取对齐 |
|
|
308
309
|
| `allowWriteMethods` | `false` | 模型能不能改对端状态 —— 见[安全说明](#安全说明) |
|
|
309
|
-
| `browserExecutablePath` / `
|
|
310
|
+
| `browserExecutablePath` / `browserInitScript` | `""` | 强能力:让 Chromium 执行指定文件、往每个页面注入 JS。只从部署配置来,模型入参到不了 |
|
|
310
311
|
| `browserRealChrome` / `browserDnsOverHttps` | `false` | 改用本机安装的 Google Chrome;浏览器 DNS 走 DoH(配代理时防 DNS 泄露) |
|
|
311
312
|
| `recordRequests` / `maxRecordedRequests` | `false` / `100` | 浏览器会话是否默认记录网络历史(模型可在 `scrapling_session_open` 上按次用 `recordNetwork` 打开),以及一个会话最多留多少条 |
|
|
312
313
|
| `sessionStateDir` | `""` | 存放 Playwright 兼容登录态文件的目录。模型只能给**纯文件名**,目录始终是部署方的决定;留空禁用存取这一对 |
|
|
@@ -359,7 +360,7 @@ dsh-scrapling doctor --mode mcp --profile <profileDir>
|
|
|
359
360
|
- **没有端口白名单**(默认不限端口),与 dsh 内置 fetch provider 的取舍一致。
|
|
360
361
|
- **爬虫每页收进结果前复判两次** —— 一次过守卫(最终 URL 仍可能落在私网上),一次过起始域,因为 Scrapling 的 `allow_domains` 是对页面里链接的字符串比较、不管重定向目标。爬虫会话设了 `follow_redirects="safe"`,curl_cffi 拒绝跳向私网的跳转。
|
|
361
362
|
- **WebSocket 覆盖依赖 Playwright 版本。** 守卫用 `route_web_socket` 拦握手;更老的 Playwright 没有这个方法,那种情况下 WebSocket 不在守卫范围内,插件把它报成握手能力里的 `websocketGuard`(启动日志会打印探测到的能力),不会静默降级。
|
|
362
|
-
- **不接受来自模型的代码执行。** `page_action`、`page_setup`、`selector_config`、`proxy`、`executablePath
|
|
363
|
+
- **不接受来自模型的代码执行。** `page_action`、`page_setup`、`selector_config`、`proxy`、`executablePath` 绝不进入任何工具 schema,浏览器侧的网络守卫由插件自己的代码注册。浏览器强能力与 `allowWriteMethods` 只从部署配置来。
|
|
363
364
|
- **写方法默认关。** `allowWriteMethods` 关着时,`method` 与 `body` 根本不在 `scrapling_fetch` 的参数面里,sidecar 那侧还独立硬拒一次非 GET(`WRITE_DISABLED`)—— 两道判断各管一侧、不依赖对方。闸门、代理判定、`follow_redirects="safe"` 管的是请求**去哪里**,不是**到了之后干什么**;被注入的页面文字完全可以要求发一个 POST,所以只有任务确实是「提交数据」时才打开。`headers` 与 `cookies` 照旧可见 —— 交给它们的任何内容按设计就会进模型上下文。
|
|
364
365
|
- **反注入清洗无条件执行**,三条提取路径都过,不提供任何让模型关掉它的开关。
|
|
365
366
|
|
package/bin/dsh-scrapling.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as e}from"node:module";import{accessSync as t,constants as n,existsSync as r,readFileSync as i,statSync as a}from"node:fs";import{access as o,chmod as s,cp as c,mkdir as l,open as u,readFile as d,readdir as f,rename as p,rm as m,rmdir as h,writeFile as ee}from"node:fs/promises";import te from"node:os";import g from"node:path";import{createHash as ne,randomUUID as re}from"node:crypto";import{spawn as ie}from"node:child_process";const ae=`scrapling`,oe=`streamable-http`,se=`stdio`,ce=`DSH_SCRAPLING_MCP_TOKEN`,_=`@deepseek-ai/dsh-mcp-client`,le=`0.2.2-
|
|
3
|
-
`:return String.raw`\n`;case`\r`:return String.raw`\r`;case` `:return String.raw`\t`;default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`}}const ye=/[\u0000-\u001F\u007F-\u009F"\\]/gu;function be(e){return`"${e.replaceAll(ye,e=>ve(e))}"`}const xe="official-mcp 直连官方 scrapling-mcp:它的全部工具不经本插件的 URL 守卫与会话闸门(钉住的 scrapling 版本里有 `browser_evaluate` 这类任意 JS 执行),用的是它自己的会话与状态,本插件既不复用也不拦截。";function Se(e){if(!e.enabled)throw new ge(`OFFICIAL_MCP_DISABLED`,`official-mcp 未启用:部署配置里把 officialMcpEnabled 设为 true 才会生成接入配置`);if(!e.acceptedRisk)throw new ge(`RISK_NOT_ACCEPTED`,`${xe} 确认接受请再跑一次 setup 并带 --accept-risk。`);let t=_e(e.dataDir);return{command:t,args:[],serverName:ae,risk:xe,installCommand:he(`0.2.2-
|
|
2
|
+
import{createRequire as e}from"node:module";import{accessSync as t,constants as n,existsSync as r,readFileSync as i,statSync as a}from"node:fs";import{access as o,chmod as s,cp as c,mkdir as l,open as u,readFile as d,readdir as f,rename as p,rm as m,rmdir as h,writeFile as ee}from"node:fs/promises";import te from"node:os";import g from"node:path";import{createHash as ne,randomUUID as re}from"node:crypto";import{spawn as ie}from"node:child_process";const ae=`scrapling`,oe=`streamable-http`,se=`stdio`,ce=`DSH_SCRAPLING_MCP_TOKEN`,_=`@deepseek-ai/dsh-mcp-client`,le=`0.2.2-rc.1`,ue=[le,`0.2.2-alpha.3`,`0.2.1-rc.5`,`next`],de=[`native`,`mcp`,`official-mcp`],fe=new Set(de);function pe(e){return fe.has(e)}function me(e,t){if(!Number.isInteger(e)||e<1||e>65535)throw Error(`MCP port must be an integer in 1..65535, got ${String(e)}`);return`http://${t.includes(`:`)&&!t.startsWith(`[`)?`[${t}]`:t}:${String(e)}/mcp`}function he(e=le){if(!ue.includes(e))throw Error(`unsupported MCP client pin: ${JSON.stringify(e)}`);return`dsh plugin --profile <profile> add ${_}@${e}`}var ge=class extends Error{code;constructor(e,t){super(t),this.name=`OfficialMcpError`,this.code=e}};function _e(e){let t=g.join(e,`runtime`,`venv`);return process.platform===`win32`?g.join(t,`Scripts`,`scrapling-mcp.exe`):g.join(t,`bin`,`scrapling-mcp`)}function ve(e){switch(e){case`"`:return String.raw`\"`;case`\\`:return String.raw`\\`;case`
|
|
3
|
+
`:return String.raw`\n`;case`\r`:return String.raw`\r`;case` `:return String.raw`\t`;default:return`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`}}const ye=/[\u0000-\u001F\u007F-\u009F"\\]/gu;function be(e){return`"${e.replaceAll(ye,e=>ve(e))}"`}const xe="official-mcp 直连官方 scrapling-mcp:它的全部工具不经本插件的 URL 守卫与会话闸门(钉住的 scrapling 版本里有 `browser_evaluate` 这类任意 JS 执行),用的是它自己的会话与状态,本插件既不复用也不拦截。";function Se(e){if(!e.enabled)throw new ge(`OFFICIAL_MCP_DISABLED`,`official-mcp 未启用:部署配置里把 officialMcpEnabled 设为 true 才会生成接入配置`);if(!e.acceptedRisk)throw new ge(`RISK_NOT_ACCEPTED`,`${xe} 确认接受请再跑一次 setup 并带 --accept-risk。`);let t=_e(e.dataDir);return{command:t,args:[],serverName:ae,risk:xe,installCommand:he(`0.2.2-rc.1`),patch:[`- insert:`,` - id: scrapling-official-mcp`,` name: '${_}'`,` config:`,` serverName: ${ae}`,` transport: ${se}`,` command: ${be(t)}`,` args: []`,` failOnStartupError: true`,``].join(`
|
|
4
4
|
`)}}function Ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const we=/\r\n|\n|\r/u,Te=/:(?<port>\d+)/u,Ee=/[\t ]#.*$/u,De=/^(?:"(?<double>[^"]*)"|'(?<single>[^']*)')$/u,Oe=/^(?:-[\t ]*)?name:(?<value>.*)$/u,ke=/^(?<key>[\w-]+):[\t ]+(?<value>\S.*)$/u;function Ae(e){let t=e.replace(Ee,``).trim(),n=De.exec(t)?.groups,r=n?.double??n?.single;return r===void 0?t.length===0?void 0:t:r}function je(e){return e.split(we)}function Me(e){let t=[],n;for(let r of je(e)){let e=r.length-r.trimStart().length,i=r.slice(e),a=Ae(Oe.exec(i)?.groups?.value??``),o=ke.exec(i)?.groups;a===void 0?o?.key!==void 0&&o.value!==void 0&&n!==void 0&&e>n.indent&&(n.entry.config[o.key]=Ae(o.value)):(n={entry:{name:a,config:{}},indent:e},t.push(n.entry))}return t}function Ne(e){let{url:t}=e.config,n;if(t!==void 0)try{let{port:e,protocol:r}=new URL(t);e===``?r===`http:`?n=`80`:r===`https:`&&(n=`443`):n=e}catch{n=Te.exec(t)?.groups?.port}return n}function Pe(e){return e.config.transport===se}function Fe(e){let t=[];e.mode!==`native`&&e.clientVersion===void 0&&t.push({code:`MCP_CLIENT_MISSING`,detail:`profile 没有 ${_}:跑 ${he()} 装上它`});let n=e.clientVersion;return n!==void 0&&!ue.includes(n)&&t.push({code:`MCP_CLIENT_UNPINNED`,detail:`客户端钉的是 ${e.clientVersion},只接受 ${ue.join(` 或 `)} —— 宿主对不匹配的对端拒绝装载`}),t}function Ie(e,t){let n=[];t.length>1&&n.push({code:`DUPLICATE_SCRAPLING_ENTRY`,detail:`serverName 为 scrapling 的条目有 ${String(t.length)} 条,一个名字只能有一个 server`}),t.some(e=>Pe(e))&&t.some(e=>!Pe(e))&&n.push({code:`MCP_MODE_CONFLICT`,detail:`本插件的 ${oe} 条目与官方 ${se} 条目并存;同一时刻只能一种`});let r=e.mode===`official-mcp`,i=t.some(e=>r===Pe(e));return e.mode===`native`&&t.length>0?n.push({code:`MCP_MODE_ENTRY_MISMATCH`,detail:`integrationMode=native 却留着 scrapling 的 MCP 条目:模型会同时看到两套工具`}):e.mode!==`native`&&!i&&n.push({code:`MCP_MODE_ENTRY_MISMATCH`,detail:`integrationMode=${e.mode} 需要 ${r?se:oe} 条目,profile 里没有`}),r&&!e.officialMcpEnabled&&t.some(e=>Pe(e))&&n.push({code:`MCP_OFFICIAL_SWITCH_OFF`,detail:`留着官方 stdio 条目但 officialMcpEnabled=false:官方 server 的工具不经本插件守卫,开关要明说`}),n}function Le(e,t){let n=[...new Set(e.map(e=>Ne(e)).filter(e=>e!==void 0))];if(n.length===0)return[];let r=t===void 0?void 0:String(t);return n.length<2&&(r===void 0||n.includes(r))?[]:[{code:`MCP_PORT_MISMATCH`,detail:`条目里的端口是 ${n.join(`, `)}${r===void 0?``:`,--port 说的是 ${r}`};改过 mcpPort 就要重新应用 patch`}]}function Re(e){let t=Me(e.patchText).filter(e=>e.name===`@deepseek-ai/dsh-mcp-client`&&e.config.serverName===`scrapling`);return[...Fe(e),...Ie(e,t),...Le(t,e.expectedPort)]}const ze=/^[\t ]*officialMcpEnabled:(?<value>[^\r\n]*)$/gmu;function Be(e){let t;for(let n of e.matchAll(ze))t=n.groups?.value;let n=t?.replace(Ee,``).trim(),r=n===void 0?void 0:De.exec(n)?.groups;return r?.double??r?.single??n}function Ve(e){let t=Be(e);return t===`true`||t===`True`||t===`TRUE`}async function He(e){try{return await d(e,`utf8`)}catch(t){if(Ce(t)&&t.code===`ENOENT`)return``;throw Error(`读不出 ${e}:${String(t)}`,{cause:t})}}function Ue(e){try{let t=JSON.parse(e);return Ce(t)?t:{}}catch{return{}}}function We(e){let{dependencies:t}=Ue(e),n=Ce(t)?t[_]:void 0;return typeof n==`string`?n:void 0}async function Ge(e){let[t,n]=await Promise.all([He(g.join(e,`cordis.patch.yml`)),He(g.join(e,`package.json`))]);return{patchText:t,clientVersion:We(n),officialMcpEnabled:Ve(t)}}function Ke(e){return`${e}.patch.yml`}function qe(e){let t=[`- insert:`,` - id: scrapling-mcp`,` name: '${_}'`,` config:`,` serverName: ${ae}`,` transport: ${oe}`,` url: ${me(e.port,`127.0.0.1`)}`,` failOnStartupError: false`];return e.withAuth&&t.push(` headers:`,` Authorization: !!js '\`Bearer \${process.env.${ce}}\`'`),`${t.join(`
|
|
5
5
|
`)}\n`}function Je(){return[`# integrationMode=native:profile 里不留 scrapling 的 MCP 条目。`,`# 留着条目时模型会同时看到原生工具与 mcp__scrapling__* 两套同名不同层的工具。`,`# 这份文本本身不删任何东西:profile 里若已有 name: '${_}' 的条目,`,"# 要手工删掉它再重启宿主,否则 `doctor --mode native` 会按事实报 MCP_MODE_ENTRY_MISMATCH。",``].join(`
|
|
6
6
|
`)}const Ye=[`auto`,`tavily`,`bing`,`brave`,`serper`,`duckduckgo`,`searxng`];function Xe(e){return Ye.includes(e)}function Ze(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Qe(e,t=`|`){return e.map(e=>_t(e)).join(t)}function $e(e,t){return typeof t==`bigint`?t.toString():t}var et=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function tt(e){return new et(e)}function nt(e){return e==null}function rt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function it(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function v(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function at(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function y(e){return at(e._zod.def)??e._zod.def.shape}function ot(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return v(this,t,e),e},enumerable:!0,configurable:!0})}function st(e,t,n){t in e?v(e,t,n):e[t]=n}function b(e,t,n,r){let i=y(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ot(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):st(e,a,r?r(n.value,a):n.value))}}function ct(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ot(e,n,()=>t[n]):st(e,n,r.value))}}function x(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function lt(e){return JSON.stringify(e)}function ut(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const dt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const pt=/* @__PURE__*/ tt(()=>{if(N.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function S(e){if(ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ft(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function mt(e){return S(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const ht=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function gt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function C(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function w(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function _t(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function vt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const yt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},bt={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function xt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return b(i,e,St(e,t)),C(e,x(n,{shape:i,checks:[]}))}function St(e,t){let n=y(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Ct(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(St(e,t)),a={};return b(a,e,Reflect.ownKeys(y(e)).filter(e=>!i.has(e))),C(e,x(n,{shape:a,checks:[]}))}function wt(e,t){if(!S(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=y(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return C(e,x(e._zod.def,{shape:Tt(e,t)}))}function Tt(e,t){let n={};return b(n,e,Reflect.ownKeys(y(e))),ct(n,t),n}function Et(e,t){if(!S(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return C(e,x(e._zod.def,{shape:Tt(e,t)}))}function Dt(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return b(n,e,Reflect.ownKeys(y(e))),b(n,t,Reflect.ownKeys(y(t))),C(e,x(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ot(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(St(t,n)):void 0,o={};return b(o,t,Reflect.ownKeys(y(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),C(t,x(t._zod.def,{shape:o,checks:[]}))}function kt(e,t,n){let r=n?new Set(St(t,n)):void 0,i={};return b(i,t,Reflect.ownKeys(y(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),C(t,x(t._zod.def,{shape:i}))}function T(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function At(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function E(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function jt(e){return typeof e==`string`?e:e?.message}function Mt(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Nt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function D(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:jt(e.inst?._zod.def?.error?.(e))??jt(a?.(e))??jt(t?.error?.(e))??jt(n.customError?.(e))??jt(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const Pt=/[\uD800-\uDBFF]/;function Ft(e){let t=e.length;if(!Pt.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function It(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Lt(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Rt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function zt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ht(e,n,r.value)}}function O(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Bt(e,t,n){return O(e,t,n,!1)}/* @__NO_SIDE_EFFECTS__ */
|
|
7
7
|
function Vt(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return O(this,n,r(this))},set(e){O(this,n,e)}})}return t}function Ht(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:O(this,t,n.bind(this))},set(e){O(this,t,e)}})}function Ut(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Wt,k=!1;const Gt={configurable:!0,get(){k=!0}};function A(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Wt!==e._zod?Wt=void 0:(Wt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Gt);let e=k;k=!1;try{let r=n(this);return k?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),k||=e,r}catch(n){throw delete this[t],k||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Kt(e,t,n,r){let i=Ut(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function qt(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Jt;const Yt={value:void 0,enumerable:!1};let Xt=`captureStackTrace`in Error?Error:null;function Zt(e){let t=Xt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Xt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
|
|
8
8
|
function j(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Yt.value=new a(r);try{Object.defineProperty(n,"_zod",Yt)}finally{Yt.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),zt(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Zt(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var M=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Qt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Jt=globalThis).__zod_globalConfig??(Jt.__zod_globalConfig={});const N=globalThis.__zod_globalConfig;function P(e){return e&&Object.assign(N,e),N}function $t(){let e=this._zod;return e.message??=JSON.stringify(e.def,$e,2),e.message}function en(e){this._zod.message=e}const tn={get:$t,set:en,enumerable:!0,configurable:!0},nn={value:void 0,enumerable:!1},rn=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),an=/* @__PURE__ */ j(`$ZodError`,(e,t)=>{e.name=`$ZodError`,nn.value=t,Object.defineProperty(e,"issues",nn),nn.value=void 0,Object.defineProperty(e,"message",tn);let n=Object.getPrototypeOf(e);rn.has(n)||(rn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function on(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function sn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?on(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function cn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ln(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function un(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${ln(e.path)}`);return t.join(`
|
|
9
|
-
`)}function dn(e,t){return{callee:t?.callee??e,Err:t?.Err}}const fn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new M;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>D(e,o,P())));throw dt(n,a?.callee??t),n}return s.value};return t},pn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>D(e,o,P())));throw dt(n,a?.callee??t),n}return s.value};return t},mn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new M;return a.issues.length?hn(e,a.issues,i):{success:!0,data:a.value}};function hn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>D(e,n,P()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const gn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?hn(e,a.issues,i):{success:!0,data:a.value}},_n=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),vn=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),yn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==_n)return!0;if(r.definite===!0&&n===void 0)return!1}return bn(e,t,n)});function bn(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[vn]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new M;return a.issues.length===0}const xn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Sn=e=>{let t=fn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,dn(n,a))};return n},Cn=e=>{let t=fn(e),n=(e,r,i,a)=>t(e,r,i,dn(n,a));return n},wn=e=>{let t=pn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,dn(n,a))};return n},Tn=e=>{let t=pn(e),n=async(e,r,i,a)=>await t(e,r,i,dn(n,a));return n},En=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mn(e)(t,n,i)},Dn=e=>(t,n,r)=>mn(e)(t,n,r),On=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gn(e)(t,n,i)},kn=e=>async(t,n,r)=>gn(e)(t,n,r),An=/^[cC][0-9a-z]{6,}$/,jn=/^[0-9a-z]+$/,Mn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Nn=/^[0-9a-vA-V]{20}$/,Pn=/^[A-Za-z0-9]{27}$/,Fn=/^[a-zA-Z0-9_-]{21}$/;function In(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Ln=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,zn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Bn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Vn(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const Hn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Un=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Wn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Gn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Jn=/^https?$/,Yn=/^\+[1-9]\d{6,14}$/,Xn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Zn(e){return RegExp(`^${e}$`)}const Qn=/*@__PURE__*/ Zn(Xn);function $n(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function er(e){return RegExp(`^${$n(e)}$`)}function tr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${$n({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${$n({precision:e.precision})}`:n;return RegExp(`^${Xn}T(?:${r})$`)}const nr=/^[\s\S]{0,}$/,rr=/^-?\d+$/,ir=/^-?\d+(?:\.\d+)?$/,ar=/^[^A-Z]*$/,or=/^[^a-z]*$/,F=/*@__PURE__*/ j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sr=e=>{let t=e.value;return!nt(t)&&t.length!==void 0},cr={number:`number`,bigint:`bigint`,object:`date`},lr=/*@__PURE__*/ j(`$ZodCheckLessThan`,(e,t)=>{F.init(e,t);let n=cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:cr[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ur=/*@__PURE__*/ j(`$ZodCheckGreaterThan`,(e,t)=>{F.init(e,t);let n=cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:cr[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dr=/*@__PURE__*/ j(`$ZodCheckMultipleOf`,(e,t)=>{F.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):it(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),fr=/*@__PURE__*/ j(`$ZodCheckNumberFormat`,(e,t)=>{F.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=yt[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),pr=/*@__PURE__*/ j(`$ZodCheckMaxLength`,(e,t)=>{var n;F.init(e,t),(n=e._zod.def).when??(n.when=sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ft(r):i)<=t.maximum)return;let a=It(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mr=/*@__PURE__*/ j(`$ZodCheckMinLength`,(e,t)=>{var n;F.init(e,t),(n=e._zod.def).when??(n.when=sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ft(r):i)>=t.minimum)return;let a=It(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hr=/*@__PURE__*/ j(`$ZodCheckLengthEquals`,(e,t)=>{var n;F.init(e,t),(n=e._zod.def).when??(n.when=sr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ft(r):i;if(a===t.length)return;let o=It(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),gr=/*@__PURE__*/ j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;F.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_r=/*@__PURE__*/ j(`$ZodCheckRegex`,(e,t)=>{gr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vr=/*@__PURE__*/ j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ar,gr.init(e,t)}),yr=/*@__PURE__*/ j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=or,gr.init(e,t)}),br=/*@__PURE__*/ j(`$ZodCheckIncludes`,(e,t)=>{F.init(e,t);let n=gt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),xr=/*@__PURE__*/ j(`$ZodCheckStartsWith`,(e,t)=>{F.init(e,t);let n=RegExp(`^${gt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Sr=/*@__PURE__*/ j(`$ZodCheckEndsWith`,(e,t)=>{F.init(e,t);let n=RegExp(`.*${gt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Cr=/*@__PURE__*/ j(`$ZodCheckOverwrite`,(e,t)=>{F.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var wr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
9
|
+
`)}function dn(e,t){return{callee:t?.callee??e,Err:t?.Err}}const fn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new M;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>D(e,o,P())));throw dt(n,a?.callee??t),n}return s.value};return t},pn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>D(e,o,P())));throw dt(n,a?.callee??t),n}return s.value};return t},mn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new M;return a.issues.length?hn(e,a.issues,i):{success:!0,data:a.value}};function hn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>D(e,n,P()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const gn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?hn(e,a.issues,i):{success:!0,data:a.value}},_n=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),vn=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),yn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==_n)return!0;if(r.definite===!0&&n===void 0)return!1}return bn(e,t,n)});function bn(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[vn]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new M;return a.issues.length===0}const xn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Sn=e=>{let t=fn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,dn(n,a))};return n},Cn=e=>{let t=fn(e),n=(e,r,i,a)=>t(e,r,i,dn(n,a));return n},wn=e=>{let t=pn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,dn(n,a))};return n},Tn=e=>{let t=pn(e),n=async(e,r,i,a)=>await t(e,r,i,dn(n,a));return n},En=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mn(e)(t,n,i)},Dn=e=>(t,n,r)=>mn(e)(t,n,r),On=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gn(e)(t,n,i)},kn=e=>async(t,n,r)=>gn(e)(t,n,r),An=/^[cC][0-9a-z]{6,}$/,jn=/^[0-9a-z]+$/,Mn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Nn=/^[0-9a-vA-V]{20}$/,Pn=/^[A-Za-z0-9]{27}$/,Fn=/^[a-zA-Z0-9_-]{21}$/;function In(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Ln=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,zn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Bn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Vn(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const Hn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Un=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Wn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Gn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Jn=/^https?$/,Yn=/^\+[1-9]\d{6,14}$/,Xn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Zn(e){return RegExp(`^${e}$`)}const Qn=/*@__PURE__*/ Zn(Xn);function $n(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function er(e){return RegExp(`^${$n(e)}$`)}function tr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${$n({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${$n({precision:e.precision})}`:n;return RegExp(`^${Xn}T(?:${r})$`)}const nr=/^[\s\S]{0,}$/,rr=/^-?\d+$/,ir=/^-?\d+(?:\.\d+)?$/,ar=/^[^A-Z]*$/,or=/^[^a-z]*$/,F=/*@__PURE__*/ j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sr=e=>{let t=e.value;return!nt(t)&&t.length!==void 0},cr={number:`number`,bigint:`bigint`,object:`date`},lr=/*@__PURE__*/ j(`$ZodCheckLessThan`,(e,t)=>{F.init(e,t);let n=cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:cr[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ur=/*@__PURE__*/ j(`$ZodCheckGreaterThan`,(e,t)=>{F.init(e,t);let n=cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:cr[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dr=/*@__PURE__*/ j(`$ZodCheckMultipleOf`,(e,t)=>{F.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):it(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),fr=/*@__PURE__*/ j(`$ZodCheckNumberFormat`,(e,t)=>{F.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=yt[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),pr=/*@__PURE__*/ j(`$ZodCheckMaxLength`,(e,t)=>{var n;F.init(e,t),(n=e._zod.def).when??(n.when=sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ft(r):i)<=t.maximum)return;let a=It(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mr=/*@__PURE__*/ j(`$ZodCheckMinLength`,(e,t)=>{var n;F.init(e,t),(n=e._zod.def).when??(n.when=sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ft(r):i)>=t.minimum)return;let a=It(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hr=/*@__PURE__*/ j(`$ZodCheckLengthEquals`,(e,t)=>{var n;F.init(e,t),(n=e._zod.def).when??(n.when=sr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ft(r):i;if(a===t.length)return;let o=It(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),gr=/*@__PURE__*/ j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;F.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_r=/*@__PURE__*/ j(`$ZodCheckRegex`,(e,t)=>{gr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vr=/*@__PURE__*/ j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ar,gr.init(e,t)}),yr=/*@__PURE__*/ j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=or,gr.init(e,t)}),br=/*@__PURE__*/ j(`$ZodCheckIncludes`,(e,t)=>{F.init(e,t);let n=gt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),xr=/*@__PURE__*/ j(`$ZodCheckStartsWith`,(e,t)=>{F.init(e,t);let n=RegExp(`^${gt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Sr=/*@__PURE__*/ j(`$ZodCheckEndsWith`,(e,t)=>{F.init(e,t);let n=RegExp(`.*${gt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Cr=/*@__PURE__*/ j(`$ZodCheckOverwrite`,(e,t)=>{F.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var wr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
10
10
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
11
11
|
`)}\n};`)(...Object.values(this.closed))}};const Tr={major:4,minor:6,patch:7},I=/*@__PURE__*/ j(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tr;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=T(t),a;for(let o of n){if(o._zod.def.when){if(At(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new M;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Nt(t.issues,n,e),i||=T(t,n))});else{if(t.issues.length===n)continue;Nt(t.issues,n,e),i||=T(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(T(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new M;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new M;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Bt(this,`~standard`,Or(this))},set"~standard"(e){O(this,`~standard`,e)}}),Er=(e,t)=>e.issues.length?{issues:e.issues.map(e=>D(e,t,P()))}:{value:e.value};async function Dr(e,t){let n={async:!0};return Er(await e._zod.run({value:t,issues:[]},n),n)}function Or(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Er(r,n)}catch{}return Dr(e,t)},vendor:`zod`,version:1}}const kr=/*@__PURE__*/ j(`$ZodString`,(e,t)=>{I.init(e,t),e._zod.pattern=t.pattern??nr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),L=/*@__PURE__*/ j(`$ZodStringFormat`,(e,t)=>{gr.init(e,t),kr.init(e,t)}),Ar=/*@__PURE__*/ j(`$ZodGUID`,(e,t)=>{t.pattern??=Rn,L.init(e,t)}),jr=/*@__PURE__*/ j(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=zn(e)}else t.pattern??=zn();L.init(e,t)}),Mr=/*@__PURE__*/ j(`$ZodEmail`,(e,t)=>{t.pattern??=Bn,L.init(e,t)});function Nr(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Pr(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Nr(e)||2:Fr(e,t)}function Fr(e,t){if(!t.normalize&&t.protocol?.source===Jn.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const Ir=/[\t\n\r]/g;function Lr(e){return e.replace(Ir,``)}function Rr(e,t){return t.lastIndex=0,t.test(e.hostname)}function zr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Br=/*@__PURE__*/ j(`$ZodURL`,(e,t)=>{L.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Pr(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Lr(r);return}t.hostname&&!Rr(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!zr(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Lr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Vr=/*@__PURE__*/ j(`$ZodEmoji`,(e,t)=>{t.pattern??=Vn(),L.init(e,t)}),Hr=/*@__PURE__*/ j(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Fn:In(t.length),L.init(e,t)}),Ur=/*@__PURE__*/ j(`$ZodCUID`,(e,t)=>{t.pattern??=An,L.init(e,t)}),Wr=/*@__PURE__*/ j(`$ZodCUID2`,(e,t)=>{t.pattern??=jn,L.init(e,t)}),Gr=/*@__PURE__*/ j(`$ZodULID`,(e,t)=>{t.pattern??=Mn,L.init(e,t)}),Kr=/*@__PURE__*/ j(`$ZodXID`,(e,t)=>{t.pattern??=Nn,L.init(e,t)}),qr=/*@__PURE__*/ j(`$ZodKSUID`,(e,t)=>{t.pattern??=Pn,L.init(e,t)}),Jr=/*@__PURE__*/ j(`$ZodISODateTime`,(e,t)=>{t.pattern??=tr(t),L.init(e,t)}),Yr=/*@__PURE__*/ j(`$ZodISODate`,(e,t)=>{t.pattern??=Qn,L.init(e,t)}),Xr=/*@__PURE__*/ j(`$ZodISOTime`,(e,t)=>{t.pattern??=er(t),L.init(e,t)}),Zr=/*@__PURE__*/ j(`$ZodISODuration`,(e,t)=>{t.pattern??=Ln,L.init(e,t)}),Qr=/*@__PURE__*/ j(`$ZodIPv4`,(e,t)=>{t.pattern??=Hn,L.init(e,t)}),$r=/^[0-9a-fA-F:.]+$/;function ei(e){return $r.test(e)?Nr(`http://[${e}]`):!1}const ti=/*@__PURE__*/ j(`$ZodIPv6`,(e,t)=>{t.pattern??=Un,L.init(e,t),e._zod.check=n=>{ei(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),ni=/*@__PURE__*/ j(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Wn,L.init(e,t)});function ri(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ei(n)}const ii=/*@__PURE__*/ j(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Gn,L.init(e,t),e._zod.check=n=>{ri(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function ai(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const oi=/^[0-9a-zA-Z+/]*={0,2}$/,si=/*@__PURE__*/ j(`$ZodBase64`,(e,t)=>{t.pattern??=oi,L.init(e,t),e._zod.check=n=>{ai(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),ci=/^[A-Za-z0-9_-]*$/;function li(e){if(!ci.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ai(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const ui=/*@__PURE__*/ j(`$ZodBase64URL`,(e,t)=>{t.pattern??=ci,L.init(e,t),e._zod.check=n=>{li(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),di=/*@__PURE__*/ j(`$ZodE164`,(e,t)=>{t.pattern??=Yn,L.init(e,t)});function fi(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const pi=/*@__PURE__*/ j(`$ZodJWT`,(e,t)=>{L.init(e,t),e._zod.check=n=>{fi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),mi=/*@__PURE__*/ j(`$ZodNumber`,(e,t)=>{I.init(e,t),e._zod.pattern=ir,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),hi=/*@__PURE__*/ j(`$ZodNumberFormat`,(e,t)=>{fr.init(e,t),mi.init(e,t)}),gi=/*@__PURE__*/ j(`$ZodUnknown`,(e,t)=>{I.init(e,t),e._zod.parse=e=>e}),_i=/*@__PURE__*/ j(`$ZodNever`,(e,t)=>{I.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function vi(e,t){let n=Mt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Mt(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Nt(n.issues,t,e),n}}return i(n,a)}}const yi=e=>Array.isArray(e)?e.length:-1;function bi(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}const xi=/*@__PURE__*/ j(`$ZodArray`,(e,t)=>{I.init(e,t);let n=N.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>bi(t,r,e)));else if(bi(c,r,e),s&&c.issues.length!==0&&T(c))break}return o.length?Promise.all(o).then(()=>r):r},vi(e,yi)});function Si(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...E(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const Ci=[];function wi(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ci,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=vt(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ti(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(T(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Si(e,n,i,t,d,f))):Si(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const Ei=/*@__PURE__*/ j(`$ZodObject`,(e,t)=>{I.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=tt(()=>wi(t));A(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||v(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=ft,o=t.catchall,s,c=N.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(T(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Si(n,t,e,r,a,o))):Si(s,t,e,r,a,o)}return o?Ti(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Di=/*@__PURE__*/ j(`$ZodObjectJIT`,(e,t)=>{Ei.init(e,t);let n=e._zod.parse,r=tt(()=>wi(t)),i=N.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new wr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
12
12
|
let ${e}_ab = false;
|