dsh-account-authorization 0.1.0
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/LICENSE +21 -0
- package/README.md +9 -0
- package/README.zh-CN.md +43 -0
- package/SECURITY.md +39 -0
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/cordis.patch.yml +5 -0
- package/lib/authorization-compat.js +52 -0
- package/lib/client.js +65 -0
- package/lib/client.js.map +1 -0
- package/lib/host.js +491 -0
- package/lib/index.js +548 -0
- package/lib/typert.host.js +369 -0
- package/lib/typert.remote-client.js +362 -0
- package/lib/types/authorization-compat.d.ts +18 -0
- package/lib/types/generated/host.d.ts +237 -0
- package/lib/types/generated/remote.d.ts +231 -0
- package/lib/types/host/index.d.ts +29 -0
- package/lib/types/index.d.ts +9 -0
- package/lib/types/types.d.ts +65 -0
- package/lib/types/types.js +1 -0
- package/package.json +146 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lxy271713
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# DSH Account Authorization
|
|
2
|
+
|
|
3
|
+
[简体中文](README.zh-CN.md) | English
|
|
4
|
+
|
|
5
|
+
`dsh-account-authorization` is a Provider-neutral DeepSeek Harness model-account sign-in plugin. It owns one native Settings → Model sign-in section and renders only the model authorization flows already registered by Harness. On a Harness build that projects committed authorization records into Provider routes, successful authorization activates the same route used by the IDE model selector. The plugin copies no credentials and owns no Provider catalog, model catalog, credential format, or Provider protocol.
|
|
6
|
+
|
|
7
|
+
The browser receives only sanitized connection state, sign-in URLs, device codes, and non-secret choices. OAuth tokens remain inside the Provider flow and Harness credentials service. Required text and secret prompts fail closed. An abortable manual fallback paired with a safe browser sign-in URL waits only inside the Host for the official callback; the fallback content is never rendered, accepted, or forwarded. API keys stay in the native Models editor, and API-key-only flows do not produce empty account cards.
|
|
8
|
+
|
|
9
|
+
The UI and authorization flow are validated against Harness `0.1.1-rc.2`. DSH Desktop 2.0.3 accepts a Flow's opaque `target` metadata but omits it from `list()` and `describe()`. When the profile has no authorization owner, this package mounts a compatibility subclass that restores only that projection while retaining the official service's flow, attempt, and credential behavior. An existing target-capable owner is reused; an incompatible legacy owner remains authoritative and the model list fails closed instead of creating a second service. Remove this compatibility entry once Desktop ships the upstream projection implemented by Harness commit `732a504`. Direct model-route activation still requires that authorized-route projection in the LLM adapter. See [README.zh-CN.md](README.zh-CN.md) for installation, boundaries, and compatibility details.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# DSH 账号连接
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
`dsh-account-authorization` 是 DeepSeek Harness 的 Provider-neutral 模型账号登录插件。它拥有原生“设置 → 模型登录”入口,只显示当前 Harness 已注册的模型授权流程。在具备“授权记录投影为 Provider 路线”能力的 Harness 构建中,授权成功后同一个 Provider 路线直接供 IDE 模型选择器调用;插件不复制凭证、不维护 Provider 名单、不创建模型目录,也不实现任何 Provider 协议。
|
|
6
|
+
|
|
7
|
+
## 边界
|
|
8
|
+
|
|
9
|
+
- Harness `ctx.authorization` 是授权流程和状态的唯一事实来源。
|
|
10
|
+
- Provider 自己的 Flow 是凭证唯一写入者;本插件从不读取或返回 OAuth Token。
|
|
11
|
+
- 浏览器只接收脱敏连接状态、官方登录 URL、设备验证码和非敏感选择项。
|
|
12
|
+
- 要求用户输入文本或秘密的流程会被安全拒绝;浏览器登录附带的可取消手动回退只在 Host 内等待官方回调,不显示、不接收也不转发回退内容。API 密钥继续在原生“模型”页输入。
|
|
13
|
+
- 账号页只投影至少提供一种非 `api-key` 授权方法的 Flow;仅支持 API Key 的 Provider 不会生成空账号卡。
|
|
14
|
+
- “移除本机连接”只调用 Harness credentials 的删除接口,不宣称远端授权已撤销。
|
|
15
|
+
- 请求幂等记录只在当前 Host 进程的有限保留窗口内有效;重启或记录淘汰后,旧请求 ID 不再提供去重保证。
|
|
16
|
+
- 插件内的登录和移除会互斥;Harness `0.1.1-rc.2` 没有跨设置界面的凭证 CAS,因此其他界面直接发起授权时仍可能与移除竞争,真实账号操作应保持单一入口。
|
|
17
|
+
- 插件只增加一个原生设置 section,不替换设置外壳、模型页或 Provider/模型目录,也不使用 DOM Patch、固定端口、固定路径或按钮坐标。
|
|
18
|
+
|
|
19
|
+
## 兼容性
|
|
20
|
+
|
|
21
|
+
账号页与授权流程已在 Harness `0.1.1-rc.2` 上验收。DSH Desktop 2.0.3 会接收 Flow 的 `target`,但从 `list()` 和 `describe()` 输出中丢弃它。Profile 尚无授权服务时,本包挂载一个兼容子类,只恢复这项不透明元数据投影,其余 Flow、尝试和凭证行为继续使用官方服务实现;已有支持投影的授权服务时直接复用;已有不支持投影的旧服务时保持其唯一所有权,并安全隐藏模型账号,不创建第二个服务。Desktop 正式包含核心提交 `732a504` 的投影修复后,应删除这个兼容入口。登录后直接激活模型路线仍要求 LLM Adapter 包含 authorized-route projection。其他 Desktop 或 Harness 版本尚未验收。
|
|
22
|
+
|
|
23
|
+
兼容入口不维护第二份 Flow、凭证、Provider 或模型目录;它在单一 `authorization` 服务中保存 Connector 注册时附带的 `target`,并把该字段原样补回只读条目。缺少 `target` 或目标类型未知的 Flow 会安全隐藏,不会作为模型账号启动或移除。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
发布后使用官方 Profile Bundle 命令安装:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
dsh plugin --profile desktop add dsh-account-authorization@0.1.0
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
重启该 Profile 后生效。卸载:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
dsh plugin --profile desktop remove dsh-account-authorization
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
该包也会作为 Provider Connector 的运行依赖安装。普通用户应优先安装具体 Connector;只有开发其他账号 Connector 或单独验收通用账号界面时,才需要直接安装本包。
|
|
40
|
+
|
|
41
|
+
## Provider 支持
|
|
42
|
+
|
|
43
|
+
代码没有支持名单。OpenAI、Kimi、xAI/Grok、Anthropic 或后续 Connector 是否出现,只取决于当前 Harness 组合是否注册了授权 Flow。GLM/Z.ai 若只提供 API Key/套餐 Key,则仍属于原生“模型”页,不会被伪装成账号 OAuth。
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
The current release is supported only with the exact Harness peer versions listed
|
|
6
|
+
in `package.json`. It has been exercised with the Harness `0.1.1-rc.2` runtime
|
|
7
|
+
shipped by DSH Desktop 2.0.2 and 2.0.3. Other combinations are unverified.
|
|
8
|
+
|
|
9
|
+
## Reporting a vulnerability
|
|
10
|
+
|
|
11
|
+
Before source or package artifacts are published, the owners must create the
|
|
12
|
+
public GitHub repository, enable GitHub Private Vulnerability Reporting, and
|
|
13
|
+
verify its entry point from an account that does not administer the repository.
|
|
14
|
+
Once enabled, use **Security → Report a vulnerability** in the repository. Do
|
|
15
|
+
not open a public issue for suspected credential exposure.
|
|
16
|
+
|
|
17
|
+
Describe the affected version, observable behavior, minimal reproduction, and
|
|
18
|
+
security impact. Redact tokens, cookies, device codes, account identifiers,
|
|
19
|
+
private callback URLs, local paths, and credential-file contents. Maintainers
|
|
20
|
+
may request additional sanitized diagnostics through the private report.
|
|
21
|
+
|
|
22
|
+
## Security boundaries
|
|
23
|
+
|
|
24
|
+
- OAuth tokens remain inside the Provider flow and Harness credentials service.
|
|
25
|
+
- Browser RPC exposes only sanitized state, Provider-flow-supplied URLs that
|
|
26
|
+
pass scheme validation, device codes, and non-secret choices.
|
|
27
|
+
- Required secret or arbitrary-text prompts fail closed.
|
|
28
|
+
- Credential removal uses the Harness credentials interface and does not claim
|
|
29
|
+
to revoke a remote authorization grant.
|
|
30
|
+
- The plugin does not scan credential files or infer authentication from token
|
|
31
|
+
contents.
|
|
32
|
+
- Provider protocols and model discovery remain owned by their Provider
|
|
33
|
+
plugins.
|
|
34
|
+
- Installed Provider and adapter plugins are trusted code. This plugin does not
|
|
35
|
+
sandbox them or verify that a supplied URL belongs to an official Provider
|
|
36
|
+
domain.
|
|
37
|
+
|
|
38
|
+
If credential material is accidentally committed, treat it as compromised and
|
|
39
|
+
rotate it through the owning Provider before rewriting repository history.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This project is designed for the MIT-licensed [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin API and uses its published packages as peer dependencies.
|
|
4
|
+
|
|
5
|
+
The standalone Typert generation and browser-bundle build layout was adapted from the MIT-licensed [dsh-AuthInOne](https://github.com/Stormycry-cryp/dsh-AuthInOne) project by Stormycry-cryp. No Provider protocol implementation, credential store, installer, fixed-port process control, or vendored Settings owner was copied.
|
|
6
|
+
|
|
7
|
+
## dsh-AuthInOne
|
|
8
|
+
|
|
9
|
+
MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Stormycry-cryp
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import AuthorizationService from "@deepseek-ai/dsh-authorization";
|
|
2
|
+
//#region ../lib/types/authorization-compat.js
|
|
3
|
+
/**
|
|
4
|
+
* DSH Desktop 2.0.3 compatibility service.
|
|
5
|
+
*
|
|
6
|
+
* Its bundled authorization service accepts flow metadata but drops it from
|
|
7
|
+
* list()/describe(). Preserve that opaque metadata while leaving flow,
|
|
8
|
+
* credential, and attempt ownership with the Harness authorization service.
|
|
9
|
+
*/
|
|
10
|
+
var TargetPreservingAuthorizationService = class extends AuthorizationService {
|
|
11
|
+
targets = /* @__PURE__ */ new Map();
|
|
12
|
+
registerFlow(flow) {
|
|
13
|
+
const disposeFlow = super.registerFlow(flow);
|
|
14
|
+
const target = "target" in flow ? flow.target : void 0;
|
|
15
|
+
if (target === void 0) {
|
|
16
|
+
this.targets.delete(flow.key);
|
|
17
|
+
return disposeFlow;
|
|
18
|
+
}
|
|
19
|
+
let disposeTarget;
|
|
20
|
+
try {
|
|
21
|
+
disposeTarget = this.ctx.effect(() => {
|
|
22
|
+
this.targets.set(flow.key, target);
|
|
23
|
+
return () => {
|
|
24
|
+
if (this.targets.get(flow.key) === target) this.targets.delete(flow.key);
|
|
25
|
+
};
|
|
26
|
+
}, "account-authorization: project flow target");
|
|
27
|
+
} catch (error) {
|
|
28
|
+
disposeFlow();
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
return () => {
|
|
32
|
+
try {
|
|
33
|
+
disposeTarget();
|
|
34
|
+
} finally {
|
|
35
|
+
disposeFlow();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
list() {
|
|
40
|
+
return super.list().map((entry) => this.projectTarget(entry));
|
|
41
|
+
}
|
|
42
|
+
describe(key) {
|
|
43
|
+
const entry = super.describe(key);
|
|
44
|
+
return entry === void 0 ? void 0 : this.projectTarget(entry);
|
|
45
|
+
}
|
|
46
|
+
projectTarget(entry) {
|
|
47
|
+
const target = this.targets.get(entry.key);
|
|
48
|
+
return target === void 0 ? entry : Object.assign({}, entry, { target });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { TargetPreservingAuthorizationService, TargetPreservingAuthorizationService as default };
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({id:`dsh-account-authorization`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e(`react`),i=e(`react/jsx-runtime`);var a;function o(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var s=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},c=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(a=globalThis).__zod_globalConfig??(a.__zod_globalConfig={});let l=globalThis.__zod_globalConfig;function u(e){return e&&Object.assign(l,e),l}function d(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 f(e,t){return typeof t==`bigint`?t.toString():t}function p(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function m(e){return e==null}function h(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function g(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let _=Symbol(`evaluating`);function v(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_)return r===void 0&&(r=_,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function y(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function b(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ee(e){return JSON.stringify(e)}function te(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let ne=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let re=p(()=>{if(l.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function S(e){if(x(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(x(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ie(e){return S(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let ae=new Set([`string`,`number`,`symbol`]);function C(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function w(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function T(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 oe(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let se={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ce(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`);return w(e,b(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return y(this,`shape`,e),e},checks:[]}))}function le(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`);return w(e,b(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return y(this,`shape`,r),r},checks:[]}))}function ue(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=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y(this,`shape`,n),n}}))}function de(e,t){if(!S(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return y(this,`shape`,n),n}}))}function fe(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return w(e,b(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return y(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function pe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return w(t,b(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return y(this,`shape`,i),i},checks:[]}))}function me(e,t,n){return w(t,b(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return y(this,`shape`,i),i}}))}function E(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 he(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 ge(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function D(e){return typeof e==`string`?e:e?.message}function O(e,t,n){let r=e.message?e.message:D(e.inst?._zod.def?.error?.(e))??D(t?.error?.(e))??D(n.customError?.(e))??D(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function _e(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function k(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let ve=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,f,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ye=o(`$ZodError`,ve),be=o(`$ZodError`,ve,{Parent:Error});function xe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Se(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];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}let Ce=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new s;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>O(e,a,u())));throw ne(t,i?.callee),t}return o.value},we=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>O(e,a,u())));throw ne(t,i?.callee),t}return o.value},Te=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 s;return a.issues.length?{success:!1,error:new(e??ye)(a.issues.map(e=>O(e,i,u())))}:{success:!0,data:a.value}},Ee=Te(be),De=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?{success:!1,error:new e(a.issues.map(e=>O(e,i,u())))}:{success:!0,data:a.value}},Oe=De(be),ke=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ce(e)(t,n,i)},Ae=e=>(t,n,r)=>Ce(e)(t,n,r),je=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return we(e)(t,n,i)},Me=e=>async(t,n,r)=>we(e)(t,n,r),Ne=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Te(e)(t,n,i)},Pe=e=>(t,n,r)=>Te(e)(t,n,r),Fe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return De(e)(t,n,i)},Ie=e=>async(t,n,r)=>De(e)(t,n,r),Le=/^[cC][0-9a-z]{6,}$/,Re=/^[0-9a-z]+$/,ze=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Be=/^[0-9a-vA-V]{20}$/,Ve=/^[A-Za-z0-9]{27}$/,He=/^[a-zA-Z0-9_-]{21}$/,Ue=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,We=/^([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})$/,Ge=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)$/,Ke=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function qe(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let Je=/^(?:(?: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])$/,Ye=/^(([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}|:))$/,Xe=/^((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])$/,Ze=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$e=/^[A-Za-z0-9_-]*$/,et=/^https?$/,tt=/^\+[1-9]\d{6,14}$/,nt=`(?:(?:\\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])))`,rt=RegExp(`^${nt}$`);function it(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function at(e){return RegExp(`^${it(e)}$`)}function ot(e){let t=it({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${nt}T(?:${r})$`)}let st=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ct=/^-?\d+$/,lt=/^-?\d+(?:\.\d+)?$/,ut=/^(?:true|false)$/i,dt=/^undefined$/i,ft=/^[^A-Z]*$/,pt=/^[^a-z]*$/,A=o(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),mt={number:`number`,bigint:`bigint`,object:`date`},ht=o(`$ZodCheckLessThan`,(e,t)=>{A.init(e,t);let n=mt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin: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})}}),gt=o(`$ZodCheckGreaterThan`,(e,t)=>{A.init(e,t);let n=mt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin: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})}}),_t=o(`$ZodCheckMultipleOf`,(e,t)=>{A.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),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`?n.value%t.value===BigInt(0):g(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})}}),vt=o(`$ZodCheckNumberFormat`,(e,t)=>{A.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=se[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ct)}),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})}}),yt=o(`$ZodCheckMaxLength`,(e,t)=>{var n;A.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!m(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=_e(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bt=o(`$ZodCheckMinLength`,(e,t)=>{var n;A.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!m(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=_e(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xt=o(`$ZodCheckLengthEquals`,(e,t)=>{var n;A.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!m(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=_e(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),j=o(`$ZodCheckStringFormat`,(e,t)=>{var n,r;A.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),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=()=>{})}),St=o(`$ZodCheckRegex`,(e,t)=>{j.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})}}),Ct=o(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ft,j.init(e,t)}),wt=o(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=pt,j.init(e,t)}),Tt=o(`$ZodCheckIncludes`,(e,t)=>{A.init(e,t);let n=C(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),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})}}),Et=o(`$ZodCheckStartsWith`,(e,t)=>{A.init(e,t);let n=RegExp(`^${C(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),Dt=o(`$ZodCheckEndsWith`,(e,t)=>{A.init(e,t);let n=RegExp(`.*${C(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),Ot=o(`$ZodCheckOverwrite`,(e,t)=>{A.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var kt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
`).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?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
3
|
+
`))}};let At={major:4,minor:4,patch:3},M=o(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=At;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=E(e),i;for(let a of t){if(a._zod.def.when){if(he(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new s;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=E(e,t))});else{if(e.issues.length===t)continue;r||=E(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(E(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new s;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new s;return o.then(e=>t(e,r,a))}return t(o,r,a)}}v(e,`~standard`,()=>({validate:t=>{try{let n=Ee(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Oe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),jt=o(`$ZodString`,(e,t)=>{M.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??st(e._zod.bag),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}}),N=o(`$ZodStringFormat`,(e,t)=>{j.init(e,t),jt.init(e,t)}),Mt=o(`$ZodGUID`,(e,t)=>{t.pattern??=We,N.init(e,t)}),Nt=o(`$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??=Ge(e)}else t.pattern??=Ge();N.init(e,t)}),Pt=o(`$ZodEmail`,(e,t)=>{t.pattern??=Ke,N.init(e,t)}),Ft=o(`$ZodURL`,(e,t)=>{N.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===et.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),It=o(`$ZodEmoji`,(e,t)=>{t.pattern??=qe(),N.init(e,t)}),Lt=o(`$ZodNanoID`,(e,t)=>{t.pattern??=He,N.init(e,t)}),Rt=o(`$ZodCUID`,(e,t)=>{t.pattern??=Le,N.init(e,t)}),zt=o(`$ZodCUID2`,(e,t)=>{t.pattern??=Re,N.init(e,t)}),Bt=o(`$ZodULID`,(e,t)=>{t.pattern??=ze,N.init(e,t)}),Vt=o(`$ZodXID`,(e,t)=>{t.pattern??=Be,N.init(e,t)}),Ht=o(`$ZodKSUID`,(e,t)=>{t.pattern??=Ve,N.init(e,t)}),Ut=o(`$ZodISODateTime`,(e,t)=>{t.pattern??=ot(t),N.init(e,t)}),Wt=o(`$ZodISODate`,(e,t)=>{t.pattern??=rt,N.init(e,t)}),Gt=o(`$ZodISOTime`,(e,t)=>{t.pattern??=at(t),N.init(e,t)}),Kt=o(`$ZodISODuration`,(e,t)=>{t.pattern??=Ue,N.init(e,t)}),qt=o(`$ZodIPv4`,(e,t)=>{t.pattern??=Je,N.init(e,t),e._zod.bag.format=`ipv4`}),Jt=o(`$ZodIPv6`,(e,t)=>{t.pattern??=Ye,N.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Yt=o(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Xe,N.init(e,t)}),Xt=o(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ze,N.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Zt(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Qt=o(`$ZodBase64`,(e,t)=>{t.pattern??=Qe,N.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Zt(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function $t(e){if(!$e.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Zt(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let en=o(`$ZodBase64URL`,(e,t)=>{t.pattern??=$e,N.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{$t(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),tn=o(`$ZodE164`,(e,t)=>{t.pattern??=tt,N.init(e,t)});function nn(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}}let rn=o(`$ZodJWT`,(e,t)=>{N.init(e,t),e._zod.check=n=>{nn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),an=o(`$ZodNumber`,(e,t)=>{M.init(e,t),e._zod.pattern=e._zod.bag.pattern??lt,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),on=o(`$ZodNumberFormat`,(e,t)=>{vt.init(e,t),an.init(e,t)}),sn=o(`$ZodBoolean`,(e,t)=>{M.init(e,t),e._zod.pattern=ut,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),cn=o(`$ZodUndefined`,(e,t)=>{M.init(e,t),e._zod.pattern=dt,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),ln=o(`$ZodUnknown`,(e,t)=>{M.init(e,t),e._zod.parse=e=>e}),un=o(`$ZodNever`,(e,t)=>{M.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function dn(e,t,n){e.issues.length&&t.issues.push(...ge(n,e.issues)),t.value[n]=e.value}let fn=o(`$ZodArray`,(e,t)=>{M.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>dn(t,n,e))):dn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function P(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...ge(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function pn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=oe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function mn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>P(e,n,i,t,u,d))):P(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let hn=o(`$ZodObject`,(e,t)=>{if(M.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=p(()=>pn(t));v(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=x,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>P(n,t,e,s,r,i))):P(a,t,e,s,r,i)}return i?mn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),gn=o(`$ZodObjectJIT`,(e,t)=>{hn.init(e,t);let n=e._zod.parse,r=p(()=>pn(t)),i=e=>{let t=new kt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ee(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ee(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
4
|
+
if (${n}.issues.length) {
|
|
5
|
+
if (${o} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${n}.value === undefined) {
|
|
14
|
+
if (${o} in input) {
|
|
15
|
+
newResult[${o}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${o}] = ${n}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):c?t.write(`
|
|
22
|
+
if (${n}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${n}.value === undefined) {
|
|
30
|
+
if (${o} in input) {
|
|
31
|
+
newResult[${o}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${o}] = ${n}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`):t.write(`
|
|
38
|
+
const ${n}_present = ${o} in input;
|
|
39
|
+
if (${n}.issues.length) {
|
|
40
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
41
|
+
...iss,
|
|
42
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
46
|
+
payload.issues.push({
|
|
47
|
+
code: "invalid_type",
|
|
48
|
+
expected: "nonoptional",
|
|
49
|
+
input: undefined,
|
|
50
|
+
path: [${o}]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (${n}_present) {
|
|
55
|
+
if (${n}.value === undefined) {
|
|
56
|
+
newResult[${o}] = undefined;
|
|
57
|
+
} else {
|
|
58
|
+
newResult[${o}] = ${n}.value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=x,s=!l.jitless,c=s&&re.value,u=t.catchall,d;e._zod.parse=(l,f)=>{d??=r.value;let p=l.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),l=a(l,f),u?mn([],p,l,f,d,e):l):n(l,f):(l.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),l)}});function _n(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!E(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>O(e,r,u())))}),t)}let vn=o(`$ZodUnion`,(e,t)=>{M.init(e,t),v(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),v(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),v(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),v(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>h(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>_n(t,r,e,i)):_n(o,r,e,i)}}),yn=o(`$ZodIntersection`,(e,t)=>{M.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xn(e,t,n)):xn(e,i,a)}});function bn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(S(e)&&S(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=bn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),E(e))return e;let o=bn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let Sn=o(`$ZodEnum`,(e,t)=>{M.init(e,t);let n=d(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ae.has(typeof e)).map(e=>typeof e==`string`?C(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Cn=o(`$ZodLiteral`,(e,t)=>{if(M.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?C(e):e?C(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),wn=o(`$ZodTransform`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new c(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new s;return n.value=i,n.fallback=!0,n}});function Tn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let En=o(`$ZodOptional`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,v(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),v(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${h(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Tn(e,r)):Tn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Dn=o(`$ZodExactOptional`,(e,t)=>{En.init(e,t),v(e._zod,`values`,()=>t.innerType._zod.values),v(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),On=o(`$ZodNullable`,(e,t)=>{M.init(e,t),v(e._zod,`optin`,()=>t.innerType._zod.optin),v(e._zod,`optout`,()=>t.innerType._zod.optout),v(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${h(e.source)}|null)$`):void 0}),v(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),kn=o(`$ZodDefault`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,v(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>An(e,t)):An(r,t)}});function An(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let jn=o(`$ZodPrefault`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,v(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Mn=o(`$ZodNonOptional`,(e,t)=>{M.init(e,t),v(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Nn(t,e)):Nn(i,e)}});function Nn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let Pn=o(`$ZodCatch`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,v(e._zod,`optout`,()=>t.innerType._zod.optout),v(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>O(e,n,u()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>O(e,n,u()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Fn=o(`$ZodPipe`,(e,t)=>{M.init(e,t),v(e._zod,`values`,()=>t.in._zod.values),v(e._zod,`optin`,()=>t.in._zod.optin),v(e._zod,`optout`,()=>t.out._zod.optout),v(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>F(e,t.in,n)):F(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>F(e,t.out,n)):F(r,t.out,n)}});function F(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let In=o(`$ZodReadonly`,(e,t)=>{M.init(e,t),v(e._zod,`propValues`,()=>t.innerType._zod.propValues),v(e._zod,`values`,()=>t.innerType._zod.values),v(e._zod,`optin`,()=>t.innerType?._zod?.optin),v(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ln):Ln(r)}});function Ln(e){return e.value=Object.freeze(e.value),e}let Rn=o(`$ZodCustom`,(e,t)=>{A.init(e,t),M.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>zn(t,n,r,e));zn(i,n,r,e)}});function zn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(k(e))}}var Bn,Vn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Hn(){return new Vn}(Bn=globalThis).__zod_globalRegistry??(Bn.__zod_globalRegistry=Hn());let I=globalThis.__zod_globalRegistry;function Un(e,t){return new e({type:`string`,...T(t)})}function Wn(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...T(t)})}function Gn(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...T(t)})}function Kn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...T(t)})}function qn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...T(t)})}function Jn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...T(t)})}function Yn(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...T(t)})}function Xn(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...T(t)})}function Zn(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...T(t)})}function Qn(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...T(t)})}function $n(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...T(t)})}function er(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...T(t)})}function tr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...T(t)})}function nr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...T(t)})}function rr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...T(t)})}function ir(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...T(t)})}function ar(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...T(t)})}function or(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...T(t)})}function sr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...T(t)})}function cr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...T(t)})}function lr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...T(t)})}function ur(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...T(t)})}function dr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...T(t)})}function fr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...T(t)})}function pr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...T(t)})}function mr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...T(t)})}function hr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...T(t)})}function gr(e,t){return new e({type:`number`,checks:[],...T(t)})}function _r(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...T(t)})}function vr(e,t){return new e({type:`boolean`,...T(t)})}function yr(e,t){return new e({type:`undefined`,...T(t)})}function br(e){return new e({type:`unknown`})}function xr(e,t){return new e({type:`never`,...T(t)})}function Sr(e,t){return new ht({check:`less_than`,...T(t),value:e,inclusive:!1})}function Cr(e,t){return new ht({check:`less_than`,...T(t),value:e,inclusive:!0})}function wr(e,t){return new gt({check:`greater_than`,...T(t),value:e,inclusive:!1})}function Tr(e,t){return new gt({check:`greater_than`,...T(t),value:e,inclusive:!0})}function Er(e,t){return new _t({check:`multiple_of`,...T(t),value:e})}function Dr(e,t){return new yt({check:`max_length`,...T(t),maximum:e})}function L(e,t){return new bt({check:`min_length`,...T(t),minimum:e})}function Or(e,t){return new xt({check:`length_equals`,...T(t),length:e})}function kr(e,t){return new St({check:`string_format`,format:`regex`,...T(t),pattern:e})}function Ar(e){return new Ct({check:`string_format`,format:`lowercase`,...T(e)})}function jr(e){return new wt({check:`string_format`,format:`uppercase`,...T(e)})}function Mr(e,t){return new Tt({check:`string_format`,format:`includes`,...T(t),includes:e})}function Nr(e,t){return new Et({check:`string_format`,format:`starts_with`,...T(t),prefix:e})}function Pr(e,t){return new Dt({check:`string_format`,format:`ends_with`,...T(t),suffix:e})}function R(e){return new Ot({check:`overwrite`,tx:e})}function Fr(e){return R(t=>t.normalize(e))}function Ir(){return R(e=>e.trim())}function Lr(){return R(e=>e.toLowerCase())}function Rr(){return R(e=>e.toUpperCase())}function zr(){return R(e=>te(e))}function Br(e,t,n){return new e({type:`array`,element:t,...T(n)})}function Vr(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...T(n)})}function Hr(e,t){let n=Ur(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(k(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(k(r))}},e(t.value,t)),t);return n}function Ur(e,t){let n=new A({check:`custom`,...T(t)});return n._zod.check=e,n}function Wr(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??I,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function z(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,z(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&B(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Gr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
63
|
+
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Kr(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:V(t,`input`,e.processors),output:V(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function B(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return B(r.element,n);if(r.type===`set`)return B(r.valueType,n);if(r.type===`lazy`)return B(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return B(r.innerType,n);if(r.type===`intersection`)return B(r.left,n)||B(r.right,n);if(r.type===`record`||r.type===`map`)return B(r.keyType,n)||B(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:B(r.in,n)||B(r.out,n);if(r.type===`object`){for(let e in r.shape)if(B(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(B(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(B(e,n))return!0;return!!(r.rest&&B(r.rest,n))}return!1}let qr=(e,t={})=>n=>{let r=Wr({...n,processors:t});return z(e,r),Gr(r,e),Kr(r,e)},V=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Wr({...i??{},target:a,io:t,processors:n});return z(e,o),Gr(o,e),Kr(o,e)},Jr={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Yr=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Jr[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Xr=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Zr=(e,t,n,r)=>{n.type=`boolean`},Qr=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},$r=(e,t,n,r)=>{n.not={}},ei=(e,t,n,r)=>{let i=e._zod.def,a=d(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ti=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},ni=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ri=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ii=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=z(a.element,t,{...r,path:[...r.path,`items`]})},ai=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=z(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=z(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},oi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>z(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},si=(e,t,n,r)=>{let i=e._zod.def,a=z(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=z(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ci=(e,t,n,r)=>{let i=e._zod.def,a=z(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},li=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ui=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},di=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},fi=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},pi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;z(o,t,r);let s=t.seen.get(e);s.ref=o},mi=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},hi=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},gi=o(`ZodISODateTime`,(e,t)=>{Ut.init(e,t),K.init(e,t)});function _i(e){return fr(gi,e)}let vi=o(`ZodISODate`,(e,t)=>{Wt.init(e,t),K.init(e,t)});function yi(e){return pr(vi,e)}let bi=o(`ZodISOTime`,(e,t)=>{Gt.init(e,t),K.init(e,t)});function xi(e){return mr(bi,e)}let Si=o(`ZodISODuration`,(e,t)=>{Kt.init(e,t),K.init(e,t)});function Ci(e){return hr(Si,e)}let H=o(`ZodError`,(e,t)=>{ye.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Se(e,t)},flatten:{value:t=>xe(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,f,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,f,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),wi=Ce(H),Ti=we(H),Ei=Te(H),Di=De(H),Oi=ke(H),ki=Ae(H),Ai=je(H),ji=Me(H),Mi=Ne(H),Ni=Pe(H),Pi=Fe(H),Fi=Ie(H),Ii=new WeakMap;function U(e,t,n){let r=Object.getPrototypeOf(e),i=Ii.get(r);if(i||(i=new Set,Ii.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let W=o(`ZodType`,(e,t)=>(M.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:V(e,`input`),output:V(e,`output`)}}),e.toJSONSchema=qr(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>wi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ei(e,t,n),e.parseAsync=async(t,n)=>Ti(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Di(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Oi(e,t,n),e.decode=(t,n)=>ki(e,t,n),e.encodeAsync=async(t,n)=>Ai(e,t,n),e.decodeAsync=async(t,n)=>ji(e,t,n),e.safeEncode=(t,n)=>Mi(e,t,n),e.safeDecode=(t,n)=>Ni(e,t,n),e.safeEncodeAsync=async(t,n)=>Pi(e,t,n),e.safeDecodeAsync=async(t,n)=>Fi(e,t,n),U(e,`ZodType`,{check(...e){let t=this.def;return this.clone(b(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return w(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ua(e,t))},superRefine(e,t){return this.check(Wa(e,t))},overwrite(e){return this.check(R(e))},optional(){return Ta(this)},exactOptional(){return Da(this)},nullable(){return ka(this)},nullish(){return Ta(ka(this))},nonoptional(e){return Fa(this,e)},array(){return Y(this)},or(e){return Z([this,e])},and(e){return va(this,e)},transform(e){return za(this,Ca(e))},default(e){return ja(this,e)},prefault(e){return Na(this,e)},catch(e){return La(this,e)},pipe(e){return za(this,e)},readonly(){return Va(this)},describe(e){let t=this.clone();return I.add(t,{description:e}),t},meta(...e){if(e.length===0)return I.get(this);let t=this.clone();return I.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return I.get(e)?.description},configurable:!0}),e)),Li=o(`_ZodString`,(e,t)=>{jt.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yr(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,U(e,`_ZodString`,{regex(...e){return this.check(kr(...e))},includes(...e){return this.check(Mr(...e))},startsWith(...e){return this.check(Nr(...e))},endsWith(...e){return this.check(Pr(...e))},min(...e){return this.check(L(...e))},max(...e){return this.check(Dr(...e))},length(...e){return this.check(Or(...e))},nonempty(...e){return this.check(L(1,...e))},lowercase(e){return this.check(Ar(e))},uppercase(e){return this.check(jr(e))},trim(){return this.check(Ir())},normalize(...e){return this.check(Fr(...e))},toLowerCase(){return this.check(Lr())},toUpperCase(){return this.check(Rr())},slugify(){return this.check(zr())}})}),Ri=o(`ZodString`,(e,t)=>{jt.init(e,t),Li.init(e,t),e.email=t=>e.check(Wn(zi,t)),e.url=t=>e.check(Xn(Hi,t)),e.jwt=t=>e.check(dr(ra,t)),e.emoji=t=>e.check(Zn(Ui,t)),e.guid=t=>e.check(Gn(Bi,t)),e.uuid=t=>e.check(Kn(Vi,t)),e.uuidv4=t=>e.check(qn(Vi,t)),e.uuidv6=t=>e.check(Jn(Vi,t)),e.uuidv7=t=>e.check(Yn(Vi,t)),e.nanoid=t=>e.check(Qn(Wi,t)),e.guid=t=>e.check(Gn(Bi,t)),e.cuid=t=>e.check($n(Gi,t)),e.cuid2=t=>e.check(er(Ki,t)),e.ulid=t=>e.check(tr(qi,t)),e.base64=t=>e.check(cr(ea,t)),e.base64url=t=>e.check(lr(ta,t)),e.xid=t=>e.check(nr(Ji,t)),e.ksuid=t=>e.check(rr(Yi,t)),e.ipv4=t=>e.check(ir(Xi,t)),e.ipv6=t=>e.check(ar(Zi,t)),e.cidrv4=t=>e.check(or(Qi,t)),e.cidrv6=t=>e.check(sr($i,t)),e.e164=t=>e.check(ur(na,t)),e.datetime=t=>e.check(_i(t)),e.date=t=>e.check(yi(t)),e.time=t=>e.check(xi(t)),e.duration=t=>e.check(Ci(t))});function G(e){return Un(Ri,e)}let K=o(`ZodStringFormat`,(e,t)=>{N.init(e,t),Li.init(e,t)}),zi=o(`ZodEmail`,(e,t)=>{Pt.init(e,t),K.init(e,t)}),Bi=o(`ZodGUID`,(e,t)=>{Mt.init(e,t),K.init(e,t)}),Vi=o(`ZodUUID`,(e,t)=>{Nt.init(e,t),K.init(e,t)}),Hi=o(`ZodURL`,(e,t)=>{Ft.init(e,t),K.init(e,t)}),Ui=o(`ZodEmoji`,(e,t)=>{It.init(e,t),K.init(e,t)}),Wi=o(`ZodNanoID`,(e,t)=>{Lt.init(e,t),K.init(e,t)}),Gi=o(`ZodCUID`,(e,t)=>{Rt.init(e,t),K.init(e,t)}),Ki=o(`ZodCUID2`,(e,t)=>{zt.init(e,t),K.init(e,t)}),qi=o(`ZodULID`,(e,t)=>{Bt.init(e,t),K.init(e,t)}),Ji=o(`ZodXID`,(e,t)=>{Vt.init(e,t),K.init(e,t)}),Yi=o(`ZodKSUID`,(e,t)=>{Ht.init(e,t),K.init(e,t)}),Xi=o(`ZodIPv4`,(e,t)=>{qt.init(e,t),K.init(e,t)}),Zi=o(`ZodIPv6`,(e,t)=>{Jt.init(e,t),K.init(e,t)}),Qi=o(`ZodCIDRv4`,(e,t)=>{Yt.init(e,t),K.init(e,t)}),$i=o(`ZodCIDRv6`,(e,t)=>{Xt.init(e,t),K.init(e,t)}),ea=o(`ZodBase64`,(e,t)=>{Qt.init(e,t),K.init(e,t)}),ta=o(`ZodBase64URL`,(e,t)=>{en.init(e,t),K.init(e,t)}),na=o(`ZodE164`,(e,t)=>{tn.init(e,t),K.init(e,t)}),ra=o(`ZodJWT`,(e,t)=>{rn.init(e,t),K.init(e,t)}),ia=o(`ZodNumber`,(e,t)=>{an.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xr(e,t,n,r),U(e,`ZodNumber`,{gt(e,t){return this.check(wr(e,t))},gte(e,t){return this.check(Tr(e,t))},min(e,t){return this.check(Tr(e,t))},lt(e,t){return this.check(Sr(e,t))},lte(e,t){return this.check(Cr(e,t))},max(e,t){return this.check(Cr(e,t))},int(e){return this.check(oa(e))},safe(e){return this.check(oa(e))},positive(e){return this.check(wr(0,e))},nonnegative(e){return this.check(Tr(0,e))},negative(e){return this.check(Sr(0,e))},nonpositive(e){return this.check(Cr(0,e))},multipleOf(e,t){return this.check(Er(e,t))},step(e,t){return this.check(Er(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function q(e){return gr(ia,e)}let aa=o(`ZodNumberFormat`,(e,t)=>{on.init(e,t),ia.init(e,t)});function oa(e){return _r(aa,e)}let sa=o(`ZodBoolean`,(e,t)=>{sn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zr(e,t,n,r)});function ca(e){return vr(sa,e)}let la=o(`ZodUndefined`,(e,t)=>{cn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qr(e,t,n,r)});function J(e){return yr(la,e)}let ua=o(`ZodUnknown`,(e,t)=>{ln.init(e,t),W.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function da(){return br(ua)}let fa=o(`ZodNever`,(e,t)=>{un.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$r(e,t,n,r)});function pa(e){return xr(fa,e)}let ma=o(`ZodArray`,(e,t)=>{fn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ii(e,t,n,r),e.element=t.element,U(e,`ZodArray`,{min(e,t){return this.check(L(e,t))},nonempty(e){return this.check(L(1,e))},max(e,t){return this.check(Dr(e,t))},length(e,t){return this.check(Or(e,t))},unwrap(){return this.element}})});function Y(e,t){return Br(ma,e,t)}let ha=o(`ZodObject`,(e,t)=>{gn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ai(e,t,n,r),v(e,`shape`,()=>t.shape),U(e,`ZodObject`,{keyof(){return ba(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:da()})},loose(){return this.clone({...this._zod.def,catchall:da()})},strict(){return this.clone({...this._zod.def,catchall:pa()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ue(this,e)},safeExtend(e){return de(this,e)},merge(e){return fe(this,e)},pick(e){return ce(this,e)},omit(e){return le(this,e)},partial(...e){return pe(wa,this,e[0])},required(...e){return me(Pa,this,e[0])}})});function X(e,t){return new ha({type:`object`,shape:e??{},...T(t)})}let ga=o(`ZodUnion`,(e,t)=>{vn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oi(e,t,n,r),e.options=t.options});function Z(e,t){return new ga({type:`union`,options:e,...T(t)})}let _a=o(`ZodIntersection`,(e,t)=>{yn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>si(e,t,n,r)});function va(e,t){return new _a({type:`intersection`,left:e,right:t})}let ya=o(`ZodEnum`,(e,t)=>{Sn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ei(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ya({...t,checks:[],...T(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ya({...t,checks:[],...T(r),entries:i})}});function ba(e,t){return new ya({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...T(t)})}let xa=o(`ZodLiteral`,(e,t)=>{Cn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ti(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Q(e,t){return new xa({type:`literal`,values:Array.isArray(e)?e:[e],...T(t)})}let Sa=o(`ZodTransform`,(e,t)=>{wn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ri(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new c(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(k(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(k(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ca(e){return new Sa({type:`transform`,transform:e})}let wa=o(`ZodOptional`,(e,t)=>{En.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ta(e){return new wa({type:`optional`,innerType:e})}let Ea=o(`ZodExactOptional`,(e,t)=>{Dn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Da(e){return new Ea({type:`optional`,innerType:e})}let Oa=o(`ZodNullable`,(e,t)=>{On.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ci(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ka(e){return new Oa({type:`nullable`,innerType:e})}let Aa=o(`ZodDefault`,(e,t)=>{kn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ja(e,t){return new Aa({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}let Ma=o(`ZodPrefault`,(e,t)=>{jn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Na(e,t){return new Ma({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}let Pa=o(`ZodNonOptional`,(e,t)=>{Mn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fa(e,t){return new Pa({type:`nonoptional`,innerType:e,...T(t)})}let Ia=o(`ZodCatch`,(e,t)=>{Pn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function La(e,t){return new Ia({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let Ra=o(`ZodPipe`,(e,t)=>{Fn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),e.in=t.in,e.out=t.out});function za(e,t){return new Ra({type:`pipe`,in:e,out:t})}let Ba=o(`ZodReadonly`,(e,t)=>{In.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Va(e){return new Ba({type:`readonly`,innerType:e})}let Ha=o(`ZodCustom`,(e,t)=>{Rn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ni(e,t,n,r)});function Ua(e,t={}){return Vr(Ha,e,t)}function Wa(e,t){return Hr(e,t)}let Ga=X({requestId:G().readonly(),attemptId:G().readonly()}),Ka=X({id:G().readonly(),connectionId:G().readonly(),revision:q().readonly(),notice:Z([J(),X({kind:Z([Q(`browser`),Q(`device`),Q(`waiting`)]).readonly(),url:Z([J(),G()]).readonly().optional(),code:Z([J(),G()]).readonly().optional()})]).readonly().optional(),prompt:Z([J(),X({id:G().readonly(),choices:Y(X({id:G().readonly(),label:G().readonly(),kind:Z([Q(`browser`),Q(`device`),Q(`other`)]).readonly()})).readonly()})]).readonly().optional(),terminal:Z([J(),X({status:Z([Q(`authorized`),Q(`cancelled`)]).readonly()}),X({status:Q(`failed`).readonly(),code:Z([Q(`unavailable`),Q(`unknown-method`),Q(`in-flight`),Q(`input-required`),Q(`not-committed`),Q(`flow-failed`)]).readonly()})]).readonly().optional()}),qa=X({requestId:G().readonly(),attemptId:G().readonly(),promptId:G().readonly(),choice:G().readonly()}),Ja=X({id:G().readonly(),connectionId:G().readonly(),revision:q().readonly(),notice:Z([J(),X({kind:Z([Q(`browser`),Q(`device`),Q(`waiting`)]).readonly(),url:Z([J(),G()]).readonly().optional(),code:Z([J(),G()]).readonly().optional()})]).readonly().optional(),prompt:Z([J(),X({id:G().readonly(),choices:Y(X({id:G().readonly(),label:G().readonly(),kind:Z([Q(`browser`),Q(`device`),Q(`other`)]).readonly()})).readonly()})]).readonly().optional(),terminal:Z([J(),X({status:Z([Q(`authorized`),Q(`cancelled`)]).readonly()}),X({status:Q(`failed`).readonly(),code:Z([Q(`unavailable`),Q(`unknown-method`),Q(`in-flight`),Q(`input-required`),Q(`not-committed`),Q(`flow-failed`)]).readonly()})]).readonly().optional()}),Ya=X({connections:Y(X({id:G().readonly(),label:G().readonly(),configured:ca().readonly(),inFlight:ca().readonly(),methods:Y(X({id:G().readonly(),label:G().readonly(),kind:Z([Q(`browser`),Q(`device`),Q(`other`)]).readonly()})).readonly()})).readonly()}),Xa=X({requestId:G().readonly(),connectionId:G().readonly()}),Za=X({disconnected:Q(!0)}),Qa=G(),$a=X({id:G().readonly(),connectionId:G().readonly(),revision:q().readonly(),notice:Z([J(),X({kind:Z([Q(`browser`),Q(`device`),Q(`waiting`)]).readonly(),url:Z([J(),G()]).readonly().optional(),code:Z([J(),G()]).readonly().optional()})]).readonly().optional(),prompt:Z([J(),X({id:G().readonly(),choices:Y(X({id:G().readonly(),label:G().readonly(),kind:Z([Q(`browser`),Q(`device`),Q(`other`)]).readonly()})).readonly()})]).readonly().optional(),terminal:Z([J(),X({status:Z([Q(`authorized`),Q(`cancelled`)]).readonly()}),X({status:Q(`failed`).readonly(),code:Z([Q(`unavailable`),Q(`unknown-method`),Q(`in-flight`),Q(`input-required`),Q(`not-committed`),Q(`flow-failed`)]).readonly()})]).readonly().optional()}),eo=X({requestId:G().readonly(),connectionId:G().readonly(),method:G().readonly()}),to=X({id:G().readonly(),connectionId:G().readonly(),revision:q().readonly(),notice:Z([J(),X({kind:Z([Q(`browser`),Q(`device`),Q(`waiting`)]).readonly(),url:Z([J(),G()]).readonly().optional(),code:Z([J(),G()]).readonly().optional()})]).readonly().optional(),prompt:Z([J(),X({id:G().readonly(),choices:Y(X({id:G().readonly(),label:G().readonly(),kind:Z([Q(`browser`),Q(`device`),Q(`other`)]).readonly()})).readonly()})]).readonly().optional(),terminal:Z([J(),X({status:Z([Q(`authorized`),Q(`cancelled`)]).readonly()}),X({status:Q(`failed`).readonly(),code:Z([Q(`unavailable`),Q(`unknown-method`),Q(`in-flight`),Q(`input-required`),Q(`not-committed`),Q(`flow-failed`)]).readonly()})]).readonly().optional()}),no={package:`dsh-account-authorization`,descriptors:[{id:`dsh-account-authorization#accountAuthorization/cancel`,service:`accountAuthorization`,namespace:`accountAuthorization`,method:`cancel`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#CancelAuthorizationRequest`,schema:Ga}}],result:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#AuthorizationAttemptView`,schema:Ka},sourceLocation:{file:`packages/account-authorization/src/host/index.ts`,line:377,column:3}},{id:`dsh-account-authorization#accountAuthorization/choose`,service:`accountAuthorization`,namespace:`accountAuthorization`,method:`choose`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#ChooseAuthorizationRequest`,schema:qa}}],result:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#AuthorizationAttemptView`,schema:Ja},sourceLocation:{file:`packages/account-authorization/src/host/index.ts`,line:359,column:3}},{id:`dsh-account-authorization#accountAuthorization/connections`,service:`accountAuthorization`,namespace:`accountAuthorization`,method:`connections`,invocation:{kind:`direct`},parameters:[],result:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#AccountConnectionsView`,schema:Ya},sourceLocation:{file:`packages/account-authorization/src/host/index.ts`,line:210,column:9}},{id:`dsh-account-authorization#accountAuthorization/disconnect`,service:`accountAuthorization`,namespace:`accountAuthorization`,method:`disconnect`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#DisconnectAccountRequest`,schema:Xa}}],result:{mode:`strict`,typeSymbol:`dsh-account-authorization#accountAuthorization/disconnect:result`,schema:Za},sourceLocation:{file:`packages/account-authorization/src/host/index.ts`,line:392,column:9}},{id:`dsh-account-authorization#accountAuthorization/observe`,service:`accountAuthorization`,namespace:`accountAuthorization`,method:`observe`,invocation:{kind:`direct`},parameters:[{name:`attemptId`,wire:`attemptId`,source:`json`,codec:{mode:`strict`,typeSymbol:`dsh-account-authorization#accountAuthorization/observe:attemptId`,schema:Qa}}],result:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#AuthorizationAttemptView`,schema:$a},sourceLocation:{file:`packages/account-authorization/src/host/index.ts`,line:352,column:3}},{id:`dsh-account-authorization#accountAuthorization/start`,service:`accountAuthorization`,namespace:`accountAuthorization`,method:`start`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#StartAuthorizationRequest`,schema:eo}}],result:{mode:`strict`,typeSymbol:`dsh-account-authorization/types#AuthorizationAttemptView`,schema:to},sourceLocation:{file:`packages/account-authorization/src/host/index.ts`,line:231,column:3}}]},ro=`dsh-account-authorization:AccountConnections.module.css`;if(typeof document<`u`&&!document.querySelector(`style[data-plugin-css="${ro}"]`)){let e=document.createElement(`style`);e.dataset.plugin=`dsh-account-authorization`,e.dataset.pluginCss=ro,e.textContent=`.yni0ia_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:20px;display:flex}.yni0ia_heading{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.yni0ia_heading h2,.yni0ia_identity h3{color:var(--dsw-alias-label-primary);margin:0;font-weight:500}.yni0ia_heading h2{font-size:16px;line-height:24px}.yni0ia_identity h3{font-size:14px;line-height:22px}.yni0ia_heading p,.yni0ia_identity span,.yni0ia_muted,.yni0ia_empty,.yni0ia_confirmRow p,.yni0ia_attempt p{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}.yni0ia_heading p{margin-top:4px;font-size:14px;line-height:22px}.yni0ia_cards{flex-direction:column;gap:10px;display:flex}.yni0ia_card{border:1px solid var(--dsw-alias-border-l2);background:0 0;border-radius:12px;flex-direction:column;gap:12px;padding:14px 16px;display:flex}.yni0ia_cardHead{align-items:center;gap:10px;min-width:0;display:flex}.yni0ia_identity{flex:1;min-width:0}.yni0ia_identityTitle{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.yni0ia_badge{border:1px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);border-radius:4px;padding:1px 6px;font-size:11px;line-height:16px}.yni0ia_dot{border-radius:50%;flex:none;width:8px;height:8px}.yni0ia_dotConnected{background:var(--dsw-alias-state-success-primary)}.yni0ia_dotIdle{background:var(--dsw-alias-label-quaternary)}.yni0ia_secondaryButton,.yni0ia_primaryButton,.yni0ia_dangerButton,.yni0ia_textButton,.yni0ia_dangerTextButton,.yni0ia_select{box-sizing:border-box;min-height:32px;font:inherit;border-radius:16px;font-size:12px;line-height:18px}.yni0ia_secondaryButton,.yni0ia_select{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);background:0 0;padding:0 12px}.yni0ia_secondaryButton,.yni0ia_primaryButton,.yni0ia_dangerButton,.yni0ia_textButton,.yni0ia_dangerTextButton{cursor:pointer}.yni0ia_headingAction{white-space:nowrap;flex:none}.yni0ia_secondaryButton:hover,.yni0ia_textButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.yni0ia_primaryButton{background:var(--dsw-alias-button-primary-fill);width:fit-content;color:var(--dsw-alias-label-primary-foreground);border:none;justify-content:center;align-items:center;padding:0 14px;text-decoration:none;display:inline-flex}.yni0ia_dangerButton{background:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-label-primary-foreground);border:none;padding:0 12px}.yni0ia_textButton,.yni0ia_dangerTextButton{width:fit-content;min-height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;padding:0 8px}.yni0ia_dangerTextButton{color:var(--dsw-alias-state-error-primary)}.yni0ia_attempt{background:var(--dsw-alias-bg-layer-1);border-radius:10px;flex-direction:column;align-items:flex-start;gap:10px;padding:12px;display:flex}.yni0ia_codeRow,.yni0ia_choices,.yni0ia_confirmRow{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.yni0ia_choices{flex-direction:column;align-items:flex-start}.yni0ia_codeRow code{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);letter-spacing:.08em;border-radius:6px;padding:6px 10px;font-size:14px}.yni0ia_success,.yni0ia_notice{margin:0;font-size:12px;line-height:18px}.yni0ia_success{color:var(--dsw-alias-state-success-primary)}.yni0ia_notice{color:var(--dsw-alias-state-error-primary)}.yni0ia_empty{border:1px dashed var(--dsw-alias-border-l2);text-align:center;border-radius:12px;padding:24px}@media (width<=640px){.yni0ia_heading,.yni0ia_cardHead{flex-direction:column;align-items:stretch}.yni0ia_dot{display:none}.yni0ia_select,.yni0ia_secondaryButton{width:100%}}`,document.head.appendChild(e)}var $={attempt:`yni0ia_attempt`,badge:`yni0ia_badge`,card:`yni0ia_card`,cardHead:`yni0ia_cardHead`,cards:`yni0ia_cards`,choices:`yni0ia_choices`,codeRow:`yni0ia_codeRow`,confirmRow:`yni0ia_confirmRow`,dangerButton:`yni0ia_dangerButton`,dangerTextButton:`yni0ia_dangerTextButton`,dot:`yni0ia_dot`,dotConnected:`yni0ia_dotConnected`,dotIdle:`yni0ia_dotIdle`,empty:`yni0ia_empty`,heading:`yni0ia_heading`,headingAction:`yni0ia_headingAction`,identity:`yni0ia_identity`,identityTitle:`yni0ia_identityTitle`,muted:`yni0ia_muted`,notice:`yni0ia_notice`,primaryButton:`yni0ia_primaryButton`,secondaryButton:`yni0ia_secondaryButton`,section:`yni0ia_section`,select:`yni0ia_select`,success:`yni0ia_success`,textButton:`yni0ia_textButton`};function io(){return crypto.randomUUID().replaceAll(`-`,`_`)}function ao(e,t){return e.kind===`browser`?t(`browserMethod`):e.kind===`device`?t(`deviceMethod`):t(`otherMethod`)}function oo(e,t){return e.kind===`browser`?t(`browserMethod`):e.kind===`device`?t(`deviceMethod`):t(`otherMethod`)}function so(e,t){let n=e.terminal;if(n!==void 0)return n.status===`failed`?t({unavailable:`errorUnavailable`,"unknown-method":`errorUnknownMethod`,"in-flight":`errorInFlight`,"input-required":`errorInputRequired`,"not-committed":`errorNotCommitted`,"flow-failed":`errorFlowFailed`}[n.code]):n.status===`authorized`?t(`authorized`):t(`cancelled`)}function co({connection:e,attempt:t,remote:n,t:a,onRefresh:o}){let[s,c]=(0,r.useState)(e.methods[0]?.id??``),[l,u]=(0,r.useState)(!1),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(null),h=t!==void 0&&t.terminal===void 0,g=h||e.inFlight;(0,r.useEffect)(()=>{e.methods.some(e=>e.id===s)||c(e.methods[0]?.id??``)},[e.methods,s]);let _=async e=>{m(null);try{await e()}catch{m(a(`errorFlowFailed`))}};return(0,i.jsxs)(`article`,{className:$.card,children:[(0,i.jsxs)(`div`,{className:$.cardHead,children:[(0,i.jsx)(`span`,{className:`${$.dot} ${e.configured?$.dotConnected:$.dotIdle}`,"aria-hidden":`true`}),(0,i.jsxs)(`div`,{className:$.identity,children:[(0,i.jsxs)(`div`,{className:$.identityTitle,children:[(0,i.jsx)(`h3`,{children:e.label}),(0,i.jsx)(`span`,{className:$.badge,children:a(`modelAccount`)})]}),(0,i.jsx)(`span`,{children:g?a(`connecting`):e.configured?a(`connected`):a(`available`)})]}),e.methods.length>1&&!g&&(0,i.jsx)(`select`,{className:$.select,"aria-label":a(`methodLabel`),value:s,onChange:e=>{c(e.target.value)},children:e.methods.map(e=>(0,i.jsx)(`option`,{value:e.id,children:ao(e,a)},e.id))}),!g&&e.methods.length>0&&(0,i.jsx)(`button`,{className:$.secondaryButton,type:`button`,onClick:()=>void _(async()=>{await n.start({requestId:io(),connectionId:e.id,method:s}),await o()}),children:e.configured?a(`reconnect`):a(`connect`)})]}),e.methods.length===0&&!e.configured&&(0,i.jsx)(`p`,{className:$.muted,children:a(`empty`)}),h&&t!==void 0&&(0,i.jsxs)(`div`,{className:$.attempt,"aria-live":`polite`,children:[t.notice?.kind===`device`&&(0,i.jsx)(`p`,{children:a(`deviceInstruction`)}),t.notice?.kind===`browser`&&(0,i.jsx)(`p`,{children:a(`browserInstruction`)}),t.notice?.kind===`waiting`&&(0,i.jsx)(`p`,{children:a(`waitingInstruction`)}),t.notice?.code!==void 0&&(0,i.jsxs)(`div`,{className:$.codeRow,children:[(0,i.jsx)(`code`,{children:t.notice.code}),(0,i.jsx)(`button`,{className:$.textButton,type:`button`,onClick:()=>void _(async()=>{await navigator.clipboard.writeText(t.notice?.code??``),f(!0)}),children:a(d?`copied`:`copyCode`)})]}),t.notice?.url!==void 0&&(0,i.jsx)(`a`,{className:$.primaryButton,href:t.notice.url,target:`_blank`,rel:`noreferrer noopener`,children:a(`openBrowser`)}),t.prompt!==void 0&&(0,i.jsxs)(`div`,{className:$.choices,children:[(0,i.jsx)(`p`,{children:a(`chooseInstruction`)}),t.prompt.choices.map(e=>(0,i.jsx)(`button`,{className:$.secondaryButton,type:`button`,onClick:()=>void _(async()=>{await n.choose({requestId:io(),attemptId:t.id,promptId:t.prompt?.id??``,choice:e.id})}),children:oo(e,a)},e.id))]}),(0,i.jsx)(`button`,{className:$.textButton,type:`button`,onClick:()=>void _(async()=>{await n.cancel({requestId:io(),attemptId:t.id})}),children:a(`stop`)})]}),t!==void 0&&t.terminal!==void 0&&(0,i.jsx)(`p`,{className:t.terminal.status===`authorized`?$.success:$.notice,"aria-live":`polite`,children:so(t,a)}),e.configured&&!g&&(l?(0,i.jsxs)(`div`,{className:$.confirmRow,children:[(0,i.jsx)(`p`,{children:a(`disconnectConfirm`)}),(0,i.jsx)(`button`,{className:$.dangerButton,type:`button`,onClick:()=>void _(async()=>{await n.disconnect({requestId:io(),connectionId:e.id}),u(!1),await o()}),children:a(`confirm`)}),(0,i.jsx)(`button`,{className:$.textButton,type:`button`,onClick:()=>{u(!1)},children:a(`cancel`)})]}):(0,i.jsx)(`button`,{className:$.dangerTextButton,type:`button`,onClick:()=>{u(!0)},children:a(`disconnect`)})),p!==null&&(0,i.jsx)(`p`,{className:$.notice,children:p})]})}function lo({remote:e,t}){let[n,a]=(0,r.useState)([]),[o,s]=(0,r.useState)({}),[c,l]=(0,r.useState)(!0),[u,d]=(0,r.useState)(!1),f=(0,r.useRef)(!0),p=(0,r.useCallback)(async()=>{try{let t=await e.connections();if(!f.current)return;a(t.connections),d(!1)}catch{f.current&&d(!0)}finally{f.current&&l(!1)}},[e]);(0,r.useEffect)(()=>(f.current=!0,p(),()=>{f.current=!1}),[p]),(0,r.useEffect)(()=>{let t=Object.values(o).filter(e=>e.terminal===void 0),r=n.some(e=>{let t=o[e.id];return e.inFlight&&(t===void 0||t.terminal!==void 0)});if(t.length===0&&!r)return;let i=window.setTimeout(()=>{let n=t.map(async t=>{try{let n=await e.observe(t.id);if(!f.current)return;s(e=>({...e,[n.connectionId]:n})),n.terminal!==void 0&&await p()}catch{}});Promise.all([...n,...r?[p()]:[]])},600);return()=>{window.clearTimeout(i)}},[o,n,p,e]);let m=(0,r.useMemo)(()=>({...e,start:async t=>{let n=await e.start(t);return f.current&&s(e=>({...e,[n.connectionId]:n})),n},choose:async t=>{let n=await e.choose(t);return f.current&&s(e=>({...e,[n.connectionId]:n})),n},cancel:async t=>{let n=await e.cancel(t);return f.current&&s(e=>({...e,[n.connectionId]:n})),n}}),[e]),h=(0,r.useCallback)(()=>{p()},[p]);return(0,i.jsxs)(`section`,{className:$.section,children:[(0,i.jsxs)(`div`,{className:$.heading,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h2`,{children:t(`title`)}),(0,i.jsx)(`p`,{children:t(`intro`)})]}),(0,i.jsx)(`button`,{className:`${$.secondaryButton} ${$.headingAction}`,type:`button`,onClick:h,children:t(`refresh`)})]}),c&&(0,i.jsx)(`p`,{className:$.muted,children:t(`loading`)}),u&&(0,i.jsx)(`p`,{className:$.notice,children:t(`loadFailed`)}),!c&&!u&&n.length===0&&(0,i.jsx)(`p`,{className:$.empty,children:t(`noAuthorizationFlows`)}),(0,i.jsx)(`div`,{className:$.cards,children:n.map(e=>(0,i.jsx)(co,{connection:e,attempt:o[e.id],remote:m,t,onRefresh:p},e.id))})]})}let uo={tab:`模型登录`,title:`模型登录`,intro:`管理已安装的模型账号登录。只有 Provider 官方提供的账号登录才会显示;API 密钥和自定义 Provider 仍在“模型”页管理。`,refresh:`刷新`,loading:`正在检查账号连接…`,empty:`当前没有已安装的账号登录方式。安装支持账号授权的 Provider 后会自动出现在这里。`,noAuthorizationFlows:`当前没有 Provider 提供模型账号登录。`,modelAccount:`模型账号`,available:`可连接`,connected:`已连接`,connecting:`连接中`,connect:`连接账号`,reconnect:`更换账号`,disconnect:`移除本机连接`,disconnectConfirm:`仅删除本机保存的连接,不代表远端账号已撤销授权。`,confirm:`确认移除`,cancel:`取消`,browserMethod:`浏览器登录`,deviceMethod:`设备验证码登录`,otherMethod:`Provider 提供的登录方式`,methodLabel:`登录方式`,openBrowser:`打开登录页面`,deviceInstruction:`请在登录页面输入以下验证码`,browserInstruction:`请在浏览器中完成账号登录`,waitingInstruction:`正在等待账号授权完成…`,chooseInstruction:`请选择登录方式`,copyCode:`复制验证码`,copied:`已复制`,authorized:`账号连接成功。IDE 可用模型以 Harness 当前目录为准。`,cancelled:`账号连接已取消。`,stop:`停止连接`,errorUnavailable:`该登录方式已不可用,请刷新后重试。`,errorUnknownMethod:`所选登录方式已发生变化,请刷新后重试。`,errorInFlight:`该账号已有登录流程正在进行。`,errorInputRequired:`该流程要求传输敏感输入,本插件已安全拒绝。请在 Provider 官方配置中完成。`,errorNotCommitted:`登录流程结束,但 Provider 没有保存有效连接。`,errorFlowFailed:`账号登录失败。Provider 的原始错误未显示,以免泄露敏感信息。`,loadFailed:`无法读取账号连接,请稍后重试。`},fo={tab:`Model sign-in`,title:`Model sign-in`,intro:`Manage installed connection capabilities in one place. Only official Provider sign-ins appear here; API keys and custom Providers stay in Models.`,refresh:`Refresh`,loading:`Checking account connections…`,empty:`No installed Provider currently offers account sign-in.`,noAuthorizationFlows:`No Provider currently offers model account sign-in.`,modelAccount:`Model account`,available:`Available`,connected:`Connected`,connecting:`Connecting`,connect:`Connect account`,reconnect:`Switch account`,disconnect:`Remove local connection`,disconnectConfirm:`This removes the local connection only and does not confirm remote revocation.`,confirm:`Remove`,cancel:`Cancel`,browserMethod:`Browser sign-in`,deviceMethod:`Device-code sign-in`,otherMethod:`Provider sign-in`,methodLabel:`Sign-in method`,openBrowser:`Open sign-in page`,deviceInstruction:`Enter this code on the sign-in page`,browserInstruction:`Complete account sign-in in your browser`,waitingInstruction:`Waiting for account authorization…`,chooseInstruction:`Choose a sign-in method`,copyCode:`Copy code`,copied:`Copied`,authorized:`Account connected. IDE availability follows the current Harness model catalog.`,cancelled:`Account connection cancelled.`,stop:`Stop`,errorUnavailable:`This sign-in is no longer available. Refresh and try again.`,errorUnknownMethod:`The selected sign-in method changed. Refresh and try again.`,errorInFlight:`A sign-in attempt is already active for this account.`,errorInputRequired:`This flow requires sensitive input over the client channel, so the plugin refused it. Use the Provider configuration.`,errorNotCommitted:`The flow ended without saving a valid connection.`,errorFlowFailed:`Account sign-in failed. Provider details are hidden to avoid exposing sensitive data.`,loadFailed:`Could not read account connections. Try again.`},po=`settings.accountAuthorization`,mo=[`slots`,`locale`,`remote`];async function ho(e){let t=await e.remote.$mount(no),n=e.get(`remote.accountAuthorization`);if(n===void 0)throw await t(),Error(`account-authorization: mounted Remote namespace is unavailable`);e.effect(()=>e.locale.register(po,{zh:uo,en:fo}),`account-authorization: dictionaries`);let i=e.locale.bind(po),a=async e=>{let t=await e;if(!t.ok||t.value===void 0)throw Error(t.error?.message??`Remote call failed`);return t.value},o={connections:()=>a(n.connections()),start:e=>a(n.start(e)),observe:e=>a(n.observe(e)),choose:e=>a(n.choose(e)),cancel:e=>a(n.cancel(e)),disconnect:e=>a(n.disconnect(e))};return e.slots.inject(`settings.section`,()=>{let t=Object.assign({name:`settings.section`,id:`account-connections`,order:40,label:()=>i(`tab`),locale:po},{icon:`account`});return e.slots.register(t,e=>(0,r.createElement)(lo,{...e,remote:o,t:i}))}),t}return n.apply=ho,n.inject=mo,t.exports}});
|
|
65
|
+
//# sourceMappingURL=client.js.map
|