@likec4/mcp 1.32.2 → 1.34.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/.turbo/turbo-build.log +15 -20
- package/README.md +25 -0
- package/dist/index.mjs +3 -3
- package/package.json +9 -9
- package/src/index.ts +1 -59
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
|
|
2
|
-
> @likec4/mcp@1.
|
|
2
|
+
> @likec4/mcp@1.34.0 build /home/runner/work/likec4/likec4/packages/mcp
|
|
3
3
|
> wireit
|
|
4
4
|
|
|
5
5
|
Analyzing
|
|
6
|
+
0% [0 / 1] [1 running] build
|
|
6
7
|
[info] Automatically detected entries: src/index [esm]
|
|
7
8
|
[info] Building mcp
|
|
8
9
|
[info] Cleaning dist directory: `./dist`
|
|
9
|
-
../../node_modules/.pnpm/@mantine+colors-generator@8.1.0_chroma-js@3.1.2/node_modules/@mantine/colors-generator/esm/generate-colors.mjs (1:0): Module level directives cause errors when bundled, "use client" in "../../node_modules/.pnpm/@mantine+colors-generator@8.1.0_chroma-js@3.1.2/node_modules/@mantine/colors-generator/esm/generate-colors.mjs" was ignored.
|
|
10
10
|
[success] Build succeeded for mcp
|
|
11
|
-
[log] dist/index.mjs (total size:
|
|
12
|
-
📦 ../../node_modules/.pnpm/zod@3.25.
|
|
13
|
-
📦 ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
14
|
-
📦 ../../node_modules/.pnpm
|
|
15
|
-
📦 ../../node_modules/.pnpm/zod@3.25.
|
|
16
|
-
📦 ../../node_modules/.pnpm/zod@3.25.
|
|
17
|
-
📦 ../../node_modules/.pnpm/zod@3.25.
|
|
18
|
-
📦 ../../node_modules/.pnpm
|
|
19
|
-
📦 ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
20
|
-
📦 ../../node_modules/.pnpm
|
|
21
|
-
📦 ../../node_modules/.pnpm
|
|
22
|
-
|
|
23
|
-
📦 ../../node_modules/.pnpm/zod@3.25.64/node_modules/zod/dist/esm/v3/helpers/errorUtil.js (292 B)
|
|
24
|
-
📦 ../../node_modules/.pnpm/zod@3.25.64/node_modules/zod/dist/esm/v3/errors.js (88 B)
|
|
25
|
-
📦 ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.64/node_modules/zod-to-json-schema/dist/esm/parsers/string.js (72 B)
|
|
26
|
-
📦 ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-ENOHV5LT.js (42 B)
|
|
27
|
-
Σ Total dist size (byte size): 68.8 kB
|
|
11
|
+
[log] dist/index.mjs (total size: 64.2 kB, chunk size: 64.2 kB)
|
|
12
|
+
📦 ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/types.js (122 kB)
|
|
13
|
+
📦 ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.13.2/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js (42.9 kB)
|
|
14
|
+
📦 ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/locales/en.js (5.26 kB)
|
|
15
|
+
📦 ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/ZodError.js (4.12 kB)
|
|
16
|
+
📦 ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/helpers/util.js (4.03 kB)
|
|
17
|
+
📦 ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/helpers/parseUtil.js (3.39 kB)
|
|
18
|
+
📦 ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.13.2/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js (2.75 kB)
|
|
19
|
+
📦 ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.13.2/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js (821 B)
|
|
20
|
+
📦 ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/helpers/errorUtil.js (292 B)
|
|
21
|
+
📦 ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/errors.js (88 B)
|
|
22
|
+
Σ Total dist size (byte size): 64.2 kB
|
|
28
23
|
[log]
|
|
29
|
-
✅ Ran 1 script and skipped 0 in
|
|
24
|
+
✅ Ran 1 script and skipped 0 in 1.5s.
|
package/README.md
CHANGED
|
@@ -20,3 +20,28 @@
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
|
+
|
|
24
|
+
## Getting help
|
|
25
|
+
|
|
26
|
+
We are always happy to help you get started:
|
|
27
|
+
|
|
28
|
+
- [Join Discord community](https://discord.gg/86ZSpjKAdA) – it is the easiest way to get help
|
|
29
|
+
- [GitHub Discussions](https://github.com/likec4/likec4/discussions) – ask anything about the project or give feedback
|
|
30
|
+
|
|
31
|
+
## Contributors
|
|
32
|
+
|
|
33
|
+
<a href="https://github.com/likec4/likec4/graphs/contributors">
|
|
34
|
+
<img src="https://contrib.rocks/image?repo=likec4/likec4" />
|
|
35
|
+
</a>
|
|
36
|
+
|
|
37
|
+
[Become a contributor](../../CONTRIBUTING.md)
|
|
38
|
+
|
|
39
|
+
## Support development
|
|
40
|
+
|
|
41
|
+
LikeC4 is a MIT-licensed open source project with its ongoing development made possible entirely by your support.\
|
|
42
|
+
If you like the project, please consider contributing financially to help grow and improve it.\
|
|
43
|
+
You can support us via [OpenCollective](https://opencollective.com/likec4) or [GitHub Sponsors](https://github.com/sponsors/likec4).
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
This project is released under the [MIT License](LICENSE)
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import Me from"node:process";import{LikeC4 as mt}from"likec4";import{resolve as pt}from"node:path";function gt(r){return typeof r=="function"}function _t(r,e){if(!r)throw new Error("Invariant failed")}function yt(r,e){const t=e??r;_t(gt(t));function*s(n){for(const a of n)t(a)&&(yield a)}return e?s(r):s}var w;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const o of n)a[o]=o;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(const i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(const o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(w||(w={}));var Pe;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Pe||(Pe={}));const h=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}},c=w.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,d=0;for(;d<o.path.length;){const l=o.path[d];d===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],d++}}};return n(this),s}static assert(e){if(!(e instanceof z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}z.create=r=>new z(r);const be=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===h.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,w.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${w.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${w.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${w.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:w.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,w.assertNever(r)}return{message:t}};let vt=be;function xt(){return vt}const kt=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let i="";const d=s.filter(l=>!!l).slice().reverse();for(const l of d)i=l(o,{data:e,defaultError:i}).message;return{...n,path:a,message:i}};function u(r,e){const t=xt(),s=kt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===be?void 0:be].filter(n=>!!n)});r.common.issues.push(s)}class C{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return y;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,o=await n.value;s.push({key:a,value:o})}return C.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return y;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}}const y=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),A=r=>({status:"valid",value:r}),Le=r=>r.status==="aborted",$e=r=>r.status==="dirty",G=r=>r.status==="valid",re=r=>typeof Promise<"u"&&r instanceof Promise;var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));class M{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ve=(r,e)=>{if(G(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new z(r.common.issues);return this._error=t,this._error}}};function x(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{const{message:d}=r;return o.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??s??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:d??t??i.defaultError}},description:n}}class k{get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new C,ctx:{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Ve(s,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return G(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>G(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(re(n)?n:Promise.resolve(n));return Ve(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const o=e(n),i=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new W({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return V.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this)}promise(){return oe.create(this,this._def)}or(e){return ne.create([this,e],this._def)}and(e){return ae.create(this,e,this._def)}transform(e){return new W({...x(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ce({...x(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new He({typeName:v.ZodBranded,type:this,...x(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new de({...x(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ze.create(this,e)}readonly(){return ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const bt=/^c[^\s-]{8,}$/i,wt=/^[0-9a-z]+$/,St=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Tt=/^[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,Rt=/^[a-z0-9_-]{21}$/i,Ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nt=/^[-+]?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)?)??$/,Ot=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,At="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let we;const jt=/^(?:(?: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])$/,It=/^(?:(?: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])$/,Et=/^(([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]))$/,Zt=/^(([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])$/,Mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\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])))",Lt=new RegExp(`^${ze}$`);function qe(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function $t(r){return new RegExp(`^${qe(r)}$`)}function Vt(r){let e=`${ze}T${qe(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zt(r,e){return!!((e==="v4"||!e)&&jt.test(r)||(e==="v6"||!e)&&Et.test(r))}function qt(r,e){if(!Ct.test(r))return!1;try{const[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Dt(r,e){return!!((e==="v4"||!e)&&It.test(r)||(e==="v6"||!e)&&Zt.test(r))}class q extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:h.string,received:a.parsedType}),y}const s=new C;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?u(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&u(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")we||(we=new RegExp(At,"u")),we.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")bt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")wt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),u(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?$t(a).test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?zt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?qt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Dt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):w.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...m.errToObj(s)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}q.create=r=>new q({checks:[],typeName:v.ZodString,coerce:r?.coerce??!1,...x(r)});function Bt(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}class Q extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:h.number,received:a.parsedType}),y}let s;const n=new C;for(const a of this._def.checks)a.kind==="int"?w.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Bt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_finite,message:a.message}),n.dirty()):w.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&w.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Q.create=r=>new Q({checks:[],typeName:v.ZodNumber,coerce:r?.coerce||!1,...x(r)});class te extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let s;const n=new C;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),u(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):w.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:h.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,n){return new te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(n)}]})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}te.create=r=>new te({checks:[],typeName:v.ZodBigInt,coerce:r?.coerce??!1,...x(r)});class Se extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:h.boolean,received:s.parsedType}),y}return A(e.data)}}Se.create=r=>new Se({typeName:v.ZodBoolean,coerce:r?.coerce||!1,...x(r)});class ve extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_type,expected:h.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return u(a,{code:c.invalid_date}),y}const s=new C;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),u(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):w.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ve({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}ve.create=r=>new ve({checks:[],coerce:r?.coerce||!1,typeName:v.ZodDate,...x(r)});class De extends k{_parse(e){if(this._getType(e)!==h.symbol){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:h.symbol,received:s.parsedType}),y}return A(e.data)}}De.create=r=>new De({typeName:v.ZodSymbol,...x(r)});class Te extends k{_parse(e){if(this._getType(e)!==h.undefined){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:h.undefined,received:s.parsedType}),y}return A(e.data)}}Te.create=r=>new Te({typeName:v.ZodUndefined,...x(r)});class Re extends k{_parse(e){if(this._getType(e)!==h.null){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:h.null,received:s.parsedType}),y}return A(e.data)}}Re.create=r=>new Re({typeName:v.ZodNull,...x(r)});class Be extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return A(e.data)}}Be.create=r=>new Be({typeName:v.ZodAny,...x(r)});class Ce extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return A(e.data)}}Ce.create=r=>new Ce({typeName:v.ZodUnknown,...x(r)});class B extends k{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:c.invalid_type,expected:h.never,received:t.parsedType}),y}}B.create=r=>new B({typeName:v.ZodNever,...x(r)});class Ue extends k{_parse(e){if(this._getType(e)!==h.undefined){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:h.void,received:s.parsedType}),y}return A(e.data)}}Ue.create=r=>new Ue({typeName:v.ZodVoid,...x(r)});class L extends k{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return u(t,{code:c.invalid_type,expected:h.array,received:t.parsedType}),y;if(n.exactLength!==null){const o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(u(t,{code:o?c.too_big:c.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(u(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(u(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new M(t,o,t.path,i)))).then(o=>C.mergeArray(s,o));const a=[...t.data].map((o,i)=>n.type._parseSync(new M(t,o,t.path,i)));return C.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new L({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new L({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new L({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}L.create=(r,e)=>new L({type:r,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...x(e)});function X(r){if(r instanceof S){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=V.create(X(s))}return new S({...r._def,shape:()=>e})}else return r instanceof L?new L({...r._def,type:X(r.element)}):r instanceof V?V.create(X(r.unwrap())):r instanceof F?F.create(X(r.unwrap())):r instanceof J?J.create(r.items.map(e=>X(e))):r}class S extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=w.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const l=this._getOrReturnCtx(e);return u(l,{code:c.invalid_type,expected:h.object,received:l.parsedType}),y}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(const l in n.data)o.includes(l)||i.push(l);const d=[];for(const l of o){const g=a[l],O=n.data[l];d.push({key:{status:"valid",value:l},value:g._parse(new M(n,O,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof B){const l=this._def.unknownKeys;if(l==="passthrough")for(const g of i)d.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(l==="strict")i.length>0&&(u(n,{code:c.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const g of i){const O=n.data[g];d.push({key:{status:"valid",value:g},value:l._parse(new M(n,O,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const g of d){const O=await g.key,ke=await g.value;l.push({key:O,value:ke,alwaysSet:g.alwaysSet})}return l}).then(l=>C.mergeObjectSync(s,l)):C.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new S({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:m.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new S({...this._def,unknownKeys:"strip"})}passthrough(){return new S({...this._def,unknownKeys:"passthrough"})}extend(e){return new S({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new S({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new S({...this._def,catchall:e})}pick(e){const t={};for(const s of w.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new S({...this._def,shape:()=>t})}omit(e){const t={};for(const s of w.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new S({...this._def,shape:()=>t})}deepPartial(){return X(this)}partial(e){const t={};for(const s of w.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new S({...this._def,shape:()=>t})}required(e){const t={};for(const s of w.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof V;)a=a._def.innerType;t[s]=a}return new S({...this._def,shape:()=>t})}keyof(){return Fe(w.objectKeys(this.shape))}}S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:B.create(),typeName:v.ZodObject,...x(e)}),S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:B.create(),typeName:v.ZodObject,...x(e)}),S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:B.create(),typeName:v.ZodObject,...x(e)});class ne extends k{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const i of a)if(i.result.status==="valid")return i.result;for(const i of a)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(i=>new z(i.ctx.common.issues));return u(t,{code:c.invalid_union,unionErrors:o}),y}if(t.common.async)return Promise.all(s.map(async a=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a;const o=[];for(const d of s){const l={...t,common:{...t.common,issues:[]},parent:null},g=d._parseSync({data:t.data,path:t.path,parent:l});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(d=>new z(d));return u(t,{code:c.invalid_union,unionErrors:i}),y}}get options(){return this._def.options}}ne.create=(r,e)=>new ne({options:r,typeName:v.ZodUnion,...x(e)});const $=r=>r instanceof Oe?$(r.schema):r instanceof W?$(r.innerType()):r instanceof ie?[r.value]:r instanceof H?r.options:r instanceof Ae?w.objectValues(r.enum):r instanceof ce?$(r._def.innerType):r instanceof Te?[void 0]:r instanceof Re?[null]:r instanceof V?[void 0,...$(r.unwrap())]:r instanceof F?[null,...$(r.unwrap())]:r instanceof He||r instanceof ue?$(r.unwrap()):r instanceof de?$(r._def.innerType):[];class Ee extends k{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return u(t,{code:c.invalid_type,expected:h.object,received:t.parsedType}),y;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const o=$(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of o){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return new Ee({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...x(s)})}}function Ne(r,e){const t=D(r),s=D(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&s===h.object){const n=w.objectKeys(e),a=w.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o={...r,...e};for(const i of a){const d=Ne(r[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(t===h.array&&s===h.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const o=r[a],i=e[a],d=Ne(o,i);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ae extends k{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Le(a)||Le(o))return y;const i=Ne(a.value,o.value);return i.valid?(($e(a)||$e(o))&&t.dirty(),{status:t.value,value:i.data}):(u(s,{code:c.invalid_intersection_types}),y)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ae.create=(r,e,t)=>new ae({left:r,right:e,typeName:v.ZodIntersection,...x(t)});class J extends k{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return u(s,{code:c.invalid_type,expected:h.array,received:s.parsedType}),y;if(s.data.length<this._def.items.length)return u(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&s.data.length>this._def.items.length&&(u(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((o,i)=>{const d=this._def.items[i]||this._def.rest;return d?d._parse(new M(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>C.mergeArray(t,o)):C.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new J({...this._def,rest:e})}}J.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new J({items:r,typeName:v.ZodTuple,rest:null,...x(e)})};class xe extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return u(s,{code:c.invalid_type,expected:h.object,received:s.parsedType}),y;const n=[],a=this._def.keyType,o=this._def.valueType;for(const i in s.data)n.push({key:a._parse(new M(s,i,s.path,i)),value:o._parse(new M(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?C.mergeObjectAsync(t,n):C.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof k?new xe({keyType:e,valueType:t,typeName:v.ZodRecord,...x(s)}):new xe({keyType:q.create(),valueType:e,typeName:v.ZodRecord,...x(t)})}}class We extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return u(s,{code:c.invalid_type,expected:h.map,received:s.parsedType}),y;const n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,d],l)=>({key:n._parse(new M(s,i,s.path,[l,"key"])),value:a._parse(new M(s,d,s.path,[l,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const d of o){const l=await d.key,g=await d.value;if(l.status==="aborted"||g.status==="aborted")return y;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}})}else{const i=new Map;for(const d of o){const l=d.key,g=d.value;if(l.status==="aborted"||g.status==="aborted")return y;(l.status==="dirty"||g.status==="dirty")&&t.dirty(),i.set(l.value,g.value)}return{status:t.value,value:i}}}}We.create=(r,e,t)=>new We({valueType:e,keyType:r,typeName:v.ZodMap,...x(t)});class se extends k{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return u(s,{code:c.invalid_type,expected:h.set,received:s.parsedType}),y;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(u(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(u(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function o(d){const l=new Set;for(const g of d){if(g.status==="aborted")return y;g.status==="dirty"&&t.dirty(),l.add(g.value)}return{status:t.value,value:l}}const i=[...s.data.values()].map((d,l)=>a._parse(new M(s,d,s.path,l)));return s.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,t){return new se({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(r,e)=>new se({valueType:r,minSize:null,maxSize:null,typeName:v.ZodSet,...x(e)});class Oe extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Oe.create=(r,e)=>new Oe({getter:r,typeName:v.ZodLazy,...x(e)});class ie extends k{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}ie.create=(r,e)=>new ie({value:r,typeName:v.ZodLiteral,...x(e)});function Fe(r,e){return new H({values:r,typeName:v.ZodEnum,...x(e)})}class H extends k{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return u(t,{expected:w.joinValues(s),received:t.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return u(t,{received:t.data,code:c.invalid_enum_value,options:s}),y}return A(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return H.create(e,{...this._def,...t})}exclude(e,t=this._def){return H.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}H.create=Fe;class Ae extends k{_parse(e){const t=w.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){const n=w.objectValues(t);return u(s,{expected:w.joinValues(n),received:s.parsedType,code:c.invalid_type}),y}if(this._cache||(this._cache=new Set(w.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=w.objectValues(t);return u(s,{received:s.data,code:c.invalid_enum_value,options:n}),y}return A(e.data)}get enum(){return this._def.values}}Ae.create=(r,e)=>new Ae({values:r,typeName:v.ZodNativeEnum,...x(e)});class oe extends k{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return u(t,{code:c.invalid_type,expected:h.promise,received:t.parsedType}),y;const s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return A(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}oe.create=(r,e)=>new oe({type:r,typeName:v.ZodPromise,...x(e)});class W extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{u(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return y;const d=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return d.status==="aborted"?y:d.status==="dirty"||t.value==="dirty"?K(d.value):d});{if(t.value==="aborted")return y;const i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?y:i.status==="dirty"||t.value==="dirty"?K(i.value):i}}if(n.type==="refinement"){const o=i=>{const d=n.refinement(i,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?y:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?y:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!G(o))return y;const i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>G(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):y);w.assertNever(n)}}W.create=(r,e,t)=>new W({schema:r,typeName:v.ZodEffects,effect:e,...x(t)}),W.createWithPreprocess=(r,e,t)=>new W({schema:e,effect:{type:"preprocess",transform:r},typeName:v.ZodEffects,...x(t)});class V extends k{_parse(e){return this._getType(e)===h.undefined?A(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V.create=(r,e)=>new V({innerType:r,typeName:v.ZodOptional,...x(e)});class F extends k{_parse(e){return this._getType(e)===h.null?A(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(r,e)=>new F({innerType:r,typeName:v.ZodNullable,...x(e)});class ce extends k{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ce.create=(r,e)=>new ce({innerType:r,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class de extends k{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return re(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new z(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new z(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}de.create=(r,e)=>new de({innerType:r,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Je extends k{_parse(e){if(this._getType(e)!==h.nan){const s=this._getOrReturnCtx(e);return u(s,{code:c.invalid_type,expected:h.nan,received:s.parsedType}),y}return{status:"valid",value:e.data}}}Je.create=r=>new Je({typeName:v.ZodNaN,...x(r)});class He extends k{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ze extends k{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?y:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Ze({in:e,out:t,typeName:v.ZodPipeline})}}class ue extends k{_parse(e){const t=this._def.innerType._parse(e),s=n=>(G(n)&&(n.value=Object.freeze(n.value)),n);return re(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}ue.create=(r,e)=>new ue({innerType:r,typeName:v.ZodReadonly,...x(e)});var v;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(v||(v={}));const p=q.create,I=Q.create,j=Se.create,le=Ce.create;B.create;const T=L.create,_=S.create,R=ne.create,Ut=Ee.create;ae.create,J.create;const Ge=xe.create,b=ie.create,Y=H.create;oe.create;const f=V.create;F.create;const he="2.0",Xe=R([p(),I().int()]),Ye=p(),Wt=_({progressToken:f(Xe)}).passthrough(),E=_({_meta:f(Wt)}).passthrough(),N=_({method:p(),params:f(E)}),ee=_({_meta:f(_({}).passthrough())}).passthrough(),P=_({method:p(),params:f(ee)}),Z=_({_meta:f(_({}).passthrough())}).passthrough(),fe=R([p(),I().int()]),Ft=_({jsonrpc:b(he),id:fe}).merge(N).strict(),Jt=_({jsonrpc:b(he)}).merge(P).strict(),Ht=_({jsonrpc:b(he),id:fe,result:Z}).strict();var Qe;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(Qe||(Qe={}));const Gt=_({jsonrpc:b(he),id:fe,error:_({code:I().int(),message:p(),data:f(le())})}).strict(),Xt=R([Ft,Jt,Ht,Gt]),Ke=Z.strict(),et=P.extend({method:b("notifications/cancelled"),params:ee.extend({requestId:fe,reason:p().optional()})}),tt=_({name:p(),version:p()}).passthrough(),Yt=_({experimental:f(_({}).passthrough()),sampling:f(_({}).passthrough()),roots:f(_({listChanged:f(j())}).passthrough())}).passthrough(),Qt=N.extend({method:b("initialize"),params:E.extend({protocolVersion:p(),capabilities:Yt,clientInfo:tt})}),Kt=_({experimental:f(_({}).passthrough()),logging:f(_({}).passthrough()),completions:f(_({}).passthrough()),prompts:f(_({listChanged:f(j())}).passthrough()),resources:f(_({subscribe:f(j()),listChanged:f(j())}).passthrough()),tools:f(_({listChanged:f(j())}).passthrough())}).passthrough(),es=Z.extend({protocolVersion:p(),capabilities:Kt,serverInfo:tt,instructions:f(p())}),ts=P.extend({method:b("notifications/initialized")}),st=N.extend({method:b("ping")}),ss=_({progress:I(),total:f(I()),message:f(p())}).passthrough(),rt=P.extend({method:b("notifications/progress"),params:ee.merge(ss).extend({progressToken:Xe})}),me=N.extend({params:E.extend({cursor:f(Ye)}).optional()}),pe=Z.extend({nextCursor:f(Ye)}),nt=_({uri:p(),mimeType:f(p())}).passthrough(),at=nt.extend({text:p()}),it=nt.extend({blob:p().base64()}),rs=_({uri:p(),name:p(),description:f(p()),mimeType:f(p())}).passthrough(),ns=_({uriTemplate:p(),name:p(),description:f(p()),mimeType:f(p())}).passthrough(),as=me.extend({method:b("resources/list")}),is=pe.extend({resources:T(rs)}),os=me.extend({method:b("resources/templates/list")}),cs=pe.extend({resourceTemplates:T(ns)}),ds=N.extend({method:b("resources/read"),params:E.extend({uri:p()})}),us=Z.extend({contents:T(R([at,it]))}),ls=P.extend({method:b("notifications/resources/list_changed")}),hs=N.extend({method:b("resources/subscribe"),params:E.extend({uri:p()})}),fs=N.extend({method:b("resources/unsubscribe"),params:E.extend({uri:p()})}),ms=P.extend({method:b("notifications/resources/updated"),params:ee.extend({uri:p()})}),ps=_({name:p(),description:f(p()),required:f(j())}).passthrough(),gs=_({name:p(),description:f(p()),arguments:f(T(ps))}).passthrough(),_s=me.extend({method:b("prompts/list")}),ys=pe.extend({prompts:T(gs)}),vs=N.extend({method:b("prompts/get"),params:E.extend({name:p(),arguments:f(Ge(p()))})}),ge=_({type:b("text"),text:p()}).passthrough(),_e=_({type:b("image"),data:p().base64(),mimeType:p()}).passthrough(),ye=_({type:b("audio"),data:p().base64(),mimeType:p()}).passthrough(),ot=_({type:b("resource"),resource:R([at,it])}).passthrough(),xs=_({role:Y(["user","assistant"]),content:R([ge,_e,ye,ot])}).passthrough(),ks=Z.extend({description:f(p()),messages:T(xs)}),bs=P.extend({method:b("notifications/prompts/list_changed")}),ws=_({title:f(p()),readOnlyHint:f(j()),destructiveHint:f(j()),idempotentHint:f(j()),openWorldHint:f(j())}).passthrough(),Ss=_({name:p(),description:f(p()),inputSchema:_({type:b("object"),properties:f(_({}).passthrough()),required:f(T(p()))}).passthrough(),outputSchema:f(_({type:b("object"),properties:f(_({}).passthrough()),required:f(T(p()))}).passthrough()),annotations:f(ws)}).passthrough(),Ts=me.extend({method:b("tools/list")}),Rs=pe.extend({tools:T(Ss)}),ct=Z.extend({content:T(R([ge,_e,ye,ot])).default([]),structuredContent:_({}).passthrough().optional(),isError:f(j())});ct.or(Z.extend({toolResult:le()}));const Cs=N.extend({method:b("tools/call"),params:E.extend({name:p(),arguments:f(Ge(le()))})}),Ns=P.extend({method:b("notifications/tools/list_changed")}),dt=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),Os=N.extend({method:b("logging/setLevel"),params:E.extend({level:dt})}),As=P.extend({method:b("notifications/message"),params:ee.extend({level:dt,logger:f(p()),data:le()})}),js=_({name:p().optional()}).passthrough(),Is=_({hints:f(T(js)),costPriority:f(I().min(0).max(1)),speedPriority:f(I().min(0).max(1)),intelligencePriority:f(I().min(0).max(1))}).passthrough(),Es=_({role:Y(["user","assistant"]),content:R([ge,_e,ye])}).passthrough(),Zs=N.extend({method:b("sampling/createMessage"),params:E.extend({messages:T(Es),systemPrompt:f(p()),includeContext:f(Y(["none","thisServer","allServers"])),temperature:f(I()),maxTokens:I().int(),stopSequences:f(T(p())),metadata:f(_({}).passthrough()),modelPreferences:f(Is)})}),Ms=Z.extend({model:p(),stopReason:f(Y(["endTurn","stopSequence","maxTokens"]).or(p())),role:Y(["user","assistant"]),content:Ut("type",[ge,_e,ye])}),Ps=_({type:b("ref/resource"),uri:p()}).passthrough(),Ls=_({type:b("ref/prompt"),name:p()}).passthrough(),$s=N.extend({method:b("completion/complete"),params:E.extend({ref:R([Ls,Ps]),argument:_({name:p(),value:p()}).passthrough()})}),Vs=Z.extend({completion:_({values:T(p()).max(100),total:f(I().int()),hasMore:f(j())}).passthrough()}),zs=_({uri:p().startsWith("file://"),name:f(p())}).passthrough(),qs=N.extend({method:b("roots/list")}),Ds=Z.extend({roots:T(zs)}),Bs=P.extend({method:b("notifications/roots/list_changed")});R([st,Qt,$s,Os,vs,_s,as,os,ds,hs,fs,Cs,Ts]),R([et,rt,ts,Bs]),R([Ke,Ms,Ds]),R([st,Zs,qs]),R([et,rt,As,ms,ls,Ns,bs]),R([Ke,es,Vs,ks,ys,is,cs,us,ct,Rs]),new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var je;(function(r){r.Completable="McpCompletable"})(je||(je={}));class ut extends k{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}ut.create=(r,e)=>new ut({type:r,typeName:je.Completable,complete:e.complete,...Us(e)});function Us(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{var d,l;const{message:g}=r;return o.code==="invalid_enum_value"?{message:g??i.defaultError}:typeof i.data>"u"?{message:(d=g??s)!==null&&d!==void 0?d:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(l=g??t)!==null&&l!==void 0?l:i.defaultError}},description:n}}const lt=1e6,Ie=1e6,ht=1e4,Ws=1e6;class U{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,s){if(e.length>t)throw new Error(`${s} exceeds maximum length of ${t} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){U.validateLength(e,lt,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const t=[];let s="",n=0,a=0;for(;n<e.length;)if(e[n]==="{"){s&&(t.push(s),s="");const o=e.indexOf("}",n);if(o===-1)throw new Error("Unclosed template expression");if(a++,a>ht)throw new Error(`Template contains too many expressions (max ${ht})`);const i=e.slice(n+1,o),d=this.getOperator(i),l=i.includes("*"),g=this.getNames(i),O=g[0];for(const ke of g)U.validateLength(ke,Ie,"Variable name");t.push({name:O,operator:d,names:g,exploded:l}),n=o+1}else s+=e[n],n++;return s&&t.push(s),t}getOperator(e){return["+","#",".","/","?","&"].find(s=>e.startsWith(s))||""}getNames(e){const t=this.getOperator(e);return e.slice(t.length).split(",").map(s=>s.replace("*","").trim()).filter(s=>s.length>0)}encodeValue(e,t){return U.validateLength(e,Ie,"Variable value"),t==="+"||t==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,t){if(e.operator==="?"||e.operator==="&"){const o=e.names.map(d=>{const l=t[d];if(l===void 0)return"";const g=Array.isArray(l)?l.map(O=>this.encodeValue(O,e.operator)).join(","):this.encodeValue(l.toString(),e.operator);return`${d}=${g}`}).filter(d=>d.length>0);return o.length===0?"":(e.operator==="?"?"?":"&")+o.join("&")}if(e.names.length>1){const o=e.names.map(i=>t[i]).filter(i=>i!==void 0);return o.length===0?"":o.map(i=>Array.isArray(i)?i[0]:i).join(",")}const s=t[e.name];if(s===void 0)return"";const a=(Array.isArray(s)?s:[s]).map(o=>this.encodeValue(o,e.operator));switch(e.operator){case"":return a.join(",");case"+":return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/");default:return a.join(",")}}expand(e){let t="",s=!1;for(const n of this.parts){if(typeof n=="string"){t+=n;continue}const a=this.expandPart(n,e);a&&((n.operator==="?"||n.operator==="&")&&s?t+=a.replace("?","&"):t+=a,(n.operator==="?"||n.operator==="&")&&(s=!0))}return t}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const t=[];for(const a of e.names)U.validateLength(a,Ie,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let a=0;a<e.names.length;a++){const o=e.names[a],i=a===0?"\\"+e.operator:"&";t.push({pattern:i+this.escapeRegExp(o)+"=([^&]+)",name:o})}return t}let s;const n=e.name;switch(e.operator){case"":s=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":s="(.+)";break;case".":s="\\.([^/,]+)";break;case"/":s="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:s="([^/]+)"}return t.push({pattern:s,name:n}),t}match(e){U.validateLength(e,lt,"URI");let t="^";const s=[];for(const i of this.parts)if(typeof i=="string")t+=this.escapeRegExp(i);else{const d=this.partToRegExp(i);for(const{pattern:l,name:g}of d)t+=l,s.push({name:g,exploded:i.exploded})}t+="$",U.validateLength(t,Ws,"Generated regex pattern");const n=new RegExp(t),a=e.match(n);if(!a)return null;const o={};for(let i=0;i<s.length;i++){const{name:d,exploded:l}=s[i],g=a[i+1],O=d.replace("*","");l&&g.includes(",")?o[O]=g.split(","):o[O]=g}return o}}class Fs{constructor(e,t){this._callbacks=t,this._uriTemplate=typeof e=="string"?new U(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var t;return(t=this._callbacks.complete)===null||t===void 0?void 0:t[e]}}class Js{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf(`
|
|
3
|
-
`);if(e===-1)return null;const t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
4
|
-
`}class
|
|
2
|
+
import je from"node:process";import{LikeC4 as ut}from"likec4";import{resolve as lt}from"node:path";var b;(function(s){s.assertEqual=a=>{};function e(a){}s.assertIs=e;function t(a){throw new Error}s.assertNever=t,s.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},s.getValidEnumValues=a=>{const n=s.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of n)i[o]=a[o];return s.objectValues(i)},s.objectValues=a=>s.objectKeys(a).map(function(n){return a[n]}),s.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},s.find=(a,n)=>{for(const i of a)if(n(i))return i},s.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(b||(b={}));var Ee;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Ee||(Ee={}));const h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=s=>{switch(typeof s){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(s)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(s)?h.array:s===null?h.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?h.promise:typeof Map<"u"&&s instanceof Map?h.map:typeof Set<"u"&&s instanceof Set?h.set:typeof Date<"u"&&s instanceof Date?h.date:h.object;default:return h.unknown}},d=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},r={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,p=0;for(;p<i.path.length;){const g=i.path[p];p===i.path.length-1?(o[g]=o[g]||{_errors:[]},o[g]._errors.push(t(i))):o[g]=o[g]||{_errors:[]},o=o[g],p++}}};return a(this),r}static assert(e){if(!(e instanceof z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}z.create=s=>new z(s);const ve=(s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===h.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:b.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(s)}return{message:t}};let ht=ve;function ft(){return ht}const mt=s=>{const{data:e,path:t,errorMaps:r,issueData:a}=s,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let o="";const p=r.filter(g=>!!g).slice().reverse();for(const g of p)o=g(i,{data:e,defaultError:o}).message;return{...a,path:n,message:o}};function u(s,e){const t=ft(),r=mt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===ve?void 0:ve].filter(a=>!!a)});s.common.issues.push(r)}class N{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if(a.status==="aborted")return _;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const a of t){const n=await a.key,i=await a.value;r.push({key:n,value:i})}return N.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return _;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[n.value]=i.value)}return{status:e.value,value:r}}}const _=Object.freeze({status:"aborted"}),X=s=>({status:"dirty",value:s}),Z=s=>({status:"valid",value:s}),Pe=s=>s.status==="aborted",Le=s=>s.status==="dirty",H=s=>s.status==="valid",ne=s=>typeof Promise<"u"&&s instanceof Promise;var m;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));class E{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const $e=(s,e)=>{if(H(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new z(s.common.issues);return this._error=t,this._error}}};function x(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:a}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:p}=s;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:p??t??o.defaultError}},description:a}}class k{get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ne(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parseSync({data:e,path:r.path,parent:r});return $e(r,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return H(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>H(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(ne(a)?a:Promise.resolve(a));return $e(r,n)}refine(e,t){const r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),o=()=>n.addIssue({code:d.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(p=>p?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new U({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return M.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this)}promise(){return de.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new U({...x(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ue({...x(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new We({typeName:y.ZodBranded,type:this,...x(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new le({...x(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const pt=/^c[^\s-]{8,}$/i,gt=/^[0-9a-z]+$/,_t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yt=/^[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,vt=/^[a-z0-9_-]{21}$/i,xt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kt=/^[-+]?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)?)??$/,bt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,St="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xe;const wt=/^(?:(?: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])$/,Tt=/^(?:(?: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])$/,Rt=/^(([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]))$/,Ct=/^(([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])$/,Nt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Me="((\\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])))",At=new RegExp(`^${Me}$`);function Ve(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Zt(s){return new RegExp(`^${Ve(s)}$`)}function It(s){let e=`${Me}T${Ve(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function jt(s,e){return!!((e==="v4"||!e)&&wt.test(s)||(e==="v6"||!e)&&Rt.test(s))}function Et(s,e){if(!xt.test(s))return!1;try{const[t]=s.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Pt(s,e){return!!((e==="v4"||!e)&&Tt.test(s)||(e==="v6"||!e)&&Ct.test(s))}class q extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.string,received:n.parsedType}),_}const r=new N;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?u(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&u(a,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")bt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"email",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")xe||(xe=new RegExp(St,"u")),xe.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"emoji",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")yt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"uuid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")vt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"nanoid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")pt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")gt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid2",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")_t.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ulid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),u(a,{validation:"url",code:d.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"regex",code:d.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?It(n).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?At.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?Zt(n).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?kt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"duration",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?jt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ip",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="jwt"?Et(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"jwt",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="cidr"?Pt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cidr",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?Nt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="base64url"?Ot.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64url",code:d.invalid_string,message:n.message}),r.dirty()):b.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:d.invalid_string,...m.errToObj(r)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}q.create=s=>new q({checks:[],typeName:y.ZodString,coerce:s?.coerce??!1,...x(s)});function Lt(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,n=Number.parseInt(s.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.number,received:n.parsedType}),_}let r;const a=new N;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Lt(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_finite,message:n.message}),a.dirty()):b.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,r,a){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:m.toString(a)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Y.create=s=>new Y({checks:[],typeName:y.ZodNumber,coerce:s?.coerce||!1,...x(s)});class re extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let r;const a=new N;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):b.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,r,a){return new re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:m.toString(a)}]})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}re.create=s=>new re({checks:[],typeName:y.ZodBigInt,coerce:s?.coerce??!1,...x(s)});class ke extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.boolean,received:r.parsedType}),_}return Z(e.data)}}ke.create=s=>new ke({typeName:y.ZodBoolean,coerce:s?.coerce||!1,...x(s)});class _e extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.date,received:n.parsedType}),_}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_date}),_}const r=new N;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):b.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new _e({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}_e.create=s=>new _e({checks:[],coerce:s?.coerce||!1,typeName:y.ZodDate,...x(s)});class ze extends k{_parse(e){if(this._getType(e)!==h.symbol){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.symbol,received:r.parsedType}),_}return Z(e.data)}}ze.create=s=>new ze({typeName:y.ZodSymbol,...x(s)});class be extends k{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.undefined,received:r.parsedType}),_}return Z(e.data)}}be.create=s=>new be({typeName:y.ZodUndefined,...x(s)});class Se extends k{_parse(e){if(this._getType(e)!==h.null){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.null,received:r.parsedType}),_}return Z(e.data)}}Se.create=s=>new Se({typeName:y.ZodNull,...x(s)});class qe extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}qe.create=s=>new qe({typeName:y.ZodAny,...x(s)});class we extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}we.create=s=>new we({typeName:y.ZodUnknown,...x(s)});class B extends k{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),_}}B.create=s=>new B({typeName:y.ZodNever,...x(s)});class De extends k{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.void,received:r.parsedType}),_}return Z(e.data)}}De.create=s=>new De({typeName:y.ZodVoid,...x(s)});class L extends k{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==h.array)return u(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),_;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,o=t.data.length<a.exactLength.value;(i||o)&&(u(t,{code:i?d.too_big:d.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(u(t,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(u(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>a.type._parseAsync(new E(t,i,t.path,o)))).then(i=>N.mergeArray(r,i));const n=[...t.data].map((i,o)=>a.type._parseSync(new E(t,i,t.path,o)));return N.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new L({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new L({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new L({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}L.create=(s,e)=>new L({type:s,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...x(e)});function G(s){if(s instanceof w){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=M.create(G(r))}return new w({...s._def,shape:()=>e})}else return s instanceof L?new L({...s._def,type:G(s.element)}):s instanceof M?M.create(G(s.unwrap())):s instanceof F?F.create(G(s.unwrap())):s instanceof W?W.create(s.items.map(e=>G(e))):s}class w extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const g=this._getOrReturnCtx(e);return u(g,{code:d.invalid_type,expected:h.object,received:g.parsedType}),_}const{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(const g in a.data)i.includes(g)||o.push(g);const p=[];for(const g of i){const S=n[g],Q=a.data[g];p.push({key:{status:"valid",value:g},value:S._parse(new E(a,Q,a.path,g)),alwaysSet:g in a.data})}if(this._def.catchall instanceof B){const g=this._def.unknownKeys;if(g==="passthrough")for(const S of o)p.push({key:{status:"valid",value:S},value:{status:"valid",value:a.data[S]}});else if(g==="strict")o.length>0&&(u(a,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const S of o){const Q=a.data[S];p.push({key:{status:"valid",value:S},value:g._parse(new E(a,Q,a.path,S)),alwaysSet:S in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const g=[];for(const S of p){const Q=await S.key,dt=await S.value;g.push({key:Q,value:dt,alwaysSet:S.alwaysSet})}return g}).then(g=>N.mergeObjectSync(r,g)):N.mergeObjectSync(r,p)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{const a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:m.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new w({...this._def,catchall:e})}pick(e){const t={};for(const r of b.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}omit(e){const t={};for(const r of b.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};for(const r of b.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new w({...this._def,shape:()=>t})}required(e){const t={};for(const r of b.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof M;)n=n._def.innerType;t[r]=n}return new w({...this._def,shape:()=>t})}keyof(){return Ue(b.objectKeys(this.shape))}}w.create=(s,e)=>new w({shape:()=>s,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...x(e)}),w.strictCreate=(s,e)=>new w({shape:()=>s,unknownKeys:"strict",catchall:B.create(),typeName:y.ZodObject,...x(e)}),w.lazycreate=(s,e)=>new w({shape:s,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...x(e)});class ie extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new z(o.ctx.common.issues));return u(t,{code:d.invalid_union,unionErrors:i}),_}if(t.common.async)return Promise.all(r.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const p of r){const g={...t,common:{...t.common,issues:[]},parent:null},S=p._parseSync({data:t.data,path:t.path,parent:g});if(S.status==="valid")return S;S.status==="dirty"&&!n&&(n={result:S,ctx:g}),g.common.issues.length&&i.push(g.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(p=>new z(p));return u(t,{code:d.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}ie.create=(s,e)=>new ie({options:s,typeName:y.ZodUnion,...x(e)});const $=s=>s instanceof Re?$(s.schema):s instanceof U?$(s.innerType()):s instanceof ce?[s.value]:s instanceof J?s.options:s instanceof Ce?b.objectValues(s.enum):s instanceof ue?$(s._def.innerType):s instanceof be?[void 0]:s instanceof Se?[null]:s instanceof M?[void 0,...$(s.unwrap())]:s instanceof F?[null,...$(s.unwrap())]:s instanceof We||s instanceof he?$(s.unwrap()):s instanceof le?$(s._def.innerType):[];class Ze extends k{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return u(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),_;const r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const n of t){const i=$(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new Ze({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...x(r)})}}function Te(s,e){const t=D(s),r=D(e);if(s===e)return{valid:!0,data:s};if(t===h.object&&r===h.object){const a=b.objectKeys(e),n=b.objectKeys(s).filter(o=>a.indexOf(o)!==-1),i={...s,...e};for(const o of n){const p=Te(s[o],e[o]);if(!p.valid)return{valid:!1};i[o]=p.data}return{valid:!0,data:i}}else if(t===h.array&&r===h.array){if(s.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<s.length;n++){const i=s[n],o=e[n],p=Te(i,o);if(!p.valid)return{valid:!1};a.push(p.data)}return{valid:!0,data:a}}else return t===h.date&&r===h.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class oe extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(n,i)=>{if(Pe(n)||Pe(i))return _;const o=Te(n.value,i.value);return o.valid?((Le(n)||Le(i))&&t.dirty(),{status:t.value,value:o.data}):(u(r,{code:d.invalid_intersection_types}),_)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}oe.create=(s,e,t)=>new oe({left:s,right:e,typeName:y.ZodIntersection,...x(t)});class W extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.array)return u(r,{code:d.invalid_type,expected:h.array,received:r.parsedType}),_;if(r.data.length<this._def.items.length)return u(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&r.data.length>this._def.items.length&&(u(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((i,o)=>{const p=this._def.items[o]||this._def.rest;return p?p._parse(new E(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(n).then(i=>N.mergeArray(t,i)):N.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new W({...this._def,rest:e})}}W.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W({items:s,typeName:y.ZodTuple,rest:null,...x(e)})};class ye extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.object)return u(r,{code:d.invalid_type,expected:h.object,received:r.parsedType}),_;const a=[],n=this._def.keyType,i=this._def.valueType;for(const o in r.data)a.push({key:n._parse(new E(r,o,r.path,o)),value:i._parse(new E(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?N.mergeObjectAsync(t,a):N.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof k?new ye({keyType:e,valueType:t,typeName:y.ZodRecord,...x(r)}):new ye({keyType:q.create(),valueType:e,typeName:y.ZodRecord,...x(t)})}}class Be extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.map)return u(r,{code:d.invalid_type,expected:h.map,received:r.parsedType}),_;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([o,p],g)=>({key:a._parse(new E(r,o,r.path,[g,"key"])),value:n._parse(new E(r,p,r.path,[g,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const p of i){const g=await p.key,S=await p.value;if(g.status==="aborted"||S.status==="aborted")return _;(g.status==="dirty"||S.status==="dirty")&&t.dirty(),o.set(g.value,S.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const p of i){const g=p.key,S=p.value;if(g.status==="aborted"||S.status==="aborted")return _;(g.status==="dirty"||S.status==="dirty")&&t.dirty(),o.set(g.value,S.value)}return{status:t.value,value:o}}}}Be.create=(s,e,t)=>new Be({valueType:e,keyType:s,typeName:y.ZodMap,...x(t)});class ae extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.set)return u(r,{code:d.invalid_type,expected:h.set,received:r.parsedType}),_;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(u(r,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(u(r,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(p){const g=new Set;for(const S of p){if(S.status==="aborted")return _;S.status==="dirty"&&t.dirty(),g.add(S.value)}return{status:t.value,value:g}}const o=[...r.data.values()].map((p,g)=>n._parse(new E(r,p,r.path,g)));return r.common.async?Promise.all(o).then(p=>i(p)):i(o)}min(e,t){return new ae({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new ae({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ae.create=(s,e)=>new ae({valueType:s,minSize:null,maxSize:null,typeName:y.ZodSet,...x(e)});class Re extends k{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Re.create=(s,e)=>new Re({getter:s,typeName:y.ZodLazy,...x(e)});class ce extends k{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}ce.create=(s,e)=>new ce({value:s,typeName:y.ZodLiteral,...x(e)});function Ue(s,e){return new J({values:s,typeName:y.ZodEnum,...x(e)})}class J extends k{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{expected:b.joinValues(r),received:t.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{received:t.data,code:d.invalid_enum_value,options:r}),_}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return J.create(e,{...this._def,...t})}exclude(e,t=this._def){return J.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}J.create=Ue;class Ce extends k{_parse(e){const t=b.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==h.string&&r.parsedType!==h.number){const a=b.objectValues(t);return u(r,{expected:b.joinValues(a),received:r.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=b.objectValues(t);return u(r,{received:r.data,code:d.invalid_enum_value,options:a}),_}return Z(e.data)}get enum(){return this._def.values}}Ce.create=(s,e)=>new Ce({values:s,typeName:y.ZodNativeEnum,...x(e)});class de extends k{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return u(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),_;const r=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return Z(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}de.create=(s,e)=>new de({type:s,typeName:y.ZodPromise,...x(e)});class U extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{u(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return _;const p=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return p.status==="aborted"?_:p.status==="dirty"||t.value==="dirty"?X(p.value):p});{if(t.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?_:o.status==="dirty"||t.value==="dirty"?X(o.value):o}}if(a.type==="refinement"){const i=o=>{const p=a.refinement(o,n);if(r.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!H(i))return _;const o=a.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>H(i)?Promise.resolve(a.transform(i.value,n)).then(o=>({status:t.value,value:o})):_);b.assertNever(a)}}U.create=(s,e,t)=>new U({schema:s,typeName:y.ZodEffects,effect:e,...x(t)}),U.createWithPreprocess=(s,e,t)=>new U({schema:e,effect:{type:"preprocess",transform:s},typeName:y.ZodEffects,...x(t)});class M extends k{_parse(e){return this._getType(e)===h.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}M.create=(s,e)=>new M({innerType:s,typeName:y.ZodOptional,...x(e)});class F extends k{_parse(e){return this._getType(e)===h.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(s,e)=>new F({innerType:s,typeName:y.ZodNullable,...x(e)});class ue extends k{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===h.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ue.create=(s,e)=>new ue({innerType:s,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class le extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ne(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}le.create=(s,e)=>new le({innerType:s,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Fe extends k{_parse(e){if(this._getType(e)!==h.nan){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.nan,received:r.parsedType}),_}return{status:"valid",value:e.data}}}Fe.create=s=>new Fe({typeName:y.ZodNaN,...x(s)});class We extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ie extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?_:n.status==="dirty"?(t.dirty(),X(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?_:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new Ie({in:e,out:t,typeName:y.ZodPipeline})}}class he extends k{_parse(e){const t=this._def.innerType._parse(e),r=a=>(H(a)&&(a.value=Object.freeze(a.value)),a);return ne(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}}he.create=(s,e)=>new he({innerType:s,typeName:y.ZodReadonly,...x(e)});var y;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(y||(y={}));const l=q.create,R=Y.create,A=ke.create,K=we.create;B.create;const T=L.create,f=w.create,C=ie.create,$t=Ze.create;oe.create,W.create;const ee=ye.create,v=ce.create,V=J.create;de.create;const c=M.create;F.create;const fe="2.0",Je=C([l(),R().int()]),He=l(),Mt=f({progressToken:c(Je)}).passthrough(),I=f({_meta:c(Mt)}).passthrough(),O=f({method:l(),params:c(I)}),te=f({_meta:c(f({}).passthrough())}).passthrough(),P=f({method:l(),params:c(te)}),j=f({_meta:c(f({}).passthrough())}).passthrough(),me=C([l(),R().int()]),Vt=f({jsonrpc:v(fe),id:me}).merge(O).strict(),zt=f({jsonrpc:v(fe)}).merge(P).strict(),qt=f({jsonrpc:v(fe),id:me,result:j}).strict();var Ge;(function(s){s[s.ConnectionClosed=-32e3]="ConnectionClosed",s[s.RequestTimeout=-32001]="RequestTimeout",s[s.ParseError=-32700]="ParseError",s[s.InvalidRequest=-32600]="InvalidRequest",s[s.MethodNotFound=-32601]="MethodNotFound",s[s.InvalidParams=-32602]="InvalidParams",s[s.InternalError=-32603]="InternalError"})(Ge||(Ge={}));const Dt=f({jsonrpc:v(fe),id:me,error:f({code:R().int(),message:l(),data:c(K())})}).strict(),Bt=C([Vt,zt,qt,Dt]),Ye=j.strict(),Qe=P.extend({method:v("notifications/cancelled"),params:te.extend({requestId:me,reason:l().optional()})}),se=f({name:l(),title:c(l())}).passthrough(),Xe=se.extend({version:l()}),Ut=f({experimental:c(f({}).passthrough()),sampling:c(f({}).passthrough()),elicitation:c(f({}).passthrough()),roots:c(f({listChanged:c(A())}).passthrough())}).passthrough(),Ft=O.extend({method:v("initialize"),params:I.extend({protocolVersion:l(),capabilities:Ut,clientInfo:Xe})}),Wt=f({experimental:c(f({}).passthrough()),logging:c(f({}).passthrough()),completions:c(f({}).passthrough()),prompts:c(f({listChanged:c(A())}).passthrough()),resources:c(f({subscribe:c(A()),listChanged:c(A())}).passthrough()),tools:c(f({listChanged:c(A())}).passthrough())}).passthrough(),Jt=j.extend({protocolVersion:l(),capabilities:Wt,serverInfo:Xe,instructions:c(l())}),Ht=P.extend({method:v("notifications/initialized")}),Ke=O.extend({method:v("ping")}),Gt=f({progress:R(),total:c(R()),message:c(l())}).passthrough(),et=P.extend({method:v("notifications/progress"),params:te.merge(Gt).extend({progressToken:Je})}),pe=O.extend({params:I.extend({cursor:c(He)}).optional()}),ge=j.extend({nextCursor:c(He)}),tt=f({uri:l(),mimeType:c(l()),_meta:c(f({}).passthrough())}).passthrough(),st=tt.extend({text:l()}),rt=tt.extend({blob:l().base64()}),at=se.extend({uri:l(),description:c(l()),mimeType:c(l()),_meta:c(f({}).passthrough())}),Yt=se.extend({uriTemplate:l(),description:c(l()),mimeType:c(l()),_meta:c(f({}).passthrough())}),Qt=pe.extend({method:v("resources/list")}),Xt=ge.extend({resources:T(at)}),Kt=pe.extend({method:v("resources/templates/list")}),es=ge.extend({resourceTemplates:T(Yt)}),ts=O.extend({method:v("resources/read"),params:I.extend({uri:l()})}),ss=j.extend({contents:T(C([st,rt]))}),rs=P.extend({method:v("notifications/resources/list_changed")}),as=O.extend({method:v("resources/subscribe"),params:I.extend({uri:l()})}),ns=O.extend({method:v("resources/unsubscribe"),params:I.extend({uri:l()})}),is=P.extend({method:v("notifications/resources/updated"),params:te.extend({uri:l()})}),os=f({name:l(),description:c(l()),required:c(A())}).passthrough(),cs=se.extend({description:c(l()),arguments:c(T(os)),_meta:c(f({}).passthrough())}),ds=pe.extend({method:v("prompts/list")}),us=ge.extend({prompts:T(cs)}),ls=O.extend({method:v("prompts/get"),params:I.extend({name:l(),arguments:c(ee(l()))})}),Ne=f({type:v("text"),text:l(),_meta:c(f({}).passthrough())}).passthrough(),Oe=f({type:v("image"),data:l().base64(),mimeType:l(),_meta:c(f({}).passthrough())}).passthrough(),Ae=f({type:v("audio"),data:l().base64(),mimeType:l(),_meta:c(f({}).passthrough())}).passthrough(),hs=f({type:v("resource"),resource:C([st,rt]),_meta:c(f({}).passthrough())}).passthrough(),fs=at.extend({type:v("resource_link")}),nt=C([Ne,Oe,Ae,fs,hs]),ms=f({role:V(["user","assistant"]),content:nt}).passthrough(),ps=j.extend({description:c(l()),messages:T(ms)}),gs=P.extend({method:v("notifications/prompts/list_changed")}),_s=f({title:c(l()),readOnlyHint:c(A()),destructiveHint:c(A()),idempotentHint:c(A()),openWorldHint:c(A())}).passthrough(),ys=se.extend({description:c(l()),inputSchema:f({type:v("object"),properties:c(f({}).passthrough()),required:c(T(l()))}).passthrough(),outputSchema:c(f({type:v("object"),properties:c(f({}).passthrough()),required:c(T(l()))}).passthrough()),annotations:c(_s),_meta:c(f({}).passthrough())}),vs=pe.extend({method:v("tools/list")}),xs=ge.extend({tools:T(ys)}),it=j.extend({content:T(nt).default([]),structuredContent:f({}).passthrough().optional(),isError:c(A())});it.or(j.extend({toolResult:K()}));const ks=O.extend({method:v("tools/call"),params:I.extend({name:l(),arguments:c(ee(K()))})}),bs=P.extend({method:v("notifications/tools/list_changed")}),ot=V(["debug","info","notice","warning","error","critical","alert","emergency"]),Ss=O.extend({method:v("logging/setLevel"),params:I.extend({level:ot})}),ws=P.extend({method:v("notifications/message"),params:te.extend({level:ot,logger:c(l()),data:K()})}),Ts=f({name:l().optional()}).passthrough(),Rs=f({hints:c(T(Ts)),costPriority:c(R().min(0).max(1)),speedPriority:c(R().min(0).max(1)),intelligencePriority:c(R().min(0).max(1))}).passthrough(),Cs=f({role:V(["user","assistant"]),content:C([Ne,Oe,Ae])}).passthrough(),Ns=O.extend({method:v("sampling/createMessage"),params:I.extend({messages:T(Cs),systemPrompt:c(l()),includeContext:c(V(["none","thisServer","allServers"])),temperature:c(R()),maxTokens:R().int(),stopSequences:c(T(l())),metadata:c(f({}).passthrough()),modelPreferences:c(Rs)})}),Os=j.extend({model:l(),stopReason:c(V(["endTurn","stopSequence","maxTokens"]).or(l())),role:V(["user","assistant"]),content:$t("type",[Ne,Oe,Ae])}),As=f({type:v("boolean"),title:c(l()),description:c(l()),default:c(A())}).passthrough(),Zs=f({type:v("string"),title:c(l()),description:c(l()),minLength:c(R()),maxLength:c(R()),format:c(V(["email","uri","date","date-time"]))}).passthrough(),Is=f({type:V(["number","integer"]),title:c(l()),description:c(l()),minimum:c(R()),maximum:c(R())}).passthrough(),js=f({type:v("string"),title:c(l()),description:c(l()),enum:T(l()),enumNames:c(T(l()))}).passthrough(),Es=C([As,Zs,Is,js]),Ps=O.extend({method:v("elicitation/create"),params:I.extend({message:l(),requestedSchema:f({type:v("object"),properties:ee(l(),Es),required:c(T(l()))}).passthrough()})}),Ls=j.extend({action:V(["accept","reject","cancel"]),content:c(ee(l(),K()))}),$s=f({type:v("ref/resource"),uri:l()}).passthrough(),Ms=f({type:v("ref/prompt"),name:l()}).passthrough(),Vs=O.extend({method:v("completion/complete"),params:I.extend({ref:C([Ms,$s]),argument:f({name:l(),value:l()}).passthrough(),context:c(f({arguments:c(ee(l(),l()))}))})}),zs=j.extend({completion:f({values:T(l()).max(100),total:c(R().int()),hasMore:c(A())}).passthrough()}),qs=f({uri:l().startsWith("file://"),name:c(l()),_meta:c(f({}).passthrough())}).passthrough(),Ds=O.extend({method:v("roots/list")}),Bs=j.extend({roots:T(qs)}),Us=P.extend({method:v("notifications/roots/list_changed")});C([Ke,Ft,Vs,Ss,ls,ds,Qt,Kt,ts,as,ns,ks,vs]),C([Qe,et,Ht,Us]),C([Ye,Os,Ls,Bs]),C([Ke,Ns,Ps,Ds]),C([Qe,et,ws,is,rs,bs,gs]),C([Ye,Jt,zs,ps,us,Xt,es,ss,it,xs]);class Fs{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf(`
|
|
3
|
+
`);if(e===-1)return null;const t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Ws(t)}clear(){this._buffer=void 0}}function Ws(s){return Bt.parse(JSON.parse(s))}function Js(s){return JSON.stringify(s)+`
|
|
4
|
+
`}class Hs{constructor(e=je.stdin,t=je.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Fs,this._started=!1,this._ondata=r=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=r=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,r)}}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(){for(var e,t;;)try{const r=this._readBuffer.readMessage();if(r===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,r)}catch(r){(t=this.onerror)===null||t===void 0||t.call(this,r)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{const r=Js(e);this._stdout.write(r)?t():this._stdout.once("drain",t)})}}const ct=lt(process.env.LIKEC4_WORKSPACE||".");async function Gs(){console.error(`Loading LikeC4 from workspace ${ct}`);const s=await ut.fromWorkspace(ct,{logger:!1}),e=s.langium.mcp.ServerFactory.create({capabilities:{tools:{},logging:{}}});e.server.oninitialized=()=>{e.server.sendLoggingMessage({level:"info",data:{message:"Server initialized",workspace:s.workspace}})};const t=new Hs;console.error("Connecting server to transport..."),await e.connect(t),console.error("LikeC4 MCP Server running on stdio")}Gs().catch(s=>{console.error(s),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/mcp",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.34.0",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
7
7
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"likec4": "1.
|
|
50
|
+
"likec4": "1.34.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
54
|
-
"@types/node": "~20.19.
|
|
55
|
-
"remeda": "^2.23.
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.13.2",
|
|
54
|
+
"@types/node": "~20.19.1",
|
|
55
|
+
"remeda": "^2.23.1",
|
|
56
56
|
"tsx": "4.19.4",
|
|
57
57
|
"turbo": "2.5.4",
|
|
58
58
|
"typescript": "5.8.3",
|
|
59
59
|
"unbuild": "3.5.0",
|
|
60
|
-
"vitest": "3.2.
|
|
61
|
-
"zod": "
|
|
60
|
+
"vitest": "3.2.4",
|
|
61
|
+
"zod": "3.25.67",
|
|
62
62
|
"wireit": "0.14.12",
|
|
63
|
-
"@likec4/core": "1.
|
|
64
|
-
"@likec4/tsconfig": "1.
|
|
63
|
+
"@likec4/core": "1.34.0",
|
|
64
|
+
"@likec4/tsconfig": "1.34.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"typecheck": "tsc -b --verbose",
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
type ProjectId,
|
|
5
|
-
ifilter,
|
|
6
|
-
} from '@likec4/core'
|
|
7
|
-
import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
8
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
9
|
-
import type { Resource } from '@modelcontextprotocol/sdk/types.js'
|
|
10
4
|
import { LikeC4 } from 'likec4'
|
|
11
5
|
import { resolve } from 'node:path'
|
|
12
6
|
|
|
@@ -18,64 +12,12 @@ async function main() {
|
|
|
18
12
|
logger: false,
|
|
19
13
|
})
|
|
20
14
|
|
|
21
|
-
const mcpTools = likec4.langium.mcp.Tools
|
|
22
15
|
const mcp = likec4.langium.mcp.ServerFactory.create({
|
|
23
16
|
capabilities: {
|
|
24
|
-
completions: {},
|
|
25
17
|
tools: {},
|
|
26
|
-
|
|
18
|
+
logging: {},
|
|
27
19
|
},
|
|
28
20
|
})
|
|
29
|
-
|
|
30
|
-
mcp.resource(
|
|
31
|
-
'likec4 element',
|
|
32
|
-
new ResourceTemplate('likec4://projects/{project}/elements/{id}', {
|
|
33
|
-
list: async () => {
|
|
34
|
-
const projects = await likec4.languageServices.projects()
|
|
35
|
-
const resources: Resource[] = []
|
|
36
|
-
for (const { id } of projects) {
|
|
37
|
-
const model = likec4.computedModel(id)
|
|
38
|
-
for (const el of model.elements()) {
|
|
39
|
-
resources.push({
|
|
40
|
-
uri: `likec4://projects/${id}/elements/${el.id}`,
|
|
41
|
-
name: el.title,
|
|
42
|
-
id: el.id,
|
|
43
|
-
description: `Model element of kind "${el.kind}"`,
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return ({
|
|
48
|
-
resources,
|
|
49
|
-
})
|
|
50
|
-
},
|
|
51
|
-
complete: {
|
|
52
|
-
project: async (name) => {
|
|
53
|
-
const projects = await likec4.projects()
|
|
54
|
-
const newLocal = name.toLowerCase()
|
|
55
|
-
return projects.filter(id => id.toLowerCase().startsWith(newLocal))
|
|
56
|
-
},
|
|
57
|
-
id: async (name) => {
|
|
58
|
-
const { id } = likec4.languageServices.projects()[0]
|
|
59
|
-
const model = likec4.computedModel(id)
|
|
60
|
-
return [...ifilter(model.elements(), el => el.id.startsWith(name))].map(i => i.id)
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
}),
|
|
64
|
-
async (uri, { project, id }) => {
|
|
65
|
-
const text = await mcpTools.readElement({
|
|
66
|
-
id: id as string,
|
|
67
|
-
project: project as ProjectId,
|
|
68
|
-
})
|
|
69
|
-
return {
|
|
70
|
-
contents: [{
|
|
71
|
-
uri: uri.href,
|
|
72
|
-
mimeType: 'application/json',
|
|
73
|
-
text,
|
|
74
|
-
}],
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
)
|
|
78
|
-
|
|
79
21
|
mcp.server.oninitialized = () => {
|
|
80
22
|
mcp.server.sendLoggingMessage({
|
|
81
23
|
level: 'info',
|