@modelcontextprotocol/ext-apps 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/app-bridge.d.ts +310 -26
- package/dist/src/app-bridge.js +38 -25
- package/dist/src/app.d.ts +41 -9
- package/dist/src/app.js +38 -25
- package/dist/src/generated/schema.d.ts +119 -5
- package/dist/src/generated/schema.test.d.ts +9 -1
- package/dist/src/react/index.d.ts +5 -0
- package/dist/src/react/index.js +38 -25
- package/dist/src/react/useDocumentTheme.d.ts +46 -0
- package/dist/src/react/useHostStyles.d.ts +121 -0
- package/dist/src/server/index.d.ts +109 -0
- package/dist/src/server/index.js +42 -0
- package/dist/src/server/index.test.d.ts +1 -0
- package/dist/src/spec.types.d.ts +83 -1
- package/dist/src/styles.d.ts +141 -0
- package/dist/src/types.d.ts +31 -2
- package/package.json +51 -16
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { McpUiTheme } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* React hook that provides the current document theme reactively.
|
|
4
|
+
*
|
|
5
|
+
* Uses a MutationObserver to watch for changes to the `data-theme` attribute
|
|
6
|
+
* or `class` on `document.documentElement`. When the theme changes (e.g., from
|
|
7
|
+
* host context updates), the hook automatically re-renders your component with
|
|
8
|
+
* the new theme value.
|
|
9
|
+
*
|
|
10
|
+
* @returns The current theme ("light" or "dark")
|
|
11
|
+
*
|
|
12
|
+
* @example Conditionally render based on theme
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { useDocumentTheme } from '@modelcontextprotocol/ext-apps/react';
|
|
15
|
+
*
|
|
16
|
+
* function MyApp() {
|
|
17
|
+
* const theme = useDocumentTheme();
|
|
18
|
+
*
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {theme === 'dark' ? <DarkIcon /> : <LightIcon />}
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Use with theme-aware styling
|
|
28
|
+
* ```tsx
|
|
29
|
+
* function ThemedButton() {
|
|
30
|
+
* const theme = useDocumentTheme();
|
|
31
|
+
*
|
|
32
|
+
* return (
|
|
33
|
+
* <button style={{
|
|
34
|
+
* background: theme === 'dark' ? '#333' : '#fff',
|
|
35
|
+
* color: theme === 'dark' ? '#fff' : '#333',
|
|
36
|
+
* }}>
|
|
37
|
+
* Click me
|
|
38
|
+
* </button>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @see {@link getDocumentTheme} for the underlying function
|
|
44
|
+
* @see {@link applyDocumentTheme} to set the theme
|
|
45
|
+
*/
|
|
46
|
+
export declare function useDocumentTheme(): McpUiTheme;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { App } from "../app";
|
|
2
|
+
import { McpUiHostContext } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* React hook that applies host style variables and theme as CSS custom properties.
|
|
5
|
+
*
|
|
6
|
+
* This hook listens to host context changes and automatically applies:
|
|
7
|
+
* - `styles.variables` CSS variables to `document.documentElement` (e.g., `--color-background-primary`)
|
|
8
|
+
* - `theme` via `color-scheme` CSS property, enabling `light-dark()` CSS function support
|
|
9
|
+
*
|
|
10
|
+
* The hook also applies styles and theme from the initial host context when
|
|
11
|
+
* the app first connects.
|
|
12
|
+
*
|
|
13
|
+
* **Note:** If the host provides style values using CSS `light-dark()` function,
|
|
14
|
+
* this hook ensures they work correctly by setting the `color-scheme` property
|
|
15
|
+
* based on the host's theme preference.
|
|
16
|
+
*
|
|
17
|
+
* @param app - The connected App instance, or null during initialization
|
|
18
|
+
* @param initialContext - Initial host context from the connection (optional).
|
|
19
|
+
* If provided, styles and theme will be applied immediately on mount.
|
|
20
|
+
*
|
|
21
|
+
* @example Basic usage with useApp
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { useApp } from '@modelcontextprotocol/ext-apps/react';
|
|
24
|
+
* import { useHostStyleVariables } from '@modelcontextprotocol/ext-apps/react';
|
|
25
|
+
*
|
|
26
|
+
* function MyApp() {
|
|
27
|
+
* const { app, isConnected } = useApp({
|
|
28
|
+
* appInfo: { name: "MyApp", version: "1.0.0" },
|
|
29
|
+
* capabilities: {},
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Automatically apply host style variables and theme
|
|
33
|
+
* useHostStyleVariables(app);
|
|
34
|
+
*
|
|
35
|
+
* return (
|
|
36
|
+
* <div style={{ background: 'var(--color-background-primary)' }}>
|
|
37
|
+
* Hello!
|
|
38
|
+
* </div>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example With initial context
|
|
44
|
+
* ```tsx
|
|
45
|
+
* const [hostContext, setHostContext] = useState<McpUiHostContext | null>(null);
|
|
46
|
+
*
|
|
47
|
+
* // ... get initial context from app.connect() result
|
|
48
|
+
*
|
|
49
|
+
* useHostStyleVariables(app, hostContext);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see {@link applyHostStyleVariables} for the underlying styles function
|
|
53
|
+
* @see {@link applyDocumentTheme} for the underlying theme function
|
|
54
|
+
* @see {@link useHostFonts} for applying host fonts
|
|
55
|
+
* @see {@link McpUiStyles} for available CSS variables
|
|
56
|
+
*/
|
|
57
|
+
export declare function useHostStyleVariables(app: App | null, initialContext?: McpUiHostContext | null): void;
|
|
58
|
+
/**
|
|
59
|
+
* React hook that applies host fonts from CSS.
|
|
60
|
+
*
|
|
61
|
+
* This hook listens to host context changes and automatically applies:
|
|
62
|
+
* - `styles.css.fonts` as a `<style>` tag for custom fonts
|
|
63
|
+
*
|
|
64
|
+
* The CSS can contain `@font-face` rules for self-hosted fonts,
|
|
65
|
+
* `@import` statements for Google Fonts or other font services, or both.
|
|
66
|
+
*
|
|
67
|
+
* The hook also applies fonts from the initial host context when
|
|
68
|
+
* the app first connects.
|
|
69
|
+
*
|
|
70
|
+
* @param app - The connected App instance, or null during initialization
|
|
71
|
+
* @param initialContext - Initial host context from the connection (optional).
|
|
72
|
+
* If provided, fonts will be applied immediately on mount.
|
|
73
|
+
*
|
|
74
|
+
* @example Basic usage with useApp
|
|
75
|
+
* ```tsx
|
|
76
|
+
* import { useApp } from '@modelcontextprotocol/ext-apps/react';
|
|
77
|
+
* import { useHostFonts } from '@modelcontextprotocol/ext-apps/react';
|
|
78
|
+
*
|
|
79
|
+
* function MyApp() {
|
|
80
|
+
* const { app, isConnected } = useApp({
|
|
81
|
+
* appInfo: { name: "MyApp", version: "1.0.0" },
|
|
82
|
+
* capabilities: {},
|
|
83
|
+
* });
|
|
84
|
+
*
|
|
85
|
+
* // Automatically apply host fonts
|
|
86
|
+
* useHostFonts(app);
|
|
87
|
+
*
|
|
88
|
+
* return (
|
|
89
|
+
* <div style={{ fontFamily: 'var(--font-sans)' }}>
|
|
90
|
+
* Hello!
|
|
91
|
+
* </div>
|
|
92
|
+
* );
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example With initial context
|
|
97
|
+
* ```tsx
|
|
98
|
+
* const [hostContext, setHostContext] = useState<McpUiHostContext | null>(null);
|
|
99
|
+
*
|
|
100
|
+
* // ... get initial context from app.connect() result
|
|
101
|
+
*
|
|
102
|
+
* useHostFonts(app, hostContext);
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @see {@link applyHostFonts} for the underlying fonts function
|
|
106
|
+
* @see {@link useHostStyleVariables} for applying style variables and theme
|
|
107
|
+
*/
|
|
108
|
+
export declare function useHostFonts(app: App | null, initialContext?: McpUiHostContext | null): void;
|
|
109
|
+
/**
|
|
110
|
+
* React hook that applies host styles, fonts, and theme.
|
|
111
|
+
*
|
|
112
|
+
* This is a convenience hook that combines {@link useHostStyleVariables} and
|
|
113
|
+
* {@link useHostFonts}. Use the individual hooks if you need more control.
|
|
114
|
+
*
|
|
115
|
+
* @param app - The connected App instance, or null during initialization
|
|
116
|
+
* @param initialContext - Initial host context from the connection (optional).
|
|
117
|
+
*
|
|
118
|
+
* @see {@link useHostStyleVariables} for style variables and theme only
|
|
119
|
+
* @see {@link useHostFonts} for fonts only
|
|
120
|
+
*/
|
|
121
|
+
export declare function useHostStyles(app: App | null, initialContext?: McpUiHostContext | null): void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server Helpers for MCP Apps.
|
|
3
|
+
*
|
|
4
|
+
* @module server-helpers
|
|
5
|
+
*/
|
|
6
|
+
import { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE, McpUiResourceMeta, McpUiToolMeta } from "../app.js";
|
|
7
|
+
import type { McpServer, ResourceMetadata, ToolCallback, ReadResourceCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
9
|
+
import type { ZodRawShape } from "zod";
|
|
10
|
+
export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE };
|
|
11
|
+
export type { ResourceMetadata, ToolCallback, ReadResourceCallback };
|
|
12
|
+
/**
|
|
13
|
+
* Tool configuration (same as McpServer.registerTool).
|
|
14
|
+
*/
|
|
15
|
+
export interface ToolConfig {
|
|
16
|
+
title?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
inputSchema?: ZodRawShape;
|
|
19
|
+
annotations?: ToolAnnotations;
|
|
20
|
+
_meta?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* MCP App Tool configuration for `registerAppTool`.
|
|
24
|
+
*/
|
|
25
|
+
export interface McpUiAppToolConfig extends ToolConfig {
|
|
26
|
+
_meta: {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
} & ({
|
|
29
|
+
ui: McpUiToolMeta;
|
|
30
|
+
} | {
|
|
31
|
+
/**
|
|
32
|
+
* URI of the UI resource to display for this tool.
|
|
33
|
+
* This is converted to `_meta["ui/resourceUri"]`.
|
|
34
|
+
*
|
|
35
|
+
* @example "ui://weather/widget.html"
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Use `_meta.ui.resourceUri` instead.
|
|
38
|
+
*/
|
|
39
|
+
[RESOURCE_URI_META_KEY]?: string;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* MCP App Resource configuration for `registerAppResource`.
|
|
44
|
+
*/
|
|
45
|
+
export interface McpUiAppResourceConfig extends ResourceMetadata {
|
|
46
|
+
_meta: {
|
|
47
|
+
ui: McpUiResourceMeta;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Register an app tool with the MCP server.
|
|
53
|
+
*
|
|
54
|
+
* This is a convenience wrapper around `server.registerTool` that will allow more backwards-compatibility.
|
|
55
|
+
*
|
|
56
|
+
* @param server - The MCP server instance
|
|
57
|
+
* @param name - Tool name/identifier
|
|
58
|
+
* @param config - Tool configuration with required `ui` field
|
|
59
|
+
* @param handler - Tool handler function
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* import { registerAppTool } from '@modelcontextprotocol/ext-apps/server';
|
|
64
|
+
* import { z } from 'zod';
|
|
65
|
+
*
|
|
66
|
+
* registerAppTool(server, "get-weather", {
|
|
67
|
+
* title: "Get Weather",
|
|
68
|
+
* description: "Get current weather for a location",
|
|
69
|
+
* inputSchema: { location: z.string() },
|
|
70
|
+
* _meta: {
|
|
71
|
+
* [RESOURCE_URI_META_KEY]: "ui://weather/widget.html",
|
|
72
|
+
* },
|
|
73
|
+
* }, async (args) => {
|
|
74
|
+
* const weather = await fetchWeather(args.location);
|
|
75
|
+
* return { content: [{ type: "text", text: JSON.stringify(weather) }] };
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function registerAppTool(server: Pick<McpServer, "registerTool">, name: string, config: McpUiAppToolConfig, handler: ToolCallback<ZodRawShape>): void;
|
|
80
|
+
/**
|
|
81
|
+
* Register an app resource with the MCP server.
|
|
82
|
+
*
|
|
83
|
+
* This is a convenience wrapper around `server.registerResource` that:
|
|
84
|
+
* - Defaults the MIME type to "text/html;profile=mcp-app"
|
|
85
|
+
* - Provides a cleaner API matching the SDK's callback signature
|
|
86
|
+
*
|
|
87
|
+
* @param server - The MCP server instance
|
|
88
|
+
* @param name - Human-readable resource name
|
|
89
|
+
* @param uri - Resource URI (should match the `ui` field in tool config)
|
|
90
|
+
* @param config - Resource configuration
|
|
91
|
+
* @param readCallback - Callback that returns the resource contents
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* import { registerAppResource } from '@modelcontextprotocol/ext-apps/server';
|
|
96
|
+
*
|
|
97
|
+
* registerAppResource(server, "Weather Widget", "ui://weather/widget.html", {
|
|
98
|
+
* description: "Interactive weather display",
|
|
99
|
+
* mimeType: RESOURCE_MIME_TYPE,
|
|
100
|
+
* }, async () => ({
|
|
101
|
+
* contents: [{
|
|
102
|
+
* uri: "ui://weather/widget.html",
|
|
103
|
+
* mimeType: RESOURCE_MIME_TYPE,
|
|
104
|
+
* text: await fs.readFile("dist/widget.html", "utf-8"),
|
|
105
|
+
* }],
|
|
106
|
+
* }));
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function registerAppResource(server: Pick<McpServer, "registerResource">, name: string, uri: string, config: McpUiAppResourceConfig, readCallback: ReadResourceCallback): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var j9=Object.defineProperty;var k9=(Q,X)=>{for(var W in X)j9(Q,W,{get:X[W],enumerable:!0,configurable:!0,set:(Y)=>X[W]=()=>Y})};import{Protocol as x2}from"@modelcontextprotocol/sdk/shared/protocol.js";import{CallToolRequestSchema as u2,CallToolResultSchema as c2,ListToolsRequestSchema as y2,PingRequestSchema as m2}from"@modelcontextprotocol/sdk/types.js";import{JSONRPCMessageSchema as C9}from"@modelcontextprotocol/sdk/types.js";class EQ{eventTarget;eventSource;messageListener;constructor(Q=window.parent,X){this.eventTarget=Q;this.eventSource=X;this.messageListener=(W)=>{if(X&&W.source!==this.eventSource){console.error("Ignoring message from unknown source",W);return}let Y=C9.safeParse(W.data);if(Y.success)console.debug("Parsed message",Y.data),this.onmessage?.(Y.data);else console.error("Failed to parse message",Y.error.message,W),this.onerror?.(Error("Invalid JSON-RPC message received: "+Y.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(Q,X){console.debug("Sending message",Q),this.eventTarget.postMessage(Q,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var gQ="2025-11-21";var n2=Object.freeze({status:"aborted"});function w(Q,X,W){function Y(K,L){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:L,constr:q,traits:new Set},enumerable:!1});if(K._zod.traits.has(Q))return;K._zod.traits.add(Q),X(K,L);let H=q.prototype,N=Object.keys(H);for(let E=0;E<N.length;E++){let O=N[E];if(!(O in K))K[O]=H[O].bind(K)}}let J=W?.Parent??Object;class G extends J{}Object.defineProperty(G,"name",{value:Q});function q(K){var L;let H=W?.Parent?new G:this;Y(H,K),(L=H._zod).deferred??(L.deferred=[]);for(let N of H._zod.deferred)N();return H}return Object.defineProperty(q,"init",{value:Y}),Object.defineProperty(q,Symbol.hasInstance,{value:(K)=>{if(W?.Parent&&K instanceof W.Parent)return!0;return K?._zod?.traits?.has(Q)}}),Object.defineProperty(q,"name",{value:Q}),q}var e2=Symbol("zod_brand");class h extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class XQ extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var OQ={};function v(Q){if(Q)Object.assign(OQ,Q);return OQ}var D={};k9(D,{unwrapMessage:()=>WQ,uint8ArrayToHex:()=>GX,uint8ArrayToBase64url:()=>YX,uint8ArrayToBase64:()=>C1,stringifyPrimitive:()=>b1,slugify:()=>uQ,shallowClone:()=>_1,safeExtend:()=>t9,required:()=>QX,randomString:()=>l9,propertyKeyTypes:()=>yQ,promiseAllObject:()=>o9,primitiveTypes:()=>T1,prefixIssues:()=>u,pick:()=>i9,partial:()=>s9,optionalKeys:()=>mQ,omit:()=>n9,objectClone:()=>y9,numKeys:()=>r9,nullish:()=>GQ,normalizeParams:()=>B,mergeDefs:()=>f,merge:()=>a9,jsonStringifyReplacer:()=>e,joinValues:()=>c9,issue:()=>t,isPlainObject:()=>o,isObject:()=>n,hexToUint8Array:()=>JX,getSizableOrigin:()=>j1,getParsedType:()=>p9,getLengthableOrigin:()=>KQ,getEnumValues:()=>YQ,getElementAtPath:()=>f9,floatSafeRemainder:()=>xQ,finalizeIssue:()=>j,extend:()=>e9,escapeRegex:()=>x,esc:()=>DQ,defineLazy:()=>V,createTransparentProxy:()=>d9,cloneDef:()=>m9,clone:()=>Z,cleanRegex:()=>qQ,cleanEnum:()=>XX,captureStackTrace:()=>VQ,cached:()=>JQ,base64urlToUint8Array:()=>WX,base64ToUint8Array:()=>k1,assignProp:()=>m,assertNotEqual:()=>g9,assertNever:()=>x9,assertIs:()=>h9,assertEqual:()=>v9,assert:()=>u9,allowsEval:()=>cQ,aborted:()=>l,NUMBER_FORMAT_RANGES:()=>fQ,Class:()=>v1,BIGINT_FORMAT_RANGES:()=>Z1});function v9(Q){return Q}function g9(Q){return Q}function h9(Q){}function x9(Q){throw Error("Unexpected value in exhaustive check")}function u9(Q){}function YQ(Q){let X=Object.values(Q).filter((Y)=>typeof Y==="number");return Object.entries(Q).filter(([Y,J])=>X.indexOf(+Y)===-1).map(([Y,J])=>J)}function c9(Q,X="|"){return Q.map((W)=>b1(W)).join(X)}function e(Q,X){if(typeof X==="bigint")return X.toString();return X}function JQ(Q){return{get value(){{let W=Q();return Object.defineProperty(this,"value",{value:W}),W}throw Error("cached value already set")}}}function GQ(Q){return Q===null||Q===void 0}function qQ(Q){let X=Q.startsWith("^")?1:0,W=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,W)}function xQ(Q,X){let W=(Q.toString().split(".")[1]||"").length,Y=X.toString(),J=(Y.split(".")[1]||"").length;if(J===0&&/\d?e-\d?/.test(Y)){let L=Y.match(/\d?e-(\d?)/);if(L?.[1])J=Number.parseInt(L[1])}let G=W>J?W:J,q=Number.parseInt(Q.toFixed(G).replace(".","")),K=Number.parseInt(X.toFixed(G).replace(".",""));return q%K/10**G}var S1=Symbol("evaluating");function V(Q,X,W){let Y=void 0;Object.defineProperty(Q,X,{get(){if(Y===S1)return;if(Y===void 0)Y=S1,Y=W();return Y},set(J){Object.defineProperty(Q,X,{value:J})},configurable:!0})}function y9(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function m(Q,X,W){Object.defineProperty(Q,X,{value:W,writable:!0,enumerable:!0,configurable:!0})}function f(...Q){let X={};for(let W of Q){let Y=Object.getOwnPropertyDescriptors(W);Object.assign(X,Y)}return Object.defineProperties({},X)}function m9(Q){return f(Q._zod.def)}function f9(Q,X){if(!X)return Q;return X.reduce((W,Y)=>W?.[Y],Q)}function o9(Q){let X=Object.keys(Q),W=X.map((Y)=>Q[Y]);return Promise.all(W).then((Y)=>{let J={};for(let G=0;G<X.length;G++)J[X[G]]=Y[G];return J})}function l9(Q=10){let W="";for(let Y=0;Y<Q;Y++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function DQ(Q){return JSON.stringify(Q)}function uQ(Q){return Q.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var VQ="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function n(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var cQ=JQ(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function o(Q){if(n(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let W=X.prototype;if(n(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function _1(Q){if(o(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function r9(Q){let X=0;for(let W in Q)if(Object.prototype.hasOwnProperty.call(Q,W))X++;return X}var p9=(Q)=>{let X=typeof Q;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(Q)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Q.then&&typeof Q.then==="function"&&Q.catch&&typeof Q.catch==="function")return"promise";if(typeof Map<"u"&&Q instanceof Map)return"map";if(typeof Set<"u"&&Q instanceof Set)return"set";if(typeof Date<"u"&&Q instanceof Date)return"date";if(typeof File<"u"&&Q instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},yQ=new Set(["string","number","symbol"]),T1=new Set(["string","number","bigint","boolean","symbol","undefined"]);function x(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(Q,X,W){let Y=new Q._zod.constr(X??Q._zod.def);if(!X||W?.parent)Y._zod.parent=Q;return Y}function B(Q){let X=Q;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function d9(Q){let X;return new Proxy({},{get(W,Y,J){return X??(X=Q()),Reflect.get(X,Y,J)},set(W,Y,J,G){return X??(X=Q()),Reflect.set(X,Y,J,G)},has(W,Y){return X??(X=Q()),Reflect.has(X,Y)},deleteProperty(W,Y){return X??(X=Q()),Reflect.deleteProperty(X,Y)},ownKeys(W){return X??(X=Q()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(W,Y){return X??(X=Q()),Reflect.getOwnPropertyDescriptor(X,Y)},defineProperty(W,Y,J){return X??(X=Q()),Reflect.defineProperty(X,Y,J)}})}function b1(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function mQ(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var fQ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Z1={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function i9(Q,X){let W=Q._zod.def,Y=f(Q._zod.def,{get shape(){let J={};for(let G in X){if(!(G in W.shape))throw Error(`Unrecognized key: "${G}"`);if(!X[G])continue;J[G]=W.shape[G]}return m(this,"shape",J),J},checks:[]});return Z(Q,Y)}function n9(Q,X){let W=Q._zod.def,Y=f(Q._zod.def,{get shape(){let J={...Q._zod.def.shape};for(let G in X){if(!(G in W.shape))throw Error(`Unrecognized key: "${G}"`);if(!X[G])continue;delete J[G]}return m(this,"shape",J),J},checks:[]});return Z(Q,Y)}function e9(Q,X){if(!o(X))throw Error("Invalid input to extend: expected a plain object");let W=Q._zod.def.checks;if(W&&W.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let J=f(Q._zod.def,{get shape(){let G={...Q._zod.def.shape,...X};return m(this,"shape",G),G},checks:[]});return Z(Q,J)}function t9(Q,X){if(!o(X))throw Error("Invalid input to safeExtend: expected a plain object");let W={...Q._zod.def,get shape(){let Y={...Q._zod.def.shape,...X};return m(this,"shape",Y),Y},checks:Q._zod.def.checks};return Z(Q,W)}function a9(Q,X){let W=f(Q._zod.def,{get shape(){let Y={...Q._zod.def.shape,...X._zod.def.shape};return m(this,"shape",Y),Y},get catchall(){return X._zod.def.catchall},checks:[]});return Z(Q,W)}function s9(Q,X,W){let Y=f(X._zod.def,{get shape(){let J=X._zod.def.shape,G={...J};if(W)for(let q in W){if(!(q in J))throw Error(`Unrecognized key: "${q}"`);if(!W[q])continue;G[q]=Q?new Q({type:"optional",innerType:J[q]}):J[q]}else for(let q in J)G[q]=Q?new Q({type:"optional",innerType:J[q]}):J[q];return m(this,"shape",G),G},checks:[]});return Z(X,Y)}function QX(Q,X,W){let Y=f(X._zod.def,{get shape(){let J=X._zod.def.shape,G={...J};if(W)for(let q in W){if(!(q in G))throw Error(`Unrecognized key: "${q}"`);if(!W[q])continue;G[q]=new Q({type:"nonoptional",innerType:J[q]})}else for(let q in J)G[q]=new Q({type:"nonoptional",innerType:J[q]});return m(this,"shape",G),G},checks:[]});return Z(X,Y)}function l(Q,X=0){if(Q.aborted===!0)return!0;for(let W=X;W<Q.issues.length;W++)if(Q.issues[W]?.continue!==!0)return!0;return!1}function u(Q,X){return X.map((W)=>{var Y;return(Y=W).path??(Y.path=[]),W.path.unshift(Q),W})}function WQ(Q){return typeof Q==="string"?Q:Q?.message}function j(Q,X,W){let Y={...Q,path:Q.path??[]};if(!Q.message){let J=WQ(Q.inst?._zod.def?.error?.(Q))??WQ(X?.error?.(Q))??WQ(W.customError?.(Q))??WQ(W.localeError?.(Q))??"Invalid input";Y.message=J}if(delete Y.inst,delete Y.continue,!X?.reportInput)delete Y.input;return Y}function j1(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function KQ(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function t(...Q){let[X,W,Y]=Q;if(typeof X==="string")return{message:X,code:"custom",input:W,inst:Y};return{...X}}function XX(Q){return Object.entries(Q).filter(([X,W])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function k1(Q){let X=atob(Q),W=new Uint8Array(X.length);for(let Y=0;Y<X.length;Y++)W[Y]=X.charCodeAt(Y);return W}function C1(Q){let X="";for(let W=0;W<Q.length;W++)X+=String.fromCharCode(Q[W]);return btoa(X)}function WX(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),W="=".repeat((4-X.length%4)%4);return k1(X+W)}function YX(Q){return C1(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function JX(Q){let X=Q.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let W=new Uint8Array(X.length/2);for(let Y=0;Y<X.length;Y+=2)W[Y/2]=Number.parseInt(X.slice(Y,Y+2),16);return W}function GX(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class v1{constructor(...Q){}}var g1=(Q,X)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:X,enumerable:!1}),Q.message=JSON.stringify(X,e,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},IQ=w("$ZodError",g1),oQ=w("$ZodError",g1,{Parent:Error});function h1(Q,X=(W)=>W.message){let W={},Y=[];for(let J of Q.issues)if(J.path.length>0)W[J.path[0]]=W[J.path[0]]||[],W[J.path[0]].push(X(J));else Y.push(X(J));return{formErrors:Y,fieldErrors:W}}function x1(Q,X=(W)=>W.message){let W={_errors:[]},Y=(J)=>{for(let G of J.issues)if(G.code==="invalid_union"&&G.errors.length)G.errors.map((q)=>Y({issues:q}));else if(G.code==="invalid_key")Y({issues:G.issues});else if(G.code==="invalid_element")Y({issues:G.issues});else if(G.path.length===0)W._errors.push(X(G));else{let q=W,K=0;while(K<G.path.length){let L=G.path[K];if(K!==G.path.length-1)q[L]=q[L]||{_errors:[]};else q[L]=q[L]||{_errors:[]},q[L]._errors.push(X(G));q=q[L],K++}}};return Y(Q),W}var FQ=(Q)=>(X,W,Y,J)=>{let G=Y?Object.assign(Y,{async:!1}):{async:!1},q=X._zod.run({value:W,issues:[]},G);if(q instanceof Promise)throw new h;if(q.issues.length){let K=new(J?.Err??Q)(q.issues.map((L)=>j(L,G,v())));throw VQ(K,J?.callee),K}return q.value};var MQ=(Q)=>async(X,W,Y,J)=>{let G=Y?Object.assign(Y,{async:!0}):{async:!0},q=X._zod.run({value:W,issues:[]},G);if(q instanceof Promise)q=await q;if(q.issues.length){let K=new(J?.Err??Q)(q.issues.map((L)=>j(L,G,v())));throw VQ(K,J?.callee),K}return q.value};var wQ=(Q)=>(X,W,Y)=>{let J=Y?{...Y,async:!1}:{async:!1},G=X._zod.run({value:W,issues:[]},J);if(G instanceof Promise)throw new h;return G.issues.length?{success:!1,error:new(Q??IQ)(G.issues.map((q)=>j(q,J,v())))}:{success:!0,data:G.value}},u1=wQ(oQ),LQ=(Q)=>async(X,W,Y)=>{let J=Y?Object.assign(Y,{async:!0}):{async:!0},G=X._zod.run({value:W,issues:[]},J);if(G instanceof Promise)G=await G;return G.issues.length?{success:!1,error:new Q(G.issues.map((q)=>j(q,J,v())))}:{success:!0,data:G.value}},c1=LQ(oQ),y1=(Q)=>(X,W,Y)=>{let J=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return FQ(Q)(X,W,J)};var m1=(Q)=>(X,W,Y)=>{return FQ(Q)(X,W,Y)};var f1=(Q)=>async(X,W,Y)=>{let J=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return MQ(Q)(X,W,J)};var o1=(Q)=>async(X,W,Y)=>{return MQ(Q)(X,W,Y)};var l1=(Q)=>(X,W,Y)=>{let J=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return wQ(Q)(X,W,J)};var r1=(Q)=>(X,W,Y)=>{return wQ(Q)(X,W,Y)};var p1=(Q)=>async(X,W,Y)=>{let J=Y?Object.assign(Y,{direction:"backward"}):{direction:"backward"};return LQ(Q)(X,W,J)};var d1=(Q)=>async(X,W,Y)=>{return LQ(Q)(X,W,Y)};var i1=/^[cC][^\s-]{8,}$/,n1=/^[0-9a-z]+$/,e1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,t1=/^[0-9a-vA-V]{20}$/,a1=/^[A-Za-z0-9]{27}$/,s1=/^[a-zA-Z0-9_-]{21}$/,Q0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var X0=/^([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})$/,lQ=(Q)=>{if(!Q)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${Q}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var W0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var KX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Y0(){return new RegExp(KX,"u")}var J0=/^(?:(?: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])$/,G0=/^(([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}|:))$/;var q0=/^((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])$/,K0=/^(([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])$/,w0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rQ=/^[A-Za-z0-9_-]*$/;var L0=/^\+(?:[0-9]){6,14}[0-9]$/,A0="(?:(?:\\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])))",H0=new RegExp(`^${A0}$`);function N0(Q){return typeof Q.precision==="number"?Q.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":Q.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${Q.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function B0(Q){return new RegExp(`^${N0(Q)}$`)}function z0(Q){let X=N0({precision:Q.precision}),W=["Z"];if(Q.local)W.push("");if(Q.offset)W.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Y=`${X}(?:${W.join("|")})`;return new RegExp(`^${A0}T(?:${Y})$`)}var E0=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var O0=/^-?\d+$/,D0=/^-?\d+(?:\.\d+)?/,V0=/^(?:true|false)$/i;var I0=/^undefined$/i;var F0=/^[^A-Z]*$/,M0=/^[^a-z]*$/;var S=w("$ZodCheck",(Q,X)=>{var W;Q._zod??(Q._zod={}),Q._zod.def=X,(W=Q._zod).onattach??(W.onattach=[])}),$0={number:"number",bigint:"bigint",object:"date"},pQ=w("$ZodCheckLessThan",(Q,X)=>{S.init(Q,X);let W=$0[typeof X.value];Q._zod.onattach.push((Y)=>{let J=Y._zod.bag,G=(X.inclusive?J.maximum:J.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<G)if(X.inclusive)J.maximum=X.value;else J.exclusiveMaximum=X.value}),Q._zod.check=(Y)=>{if(X.inclusive?Y.value<=X.value:Y.value<X.value)return;Y.issues.push({origin:W,code:"too_big",maximum:X.value,input:Y.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),dQ=w("$ZodCheckGreaterThan",(Q,X)=>{S.init(Q,X);let W=$0[typeof X.value];Q._zod.onattach.push((Y)=>{let J=Y._zod.bag,G=(X.inclusive?J.minimum:J.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>G)if(X.inclusive)J.minimum=X.value;else J.exclusiveMinimum=X.value}),Q._zod.check=(Y)=>{if(X.inclusive?Y.value>=X.value:Y.value>X.value)return;Y.issues.push({origin:W,code:"too_small",minimum:X.value,input:Y.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),P0=w("$ZodCheckMultipleOf",(Q,X)=>{S.init(Q,X),Q._zod.onattach.push((W)=>{var Y;(Y=W._zod.bag).multipleOf??(Y.multipleOf=X.value)}),Q._zod.check=(W)=>{if(typeof W.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%X.value===BigInt(0):xQ(W.value,X.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:X.value,input:W.value,inst:Q,continue:!X.abort})}}),U0=w("$ZodCheckNumberFormat",(Q,X)=>{S.init(Q,X),X.format=X.format||"float64";let W=X.format?.includes("int"),Y=W?"int":"number",[J,G]=fQ[X.format];Q._zod.onattach.push((q)=>{let K=q._zod.bag;if(K.format=X.format,K.minimum=J,K.maximum=G,W)K.pattern=O0}),Q._zod.check=(q)=>{let K=q.value;if(W){if(!Number.isInteger(K)){q.issues.push({expected:Y,format:X.format,code:"invalid_type",continue:!1,input:K,inst:Q});return}if(!Number.isSafeInteger(K)){if(K>0)q.issues.push({input:K,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:Y,continue:!X.abort});else q.issues.push({input:K,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:Y,continue:!X.abort});return}}if(K<J)q.issues.push({origin:"number",input:K,code:"too_small",minimum:J,inclusive:!0,inst:Q,continue:!X.abort});if(K>G)q.issues.push({origin:"number",input:K,code:"too_big",maximum:G,inst:Q})}});var R0=w("$ZodCheckMaxLength",(Q,X)=>{var W;S.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let J=Y.value;return!GQ(J)&&J.length!==void 0}),Q._zod.onattach.push((Y)=>{let J=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<J)Y._zod.bag.maximum=X.maximum}),Q._zod.check=(Y)=>{let J=Y.value;if(J.length<=X.maximum)return;let q=KQ(J);Y.issues.push({origin:q,code:"too_big",maximum:X.maximum,inclusive:!0,input:J,inst:Q,continue:!X.abort})}}),S0=w("$ZodCheckMinLength",(Q,X)=>{var W;S.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let J=Y.value;return!GQ(J)&&J.length!==void 0}),Q._zod.onattach.push((Y)=>{let J=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>J)Y._zod.bag.minimum=X.minimum}),Q._zod.check=(Y)=>{let J=Y.value;if(J.length>=X.minimum)return;let q=KQ(J);Y.issues.push({origin:q,code:"too_small",minimum:X.minimum,inclusive:!0,input:J,inst:Q,continue:!X.abort})}}),_0=w("$ZodCheckLengthEquals",(Q,X)=>{var W;S.init(Q,X),(W=Q._zod.def).when??(W.when=(Y)=>{let J=Y.value;return!GQ(J)&&J.length!==void 0}),Q._zod.onattach.push((Y)=>{let J=Y._zod.bag;J.minimum=X.length,J.maximum=X.length,J.length=X.length}),Q._zod.check=(Y)=>{let J=Y.value,G=J.length;if(G===X.length)return;let q=KQ(J),K=G>X.length;Y.issues.push({origin:q,...K?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:Y.value,inst:Q,continue:!X.abort})}}),AQ=w("$ZodCheckStringFormat",(Q,X)=>{var W,Y;if(S.init(Q,X),Q._zod.onattach.push((J)=>{let G=J._zod.bag;if(G.format=X.format,X.pattern)G.patterns??(G.patterns=new Set),G.patterns.add(X.pattern)}),X.pattern)(W=Q._zod).check??(W.check=(J)=>{if(X.pattern.lastIndex=0,X.pattern.test(J.value))return;J.issues.push({origin:"string",code:"invalid_format",format:X.format,input:J.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:Q,continue:!X.abort})});else(Y=Q._zod).check??(Y.check=()=>{})}),T0=w("$ZodCheckRegex",(Q,X)=>{AQ.init(Q,X),Q._zod.check=(W)=>{if(X.pattern.lastIndex=0,X.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:X.pattern.toString(),inst:Q,continue:!X.abort})}}),b0=w("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=F0),AQ.init(Q,X)}),Z0=w("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=M0),AQ.init(Q,X)}),j0=w("$ZodCheckIncludes",(Q,X)=>{S.init(Q,X);let W=x(X.includes),Y=new RegExp(typeof X.position==="number"?`^.{${X.position}}${W}`:W);X.pattern=Y,Q._zod.onattach.push((J)=>{let G=J._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Y)}),Q._zod.check=(J)=>{if(J.value.includes(X.includes,X.position))return;J.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:J.value,inst:Q,continue:!X.abort})}}),k0=w("$ZodCheckStartsWith",(Q,X)=>{S.init(Q,X);let W=new RegExp(`^${x(X.prefix)}.*`);X.pattern??(X.pattern=W),Q._zod.onattach.push((Y)=>{let J=Y._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(W)}),Q._zod.check=(Y)=>{if(Y.value.startsWith(X.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:Y.value,inst:Q,continue:!X.abort})}}),C0=w("$ZodCheckEndsWith",(Q,X)=>{S.init(Q,X);let W=new RegExp(`.*${x(X.suffix)}$`);X.pattern??(X.pattern=W),Q._zod.onattach.push((Y)=>{let J=Y._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(W)}),Q._zod.check=(Y)=>{if(Y.value.endsWith(X.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:Y.value,inst:Q,continue:!X.abort})}});var v0=w("$ZodCheckOverwrite",(Q,X)=>{S.init(Q,X),Q._zod.check=(W)=>{W.value=X.tx(W.value)}});class iQ{constructor(Q=[]){if(this.content=[],this.indent=0,this)this.args=Q}indented(Q){this.indent+=1,Q(this),this.indent-=1}write(Q){if(typeof Q==="function"){Q(this,{execution:"sync"}),Q(this,{execution:"async"});return}let W=Q.split(`
|
|
2
|
+
`).filter((G)=>G),Y=Math.min(...W.map((G)=>G.length-G.trimStart().length)),J=W.map((G)=>G.slice(Y)).map((G)=>" ".repeat(this.indent*2)+G);for(let G of J)this.content.push(G)}compile(){let Q=Function,X=this?.args,Y=[...(this?.content??[""]).map((J)=>` ${J}`)];return new Q(...X,Y.join(`
|
|
3
|
+
`))}}var h0={major:4,minor:2,patch:1};var I=w("$ZodType",(Q,X)=>{var W;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=h0;let Y=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))Y.unshift(Q);for(let J of Y)for(let G of J._zod.onattach)G(Q);if(Y.length===0)(W=Q._zod).deferred??(W.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let J=(q,K,L)=>{let H=l(q),N;for(let E of K){if(E._zod.def.when){if(!E._zod.def.when(q))continue}else if(H)continue;let O=q.issues.length,$=E._zod.check(q);if($ instanceof Promise&&L?.async===!1)throw new h;if(N||$ instanceof Promise)N=(N??Promise.resolve()).then(async()=>{if(await $,q.issues.length===O)return;if(!H)H=l(q,O)});else{if(q.issues.length===O)continue;if(!H)H=l(q,O)}}if(N)return N.then(()=>{return q});return q},G=(q,K,L)=>{if(l(q))return q.aborted=!0,q;let H=J(K,Y,L);if(H instanceof Promise){if(L.async===!1)throw new h;return H.then((N)=>Q._zod.parse(N,L))}return Q._zod.parse(H,L)};Q._zod.run=(q,K)=>{if(K.skipChecks)return Q._zod.parse(q,K);if(K.direction==="backward"){let H=Q._zod.parse({value:q.value,issues:[]},{...K,skipChecks:!0});if(H instanceof Promise)return H.then((N)=>{return G(N,q,K)});return G(H,q,K)}let L=Q._zod.parse(q,K);if(L instanceof Promise){if(K.async===!1)throw new h;return L.then((H)=>J(H,Y,K))}return J(L,Y,K)}}Q["~standard"]={validate:(J)=>{try{let G=u1(Q,J);return G.success?{value:G.data}:{issues:G.error?.issues}}catch(G){return c1(Q,J).then((q)=>q.success?{value:q.data}:{issues:q.error?.issues})}},vendor:"zod",version:1}}),RQ=w("$ZodString",(Q,X)=>{I.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??E0(Q._zod.bag),Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=String(W.value)}catch(J){}if(typeof W.value==="string")return W;return W.issues.push({expected:"string",code:"invalid_type",input:W.value,inst:Q}),W}}),F=w("$ZodStringFormat",(Q,X)=>{AQ.init(Q,X),RQ.init(Q,X)}),r0=w("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=X0),F.init(Q,X)}),p0=w("$ZodUUID",(Q,X)=>{if(X.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(Y===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=lQ(Y))}else X.pattern??(X.pattern=lQ());F.init(Q,X)}),d0=w("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=W0),F.init(Q,X)}),i0=w("$ZodURL",(Q,X)=>{F.init(Q,X),Q._zod.check=(W)=>{try{let Y=W.value.trim(),J=new URL(Y);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(J.hostname))W.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:W.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))W.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:W.value,inst:Q,continue:!X.abort})}if(X.normalize)W.value=J.href;else W.value=Y;return}catch(Y){W.issues.push({code:"invalid_format",format:"url",input:W.value,inst:Q,continue:!X.abort})}}}),n0=w("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=Y0()),F.init(Q,X)}),e0=w("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=s1),F.init(Q,X)}),t0=w("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=i1),F.init(Q,X)}),a0=w("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=n1),F.init(Q,X)}),s0=w("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=e1),F.init(Q,X)}),Q3=w("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=t1),F.init(Q,X)}),X3=w("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=a1),F.init(Q,X)}),W3=w("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=z0(X)),F.init(Q,X)}),Y3=w("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=H0),F.init(Q,X)}),J3=w("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=B0(X)),F.init(Q,X)}),G3=w("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=Q0),F.init(Q,X)}),q3=w("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=J0),F.init(Q,X),Q._zod.bag.format="ipv4"}),K3=w("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=G0),F.init(Q,X),Q._zod.bag.format="ipv6",Q._zod.check=(W)=>{try{new URL(`http://[${W.value}]`)}catch{W.issues.push({code:"invalid_format",format:"ipv6",input:W.value,inst:Q,continue:!X.abort})}}});var w3=w("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=q0),F.init(Q,X)}),L3=w("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=K0),F.init(Q,X),Q._zod.check=(W)=>{let Y=W.value.split("/");try{if(Y.length!==2)throw Error();let[J,G]=Y;if(!G)throw Error();let q=Number(G);if(`${q}`!==G)throw Error();if(q<0||q>128)throw Error();new URL(`http://[${J}]`)}catch{W.issues.push({code:"invalid_format",format:"cidrv6",input:W.value,inst:Q,continue:!X.abort})}}});function A3(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var H3=w("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=w0),F.init(Q,X),Q._zod.bag.contentEncoding="base64",Q._zod.check=(W)=>{if(A3(W.value))return;W.issues.push({code:"invalid_format",format:"base64",input:W.value,inst:Q,continue:!X.abort})}});function wX(Q){if(!rQ.test(Q))return!1;let X=Q.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),W=X.padEnd(Math.ceil(X.length/4)*4,"=");return A3(W)}var N3=w("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=rQ),F.init(Q,X),Q._zod.bag.contentEncoding="base64url",Q._zod.check=(W)=>{if(wX(W.value))return;W.issues.push({code:"invalid_format",format:"base64url",input:W.value,inst:Q,continue:!X.abort})}}),B3=w("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=L0),F.init(Q,X)});function LX(Q,X=null){try{let W=Q.split(".");if(W.length!==3)return!1;let[Y]=W;if(!Y)return!1;let J=JSON.parse(atob(Y));if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(X&&(!("alg"in J)||J.alg!==X))return!1;return!0}catch{return!1}}var z3=w("$ZodJWT",(Q,X)=>{F.init(Q,X),Q._zod.check=(W)=>{if(LX(W.value,X.alg))return;W.issues.push({code:"invalid_format",format:"jwt",input:W.value,inst:Q,continue:!X.abort})}});var eQ=w("$ZodNumber",(Q,X)=>{I.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??D0,Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=Number(W.value)}catch(q){}let J=W.value;if(typeof J==="number"&&!Number.isNaN(J)&&Number.isFinite(J))return W;let G=typeof J==="number"?Number.isNaN(J)?"NaN":!Number.isFinite(J)?"Infinity":void 0:void 0;return W.issues.push({expected:"number",code:"invalid_type",input:J,inst:Q,...G?{received:G}:{}}),W}}),E3=w("$ZodNumberFormat",(Q,X)=>{U0.init(Q,X),eQ.init(Q,X)}),O3=w("$ZodBoolean",(Q,X)=>{I.init(Q,X),Q._zod.pattern=V0,Q._zod.parse=(W,Y)=>{if(X.coerce)try{W.value=Boolean(W.value)}catch(G){}let J=W.value;if(typeof J==="boolean")return W;return W.issues.push({expected:"boolean",code:"invalid_type",input:J,inst:Q}),W}});var D3=w("$ZodUndefined",(Q,X)=>{I.init(Q,X),Q._zod.pattern=I0,Q._zod.values=new Set([void 0]),Q._zod.optin="optional",Q._zod.optout="optional",Q._zod.parse=(W,Y)=>{let J=W.value;if(typeof J>"u")return W;return W.issues.push({expected:"undefined",code:"invalid_type",input:J,inst:Q}),W}});var V3=w("$ZodUnknown",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W)=>W}),I3=w("$ZodNever",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{return W.issues.push({expected:"never",code:"invalid_type",input:W.value,inst:Q}),W}});function x0(Q,X,W){if(Q.issues.length)X.issues.push(...u(W,Q.issues));X.value[W]=Q.value}var F3=w("$ZodArray",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{let J=W.value;if(!Array.isArray(J))return W.issues.push({expected:"array",code:"invalid_type",input:J,inst:Q}),W;W.value=Array(J.length);let G=[];for(let q=0;q<J.length;q++){let K=J[q],L=X.element._zod.run({value:K,issues:[]},Y);if(L instanceof Promise)G.push(L.then((H)=>x0(H,W,q)));else x0(L,W,q)}if(G.length)return Promise.all(G).then(()=>W);return W}});function UQ(Q,X,W,Y){if(Q.issues.length)X.issues.push(...u(W,Q.issues));if(Q.value===void 0){if(W in Y)X.value[W]=void 0}else X.value[W]=Q.value}function M3(Q){let X=Object.keys(Q.shape);for(let Y of X)if(!Q.shape?.[Y]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Y}": expected a Zod schema`);let W=mQ(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(W)}}function $3(Q,X,W,Y,J,G){let q=[],K=J.keySet,L=J.catchall._zod,H=L.def.type;for(let N in X){if(K.has(N))continue;if(H==="never"){q.push(N);continue}let E=L.run({value:X[N],issues:[]},Y);if(E instanceof Promise)Q.push(E.then((O)=>UQ(O,W,N,X)));else UQ(E,W,N,X)}if(q.length)W.issues.push({code:"unrecognized_keys",keys:q,input:X,inst:G});if(!Q.length)return W;return Promise.all(Q).then(()=>{return W})}var AX=w("$ZodObject",(Q,X)=>{if(I.init(Q,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let K=X.shape;Object.defineProperty(X,"shape",{get:()=>{let L={...K};return Object.defineProperty(X,"shape",{value:L}),L}})}let Y=JQ(()=>M3(X));V(Q._zod,"propValues",()=>{let K=X.shape,L={};for(let H in K){let N=K[H]._zod;if(N.values){L[H]??(L[H]=new Set);for(let E of N.values)L[H].add(E)}}return L});let J=n,G=X.catchall,q;Q._zod.parse=(K,L)=>{q??(q=Y.value);let H=K.value;if(!J(H))return K.issues.push({expected:"object",code:"invalid_type",input:H,inst:Q}),K;K.value={};let N=[],E=q.shape;for(let O of q.keys){let T=E[O]._zod.run({value:H[O],issues:[]},L);if(T instanceof Promise)N.push(T.then((vQ)=>UQ(vQ,K,O,H)));else UQ(T,K,O,H)}if(!G)return N.length?Promise.all(N).then(()=>K):K;return $3(N,H,K,L,Y.value,Q)}}),P3=w("$ZodObjectJIT",(Q,X)=>{AX.init(Q,X);let W=Q._zod.parse,Y=JQ(()=>M3(X)),J=(O)=>{let $=new iQ(["shape","payload","ctx"]),T=Y.value,vQ=(g)=>{let C=DQ(g);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};$.write("const input = payload.value;");let R1=Object.create(null),b9=0;for(let g of T.keys)R1[g]=`key_${b9++}`;$.write("const newResult = {};");for(let g of T.keys){let C=R1[g],QQ=DQ(g);$.write(`const ${C} = ${vQ(g)};`),$.write(`
|
|
4
|
+
if (${C}.issues.length) {
|
|
5
|
+
payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
|
|
6
|
+
...iss,
|
|
7
|
+
path: iss.path ? [${QQ}, ...iss.path] : [${QQ}]
|
|
8
|
+
})));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
if (${C}.value === undefined) {
|
|
13
|
+
if (${QQ} in input) {
|
|
14
|
+
newResult[${QQ}] = undefined;
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
newResult[${QQ}] = ${C}.value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
`)}$.write("payload.value = newResult;"),$.write("return payload;");let Z9=$.compile();return(g,C)=>Z9(O,g,C)},G,q=n,K=!OQ.jitless,H=K&&cQ.value,N=X.catchall,E;Q._zod.parse=(O,$)=>{E??(E=Y.value);let T=O.value;if(!q(T))return O.issues.push({expected:"object",code:"invalid_type",input:T,inst:Q}),O;if(K&&H&&$?.async===!1&&$.jitless!==!0){if(!G)G=J(X.shape);if(O=G(O,$),!N)return O;return $3([],T,O,$,E,Q)}return W(O,$)}});function u0(Q,X,W,Y){for(let G of Q)if(G.issues.length===0)return X.value=G.value,X;let J=Q.filter((G)=>!l(G));if(J.length===1)return X.value=J[0].value,J[0];return X.issues.push({code:"invalid_union",input:X.value,inst:W,errors:Q.map((G)=>G.issues.map((q)=>j(q,Y,v())))}),X}var U3=w("$ZodUnion",(Q,X)=>{I.init(Q,X),V(Q._zod,"optin",()=>X.options.some((J)=>J._zod.optin==="optional")?"optional":void 0),V(Q._zod,"optout",()=>X.options.some((J)=>J._zod.optout==="optional")?"optional":void 0),V(Q._zod,"values",()=>{if(X.options.every((J)=>J._zod.values))return new Set(X.options.flatMap((J)=>Array.from(J._zod.values)));return}),V(Q._zod,"pattern",()=>{if(X.options.every((J)=>J._zod.pattern)){let J=X.options.map((G)=>G._zod.pattern);return new RegExp(`^(${J.map((G)=>qQ(G.source)).join("|")})$`)}return});let W=X.options.length===1,Y=X.options[0]._zod.run;Q._zod.parse=(J,G)=>{if(W)return Y(J,G);let q=!1,K=[];for(let L of X.options){let H=L._zod.run({value:J.value,issues:[]},G);if(H instanceof Promise)K.push(H),q=!0;else{if(H.issues.length===0)return H;K.push(H)}}if(!q)return u0(K,J,Q,G);return Promise.all(K).then((L)=>{return u0(L,J,Q,G)})}});var R3=w("$ZodIntersection",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{let J=W.value,G=X.left._zod.run({value:J,issues:[]},Y),q=X.right._zod.run({value:J,issues:[]},Y);if(G instanceof Promise||q instanceof Promise)return Promise.all([G,q]).then(([L,H])=>{return c0(W,L,H)});return c0(W,G,q)}});function nQ(Q,X){if(Q===X)return{valid:!0,data:Q};if(Q instanceof Date&&X instanceof Date&&+Q===+X)return{valid:!0,data:Q};if(o(Q)&&o(X)){let W=Object.keys(X),Y=Object.keys(Q).filter((G)=>W.indexOf(G)!==-1),J={...Q,...X};for(let G of Y){let q=nQ(Q[G],X[G]);if(!q.valid)return{valid:!1,mergeErrorPath:[G,...q.mergeErrorPath]};J[G]=q.data}return{valid:!0,data:J}}if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let Y=0;Y<Q.length;Y++){let J=Q[Y],G=X[Y],q=nQ(J,G);if(!q.valid)return{valid:!1,mergeErrorPath:[Y,...q.mergeErrorPath]};W.push(q.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function c0(Q,X,W){if(X.issues.length)Q.issues.push(...X.issues);if(W.issues.length)Q.issues.push(...W.issues);if(l(Q))return Q;let Y=nQ(X.value,W.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return Q.value=Y.data,Q}var S3=w("$ZodRecord",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{let J=W.value;if(!o(J))return W.issues.push({expected:"record",code:"invalid_type",input:J,inst:Q}),W;let G=[],q=X.keyType._zod.values;if(q){W.value={};let K=new Set;for(let H of q)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let N=X.valueType._zod.run({value:J[H],issues:[]},Y);if(N instanceof Promise)G.push(N.then((E)=>{if(E.issues.length)W.issues.push(...u(H,E.issues));W.value[H]=E.value}));else{if(N.issues.length)W.issues.push(...u(H,N.issues));W.value[H]=N.value}}let L;for(let H in J)if(!K.has(H))L=L??[],L.push(H);if(L&&L.length>0)W.issues.push({code:"unrecognized_keys",input:J,inst:Q,keys:L})}else{W.value={};for(let K of Reflect.ownKeys(J)){if(K==="__proto__")continue;let L=X.keyType._zod.run({value:K,issues:[]},Y);if(L instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(L.issues.length){if(X.mode==="loose")W.value[K]=J[K];else W.issues.push({code:"invalid_key",origin:"record",issues:L.issues.map((N)=>j(N,Y,v())),input:K,path:[K],inst:Q});continue}let H=X.valueType._zod.run({value:J[K],issues:[]},Y);if(H instanceof Promise)G.push(H.then((N)=>{if(N.issues.length)W.issues.push(...u(K,N.issues));W.value[L.value]=N.value}));else{if(H.issues.length)W.issues.push(...u(K,H.issues));W.value[L.value]=H.value}}}if(G.length)return Promise.all(G).then(()=>W);return W}});var _3=w("$ZodEnum",(Q,X)=>{I.init(Q,X);let W=YQ(X.entries),Y=new Set(W);Q._zod.values=Y,Q._zod.pattern=new RegExp(`^(${W.filter((J)=>yQ.has(typeof J)).map((J)=>typeof J==="string"?x(J):J.toString()).join("|")})$`),Q._zod.parse=(J,G)=>{let q=J.value;if(Y.has(q))return J;return J.issues.push({code:"invalid_value",values:W,input:q,inst:Q}),J}}),T3=w("$ZodLiteral",(Q,X)=>{if(I.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");let W=new Set(X.values);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?x(Y):Y?x(Y.toString()):String(Y)).join("|")})$`),Q._zod.parse=(Y,J)=>{let G=Y.value;if(W.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:Q}),Y}});var b3=w("$ZodTransform",(Q,X)=>{I.init(Q,X),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")throw new XQ(Q.constructor.name);let J=X.transform(W.value,W);if(Y.async)return(J instanceof Promise?J:Promise.resolve(J)).then((q)=>{return W.value=q,W});if(J instanceof Promise)throw new h;return W.value=J,W}});function y0(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var Z3=w("$ZodOptional",(Q,X)=>{I.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",V(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),V(Q._zod,"pattern",()=>{let W=X.innerType._zod.pattern;return W?new RegExp(`^(${qQ(W.source)})?$`):void 0}),Q._zod.parse=(W,Y)=>{if(X.innerType._zod.optin==="optional"){let J=X.innerType._zod.run(W,Y);if(J instanceof Promise)return J.then((G)=>y0(G,W.value));return y0(J,W.value)}if(W.value===void 0)return W;return X.innerType._zod.run(W,Y)}}),j3=w("$ZodNullable",(Q,X)=>{I.init(Q,X),V(Q._zod,"optin",()=>X.innerType._zod.optin),V(Q._zod,"optout",()=>X.innerType._zod.optout),V(Q._zod,"pattern",()=>{let W=X.innerType._zod.pattern;return W?new RegExp(`^(${qQ(W.source)}|null)$`):void 0}),V(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),Q._zod.parse=(W,Y)=>{if(W.value===null)return W;return X.innerType._zod.run(W,Y)}}),k3=w("$ZodDefault",(Q,X)=>{I.init(Q,X),Q._zod.optin="optional",V(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);if(W.value===void 0)return W.value=X.defaultValue,W;let J=X.innerType._zod.run(W,Y);if(J instanceof Promise)return J.then((G)=>m0(G,X));return m0(J,X)}});function m0(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var C3=w("$ZodPrefault",(Q,X)=>{I.init(Q,X),Q._zod.optin="optional",V(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);if(W.value===void 0)W.value=X.defaultValue;return X.innerType._zod.run(W,Y)}}),v3=w("$ZodNonOptional",(Q,X)=>{I.init(Q,X),V(Q._zod,"values",()=>{let W=X.innerType._zod.values;return W?new Set([...W].filter((Y)=>Y!==void 0)):void 0}),Q._zod.parse=(W,Y)=>{let J=X.innerType._zod.run(W,Y);if(J instanceof Promise)return J.then((G)=>f0(G,Q));return f0(J,Q)}});function f0(Q,X){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:X});return Q}var g3=w("$ZodCatch",(Q,X)=>{I.init(Q,X),V(Q._zod,"optin",()=>X.innerType._zod.optin),V(Q._zod,"optout",()=>X.innerType._zod.optout),V(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);let J=X.innerType._zod.run(W,Y);if(J instanceof Promise)return J.then((G)=>{if(W.value=G.value,G.issues.length)W.value=X.catchValue({...W,error:{issues:G.issues.map((q)=>j(q,Y,v()))},input:W.value}),W.issues=[];return W});if(W.value=J.value,J.issues.length)W.value=X.catchValue({...W,error:{issues:J.issues.map((G)=>j(G,Y,v()))},input:W.value}),W.issues=[];return W}});var h3=w("$ZodPipe",(Q,X)=>{I.init(Q,X),V(Q._zod,"values",()=>X.in._zod.values),V(Q._zod,"optin",()=>X.in._zod.optin),V(Q._zod,"optout",()=>X.out._zod.optout),V(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward"){let G=X.out._zod.run(W,Y);if(G instanceof Promise)return G.then((q)=>PQ(q,X.in,Y));return PQ(G,X.in,Y)}let J=X.in._zod.run(W,Y);if(J instanceof Promise)return J.then((G)=>PQ(G,X.out,Y));return PQ(J,X.out,Y)}});function PQ(Q,X,W){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},W)}var x3=w("$ZodReadonly",(Q,X)=>{I.init(Q,X),V(Q._zod,"propValues",()=>X.innerType._zod.propValues),V(Q._zod,"values",()=>X.innerType._zod.values),V(Q._zod,"optin",()=>X.innerType?._zod?.optin),V(Q._zod,"optout",()=>X.innerType?._zod?.optout),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(W,Y);let J=X.innerType._zod.run(W,Y);if(J instanceof Promise)return J.then(o0);return o0(J)}});function o0(Q){return Q.value=Object.freeze(Q.value),Q}var u3=w("$ZodCustom",(Q,X)=>{S.init(Q,X),I.init(Q,X),Q._zod.parse=(W,Y)=>{return W},Q._zod.check=(W)=>{let Y=W.value,J=X.fn(Y);if(J instanceof Promise)return J.then((G)=>l0(G,W,Y,Q));l0(J,W,Y,Q);return}});function l0(Q,X,W,Y){if(!Q){let J={code:"custom",input:W,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)J.params=Y._zod.def.params;X.issues.push(t(J))}}var c3,N6=Symbol("ZodOutput"),B6=Symbol("ZodInput");class y3{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...X){let W=X[0];if(this._map.set(Q,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,Q)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Q){let X=this._map.get(Q);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(Q),this}get(Q){let X=Q._zod.parent;if(X){let W={...this.get(X)??{}};delete W.id;let Y={...W,...this._map.get(Q)};return Object.keys(Y).length?Y:void 0}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function HX(){return new y3}(c3=globalThis).__zod_globalRegistry??(c3.__zod_globalRegistry=HX());var d=globalThis.__zod_globalRegistry;function m3(Q,X){return new Q({type:"string",...B(X)})}function f3(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...B(X)})}function tQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...B(X)})}function o3(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...B(X)})}function l3(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(X)})}function r3(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(X)})}function p3(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(X)})}function d3(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...B(X)})}function i3(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...B(X)})}function n3(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(X)})}function e3(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...B(X)})}function t3(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(X)})}function a3(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...B(X)})}function s3(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...B(X)})}function Q4(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(X)})}function X4(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(X)})}function W4(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(X)})}function Y4(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(X)})}function J4(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(X)})}function G4(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...B(X)})}function q4(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...B(X)})}function K4(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...B(X)})}function w4(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...B(X)})}function L4(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(X)})}function A4(Q,X){return new Q({type:"string",format:"date",check:"string_format",...B(X)})}function H4(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...B(X)})}function N4(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...B(X)})}function B4(Q,X){return new Q({type:"number",checks:[],...B(X)})}function z4(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...B(X)})}function E4(Q,X){return new Q({type:"boolean",...B(X)})}function O4(Q,X){return new Q({type:"undefined",...B(X)})}function D4(Q){return new Q({type:"unknown"})}function V4(Q,X){return new Q({type:"never",...B(X)})}function SQ(Q,X){return new pQ({check:"less_than",...B(X),value:Q,inclusive:!1})}function HQ(Q,X){return new pQ({check:"less_than",...B(X),value:Q,inclusive:!0})}function _Q(Q,X){return new dQ({check:"greater_than",...B(X),value:Q,inclusive:!1})}function NQ(Q,X){return new dQ({check:"greater_than",...B(X),value:Q,inclusive:!0})}function TQ(Q,X){return new P0({check:"multiple_of",...B(X),value:Q})}function bQ(Q,X){return new R0({check:"max_length",...B(X),maximum:Q})}function a(Q,X){return new S0({check:"min_length",...B(X),minimum:Q})}function ZQ(Q,X){return new _0({check:"length_equals",...B(X),length:Q})}function aQ(Q,X){return new T0({check:"string_format",format:"regex",...B(X),pattern:Q})}function sQ(Q){return new b0({check:"string_format",format:"lowercase",...B(Q)})}function Q1(Q){return new Z0({check:"string_format",format:"uppercase",...B(Q)})}function X1(Q,X){return new j0({check:"string_format",format:"includes",...B(X),includes:Q})}function W1(Q,X){return new k0({check:"string_format",format:"starts_with",...B(X),prefix:Q})}function Y1(Q,X){return new C0({check:"string_format",format:"ends_with",...B(X),suffix:Q})}function r(Q){return new v0({check:"overwrite",tx:Q})}function J1(Q){return r((X)=>X.normalize(Q))}function G1(){return r((Q)=>Q.trim())}function q1(){return r((Q)=>Q.toLowerCase())}function K1(){return r((Q)=>Q.toUpperCase())}function w1(){return r((Q)=>uQ(Q))}function I4(Q,X,W){return new Q({type:"array",element:X,...B(W)})}function F4(Q,X,W){return new Q({type:"custom",check:"custom",fn:X,...B(W)})}function M4(Q){let X=NX((W)=>{return W.addIssue=(Y)=>{if(typeof Y==="string")W.issues.push(t(Y,W.value,X._zod.def));else{let J=Y;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=W.value),J.inst??(J.inst=X),J.continue??(J.continue=!X._zod.def.abort),W.issues.push(t(J))}},Q(W.value,W)});return X}function NX(Q,X){let W=new S({check:"custom",...B(X)});return W._zod.check=Q,W}function L1(Q){let X=Q?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:Q.processors??{},metadataRegistry:Q?.metadata??d,target:X,unrepresentable:Q?.unrepresentable??"throw",override:Q?.override??(()=>{}),io:Q?.io??"output",counter:0,seen:new Map,cycles:Q?.cycles??"ref",reused:Q?.reused??"inline",external:Q?.external??void 0}}function R(Q,X,W={path:[],schemaPath:[]}){var Y;let J=Q._zod.def,G=X.seen.get(Q);if(G){if(G.count++,W.schemaPath.includes(Q))G.cycle=W.path;return G.schema}let q={schema:{},count:1,cycle:void 0,path:W.path};X.seen.set(Q,q);let K=Q._zod.toJSONSchema?.();if(K)q.schema=K;else{let N={...W,schemaPath:[...W.schemaPath,Q],path:W.path},E=Q._zod.parent;if(E)q.ref=E,R(E,X,N),X.seen.get(E).isParent=!0;else if(Q._zod.processJSONSchema)Q._zod.processJSONSchema(X,q.schema,N);else{let O=q.schema,$=X.processors[J.type];if(!$)throw Error(`[toJSONSchema]: Non-representable type encountered: ${J.type}`);$(Q,X,O,N)}}let L=X.metadataRegistry.get(Q);if(L)Object.assign(q.schema,L);if(X.io==="input"&&_(Q))delete q.schema.examples,delete q.schema.default;if(X.io==="input"&&q.schema._prefault)(Y=q.schema).default??(Y.default=q.schema._prefault);return delete q.schema._prefault,X.seen.get(Q).schema}function A1(Q,X){let W=Q.seen.get(X);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(G)=>{let q=Q.target==="draft-2020-12"?"$defs":"definitions";if(Q.external){let N=Q.external.registry.get(G[0])?.id,E=Q.external.uri??(($)=>$);if(N)return{ref:E(N)};let O=G[1].defId??G[1].schema.id??`schema${Q.counter++}`;return G[1].defId=O,{defId:O,ref:`${E("__shared")}#/${q}/${O}`}}if(G[1]===W)return{ref:"#"};let L=`${"#"}/${q}/`,H=G[1].schema.id??`__schema${Q.counter++}`;return{defId:H,ref:L+H}},J=(G)=>{if(G[1].schema.$ref)return;let q=G[1],{ref:K,defId:L}=Y(G);if(q.def={...q.schema},L)q.defId=L;let H=q.schema;for(let N in H)delete H[N];H.$ref=K};if(Q.cycles==="throw")for(let G of Q.seen.entries()){let q=G[1];if(q.cycle)throw Error(`Cycle detected: #/${q.cycle?.join("/")}/<root>
|
|
21
|
+
|
|
22
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let G of Q.seen.entries()){let q=G[1];if(X===G[0]){J(G);continue}if(Q.external){let L=Q.external.registry.get(G[0])?.id;if(X!==G[0]&&L){J(G);continue}}if(Q.metadataRegistry.get(G[0])?.id){J(G);continue}if(q.cycle){J(G);continue}if(q.count>1){if(Q.reused==="ref"){J(G);continue}}}}function H1(Q,X){let W=Q.seen.get(X);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(q)=>{let K=Q.seen.get(q),L=K.def??K.schema,H={...L};if(K.ref===null)return;let N=K.ref;if(K.ref=null,N){Y(N);let E=Q.seen.get(N).schema;if(E.$ref&&(Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"))L.allOf=L.allOf??[],L.allOf.push(E);else Object.assign(L,E),Object.assign(L,H)}if(!K.isParent)Q.override({zodSchema:q,jsonSchema:L,path:K.path??[]})};for(let q of[...Q.seen.entries()].reverse())Y(q[0]);let J={};if(Q.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if(Q.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if(Q.target==="openapi-3.0");if(Q.external?.uri){let q=Q.external.registry.get(X)?.id;if(!q)throw Error("Schema is missing an `id` property");J.$id=Q.external.uri(q)}Object.assign(J,W.def??W.schema);let G=Q.external?.defs??{};for(let q of Q.seen.entries()){let K=q[1];if(K.def&&K.defId)G[K.defId]=K.def}if(Q.external);else if(Object.keys(G).length>0)if(Q.target==="draft-2020-12")J.$defs=G;else J.definitions=G;try{let q=JSON.parse(JSON.stringify(J));return Object.defineProperty(q,"~standard",{value:{...X["~standard"],jsonSchema:{input:BQ(X,"input"),output:BQ(X,"output")}},enumerable:!1,writable:!1}),q}catch(q){throw Error("Error converting schema to JSON.")}}function _(Q,X){let W=X??{seen:new Set};if(W.seen.has(Q))return!1;W.seen.add(Q);let Y=Q._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return _(Y.element,W);if(Y.type==="set")return _(Y.valueType,W);if(Y.type==="lazy")return _(Y.getter(),W);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return _(Y.innerType,W);if(Y.type==="intersection")return _(Y.left,W)||_(Y.right,W);if(Y.type==="record"||Y.type==="map")return _(Y.keyType,W)||_(Y.valueType,W);if(Y.type==="pipe")return _(Y.in,W)||_(Y.out,W);if(Y.type==="object"){for(let J in Y.shape)if(_(Y.shape[J],W))return!0;return!1}if(Y.type==="union"){for(let J of Y.options)if(_(J,W))return!0;return!1}if(Y.type==="tuple"){for(let J of Y.items)if(_(J,W))return!0;if(Y.rest&&_(Y.rest,W))return!0;return!1}return!1}var $4=(Q,X={})=>(W)=>{let Y=L1({...W,processors:X});return R(Q,Y),A1(Y,Q),H1(Y,Q)},BQ=(Q,X)=>(W)=>{let{libraryOptions:Y,target:J}=W??{},G=L1({...Y??{},target:J,io:X,processors:{}});return R(Q,G),A1(G,Q),H1(G,Q)};var BX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},P4=(Q,X,W,Y)=>{let J=W;J.type="string";let{minimum:G,maximum:q,format:K,patterns:L,contentEncoding:H}=Q._zod.bag;if(typeof G==="number")J.minLength=G;if(typeof q==="number")J.maxLength=q;if(K){if(J.format=BX[K]??K,J.format==="")delete J.format}if(H)J.contentEncoding=H;if(L&&L.size>0){let N=[...L];if(N.length===1)J.pattern=N[0].source;else if(N.length>1)J.allOf=[...N.map((E)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:E.source}))]}},U4=(Q,X,W,Y)=>{let J=W,{minimum:G,maximum:q,format:K,multipleOf:L,exclusiveMaximum:H,exclusiveMinimum:N}=Q._zod.bag;if(typeof K==="string"&&K.includes("int"))J.type="integer";else J.type="number";if(typeof N==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")J.minimum=N,J.exclusiveMinimum=!0;else J.exclusiveMinimum=N;if(typeof G==="number"){if(J.minimum=G,typeof N==="number"&&X.target!=="draft-04")if(N>=G)delete J.minimum;else delete J.exclusiveMinimum}if(typeof H==="number")if(X.target==="draft-04"||X.target==="openapi-3.0")J.maximum=H,J.exclusiveMaximum=!0;else J.exclusiveMaximum=H;if(typeof q==="number"){if(J.maximum=q,typeof H==="number"&&X.target!=="draft-04")if(H<=q)delete J.maximum;else delete J.exclusiveMaximum}if(typeof L==="number")J.multipleOf=L},R4=(Q,X,W,Y)=>{W.type="boolean"};var S4=(Q,X,W,Y)=>{if(X.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")};var _4=(Q,X,W,Y)=>{W.not={}};var T4=(Q,X,W,Y)=>{};var b4=(Q,X,W,Y)=>{let J=Q._zod.def,G=YQ(J.entries);if(G.every((q)=>typeof q==="number"))W.type="number";if(G.every((q)=>typeof q==="string"))W.type="string";W.enum=G},Z4=(Q,X,W,Y)=>{let J=Q._zod.def,G=[];for(let q of J.values)if(q===void 0){if(X.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof q==="bigint")if(X.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else G.push(Number(q));else G.push(q);if(G.length===0);else if(G.length===1){let q=G[0];if(W.type=q===null?"null":typeof q,X.target==="draft-04"||X.target==="openapi-3.0")W.enum=[q];else W.const=q}else{if(G.every((q)=>typeof q==="number"))W.type="number";if(G.every((q)=>typeof q==="string"))W.type="string";if(G.every((q)=>typeof q==="boolean"))W.type="boolean";if(G.every((q)=>q===null))W.type="null";W.enum=G}};var j4=(Q,X,W,Y)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var k4=(Q,X,W,Y)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var C4=(Q,X,W,Y)=>{let J=W,G=Q._zod.def,{minimum:q,maximum:K}=Q._zod.bag;if(typeof q==="number")J.minItems=q;if(typeof K==="number")J.maxItems=K;J.type="array",J.items=R(G.element,X,{...Y,path:[...Y.path,"items"]})},v4=(Q,X,W,Y)=>{let J=W,G=Q._zod.def;J.type="object",J.properties={};let q=G.shape;for(let H in q)J.properties[H]=R(q[H],X,{...Y,path:[...Y.path,"properties",H]});let K=new Set(Object.keys(q)),L=new Set([...K].filter((H)=>{let N=G.shape[H]._zod;if(X.io==="input")return N.optin===void 0;else return N.optout===void 0}));if(L.size>0)J.required=Array.from(L);if(G.catchall?._zod.def.type==="never")J.additionalProperties=!1;else if(!G.catchall){if(X.io==="output")J.additionalProperties=!1}else if(G.catchall)J.additionalProperties=R(G.catchall,X,{...Y,path:[...Y.path,"additionalProperties"]})},g4=(Q,X,W,Y)=>{let J=Q._zod.def,G=J.inclusive===!1,q=J.options.map((K,L)=>R(K,X,{...Y,path:[...Y.path,G?"oneOf":"anyOf",L]}));if(G)W.oneOf=q;else W.anyOf=q},h4=(Q,X,W,Y)=>{let J=Q._zod.def,G=R(J.left,X,{...Y,path:[...Y.path,"allOf",0]}),q=R(J.right,X,{...Y,path:[...Y.path,"allOf",1]}),K=(H)=>("allOf"in H)&&Object.keys(H).length===1,L=[...K(G)?G.allOf:[G],...K(q)?q.allOf:[q]];W.allOf=L};var x4=(Q,X,W,Y)=>{let J=W,G=Q._zod.def;if(J.type="object",X.target==="draft-07"||X.target==="draft-2020-12")J.propertyNames=R(G.keyType,X,{...Y,path:[...Y.path,"propertyNames"]});J.additionalProperties=R(G.valueType,X,{...Y,path:[...Y.path,"additionalProperties"]})},u4=(Q,X,W,Y)=>{let J=Q._zod.def,G=R(J.innerType,X,Y),q=X.seen.get(Q);if(X.target==="openapi-3.0")q.ref=J.innerType,W.nullable=!0;else W.anyOf=[G,{type:"null"}]},c4=(Q,X,W,Y)=>{let J=Q._zod.def;R(J.innerType,X,Y);let G=X.seen.get(Q);G.ref=J.innerType},y4=(Q,X,W,Y)=>{let J=Q._zod.def;R(J.innerType,X,Y);let G=X.seen.get(Q);G.ref=J.innerType,W.default=JSON.parse(JSON.stringify(J.defaultValue))},m4=(Q,X,W,Y)=>{let J=Q._zod.def;R(J.innerType,X,Y);let G=X.seen.get(Q);if(G.ref=J.innerType,X.io==="input")W._prefault=JSON.parse(JSON.stringify(J.defaultValue))},f4=(Q,X,W,Y)=>{let J=Q._zod.def;R(J.innerType,X,Y);let G=X.seen.get(Q);G.ref=J.innerType;let q;try{q=J.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}W.default=q},o4=(Q,X,W,Y)=>{let J=Q._zod.def,G=X.io==="input"?J.in._zod.def.type==="transform"?J.out:J.in:J.out;R(G,X,Y);let q=X.seen.get(Q);q.ref=G},l4=(Q,X,W,Y)=>{let J=Q._zod.def;R(J.innerType,X,Y);let G=X.seen.get(Q);G.ref=J.innerType,W.readOnly=!0};var r4=(Q,X,W,Y)=>{let J=Q._zod.def;R(J.innerType,X,Y);let G=X.seen.get(Q);G.ref=J.innerType};var FX=w("ZodISODateTime",(Q,X)=>{W3.init(Q,X),M.init(Q,X)});function p4(Q){return L4(FX,Q)}var MX=w("ZodISODate",(Q,X)=>{Y3.init(Q,X),M.init(Q,X)});function d4(Q){return A4(MX,Q)}var $X=w("ZodISOTime",(Q,X)=>{J3.init(Q,X),M.init(Q,X)});function i4(Q){return H4($X,Q)}var PX=w("ZodISODuration",(Q,X)=>{G3.init(Q,X),M.init(Q,X)});function n4(Q){return N4(PX,Q)}var e4=(Q,X)=>{IQ.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(W)=>x1(Q,W)},flatten:{value:(W)=>h1(Q,W)},addIssue:{value:(W)=>{Q.issues.push(W),Q.message=JSON.stringify(Q.issues,e,2)}},addIssues:{value:(W)=>{Q.issues.push(...W),Q.message=JSON.stringify(Q.issues,e,2)}},isEmpty:{get(){return Q.issues.length===0}}})},l6=w("ZodError",e4),b=w("ZodError",e4,{Parent:Error});var t4=FQ(b),a4=MQ(b),s4=wQ(b),Q9=LQ(b),X9=y1(b),W9=m1(b),Y9=f1(b),J9=o1(b),G9=l1(b),q9=r1(b),K9=p1(b),w9=d1(b);var P=w("ZodType",(Q,X)=>{return I.init(Q,X),Object.assign(Q["~standard"],{jsonSchema:{input:BQ(Q,"input"),output:BQ(Q,"output")}}),Q.toJSONSchema=$4(Q,{}),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...W)=>{return Q.clone(D.mergeDefs(X,{checks:[...X.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]}))},Q.clone=(W,Y)=>Z(Q,W,Y),Q.brand=()=>Q,Q.register=(W,Y)=>{return W.add(Q,Y),Q},Q.parse=(W,Y)=>t4(Q,W,Y,{callee:Q.parse}),Q.safeParse=(W,Y)=>s4(Q,W,Y),Q.parseAsync=async(W,Y)=>a4(Q,W,Y,{callee:Q.parseAsync}),Q.safeParseAsync=async(W,Y)=>Q9(Q,W,Y),Q.spa=Q.safeParseAsync,Q.encode=(W,Y)=>X9(Q,W,Y),Q.decode=(W,Y)=>W9(Q,W,Y),Q.encodeAsync=async(W,Y)=>Y9(Q,W,Y),Q.decodeAsync=async(W,Y)=>J9(Q,W,Y),Q.safeEncode=(W,Y)=>G9(Q,W,Y),Q.safeDecode=(W,Y)=>q9(Q,W,Y),Q.safeEncodeAsync=async(W,Y)=>K9(Q,W,Y),Q.safeDecodeAsync=async(W,Y)=>w9(Q,W,Y),Q.refine=(W,Y)=>Q.check(V2(W,Y)),Q.superRefine=(W)=>Q.check(I2(W)),Q.overwrite=(W)=>Q.check(r(W)),Q.optional=()=>H9(Q),Q.nullable=()=>N9(Q),Q.nullish=()=>H9(N9(Q)),Q.nonoptional=(W)=>H2(Q,W),Q.array=()=>y(Q),Q.or=(W)=>p([Q,W]),Q.and=(W)=>Q2(Q,W),Q.transform=(W)=>B9(Q,G2(W)),Q.default=(W)=>w2(Q,W),Q.prefault=(W)=>A2(Q,W),Q.catch=(W)=>B2(Q,W),Q.pipe=(W)=>B9(Q,W),Q.readonly=()=>O2(Q),Q.describe=(W)=>{let Y=Q.clone();return d.add(Y,{description:W}),Y},Object.defineProperty(Q,"description",{get(){return d.get(Q)?.description},configurable:!0}),Q.meta=(...W)=>{if(W.length===0)return d.get(Q);let Y=Q.clone();return d.add(Y,W[0]),Y},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),z9=w("_ZodString",(Q,X)=>{RQ.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(Y,J,G)=>P4(Q,Y,J,G);let W=Q._zod.bag;Q.format=W.format??null,Q.minLength=W.minimum??null,Q.maxLength=W.maximum??null,Q.regex=(...Y)=>Q.check(aQ(...Y)),Q.includes=(...Y)=>Q.check(X1(...Y)),Q.startsWith=(...Y)=>Q.check(W1(...Y)),Q.endsWith=(...Y)=>Q.check(Y1(...Y)),Q.min=(...Y)=>Q.check(a(...Y)),Q.max=(...Y)=>Q.check(bQ(...Y)),Q.length=(...Y)=>Q.check(ZQ(...Y)),Q.nonempty=(...Y)=>Q.check(a(1,...Y)),Q.lowercase=(Y)=>Q.check(sQ(Y)),Q.uppercase=(Y)=>Q.check(Q1(Y)),Q.trim=()=>Q.check(G1()),Q.normalize=(...Y)=>Q.check(J1(...Y)),Q.toLowerCase=()=>Q.check(q1()),Q.toUpperCase=()=>Q.check(K1()),Q.slugify=()=>Q.check(w1())}),_X=w("ZodString",(Q,X)=>{RQ.init(Q,X),z9.init(Q,X),Q.email=(W)=>Q.check(f3(TX,W)),Q.url=(W)=>Q.check(d3(bX,W)),Q.jwt=(W)=>Q.check(w4(lX,W)),Q.emoji=(W)=>Q.check(i3(ZX,W)),Q.guid=(W)=>Q.check(tQ(L9,W)),Q.uuid=(W)=>Q.check(o3(kQ,W)),Q.uuidv4=(W)=>Q.check(l3(kQ,W)),Q.uuidv6=(W)=>Q.check(r3(kQ,W)),Q.uuidv7=(W)=>Q.check(p3(kQ,W)),Q.nanoid=(W)=>Q.check(n3(jX,W)),Q.guid=(W)=>Q.check(tQ(L9,W)),Q.cuid=(W)=>Q.check(e3(kX,W)),Q.cuid2=(W)=>Q.check(t3(CX,W)),Q.ulid=(W)=>Q.check(a3(vX,W)),Q.base64=(W)=>Q.check(G4(mX,W)),Q.base64url=(W)=>Q.check(q4(fX,W)),Q.xid=(W)=>Q.check(s3(gX,W)),Q.ksuid=(W)=>Q.check(Q4(hX,W)),Q.ipv4=(W)=>Q.check(X4(xX,W)),Q.ipv6=(W)=>Q.check(W4(uX,W)),Q.cidrv4=(W)=>Q.check(Y4(cX,W)),Q.cidrv6=(W)=>Q.check(J4(yX,W)),Q.e164=(W)=>Q.check(K4(oX,W)),Q.datetime=(W)=>Q.check(p4(W)),Q.date=(W)=>Q.check(d4(W)),Q.time=(W)=>Q.check(i4(W)),Q.duration=(W)=>Q.check(n4(W))});function U(Q){return m3(_X,Q)}var M=w("ZodStringFormat",(Q,X)=>{F.init(Q,X),z9.init(Q,X)}),TX=w("ZodEmail",(Q,X)=>{d0.init(Q,X),M.init(Q,X)});var L9=w("ZodGUID",(Q,X)=>{r0.init(Q,X),M.init(Q,X)});var kQ=w("ZodUUID",(Q,X)=>{p0.init(Q,X),M.init(Q,X)});var bX=w("ZodURL",(Q,X)=>{i0.init(Q,X),M.init(Q,X)});var ZX=w("ZodEmoji",(Q,X)=>{n0.init(Q,X),M.init(Q,X)});var jX=w("ZodNanoID",(Q,X)=>{e0.init(Q,X),M.init(Q,X)});var kX=w("ZodCUID",(Q,X)=>{t0.init(Q,X),M.init(Q,X)});var CX=w("ZodCUID2",(Q,X)=>{a0.init(Q,X),M.init(Q,X)});var vX=w("ZodULID",(Q,X)=>{s0.init(Q,X),M.init(Q,X)});var gX=w("ZodXID",(Q,X)=>{Q3.init(Q,X),M.init(Q,X)});var hX=w("ZodKSUID",(Q,X)=>{X3.init(Q,X),M.init(Q,X)});var xX=w("ZodIPv4",(Q,X)=>{q3.init(Q,X),M.init(Q,X)});var uX=w("ZodIPv6",(Q,X)=>{K3.init(Q,X),M.init(Q,X)});var cX=w("ZodCIDRv4",(Q,X)=>{w3.init(Q,X),M.init(Q,X)});var yX=w("ZodCIDRv6",(Q,X)=>{L3.init(Q,X),M.init(Q,X)});var mX=w("ZodBase64",(Q,X)=>{H3.init(Q,X),M.init(Q,X)});var fX=w("ZodBase64URL",(Q,X)=>{N3.init(Q,X),M.init(Q,X)});var oX=w("ZodE164",(Q,X)=>{B3.init(Q,X),M.init(Q,X)});var lX=w("ZodJWT",(Q,X)=>{z3.init(Q,X),M.init(Q,X)});var E9=w("ZodNumber",(Q,X)=>{eQ.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(Y,J,G)=>U4(Q,Y,J,G),Q.gt=(Y,J)=>Q.check(_Q(Y,J)),Q.gte=(Y,J)=>Q.check(NQ(Y,J)),Q.min=(Y,J)=>Q.check(NQ(Y,J)),Q.lt=(Y,J)=>Q.check(SQ(Y,J)),Q.lte=(Y,J)=>Q.check(HQ(Y,J)),Q.max=(Y,J)=>Q.check(HQ(Y,J)),Q.int=(Y)=>Q.check(A9(Y)),Q.safe=(Y)=>Q.check(A9(Y)),Q.positive=(Y)=>Q.check(_Q(0,Y)),Q.nonnegative=(Y)=>Q.check(NQ(0,Y)),Q.negative=(Y)=>Q.check(SQ(0,Y)),Q.nonpositive=(Y)=>Q.check(HQ(0,Y)),Q.multipleOf=(Y,J)=>Q.check(TQ(Y,J)),Q.step=(Y,J)=>Q.check(TQ(Y,J)),Q.finite=()=>Q;let W=Q._zod.bag;Q.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),Q.isFinite=!0,Q.format=W.format??null});function k(Q){return B4(E9,Q)}var rX=w("ZodNumberFormat",(Q,X)=>{E3.init(Q,X),E9.init(Q,X)});function A9(Q){return z4(rX,Q)}var pX=w("ZodBoolean",(Q,X)=>{O3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>R4(Q,W,Y,J)});function c(Q){return E4(pX,Q)}var dX=w("ZodUndefined",(Q,X)=>{D3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>S4(Q,W,Y,J)});function O9(Q){return O4(dX,Q)}var iX=w("ZodUnknown",(Q,X)=>{V3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>T4(Q,W,Y,J)});function i(){return D4(iX)}var nX=w("ZodNever",(Q,X)=>{I3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>_4(Q,W,Y,J)});function eX(Q){return V4(nX,Q)}var tX=w("ZodArray",(Q,X)=>{F3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>C4(Q,W,Y,J),Q.element=X.element,Q.min=(W,Y)=>Q.check(a(W,Y)),Q.nonempty=(W)=>Q.check(a(1,W)),Q.max=(W,Y)=>Q.check(bQ(W,Y)),Q.length=(W,Y)=>Q.check(ZQ(W,Y)),Q.unwrap=()=>Q.element});function y(Q,X){return I4(tX,Q,X)}var D9=w("ZodObject",(Q,X)=>{P3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>v4(Q,W,Y,J),D.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>W2(Object.keys(Q._zod.def.shape)),Q.catchall=(W)=>Q.clone({...Q._zod.def,catchall:W}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:i()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:i()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:eX()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(W)=>{return D.extend(Q,W)},Q.safeExtend=(W)=>{return D.safeExtend(Q,W)},Q.merge=(W)=>D.merge(Q,W),Q.pick=(W)=>D.pick(Q,W),Q.omit=(W)=>D.omit(Q,W),Q.partial=(...W)=>D.partial(V9,Q,W[0]),Q.required=(...W)=>D.required(I9,Q,W[0])});function z(Q,X){let W={type:"object",shape:Q??{},...D.normalizeParams(X)};return new D9(W)}function s(Q,X){return new D9({type:"object",shape:Q,catchall:i(),...D.normalizeParams(X)})}var aX=w("ZodUnion",(Q,X)=>{U3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>g4(Q,W,Y,J),Q.options=X.options});function p(Q,X){return new aX({type:"union",options:Q,...D.normalizeParams(X)})}var sX=w("ZodIntersection",(Q,X)=>{R3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>h4(Q,W,Y,J)});function Q2(Q,X){return new sX({type:"intersection",left:Q,right:X})}var X2=w("ZodRecord",(Q,X)=>{S3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>x4(Q,W,Y,J),Q.keyType=X.keyType,Q.valueType=X.valueType});function zQ(Q,X,W){return new X2({type:"record",keyType:Q,valueType:X,...D.normalizeParams(W)})}var N1=w("ZodEnum",(Q,X)=>{_3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(Y,J,G)=>b4(Q,Y,J,G),Q.enum=X.entries,Q.options=Object.values(X.entries);let W=new Set(Object.keys(X.entries));Q.extract=(Y,J)=>{let G={};for(let q of Y)if(W.has(q))G[q]=X.entries[q];else throw Error(`Key ${q} not found in enum`);return new N1({...X,checks:[],...D.normalizeParams(J),entries:G})},Q.exclude=(Y,J)=>{let G={...X.entries};for(let q of Y)if(W.has(q))delete G[q];else throw Error(`Key ${q} not found in enum`);return new N1({...X,checks:[],...D.normalizeParams(J),entries:G})}});function W2(Q,X){let W=Array.isArray(Q)?Object.fromEntries(Q.map((Y)=>[Y,Y])):Q;return new N1({type:"enum",entries:W,...D.normalizeParams(X)})}var Y2=w("ZodLiteral",(Q,X)=>{T3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>Z4(Q,W,Y,J),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function A(Q,X){return new Y2({type:"literal",values:Array.isArray(Q)?Q:[Q],...D.normalizeParams(X)})}var J2=w("ZodTransform",(Q,X)=>{b3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>k4(Q,W,Y,J),Q._zod.parse=(W,Y)=>{if(Y.direction==="backward")throw new XQ(Q.constructor.name);W.addIssue=(G)=>{if(typeof G==="string")W.issues.push(D.issue(G,W.value,X));else{let q=G;if(q.fatal)q.continue=!1;q.code??(q.code="custom"),q.input??(q.input=W.value),q.inst??(q.inst=Q),W.issues.push(D.issue(q))}};let J=X.transform(W.value,W);if(J instanceof Promise)return J.then((G)=>{return W.value=G,W});return W.value=J,W}});function G2(Q){return new J2({type:"transform",transform:Q})}var V9=w("ZodOptional",(Q,X)=>{Z3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>r4(Q,W,Y,J),Q.unwrap=()=>Q._zod.def.innerType});function H9(Q){return new V9({type:"optional",innerType:Q})}var q2=w("ZodNullable",(Q,X)=>{j3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>u4(Q,W,Y,J),Q.unwrap=()=>Q._zod.def.innerType});function N9(Q){return new q2({type:"nullable",innerType:Q})}var K2=w("ZodDefault",(Q,X)=>{k3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>y4(Q,W,Y,J),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function w2(Q,X){return new K2({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():D.shallowClone(X)}})}var L2=w("ZodPrefault",(Q,X)=>{C3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>m4(Q,W,Y,J),Q.unwrap=()=>Q._zod.def.innerType});function A2(Q,X){return new L2({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():D.shallowClone(X)}})}var I9=w("ZodNonOptional",(Q,X)=>{v3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>c4(Q,W,Y,J),Q.unwrap=()=>Q._zod.def.innerType});function H2(Q,X){return new I9({type:"nonoptional",innerType:Q,...D.normalizeParams(X)})}var N2=w("ZodCatch",(Q,X)=>{g3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>f4(Q,W,Y,J),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function B2(Q,X){return new N2({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var z2=w("ZodPipe",(Q,X)=>{h3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>o4(Q,W,Y,J),Q.in=X.in,Q.out=X.out});function B9(Q,X){return new z2({type:"pipe",in:Q,out:X})}var E2=w("ZodReadonly",(Q,X)=>{x3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>l4(Q,W,Y,J),Q.unwrap=()=>Q._zod.def.innerType});function O2(Q){return new E2({type:"readonly",innerType:Q})}var D2=w("ZodCustom",(Q,X)=>{u3.init(Q,X),P.init(Q,X),Q._zod.processJSONSchema=(W,Y,J)=>j4(Q,W,Y,J)});function V2(Q,X={}){return F4(D2,Q,X)}function I2(Q){return M4(Q)}import{ContentBlockSchema as F2,CallToolResultSchema as M2,ImplementationSchema as F9,RequestIdSchema as $2,ToolSchema as P2}from"@modelcontextprotocol/sdk/types.js";var M9=p([A("light"),A("dark")]).describe("Color theme preference for the host environment."),CQ=p([A("inline"),A("fullscreen"),A("pip")]).describe("Display mode for UI presentation."),U2=p([A("--color-background-primary"),A("--color-background-secondary"),A("--color-background-tertiary"),A("--color-background-inverse"),A("--color-background-ghost"),A("--color-background-info"),A("--color-background-danger"),A("--color-background-success"),A("--color-background-warning"),A("--color-background-disabled"),A("--color-text-primary"),A("--color-text-secondary"),A("--color-text-tertiary"),A("--color-text-inverse"),A("--color-text-info"),A("--color-text-danger"),A("--color-text-success"),A("--color-text-warning"),A("--color-text-disabled"),A("--color-text-ghost"),A("--color-border-primary"),A("--color-border-secondary"),A("--color-border-tertiary"),A("--color-border-inverse"),A("--color-border-ghost"),A("--color-border-info"),A("--color-border-danger"),A("--color-border-success"),A("--color-border-warning"),A("--color-border-disabled"),A("--color-ring-primary"),A("--color-ring-secondary"),A("--color-ring-inverse"),A("--color-ring-info"),A("--color-ring-danger"),A("--color-ring-success"),A("--color-ring-warning"),A("--font-sans"),A("--font-mono"),A("--font-weight-normal"),A("--font-weight-medium"),A("--font-weight-semibold"),A("--font-weight-bold"),A("--font-text-xs-size"),A("--font-text-sm-size"),A("--font-text-md-size"),A("--font-text-lg-size"),A("--font-heading-xs-size"),A("--font-heading-sm-size"),A("--font-heading-md-size"),A("--font-heading-lg-size"),A("--font-heading-xl-size"),A("--font-heading-2xl-size"),A("--font-heading-3xl-size"),A("--font-text-xs-line-height"),A("--font-text-sm-line-height"),A("--font-text-md-line-height"),A("--font-text-lg-line-height"),A("--font-heading-xs-line-height"),A("--font-heading-sm-line-height"),A("--font-heading-md-line-height"),A("--font-heading-lg-line-height"),A("--font-heading-xl-line-height"),A("--font-heading-2xl-line-height"),A("--font-heading-3xl-line-height"),A("--border-radius-xs"),A("--border-radius-sm"),A("--border-radius-md"),A("--border-radius-lg"),A("--border-radius-xl"),A("--border-radius-full"),A("--border-width-regular"),A("--shadow-hairline"),A("--shadow-sm"),A("--shadow-md"),A("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),R2=zQ(U2.describe(`Style variables for theming MCP apps.
|
|
23
|
+
|
|
24
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
25
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
26
|
+
|
|
27
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
28
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),p([U(),O9()]).describe(`Style variables for theming MCP apps.
|
|
29
|
+
|
|
30
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
31
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
32
|
+
|
|
33
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
34
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
|
|
35
|
+
|
|
36
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
37
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
38
|
+
|
|
39
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
40
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),S2=z({method:A("ui/open-link"),params:z({url:U().describe("URL to open in the host's browser")})}),B1=s({isError:c().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}),z1=s({isError:c().optional().describe("True if the host rejected or failed to deliver the message.")}),_2=z({method:A("ui/notifications/sandbox-proxy-ready"),params:z({})}),T2=z({method:A("ui/notifications/sandbox-resource-ready"),params:z({html:U().describe("HTML content to load into the inner iframe."),sandbox:U().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:z({connectDomains:y(U()).optional().describe("Origins for network requests (fetch/XHR/WebSocket)."),resourceDomains:y(U()).optional().describe("Origins for static resources (scripts, images, styles, fonts).")}).optional().describe("CSP configuration from resource metadata.")})}),b2=z({method:A("ui/notifications/size-changed"),params:z({width:k().optional().describe("New width in pixels."),height:k().optional().describe("New height in pixels.")})}),E1=z({method:A("ui/notifications/tool-input"),params:z({arguments:zQ(U(),i().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),O1=z({method:A("ui/notifications/tool-input-partial"),params:z({arguments:zQ(U(),i().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),D1=z({method:A("ui/notifications/tool-cancelled"),params:z({reason:U().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),$9=z({fonts:U().optional().describe("CSS for font loading (@font-face rules or")}),P9=z({variables:R2.optional().describe("CSS variables for theming the app."),css:$9.optional().describe("CSS blocks that apps can inject.")}),V1=z({method:A("ui/resource-teardown"),params:z({})}),Z2=zQ(U(),i()),U9=z({experimental:z({}).optional().describe("Experimental features (structure TBD)."),openLinks:z({}).optional().describe("Host supports opening external URLs."),serverTools:z({listChanged:c().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:z({listChanged:c().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:z({}).optional().describe("Host accepts log messages.")}),R9=z({experimental:z({}).optional().describe("Experimental features (structure TBD)."),tools:z({listChanged:c().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call.")}),j2=z({method:A("ui/notifications/initialized"),params:z({}).optional()}),S9=z({connectDomains:y(U()).optional().describe("Origins for network requests (fetch/XHR/WebSocket)."),resourceDomains:y(U()).optional().describe("Origins for static resources (scripts, images, styles, fonts).")}),k2=z({csp:S9.optional().describe("Content Security Policy configuration."),domain:U().optional().describe("Dedicated origin for widget sandbox."),prefersBorder:c().optional().describe("Visual boundary preference - true if UI prefers a visible border.")}),C2=z({method:A("ui/request-display-mode"),params:z({mode:CQ.describe("The display mode being requested.")})}),I1=s({mode:CQ.describe("The display mode that was actually set. May differ from requested if not supported.")}),_9=p([A("model"),A("app")]).describe("Tool visibility scope - who can access the tool."),v2=z({resourceUri:U(),visibility:y(_9).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
41
|
+
- "model": Tool visible to and callable by the agent
|
|
42
|
+
- "app": Tool callable by the app from this server only`)}),g2=z({method:A("ui/message"),params:z({role:A("user").describe('Message role, currently only "user" is supported.'),content:y(F2).describe("Message content blocks (text, image, etc.).")})}),F1=z({method:A("ui/notifications/tool-result"),params:M2.describe("Standard MCP tool execution result.")}),M1=s({toolInfo:z({id:$2.describe("JSON-RPC id of the tools/call request."),tool:P2.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:M9.optional().describe("Current color theme preference."),styles:P9.optional().describe("Style configuration for theming the app."),displayMode:CQ.optional().describe("How the UI is currently displayed."),availableDisplayModes:y(U()).optional().describe("Display modes the host supports."),viewport:z({width:k().describe("Current viewport width in pixels."),height:k().describe("Current viewport height in pixels."),maxHeight:k().optional().describe("Maximum available height in pixels (if constrained)."),maxWidth:k().optional().describe("Maximum available width in pixels (if constrained).")}).optional().describe("Current and maximum dimensions available to the UI."),locale:U().optional().describe("User's language and region preference in BCP 47 format."),timeZone:U().optional().describe("User's timezone in IANA format."),userAgent:U().optional().describe("Host application identifier."),platform:p([A("web"),A("desktop"),A("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:z({touch:c().optional().describe("Whether the device supports touch input."),hover:c().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:z({top:k().describe("Top safe area inset in pixels."),right:k().describe("Right safe area inset in pixels."),bottom:k().describe("Bottom safe area inset in pixels."),left:k().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}),$1=z({method:A("ui/notifications/host-context-changed"),params:M1.describe("Partial context update containing only changed fields.")}),h2=z({method:A("ui/initialize"),params:z({appInfo:F9.describe("App identification (name and version)."),appCapabilities:R9.describe("Features and capabilities this app provides."),protocolVersion:U().describe("Protocol version this app supports.")})}),P1=s({protocolVersion:U().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:F9.describe("Host application identification and version."),hostCapabilities:U9.describe("Features and capabilities provided by the host."),hostContext:M1.describe("Rich context about the host environment.")});var U1="ui/resourceUri",T9="text/html;profile=mcp-app";class f2 extends x2{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(Q,X={},W={autoResize:!0}){super(W);this._appInfo=Q;this._capabilities=X;this.options=W;this.setRequestHandler(m2,(Y)=>{return console.log("Received ping:",Y.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(Q){this.setNotificationHandler(E1,(X)=>Q(X.params))}set ontoolinputpartial(Q){this.setNotificationHandler(O1,(X)=>Q(X.params))}set ontoolresult(Q){this.setNotificationHandler(F1,(X)=>Q(X.params))}set ontoolcancelled(Q){this.setNotificationHandler(D1,(X)=>Q(X.params))}set onhostcontextchanged(Q){this.setNotificationHandler($1,(X)=>{this._hostContext={...this._hostContext,...X.params},Q(X.params)})}set onteardown(Q){this.setRequestHandler(V1,(X,W)=>Q(X.params,W))}set oncalltool(Q){this.setRequestHandler(u2,(X,W)=>Q(X.params,W))}set onlisttools(Q){this.setRequestHandler(y2,(X,W)=>Q(X.params,W))}assertCapabilityForMethod(Q){}assertRequestHandlerCapability(Q){switch(Q){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${Q})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${Q} registered`)}}assertNotificationCapability(Q){}assertTaskCapability(Q){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(Q){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(Q,X){return await this.request({method:"tools/call",params:Q},c2,X)}sendMessage(Q,X){return this.request({method:"ui/message",params:Q},z1,X)}sendLog(Q){return this.notification({method:"notifications/message",params:Q})}openLink(Q,X){return this.request({method:"ui/open-link",params:Q},B1,X)}sendOpenLink=this.openLink;requestDisplayMode(Q,X){return this.request({method:"ui/request-display-mode",params:Q},I1,X)}sendSizeChanged(Q){return this.notification({method:"ui/notifications/size-changed",params:Q})}setupSizeChangedNotifications(){let Q=!1,X=0,W=0,Y=()=>{if(Q)return;Q=!0,requestAnimationFrame(()=>{Q=!1;let G=document.documentElement,q=G.style.width,K=G.style.height;G.style.width="fit-content",G.style.height="fit-content";let L=G.getBoundingClientRect();G.style.width=q,G.style.height=K;let H=window.innerWidth-G.clientWidth,N=Math.ceil(L.width+H),E=Math.ceil(L.height);if(N!==X||E!==W)X=N,W=E,this.sendSizeChanged({width:N,height:E})})};Y();let J=new ResizeObserver(Y);return J.observe(document.documentElement),J.observe(document.body),()=>J.disconnect()}async connect(Q=new EQ(window.parent),X){await super.connect(Q);try{let W=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:gQ}},P1,X);if(W===void 0)throw Error(`Server sent invalid initialize result: ${W}`);if(this._hostCapabilities=W.hostCapabilities,this._hostInfo=W.hostInfo,this._hostContext=W.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(W){throw this.close(),W}}}function oW(Q,X,W,Y){let J=W._meta,G=J.ui,q=J[U1],K=J;if(G?.resourceUri&&!q)K={...J,[U1]:G.resourceUri};else if(q&&!G?.resourceUri)K={...J,ui:{...G,resourceUri:q}};Q.registerTool(X,{...W,_meta:K},Y)}function lW(Q,X,W,Y,J){Q.registerResource(X,W,{mimeType:T9,...Y},J)}export{oW as registerAppTool,lW as registerAppResource,U1 as RESOURCE_URI_META_KEY,T9 as RESOURCE_MIME_TYPE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|