mcp-server-wom-call 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import 'dotenv/config';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -1,413 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * MCP Server - Work Order Management (WOM) Ticket Creator
4
- * 用于自动化创建运维工单的 MCP 服务器
5
- *
6
- * @author Your Name
7
- * @version <% process.env.version %>
3
+ * mcp-server-wom-call v0.0.8
4
+ * Build Date: 2025-12-22T07:51:51.368Z
5
+ * Author: Twyford Ltd.
6
+ * @license MIT
8
7
  */
9
- import 'dotenv/config';
10
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
11
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
12
- import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
13
- import ESBProtocolBuilder from './utils/ESBProtocolBuilder.js';
14
- import packageJson from '../package.json' with { type: 'json' };
15
- // ============ 在文件开头添加系统列表常量 ============
16
- /**
17
- * 支持的系统列表
18
- */
19
- const SUPPORTED_SYSTEMS = {
20
- SRM: '供应商关系系统 - 供应商管理、采购流程、供应商评估',
21
- SPMS: '备件系统 - 备件管理、库存查询、备件申领',
22
- POS: '旧仓库管理系统 - 仓库出入库、库存盘点、物料管理',
23
- SAP: 'SAP 系统 - ERP 核心业务、财务、生产、销售',
24
- MDM: '主数据管理系统 - 主数据维护、数据质量、数据同步',
25
- WOM: '工单系统 - 工单管理、任务跟踪、工单审批',
26
- OA: 'OA 系统 - 办公自动化、审批流程、公文管理',
27
- ESB: '企业总线系统 - 系统集成、接口管理、数据交换',
28
- TMS: '运输管理系统 - 运输调度、物流跟踪、配送管理',
29
- '网络/硬件': '网络硬件客户支持 - 网络故障、硬件报修、IT 基础设施',
30
- CRM: '客户关系管理系统 - 客户管理、销售跟进、客户服务',
31
- QMS: '质量管理系统 - 质量检验、不合格品处理、质量追溯',
32
- VOSA: '数字化产品项目 - 数字化平台、创新项目、新产品功能',
33
- EAM: '企业资源管理系统 - 资产管理、设备维护、资源调配'
34
- };
35
- // ============ 常量定义 ============
36
- /**
37
- * 工单创建工具定义
38
- */
39
- const WOM_CREATOR_TOOL = {
40
- name: 'create-wom-ticket',
41
- description: `创建运维工单(Work Order Management)
42
-
43
- **功能说明:**
44
- 用于自动化提交系统故障、需求变更、运维支持等工单到企业服务总线(ESB)。
45
-
46
- **适用场景:**
47
- - 系统故障报修(如:登录异常、功能失效)
48
- - 功能需求提交(如:新增报表、权限调整)
49
- - 运维支持请求(如:数据修复、配置变更)
50
- - 事件跟踪记录(如:性能问题、安全事件)
51
-
52
- **重要提示:**
53
- system 参数必须使用精确的系统代码(区分大小写),不可使用系统全称或其他变体。
54
-
55
- **使用示例:**
56
- 用户:"帮我报个工单,OA系统的审批流程有bug"
57
- AI 应使用 system: "OA"(而不是"OA系统"或"oa")`,
58
- inputSchema: {
59
- type: 'object',
60
- required: ['empNo', 'content', 'system', 'title'],
61
- properties: {
62
- name: {
63
- type: 'string',
64
- minLength: 1,
65
- maxLength: 100,
66
- description: '提交人姓名(用于工单联系和通知)'
67
- },
68
- email: {
69
- type: 'string',
70
- format: 'email',
71
- description: '提交人邮箱(用于接收工单处理进度通知)'
72
- },
73
- empNo: {
74
- type: 'string',
75
- minLength: 1,
76
- description: '员工工号(必填,用于身份验证和工单归属)'
77
- },
78
- system: {
79
- type: 'string',
80
- minLength: 1,
81
- enum: Object.keys(SUPPORTED_SYSTEMS),
82
- description: `问题所属系统代码(必填,必须精确匹配以下代码之一,区分大小写):
83
-
84
- • SRM - 供应商关系系统(供应商管理、采购流程)
85
- • SPMS - 备件系统(备件管理、库存查询)
86
- • POS - 旧仓库管理系统(仓库出入库、物料管理)
87
- • SAP - SAP 系统(ERP、财务、生产、销售)
88
- • MDM - 主数据管理系统(主数据维护、数据同步)
89
- • WOM - 工单系统(工单管理、任务跟踪)
90
- • OA - OA 系统(办公自动化、审批流程)
91
- • ESB - 企业总线系统(系统集成、接口管理)
92
- • TMS - 运输管理系统(运输调度、物流跟踪)
93
- • 网络/硬件 - 网络硬件客户支持(网络故障、硬件报修)
94
- • CRM - 客户关系管理系统(客户管理、销售跟进)
95
- • QMS - 质量管理系统(质量检验、质量追溯)
96
- • VOSA - 数字化产品项目(数字化平台、创新项目)
97
- • EAM - 企业资源管理系统(资产管理、设备维护)
98
-
99
- ⚠️ 注意:必须使用代码(如"OA"),不能使用全称(如"OA系统")`
100
- },
101
- eventId: {
102
- type: 'string',
103
- description: '关联的事件ID(可选,用于追踪特定监控事件或告警)'
104
- },
105
- replayId: {
106
- type: 'string',
107
- description: '会话回放ID(可选,用于问题复现和分析)'
108
- },
109
- title: {
110
- type: 'string',
111
- minLength: 1,
112
- maxLength: 100,
113
- description: '工单标题(必填,简明扼要描述问题,如:"登录页面无法访问"、"审批流程卡住")'
114
- },
115
- content: {
116
- type: 'string',
117
- minLength: 1,
118
- maxLength: 5000,
119
- description: `问题详细描述(必填)
120
- 建议包含以下信息:
121
- - 问题现象:具体出现了什么问题
122
- - 复现步骤:如何触发该问题
123
- - 影响范围:影响了哪些用户或业务
124
- - 期望结果:希望达到什么效果
125
- - 发生时间:问题首次出现的时间`
126
- },
127
- attachments: {
128
- type: 'array',
129
- items: {
130
- type: 'object',
131
- required: ['filename', 'url'],
132
- properties: {
133
- filename: {
134
- type: 'string',
135
- description: '附件文件名(必须含扩展名,如:error.log、screenshot.png)'
136
- },
137
- url: {
138
- type: 'string',
139
- description: '附件访问URL(需可公网访问或内网可达,支持 http/https 协议)'
140
- },
141
- size: {
142
- type: 'number',
143
- description: '文件大小(字节,用于验证和展示)'
144
- }
145
- }
146
- },
147
- description: '附件列表(可选,支持截图、日志、录屏等,建议单个文件不超过10MB)'
148
- }
149
- }
150
- }
151
- };
152
- // ============ 全局配置 ============
153
- let ESB_URL = process.env.ESB_URL || '';
154
- // ============ 服务器配置 ============
155
- const SERVER_CONFIG = {
156
- name: 'mcp-server-wom-call',
157
- version: packageJson.version,
158
- description: 'MCP Server for Work Order Management System Integration'
159
- };
160
- // ============ 工具函数 ============
161
- /**
162
- * 验证配置是否完整
163
- * @throws {Error} 如果必需的配置未设置
164
- */
165
- function validateConfiguration() {
166
- if (!ESB_URL) {
167
- throw new Error('ESB_URL is not configured. Please set it in .env file, system environment, or MCP client configuration.');
168
- }
169
- }
170
- /**
171
- * 构建 ESB 请求负载
172
- * @param input - 工单输入参数
173
- * @returns JSON 格式的 ESB 请求体
174
- */
175
- function buildESBPayload(input) {
176
- const builder = new ESBProtocolBuilder();
177
- // 设置基本信息
178
- builder
179
- .setJobTitle(input.title)
180
- .setProposeUser(input.empNo)
181
- .setJobDesc(Buffer.from(input.content, 'utf-8').toString('base64')) // Base64 编码内容
182
- .setBusinessSystem(input.system)
183
- .setEventId(input.eventId || '')
184
- .setAppId(input.system);
185
- // 添加附件(如果有)
186
- if (input.attachments && input.attachments.length > 0) {
187
- const validAttachments = input.attachments.filter((att) => typeof att.filename === 'string' &&
188
- typeof att.url === 'string' &&
189
- att.filename.length > 0 &&
190
- att.url.length > 0);
191
- if (validAttachments.length > 0) {
192
- builder.addAttachments(validAttachments.map((attachment) => ({
193
- attachmentName: attachment.filename,
194
- attachmentDesc: attachment.url
195
- })));
196
- }
197
- }
198
- return builder.buildJSON();
199
- }
200
- /**
201
- * 调用 ESB API 创建工单
202
- * @param input - 工单输入参数
203
- * @returns ESB API 响应的 JSON 字符串
204
- * @throws {Error} 如果 API 调用失败
205
- */
206
- async function createWorkOrder(input) {
207
- const url = ESB_URL;
208
- if (!url) {
209
- throw new Error('ESB_URL is not configured');
210
- }
211
- const requestBody = buildESBPayload(input);
212
- try {
213
- const response = await fetch(url, {
214
- method: 'POST',
215
- headers: {
216
- 'Content-Type': 'application/json'
217
- },
218
- body: requestBody
219
- });
220
- if (!response.ok) {
221
- const errorText = await response.text();
222
- throw new Error(`ESB API request failed: ${response.status} ${response.statusText}\nResponse: ${errorText}`);
223
- }
224
- const responseData = await response.json();
225
- return JSON.stringify(responseData, null, 2);
226
- }
227
- catch (error) {
228
- if (error instanceof Error) {
229
- throw new Error(`Failed to create work order: ${error.message}`);
230
- }
231
- throw new Error(`Failed to create work order: ${String(error)}`);
232
- }
233
- }
234
- /**
235
- * 验证输入参数
236
- * @param args - 待验证的参数
237
- * @throws {Error} 如果参数验证失败
238
- */
239
- function validateInput(args) {
240
- if (!args || typeof args !== 'object') {
241
- throw new Error('Invalid input: arguments must be an object');
242
- }
243
- const input = args;
244
- // 验证必填字段
245
- if (!input.empNo ||
246
- typeof input.empNo !== 'string' ||
247
- input.empNo.trim().length === 0) {
248
- throw new Error('Invalid input: empNo is required and must be a non-empty string');
249
- }
250
- if (!input.system ||
251
- typeof input.system !== 'string' ||
252
- input.system.trim().length === 0) {
253
- throw new Error('Invalid input: system is required and must be a non-empty string');
254
- }
255
- if (!input.title ||
256
- typeof input.title !== 'string' ||
257
- input.title.trim().length === 0) {
258
- throw new Error('Invalid input: title is required and must be a non-empty string');
259
- }
260
- if (!input.content ||
261
- typeof input.content !== 'string' ||
262
- input.content.trim().length === 0) {
263
- throw new Error('Invalid input: content is required and must be a non-empty string');
264
- }
265
- // 验证长度限制
266
- if (input.title.length > 100) {
267
- throw new Error('Invalid input: title must not exceed 100 characters');
268
- }
269
- if (input.content.length > 5000) {
270
- throw new Error('Invalid input: content must not exceed 5000 characters');
271
- }
272
- // 验证可选字段
273
- if (input.name !== undefined &&
274
- (typeof input.name !== 'string' || input.name.length > 100)) {
275
- throw new Error('Invalid input: name must be a string with max 100 characters');
276
- }
277
- if (input.email !== undefined && typeof input.email !== 'string') {
278
- throw new Error('Invalid input: email must be a string');
279
- }
280
- // 验证邮箱格式(如果提供)
281
- if (input.email && input.email.length > 0) {
282
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
283
- if (!emailRegex.test(input.email)) {
284
- throw new Error('Invalid input: email format is invalid');
285
- }
286
- }
287
- // 验证附件格式(如果提供)
288
- if (input.attachments !== undefined) {
289
- if (!Array.isArray(input.attachments)) {
290
- throw new Error('Invalid input: attachments must be an array');
291
- }
292
- for (const [index, attachment] of input.attachments.entries()) {
293
- if (!attachment || typeof attachment !== 'object') {
294
- throw new Error(`Invalid input: attachment at index ${index} must be an object`);
295
- }
296
- if (!attachment.filename ||
297
- typeof attachment.filename !== 'string' ||
298
- attachment.filename.trim().length === 0) {
299
- throw new Error(`Invalid input: attachment at index ${index} must have a valid filename`);
300
- }
301
- if (!attachment.url ||
302
- typeof attachment.url !== 'string' ||
303
- attachment.url.trim().length === 0) {
304
- throw new Error(`Invalid input: attachment at index ${index} must have a valid url`);
305
- }
306
- // 验证 URL 格式
307
- try {
308
- new URL(attachment.url);
309
- }
310
- catch {
311
- throw new Error(`Invalid input: attachment at index ${index} has an invalid URL format`);
312
- }
313
- if (attachment.size !== undefined &&
314
- (typeof attachment.size !== 'number' || attachment.size < 0)) {
315
- throw new Error(`Invalid input: attachment at index ${index} size must be a positive number`);
316
- }
317
- }
318
- }
319
- }
320
- // ============ MCP 服务器实现 ============
321
- /**
322
- * 创建 MCP 服务器实例
323
- * 注意:Server 构造函数会自动处理 initialize 请求
324
- */
325
- const server = new Server({
326
- name: SERVER_CONFIG.name,
327
- version: SERVER_CONFIG.version
328
- }, {
329
- capabilities: {
330
- tools: {}
331
- }
332
- });
333
- /**
334
- * 注册工具列表处理器
335
- */
336
- server.setRequestHandler(ListToolsRequestSchema, async () => {
337
- return {
338
- tools: [WOM_CREATOR_TOOL]
339
- };
340
- });
341
- /**
342
- * 注册工具调用处理器
343
- */
344
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
345
- try {
346
- // 验证配置
347
- validateConfiguration();
348
- const { name, arguments: args } = request.params;
349
- if (!args) {
350
- throw new Error('No arguments provided');
351
- }
352
- switch (name) {
353
- case 'create-wom-ticket': {
354
- validateInput(args);
355
- const result = await createWorkOrder(args);
356
- return {
357
- content: [
358
- {
359
- type: 'text',
360
- text: `✅ 工单创建成功\n\n${result}`
361
- }
362
- ],
363
- isError: false
364
- };
365
- }
366
- default:
367
- throw new Error(`Unknown tool: ${name}`);
368
- }
369
- }
370
- catch (error) {
371
- const errorMessage = error instanceof Error ? error.message : String(error);
372
- console.error('❌ Error handling tool call:', errorMessage);
373
- return {
374
- content: [
375
- {
376
- type: 'text',
377
- text: `❌ 工单创建失败\n\n错误信息:${errorMessage}`
378
- }
379
- ],
380
- isError: true
381
- };
382
- }
383
- });
384
- // ============ 服务器启动 ============
385
- /**
386
- * 启动 MCP 服务器
387
- */
388
- async function runServer() {
389
- try {
390
- // 创建传输层
391
- const transport = new StdioServerTransport();
392
- // 连接服务器(SDK 会自动处理 initialize 握手)
393
- await server.connect(transport);
394
- // 输出启动日志
395
- console.error(`🚀 ${SERVER_CONFIG.name} v${SERVER_CONFIG.version} is running`);
396
- console.error(`📝 ${SERVER_CONFIG.description}`);
397
- if (ESB_URL) {
398
- console.error(`🔗 ESB URL: ${ESB_URL}`);
399
- }
400
- else {
401
- console.error(`⚠️ ESB URL not configured. Please set ESB_URL environment variable.`);
402
- }
403
- }
404
- catch (error) {
405
- console.error('❌ Failed to start server:', error);
406
- throw error;
407
- }
408
- }
409
- // 启动服务器
410
- runServer().catch((error) => {
411
- console.error('💥 Fatal error:', error);
412
- process.exit(1);
413
- });
8
+ "use strict";var e,t,s,r,n,a,i,o,d=require("fs"),c=require("path"),u=require("os"),l=require("crypto"),h=require("node:process"),p={exports:{}};a||(a=1,function(){if(e)return p.exports;e=1;const t=d,s=c,r=u,n=l,a=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function i(e){}function o(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function h(e,t){let s;try{s=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){const e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}const r=s.password;if(!r){const e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const n=s.searchParams.get("environment");if(!n){const e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const a="DOTENV_VAULT_"+n.toUpperCase(),i=e.parsed[a];if(!i){const e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:i,key:r}}function m(e){let r=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(const s of e.path)t.existsSync(s)&&(r=s.endsWith(".vault")?s:s+".vault");else r=e.path.endsWith(".vault")?e.path:e.path+".vault";else r=s.resolve(process.cwd(),".env.vault");return t.existsSync(r)?r:null}function f(e){return"~"===e[0]?s.join(r.homedir(),e.slice(1)):e}const _={configDotenv:function(e){const r=s.resolve(process.cwd(),".env");let n="utf8";const a=!(!e||!e.debug),o=!e||!("quiet"in e)||e.quiet;e&&e.encoding&&(n=e.encoding);let d,c=[r];if(e&&e.path)if(Array.isArray(e.path)){c=[];for(const t of e.path)c.push(f(t))}else c=[f(e.path)];const u={};for(const s of c)try{const r=_.parse(t.readFileSync(s,{encoding:n}));_.populate(u,r,e)}catch(e){a&&i(e.message),d=e}let l=process.env;if(e&&null!=e.processEnv&&(l=e.processEnv),_.populate(l,u,e),a||!o){Object.keys(u).length;const e=[];for(const t of c)try{const r=s.relative(process.cwd(),t);e.push(r)}catch(e){a&&i(e.message),d=e}e.join(",")}return d?{parsed:u,error:d}:{parsed:u}},_configVault:function(e){!e||e.debug,!e||!("quiet"in e)||e.quiet;const t=_._parseVault(e);let s=process.env;return e&&null!=e.processEnv&&(s=e.processEnv),_.populate(s,t,e),{parsed:t}},_parseVault:function(e){const t=m(e=e||{});e.path=t;const s=_.configDotenv(e);if(!s.parsed){const e=Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const r=o(e).split(","),n=r.length;let a;for(let e=0;e<n;e++)try{const t=h(s,r[e].trim());a=_.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=n)throw t}return _.parse(a)},config:function(e){return 0===o(e).length?_.configDotenv(e):m(e)?_._configVault(e):_.configDotenv(e)},decrypt:function(e,t){const s=Buffer.from(t.slice(-64),"hex");let r=Buffer.from(e,"base64");const a=r.subarray(0,12),i=r.subarray(-16);r=r.subarray(12,-16);try{const e=n.createDecipheriv("aes-256-gcm",s,a);return e.setAuthTag(i),`${e.update(r)}${e.final()}`}catch(e){const t=e instanceof RangeError,s="Invalid key length"===e.message,r="Unsupported state or unable to authenticate data"===e.message;if(t||s){const e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){const e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw e}},parse:function(e){const t={};let s,r=e.toString();for(r=r.replace(/\r\n?/gm,"\n");null!=(s=a.exec(r));){const e=s[1];let r=s[2]||"";r=r.trim();const n=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===n&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[e]=r}return t},populate:function(e,t,s={}){const r=!(!s||!s.debug),n=!(!s||!s.override);if("object"!=typeof t){const e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const s of Object.keys(t))!{}.hasOwnProperty.call(e,s)?e[s]=t[s]:(!0===n&&(e[s]=t[s]),r&&i())}};return p.exports.configDotenv=_.configDotenv,p.exports._configVault=_._configVault,p.exports._parseVault=_._parseVault,p.exports.config=_.config,p.exports.decrypt=_.decrypt,p.exports.parse=_.parse,p.exports.populate=_.populate,p.exports=_,p.exports}().config(Object.assign({},function(){if(s)return t;s=1;const e={};return null!=process.env.DOTENV_CONFIG_ENCODING&&(e.encoding=process.env.DOTENV_CONFIG_ENCODING),null!=process.env.DOTENV_CONFIG_PATH&&(e.path=process.env.DOTENV_CONFIG_PATH),null!=process.env.DOTENV_CONFIG_QUIET&&(e.quiet=process.env.DOTENV_CONFIG_QUIET),null!=process.env.DOTENV_CONFIG_DEBUG&&(e.debug=process.env.DOTENV_CONFIG_DEBUG),null!=process.env.DOTENV_CONFIG_OVERRIDE&&(e.override=process.env.DOTENV_CONFIG_OVERRIDE),null!=process.env.DOTENV_CONFIG_DOTENV_KEY&&(e.DOTENV_KEY=process.env.DOTENV_CONFIG_DOTENV_KEY),t=e}(),function(){if(n)return r;n=1;const e=/^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;return r=function(t){const s=t.reduce(function(t,s){const r=s.match(e);return r&&(t[r[1]]=r[2]),t},{});return"quiet"in s||(s.quiet="true"),s}}()(process.argv)))),function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw Error()},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(const e of s)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)({}).hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(i||(i={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(o||(o={}));const m=i.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),f=e=>{switch(typeof e){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(e)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(e)?m.array:null===e?m.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?m.promise:"undefined"!=typeof Map&&e instanceof Map?m.map:"undefined"!=typeof Set&&e instanceof Set?m.set:void 0!==Date&&e instanceof Date?m.date:m.object;default:return m.unknown}},_=i.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class g extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},s={_errors:[]},r=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(r);else if("invalid_return_type"===n.code)r(n.returnTypeError);else if("invalid_arguments"===n.code)r(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,r=0;for(;r<n.path.length;){const s=n.path[r];r===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],r++}}};return r(this),s}static assert(e){if(!(e instanceof g))throw Error("Not a ZodError: "+e)}toString(){return this.message}get message(){return JSON.stringify(this.issues,i.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const r of this.issues)if(r.path.length>0){const s=r.path[0];t[s]=t[s]||[],t[s].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}g.create=e=>new g(e);const v=(e,t)=>{let s;switch(e.code){case _.invalid_type:s=e.received===m.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case _.invalid_literal:s="Invalid literal value, expected "+JSON.stringify(e.expected,i.jsonStringifyReplacer);break;case _.unrecognized_keys:s="Unrecognized key(s) in object: "+i.joinValues(e.keys,", ");break;case _.invalid_union:s="Invalid input";break;case _.invalid_union_discriminator:s="Invalid discriminator value. Expected "+i.joinValues(e.options);break;case _.invalid_enum_value:s=`Invalid enum value. Expected ${i.joinValues(e.options)}, received '${e.received}'`;break;case _.invalid_arguments:s="Invalid function arguments";break;case _.invalid_return_type:s="Invalid function return type";break;case _.invalid_date:s="Invalid date";break;case _.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:i.assertNever(e.validation):s="regex"!==e.validation?"Invalid "+e.validation:"Invalid";break;case _.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(+e.minimum)}`:"Invalid input";break;case _.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(+e.maximum)}`:"Invalid input";break;case _.custom:s="Invalid input";break;case _.invalid_intersection_types:s="Intersection results could not be merged";break;case _.not_multiple_of:s="Number must be a multiple of "+e.multipleOf;break;case _.not_finite:s="Number must be finite";break;default:s=t.defaultError,i.assertNever(e)}return{message:s}};let y=v;function x(e,t){const s=y,r=(e=>{const{data:t,path:s,errorMaps:r,issueData:n}=e,a=[...s,...n.path||[]],i={...n,path:a};if(void 0!==n.message)return{...n,path:a,message:n.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:a,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===v?void 0:v].filter(e=>!!e)});e.common.issues.push(r)}class b{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const r of t){if("aborted"===r.status)return E;"dirty"===r.status&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t){const t=await e.key,r=await e.value;s.push({key:t,value:r})}return b.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const r of t){const{key:t,value:n}=r;if("aborted"===t.status)return E;if("aborted"===n.status)return E;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!r.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const E=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),T=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,S=e=>"dirty"===e.status,O=e=>"valid"===e.status,A=e=>"undefined"!=typeof Promise&&e instanceof Promise;var N;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(N||(N={}));class I{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const R=(e,t)=>{if(O(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new g(e.common.issues);return this._error=t,this._error}}};function C(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:r,description:n}=e;if(t&&(s||r))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??n.defaultError}:void 0===n.data?{message:a??r??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:a??s??n.defaultError}},description:n}}class D{get description(){return this._def.description}_getType(e){return f(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:f(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:f(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(A(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)},r=this._parseSync({data:e,path:s.path,parent:s});return R(s,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return O(s)?{value:s.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>O(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:f(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(A(r)?r:Promise.resolve(r));return R(s,n)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const n=e(t),a=()=>r.addIssue({code:_.custom,...s(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(a(),!1)):!!n||(a(),!1)})}refinement(e,t){return this._refinement((s,r)=>!!e(s)||(r.addIssue("function"==typeof t?t(s,r):t),!1))}_refinement(e){return new Ze({schema:this,typeName:Fe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return je.create(this,this._def)}nullable(){return qe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _e.create(this)}promise(){return De.create(this,this._def)}or(e){return ye.create([this,e],this._def)}and(e){return ke.create(this,e,this._def)}transform(e){return new Ze({...C(this._def),schema:this,typeName:Fe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Pe({...C(this._def),innerType:this,defaultValue:t,typeName:Fe.ZodDefault})}brand(){return new Ue({typeName:Fe.ZodBranded,type:this,...C(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new $e({...C(this._def),innerType:this,catchValue:t,typeName:Fe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ve.create(this,e)}readonly(){return Le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z=/^c[^\s-]{8,}$/i,j=/^[0-9a-z]+$/,q=/^[0-9A-HJKMNP-TV-Z]{26}$/i,P=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,$=/^[a-z0-9_-]{21}$/i,M=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,U=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,V=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let L;const F=/^(?:(?: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])$/,H=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,B=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,z=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,K=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,W="((\\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])))",Y=RegExp(`^${W}$`);function J(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t+="(\\.\\d+)?"),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function G(e){return RegExp(`^${J(e)}$`)}function X(e){let t=`${W}T${J(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,RegExp(`^${t}$`)}function ee(e,t){return!("v4"!==t&&t||!F.test(e))||!("v6"!==t&&t||!B.test(e))}function te(e,t){if(!M.test(e))return!1;try{const[s]=e.split(".");if(!s)return!1;const r=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(r));return!("object"!=typeof n||null===n||"typ"in n&&"JWT"!==n?.typ||!n.alg||t&&n.alg!==t)}catch{return!1}}function se(e,t){return!("v4"!==t&&t||!H.test(e))||!("v6"!==t&&t||!Q.test(e))}class re extends D{_parse(e){if(this._def.coerce&&(e.data=e.data+""),this._getType(e)!==m.string){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.string,received:t.parsedType}),E}const t=new b;let s;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),x(s,{code:_.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),x(s,{code:_.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,a=e.data.length<r.value;(n||a)&&(s=this._getOrReturnCtx(e,s),n?x(s,{code:_.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&x(s,{code:_.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)V.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"email",code:_.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)L||(L=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),L.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"emoji",code:_.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)P.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"uuid",code:_.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)$.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"nanoid",code:_.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Z.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"cuid",code:_.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)j.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"cuid2",code:_.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)q.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"ulid",code:_.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),x(s,{validation:"url",code:_.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"regex",code:_.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),x(s,{code:_.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),x(s,{code:_.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),x(s,{code:_.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?X(r).test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{code:_.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?Y.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{code:_.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?G(r).test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{code:_.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?U.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"duration",code:_.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?ee(e.data,r.version)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"ip",code:_.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?te(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"jwt",code:_.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?se(e.data,r.version)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"cidr",code:_.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?z.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"base64",code:_.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?K.test(e.data)||(s=this._getOrReturnCtx(e,s),x(s,{validation:"base64url",code:_.invalid_string,message:r.message}),t.dirty()):i.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(t=>e.test(t),{validation:t,code:_.invalid_string,...N.errToObj(s)})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new re({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new re({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new re({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ne(e,t){const s=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,n=s>r?s:r;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}re.create=e=>new re({checks:[],typeName:Fe.ZodString,coerce:e?.coerce??!1,...C(e)});class ae extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=+e.data),this._getType(e)!==m.number){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.number,received:t.parsedType}),E}let t;const s=new b;for(const r of this._def.checks)"int"===r.kind?i.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:_.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:_.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:_.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):"multipleOf"===r.kind?0!==ne(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:_.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:_.not_finite,message:r.message}),s.dirty()):i.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,s,r){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:N.toString(r)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&i.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ae.create=e=>new ae({checks:[],typeName:Fe.ZodNumber,coerce:e?.coerce||!1,...C(e)});class ie extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let t;const s=new b;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:_.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:_.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),x(t,{code:_.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):i.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.bigint,received:t.parsedType}),E}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,s,r){return new ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:N.toString(r)}]})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ie.create=e=>new ie({checks:[],typeName:Fe.ZodBigInt,coerce:e?.coerce??!1,...C(e)});class oe extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.boolean,received:t.parsedType}),E}return T(e.data)}}oe.create=e=>new oe({typeName:Fe.ZodBoolean,coerce:e?.coerce||!1,...C(e)});class de extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.date,received:t.parsedType}),E}if(Number.isNaN(e.data.getTime()))return x(this._getOrReturnCtx(e),{code:_.invalid_date}),E;const t=new b;let s;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),x(s,{code:_.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),x(s,{code:_.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):i.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}de.create=e=>new de({checks:[],coerce:e?.coerce||!1,typeName:Fe.ZodDate,...C(e)});class ce extends D{_parse(e){if(this._getType(e)!==m.symbol){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.symbol,received:t.parsedType}),E}return T(e.data)}}ce.create=e=>new ce({typeName:Fe.ZodSymbol,...C(e)});class ue extends D{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.undefined,received:t.parsedType}),E}return T(e.data)}}ue.create=e=>new ue({typeName:Fe.ZodUndefined,...C(e)});class le extends D{_parse(e){if(this._getType(e)!==m.null){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.null,received:t.parsedType}),E}return T(e.data)}}le.create=e=>new le({typeName:Fe.ZodNull,...C(e)});class he extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}}he.create=e=>new he({typeName:Fe.ZodAny,...C(e)});class pe extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}}pe.create=e=>new pe({typeName:Fe.ZodUnknown,...C(e)});class me extends D{_parse(e){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.never,received:t.parsedType}),E}}me.create=e=>new me({typeName:Fe.ZodNever,...C(e)});class fe extends D{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.void,received:t.parsedType}),E}return T(e.data)}}fe.create=e=>new fe({typeName:Fe.ZodVoid,...C(e)});class _e extends D{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.array)return x(t,{code:_.invalid_type,expected:m.array,received:t.parsedType}),E;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,n=t.data.length<r.exactLength.value;(e||n)&&(x(t,{code:e?_.too_big:_.too_small,minimum:n?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(x(t,{code:_.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(x(t,{code:_.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((e,s)=>r.type._parseAsync(new I(t,e,t.path,s)))).then(e=>b.mergeArray(s,e));const n=[...t.data].map((e,s)=>r.type._parseSync(new I(t,e,t.path,s)));return b.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new _e({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new _e({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new _e({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}}function ge(e){if(e instanceof ve){const t={};for(const s in e.shape){const r=e.shape[s];t[s]=je.create(ge(r))}return new ve({...e._def,shape:()=>t})}return e instanceof _e?new _e({...e._def,type:ge(e.element)}):e instanceof je?je.create(ge(e.unwrap())):e instanceof qe?qe.create(ge(e.unwrap())):e instanceof Te?Te.create(e.items.map(e=>ge(e))):e}_e.create=(e,t)=>new _e({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Fe.ZodArray,...C(t)});class ve extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=i.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.object,received:t.parsedType}),E}const{status:t,ctx:s}=this._processInputParams(e),{shape:r,keys:n}=this._getCached(),a=[];if(!(this._def.catchall instanceof me&&"strip"===this._def.unknownKeys))for(const e in s.data)n.includes(e)||a.push(e);const i=[];for(const e of n){const t=r[e],n=s.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new I(s,n,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof me){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of a)i.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)a.length>0&&(x(s,{code:_.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=s.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new I(s,r,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const s=await t.key,r=await t.value;e.push({key:s,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>b.mergeObjectSync(t,e)):b.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new ve({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{const r=this._def.errorMap?.(t,s).message??s.defaultError;return"unrecognized_keys"===t.code?{message:N.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new ve({...this._def,unknownKeys:"strip"})}passthrough(){return new ve({...this._def,unknownKeys:"passthrough"})}extend(e){return new ve({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ve({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Fe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ve({...this._def,catchall:e})}pick(e){const t={};for(const s of i.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new ve({...this._def,shape:()=>t})}omit(e){const t={};for(const s of i.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new ve({...this._def,shape:()=>t})}deepPartial(){return ge(this)}partial(e){const t={};for(const s of i.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new ve({...this._def,shape:()=>t})}required(e){const t={};for(const s of i.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof je;)e=e._def.innerType;t[s]=e}return new ve({...this._def,shape:()=>t})}keyof(){return Ie(i.objectKeys(this.shape))}}ve.create=(e,t)=>new ve({shape:()=>e,unknownKeys:"strip",catchall:me.create(),typeName:Fe.ZodObject,...C(t)}),ve.strictCreate=(e,t)=>new ve({shape:()=>e,unknownKeys:"strict",catchall:me.create(),typeName:Fe.ZodObject,...C(t)}),ve.lazycreate=(e,t)=>new ve({shape:e,unknownKeys:"strip",catchall:me.create(),typeName:Fe.ZodObject,...C(t)});class ye extends D{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map(async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map(e=>new g(e.ctx.common.issues));return x(t,{code:_.invalid_union,unionErrors:s}),E});{let e;const r=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},a=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:s}),s.common.issues.length&&r.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=r.map(e=>new g(e));return x(t,{code:_.invalid_union,unionErrors:n}),E}}get options(){return this._def.options}}ye.create=(e,t)=>new ye({options:e,typeName:Fe.ZodUnion,...C(t)});const xe=e=>e instanceof Ae?xe(e.schema):e instanceof Ze?xe(e.innerType()):e instanceof Ne?[e.value]:e instanceof Re?e.options:e instanceof Ce?i.objectValues(e.enum):e instanceof Pe?xe(e._def.innerType):e instanceof ue?[void 0]:e instanceof le?[null]:e instanceof je?[void 0,...xe(e.unwrap())]:e instanceof qe?[null,...xe(e.unwrap())]:e instanceof Ue||e instanceof Le?xe(e.unwrap()):e instanceof $e?xe(e._def.innerType):[];class be extends D{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return x(t,{code:_.invalid_type,expected:m.object,received:t.parsedType}),E;const s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const r=new Map;for(const s of t){const t=xe(s.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw Error(`Discriminator property ${e+""} has duplicate value ${n+""}`);r.set(n,s)}}return new be({typeName:Fe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...C(s)})}}function Ee(e,t){const s=f(e),r=f(t);if(e===t)return{valid:!0,data:e};if(s===m.object&&r===m.object){const s=i.objectKeys(t),r=i.objectKeys(e).filter(e=>-1!==s.indexOf(e)),n={...e,...t};for(const s of r){const r=Ee(e[s],t[s]);if(!r.valid)return{valid:!1};n[s]=r.data}return{valid:!0,data:n}}if(s===m.array&&r===m.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let r=0;r<e.length;r++){const n=Ee(e[r],t[r]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}return s===m.date&&r===m.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class ke extends D{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=(e,r)=>{if(w(e)||w(r))return E;const n=Ee(e.value,r.value);return n.valid?((S(e)||S(r))&&t.dirty(),{status:t.value,value:n.data}):(x(s,{code:_.invalid_intersection_types}),E)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ke.create=(e,t,s)=>new ke({left:e,right:t,typeName:Fe.ZodIntersection,...C(s)});class Te extends D{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.array)return x(s,{code:_.invalid_type,expected:m.array,received:s.parsedType}),E;if(s.data.length<this._def.items.length)return x(s,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&s.data.length>this._def.items.length&&(x(s,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...s.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new I(s,e,s.path,t)):null}).filter(e=>!!e);return s.common.async?Promise.all(r).then(e=>b.mergeArray(t,e)):b.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Te({...this._def,rest:e})}}Te.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te({items:e,typeName:Fe.ZodTuple,rest:null,...C(t)})};class we extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return x(s,{code:_.invalid_type,expected:m.object,received:s.parsedType}),E;const r=[],n=this._def.keyType,a=this._def.valueType;for(const e in s.data)r.push({key:n._parse(new I(s,e,s.path,e)),value:a._parse(new I(s,s.data[e],s.path,e)),alwaysSet:e in s.data});return s.common.async?b.mergeObjectAsync(t,r):b.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return new we(t instanceof D?{keyType:e,valueType:t,typeName:Fe.ZodRecord,...C(s)}:{keyType:re.create(),valueType:e,typeName:Fe.ZodRecord,...C(t)})}}class Se extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.map)return x(s,{code:_.invalid_type,expected:m.map,received:s.parsedType}),E;const r=this._def.keyType,n=this._def.valueType,a=[...s.data.entries()].map(([e,t],a)=>({key:r._parse(new I(s,e,s.path,[a,"key"])),value:n._parse(new I(s,t,s.path,[a,"value"]))}));if(s.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const s of a){const r=await s.key,n=await s.value;if("aborted"===r.status||"aborted"===n.status)return E;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const s of a){const r=s.key,n=s.value;if("aborted"===r.status||"aborted"===n.status)return E;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}}}}Se.create=(e,t,s)=>new Se({valueType:t,keyType:e,typeName:Fe.ZodMap,...C(s)});class Oe extends D{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.set)return x(s,{code:_.invalid_type,expected:m.set,received:s.parsedType}),E;const r=this._def;null!==r.minSize&&s.data.size<r.minSize.value&&(x(s,{code:_.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&s.data.size>r.maxSize.value&&(x(s,{code:_.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const n=this._def.valueType;function a(e){const s=new Set;for(const r of e){if("aborted"===r.status)return E;"dirty"===r.status&&t.dirty(),s.add(r.value)}return{status:t.value,value:s}}const i=[...s.data.values()].map((e,t)=>n._parse(new I(s,e,s.path,t)));return s.common.async?Promise.all(i).then(e=>a(e)):a(i)}min(e,t){return new Oe({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new Oe({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Oe.create=(e,t)=>new Oe({valueType:e,minSize:null,maxSize:null,typeName:Fe.ZodSet,...C(t)});class Ae extends D{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ae.create=(e,t)=>new Ae({getter:e,typeName:Fe.ZodLazy,...C(t)});class Ne extends D{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:_.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ie(e,t){return new Re({values:e,typeName:Fe.ZodEnum,...C(t)})}Ne.create=(e,t)=>new Ne({value:e,typeName:Fe.ZodLiteral,...C(t)});class Re extends D{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return x(t,{expected:i.joinValues(s),received:t.parsedType,code:_.invalid_type}),E}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return x(t,{received:t.data,code:_.invalid_enum_value,options:s}),E}return T(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Re.create(e,{...this._def,...t})}exclude(e,t=this._def){return Re.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Re.create=Ie;class Ce extends D{_parse(e){const t=i.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==m.string&&s.parsedType!==m.number){const e=i.objectValues(t);return x(s,{expected:i.joinValues(e),received:s.parsedType,code:_.invalid_type}),E}if(this._cache||(this._cache=new Set(i.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=i.objectValues(t);return x(s,{received:s.data,code:_.invalid_enum_value,options:e}),E}return T(e.data)}get enum(){return this._def.values}}Ce.create=(e,t)=>new Ce({values:e,typeName:Fe.ZodNativeEnum,...C(t)});class De extends D{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&!1===t.common.async)return x(t,{code:_.invalid_type,expected:m.promise,received:t.parsedType}),E;const s=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return T(s.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}De.create=(e,t)=>new De({type:e,typeName:Fe.ZodPromise,...C(t)});class Ze extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Fe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:e=>{x(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===r.type){const e=r.transform(s.data,n);if(s.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return E;const r=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===r.status?E:"dirty"===r.status||"dirty"===t.value?k(r.value):r});{if("aborted"===t.value)return E;const r=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===r.status?E:"dirty"===r.status||"dirty"===t.value?k(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,n);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const r=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===r.status?E:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(s=>"aborted"===s.status?E:("dirty"===s.status&&t.dirty(),e(s.value).then(()=>({status:t.value,value:s.value}))))}if("transform"===r.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!O(e))return E;const a=r.transform(e.value,n);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(e=>O(e)?Promise.resolve(r.transform(e.value,n)).then(e=>({status:t.value,value:e})):E)}i.assertNever(r)}}Ze.create=(e,t,s)=>new Ze({schema:e,typeName:Fe.ZodEffects,effect:t,...C(s)}),Ze.createWithPreprocess=(e,t,s)=>new Ze({schema:t,effect:{type:"preprocess",transform:e},typeName:Fe.ZodEffects,...C(s)});class je extends D{_parse(e){return this._getType(e)===m.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}je.create=(e,t)=>new je({innerType:e,typeName:Fe.ZodOptional,...C(t)});class qe extends D{_parse(e){return this._getType(e)===m.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}qe.create=(e,t)=>new qe({innerType:e,typeName:Fe.ZodNullable,...C(t)});class Pe extends D{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===m.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Pe.create=(e,t)=>new Pe({innerType:e,typeName:Fe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...C(t)});class $e extends D{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return A(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new g(s.common.issues)},input:s.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new g(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}$e.create=(e,t)=>new $e({innerType:e,typeName:Fe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...C(t)});class Me extends D{_parse(e){if(this._getType(e)!==m.nan){const t=this._getOrReturnCtx(e);return x(t,{code:_.invalid_type,expected:m.nan,received:t.parsedType}),E}return{status:"valid",value:e.data}}}Me.create=e=>new Me({typeName:Fe.ZodNaN,...C(e)});class Ue extends D{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ve extends D{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?E:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})();{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?E:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new Ve({in:e,out:t,typeName:Fe.ZodPipeline})}}class Le extends D{_parse(e){const t=this._def.innerType._parse(e),s=e=>(O(e)&&(e.value=Object.freeze(e.value)),e);return A(t)?t.then(e=>s(e)):s(t)}unwrap(){return this._def.innerType}}var Fe;Le.create=(e,t)=>new Le({innerType:e,typeName:Fe.ZodReadonly,...C(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Fe||(Fe={}));const He=re.create,Be=ae.create,Qe=oe.create,ze=pe.create;me.create;const Ke=_e.create,We=ve.create,Ye=ye.create,Je=be.create;ke.create,Te.create;const Ge=we.create,Xe=Ne.create,et=Re.create;De.create;const tt=je.create;qe.create;const st="2024-11-05",rt=[st,"2024-10-07"],nt="2.0",at=Ye([He(),Be().int()]),it=He(),ot=We({_meta:tt(We({progressToken:tt(at)}).passthrough())}).passthrough(),dt=We({method:He(),params:tt(ot)}),ct=We({_meta:tt(We({}).passthrough())}).passthrough(),ut=We({method:He(),params:tt(ct)}),lt=We({_meta:tt(We({}).passthrough())}).passthrough(),ht=Ye([He(),Be().int()]),pt=We({jsonrpc:Xe(nt),id:ht}).merge(dt).strict(),mt=We({jsonrpc:Xe(nt)}).merge(ut).strict(),ft=We({jsonrpc:Xe(nt),id:ht,result:lt}).strict();var _t;!function(e){e[e.ConnectionClosed=-1]="ConnectionClosed",e[e.RequestTimeout=-2]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(_t||(_t={}));const gt=Ye([pt,mt,ft,We({jsonrpc:Xe(nt),id:ht,error:We({code:Be().int(),message:He(),data:tt(ze())})}).strict()]),vt=lt.strict(),yt=ut.extend({method:Xe("notifications/cancelled"),params:ct.extend({requestId:ht,reason:He().optional()})}),xt=We({name:He(),version:He()}).passthrough(),bt=We({experimental:tt(We({}).passthrough()),sampling:tt(We({}).passthrough()),roots:tt(We({listChanged:tt(Qe())}).passthrough())}).passthrough(),Et=dt.extend({method:Xe("initialize"),params:ot.extend({protocolVersion:He(),capabilities:bt,clientInfo:xt})}),kt=We({experimental:tt(We({}).passthrough()),logging:tt(We({}).passthrough()),prompts:tt(We({listChanged:tt(Qe())}).passthrough()),resources:tt(We({subscribe:tt(Qe()),listChanged:tt(Qe())}).passthrough()),tools:tt(We({listChanged:tt(Qe())}).passthrough())}).passthrough(),Tt=lt.extend({protocolVersion:He(),capabilities:kt,serverInfo:xt}),wt=ut.extend({method:Xe("notifications/initialized")}),St=dt.extend({method:Xe("ping")}),Ot=We({progress:Be(),total:tt(Be())}).passthrough(),At=ut.extend({method:Xe("notifications/progress"),params:ct.merge(Ot).extend({progressToken:at})}),Nt=dt.extend({params:ot.extend({cursor:tt(it)}).optional()}),It=lt.extend({nextCursor:tt(it)}),Rt=We({uri:He(),mimeType:tt(He())}).passthrough(),Ct=Rt.extend({text:He()}),Dt=Rt.extend({blob:He().base64()}),Zt=We({uri:He(),name:He(),description:tt(He()),mimeType:tt(He())}).passthrough(),jt=We({uriTemplate:He(),name:He(),description:tt(He()),mimeType:tt(He())}).passthrough(),qt=Nt.extend({method:Xe("resources/list")}),Pt=It.extend({resources:Ke(Zt)}),$t=Nt.extend({method:Xe("resources/templates/list")}),Mt=It.extend({resourceTemplates:Ke(jt)}),Ut=dt.extend({method:Xe("resources/read"),params:ot.extend({uri:He()})}),Vt=lt.extend({contents:Ke(Ye([Ct,Dt]))}),Lt=ut.extend({method:Xe("notifications/resources/list_changed")}),Ft=dt.extend({method:Xe("resources/subscribe"),params:ot.extend({uri:He()})}),Ht=dt.extend({method:Xe("resources/unsubscribe"),params:ot.extend({uri:He()})}),Bt=ut.extend({method:Xe("notifications/resources/updated"),params:ct.extend({uri:He()})}),Qt=We({name:He(),description:tt(He()),required:tt(Qe())}).passthrough(),zt=We({name:He(),description:tt(He()),arguments:tt(Ke(Qt))}).passthrough(),Kt=Nt.extend({method:Xe("prompts/list")}),Wt=It.extend({prompts:Ke(zt)}),Yt=dt.extend({method:Xe("prompts/get"),params:ot.extend({name:He(),arguments:tt(Ge(He()))})}),Jt=We({type:Xe("text"),text:He()}).passthrough(),Gt=We({type:Xe("image"),data:He().base64(),mimeType:He()}).passthrough(),Xt=We({type:Xe("resource"),resource:Ye([Ct,Dt])}).passthrough(),es=We({role:et(["user","assistant"]),content:Ye([Jt,Gt,Xt])}).passthrough(),ts=lt.extend({description:tt(He()),messages:Ke(es)}),ss=ut.extend({method:Xe("notifications/prompts/list_changed")}),rs=We({name:He(),description:tt(He()),inputSchema:We({type:Xe("object"),properties:tt(We({}).passthrough())}).passthrough()}).passthrough(),ns=Nt.extend({method:Xe("tools/list")}),as=It.extend({tools:Ke(rs)}),is=lt.extend({content:Ke(Ye([Jt,Gt,Xt])),isError:Qe().default(!1).optional()});is.or(lt.extend({toolResult:ze()}));const os=dt.extend({method:Xe("tools/call"),params:ot.extend({name:He(),arguments:tt(Ge(ze()))})}),ds=ut.extend({method:Xe("notifications/tools/list_changed")}),cs=et(["debug","info","notice","warning","error","critical","alert","emergency"]),us=dt.extend({method:Xe("logging/setLevel"),params:ot.extend({level:cs})}),ls=ut.extend({method:Xe("notifications/message"),params:ct.extend({level:cs,logger:tt(He()),data:ze()})}),hs=We({name:He().optional()}).passthrough(),ps=We({hints:tt(Ke(hs)),costPriority:tt(Be().min(0).max(1)),speedPriority:tt(Be().min(0).max(1)),intelligencePriority:tt(Be().min(0).max(1))}).passthrough(),ms=We({role:et(["user","assistant"]),content:Ye([Jt,Gt])}).passthrough(),fs=dt.extend({method:Xe("sampling/createMessage"),params:ot.extend({messages:Ke(ms),systemPrompt:tt(He()),includeContext:tt(et(["none","thisServer","allServers"])),temperature:tt(Be()),maxTokens:Be().int(),stopSequences:tt(Ke(He())),metadata:tt(We({}).passthrough()),modelPreferences:tt(ps)})}),_s=lt.extend({model:He(),stopReason:tt(et(["endTurn","stopSequence","maxTokens"]).or(He())),role:et(["user","assistant"]),content:Je("type",[Jt,Gt])}),gs=We({type:Xe("ref/resource"),uri:He()}).passthrough(),vs=We({type:Xe("ref/prompt"),name:He()}).passthrough(),ys=dt.extend({method:Xe("completion/complete"),params:ot.extend({ref:Ye([vs,gs]),argument:We({name:He(),value:He()}).passthrough()})}),xs=lt.extend({completion:We({values:Ke(He()).max(100),total:tt(Be().int()),hasMore:tt(Qe())}).passthrough()}),bs=We({uri:He().startsWith("file://"),name:tt(He())}).passthrough(),Es=dt.extend({method:Xe("roots/list")}),ks=lt.extend({roots:Ke(bs)}),Ts=ut.extend({method:Xe("notifications/roots/list_changed")});Ye([St,Et,ys,us,Yt,Kt,qt,$t,Ut,Ft,Ht,os,ns]),Ye([yt,At,wt,Ts]),Ye([vt,_s,ks]),Ye([St,fs,Es]),Ye([yt,At,ls,Bt,Lt,ds,ss]),Ye([vt,Tt,xs,ts,Wt,Pt,Mt,Vt,is,as]);class ws extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s}}class Ss{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this.setNotificationHandler(yt,e=>{const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}),this.setNotificationHandler(At,e=>{this._onprogress(e)}),this.setRequestHandler(St,e=>({}))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=e=>{this._onerror(e)},this._transport.onmessage=e=>{"method"in e?"id"in e?this._onrequest(e):this._onnotification(e):this._onresponse(e)},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const s=new ws(_t.ConnectionClosed,"Connection closed");for(const e of t.values())e(s)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const s=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==s&&Promise.resolve().then(()=>s(e)).catch(e=>this._onerror(Error("Uncaught error in notification handler: "+e)))}_onrequest(e){var t,s;const r=null!==(t=this._requestHandlers.get(e.method))&&void 0!==t?t:this.fallbackRequestHandler;if(void 0===r)return void(null===(s=this._transport)||void 0===s||s.send({jsonrpc:"2.0",id:e.id,error:{code:_t.MethodNotFound,message:"Method not found"}}).catch(e=>this._onerror(Error("Failed to send an error response: "+e))));const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n),Promise.resolve().then(()=>r(e,{signal:n.signal})).then(t=>{var s;if(!n.signal.aborted)return null===(s=this._transport)||void 0===s?void 0:s.send({result:t,jsonrpc:"2.0",id:e.id})},t=>{var s,r;if(!n.signal.aborted)return null===(s=this._transport)||void 0===s?void 0:s.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:_t.InternalError,message:null!==(r=t.message)&&void 0!==r?r:"Internal error"}})}).catch(e=>this._onerror(Error("Failed to send response: "+e))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progress:t,total:s,progressToken:r}=e.params,n=this._progressHandlers.get(+r);void 0!==n?n({progress:t,total:s}):this._onerror(Error("Received a progress notification for an unknown token: "+JSON.stringify(e)))}_onresponse(e){const t=e.id,s=this._responseHandlers.get(+t);void 0!==s?(this._responseHandlers.delete(+t),this._progressHandlers.delete(+t),s("result"in e?e:new ws(e.error.code,e.error.message,e.error.data))):this._onerror(Error("Received a response for an unknown message ID: "+JSON.stringify(e)))}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}request(e,t,s){return new Promise((r,n)=>{var a,i,o,d;if(!this._transport)return void n(Error("Not connected"));!0===(null===(a=this._options)||void 0===a?void 0:a.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(i=null==s?void 0:s.signal)||void 0===i||i.throwIfAborted();const c=this._requestMessageId++,u={...e,jsonrpc:"2.0",id:c};let l;(null==s?void 0:s.onprogress)&&(this._progressHandlers.set(c,s.onprogress),u.params={...e.params,_meta:{progressToken:c}}),this._responseHandlers.set(c,e=>{var a;if(void 0!==l&&clearTimeout(l),!(null===(a=null==s?void 0:s.signal)||void 0===a?void 0:a.aborted)){if(e instanceof Error)return n(e);try{const s=t.parse(e.result);r(s)}catch(e){n(e)}}});const h=e=>{var t;this._responseHandlers.delete(c),this._progressHandlers.delete(c),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"cancelled",params:{requestId:c,reason:e+""}}).catch(e=>this._onerror(Error("Failed to send cancellation: "+e))),n(e)};null===(o=null==s?void 0:s.signal)||void 0===o||o.addEventListener("abort",()=>{var e;void 0!==l&&clearTimeout(l),h(null===(e=null==s?void 0:s.signal)||void 0===e?void 0:e.reason)});const p=null!==(d=null==s?void 0:s.timeout)&&void 0!==d?d:6e4;l=setTimeout(()=>h(new ws(_t.RequestTimeout,"Request timed out",{timeout:p})),p),this._transport.send(u).catch(e=>{void 0!==l&&clearTimeout(l),n(e)})})}async notification(e){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);const t={...e,jsonrpc:"2.0"};await this._transport.send(t)}setRequestHandler(e,t){const s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(s,r)=>Promise.resolve(t(e.parse(s),r)))}removeRequestHandler(e){this._requestHandlers.delete(e)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}class Os{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf("\n");if(-1===e)return null;const t=this._buffer.toString("utf8",0,e);return this._buffer=this._buffer.subarray(e+1),function(e){return gt.parse(JSON.parse(e))}(t)}clear(){this._buffer=void 0}}class As{constructor(e=h.stdin,t=h.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Os,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{const t=this._readBuffer.readMessage();if(null===t)break;null===(e=this.onmessage)||void 0===e||e.call(this,t)}catch(e){null===(t=this.onerror)||void 0===t||t.call(this,e)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._readBuffer.clear(),null===(e=this.onclose)||void 0===e||e.call(this)}send(e){return new Promise(t=>{const s=function(e){return JSON.stringify(e)+"\n"}(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}}class Ns{request;constructor(){this.request={REQUEST:{ESB_ATTRS:{App_ID:"VOSA",Target_ID:"WOMS",Application_ID:"00020000000002",Transaction_ID:""},REQUEST_DATA:{SendData:{Head:{jobTitle:"",businessSystem:"",proposeUser:"",jobDesc:"",fbk13:"",eventId:"",attachmentList:[]}},SendHead:{},SendURL:{},Operation:"Z_WORK_ORDER_CREATE_NEW",Type:"Z_WORK_ORDER_CREATE_NEW"}}}}setESBAttrs(e){return this.request.REQUEST.ESB_ATTRS={...this.request.REQUEST.ESB_ATTRS,...e},this}setAppId(e){return this.request.REQUEST.ESB_ATTRS.App_ID=e,this}setEventId(e){return this.request.REQUEST.REQUEST_DATA.SendData.Head.eventId=e,this}setTargetId(e){return this.request.REQUEST.ESB_ATTRS.Target_ID=e,this}setApplicationId(e){return this.request.REQUEST.ESB_ATTRS.Application_ID=e,this}generateApplicationId(){return this.request.REQUEST.ESB_ATTRS.Application_ID=this._generateApplicationId(),this}setTransactionId(e){return this.request.REQUEST.ESB_ATTRS.Transaction_ID=e||this._generateUUID(),this}setJobTitle(e){return this.request.REQUEST.REQUEST_DATA.SendData.Head.jobTitle=e,this}setBusinessSystem(e){return this.request.REQUEST.REQUEST_DATA.SendData.Head.businessSystem=e,this}setProposeUser(e){return this.request.REQUEST.REQUEST_DATA.SendData.Head.proposeUser=e,this}setJobDesc(e){return this.request.REQUEST.REQUEST_DATA.SendData.Head.jobDesc=e,this}setTimestamp(e){const t=e||new Date;return this.request.REQUEST.REQUEST_DATA.SendData.Head.fbk13=this._formatDate(t),this}addAttachment(e,t){return this.request.REQUEST.REQUEST_DATA.SendData.Head.attachmentList||(this.request.REQUEST.REQUEST_DATA.SendData.Head.attachmentList=[]),this.request.REQUEST.REQUEST_DATA.SendData.Head.attachmentList.push({attachmentName:e,attachmentDesc:t}),this}addAttachments(e){return e.forEach(e=>{this.addAttachment(e.attachmentName,e.attachmentDesc)}),this}setAttachments(e){return this.request.REQUEST.REQUEST_DATA.SendData.Head.attachmentList=e,this}clearAttachments(){return this.request.REQUEST.REQUEST_DATA.SendData.Head.attachmentList=[],this}setOperation(e){return this.request.REQUEST.REQUEST_DATA.Operation=e,this.request.REQUEST.REQUEST_DATA.Type=e,this}setSendHead(e){return this.request.REQUEST.REQUEST_DATA.SendHead=e,this}setSendURL(e){return this.request.REQUEST.REQUEST_DATA.SendURL=e,this}setWorkOrderHead(e){return this.request.REQUEST.REQUEST_DATA.SendData.Head={...this.request.REQUEST.REQUEST_DATA.SendData.Head,...e},this}build(){return this.request.REQUEST.ESB_ATTRS.Transaction_ID||this.setTransactionId(),this.request.REQUEST.REQUEST_DATA.SendData.Head.fbk13||this.setTimestamp(),JSON.parse(JSON.stringify(this.request))}buildJSON(e=!1){return JSON.stringify(this.build(),null,e?2:0)}reset(){const e=new Ns;return this.request=e.request,this}getData(){return JSON.parse(JSON.stringify(this.request))}_generateApplicationId(){const e=new Date;return`${e.getFullYear()}${(e.getMonth()+1+"").padStart(2,"0")}${(e.getDate()+"").padStart(2,"0")}${Math.floor(1e6*Math.random()).toString().padStart(6,"0")}`}_generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}_formatDate(e){const t=e=>e.toString().padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}}const Is={name:"create-wom-ticket",description:'创建运维工单(Work Order Management)\n\n**功能说明:**\n用于自动化提交系统故障、需求变更、运维支持等工单到企业服务总线(ESB)。\n\n**适用场景:**\n- 系统故障报修(如:登录异常、功能失效)\n- 功能需求提交(如:新增报表、权限调整)\n- 运维支持请求(如:数据修复、配置变更)\n- 事件跟踪记录(如:性能问题、安全事件)\n\n**重要提示:**\nsystem 参数必须使用精确的系统代码(区分大小写),不可使用系统全称或其他变体。\n\n**使用示例:**\n用户:"帮我报个工单,OA系统的审批流程有bug"\nAI 应使用 system: "OA"(而不是"OA系统"或"oa")',inputSchema:{type:"object",required:["empNo","content","system","title"],properties:{name:{type:"string",minLength:1,maxLength:100,description:"提交人姓名(用于工单联系和通知)"},email:{type:"string",format:"email",description:"提交人邮箱(用于接收工单处理进度通知)"},empNo:{type:"string",minLength:1,description:"员工工号(必填,用于身份验证和工单归属, 如果消息来自企微, from.userid 与该员工工号一致)"},system:{type:"string",minLength:1,enum:Object.keys({SRM:"供应商关系系统 - 供应商管理、采购流程、供应商评估",SPMS:"备件系统 - 备件管理、库存查询、备件申领",POS:"旧仓库管理系统 - 仓库出入库、库存盘点、物料管理",SAP:"SAP 系统 - ERP 核心业务、财务、生产、销售",MDM:"主数据管理系统 - 主数据维护、数据质量、数据同步",WOM:"工单系统 - 工单管理、任务跟踪、工单审批",OA:"OA 系统 - 办公自动化、审批流程、公文管理",ESB:"企业总线系统 - 系统集成、接口管理、数据交换",TMS:"运输管理系统 - 运输调度、物流跟踪、配送管理","网络/硬件":"网络硬件客户支持 - 网络故障、硬件报修、IT 基础设施",CRM:"客户关系管理系统 - 客户管理、销售跟进、客户服务",QMS:"质量管理系统 - 质量检验、不合格品处理、质量追溯",VOSA:"数字化产品项目 - 数字化平台、创新项目、新产品功能",EAM:"企业资源管理系统 - 资产管理、设备维护、资源调配"}),description:'问题所属系统代码(必填,必须精确匹配以下代码之一,区分大小写):\n\n• SRM - 供应商关系系统(供应商管理、采购流程)\n• SPMS - 备件系统(备件管理、库存查询)\n• POS - 旧仓库管理系统(仓库出入库、物料管理)\n• SAP - SAP 系统(ERP、财务、生产、销售)\n• MDM - 主数据管理系统(主数据维护、数据同步)\n• WOM - 工单系统(工单管理、任务跟踪)\n• OA - OA 系统(办公自动化、审批流程)\n• ESB - 企业总线系统(系统集成、接口管理)\n• TMS - 运输管理系统(运输调度、物流跟踪)\n• 网络/硬件 - 网络硬件客户支持(网络故障、硬件报修)\n• CRM - 客户关系管理系统(客户管理、销售跟进)\n• QMS - 质量管理系统(质量检验、质量追溯)\n• VOSA - 数字化产品项目(数字化平台、创新项目)\n• EAM - 企业资源管理系统(资产管理、设备维护)\n\n⚠️ 注意:必须使用代码(如"OA"),不能使用全称(如"OA系统")'},eventId:{type:"string",description:"关联的事件ID(可选,用于追踪特定监控事件或告警)"},replayId:{type:"string",description:"会话回放ID(可选,用于问题复现和分析)"},title:{type:"string",minLength:1,maxLength:100,description:'工单标题(必填,简明扼要描述问题,如:"登录页面无法访问"、"审批流程卡住")'},content:{type:"string",minLength:1,maxLength:5e3,description:"问题详细描述(必填)\n建议包含以下信息:\n- 问题现象:具体出现了什么问题\n- 复现步骤:如何触发该问题\n- 影响范围:影响了哪些用户或业务\n- 期望结果:希望达到什么效果\n- 发生时间:问题首次出现的时间"},attachments:{type:"array",items:{type:"object",required:["filename","url"],properties:{filename:{type:"string",description:"附件文件名(必须含扩展名,如:error.log、screenshot.png)"},url:{type:"string",description:"附件访问URL(需可公网访问或内网可达,支持 http/https 协议)"},size:{type:"number",description:"文件大小(字节,用于验证和展示)"}}},description:"附件列表(可选,支持截图、日志、录屏等,建议单个文件不超过10MB)"}}}};let Rs=process.env.ESB_URL||"";const Cs="mcp-server-wom-call",Ds="0.0.8";async function Zs(e){const t=Rs;if(!t)throw Error("ESB_URL is not configured");const s=function(e){const t=new Ns;if(t.setJobTitle(e.title).setProposeUser(e.empNo).setJobDesc(Buffer.from(e.content,"utf-8").toString("base64")).setBusinessSystem(e.system).setEventId(e.eventId||"").setAppId(e.system),e.attachments&&e.attachments.length>0){const s=e.attachments.filter(e=>"string"==typeof e.filename&&"string"==typeof e.url&&e.filename.length>0&&e.url.length>0);s.length>0&&t.addAttachments(s.map(e=>({attachmentName:e.filename,attachmentDesc:e.url})))}return t.buildJSON()}(e);try{const e=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:s});if(!e.ok){const t=await e.text();throw Error(`ESB API request failed: ${e.status} ${e.statusText}\nResponse: ${t}`)}const r=await e.json();return JSON.stringify(r,null,2)}catch(e){if(e instanceof Error)throw Error("Failed to create work order: "+e.message);throw Error("Failed to create work order: "+e)}}const js=new class extends Ss{constructor(e,t){super(t),this._serverInfo=e,this._capabilities=t.capabilities,this.setRequestHandler(Et,e=>this._oninitialize(e)),this.setNotificationHandler(wt,()=>{var e;return null===(e=this.oninitialized)||void 0===e?void 0:e.call(this)})}assertCapabilityForMethod(e){var t,s;switch(e){case"sampling/createMessage":if(!(null===(t=this._clientCapabilities)||void 0===t?void 0:t.sampling))throw Error(`Client does not support sampling (required for ${e})`);break;case"roots/list":if(!(null===(s=this._clientCapabilities)||void 0===s?void 0:s.roots))throw Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`)}}async _oninitialize(e){const t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:rt.includes(t)?t:st,capabilities:this.getCapabilities(),serverInfo:this._serverInfo}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},vt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},_s,t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},ks,t)}async sendLoggingMessage(e){return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}({name:Cs,version:Ds},{capabilities:{tools:{}}});js.setRequestHandler(ns,async()=>({tools:[Is]})),js.setRequestHandler(os,async e=>{try{!function(){if(!Rs)throw Error("ESB_URL is not configured. Please set it in .env file, system environment, or MCP client configuration.")}();const{name:t,arguments:s}=e.params;if(!s)throw Error("No arguments provided");if("create-wom-ticket"===t)return function(e){if(!e||"object"!=typeof e)throw Error("Invalid input: arguments must be an object");const t=e;if(!t.empNo||"string"!=typeof t.empNo||0===t.empNo.trim().length)throw Error("Invalid input: empNo is required and must be a non-empty string");if(!t.system||"string"!=typeof t.system||0===t.system.trim().length)throw Error("Invalid input: system is required and must be a non-empty string");if(!t.title||"string"!=typeof t.title||0===t.title.trim().length)throw Error("Invalid input: title is required and must be a non-empty string");if(!t.content||"string"!=typeof t.content||0===t.content.trim().length)throw Error("Invalid input: content is required and must be a non-empty string");if(t.title.length>100)throw Error("Invalid input: title must not exceed 100 characters");if(t.content.length>5e3)throw Error("Invalid input: content must not exceed 5000 characters");if(void 0!==t.name&&("string"!=typeof t.name||t.name.length>100))throw Error("Invalid input: name must be a string with max 100 characters");if(void 0!==t.email&&"string"!=typeof t.email)throw Error("Invalid input: email must be a string");if(t.email&&t.email.length>0&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.email))throw Error("Invalid input: email format is invalid");if(void 0!==t.attachments){if(!Array.isArray(t.attachments))throw Error("Invalid input: attachments must be an array");for(const[e,s]of t.attachments.entries()){if(!s||"object"!=typeof s)throw Error(`Invalid input: attachment at index ${e} must be an object`);if(!s.filename||"string"!=typeof s.filename||0===s.filename.trim().length)throw Error(`Invalid input: attachment at index ${e} must have a valid filename`);if(!s.url||"string"!=typeof s.url||0===s.url.trim().length)throw Error(`Invalid input: attachment at index ${e} must have a valid url`);try{new URL(s.url)}catch{throw Error(`Invalid input: attachment at index ${e} has an invalid URL format`)}if(void 0!==s.size&&("number"!=typeof s.size||s.size<0))throw Error(`Invalid input: attachment at index ${e} size must be a positive number`)}}}(s),{content:[{type:"text",text:"✅ 工单创建成功\n\n"+await Zs(s)}],isError:!1};throw Error("Unknown tool: "+t)}catch(e){return{content:[{type:"text",text:"❌ 工单创建失败\n\n错误信息:"+(e instanceof Error?e.message:e+"")}],isError:!0}}}),async function(){try{const e=new As;await js.connect(e)}catch(e){throw e}}().catch(e=>{process.exit(1)});
9
+ //# sourceMappingURL=index.js.map