@presidio-dev/specifai-mcp-server 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ MIT License
2
+
3
+ Copyright (c) Presidio, Inc. and affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ The Software may include logos, trademarks, and other branding assets
24
+ (“Branding”) of Presidio, Inc. Use of the Branding in modified or redistributed
25
+ versions of the Software requires removal or replacement unless prior written
26
+ permission is obtained from Presidio, Inc.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # Specifai MCP Server
2
+
3
+ A Model Context Protocol (MCP) server for [Specifai](https://github.com/presidio-oss/specifai) project integration and automation with any MCP-compatible AI tool. This server is designed to work with tool agnostic, meaning it can be used with any tool that supports the MCP protocol. This server currently expose tools to read all documents generated by Specifai project.
4
+
5
+ > [!WARNING]
6
+ > This server is currently in experimental. The functionality and available tools are subject to change and expansion as we continue to develop and improve the server.
7
+
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![npm version](https://badge.fury.io/js/@presidio-dev%2Fspecif-ai-mcp-server.svg)](https://badge.fury.io/js/@presidio-dev%2Fspecif-ai-mcp-server)
10
+
11
+ ## Table of Contents
12
+
13
+ - [Installation](#installation)
14
+ - [Configuration](#configuration)
15
+ - [Preparing Your Project](#preparing-your-project)
16
+ - [IDE Integration](#specifai-mcp-integration-with-popular-ide-and-extension)
17
+ - [Available Tools](#available-tools)
18
+ - [Requirements](#requirements)
19
+ - [Contributing](#contributing)
20
+ - [Security](#security)
21
+ - [License](#license)
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ # Latest version
27
+ npx --yes @presidio-dev/specifai-mcp-server@latest
28
+
29
+ # Specific version
30
+ npx --yes @presidio-dev/specifai-mcp-server@1.2.3
31
+ ```
32
+
33
+ We recommend `npx` to install the server, but you can use any node package manager of your preference such as `yarn`, `pnpm`, `bun`, etc.
34
+
35
+ ## Configuration
36
+
37
+ with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) with latest version:
38
+
39
+ ```json
40
+ {
41
+ "specifai": {
42
+ "command": "npx",
43
+ "args": ["--yes", "@presidio-dev/specifai-mcp-server@latest"],
44
+ "disabled": false,
45
+ "autoApprove": []
46
+ }
47
+ }
48
+ ```
49
+
50
+ with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) with specific version:
51
+
52
+ ```json
53
+ {
54
+ "specifai": {
55
+ "command": "npx",
56
+ "args": ["--yes", "@presidio-dev/specifai-mcp-server@1.2.3"],
57
+ "disabled": false,
58
+ "autoApprove": []
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### Preparing your project
64
+
65
+ > This is completely optional, but it's recommended to use it to avoid having to specify the project directory path every time you access the server. For AI IDE / Extension (Hai Build), it's recommended to use a `.specifai-path` file to specify the project directory path.
66
+
67
+ Make sure your project root directory contains a `.specifai-path` file. It's how the Specifai MCP server know where to find the specification documents generated by Specifai.
68
+
69
+ The file is a plain text file containing the absolute path to the project directory where the specification documents for an project are stored.
70
+
71
+ For example, if your project directory is located at `/path/to/project`, the `.specifai-path` file should contain the following line:
72
+
73
+ ```
74
+ /path/to/project
75
+ ```
76
+
77
+ ## Specifai MCP integration with popular IDE and extension
78
+
79
+ See the setup instructions for each
80
+
81
+ 1. [Hai Build](./docs/setup/hai-build.md)
82
+ 2. [Cursor](./docs/setup/cursor.md)
83
+
84
+ ### Available Tools
85
+
86
+ The server provides several tools for interacting with your specification documents:
87
+
88
+ | Tool Name | Description |
89
+ | ------------------ | ---------------------------------------- |
90
+ | `get-brds` | Get Business Requirement Documents |
91
+ | `get-prds` | Get Product Requirement Documents |
92
+ | `get-nfrs` | Get Non-Functional Requirements |
93
+ | `get-uirs` | Get User Interface Requirements |
94
+ | `get-bpds` | Get Business Process Documents |
95
+ | `get-user-stories` | Get User Stories for a specific PRD |
96
+ | `get-tasks` | Get Tasks for a specific User Story |
97
+ | `get-task` | Get details of a specific Task |
98
+ | `set-project-path` | Set or change the project directory path |
99
+
100
+ ## Requirements
101
+
102
+ Package manager installation:
103
+
104
+ - Node.js >= 16.0.0
105
+ - Bun >= 1.0.0 (if using Bun runtime)
106
+
107
+ ## Contributing
108
+
109
+ We welcome contributions to the Specifai MCP Server! Please see our [Contributing Guide](CONTRIBUTING.md) for more information on how to get started.
110
+
111
+ ### Development Setup
112
+
113
+ For detailed instructions on setting up your development environment, please refer to our [Development Setup Guide](docs/dev/02-development-setup.md).
114
+
115
+ ### Architecture
116
+
117
+ To understand the project architecture, please see our [Architecture Guide](docs/dev/03-architecture-guide.md).
118
+
119
+ ## Security
120
+
121
+ For information about our security policy and how to report security vulnerabilities, please see our [Security Policy](SECURITY.md).
122
+
123
+ ## License
124
+
125
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
126
+
127
+ ## Acknowledgements
128
+
129
+ - [Model Context Protocol](https://modelcontextprotocol.io/) - The protocol specification this server implements
130
+ - [Specifai](https://github.com/presidio-oss/specifai) - The project this server integrates with
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ var K;(function($){$.assertEqual=(J)=>J;function X(J){}$.assertIs=X;function Q(J){throw new Error}$.assertNever=Q,$.arrayToEnum=(J)=>{let G={};for(let Y of J)G[Y]=Y;return G},$.getValidEnumValues=(J)=>{let G=$.objectKeys(J).filter((B)=>typeof J[J[B]]!=="number"),Y={};for(let B of G)Y[B]=J[B];return $.objectValues(Y)},$.objectValues=(J)=>{return $.objectKeys(J).map(function(G){return J[G]})},$.objectKeys=typeof Object.keys==="function"?(J)=>Object.keys(J):(J)=>{let G=[];for(let Y in J)if(Object.prototype.hasOwnProperty.call(J,Y))G.push(Y);return G},$.find=(J,G)=>{for(let Y of J)if(G(Y))return Y;return},$.isInteger=typeof Number.isInteger==="function"?(J)=>Number.isInteger(J):(J)=>typeof J==="number"&&isFinite(J)&&Math.floor(J)===J;function W(J,G=" | "){return J.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(G)}$.joinValues=W,$.jsonStringifyReplacer=(J,G)=>{if(typeof G==="bigint")return G.toString();return G}})(K||(K={}));var o0;(function($){$.mergeShapes=(X,Q)=>{return{...X,...Q}}})(o0||(o0={}));var w=K.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=($)=>{switch(typeof $){case"undefined":return w.undefined;case"string":return w.string;case"number":return isNaN($)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":if(Array.isArray($))return w.array;if($===null)return w.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return w.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return w.map;if(typeof Set!=="undefined"&&$ instanceof Set)return w.set;if(typeof Date!=="undefined"&&$ instanceof Date)return w.date;return w.object;default:return w.unknown}},q=K.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"]),u1=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class S extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let X=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,X);else this.__proto__=X;this.name="ZodError",this.issues=$}format($){let X=$||function(J){return J.message},Q={_errors:[]},W=(J)=>{for(let G of J.issues)if(G.code==="invalid_union")G.unionErrors.map(W);else if(G.code==="invalid_return_type")W(G.returnTypeError);else if(G.code==="invalid_arguments")W(G.argumentsError);else if(G.path.length===0)Q._errors.push(X(G));else{let Y=Q,B=0;while(B<G.path.length){let M=G.path[B];if(B!==G.path.length-1)Y[M]=Y[M]||{_errors:[]};else Y[M]=Y[M]||{_errors:[]},Y[M]._errors.push(X(G));Y=Y[M],B++}}};return W(this),Q}static assert($){if(!($ instanceof S))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,K.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Q=[];for(let W of this.issues)if(W.path.length>0)X[W.path[0]]=X[W.path[0]]||[],X[W.path[0]].push($(W));else Q.push($(W));return{formErrors:Q,fieldErrors:X}}get formErrors(){return this.flatten()}}S.create=($)=>{return new S($)};var H0=($,X)=>{let Q;switch($.code){case q.invalid_type:if($.received===w.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case q.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,K.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:Q=`Unrecognized key(s) in object: ${K.joinValues($.keys,", ")}`;break;case q.invalid_union:Q="Invalid input";break;case q.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${K.joinValues($.options)}`;break;case q.invalid_enum_value:Q=`Invalid enum value. Expected ${K.joinValues($.options)}, received '${$.received}'`;break;case q.invalid_arguments:Q="Invalid function arguments";break;case q.invalid_return_type:Q="Invalid function return type";break;case q.invalid_date:Q="Invalid date";break;case q.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else K.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case q.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case q.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case q.custom:Q="Invalid input";break;case q.invalid_intersection_types:Q="Intersection results could not be merged";break;case q.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case q.not_finite:Q="Number must be finite";break;default:Q=X.defaultError,K.assertNever($)}return{message:Q}},R1=H0;function p1($){R1=$}function I0(){return R1}var P0=($)=>{let{data:X,path:Q,errorMaps:W,issueData:J}=$,G=[...Q,...J.path||[]],Y={...J,path:G};if(J.message!==void 0)return{...J,path:G,message:J.message};let B="",M=W.filter((V)=>!!V).slice().reverse();for(let V of M)B=V(Y,{data:X,defaultError:B}).message;return{...J,path:G,message:B}},n1=[];function z($,X){let Q=I0(),W=P0({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===H0?void 0:H0].filter((J)=>!!J)});$.common.issues.push(W)}class j{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,X){let Q=[];for(let W of X){if(W.status==="aborted")return R;if(W.status==="dirty")$.dirty();Q.push(W.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,X){let Q=[];for(let W of X){let J=await W.key,G=await W.value;Q.push({key:J,value:G})}return j.mergeObjectSync($,Q)}static mergeObjectSync($,X){let Q={};for(let W of X){let{key:J,value:G}=W;if(J.status==="aborted")return R;if(G.status==="aborted")return R;if(J.status==="dirty")$.dirty();if(G.status==="dirty")$.dirty();if(J.value!=="__proto__"&&(typeof G.value!=="undefined"||W.alwaysSet))Q[J.value]=G.value}return{status:$.value,value:Q}}}var R=Object.freeze({status:"aborted"}),W0=($)=>({status:"dirty",value:$}),E=($)=>({status:"valid",value:$}),a0=($)=>$.status==="aborted",s0=($)=>$.status==="dirty",o=($)=>$.status==="valid",K0=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;function T0($,X,Q,W){if(Q==="a"&&!W)throw new TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!W:!X.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?W:Q==="a"?W.call($):W?W.value:X.get($)}function U1($,X,Q,W,J){if(W==="m")throw new TypeError("Private method is not writable");if(W==="a"&&!J)throw new TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!J:!X.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return W==="a"?J.call($,Q):J?J.value=Q:X.set($,Q),Q}var A;(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X===null||X===void 0?void 0:X.message})(A||(A={}));var U0,D0;class P{constructor($,X,Q,W){this._cachedPath=[],this.parent=$,this.data=X,this._path=Q,this._key=W}get path(){if(!this._cachedPath.length)if(this._key instanceof Array)this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var A1=($,X)=>{if(o(X))return{success:!0,data:X.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new S($.common.issues);return this._error=Q,this._error}}}};function U($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:W,description:J}=$;if(X&&(Q||W))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:J};return{errorMap:(Y,B)=>{var M,V;let{message:F}=$;if(Y.code==="invalid_enum_value")return{message:F!==null&&F!==void 0?F:B.defaultError};if(typeof B.data==="undefined")return{message:(M=F!==null&&F!==void 0?F:W)!==null&&M!==void 0?M:B.defaultError};if(Y.code!=="invalid_type")return{message:B.defaultError};return{message:(V=F!==null&&F!==void 0?F:Q)!==null&&V!==void 0?V:B.defaultError}},description:J}}class D{get description(){return this._def.description}_getType($){return Z($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:Z($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new j,ctx:{common:$.parent.common,data:$.data,parsedType:Z($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(K0(X))throw new Error("Synchronous parse encountered promise.");return X}_parseAsync($){let X=this._parse($);return Promise.resolve(X)}parse($,X){let Q=this.safeParse($,X);if(Q.success)return Q.data;throw Q.error}safeParse($,X){var Q;let W={common:{issues:[],async:(Q=X===null||X===void 0?void 0:X.async)!==null&&Q!==void 0?Q:!1,contextualErrorMap:X===null||X===void 0?void 0:X.errorMap},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:Z($)},J=this._parseSync({data:$,path:W.path,parent:W});return A1(W,J)}"~validate"($){var X,Q;let W={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:Z($)};if(!this["~standard"].async)try{let J=this._parseSync({data:$,path:[],parent:W});return o(J)?{value:J.value}:{issues:W.common.issues}}catch(J){if((Q=(X=J===null||J===void 0?void 0:J.message)===null||X===void 0?void 0:X.toLowerCase())===null||Q===void 0?void 0:Q.includes("encountered"))this["~standard"].async=!0;W.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:W}).then((J)=>o(J)?{value:J.value}:{issues:W.common.issues})}async parseAsync($,X){let Q=await this.safeParseAsync($,X);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,X){let Q={common:{issues:[],contextualErrorMap:X===null||X===void 0?void 0:X.errorMap,async:!0},path:(X===null||X===void 0?void 0:X.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:Z($)},W=this._parse({data:$,path:Q.path,parent:Q}),J=await(K0(W)?W:Promise.resolve(W));return A1(Q,J)}refine($,X){let Q=(W)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(W);else return X};return this._refinement((W,J)=>{let G=$(W),Y=()=>J.addIssue({code:q.custom,...Q(W)});if(typeof Promise!=="undefined"&&G instanceof Promise)return G.then((B)=>{if(!B)return Y(),!1;else return!0});if(!G)return Y(),!1;else return!0})}refinement($,X){return this._refinement((Q,W)=>{if(!$(Q))return W.addIssue(typeof X==="function"?X(Q,W):X),!1;else return!0})}_refinement($){return new C({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(X)=>this["~validate"](X)}}optional(){return I.create(this,this._def)}nullable(){return c.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return k.create(this)}promise(){return e.create(this,this._def)}or($){return q0.create([this,$],this._def)}and($){return M0.create(this,$,this._def)}transform($){return new C({...U(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new A0({...U(this._def),innerType:this,defaultValue:X,typeName:L.ZodDefault})}brand(){return new g0({typeName:L.ZodBranded,type:this,...U(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new O0({...U(this._def),innerType:this,catchValue:X,typeName:L.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return S0.create(this,$)}readonly(){return L0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var i1=/^c[^\s-]{8,}$/i,d1=/^[0-9a-z]+$/,r1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,o1=/^[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,a1=/^[a-z0-9_-]{21}$/i,s1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,t1=/^[-+]?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)?)??$/,e1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",r0,X2=/^(?:(?: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])$/,Q2=/^(?:(?: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])$/,W2=/^(([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]))$/,J2=/^(([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])$/,H2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,G2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,D1="((\\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])))",Y2=new RegExp(`^${D1}$`);function K1($){let X="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;return X}function B2($){return new RegExp(`^${K1($)}$`)}function F1($){let X=`${D1}T${K1($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Q.join("|")})`,new RegExp(`^${X}$`)}function q2($,X){if((X==="v4"||!X)&&X2.test($))return!0;if((X==="v6"||!X)&&W2.test($))return!0;return!1}function M2($,X){if(!s1.test($))return!1;try{let[Q]=$.split("."),W=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),J=JSON.parse(atob(W));if(typeof J!=="object"||J===null)return!1;if(!J.typ||!J.alg)return!1;if(X&&J.alg!==X)return!1;return!0}catch(Q){return!1}}function z2($,X){if((X==="v4"||!X)&&Q2.test($))return!0;if((X==="v6"||!X)&&J2.test($))return!0;return!1}class f extends D{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==w.string){let J=this._getOrReturnCtx($);return z(J,{code:q.invalid_type,expected:w.string,received:J.parsedType}),R}let Q=new j,W=void 0;for(let J of this._def.checks)if(J.kind==="min"){if($.data.length<J.value)W=this._getOrReturnCtx($,W),z(W,{code:q.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),Q.dirty()}else if(J.kind==="max"){if($.data.length>J.value)W=this._getOrReturnCtx($,W),z(W,{code:q.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),Q.dirty()}else if(J.kind==="length"){let G=$.data.length>J.value,Y=$.data.length<J.value;if(G||Y){if(W=this._getOrReturnCtx($,W),G)z(W,{code:q.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});else if(Y)z(W,{code:q.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});Q.dirty()}}else if(J.kind==="email"){if(!e1.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"email",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="emoji"){if(!r0)r0=new RegExp($2,"u");if(!r0.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"emoji",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="uuid"){if(!o1.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"uuid",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="nanoid"){if(!a1.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"nanoid",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="cuid"){if(!i1.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"cuid",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="cuid2"){if(!d1.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"cuid2",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="ulid"){if(!r1.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"ulid",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="url")try{new URL($.data)}catch(G){W=this._getOrReturnCtx($,W),z(W,{validation:"url",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="regex"){if(J.regex.lastIndex=0,!J.regex.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"regex",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="trim")$.data=$.data.trim();else if(J.kind==="includes"){if(!$.data.includes(J.value,J.position))W=this._getOrReturnCtx($,W),z(W,{code:q.invalid_string,validation:{includes:J.value,position:J.position},message:J.message}),Q.dirty()}else if(J.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(J.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(J.kind==="startsWith"){if(!$.data.startsWith(J.value))W=this._getOrReturnCtx($,W),z(W,{code:q.invalid_string,validation:{startsWith:J.value},message:J.message}),Q.dirty()}else if(J.kind==="endsWith"){if(!$.data.endsWith(J.value))W=this._getOrReturnCtx($,W),z(W,{code:q.invalid_string,validation:{endsWith:J.value},message:J.message}),Q.dirty()}else if(J.kind==="datetime"){if(!F1(J).test($.data))W=this._getOrReturnCtx($,W),z(W,{code:q.invalid_string,validation:"datetime",message:J.message}),Q.dirty()}else if(J.kind==="date"){if(!Y2.test($.data))W=this._getOrReturnCtx($,W),z(W,{code:q.invalid_string,validation:"date",message:J.message}),Q.dirty()}else if(J.kind==="time"){if(!B2(J).test($.data))W=this._getOrReturnCtx($,W),z(W,{code:q.invalid_string,validation:"time",message:J.message}),Q.dirty()}else if(J.kind==="duration"){if(!t1.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"duration",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="ip"){if(!q2($.data,J.version))W=this._getOrReturnCtx($,W),z(W,{validation:"ip",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="jwt"){if(!M2($.data,J.alg))W=this._getOrReturnCtx($,W),z(W,{validation:"jwt",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="cidr"){if(!z2($.data,J.version))W=this._getOrReturnCtx($,W),z(W,{validation:"cidr",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="base64"){if(!H2.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"base64",code:q.invalid_string,message:J.message}),Q.dirty()}else if(J.kind==="base64url"){if(!G2.test($.data))W=this._getOrReturnCtx($,W),z(W,{validation:"base64url",code:q.invalid_string,message:J.message}),Q.dirty()}else K.assertNever(J);return{status:Q.value,value:$.data}}_regex($,X,Q){return this.refinement((W)=>$.test(W),{validation:X,code:q.invalid_string,...A.errToObj(Q)})}_addCheck($){return new f({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...A.errToObj($)})}url($){return this._addCheck({kind:"url",...A.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...A.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...A.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...A.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...A.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...A.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...A.errToObj($)})}base64($){return this._addCheck({kind:"base64",...A.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...A.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...A.errToObj($)})}ip($){return this._addCheck({kind:"ip",...A.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...A.errToObj($)})}datetime($){var X,Q;if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,offset:(X=$===null||$===void 0?void 0:$.offset)!==null&&X!==void 0?X:!1,local:(Q=$===null||$===void 0?void 0:$.local)!==null&&Q!==void 0?Q:!1,...A.errToObj($===null||$===void 0?void 0:$.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,...A.errToObj($===null||$===void 0?void 0:$.message)})}duration($){return this._addCheck({kind:"duration",...A.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...A.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X===null||X===void 0?void 0:X.position,...A.errToObj(X===null||X===void 0?void 0:X.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...A.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...A.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...A.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...A.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...A.errToObj(X)})}nonempty($){return this.min(1,A.errToObj($))}trim(){return new f({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new f({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new f({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxLength(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}}f.create=($)=>{var X;return new f({checks:[],typeName:L.ZodString,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...U($)})};function w2($,X){let Q=($.toString().split(".")[1]||"").length,W=(X.toString().split(".")[1]||"").length,J=Q>W?Q:W,G=parseInt($.toFixed(J).replace(".","")),Y=parseInt(X.toFixed(J).replace(".",""));return G%Y/Math.pow(10,J)}class n extends D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==w.number){let J=this._getOrReturnCtx($);return z(J,{code:q.invalid_type,expected:w.number,received:J.parsedType}),R}let Q=void 0,W=new j;for(let J of this._def.checks)if(J.kind==="int"){if(!K.isInteger($.data))Q=this._getOrReturnCtx($,Q),z(Q,{code:q.invalid_type,expected:"integer",received:"float",message:J.message}),W.dirty()}else if(J.kind==="min"){if(J.inclusive?$.data<J.value:$.data<=J.value)Q=this._getOrReturnCtx($,Q),z(Q,{code:q.too_small,minimum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),W.dirty()}else if(J.kind==="max"){if(J.inclusive?$.data>J.value:$.data>=J.value)Q=this._getOrReturnCtx($,Q),z(Q,{code:q.too_big,maximum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),W.dirty()}else if(J.kind==="multipleOf"){if(w2($.data,J.value)!==0)Q=this._getOrReturnCtx($,Q),z(Q,{code:q.not_multiple_of,multipleOf:J.value,message:J.message}),W.dirty()}else if(J.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),z(Q,{code:q.not_finite,message:J.message}),W.dirty()}else K.assertNever(J);return{status:W.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,A.toString(X))}gt($,X){return this.setLimit("min",$,!1,A.toString(X))}lte($,X){return this.setLimit("max",$,!0,A.toString(X))}lt($,X){return this.setLimit("max",$,!1,A.toString(X))}setLimit($,X,Q,W){return new n({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:A.toString(W)}]})}_addCheck($){return new n({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:A.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:A.toString(X)})}finite($){return this._addCheck({kind:"finite",message:A.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString($)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&K.isInteger($.value))}get isFinite(){let $=null,X=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(X===null||Q.value>X)X=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(X)&&Number.isFinite($)}}n.create=($)=>{return new n({checks:[],typeName:L.ZodNumber,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...U($)})};class i extends D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch(J){return this._getInvalidInput($)}if(this._getType($)!==w.bigint)return this._getInvalidInput($);let Q=void 0,W=new j;for(let J of this._def.checks)if(J.kind==="min"){if(J.inclusive?$.data<J.value:$.data<=J.value)Q=this._getOrReturnCtx($,Q),z(Q,{code:q.too_small,type:"bigint",minimum:J.value,inclusive:J.inclusive,message:J.message}),W.dirty()}else if(J.kind==="max"){if(J.inclusive?$.data>J.value:$.data>=J.value)Q=this._getOrReturnCtx($,Q),z(Q,{code:q.too_big,type:"bigint",maximum:J.value,inclusive:J.inclusive,message:J.message}),W.dirty()}else if(J.kind==="multipleOf"){if($.data%J.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),z(Q,{code:q.not_multiple_of,multipleOf:J.value,message:J.message}),W.dirty()}else K.assertNever(J);return{status:W.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return z(X,{code:q.invalid_type,expected:w.bigint,received:X.parsedType}),R}gte($,X){return this.setLimit("min",$,!0,A.toString(X))}gt($,X){return this.setLimit("min",$,!1,A.toString(X))}lte($,X){return this.setLimit("max",$,!0,A.toString(X))}lt($,X){return this.setLimit("max",$,!1,A.toString(X))}setLimit($,X,Q,W){return new i({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:A.toString(W)}]})}_addCheck($){return new i({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:A.toString(X)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}}i.create=($)=>{var X;return new i({checks:[],typeName:L.ZodBigInt,coerce:(X=$===null||$===void 0?void 0:$.coerce)!==null&&X!==void 0?X:!1,...U($)})};class G0 extends D{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==w.boolean){let Q=this._getOrReturnCtx($);return z(Q,{code:q.invalid_type,expected:w.boolean,received:Q.parsedType}),R}return E($.data)}}G0.create=($)=>{return new G0({typeName:L.ZodBoolean,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...U($)})};class a extends D{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==w.date){let J=this._getOrReturnCtx($);return z(J,{code:q.invalid_type,expected:w.date,received:J.parsedType}),R}if(isNaN($.data.getTime())){let J=this._getOrReturnCtx($);return z(J,{code:q.invalid_date}),R}let Q=new j,W=void 0;for(let J of this._def.checks)if(J.kind==="min"){if($.data.getTime()<J.value)W=this._getOrReturnCtx($,W),z(W,{code:q.too_small,message:J.message,inclusive:!0,exact:!1,minimum:J.value,type:"date"}),Q.dirty()}else if(J.kind==="max"){if($.data.getTime()>J.value)W=this._getOrReturnCtx($,W),z(W,{code:q.too_big,message:J.message,inclusive:!0,exact:!1,maximum:J.value,type:"date"}),Q.dirty()}else K.assertNever(J);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new a({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:A.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:A.toString(X)})}get minDate(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $!=null?new Date($):null}}a.create=($)=>{return new a({checks:[],coerce:($===null||$===void 0?void 0:$.coerce)||!1,typeName:L.ZodDate,...U($)})};class F0 extends D{_parse($){if(this._getType($)!==w.symbol){let Q=this._getOrReturnCtx($);return z(Q,{code:q.invalid_type,expected:w.symbol,received:Q.parsedType}),R}return E($.data)}}F0.create=($)=>{return new F0({typeName:L.ZodSymbol,...U($)})};class Y0 extends D{_parse($){if(this._getType($)!==w.undefined){let Q=this._getOrReturnCtx($);return z(Q,{code:q.invalid_type,expected:w.undefined,received:Q.parsedType}),R}return E($.data)}}Y0.create=($)=>{return new Y0({typeName:L.ZodUndefined,...U($)})};class B0 extends D{_parse($){if(this._getType($)!==w.null){let Q=this._getOrReturnCtx($);return z(Q,{code:q.invalid_type,expected:w.null,received:Q.parsedType}),R}return E($.data)}}B0.create=($)=>{return new B0({typeName:L.ZodNull,...U($)})};class s extends D{constructor(){super(...arguments);this._any=!0}_parse($){return E($.data)}}s.create=($)=>{return new s({typeName:L.ZodAny,...U($)})};class p extends D{constructor(){super(...arguments);this._unknown=!0}_parse($){return E($.data)}}p.create=($)=>{return new p({typeName:L.ZodUnknown,...U($)})};class g extends D{_parse($){let X=this._getOrReturnCtx($);return z(X,{code:q.invalid_type,expected:w.never,received:X.parsedType}),R}}g.create=($)=>{return new g({typeName:L.ZodNever,...U($)})};class N0 extends D{_parse($){if(this._getType($)!==w.undefined){let Q=this._getOrReturnCtx($);return z(Q,{code:q.invalid_type,expected:w.void,received:Q.parsedType}),R}return E($.data)}}N0.create=($)=>{return new N0({typeName:L.ZodVoid,...U($)})};class k extends D{_parse($){let{ctx:X,status:Q}=this._processInputParams($),W=this._def;if(X.parsedType!==w.array)return z(X,{code:q.invalid_type,expected:w.array,received:X.parsedType}),R;if(W.exactLength!==null){let G=X.data.length>W.exactLength.value,Y=X.data.length<W.exactLength.value;if(G||Y)z(X,{code:G?q.too_big:q.too_small,minimum:Y?W.exactLength.value:void 0,maximum:G?W.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:W.exactLength.message}),Q.dirty()}if(W.minLength!==null){if(X.data.length<W.minLength.value)z(X,{code:q.too_small,minimum:W.minLength.value,type:"array",inclusive:!0,exact:!1,message:W.minLength.message}),Q.dirty()}if(W.maxLength!==null){if(X.data.length>W.maxLength.value)z(X,{code:q.too_big,maximum:W.maxLength.value,type:"array",inclusive:!0,exact:!1,message:W.maxLength.message}),Q.dirty()}if(X.common.async)return Promise.all([...X.data].map((G,Y)=>{return W.type._parseAsync(new P(X,G,X.path,Y))})).then((G)=>{return j.mergeArray(Q,G)});let J=[...X.data].map((G,Y)=>{return W.type._parseSync(new P(X,G,X.path,Y))});return j.mergeArray(Q,J)}get element(){return this._def.type}min($,X){return new k({...this._def,minLength:{value:$,message:A.toString(X)}})}max($,X){return new k({...this._def,maxLength:{value:$,message:A.toString(X)}})}length($,X){return new k({...this._def,exactLength:{value:$,message:A.toString(X)}})}nonempty($){return this.min(1,$)}}k.create=($,X)=>{return new k({type:$,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...U(X)})};function Q0($){if($ instanceof N){let X={};for(let Q in $.shape){let W=$.shape[Q];X[Q]=I.create(Q0(W))}return new N({...$._def,shape:()=>X})}else if($ instanceof k)return new k({...$._def,type:Q0($.element)});else if($ instanceof I)return I.create(Q0($.unwrap()));else if($ instanceof c)return c.create(Q0($.unwrap()));else if($ instanceof x)return x.create($.items.map((X)=>Q0(X)));else return $}class N extends D{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),X=K.objectKeys($);return this._cached={shape:$,keys:X}}_parse($){if(this._getType($)!==w.object){let M=this._getOrReturnCtx($);return z(M,{code:q.invalid_type,expected:w.object,received:M.parsedType}),R}let{status:Q,ctx:W}=this._processInputParams($),{shape:J,keys:G}=this._getCached(),Y=[];if(!(this._def.catchall instanceof g&&this._def.unknownKeys==="strip")){for(let M in W.data)if(!G.includes(M))Y.push(M)}let B=[];for(let M of G){let V=J[M],F=W.data[M];B.push({key:{status:"valid",value:M},value:V._parse(new P(W,F,W.path,M)),alwaysSet:M in W.data})}if(this._def.catchall instanceof g){let M=this._def.unknownKeys;if(M==="passthrough")for(let V of Y)B.push({key:{status:"valid",value:V},value:{status:"valid",value:W.data[V]}});else if(M==="strict"){if(Y.length>0)z(W,{code:q.unrecognized_keys,keys:Y}),Q.dirty()}else if(M==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let M=this._def.catchall;for(let V of Y){let F=W.data[V];B.push({key:{status:"valid",value:V},value:M._parse(new P(W,F,W.path,V)),alwaysSet:V in W.data})}}if(W.common.async)return Promise.resolve().then(async()=>{let M=[];for(let V of B){let F=await V.key,_=await V.value;M.push({key:F,value:_,alwaysSet:V.alwaysSet})}return M}).then((M)=>{return j.mergeObjectSync(Q,M)});else return j.mergeObjectSync(Q,B)}get shape(){return this._def.shape()}strict($){return A.errToObj,new N({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Q)=>{var W,J,G,Y;let B=(G=(J=(W=this._def).errorMap)===null||J===void 0?void 0:J.call(W,X,Q).message)!==null&&G!==void 0?G:Q.defaultError;if(X.code==="unrecognized_keys")return{message:(Y=A.errToObj($).message)!==null&&Y!==void 0?Y:B};return{message:B}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend($){return new N({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new N({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:L.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new N({...this._def,catchall:$})}pick($){let X={};return K.objectKeys($).forEach((Q)=>{if($[Q]&&this.shape[Q])X[Q]=this.shape[Q]}),new N({...this._def,shape:()=>X})}omit($){let X={};return K.objectKeys(this.shape).forEach((Q)=>{if(!$[Q])X[Q]=this.shape[Q]}),new N({...this._def,shape:()=>X})}deepPartial(){return Q0(this)}partial($){let X={};return K.objectKeys(this.shape).forEach((Q)=>{let W=this.shape[Q];if($&&!$[Q])X[Q]=W;else X[Q]=W.optional()}),new N({...this._def,shape:()=>X})}required($){let X={};return K.objectKeys(this.shape).forEach((Q)=>{if($&&!$[Q])X[Q]=this.shape[Q];else{let J=this.shape[Q];while(J instanceof I)J=J._def.innerType;X[Q]=J}}),new N({...this._def,shape:()=>X})}keyof(){return N1(K.objectKeys(this.shape))}}N.create=($,X)=>{return new N({shape:()=>$,unknownKeys:"strip",catchall:g.create(),typeName:L.ZodObject,...U(X)})};N.strictCreate=($,X)=>{return new N({shape:()=>$,unknownKeys:"strict",catchall:g.create(),typeName:L.ZodObject,...U(X)})};N.lazycreate=($,X)=>{return new N({shape:$,unknownKeys:"strip",catchall:g.create(),typeName:L.ZodObject,...U(X)})};class q0 extends D{_parse($){let{ctx:X}=this._processInputParams($),Q=this._def.options;function W(J){for(let Y of J)if(Y.result.status==="valid")return Y.result;for(let Y of J)if(Y.result.status==="dirty")return X.common.issues.push(...Y.ctx.common.issues),Y.result;let G=J.map((Y)=>new S(Y.ctx.common.issues));return z(X,{code:q.invalid_union,unionErrors:G}),R}if(X.common.async)return Promise.all(Q.map(async(J)=>{let G={...X,common:{...X.common,issues:[]},parent:null};return{result:await J._parseAsync({data:X.data,path:X.path,parent:G}),ctx:G}})).then(W);else{let J=void 0,G=[];for(let B of Q){let M={...X,common:{...X.common,issues:[]},parent:null},V=B._parseSync({data:X.data,path:X.path,parent:M});if(V.status==="valid")return V;else if(V.status==="dirty"&&!J)J={result:V,ctx:M};if(M.common.issues.length)G.push(M.common.issues)}if(J)return X.common.issues.push(...J.ctx.common.issues),J.result;let Y=G.map((B)=>new S(B));return z(X,{code:q.invalid_union,unionErrors:Y}),R}}get options(){return this._def.options}}q0.create=($,X)=>{return new q0({options:$,typeName:L.ZodUnion,...U(X)})};var l=($)=>{if($ instanceof z0)return l($.schema);else if($ instanceof C)return l($.innerType());else if($ instanceof w0)return[$.value];else if($ instanceof d)return $.options;else if($ instanceof V0)return K.objectValues($.enum);else if($ instanceof A0)return l($._def.innerType);else if($ instanceof Y0)return[void 0];else if($ instanceof B0)return[null];else if($ instanceof I)return[void 0,...l($.unwrap())];else if($ instanceof c)return[null,...l($.unwrap())];else if($ instanceof g0)return l($.unwrap());else if($ instanceof L0)return l($.unwrap());else if($ instanceof O0)return l($._def.innerType);else return[]};class h0 extends D{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==w.object)return z(X,{code:q.invalid_type,expected:w.object,received:X.parsedType}),R;let Q=this.discriminator,W=X.data[Q],J=this.optionsMap.get(W);if(!J)return z(X,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),R;if(X.common.async)return J._parseAsync({data:X.data,path:X.path,parent:X});else return J._parseSync({data:X.data,path:X.path,parent:X})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,X,Q){let W=new Map;for(let J of X){let G=l(J.shape[$]);if(!G.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let Y of G){if(W.has(Y))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(Y)}`);W.set(Y,J)}}return new h0({typeName:L.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:W,...U(Q)})}}function t0($,X){let Q=Z($),W=Z(X);if($===X)return{valid:!0,data:$};else if(Q===w.object&&W===w.object){let J=K.objectKeys(X),G=K.objectKeys($).filter((B)=>J.indexOf(B)!==-1),Y={...$,...X};for(let B of G){let M=t0($[B],X[B]);if(!M.valid)return{valid:!1};Y[B]=M.data}return{valid:!0,data:Y}}else if(Q===w.array&&W===w.array){if($.length!==X.length)return{valid:!1};let J=[];for(let G=0;G<$.length;G++){let Y=$[G],B=X[G],M=t0(Y,B);if(!M.valid)return{valid:!1};J.push(M.data)}return{valid:!0,data:J}}else if(Q===w.date&&W===w.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}class M0 extends D{_parse($){let{status:X,ctx:Q}=this._processInputParams($),W=(J,G)=>{if(a0(J)||a0(G))return R;let Y=t0(J.value,G.value);if(!Y.valid)return z(Q,{code:q.invalid_intersection_types}),R;if(s0(J)||s0(G))X.dirty();return{status:X.value,value:Y.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([J,G])=>W(J,G));else return W(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}M0.create=($,X,Q)=>{return new M0({left:$,right:X,typeName:L.ZodIntersection,...U(Q)})};class x extends D{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==w.array)return z(Q,{code:q.invalid_type,expected:w.array,received:Q.parsedType}),R;if(Q.data.length<this._def.items.length)return z(Q,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;if(!this._def.rest&&Q.data.length>this._def.items.length)z(Q,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let J=[...Q.data].map((G,Y)=>{let B=this._def.items[Y]||this._def.rest;if(!B)return null;return B._parse(new P(Q,G,Q.path,Y))}).filter((G)=>!!G);if(Q.common.async)return Promise.all(J).then((G)=>{return j.mergeArray(X,G)});else return j.mergeArray(X,J)}get items(){return this._def.items}rest($){return new x({...this._def,rest:$})}}x.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new x({items:$,typeName:L.ZodTuple,rest:null,...U(X)})};class j0 extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==w.object)return z(Q,{code:q.invalid_type,expected:w.object,received:Q.parsedType}),R;let W=[],J=this._def.keyType,G=this._def.valueType;for(let Y in Q.data)W.push({key:J._parse(new P(Q,Y,Q.path,Y)),value:G._parse(new P(Q,Q.data[Y],Q.path,Y)),alwaysSet:Y in Q.data});if(Q.common.async)return j.mergeObjectAsync(X,W);else return j.mergeObjectSync(X,W)}get element(){return this._def.valueType}static create($,X,Q){if(X instanceof D)return new j0({keyType:$,valueType:X,typeName:L.ZodRecord,...U(Q)});return new j0({keyType:f.create(),valueType:$,typeName:L.ZodRecord,...U(X)})}}class E0 extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==w.map)return z(Q,{code:q.invalid_type,expected:w.map,received:Q.parsedType}),R;let W=this._def.keyType,J=this._def.valueType,G=[...Q.data.entries()].map(([Y,B],M)=>{return{key:W._parse(new P(Q,Y,Q.path,[M,"key"])),value:J._parse(new P(Q,B,Q.path,[M,"value"]))}});if(Q.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let B of G){let M=await B.key,V=await B.value;if(M.status==="aborted"||V.status==="aborted")return R;if(M.status==="dirty"||V.status==="dirty")X.dirty();Y.set(M.value,V.value)}return{status:X.value,value:Y}})}else{let Y=new Map;for(let B of G){let{key:M,value:V}=B;if(M.status==="aborted"||V.status==="aborted")return R;if(M.status==="dirty"||V.status==="dirty")X.dirty();Y.set(M.value,V.value)}return{status:X.value,value:Y}}}}E0.create=($,X,Q)=>{return new E0({valueType:X,keyType:$,typeName:L.ZodMap,...U(Q)})};class t extends D{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==w.set)return z(Q,{code:q.invalid_type,expected:w.set,received:Q.parsedType}),R;let W=this._def;if(W.minSize!==null){if(Q.data.size<W.minSize.value)z(Q,{code:q.too_small,minimum:W.minSize.value,type:"set",inclusive:!0,exact:!1,message:W.minSize.message}),X.dirty()}if(W.maxSize!==null){if(Q.data.size>W.maxSize.value)z(Q,{code:q.too_big,maximum:W.maxSize.value,type:"set",inclusive:!0,exact:!1,message:W.maxSize.message}),X.dirty()}let J=this._def.valueType;function G(B){let M=new Set;for(let V of B){if(V.status==="aborted")return R;if(V.status==="dirty")X.dirty();M.add(V.value)}return{status:X.value,value:M}}let Y=[...Q.data.values()].map((B,M)=>J._parse(new P(Q,B,Q.path,M)));if(Q.common.async)return Promise.all(Y).then((B)=>G(B));else return G(Y)}min($,X){return new t({...this._def,minSize:{value:$,message:A.toString(X)}})}max($,X){return new t({...this._def,maxSize:{value:$,message:A.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}}t.create=($,X)=>{return new t({valueType:$,minSize:null,maxSize:null,typeName:L.ZodSet,...U(X)})};class J0 extends D{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==w.function)return z(X,{code:q.invalid_type,expected:w.function,received:X.parsedType}),R;function Q(Y,B){return P0({data:Y,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,I0(),H0].filter((M)=>!!M),issueData:{code:q.invalid_arguments,argumentsError:B}})}function W(Y,B){return P0({data:Y,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,I0(),H0].filter((M)=>!!M),issueData:{code:q.invalid_return_type,returnTypeError:B}})}let J={errorMap:X.common.contextualErrorMap},G=X.data;if(this._def.returns instanceof e){let Y=this;return E(async function(...B){let M=new S([]),V=await Y._def.args.parseAsync(B,J).catch((u)=>{throw M.addIssue(Q(B,u)),M}),F=await Reflect.apply(G,this,V);return await Y._def.returns._def.type.parseAsync(F,J).catch((u)=>{throw M.addIssue(W(F,u)),M})})}else{let Y=this;return E(function(...B){let M=Y._def.args.safeParse(B,J);if(!M.success)throw new S([Q(B,M.error)]);let V=Reflect.apply(G,this,M.data),F=Y._def.returns.safeParse(V,J);if(!F.success)throw new S([W(V,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new J0({...this._def,args:x.create($).rest(p.create())})}returns($){return new J0({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Q){return new J0({args:$?$:x.create([]).rest(p.create()),returns:X||p.create(),typeName:L.ZodFunction,...U(Q)})}}class z0 extends D{get schema(){return this._def.getter()}_parse($){let{ctx:X}=this._processInputParams($);return this._def.getter()._parse({data:X.data,path:X.path,parent:X})}}z0.create=($,X)=>{return new z0({getter:$,typeName:L.ZodLazy,...U(X)})};class w0 extends D{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return z(X,{received:X.data,code:q.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:$.data}}get value(){return this._def.value}}w0.create=($,X)=>{return new w0({value:$,typeName:L.ZodLiteral,...U(X)})};function N1($,X){return new d({values:$,typeName:L.ZodEnum,...U(X)})}class d extends D{constructor(){super(...arguments);U0.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Q=this._def.values;return z(X,{expected:K.joinValues(Q),received:X.parsedType,code:q.invalid_type}),R}if(!T0(this,U0,"f"))U1(this,U0,new Set(this._def.values),"f");if(!T0(this,U0,"f").has($.data)){let X=this._getOrReturnCtx($),Q=this._def.values;return z(X,{received:X.data,code:q.invalid_enum_value,options:Q}),R}return E($.data)}get options(){return this._def.values}get enum(){let $={};for(let X of this._def.values)$[X]=X;return $}get Values(){let $={};for(let X of this._def.values)$[X]=X;return $}get Enum(){let $={};for(let X of this._def.values)$[X]=X;return $}extract($,X=this._def){return d.create($,{...this._def,...X})}exclude($,X=this._def){return d.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...X})}}U0=new WeakMap;d.create=N1;class V0 extends D{constructor(){super(...arguments);D0.set(this,void 0)}_parse($){let X=K.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==w.string&&Q.parsedType!==w.number){let W=K.objectValues(X);return z(Q,{expected:K.joinValues(W),received:Q.parsedType,code:q.invalid_type}),R}if(!T0(this,D0,"f"))U1(this,D0,new Set(K.getValidEnumValues(this._def.values)),"f");if(!T0(this,D0,"f").has($.data)){let W=K.objectValues(X);return z(Q,{received:Q.data,code:q.invalid_enum_value,options:W}),R}return E($.data)}get enum(){return this._def.values}}D0=new WeakMap;V0.create=($,X)=>{return new V0({values:$,typeName:L.ZodNativeEnum,...U(X)})};class e extends D{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==w.promise&&X.common.async===!1)return z(X,{code:q.invalid_type,expected:w.promise,received:X.parsedType}),R;let Q=X.parsedType===w.promise?X.data:Promise.resolve(X.data);return E(Q.then((W)=>{return this._def.type.parseAsync(W,{path:X.path,errorMap:X.common.contextualErrorMap})}))}}e.create=($,X)=>{return new e({type:$,typeName:L.ZodPromise,...U(X)})};class C extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Q}=this._processInputParams($),W=this._def.effect||null,J={addIssue:(G)=>{if(z(Q,G),G.fatal)X.abort();else X.dirty()},get path(){return Q.path}};if(J.addIssue=J.addIssue.bind(J),W.type==="preprocess"){let G=W.transform(Q.data,J);if(Q.common.async)return Promise.resolve(G).then(async(Y)=>{if(X.value==="aborted")return R;let B=await this._def.schema._parseAsync({data:Y,path:Q.path,parent:Q});if(B.status==="aborted")return R;if(B.status==="dirty")return W0(B.value);if(X.value==="dirty")return W0(B.value);return B});else{if(X.value==="aborted")return R;let Y=this._def.schema._parseSync({data:G,path:Q.path,parent:Q});if(Y.status==="aborted")return R;if(Y.status==="dirty")return W0(Y.value);if(X.value==="dirty")return W0(Y.value);return Y}}if(W.type==="refinement"){let G=(Y)=>{let B=W.refinement(Y,J);if(Q.common.async)return Promise.resolve(B);if(B instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(Q.common.async===!1){let Y=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return R;if(Y.status==="dirty")X.dirty();return G(Y.value),{status:X.value,value:Y.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((Y)=>{if(Y.status==="aborted")return R;if(Y.status==="dirty")X.dirty();return G(Y.value).then(()=>{return{status:X.value,value:Y.value}})})}if(W.type==="transform")if(Q.common.async===!1){let G=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!o(G))return G;let Y=W.transform(G.value,J);if(Y instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:Y}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((G)=>{if(!o(G))return G;return Promise.resolve(W.transform(G.value,J)).then((Y)=>({status:X.value,value:Y}))});K.assertNever(W)}}C.create=($,X,Q)=>{return new C({schema:$,typeName:L.ZodEffects,effect:X,...U(Q)})};C.createWithPreprocess=($,X,Q)=>{return new C({schema:X,effect:{type:"preprocess",transform:$},typeName:L.ZodEffects,...U(Q)})};class I extends D{_parse($){if(this._getType($)===w.undefined)return E(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}I.create=($,X)=>{return new I({innerType:$,typeName:L.ZodOptional,...U(X)})};class c extends D{_parse($){if(this._getType($)===w.null)return E(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}c.create=($,X)=>{return new c({innerType:$,typeName:L.ZodNullable,...U(X)})};class A0 extends D{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;if(X.parsedType===w.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:X.path,parent:X})}removeDefault(){return this._def.innerType}}A0.create=($,X)=>{return new A0({innerType:$,typeName:L.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...U(X)})};class O0 extends D{_parse($){let{ctx:X}=this._processInputParams($),Q={...X,common:{...X.common,issues:[]}},W=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(K0(W))return W.then((J)=>{return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new S(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new S(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}O0.create=($,X)=>{return new O0({innerType:$,typeName:L.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...U(X)})};class _0 extends D{_parse($){if(this._getType($)!==w.nan){let Q=this._getOrReturnCtx($);return z(Q,{code:q.invalid_type,expected:w.nan,received:Q.parsedType}),R}return{status:"valid",value:$.data}}}_0.create=($)=>{return new _0({typeName:L.ZodNaN,...U($)})};var V2=Symbol("zod_brand");class g0 extends D{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;return this._def.type._parse({data:Q,path:X.path,parent:X})}unwrap(){return this._def.type}}class S0 extends D{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let J=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(J.status==="aborted")return R;if(J.status==="dirty")return X.dirty(),W0(J.value);else return this._def.out._parseAsync({data:J.value,path:Q.path,parent:Q})})();else{let W=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(W.status==="aborted")return R;if(W.status==="dirty")return X.dirty(),{status:"dirty",value:W.value};else return this._def.out._parseSync({data:W.value,path:Q.path,parent:Q})}}static create($,X){return new S0({in:$,out:X,typeName:L.ZodPipeline})}}class L0 extends D{_parse($){let X=this._def.innerType._parse($),Q=(W)=>{if(o(W))W.value=Object.freeze(W.value);return W};return K0(X)?X.then((W)=>Q(W)):Q(X)}unwrap(){return this._def.innerType}}L0.create=($,X)=>{return new L0({innerType:$,typeName:L.ZodReadonly,...U(X)})};function O1($,X){let Q=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function j1($,X={},Q){if($)return s.create().superRefine((W,J)=>{var G,Y;let B=$(W);if(B instanceof Promise)return B.then((M)=>{var V,F;if(!M){let _=O1(X,W),u=(F=(V=_.fatal)!==null&&V!==void 0?V:Q)!==null&&F!==void 0?F:!0;J.addIssue({code:"custom",..._,fatal:u})}});if(!B){let M=O1(X,W),V=(Y=(G=M.fatal)!==null&&G!==void 0?G:Q)!==null&&Y!==void 0?Y:!0;J.addIssue({code:"custom",...M,fatal:V})}return});return s.create()}var A2={object:N.lazycreate},L;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(L||(L={}));var O2=($,X={message:`Input not instance of ${$.name}`})=>j1((Q)=>Q instanceof $,X),E1=f.create,_1=n.create,L2=_0.create,R2=i.create,S1=G0.create,U2=a.create,D2=F0.create,K2=Y0.create,F2=B0.create,N2=s.create,j2=p.create,E2=g.create,_2=N0.create,S2=k.create,$0=N.create,v2=N.strictCreate,b2=q0.create,C2=h0.create,f2=M0.create,k2=x.create,I2=j0.create,P2=E0.create,T2=t.create,h2=J0.create,g2=z0.create,x2=w0.create,y2=d.create,m2=V0.create,l2=e.create,L1=C.create,Z2=I.create,c2=c.create,u2=C.createWithPreprocess,p2=S0.create,n2=()=>E1().optional(),i2=()=>_1().optional(),d2=()=>S1().optional(),r2={string:($)=>f.create({...$,coerce:!0}),number:($)=>n.create({...$,coerce:!0}),boolean:($)=>G0.create({...$,coerce:!0}),bigint:($)=>i.create({...$,coerce:!0}),date:($)=>a.create({...$,coerce:!0})},o2=R,H=Object.freeze({__proto__:null,defaultErrorMap:H0,setErrorMap:p1,getErrorMap:I0,makeIssue:P0,EMPTY_PATH:n1,addIssueToContext:z,ParseStatus:j,INVALID:R,DIRTY:W0,OK:E,isAborted:a0,isDirty:s0,isValid:o,isAsync:K0,get util(){return K},get objectUtil(){return o0},ZodParsedType:w,getParsedType:Z,ZodType:D,datetimeRegex:F1,ZodString:f,ZodNumber:n,ZodBigInt:i,ZodBoolean:G0,ZodDate:a,ZodSymbol:F0,ZodUndefined:Y0,ZodNull:B0,ZodAny:s,ZodUnknown:p,ZodNever:g,ZodVoid:N0,ZodArray:k,ZodObject:N,ZodUnion:q0,ZodDiscriminatedUnion:h0,ZodIntersection:M0,ZodTuple:x,ZodRecord:j0,ZodMap:E0,ZodSet:t,ZodFunction:J0,ZodLazy:z0,ZodLiteral:w0,ZodEnum:d,ZodNativeEnum:V0,ZodPromise:e,ZodEffects:C,ZodTransformer:C,ZodOptional:I,ZodNullable:c,ZodDefault:A0,ZodCatch:O0,ZodNaN:_0,BRAND:V2,ZodBranded:g0,ZodPipeline:S0,ZodReadonly:L0,custom:j1,Schema:D,ZodSchema:D,late:A2,get ZodFirstPartyTypeKind(){return L},coerce:r2,any:N2,array:S2,bigint:R2,boolean:S1,date:U2,discriminatedUnion:C2,effect:L1,enum:y2,function:h2,instanceof:O2,intersection:f2,lazy:g2,literal:x2,map:P2,nan:L2,nativeEnum:m2,never:E2,null:F2,nullable:c2,number:_1,object:$0,oboolean:d2,onumber:i2,optional:Z2,ostring:n2,pipeline:p2,preprocess:u2,promise:l2,record:I2,set:T2,strictObject:v2,string:E1,symbol:D2,transformer:L1,tuple:k2,undefined:K2,union:b2,unknown:j2,void:_2,NEVER:o2,ZodIssueCode:q,quotelessJson:u1,ZodError:S});var e0="2024-11-05",v1=[e0,"2024-10-07"],x0="2.0",b1=H.union([H.string(),H.number().int()]),C1=H.string(),T=H.object({_meta:H.optional(H.object({progressToken:H.optional(b1)}).passthrough())}).passthrough(),v=H.object({method:H.string(),params:H.optional(T)}),v0=H.object({_meta:H.optional(H.object({}).passthrough())}).passthrough(),y=H.object({method:H.string(),params:H.optional(v0)}),h=H.object({_meta:H.optional(H.object({}).passthrough())}).passthrough(),y0=H.union([H.string(),H.number().int()]),a2=H.object({jsonrpc:H.literal(x0),id:y0}).merge(v).strict(),s2=H.object({jsonrpc:H.literal(x0)}).merge(y).strict(),t2=H.object({jsonrpc:H.literal(x0),id:y0,result:h}).strict(),X0;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(X0||(X0={}));var e2=H.object({jsonrpc:H.literal(x0),id:y0,error:H.object({code:H.number().int(),message:H.string(),data:H.optional(H.unknown())})}).strict(),f1=H.union([a2,s2,t2,e2]),m0=h.strict(),l0=y.extend({method:H.literal("notifications/cancelled"),params:v0.extend({requestId:y0,reason:H.string().optional()})}),k1=H.object({name:H.string(),version:H.string()}).passthrough(),$9=H.object({experimental:H.optional(H.object({}).passthrough()),sampling:H.optional(H.object({}).passthrough()),roots:H.optional(H.object({listChanged:H.optional(H.boolean())}).passthrough())}).passthrough(),$1=v.extend({method:H.literal("initialize"),params:T.extend({protocolVersion:H.string(),capabilities:$9,clientInfo:k1})}),X9=H.object({experimental:H.optional(H.object({}).passthrough()),logging:H.optional(H.object({}).passthrough()),prompts:H.optional(H.object({listChanged:H.optional(H.boolean())}).passthrough()),resources:H.optional(H.object({subscribe:H.optional(H.boolean()),listChanged:H.optional(H.boolean())}).passthrough()),tools:H.optional(H.object({listChanged:H.optional(H.boolean())}).passthrough())}).passthrough(),Q9=h.extend({protocolVersion:H.string(),capabilities:X9,serverInfo:k1,instructions:H.optional(H.string())}),X1=y.extend({method:H.literal("notifications/initialized")}),Z0=v.extend({method:H.literal("ping")}),W9=H.object({progress:H.number(),total:H.optional(H.number())}).passthrough(),c0=y.extend({method:H.literal("notifications/progress"),params:v0.merge(W9).extend({progressToken:b1})}),u0=v.extend({params:T.extend({cursor:H.optional(C1)}).optional()}),p0=h.extend({nextCursor:H.optional(C1)}),I1=H.object({uri:H.string(),mimeType:H.optional(H.string())}).passthrough(),P1=I1.extend({text:H.string()}),T1=I1.extend({blob:H.string().base64()}),J9=H.object({uri:H.string(),name:H.string(),description:H.optional(H.string()),mimeType:H.optional(H.string())}).passthrough(),H9=H.object({uriTemplate:H.string(),name:H.string(),description:H.optional(H.string()),mimeType:H.optional(H.string())}).passthrough(),G9=u0.extend({method:H.literal("resources/list")}),Y9=p0.extend({resources:H.array(J9)}),B9=u0.extend({method:H.literal("resources/templates/list")}),q9=p0.extend({resourceTemplates:H.array(H9)}),M9=v.extend({method:H.literal("resources/read"),params:T.extend({uri:H.string()})}),z9=h.extend({contents:H.array(H.union([P1,T1]))}),w9=y.extend({method:H.literal("notifications/resources/list_changed")}),V9=v.extend({method:H.literal("resources/subscribe"),params:T.extend({uri:H.string()})}),A9=v.extend({method:H.literal("resources/unsubscribe"),params:T.extend({uri:H.string()})}),O9=y.extend({method:H.literal("notifications/resources/updated"),params:v0.extend({uri:H.string()})}),L9=H.object({name:H.string(),description:H.optional(H.string()),required:H.optional(H.boolean())}).passthrough(),R9=H.object({name:H.string(),description:H.optional(H.string()),arguments:H.optional(H.array(L9))}).passthrough(),U9=u0.extend({method:H.literal("prompts/list")}),D9=p0.extend({prompts:H.array(R9)}),K9=v.extend({method:H.literal("prompts/get"),params:T.extend({name:H.string(),arguments:H.optional(H.record(H.string()))})}),n0=H.object({type:H.literal("text"),text:H.string()}).passthrough(),i0=H.object({type:H.literal("image"),data:H.string().base64(),mimeType:H.string()}).passthrough(),h1=H.object({type:H.literal("resource"),resource:H.union([P1,T1])}).passthrough(),F9=H.object({role:H.enum(["user","assistant"]),content:H.union([n0,i0,h1])}).passthrough(),N9=h.extend({description:H.optional(H.string()),messages:H.array(F9)}),j9=y.extend({method:H.literal("notifications/prompts/list_changed")}),E9=H.object({name:H.string(),description:H.optional(H.string()),inputSchema:H.object({type:H.literal("object"),properties:H.optional(H.object({}).passthrough())}).passthrough()}).passthrough(),Q1=u0.extend({method:H.literal("tools/list")}),_9=p0.extend({tools:H.array(E9)}),g1=h.extend({content:H.array(H.union([n0,i0,h1])),isError:H.boolean().default(!1).optional()}),J$=g1.or(h.extend({toolResult:H.unknown()})),W1=v.extend({method:H.literal("tools/call"),params:T.extend({name:H.string(),arguments:H.optional(H.record(H.unknown()))})}),S9=y.extend({method:H.literal("notifications/tools/list_changed")}),x1=H.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),v9=v.extend({method:H.literal("logging/setLevel"),params:T.extend({level:x1})}),b9=y.extend({method:H.literal("notifications/message"),params:v0.extend({level:x1,logger:H.optional(H.string()),data:H.unknown()})}),C9=H.object({name:H.string().optional()}).passthrough(),f9=H.object({hints:H.optional(H.array(C9)),costPriority:H.optional(H.number().min(0).max(1)),speedPriority:H.optional(H.number().min(0).max(1)),intelligencePriority:H.optional(H.number().min(0).max(1))}).passthrough(),k9=H.object({role:H.enum(["user","assistant"]),content:H.union([n0,i0])}).passthrough(),I9=v.extend({method:H.literal("sampling/createMessage"),params:T.extend({messages:H.array(k9),systemPrompt:H.optional(H.string()),includeContext:H.optional(H.enum(["none","thisServer","allServers"])),temperature:H.optional(H.number()),maxTokens:H.number().int(),stopSequences:H.optional(H.array(H.string())),metadata:H.optional(H.object({}).passthrough()),modelPreferences:H.optional(f9)})}),J1=h.extend({model:H.string(),stopReason:H.optional(H.enum(["endTurn","stopSequence","maxTokens"]).or(H.string())),role:H.enum(["user","assistant"]),content:H.discriminatedUnion("type",[n0,i0])}),P9=H.object({type:H.literal("ref/resource"),uri:H.string()}).passthrough(),T9=H.object({type:H.literal("ref/prompt"),name:H.string()}).passthrough(),h9=v.extend({method:H.literal("completion/complete"),params:T.extend({ref:H.union([T9,P9]),argument:H.object({name:H.string(),value:H.string()}).passthrough()})}),g9=h.extend({completion:H.object({values:H.array(H.string()).max(100),total:H.optional(H.number().int()),hasMore:H.optional(H.boolean())}).passthrough()}),x9=H.object({uri:H.string().startsWith("file://"),name:H.optional(H.string())}).passthrough(),y9=v.extend({method:H.literal("roots/list")}),H1=h.extend({roots:H.array(x9)}),m9=y.extend({method:H.literal("notifications/roots/list_changed")}),H$=H.union([Z0,$1,h9,v9,K9,U9,G9,B9,M9,V9,A9,W1,Q1]),G$=H.union([l0,c0,X1,m9]),Y$=H.union([m0,J1,H1]),B$=H.union([Z0,I9,y9]),q$=H.union([l0,c0,b9,O9,w9,S9,j9]),M$=H.union([m0,Q9,g9,N9,D9,Y9,q9,z9,g1,_9]);class b0 extends Error{constructor($,X,Q){super(`MCP error ${$}: ${X}`);this.code=$,this.data=Q}}var l9=60000;class G1{constructor($){this._options=$,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(l0,(X)=>{let Q=this._requestHandlerAbortControllers.get(X.params.requestId);Q===null||Q===void 0||Q.abort(X.params.reason)}),this.setNotificationHandler(c0,(X)=>{this._onprogress(X)}),this.setRequestHandler(Z0,(X)=>({}))}async connect($){this._transport=$,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(X)=>{this._onerror(X)},this._transport.onmessage=(X)=>{if(!("method"in X))this._onresponse(X);else if("id"in X)this._onrequest(X);else this._onnotification(X)},await this._transport.start()}_onclose(){var $;let X=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,($=this.onclose)===null||$===void 0||$.call(this);let Q=new b0(X0.ConnectionClosed,"Connection closed");for(let W of X.values())W(Q)}_onerror($){var X;(X=this.onerror)===null||X===void 0||X.call(this,$)}_onnotification($){var X;let Q=(X=this._notificationHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackNotificationHandler;if(Q===void 0)return;Promise.resolve().then(()=>Q($)).catch((W)=>this._onerror(new Error(`Uncaught error in notification handler: ${W}`)))}_onrequest($){var X,Q;let W=(X=this._requestHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackRequestHandler;if(W===void 0){(Q=this._transport)===null||Q===void 0||Q.send({jsonrpc:"2.0",id:$.id,error:{code:X0.MethodNotFound,message:"Method not found"}}).catch((G)=>this._onerror(new Error(`Failed to send an error response: ${G}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set($.id,J),Promise.resolve().then(()=>W($,{signal:J.signal})).then((G)=>{var Y;if(J.signal.aborted)return;return(Y=this._transport)===null||Y===void 0?void 0:Y.send({result:G,jsonrpc:"2.0",id:$.id})},(G)=>{var Y,B;if(J.signal.aborted)return;return(Y=this._transport)===null||Y===void 0?void 0:Y.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(G.code)?G.code:X0.InternalError,message:(B=G.message)!==null&&B!==void 0?B:"Internal error"}})}).catch((G)=>this._onerror(new Error(`Failed to send response: ${G}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:X,...Q}=$.params,W=this._progressHandlers.get(Number(X));if(W===void 0){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}W(Q)}_onresponse($){let X=$.id,Q=this._responseHandlers.get(Number(X));if(Q===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}if(this._responseHandlers.delete(Number(X)),this._progressHandlers.delete(Number(X)),"result"in $)Q($);else{let W=new b0($.error.code,$.error.message,$.error.data);Q(W)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,X,Q){return new Promise((W,J)=>{var G,Y,B,M;if(!this._transport){J(new Error("Not connected"));return}if(((G=this._options)===null||G===void 0?void 0:G.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(Y=Q===null||Q===void 0?void 0:Q.signal)===null||Y===void 0||Y.throwIfAborted();let V=this._requestMessageId++,F={...$,jsonrpc:"2.0",id:V};if(Q===null||Q===void 0?void 0:Q.onprogress)this._progressHandlers.set(V,Q.onprogress),F.params={...$.params,_meta:{progressToken:V}};let _=void 0;this._responseHandlers.set(V,(b)=>{var r;if(_!==void 0)clearTimeout(_);if((r=Q===null||Q===void 0?void 0:Q.signal)===null||r===void 0?void 0:r.aborted)return;if(b instanceof Error)return J(b);try{let R0=X.parse(b.result);W(R0)}catch(R0){J(R0)}});let u=(b)=>{var r;this._responseHandlers.delete(V),this._progressHandlers.delete(V),(r=this._transport)===null||r===void 0||r.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:V,reason:String(b)}}).catch((R0)=>this._onerror(new Error(`Failed to send cancellation: ${R0}`))),J(b)};(B=Q===null||Q===void 0?void 0:Q.signal)===null||B===void 0||B.addEventListener("abort",()=>{var b;if(_!==void 0)clearTimeout(_);u((b=Q===null||Q===void 0?void 0:Q.signal)===null||b===void 0?void 0:b.reason)});let V1=(M=Q===null||Q===void 0?void 0:Q.timeout)!==null&&M!==void 0?M:l9;_=setTimeout(()=>u(new b0(X0.RequestTimeout,"Request timed out",{timeout:V1})),V1),this._transport.send(F).catch((b)=>{if(_!==void 0)clearTimeout(_);J(b)})})}async notification($){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability($.method);let X={...$,jsonrpc:"2.0"};await this._transport.send(X)}setRequestHandler($,X){let Q=$.shape.method.value;this.assertRequestHandlerCapability(Q),this._requestHandlers.set(Q,(W,J)=>Promise.resolve(X($.parse(W),J)))}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw new Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,X){this._notificationHandlers.set($.shape.method.value,(Q)=>Promise.resolve(X($.parse(Q))))}removeNotificationHandler($){this._notificationHandlers.delete($)}}function y1($,X){return Object.entries(X).reduce((Q,[W,J])=>{if(J&&typeof J==="object")Q[W]=Q[W]?{...Q[W],...J}:J;else Q[W]=J;return Q},{...$})}class Y1 extends G1{constructor($,X){var Q;super(X);this._serverInfo=$,this._capabilities=(Q=X===null||X===void 0?void 0:X.capabilities)!==null&&Q!==void 0?Q:{},this._instructions=X===null||X===void 0?void 0:X.instructions,this.setRequestHandler($1,(W)=>this._oninitialize(W)),this.setNotificationHandler(X1,()=>{var W;return(W=this.oninitialized)===null||W===void 0?void 0:W.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=y1(this._capabilities,$)}assertCapabilityForMethod($){var X,Q;switch($){case"sampling/createMessage":if(!((X=this._clientCapabilities)===null||X===void 0?void 0:X.sampling))throw new Error(`Client does not support sampling (required for ${$})`);break;case"roots/list":if(!((Q=this._clientCapabilities)===null||Q===void 0?void 0:Q.roots))throw new Error(`Client does not support listing roots (required for ${$})`);break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${$})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${$})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${$})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${$})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${$})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${$})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${$})`);break;case"ping":case"initialize":break}}async _oninitialize($){let X=$.params.protocolVersion;return this._clientCapabilities=$.params.capabilities,this._clientVersion=$.params.clientInfo,{protocolVersion:v1.includes(X)?X:e0,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},m0)}async createMessage($,X){return this.request({method:"sampling/createMessage",params:$},J1,X)}async listRoots($,X){return this.request({method:"roots/list",params:$},H1,X)}async sendLoggingMessage($){return this.notification({method:"notifications/message",params:$})}async sendResourceUpdated($){return this.notification({method:"notifications/resources/updated",params:$})}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"})}}import l1 from"node:process";class B1{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
3
+ `);if($===-1)return null;let X=this._buffer.toString("utf8",0,$);return this._buffer=this._buffer.subarray($+1),Z9(X)}clear(){this._buffer=void 0}}function Z9($){return f1.parse(JSON.parse($))}function m1($){return JSON.stringify($)+`
4
+ `}class q1{constructor($=l1.stdin,X=l1.stdout){this._stdin=$,this._stdout=X,this._readBuffer=new B1,this._started=!1,this._ondata=(Q)=>{this._readBuffer.append(Q),this.processReadBuffer()},this._onerror=(Q)=>{var W;(W=this.onerror)===null||W===void 0||W.call(this,Q)}}async start(){if(this._started)throw new 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(){var $,X;while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;($=this.onmessage)===null||$===void 0||$.call(this,Q)}catch(Q){(X=this.onerror)===null||X===void 0||X.call(this,Q)}}async close(){var $;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),($=this.onclose)===null||$===void 0||$.call(this)}send($){return new Promise((X)=>{let Q=m1($);if(this._stdout.write(Q))X();else this._stdout.once("drain",X)})}}import{join as n9}from"path";import{readFile as i9,access as d9,constants as r9}from"fs/promises";import{join as f0}from"path";import{join as u9}from"path";import{readdir as c1,readFile as p9}from"fs/promises";import d0 from"pino";import c9 from"os";var Z1=process.env.LOG_FILE_PATH||(process.env.HOME?`${process.env.HOME}/.specifai/mcp-log.log`:void 0),M1={level:process.env.LOG_LEVEL||"info",base:{version:"0.4.0",pid:process.pid,hostname:c9.hostname()}},O;if(Z1)try{let $={target:"pino/file",options:{destination:Z1,append:!0,sync:!1,mkdir:!0,silent:!0},worker:{autoEnd:!1}};O=d0(M1,d0.transport($))}catch($){O=d0({...M1,enabled:!1})}else O=d0({...M1,enabled:!1});class C0{async readAllJsonFiles($){try{let Q=(await c1($)).filter((J)=>J.endsWith(".json"));return await Promise.all(Q.map(async(J)=>{let G=u9($,J),Y=await p9(G,"utf-8");try{return{name:J,content:JSON.parse(Y)}}catch(B){return O.error({error:B,file:J},`Error parsing JSON file ${J}`),{name:J,content:null,error:"Invalid JSON"}}}))}catch(X){return O.warn({error:X},"Directory not found, returning empty array"),[]}}async isDirectory($){try{let X=await c1($);return!0}catch{return!1}}}class z1{fileService;constructor(){this.fileService=new C0}normalize($){return O.debug({count:$.length},"Normalizing documents"),$.map((X)=>({id:X.name.replace(".json","").replace("-base",""),title:X.content.title,description:X.content.requirement}))}processPRDs($){return O.debug({count:$.length},"Processing PRD files"),$.map((X)=>{if(!X.name.includes("feature")){let Q=$.find((J)=>J.name===X.name.replace("base","feature"));if(!Q)return O.warn({basePrd:X.name},"No matching feature PRD found"),null;let W=Q.content.features.map((J)=>({id:J.id,title:J.name,description:J.description,tasks:J.tasks.map((G)=>({id:G.id,title:G.list,description:G.acceptance}))}));return O.debug({prdId:X.name,userStoriesCount:W.length},"Processed PRD with user stories"),{id:X.name.replace(".json","").replace("-base",""),title:X.content.title,description:X.content.requirement,userStories:W}}return null}).filter((X)=>X!==null)}async loadSolution($){if(O.info({projectPath:$},"Loading solution"),!await this.fileService.isDirectory($))throw O.error({projectPath:$},"Invalid project path"),new Error(`Invalid project path: ${$}`);try{let[X,Q,W,J,G]=await Promise.all([this.fileService.readAllJsonFiles(f0($,"BP")),this.fileService.readAllJsonFiles(f0($,"BRD")),this.fileService.readAllJsonFiles(f0($,"PRD")),this.fileService.readAllJsonFiles(f0($,"NFR")),this.fileService.readAllJsonFiles(f0($,"UIR"))]),Y={BP:this.normalize(X),BRD:this.normalize(Q),PRD:this.processPRDs(W),NFR:this.normalize(J),UIR:this.normalize(G)};return O.info({bpsCount:Y.BP.length,brdsCount:Y.BRD.length,prdsCount:Y.PRD.length,nfrsCount:Y.NFR.length,uirsCount:Y.UIR.length},"Solution loaded successfully"),Y}catch(X){return O.warn({error:X,projectPath:$},"Some directories not found while loading solution"),{BP:[],BRD:[],PRD:[],NFR:[],UIR:[]}}}findPRD($,X){let Q=$.PRD.find((W)=>W.id===X)||null;if(!Q)O.debug({prdId:X},"PRD not found");return Q}findUserStory($,X){let Q=$.userStories.find((W)=>W.id===X)||null;if(!Q)O.debug({prdId:$.id,userStoryId:X},"User Story not found");return Q}findTask($,X){let Q=$.tasks?.find((W)=>W.id===X)||null;if(!Q)O.debug({userStoryId:$.id,taskId:X},"Task not found");return Q}}var o9=$0({prdId:H.string(),cwd:H.string()}),a9=$0({prdId:H.string(),userStoryId:H.string(),cwd:H.string()}),s9=$0({prdId:H.string(),userStoryId:H.string(),taskId:H.string(),cwd:H.string()}),k0=$0({cwd:H.string()});class w1{server;documentService;fileService;solution;projectPath;constructor($){this.solution=null,this.projectPath=$||null,this.documentService=new z1,this.fileService=new C0,this.server=new Y1({name:"specifai",version:"0.4.0"},{capabilities:{tools:{}}}),O.info("Initializing MCP server..."),this.setupRequestHandlers(),O.info("MCP server initialized")}formatDocuments($){return $.map((X)=>[`ID: ${X.id}`,`Title: ${X.title}`,`Description: ${X.description}`,"--------------"].join(`
5
+ `)).join(`
6
+ `)}async loadSolutionByAutoInference($){let X=await this.inferProjectPath($);if(X)this.projectPath=X,this.solution=await this.documentService.loadSolution(X),O.info({inferredPath:X},"Project path auto-inferred")}async inferProjectPath($){if(!$)return O.debug("No directory path provided for inference"),null;try{if(!await this.fileService.isDirectory($))return O.debug({directoryPath:$},"Directory does not exist"),null;let X=n9($,".specifai-path");try{await d9(X,r9.R_OK)}catch{return O.debug({specFilePath:X},".specifai-path file not found"),null}let W=(await i9(X,"utf-8")).trim();if(!await this.fileService.isDirectory(W))return O.warn({projectPath:W},"Project path from .specifai-path is not a valid directory"),null;return O.info({directoryPath:$,projectPath:W},"Successfully inferred project path"),W}catch(X){return O.error({error:X,directoryPath:$},"Error inferring project path"),null}}setupRequestHandlers(){this.setupListToolsHandler(),this.setupCallToolHandler()}setupListToolsHandler(){this.server.setRequestHandler(Q1,async()=>{return O.info("Handling list tools request"),{tools:[{name:"get-brds",description:"Get Business Requirement Documents for this project",inputSchema:{type:"object",properties:{cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}},required:["cwd"]}},{name:"get-prds",description:"Get Product Requirement Documents for this project",inputSchema:{type:"object",properties:{cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}},required:["cwd"]}},{name:"get-nfrs",description:"Get Non-Functional Requirement Documents for this project",inputSchema:{type:"object",properties:{cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}},required:["cwd"]}},{name:"get-uirs",description:"Get User Interface Requirement Documents for this project",inputSchema:{type:"object",properties:{cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}},required:["cwd"]}},{name:"get-bpds",description:"Get Business Process Documents for this project",inputSchema:{type:"object",properties:{cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}},required:["cwd"]}},{name:"get-user-stories",description:"Get User Stories for a particular PRD",inputSchema:{type:"object",required:["prdId","cwd"],properties:{prdId:{type:"string",description:"The ID of the PRD to get user stories for"},cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}}}},{name:"get-tasks",description:"Get Tasks for a particular User Story",inputSchema:{type:"object",required:["prdId","userStoryId","cwd"],properties:{prdId:{type:"string",description:"The ID of the PRD to get user stories for"},userStoryId:{type:"string",description:"The ID of the User Story to get tasks for"},cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}}}},{name:"get-task",description:"Get a Task for a particular User Story in a particular PRD",inputSchema:{type:"object",required:["prdId","userStoryId","taskId","cwd"],properties:{prdId:{type:"string",description:"The ID of the PRD to get user stories for"},userStoryId:{type:"string",description:"The ID of the User Story to get tasks for"},taskId:{type:"string",description:"The ID of the Task to get"},cwd:{type:"string",description:"Absolute path where the tool is called from and containing the `.specifai-path` file to auto-infer the specifai project path. This path will be current working directory (cwd) from where the tool is called."}}}},{name:"set-project-path",description:"Update the project path and reload the solution. use this tool only when we not automatically able to infer the project path or asked by the user or us., we will try to auto infer it from the environment first.",inputSchema:{type:"object",required:["path"],properties:{path:{type:"string",description:"The absolute path to a directory containing specifai specification files."}}}}]}})}setupCallToolHandler(){if(this.projectPath)O.info({projectPath:this.projectPath},"Project path is found from process.env.PWD"),this.inferProjectPath(this.projectPath).then(($)=>{if($)O.info({inferredPath:$},"Project path auto-inferred"),this.projectPath=$,this.documentService.loadSolution($).then((X)=>{this.solution=X,O.info("Solution loaded from auto-inferred project path")})});this.server.setRequestHandler(W1,async($)=>{let{name:X,arguments:Q}=$.params;O.info({tool:X,args:Q},"Handling tool call");try{switch(X){case"set-project-path":{let{path:W}=$0({path:H.string()}).parse(Q);return this.projectPath=W,this.solution=await this.documentService.loadSolution(W),this.createTextResponse(`Project path set to: ${W}`)}case"get-brds":{let{cwd:W}=k0.parse(Q);if(W)await this.loadSolutionByAutoInference(W);if(!this.solution||!W)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");return this.createTextResponse(this.formatDocuments(this.solution.BRD))}case"get-prds":{let{cwd:W}=k0.parse(Q);if(W)await this.loadSolutionByAutoInference(W);if(!this.solution||!W)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");return this.createTextResponse(this.formatDocuments(this.solution.PRD))}case"get-nfrs":{let{cwd:W}=k0.parse(Q);if(W)await this.loadSolutionByAutoInference(W);if(!this.solution||!W)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");return this.createTextResponse(this.formatDocuments(this.solution.NFR))}case"get-uirs":{let{cwd:W}=k0.parse(Q);if(W)await this.loadSolutionByAutoInference(W);if(!this.solution||!W)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");return this.createTextResponse(this.formatDocuments(this.solution.UIR))}case"get-bpds":{let{cwd:W}=k0.parse(Q);if(W)await this.loadSolutionByAutoInference(W);if(!this.solution||!W)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");return this.createTextResponse(this.formatDocuments(this.solution.BP))}case"get-user-stories":{let{prdId:W,cwd:J}=o9.parse(Q);if(J)await this.loadSolutionByAutoInference(J);if(!this.solution||!J)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");let G=this.documentService.findPRD(this.solution,W);if(!G)return O.warn({prdId:W},"PRD not found"),this.createTextResponse(`No PRD found with ID ${W}`);return this.createTextResponse(this.formatDocuments(G.userStories))}case"get-tasks":{let{prdId:W,userStoryId:J,cwd:G}=a9.parse(Q);if(G)await this.loadSolutionByAutoInference(G);if(!this.solution||!G)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");let Y=this.documentService.findPRD(this.solution,W);if(!Y)return O.warn({prdId:W},"PRD not found"),this.createTextResponse(`No PRD found with ID ${W}`);let B=this.documentService.findUserStory(Y,J);if(!B)return O.warn({prdId:W,userStoryId:J},"User Story not found"),this.createTextResponse(`No User Story found with ID ${J}`);return this.createTextResponse(this.formatDocuments(B.tasks))}case"get-task":{let{prdId:W,userStoryId:J,taskId:G,cwd:Y}=s9.parse(Q);if(Y)await this.loadSolutionByAutoInference(Y);if(!this.solution||!Y)throw new Error("No project path set. Use set-project-path first or provide a valid cwd to auto-infer.");let B=this.documentService.findPRD(this.solution,W);if(!B)return O.warn({prdId:W},"PRD not found"),this.createTextResponse(`No PRD found with ID ${W}`);let M=this.documentService.findUserStory(B,J);if(!M)return O.warn({prdId:W,userStoryId:J},"User Story not found"),this.createTextResponse(`No User Story found with ID ${J}`);let V=this.documentService.findTask(M,G);if(!V)return O.warn({prdId:W,userStoryId:J,taskId:G},"Task not found"),this.createTextResponse(`No Task found with ID ${G}`);return this.createTextResponse([`ID: ${V.id}`,`Title: ${V.title}`,`Description: ${V.description}`].join(`
7
+ `))}default:throw O.warn({tool:X},"Unknown tool called"),new Error(`Unknown tool: ${X}`)}}catch(W){if(W instanceof H.ZodError){let J=`Invalid arguments: ${W.errors.map((G)=>`${G.path.join(".")}: ${G.message}`).join(", ")}`;throw O.error({error:W.errors,tool:X},J),new Error(J)}throw O.error({error:W,tool:X},"Error handling tool call"),W}})}createTextResponse($){return{content:[{type:"text",text:$}]}}async start(){O.info("Starting MCP server...");let $=new q1;await this.server.connect($),O.info("MCP server started successfully")}}var m={name:"@presidio-dev/specifai-mcp-server",version:"0.3.0",description:"Specifai MCP Server that runs over stdio",type:"module",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/presidio-oss/specifai-mcp-server.git"},keywords:["specifai","mcp","model-context-protocol","cli","stdio","server"],author:"Presidio",module:"dist/index.js",main:"dist/index.js",bin:{"specifai-mcp-server":"dist/index.js"},files:["dist","README.md"],engines:{node:">=16.0.0",bun:">=1.0.0"},scripts:{test:"jest --coverage","test:watch":"jest --watch",build:"./build.sh","build:npm":"./build-npm.sh",prepublishOnly:"bun run build:npm",prepare:"husky",format:"prettier --write .","format:check":"prettier --check .",release:"release-it","release:dry-run":"release-it --dry-run","release:ci":"release-it --ci"},devDependencies:{"@commitlint/cli":"^19.7.1","@commitlint/config-conventional":"^19.7.1","@jest/globals":"^29.7.0","@release-it/conventional-changelog":"^10.0.0","@types/bun":"latest","@types/jest":"^29.5.14",husky:"^9.1.7",jest:"^29.7.0",prettier:"^3.5.1","release-it":"^18.1.2","ts-jest":"^29.2.5"},peerDependencies:{typescript:"^5.0.0"},dependencies:{"@modelcontextprotocol/sdk":"^1.5.0",pino:"^9.6.0",zod:"^3.24.2"},jest:{preset:"ts-jest/presets/default-esm",testEnvironment:"node",extensionsToTreatAsEsm:[".ts"],moduleNameMapper:{"^(\\.{1,2}/.*)\\.js$":"$1"},transform:{"^.+\\.tsx?$":["ts-jest",{useESM:!0,tsconfig:"tsconfig.jest.json"}]},collectCoverageFrom:["src/services/**/*.ts","!src/services/**/*.test.ts","!src/services/**/*test-utils.ts"]}};function e9(){console.log("0.4.0")}function $$(){console.error(`
8
+ ${m.name} - v0.4.0
9
+
10
+ Usage: ${m.bin?Object.keys(m.bin)[0]:m.name}
11
+
12
+ Options:
13
+ -h, --help Display this help message
14
+ -v, --version Display version information
15
+
16
+ Example:
17
+ ${m.bin?Object.keys(m.bin)[0]:m.name}
18
+
19
+ npx --yes ${m.name}
20
+
21
+ bunx ${m.name}
22
+ `)}async function X$(){try{O.info({version:"0.4.0",pwd:process.env.PWD,...process.env},"Starting Specifai MCP Server");let $=process.argv.slice(2);if($[0]==="--help"||$[0]==="-h")$$(),process.exit($.length===0?1:0);if($[0]==="--version"||$[0]==="-v")e9(),process.exit(0);await new w1(process.env.PWD).start(),O.info("Specifai MCP Server running on stdio")}catch($){O.error({error:$ instanceof Error?$.message:String($)},"Fatal error"),process.exit(1)}}process.on("SIGINT",()=>{O.info("Received SIGINT. Shutting down..."),process.exit(0)});process.on("SIGTERM",()=>{O.info("Received SIGTERM. Shutting down..."),process.exit(0)});X$();
23
+
24
+ //# debugId=9B6F2473C99A4C0164756E2164756E21
25
+ //# sourceMappingURL=index.js.map