@weppy/roblox-mcp 2.16.1 → 2.16.2

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dashboard/dist/assets/{AssetsPage-y9ob34oQ.js → AssetsPage-_CPMetwm.js} +2 -2
  3. package/dashboard/dist/assets/ChangelogPage-B9Ct115r.css +1 -0
  4. package/dashboard/dist/assets/ChangelogPage-BpTjHwvr.js +1 -0
  5. package/dashboard/dist/assets/{ConfirmModal-BCthkdVV.js → ConfirmModal-BSbhJt6x.js} +1 -1
  6. package/dashboard/dist/assets/{ConnectionPage-C5kFQ8k3.js → ConnectionPage-BMIbBueG.js} +2 -2
  7. package/dashboard/dist/assets/{ContentScopedDialog-Be71g2ql.js → ContentScopedDialog-D92wgDaU.js} +1 -1
  8. package/dashboard/dist/assets/{ControlsPage-CAQx3UR_.js → ControlsPage-C828Cgwo.js} +2 -2
  9. package/dashboard/dist/assets/CurrentPlaceScope-BFYSAg2T.js +1 -0
  10. package/dashboard/dist/assets/{GameChangeDetail-AUqSoK_K.js → GameChangeDetail-CCQ8h1ft.js} +1 -1
  11. package/dashboard/dist/assets/{InfoLabel-CI6bHOeU.js → InfoLabel-D6WxKFnG.js} +1 -1
  12. package/dashboard/dist/assets/OverviewPage-B8RMrIaQ.js +1 -0
  13. package/dashboard/dist/assets/{UiPrimitive-BMSNRGwI.css → PageHeader-CrhjZjgp.css} +1 -1
  14. package/dashboard/dist/assets/PageHeader-Xrn6BpcL.js +6 -0
  15. package/dashboard/dist/assets/{PlaytestPage-Djj9Z4yq.js → PlaytestPage-CrCurhRT.js} +2 -2
  16. package/dashboard/dist/assets/SettingsPage-B_9NwPEF.js +1 -0
  17. package/dashboard/dist/assets/{StatusBadge-PkthVJ8-.js → StatusBadge-Ddzg1cSk.js} +1 -1
  18. package/dashboard/dist/assets/SyncPage-BNadN0NU.js +1 -0
  19. package/dashboard/dist/assets/{Tabs-PO1vvwQv.js → Tabs-DZDOsT6_.js} +1 -1
  20. package/dashboard/dist/assets/ToolsPage-bHm2QbDR.js +1 -0
  21. package/dashboard/dist/assets/{TooltipText-d7cAgyJE.js → TooltipText-B1An7dUI.js} +1 -1
  22. package/dashboard/dist/assets/{UiStudioPage-DopaYXcf.js → UiStudioPage-CWQgLMHO.js} +2 -2
  23. package/dashboard/dist/assets/WhatsNewPage-D-iibgAc.js +1 -0
  24. package/dashboard/dist/assets/{copy-DfHRl3VR.js → copy-B03ftJiE.js} +1 -1
  25. package/dashboard/dist/assets/{index-Dj2NvZgn.js → index-Ygt1Wh6v.js} +19 -19
  26. package/dashboard/dist/assets/sample-requests-r6iFLFba.js +1 -0
  27. package/dashboard/dist/assets/{useLiveUptime-BH4xRx9-.js → useLiveUptime-CnfGQ_vS.js} +1 -1
  28. package/dashboard/dist/assets/useSettings-BrnGUYZY.js +1 -0
  29. package/dashboard/dist/index.html +1 -1
  30. package/dist/index.js +1 -1
  31. package/package.json +1 -1
  32. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  33. package/dashboard/dist/assets/ChangelogDetailPage-B7dy6kfX.js +0 -1
  34. package/dashboard/dist/assets/ChangelogDetailPage-vGgnpq1q.css +0 -1
  35. package/dashboard/dist/assets/ChangelogPage-CTzv0TSI.js +0 -1
  36. package/dashboard/dist/assets/ChangelogPage-DsP0fTsc.css +0 -1
  37. package/dashboard/dist/assets/CurrentPlaceScope-CMhgXKOx.js +0 -1
  38. package/dashboard/dist/assets/OverviewPage-QU6C8Jn2.js +0 -1
  39. package/dashboard/dist/assets/PageHeader-CDCcXu8v.js +0 -6
  40. package/dashboard/dist/assets/PageHeader-CV_rjuG8.css +0 -1
  41. package/dashboard/dist/assets/SettingsPage-u168hqTU.js +0 -1
  42. package/dashboard/dist/assets/SyncPage-DCSjeijW.js +0 -1
  43. package/dashboard/dist/assets/ToolsPage-Agg2KLl4.js +0 -1
  44. package/dashboard/dist/assets/UiPrimitive-BTuxHpyB.js +0 -1
  45. package/dashboard/dist/assets/WhatsNewPage-DZNySLP6.js +0 -1
  46. package/dashboard/dist/assets/sample-requests-CG4hsqBb.js +0 -1
  47. package/dashboard/dist/assets/useSettings-Q2tOR4bH.js +0 -1
package/dist/index.js CHANGED
@@ -242,7 +242,7 @@ run().catch(() => {
242
242
 
243
243
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of t.seen.entries()){let s=o[1];if(e===o[0]){a(o);continue}if(t.external){let l=t.external.registry.get(o[0])?.id;if(e!==o[0]&&l){a(o);continue}}if(t.metadataRegistry.get(o[0])?.id){a(o);continue}if(s.cycle){a(o);continue}if(s.count>1&&t.reused==="ref"){a(o);continue}}}function uo(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=o=>{let s=t.seen.get(o);if(s.ref===null)return;let c=s.def??s.schema,l={...c},u=s.ref;if(s.ref=null,u){n(u);let p=t.seen.get(u),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Object.assign(c,m),Object.assign(c,l),o._zod.parent===u)for(let g in c)g==="$ref"||g==="allOf"||g in l||delete c[g];if(m.$ref&&p.def)for(let g in c)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(c[g])===JSON.stringify(p.def[g])&&delete c[g]}let d=o._zod.parent;if(d&&d!==u){n(d);let p=t.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m]}t.override({zodSchema:o,jsonSchema:c,path:s.path??[]})};for(let o of[...t.seen.entries()].reverse())n(o[0]);let i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let o=t.external.registry.get(e)?.id;if(!o)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(o)}Object.assign(i,r.def??r.schema);let a=t.external?.defs??{};for(let o of t.seen.entries()){let s=o[1];s.def&&s.defId&&(a[s.defId]=s.def)}t.external||Object.keys(a).length>0&&(t.target==="draft-2020-12"?i.$defs=a:i.definitions=a);try{let o=JSON.parse(JSON.stringify(i));return Object.defineProperty(o,"~standard",{value:{...e["~standard"],jsonSchema:{input:gl(e,"input",t.processors),output:gl(e,"output",t.processors)}},enumerable:!1,writable:!1}),o}catch{throw new Error("Error converting schema to JSON.")}}function xr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return xr(n.element,r);if(n.type==="set")return xr(n.valueType,r);if(n.type==="lazy")return xr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return xr(n.innerType,r);if(n.type==="intersection")return xr(n.left,r)||xr(n.right,r);if(n.type==="record"||n.type==="map")return xr(n.keyType,r)||xr(n.valueType,r);if(n.type==="pipe")return xr(n.in,r)||xr(n.out,r);if(n.type==="object"){for(let i in n.shape)if(xr(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(xr(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(xr(i,r))return!0;return!!(n.rest&&xr(n.rest,r))}return!1}var MC=(t,e={})=>r=>{let n=co({...r,processors:e});return Ae(t,n),lo(n,t),uo(n,t)},gl=(t,e,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=co({...i??{},target:a,io:e,processors:r});return Ae(t,o),lo(o,t),uo(o,t)};var lte={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},LC=(t,e,r,n)=>{let i=r;i.type="string";let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof a=="number"&&(i.minLength=a),typeof o=="number"&&(i.maxLength=o),s&&(i.format=lte[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let u=[...c];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zC=(t,e,r,n)=>{let i=r,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=t._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a=="number"&&(i.minimum=a,typeof u=="number"&&e.target!=="draft-04"&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o=="number"&&(i.maximum=o,typeof l=="number"&&e.target!=="draft-04"&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},UC=(t,e,r,n)=>{r.type="boolean"},FC=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},qC=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},BC=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},VC=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},WC=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},HC=(t,e,r,n)=>{r.not={}},ZC=(t,e,r,n)=>{},GC=(t,e,r,n)=>{},KC=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},JC=(t,e,r,n)=>{let i=t._zod.def,a=Zd(i.entries);a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),r.enum=a},YC=(t,e,r,n)=>{let i=t._zod.def,a=[];for(let o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let o=a[0];r.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[o]:r.const=o}else a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),a.every(o=>typeof o=="boolean")&&(r.type="boolean"),a.every(o=>o===null)&&(r.type="null"),r.enum=a},XC=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},QC=(t,e,r,n)=>{let i=r,a=t._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=a.source},e0=(t,e,r,n)=>{let i=r,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:c}=t._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(i,a)},t0=(t,e,r,n)=>{r.type="boolean"},r0=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},n0=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},i0=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},a0=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},o0=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},s0=(t,e,r,n)=>{let i=r,a=t._zod.def,{minimum:o,maximum:s}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=Ae(a.element,e,{...n,path:[...n.path,"items"]})},c0=(t,e,r,n)=>{let i=r,a=t._zod.def;i.type="object",i.properties={};let o=a.shape;for(let l in o)i.properties[l]=Ae(o[l],e,{...n,path:[...n.path,"properties",l]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(l=>{let u=a.shape[l]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type==="never"?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ae(a.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},Vv=(t,e,r,n)=>{let i=t._zod.def,a=i.inclusive===!1,o=i.options.map((s,c)=>Ae(s,e,{...n,path:[...n.path,a?"oneOf":"anyOf",c]}));a?r.oneOf=o:r.anyOf=o},l0=(t,e,r,n)=>{let i=t._zod.def,a=Ae(i.left,e,{...n,path:[...n.path,"allOf",0]}),o=Ae(i.right,e,{...n,path:[...n.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];r.allOf=c},u0=(t,e,r,n)=>{let i=r,a=t._zod.def;i.type="array";let o=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=a.items.map((p,m)=>Ae(p,e,{...n,path:[...n.path,o,m]})),l=a.rest?Ae(a.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[a.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=c,l&&(i.items=l)):e.target==="openapi-3.0"?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=t._zod.bag;typeof u=="number"&&(i.minItems=u),typeof d=="number"&&(i.maxItems=d)},d0=(t,e,r,n)=>{let i=r,a=t._zod.def;i.type="object";let o=a.keyType,c=o._zod.bag?.patterns;if(a.mode==="loose"&&c&&c.size>0){let u=Ae(a.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Ae(a.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=Ae(a.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let l=o._zod.values;if(l){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},p0=(t,e,r,n)=>{let i=t._zod.def,a=Ae(i.innerType,e,n),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]},m0=(t,e,r,n)=>{let i=t._zod.def;Ae(i.innerType,e,n);let a=e.seen.get(t);a.ref=i.innerType},f0=(t,e,r,n)=>{let i=t._zod.def;Ae(i.innerType,e,n);let a=e.seen.get(t);a.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},g0=(t,e,r,n)=>{let i=t._zod.def;Ae(i.innerType,e,n);let a=e.seen.get(t);a.ref=i.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},h0=(t,e,r,n)=>{let i=t._zod.def;Ae(i.innerType,e,n);let a=e.seen.get(t);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o},y0=(t,e,r,n)=>{let i=t._zod.def,a=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Ae(a,e,n);let o=e.seen.get(t);o.ref=a},v0=(t,e,r,n)=>{let i=t._zod.def;Ae(i.innerType,e,n);let a=e.seen.get(t);a.ref=i.innerType,r.readOnly=!0},b0=(t,e,r,n)=>{let i=t._zod.def;Ae(i.innerType,e,n);let a=e.seen.get(t);a.ref=i.innerType},Wv=(t,e,r,n)=>{let i=t._zod.def;Ae(i.innerType,e,n);let a=e.seen.get(t);a.ref=i.innerType},_0=(t,e,r,n)=>{let i=t._zod.innerType;Ae(i,e,n);let a=e.seen.get(t);a.ref=i},Bv={string:LC,number:zC,boolean:UC,bigint:FC,symbol:qC,null:BC,undefined:VC,void:WC,never:HC,any:ZC,unknown:GC,date:KC,enum:JC,literal:YC,nan:XC,template_literal:QC,file:e0,success:t0,custom:r0,function:n0,transform:i0,map:a0,set:o0,array:s0,object:c0,union:Vv,intersection:l0,tuple:u0,record:d0,nullable:p0,nonoptional:m0,default:f0,prefault:g0,catch:h0,pipe:y0,readonly:v0,promise:b0,optional:Wv,lazy:_0};function hl(t,e){if("_idmap"in t){let n=t,i=co({...e,processors:Bv}),a={};for(let c of n._idmap.entries()){let[l,u]=c;Ae(u,i)}let o={},s={registry:n,uri:e?.uri,defs:a};i.external=s;for(let c of n._idmap.entries()){let[l,u]=c;lo(i,u),o[l]=uo(i,u)}if(Object.keys(a).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:a}}return{schemas:o}}let r=co({...e,processors:Bv});return Ae(t,r),lo(r,t),uo(r,t)}var Hv=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=co({processors:Bv,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return Ae(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),lo(this.ctx,e);let n=uo(this.ctx,e),{"~standard":i,...a}=n;return a}};var jM={};var Dp={};vr(Dp,{ZodAny:()=>F0,ZodArray:()=>W0,ZodBase64:()=>pb,ZodBase64URL:()=>mb,ZodBigInt:()=>Sl,ZodBigIntFormat:()=>hb,ZodBoolean:()=>xl,ZodCIDRv4:()=>ub,ZodCIDRv6:()=>db,ZodCUID:()=>nb,ZodCUID2:()=>ib,ZodCatch:()=>dk,ZodCodec:()=>Sb,ZodCustom:()=>Bp,ZodCustomStringFormat:()=>bl,ZodDate:()=>Lp,ZodDefault:()=>ak,ZodDiscriminatedUnion:()=>Z0,ZodE164:()=>fb,ZodEmail:()=>eb,ZodEmoji:()=>tb,ZodEnum:()=>yl,ZodExactOptional:()=>rk,ZodFile:()=>ek,ZodFunction:()=>_k,ZodGUID:()=>$p,ZodIPv4:()=>cb,ZodIPv6:()=>lb,ZodIntersection:()=>G0,ZodJWT:()=>gb,ZodKSUID:()=>sb,ZodLazy:()=>yk,ZodLiteral:()=>Q0,ZodMAC:()=>M0,ZodMap:()=>Y0,ZodNaN:()=>mk,ZodNanoID:()=>rb,ZodNever:()=>B0,ZodNonOptional:()=>_b,ZodNull:()=>U0,ZodNullable:()=>ik,ZodNumber:()=>_l,ZodNumberFormat:()=>Rs,ZodObject:()=>zp,ZodOptional:()=>bb,ZodPipe:()=>xb,ZodPrefault:()=>sk,ZodPromise:()=>bk,ZodReadonly:()=>fk,ZodRecord:()=>qp,ZodSet:()=>X0,ZodString:()=>vl,ZodStringFormat:()=>Le,ZodSuccess:()=>uk,ZodSymbol:()=>L0,ZodTemplateLiteral:()=>hk,ZodTransform:()=>tk,ZodTuple:()=>K0,ZodType:()=>ne,ZodULID:()=>ab,ZodURL:()=>Mp,ZodUUID:()=>vi,ZodUndefined:()=>z0,ZodUnion:()=>Up,ZodUnknown:()=>q0,ZodVoid:()=>V0,ZodXID:()=>ob,ZodXor:()=>H0,_ZodString:()=>Qv,_default:()=>ok,_function:()=>zL,any:()=>xL,array:()=>le,base64:()=>iL,base64url:()=>aL,bigint:()=>hL,boolean:()=>St,catch:()=>pk,check:()=>UL,cidrv4:()=>rL,cidrv6:()=>nL,codec:()=>jL,cuid:()=>GM,cuid2:()=>KM,custom:()=>wb,date:()=>wL,describe:()=>FL,discriminatedUnion:()=>Fp,e164:()=>oL,email:()=>LM,emoji:()=>HM,enum:()=>Yt,exactOptional:()=>nk,file:()=>OL,float32:()=>pL,float64:()=>mL,function:()=>zL,guid:()=>zM,hash:()=>dL,hex:()=>uL,hostname:()=>lL,httpUrl:()=>WM,instanceof:()=>BL,int:()=>Xv,int32:()=>fL,int64:()=>yL,intersection:()=>Il,ipv4:()=>QM,ipv6:()=>tL,json:()=>WL,jwt:()=>sL,keyof:()=>IL,ksuid:()=>XM,lazy:()=>vk,literal:()=>W,looseObject:()=>Jt,looseRecord:()=>RL,mac:()=>eL,map:()=>EL,meta:()=>qL,nan:()=>NL,nanoid:()=>ZM,nativeEnum:()=>TL,never:()=>yb,nonoptional:()=>lk,null:()=>wl,nullable:()=>Np,nullish:()=>DL,number:()=>Ce,object:()=>F,optional:()=>Ke,partialRecord:()=>kL,pipe:()=>jp,prefault:()=>ck,preprocess:()=>Vp,promise:()=>LL,readonly:()=>gk,record:()=>We,refine:()=>xk,set:()=>AL,strictObject:()=>PL,string:()=>C,stringFormat:()=>cL,stringbool:()=>VL,success:()=>$L,superRefine:()=>Sk,symbol:()=>bL,templateLiteral:()=>ML,transform:()=>vb,tuple:()=>J0,uint32:()=>gL,uint64:()=>vL,ulid:()=>JM,undefined:()=>_L,union:()=>$e,unknown:()=>ze,url:()=>VM,uuid:()=>UM,uuidv4:()=>FM,uuidv6:()=>qM,uuidv7:()=>BM,void:()=>SL,xid:()=>YM,xor:()=>CL});var Zv={};vr(Zv,{endsWith:()=>xs,gt:()=>qn,gte:()=>Kt,includes:()=>bs,length:()=>so,lowercase:()=>ys,lt:()=>Fn,lte:()=>_r,maxLength:()=>oo,maxSize:()=>ca,mime:()=>Ss,minLength:()=>yi,minSize:()=>Bn,multipleOf:()=>sa,negative:()=>Ep,nonnegative:()=>Tp,nonpositive:()=>Ap,normalize:()=>ws,overwrite:()=>bn,positive:()=>Rp,property:()=>Op,regex:()=>hs,size:()=>ao,slugify:()=>fl,startsWith:()=>_s,toLowerCase:()=>Ps,toUpperCase:()=>Cs,trim:()=>Is,uppercase:()=>vs});var po={};vr(po,{ZodISODate:()=>Kv,ZodISODateTime:()=>Gv,ZodISODuration:()=>Yv,ZodISOTime:()=>Jv,date:()=>S0,datetime:()=>x0,duration:()=>I0,time:()=>w0});var Gv=S("ZodISODateTime",(t,e)=>{ny.init(t,e),Le.init(t,e)});function x0(t){return lv(Gv,t)}var Kv=S("ZodISODate",(t,e)=>{iy.init(t,e),Le.init(t,e)});function S0(t){return uv(Kv,t)}var Jv=S("ZodISOTime",(t,e)=>{ay.init(t,e),Le.init(t,e)});function w0(t){return dv(Jv,t)}var Yv=S("ZodISODuration",(t,e)=>{oy.init(t,e),Le.init(t,e)});function I0(t){return pv(Yv,t)}var MM=(t,e)=>{Xd.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Xc(t,r)},flatten:{value:r=>Yc(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Gc,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Gc,2)}},isEmpty:{get(){return t.issues.length===0}}})},dte=S("ZodError",MM),Nr=S("ZodError",MM,{Parent:Error});var P0=Qc(Nr),C0=tl(Nr),k0=nl(Nr),R0=il(Nr),E0=Eh(Nr),A0=Ah(Nr),T0=Th(Nr),O0=Oh(Nr),D0=Dh(Nr),$0=$h(Nr),N0=Nh(Nr),j0=jh(Nr);var ne=S("ZodType",(t,e)=>(X.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:gl(t,"input"),output:gl(t,"output")}}),t.toJSONSchema=MC(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(T.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),t.with=t.check,t.clone=(r,n)=>Gt(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>P0(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>k0(t,r,n),t.parseAsync=async(r,n)=>C0(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>R0(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>E0(t,r,n),t.decode=(r,n)=>A0(t,r,n),t.encodeAsync=async(r,n)=>T0(t,r,n),t.decodeAsync=async(r,n)=>O0(t,r,n),t.safeEncode=(r,n)=>D0(t,r,n),t.safeDecode=(r,n)=>$0(t,r,n),t.safeEncodeAsync=async(r,n)=>N0(t,r,n),t.safeDecodeAsync=async(r,n)=>j0(t,r,n),t.refine=(r,n)=>t.check(xk(r,n)),t.superRefine=r=>t.check(Sk(r)),t.overwrite=r=>t.check(bn(r)),t.optional=()=>Ke(t),t.exactOptional=()=>nk(t),t.nullable=()=>Np(t),t.nullish=()=>Ke(Np(t)),t.nonoptional=r=>lk(t,r),t.array=()=>le(t),t.or=r=>$e([t,r]),t.and=r=>Il(t,r),t.transform=r=>jp(t,vb(r)),t.default=r=>ok(t,r),t.prefault=r=>ck(t,r),t.catch=r=>pk(t,r),t.pipe=r=>jp(t,r),t.readonly=()=>gk(t),t.describe=r=>{let n=t.clone();return Nt.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Nt.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Nt.get(t);let n=t.clone();return Nt.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),Qv=S("_ZodString",(t,e)=>{io.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(n,i,a)=>LC(t,n,i,a);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(hs(...n)),t.includes=(...n)=>t.check(bs(...n)),t.startsWith=(...n)=>t.check(_s(...n)),t.endsWith=(...n)=>t.check(xs(...n)),t.min=(...n)=>t.check(yi(...n)),t.max=(...n)=>t.check(oo(...n)),t.length=(...n)=>t.check(so(...n)),t.nonempty=(...n)=>t.check(yi(1,...n)),t.lowercase=n=>t.check(ys(n)),t.uppercase=n=>t.check(vs(n)),t.trim=()=>t.check(Is()),t.normalize=(...n)=>t.check(ws(...n)),t.toLowerCase=()=>t.check(Ps()),t.toUpperCase=()=>t.check(Cs()),t.slugify=()=>t.check(fl())}),vl=S("ZodString",(t,e)=>{io.init(t,e),Qv.init(t,e),t.email=r=>t.check(cp(eb,r)),t.url=r=>t.check(ml(Mp,r)),t.jwt=r=>t.check(kp(gb,r)),t.emoji=r=>t.check(mp(tb,r)),t.guid=r=>t.check(pl($p,r)),t.uuid=r=>t.check(lp(vi,r)),t.uuidv4=r=>t.check(up(vi,r)),t.uuidv6=r=>t.check(dp(vi,r)),t.uuidv7=r=>t.check(pp(vi,r)),t.nanoid=r=>t.check(fp(rb,r)),t.guid=r=>t.check(pl($p,r)),t.cuid=r=>t.check(gp(nb,r)),t.cuid2=r=>t.check(hp(ib,r)),t.ulid=r=>t.check(yp(ab,r)),t.base64=r=>t.check(Ip(pb,r)),t.base64url=r=>t.check(Pp(mb,r)),t.xid=r=>t.check(vp(ob,r)),t.ksuid=r=>t.check(bp(sb,r)),t.ipv4=r=>t.check(_p(cb,r)),t.ipv6=r=>t.check(xp(lb,r)),t.cidrv4=r=>t.check(Sp(ub,r)),t.cidrv6=r=>t.check(wp(db,r)),t.e164=r=>t.check(Cp(fb,r)),t.datetime=r=>t.check(x0(r)),t.date=r=>t.check(S0(r)),t.time=r=>t.check(w0(r)),t.duration=r=>t.check(I0(r))});function C(t){return av(vl,t)}var Le=S("ZodStringFormat",(t,e)=>{De.init(t,e),Qv.init(t,e)}),eb=S("ZodEmail",(t,e)=>{Gh.init(t,e),Le.init(t,e)});function LM(t){return cp(eb,t)}var $p=S("ZodGUID",(t,e)=>{Hh.init(t,e),Le.init(t,e)});function zM(t){return pl($p,t)}var vi=S("ZodUUID",(t,e)=>{Zh.init(t,e),Le.init(t,e)});function UM(t){return lp(vi,t)}function FM(t){return up(vi,t)}function qM(t){return dp(vi,t)}function BM(t){return pp(vi,t)}var Mp=S("ZodURL",(t,e)=>{Kh.init(t,e),Le.init(t,e)});function VM(t){return ml(Mp,t)}function WM(t){return ml(Mp,{protocol:/^https?$/,hostname:$r.domain,...T.normalizeParams(t)})}var tb=S("ZodEmoji",(t,e)=>{Jh.init(t,e),Le.init(t,e)});function HM(t){return mp(tb,t)}var rb=S("ZodNanoID",(t,e)=>{Yh.init(t,e),Le.init(t,e)});function ZM(t){return fp(rb,t)}var nb=S("ZodCUID",(t,e)=>{Xh.init(t,e),Le.init(t,e)});function GM(t){return gp(nb,t)}var ib=S("ZodCUID2",(t,e)=>{Qh.init(t,e),Le.init(t,e)});function KM(t){return hp(ib,t)}var ab=S("ZodULID",(t,e)=>{ey.init(t,e),Le.init(t,e)});function JM(t){return yp(ab,t)}var ob=S("ZodXID",(t,e)=>{ty.init(t,e),Le.init(t,e)});function YM(t){return vp(ob,t)}var sb=S("ZodKSUID",(t,e)=>{ry.init(t,e),Le.init(t,e)});function XM(t){return bp(sb,t)}var cb=S("ZodIPv4",(t,e)=>{sy.init(t,e),Le.init(t,e)});function QM(t){return _p(cb,t)}var M0=S("ZodMAC",(t,e)=>{ly.init(t,e),Le.init(t,e)});function eL(t){return sv(M0,t)}var lb=S("ZodIPv6",(t,e)=>{cy.init(t,e),Le.init(t,e)});function tL(t){return xp(lb,t)}var ub=S("ZodCIDRv4",(t,e)=>{uy.init(t,e),Le.init(t,e)});function rL(t){return Sp(ub,t)}var db=S("ZodCIDRv6",(t,e)=>{dy.init(t,e),Le.init(t,e)});function nL(t){return wp(db,t)}var pb=S("ZodBase64",(t,e)=>{py.init(t,e),Le.init(t,e)});function iL(t){return Ip(pb,t)}var mb=S("ZodBase64URL",(t,e)=>{my.init(t,e),Le.init(t,e)});function aL(t){return Pp(mb,t)}var fb=S("ZodE164",(t,e)=>{fy.init(t,e),Le.init(t,e)});function oL(t){return Cp(fb,t)}var gb=S("ZodJWT",(t,e)=>{gy.init(t,e),Le.init(t,e)});function sL(t){return kp(gb,t)}var bl=S("ZodCustomStringFormat",(t,e)=>{hy.init(t,e),Le.init(t,e)});function cL(t,e,r={}){return ks(bl,t,e,r)}function lL(t){return ks(bl,"hostname",$r.hostname,t)}function uL(t){return ks(bl,"hex",$r.hex,t)}function dL(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,i=$r[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return ks(bl,n,i,e)}var _l=S("ZodNumber",(t,e)=>{rp.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(n,i,a)=>zC(t,n,i,a),t.gt=(n,i)=>t.check(qn(n,i)),t.gte=(n,i)=>t.check(Kt(n,i)),t.min=(n,i)=>t.check(Kt(n,i)),t.lt=(n,i)=>t.check(Fn(n,i)),t.lte=(n,i)=>t.check(_r(n,i)),t.max=(n,i)=>t.check(_r(n,i)),t.int=n=>t.check(Xv(n)),t.safe=n=>t.check(Xv(n)),t.positive=n=>t.check(qn(0,n)),t.nonnegative=n=>t.check(Kt(0,n)),t.negative=n=>t.check(Fn(0,n)),t.nonpositive=n=>t.check(_r(0,n)),t.multipleOf=(n,i)=>t.check(sa(n,i)),t.step=(n,i)=>t.check(sa(n,i)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function Ce(t){return mv(_l,t)}var Rs=S("ZodNumberFormat",(t,e)=>{yy.init(t,e),_l.init(t,e)});function Xv(t){return gv(Rs,t)}function pL(t){return hv(Rs,t)}function mL(t){return yv(Rs,t)}function fL(t){return vv(Rs,t)}function gL(t){return bv(Rs,t)}var xl=S("ZodBoolean",(t,e)=>{sl.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>UC(t,r,n,i)});function St(t){return _v(xl,t)}var Sl=S("ZodBigInt",(t,e)=>{np.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(n,i,a)=>FC(t,n,i,a),t.gte=(n,i)=>t.check(Kt(n,i)),t.min=(n,i)=>t.check(Kt(n,i)),t.gt=(n,i)=>t.check(qn(n,i)),t.gte=(n,i)=>t.check(Kt(n,i)),t.min=(n,i)=>t.check(Kt(n,i)),t.lt=(n,i)=>t.check(Fn(n,i)),t.lte=(n,i)=>t.check(_r(n,i)),t.max=(n,i)=>t.check(_r(n,i)),t.positive=n=>t.check(qn(BigInt(0),n)),t.negative=n=>t.check(Fn(BigInt(0),n)),t.nonpositive=n=>t.check(_r(BigInt(0),n)),t.nonnegative=n=>t.check(Kt(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(sa(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function hL(t){return Sv(Sl,t)}var hb=S("ZodBigIntFormat",(t,e)=>{vy.init(t,e),Sl.init(t,e)});function yL(t){return Iv(hb,t)}function vL(t){return Pv(hb,t)}var L0=S("ZodSymbol",(t,e)=>{by.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>qC(t,r,n,i)});function bL(t){return Cv(L0,t)}var z0=S("ZodUndefined",(t,e)=>{_y.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>VC(t,r,n,i)});function _L(t){return kv(z0,t)}var U0=S("ZodNull",(t,e)=>{xy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>BC(t,r,n,i)});function wl(t){return Rv(U0,t)}var F0=S("ZodAny",(t,e)=>{Sy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>ZC(t,r,n,i)});function xL(){return Ev(F0)}var q0=S("ZodUnknown",(t,e)=>{wy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>GC(t,r,n,i)});function ze(){return Av(q0)}var B0=S("ZodNever",(t,e)=>{Iy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>HC(t,r,n,i)});function yb(t){return Tv(B0,t)}var V0=S("ZodVoid",(t,e)=>{Py.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>WC(t,r,n,i)});function SL(t){return Ov(V0,t)}var Lp=S("ZodDate",(t,e)=>{Cy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(n,i,a)=>KC(t,n,i,a),t.min=(n,i)=>t.check(Kt(n,i)),t.max=(n,i)=>t.check(_r(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function wL(t){return Dv(Lp,t)}var W0=S("ZodArray",(t,e)=>{ky.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>s0(t,r,n,i),t.element=e.element,t.min=(r,n)=>t.check(yi(r,n)),t.nonempty=r=>t.check(yi(1,r)),t.max=(r,n)=>t.check(oo(r,n)),t.length=(r,n)=>t.check(so(r,n)),t.unwrap=()=>t.element});function le(t,e){return jC(W0,t,e)}function IL(t){let e=t._zod.def.shape;return Yt(Object.keys(e))}var zp=S("ZodObject",(t,e)=>{NC.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>c0(t,r,n,i),T.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Yt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ze()}),t.loose=()=>t.clone({...t._zod.def,catchall:ze()}),t.strict=()=>t.clone({...t._zod.def,catchall:yb()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>T.extend(t,r),t.safeExtend=r=>T.safeExtend(t,r),t.merge=r=>T.merge(t,r),t.pick=r=>T.pick(t,r),t.omit=r=>T.omit(t,r),t.partial=(...r)=>T.partial(bb,t,r[0]),t.required=(...r)=>T.required(_b,t,r[0])});function F(t,e){let r={type:"object",shape:t??{},...T.normalizeParams(e)};return new zp(r)}function PL(t,e){return new zp({type:"object",shape:t,catchall:yb(),...T.normalizeParams(e)})}function Jt(t,e){return new zp({type:"object",shape:t,catchall:ze(),...T.normalizeParams(e)})}var Up=S("ZodUnion",(t,e)=>{cl.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Vv(t,r,n,i),t.options=e.options});function $e(t,e){return new Up({type:"union",options:t,...T.normalizeParams(e)})}var H0=S("ZodXor",(t,e)=>{Up.init(t,e),Ry.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Vv(t,r,n,i),t.options=e.options});function CL(t,e){return new H0({type:"union",options:t,inclusive:!1,...T.normalizeParams(e)})}var Z0=S("ZodDiscriminatedUnion",(t,e)=>{Up.init(t,e),Ey.init(t,e)});function Fp(t,e,r){return new Z0({type:"union",options:e,discriminator:t,...T.normalizeParams(r)})}var G0=S("ZodIntersection",(t,e)=>{Ay.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>l0(t,r,n,i)});function Il(t,e){return new G0({type:"intersection",left:t,right:e})}var K0=S("ZodTuple",(t,e)=>{ip.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>u0(t,r,n,i),t.rest=r=>t.clone({...t._zod.def,rest:r})});function J0(t,e,r){let n=e instanceof X,i=n?r:e,a=n?e:null;return new K0({type:"tuple",items:t,rest:a,...T.normalizeParams(i)})}var qp=S("ZodRecord",(t,e)=>{Ty.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>d0(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType});function We(t,e,r){return new qp({type:"record",keyType:t,valueType:e,...T.normalizeParams(r)})}function kL(t,e,r){let n=Gt(t);return n._zod.values=void 0,new qp({type:"record",keyType:n,valueType:e,...T.normalizeParams(r)})}function RL(t,e,r){return new qp({type:"record",keyType:t,valueType:e,mode:"loose",...T.normalizeParams(r)})}var Y0=S("ZodMap",(t,e)=>{Oy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>a0(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(Bn(...r)),t.nonempty=r=>t.check(Bn(1,r)),t.max=(...r)=>t.check(ca(...r)),t.size=(...r)=>t.check(ao(...r))});function EL(t,e,r){return new Y0({type:"map",keyType:t,valueType:e,...T.normalizeParams(r)})}var X0=S("ZodSet",(t,e)=>{Dy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>o0(t,r,n,i),t.min=(...r)=>t.check(Bn(...r)),t.nonempty=r=>t.check(Bn(1,r)),t.max=(...r)=>t.check(ca(...r)),t.size=(...r)=>t.check(ao(...r))});function AL(t,e){return new X0({type:"set",valueType:t,...T.normalizeParams(e)})}var yl=S("ZodEnum",(t,e)=>{$y.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(n,i,a)=>JC(t,n,i,a),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let a={};for(let o of n)if(r.has(o))a[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new yl({...e,checks:[],...T.normalizeParams(i),entries:a})},t.exclude=(n,i)=>{let a={...e.entries};for(let o of n)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new yl({...e,checks:[],...T.normalizeParams(i),entries:a})}});function Yt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new yl({type:"enum",entries:r,...T.normalizeParams(e)})}function TL(t,e){return new yl({type:"enum",entries:t,...T.normalizeParams(e)})}var Q0=S("ZodLiteral",(t,e)=>{Ny.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>YC(t,r,n,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function W(t,e){return new Q0({type:"literal",values:Array.isArray(t)?t:[t],...T.normalizeParams(e)})}var ek=S("ZodFile",(t,e)=>{jy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>e0(t,r,n,i),t.min=(r,n)=>t.check(Bn(r,n)),t.max=(r,n)=>t.check(ca(r,n)),t.mime=(r,n)=>t.check(Ss(Array.isArray(r)?r:[r],n))});function OL(t){return jv(ek,t)}var tk=S("ZodTransform",(t,e)=>{My.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>i0(t,r,n,i),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Qa(t.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(T.issue(a,r.value,e));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),r.issues.push(T.issue(o))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(a=>(r.value=a,r)):(r.value=i,r)}});function vb(t){return new tk({type:"transform",transform:t})}var bb=S("ZodOptional",(t,e)=>{ap.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Wv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Ke(t){return new bb({type:"optional",innerType:t})}var rk=S("ZodExactOptional",(t,e)=>{Ly.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Wv(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function nk(t){return new rk({type:"optional",innerType:t})}var ik=S("ZodNullable",(t,e)=>{zy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>p0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Np(t){return new ik({type:"nullable",innerType:t})}function DL(t){return Ke(Np(t))}var ak=S("ZodDefault",(t,e)=>{Uy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>f0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function ok(t,e){return new ak({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():T.shallowClone(e)}})}var sk=S("ZodPrefault",(t,e)=>{Fy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>g0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function ck(t,e){return new sk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():T.shallowClone(e)}})}var _b=S("ZodNonOptional",(t,e)=>{qy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>m0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function lk(t,e){return new _b({type:"nonoptional",innerType:t,...T.normalizeParams(e)})}var uk=S("ZodSuccess",(t,e)=>{By.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>t0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function $L(t){return new uk({type:"success",innerType:t})}var dk=S("ZodCatch",(t,e)=>{Vy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>h0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function pk(t,e){return new dk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var mk=S("ZodNaN",(t,e)=>{Wy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>XC(t,r,n,i)});function NL(t){return Nv(mk,t)}var xb=S("ZodPipe",(t,e)=>{Hy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>y0(t,r,n,i),t.in=e.in,t.out=e.out});function jp(t,e){return new xb({type:"pipe",in:t,out:e})}var Sb=S("ZodCodec",(t,e)=>{xb.init(t,e),ll.init(t,e)});function jL(t,e,r){return new Sb({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var fk=S("ZodReadonly",(t,e)=>{Zy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>v0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function gk(t){return new fk({type:"readonly",innerType:t})}var hk=S("ZodTemplateLiteral",(t,e)=>{Gy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>QC(t,r,n,i)});function ML(t,e){return new hk({type:"template_literal",parts:t,...T.normalizeParams(e)})}var yk=S("ZodLazy",(t,e)=>{Yy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>_0(t,r,n,i),t.unwrap=()=>t._zod.def.getter()});function vk(t){return new yk({type:"lazy",getter:t})}var bk=S("ZodPromise",(t,e)=>{Jy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>b0(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function LL(t){return new bk({type:"promise",innerType:t})}var _k=S("ZodFunction",(t,e)=>{Ky.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>n0(t,r,n,i)});function zL(t){return new _k({type:"function",input:Array.isArray(t?.input)?J0(t?.input):t?.input??le(ze()),output:t?.output??ze()})}var Bp=S("ZodCustom",(t,e)=>{Xy.init(t,e),ne.init(t,e),t._zod.processJSONSchema=(r,n,i)=>r0(t,r,n,i)});function UL(t){let e=new Me({check:"custom"});return e._zod.check=t,e}function wb(t,e){return Mv(Bp,t??(()=>!0),e)}function xk(t,e={}){return Lv(Bp,t,e)}function Sk(t){return zv(t)}var FL=Uv,qL=Fv;function BL(t,e={}){let r=new Bp({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...T.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var VL=(...t)=>qv({Codec:Sb,Boolean:xl,String:vl},...t);function WL(t){let e=vk(()=>$e([C(t),Ce(),St(),wl(),le(e),We(C(),e)]));return e}function Vp(t,e){return jp(vb(t),e)}var mte={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function fte(t){mt({customError:t})}function gte(){return mt().customError}var wk;wk||(wk={});var L={...Dp,...Zv,iso:po},hte=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function yte(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function vte(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let n=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${t}`);return e.defs[i]}throw new Error(`Reference not found: ${t}`)}function HL(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return L.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let i=t.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return L.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let a=vte(i,e),o=or(a,e);return e.refs.set(i,o),e.processing.delete(i),o}if(t.enum!==void 0){let i=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&i.length===1&&i[0]===null)return L.null();if(i.length===0)return L.never();if(i.length===1)return L.literal(i[0]);if(i.every(o=>typeof o=="string"))return L.enum(i);let a=i.map(o=>L.literal(o));return a.length<2?a[0]:L.union([a[0],a[1],...a.slice(2)])}if(t.const!==void 0)return L.literal(t.const);let r=t.type;if(Array.isArray(r)){let i=r.map(a=>{let o={...t,type:a};return HL(o,e)});return i.length===0?L.never():i.length===1?i[0]:L.union(i)}if(!r)return L.any();let n;switch(r){case"string":{let i=L.string();if(t.format){let a=t.format;a==="email"?i=i.check(L.email()):a==="uri"||a==="uri-reference"?i=i.check(L.url()):a==="uuid"||a==="guid"?i=i.check(L.uuid()):a==="date-time"?i=i.check(L.iso.datetime()):a==="date"?i=i.check(L.iso.date()):a==="time"?i=i.check(L.iso.time()):a==="duration"?i=i.check(L.iso.duration()):a==="ipv4"?i=i.check(L.ipv4()):a==="ipv6"?i=i.check(L.ipv6()):a==="mac"?i=i.check(L.mac()):a==="cidr"?i=i.check(L.cidrv4()):a==="cidr-v6"?i=i.check(L.cidrv6()):a==="base64"?i=i.check(L.base64()):a==="base64url"?i=i.check(L.base64url()):a==="e164"?i=i.check(L.e164()):a==="jwt"?i=i.check(L.jwt()):a==="emoji"?i=i.check(L.emoji()):a==="nanoid"?i=i.check(L.nanoid()):a==="cuid"?i=i.check(L.cuid()):a==="cuid2"?i=i.check(L.cuid2()):a==="ulid"?i=i.check(L.ulid()):a==="xid"?i=i.check(L.xid()):a==="ksuid"&&(i=i.check(L.ksuid()))}typeof t.minLength=="number"&&(i=i.min(t.minLength)),typeof t.maxLength=="number"&&(i=i.max(t.maxLength)),t.pattern&&(i=i.regex(new RegExp(t.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?L.number().int():L.number();typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),typeof t.exclusiveMinimum=="number"?i=i.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(i=i.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?i=i.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(i=i.lt(t.maximum)),typeof t.multipleOf=="number"&&(i=i.multipleOf(t.multipleOf)),n=i;break}case"boolean":{n=L.boolean();break}case"null":{n=L.null();break}case"object":{let i={},a=t.properties||{},o=new Set(t.required||[]);for(let[c,l]of Object.entries(a)){let u=or(l,e);i[c]=o.has(c)?u:u.optional()}if(t.propertyNames){let c=or(t.propertyNames,e),l=t.additionalProperties&&typeof t.additionalProperties=="object"?or(t.additionalProperties,e):L.any();if(Object.keys(i).length===0){n=L.record(c,l);break}let u=L.object(i).passthrough(),d=L.looseRecord(c,l);n=L.intersection(u,d);break}if(t.patternProperties){let c=t.patternProperties,l=Object.keys(c),u=[];for(let p of l){let m=or(c[p],e),f=L.string().regex(new RegExp(p));u.push(L.looseRecord(f,m))}let d=[];if(Object.keys(i).length>0&&d.push(L.object(i).passthrough()),d.push(...u),d.length===0)n=L.object({}).passthrough();else if(d.length===1)n=d[0];else{let p=L.intersection(d[0],d[1]);for(let m=2;m<d.length;m++)p=L.intersection(p,d[m]);n=p}break}let s=L.object(i);t.additionalProperties===!1?n=s.strict():typeof t.additionalProperties=="object"?n=s.catchall(or(t.additionalProperties,e)):n=s.passthrough();break}case"array":{let i=t.prefixItems,a=t.items;if(i&&Array.isArray(i)){let o=i.map(c=>or(c,e)),s=a&&typeof a=="object"&&!Array.isArray(a)?or(a,e):void 0;s?n=L.tuple(o).rest(s):n=L.tuple(o),typeof t.minItems=="number"&&(n=n.check(L.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(L.maxLength(t.maxItems)))}else if(Array.isArray(a)){let o=a.map(c=>or(c,e)),s=t.additionalItems&&typeof t.additionalItems=="object"?or(t.additionalItems,e):void 0;s?n=L.tuple(o).rest(s):n=L.tuple(o),typeof t.minItems=="number"&&(n=n.check(L.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(L.maxLength(t.maxItems)))}else if(a!==void 0){let o=or(a,e),s=L.array(o);typeof t.minItems=="number"&&(s=s.min(t.minItems)),typeof t.maxItems=="number"&&(s=s.max(t.maxItems)),n=s}else n=L.array(L.any());break}default:throw new Error(`Unsupported type: ${r}`)}return t.description&&(n=n.describe(t.description)),t.default!==void 0&&(n=n.default(t.default)),n}function or(t,e){if(typeof t=="boolean")return t?L.any():L.never();let r=HL(t,e),n=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let s=t.anyOf.map(l=>or(l,e)),c=L.union(s);r=n?L.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let s=t.oneOf.map(l=>or(l,e)),c=L.xor(s);r=n?L.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=n?r:L.any();else{let s=n?r:or(t.allOf[0],e),c=n?0:1;for(let l=c;l<t.allOf.length;l++)s=L.intersection(s,or(t.allOf[l],e));r=s}t.nullable===!0&&e.version==="openapi-3.0"&&(r=L.nullable(r)),t.readOnly===!0&&(r=L.readonly(r));let i={},a=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of a)s in t&&(i[s]=t[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in t&&(i[s]=t[s]);for(let s of Object.keys(t))hte.has(s)||(i[s]=t[s]);return Object.keys(i).length>0&&e.registry.add(r,i),r}function ZL(t,e){if(typeof t=="boolean")return t?L.any():L.never();let r=yte(t,e?.defaultTarget),n=t.$defs||t.definitions||{},i={version:r,defs:n,refs:new Map,processing:new Set,rootSchema:t,registry:e?.registry??Nt};return or(t,i)}var Ik={};vr(Ik,{bigint:()=>Ste,boolean:()=>xte,date:()=>wte,number:()=>_te,string:()=>bte});function bte(t){return ov(vl,t)}function _te(t){return fv(_l,t)}function xte(t){return xv(xl,t)}function Ste(t){return wv(Sl,t)}function wte(t){return $v(Lp,t)}mt(Qy());var Ck="2025-11-25";var GL=[Ck,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],mo="io.modelcontextprotocol/related-task",Pb="2.0",Xt=wb(t=>t!==null&&(typeof t=="object"||typeof t=="function")),KL=$e([C(),Ce().int()]),JL=C(),ELe=Jt({ttl:$e([Ce(),wl()]).optional(),pollInterval:Ce().optional()}),Pte=F({ttl:Ce().optional()}),Cte=F({taskId:C()}),kk=Jt({progressToken:KL.optional(),[mo]:Cte.optional()}),rn=F({_meta:kk.optional()}),Wp=rn.extend({task:Pte.optional()}),YL=t=>Wp.safeParse(t).success,Qt=F({method:C(),params:rn.loose().optional()}),_n=F({_meta:kk.optional()}),xn=F({method:C(),params:_n.loose().optional()}),er=Jt({_meta:kk.optional()}),Cb=$e([C(),Ce().int()]),XL=F({jsonrpc:W(Pb),id:Cb,...Qt.shape}).strict(),Rk=t=>XL.safeParse(t).success,QL=F({jsonrpc:W(Pb),...xn.shape}).strict(),e4=t=>QL.safeParse(t).success,Ek=F({jsonrpc:W(Pb),id:Cb,result:er}).strict(),Hp=t=>Ek.safeParse(t).success;var ve;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ve||(ve={}));var Ak=F({jsonrpc:W(Pb),id:Cb.optional(),error:F({code:Ce().int(),message:C(),data:ze().optional()})}).strict();var t4=t=>Ak.safeParse(t).success;var r4=$e([XL,QL,Ek,Ak]),ALe=$e([Ek,Ak]),kb=er.strict(),kte=_n.extend({requestId:Cb.optional(),reason:C().optional()}),Rb=xn.extend({method:W("notifications/cancelled"),params:kte}),Rte=F({src:C(),mimeType:C().optional(),sizes:le(C()).optional(),theme:Yt(["light","dark"]).optional()}),Zp=F({icons:le(Rte).optional()}),Pl=F({name:C(),title:C().optional()}),n4=Pl.extend({...Pl.shape,...Zp.shape,version:C(),websiteUrl:C().optional(),description:C().optional()}),Ete=Il(F({applyDefaults:St().optional()}),We(C(),ze())),Ate=Vp(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Il(F({form:Ete.optional(),url:Xt.optional()}),We(C(),ze()).optional())),Tte=Jt({list:Xt.optional(),cancel:Xt.optional(),requests:Jt({sampling:Jt({createMessage:Xt.optional()}).optional(),elicitation:Jt({create:Xt.optional()}).optional()}).optional()}),Ote=Jt({list:Xt.optional(),cancel:Xt.optional(),requests:Jt({tools:Jt({call:Xt.optional()}).optional()}).optional()}),Dte=F({experimental:We(C(),Xt).optional(),sampling:F({context:Xt.optional(),tools:Xt.optional()}).optional(),elicitation:Ate.optional(),roots:F({listChanged:St().optional()}).optional(),tasks:Tte.optional()}),$te=rn.extend({protocolVersion:C(),capabilities:Dte,clientInfo:n4}),Tk=Qt.extend({method:W("initialize"),params:$te});var Nte=F({experimental:We(C(),Xt).optional(),logging:Xt.optional(),completions:Xt.optional(),prompts:F({listChanged:St().optional()}).optional(),resources:F({subscribe:St().optional(),listChanged:St().optional()}).optional(),tools:F({listChanged:St().optional()}).optional(),tasks:Ote.optional()}),jte=er.extend({protocolVersion:C(),capabilities:Nte,serverInfo:n4,instructions:C().optional()}),Ok=xn.extend({method:W("notifications/initialized"),params:_n.optional()});var Eb=Qt.extend({method:W("ping"),params:rn.optional()}),Mte=F({progress:Ce(),total:Ke(Ce()),message:Ke(C())}),Lte=F({..._n.shape,...Mte.shape,progressToken:KL}),Ab=xn.extend({method:W("notifications/progress"),params:Lte}),zte=rn.extend({cursor:JL.optional()}),Gp=Qt.extend({params:zte.optional()}),Kp=er.extend({nextCursor:JL.optional()}),Ute=Yt(["working","input_required","completed","failed","cancelled"]),Jp=F({taskId:C(),status:Ute,ttl:$e([Ce(),wl()]),createdAt:C(),lastUpdatedAt:C(),pollInterval:Ke(Ce()),statusMessage:Ke(C())}),Cl=er.extend({task:Jp}),Fte=_n.merge(Jp),Yp=xn.extend({method:W("notifications/tasks/status"),params:Fte}),Tb=Qt.extend({method:W("tasks/get"),params:rn.extend({taskId:C()})}),Ob=er.merge(Jp),Db=Qt.extend({method:W("tasks/result"),params:rn.extend({taskId:C()})}),TLe=er.loose(),$b=Gp.extend({method:W("tasks/list")}),Nb=Kp.extend({tasks:le(Jp)}),jb=Qt.extend({method:W("tasks/cancel"),params:rn.extend({taskId:C()})}),i4=er.merge(Jp),a4=F({uri:C(),mimeType:Ke(C()),_meta:We(C(),ze()).optional()}),o4=a4.extend({text:C()}),Dk=C().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),s4=a4.extend({blob:Dk}),Xp=Yt(["user","assistant"]),kl=F({audience:le(Xp).optional(),priority:Ce().min(0).max(1).optional(),lastModified:po.datetime({offset:!0}).optional()}),c4=F({...Pl.shape,...Zp.shape,uri:C(),description:Ke(C()),mimeType:Ke(C()),annotations:kl.optional(),_meta:Ke(Jt({}))}),qte=F({...Pl.shape,...Zp.shape,uriTemplate:C(),description:Ke(C()),mimeType:Ke(C()),annotations:kl.optional(),_meta:Ke(Jt({}))}),$k=Gp.extend({method:W("resources/list")}),Bte=Kp.extend({resources:le(c4)}),Vte=Gp.extend({method:W("resources/templates/list")}),Wte=Kp.extend({resourceTemplates:le(qte)}),Nk=rn.extend({uri:C()}),Hte=Nk,jk=Qt.extend({method:W("resources/read"),params:Hte}),Zte=er.extend({contents:le($e([o4,s4]))}),Gte=xn.extend({method:W("notifications/resources/list_changed"),params:_n.optional()}),Kte=Nk,Jte=Qt.extend({method:W("resources/subscribe"),params:Kte}),Yte=Nk,Xte=Qt.extend({method:W("resources/unsubscribe"),params:Yte}),Qte=_n.extend({uri:C()}),ere=xn.extend({method:W("notifications/resources/updated"),params:Qte}),tre=F({name:C(),description:Ke(C()),required:Ke(St())}),rre=F({...Pl.shape,...Zp.shape,description:Ke(C()),arguments:Ke(le(tre)),_meta:Ke(Jt({}))}),nre=Gp.extend({method:W("prompts/list")}),ire=Kp.extend({prompts:le(rre)}),are=rn.extend({name:C(),arguments:We(C(),C()).optional()}),ore=Qt.extend({method:W("prompts/get"),params:are}),Mk=F({type:W("text"),text:C(),annotations:kl.optional(),_meta:We(C(),ze()).optional()}),Lk=F({type:W("image"),data:Dk,mimeType:C(),annotations:kl.optional(),_meta:We(C(),ze()).optional()}),zk=F({type:W("audio"),data:Dk,mimeType:C(),annotations:kl.optional(),_meta:We(C(),ze()).optional()}),sre=F({type:W("tool_use"),name:C(),id:C(),input:We(C(),ze()),_meta:We(C(),ze()).optional()}),cre=F({type:W("resource"),resource:$e([o4,s4]),annotations:kl.optional(),_meta:We(C(),ze()).optional()}),lre=c4.extend({type:W("resource_link")}),Uk=$e([Mk,Lk,zk,lre,cre]),ure=F({role:Xp,content:Uk}),dre=er.extend({description:C().optional(),messages:le(ure)}),pre=xn.extend({method:W("notifications/prompts/list_changed"),params:_n.optional()}),mre=F({title:C().optional(),readOnlyHint:St().optional(),destructiveHint:St().optional(),idempotentHint:St().optional(),openWorldHint:St().optional()}),fre=F({taskSupport:Yt(["required","optional","forbidden"]).optional()}),l4=F({...Pl.shape,...Zp.shape,description:C().optional(),inputSchema:F({type:W("object"),properties:We(C(),Xt).optional(),required:le(C()).optional()}).catchall(ze()),outputSchema:F({type:W("object"),properties:We(C(),Xt).optional(),required:le(C()).optional()}).catchall(ze()).optional(),annotations:mre.optional(),execution:fre.optional(),_meta:We(C(),ze()).optional()}),Fk=Gp.extend({method:W("tools/list")}),gre=Kp.extend({tools:le(l4)}),Mb=er.extend({content:le(Uk).default([]),structuredContent:We(C(),ze()).optional(),isError:St().optional()}),OLe=Mb.or(er.extend({toolResult:ze()})),hre=Wp.extend({name:C(),arguments:We(C(),ze()).optional()}),Qp=Qt.extend({method:W("tools/call"),params:hre}),yre=xn.extend({method:W("notifications/tools/list_changed"),params:_n.optional()}),DLe=F({autoRefresh:St().default(!0),debounceMs:Ce().int().nonnegative().default(300)}),em=Yt(["debug","info","notice","warning","error","critical","alert","emergency"]),vre=rn.extend({level:em}),qk=Qt.extend({method:W("logging/setLevel"),params:vre}),bre=_n.extend({level:em,logger:C().optional(),data:ze()}),_re=xn.extend({method:W("notifications/message"),params:bre}),xre=F({name:C().optional()}),Sre=F({hints:le(xre).optional(),costPriority:Ce().min(0).max(1).optional(),speedPriority:Ce().min(0).max(1).optional(),intelligencePriority:Ce().min(0).max(1).optional()}),wre=F({mode:Yt(["auto","required","none"]).optional()}),Ire=F({type:W("tool_result"),toolUseId:C().describe("The unique identifier for the corresponding tool call."),content:le(Uk).default([]),structuredContent:F({}).loose().optional(),isError:St().optional(),_meta:We(C(),ze()).optional()}),Pre=Fp("type",[Mk,Lk,zk]),Ib=Fp("type",[Mk,Lk,zk,sre,Ire]),Cre=F({role:Xp,content:$e([Ib,le(Ib)]),_meta:We(C(),ze()).optional()}),kre=Wp.extend({messages:le(Cre),modelPreferences:Sre.optional(),systemPrompt:C().optional(),includeContext:Yt(["none","thisServer","allServers"]).optional(),temperature:Ce().optional(),maxTokens:Ce().int(),stopSequences:le(C()).optional(),metadata:Xt.optional(),tools:le(l4).optional(),toolChoice:wre.optional()}),Rre=Qt.extend({method:W("sampling/createMessage"),params:kre}),Bk=er.extend({model:C(),stopReason:Ke(Yt(["endTurn","stopSequence","maxTokens"]).or(C())),role:Xp,content:Pre}),Vk=er.extend({model:C(),stopReason:Ke(Yt(["endTurn","stopSequence","maxTokens","toolUse"]).or(C())),role:Xp,content:$e([Ib,le(Ib)])}),Ere=F({type:W("boolean"),title:C().optional(),description:C().optional(),default:St().optional()}),Are=F({type:W("string"),title:C().optional(),description:C().optional(),minLength:Ce().optional(),maxLength:Ce().optional(),format:Yt(["email","uri","date","date-time"]).optional(),default:C().optional()}),Tre=F({type:Yt(["number","integer"]),title:C().optional(),description:C().optional(),minimum:Ce().optional(),maximum:Ce().optional(),default:Ce().optional()}),Ore=F({type:W("string"),title:C().optional(),description:C().optional(),enum:le(C()),default:C().optional()}),Dre=F({type:W("string"),title:C().optional(),description:C().optional(),oneOf:le(F({const:C(),title:C()})),default:C().optional()}),$re=F({type:W("string"),title:C().optional(),description:C().optional(),enum:le(C()),enumNames:le(C()).optional(),default:C().optional()}),Nre=$e([Ore,Dre]),jre=F({type:W("array"),title:C().optional(),description:C().optional(),minItems:Ce().optional(),maxItems:Ce().optional(),items:F({type:W("string"),enum:le(C())}),default:le(C()).optional()}),Mre=F({type:W("array"),title:C().optional(),description:C().optional(),minItems:Ce().optional(),maxItems:Ce().optional(),items:F({anyOf:le(F({const:C(),title:C()}))}),default:le(C()).optional()}),Lre=$e([jre,Mre]),zre=$e([$re,Nre,Lre]),Ure=$e([zre,Ere,Are,Tre]),Fre=Wp.extend({mode:W("form").optional(),message:C(),requestedSchema:F({type:W("object"),properties:We(C(),Ure),required:le(C()).optional()})}),qre=Wp.extend({mode:W("url"),message:C(),elicitationId:C(),url:C().url()}),Bre=$e([Fre,qre]),Vre=Qt.extend({method:W("elicitation/create"),params:Bre}),Wre=_n.extend({elicitationId:C()}),Hre=xn.extend({method:W("notifications/elicitation/complete"),params:Wre}),Lb=er.extend({action:Yt(["accept","decline","cancel"]),content:Vp(t=>t===null?void 0:t,We(C(),$e([C(),Ce(),St(),le(C())])).optional())}),Zre=F({type:W("ref/resource"),uri:C()});var Gre=F({type:W("ref/prompt"),name:C()}),Kre=rn.extend({ref:$e([Gre,Zre]),argument:F({name:C(),value:C()}),context:F({arguments:We(C(),C()).optional()}).optional()}),Jre=Qt.extend({method:W("completion/complete"),params:Kre});var Yre=er.extend({completion:Jt({values:le(C()).max(100),total:Ke(Ce().int()),hasMore:Ke(St())})}),Xre=F({uri:C().startsWith("file://"),name:C().optional(),_meta:We(C(),ze()).optional()}),Qre=Qt.extend({method:W("roots/list"),params:rn.optional()}),Wk=er.extend({roots:le(Xre)}),ene=xn.extend({method:W("notifications/roots/list_changed"),params:_n.optional()}),$Le=$e([Eb,Tk,Jre,qk,ore,nre,$k,Vte,jk,Jte,Xte,Qp,Fk,Tb,Db,$b,jb]),NLe=$e([Rb,Ab,Ok,ene,Yp]),jLe=$e([kb,Bk,Vk,Lb,Wk,Ob,Nb,Cl]),MLe=$e([Eb,Rre,Vre,Qre,Tb,Db,$b,jb]),LLe=$e([Rb,Ab,_re,ere,Gte,yre,pre,Yp,Hre]),zLe=$e([kb,jte,Yre,dre,ire,Bte,Wte,Zte,Mb,gre,Ob,Nb,Cl]),se=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ve.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Pk(i.elicitations,r)}return new t(e,r,n)}},Pk=class extends se{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ve.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};var zb=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
244
244
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),tne(r)}clear(){this._buffer=void 0}};function tne(t){return r4.parse(JSON.parse(t))}function u4(t){return JSON.stringify(t)+`
245
- `}var Ub=class{constructor(e=d4.stdin,r=d4.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new zb,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}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(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=u4(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Fb=class{startPromise=null;stopPromise=null;start(e){return this.startPromise??=e(),this.startPromise}stop(e){return this.stopPromise??=(async()=>{this.startPromise&&await this.startPromise.catch(()=>{}),await e()})(),this.stopPromise}};var ye;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ye||(ye={}));var p4;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(p4||(p4={}));var q=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),la=t=>{switch(typeof t){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(t)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(t)?q.array:t===null?q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?q.promise:typeof Map<"u"&&t instanceof Map?q.map:typeof Set<"u"&&t instanceof Set?q.set:typeof Date<"u"&&t instanceof Date?q.date:q.object;default:return q.unknown}};var O=ye.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"]);var nn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};nn.create=t=>new nn(t);var rne=(t,e)=>{let r;switch(t.code){case O.invalid_type:t.received===q.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ye.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(t.keys,", ")}`;break;case O.invalid_union:r="Invalid input";break;case O.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(t.options)}`;break;case O.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:r="Invalid function arguments";break;case O.invalid_return_type:r="Invalid function return type";break;case O.invalid_date:r="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ye.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case O.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case O.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case O.custom:r="Invalid input";break;case O.invalid_intersection_types:r="Intersection results could not be merged";break;case O.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:r="Number must be finite";break;default:r=e.defaultError,ye.assertNever(t)}return{message:r}},fo=rne;var nne=fo;function tm(){return nne}var qb=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}};function z(t,e){let r=tm(),n=qb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===fo?void 0:fo].filter(i=>!!i)});t.common.issues.push(n)}var sr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Y;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;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"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},Y=Object.freeze({status:"aborted"}),Rl=t=>({status:"dirty",value:t}),Sr=t=>({status:"valid",value:t}),Hk=t=>t.status==="aborted",Zk=t=>t.status==="dirty",Es=t=>t.status==="valid",rm=t=>typeof Promise<"u"&&t instanceof Promise;var V;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Sn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}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}},m4=(t,e)=>{if(Es(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new nn(t.common.issues);return this._error=r,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var ue=class{get description(){return this._def.description}_getType(e){return la(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:la(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sr,ctx:{common:e.parent.common,data:e.data,parsedType:la(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(rm(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:la(e)},i=this._parseSync({data:e,path:n.path,parent:n});return m4(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:la(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Es(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Es(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:la(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(rm(i)?i:Promise.resolve(i));return m4(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:O.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Wn({schema:this,typeName:K.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:r=>this["~validate"](r)}}optional(){return Vn.create(this,this._def)}nullable(){return pa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ho.create(this)}promise(){return As.create(this,this._def)}or(e){return Dl.create([this,e],this._def)}and(e){return $l.create(this,e,this._def)}transform(e){return new Wn({...ie(this._def),schema:this,typeName:K.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new zl({...ie(this._def),innerType:this,defaultValue:r,typeName:K.ZodDefault})}brand(){return new Bb({typeName:K.ZodBranded,type:this,...ie(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ul({...ie(this._def),innerType:this,catchValue:r,typeName:K.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Vb.create(this,e)}readonly(){return Fl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ine=/^c[^\s-]{8,}$/i,ane=/^[0-9a-z]+$/,one=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sne=/^[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,cne=/^[a-z0-9_-]{21}$/i,lne=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,une=/^[-+]?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)?)??$/,dne=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pne="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gk,mne=/^(?:(?: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])$/,fne=/^(?:(?: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])$/,gne=/^(([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]))$/,hne=/^(([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])$/,yne=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vne=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,f4="((\\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])))",bne=new RegExp(`^${f4}$`);function g4(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function _ne(t){return new RegExp(`^${g4(t)}$`)}function xne(t){let e=`${f4}T${g4(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Sne(t,e){return!!((e==="v4"||!e)&&mne.test(t)||(e==="v6"||!e)&&gne.test(t))}function wne(t,e){if(!lne.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Ine(t,e){return!!((e==="v4"||!e)&&fne.test(t)||(e==="v6"||!e)&&hne.test(t))}var Al=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_type,expected:q.string,received:a.parsedType}),Y}let n=new sr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?z(i,{code:O.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&z(i,{code:O.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")dne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"email",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Gk||(Gk=new RegExp(pne,"u")),Gk.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"emoji",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")sne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"uuid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")cne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"nanoid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")ine.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ane.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid2",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")one.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ulid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),z(i,{validation:"url",code:O.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"regex",code:O.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.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)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?xne(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?bne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?_ne(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?une.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"duration",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Sne(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ip",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?wne(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"jwt",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Ine(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cidr",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?yne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?vne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64url",code:O.invalid_string,message:a.message}),n.dirty()):ye.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:O.invalid_string,...V.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.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,...V.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,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...V.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...V.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...V.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...V.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...V.errToObj(r)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Al.create=t=>new Al({checks:[],typeName:K.ZodString,coerce:t?.coerce??!1,...ie(t)});function Pne(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var nm=class t extends ue{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)!==q.number){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_type,expected:q.number,received:a.parsedType}),Y}let n,i=new sr;for(let a of this._def.checks)a.kind==="int"?ye.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),z(n,{code:O.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Pne(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),z(n,{code:O.not_finite,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:V.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ye.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nm.create=t=>new nm({checks:[],typeName:K.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var im=class t extends ue{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)!==q.bigint)return this._getInvalidInput(e);let n,i=new sr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return z(r,{code:O.invalid_type,expected:q.bigint,received:r.parsedType}),Y}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:V.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};im.create=t=>new im({checks:[],typeName:K.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var am=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.boolean,received:n.parsedType}),Y}return Sr(e.data)}};am.create=t=>new am({typeName:K.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var om=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_type,expected:q.date,received:a.parsedType}),Y}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_date}),Y}let n=new sr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ye.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};om.create=t=>new om({checks:[],coerce:t?.coerce||!1,typeName:K.ZodDate,...ie(t)});var sm=class extends ue{_parse(e){if(this._getType(e)!==q.symbol){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.symbol,received:n.parsedType}),Y}return Sr(e.data)}};sm.create=t=>new sm({typeName:K.ZodSymbol,...ie(t)});var Tl=class extends ue{_parse(e){if(this._getType(e)!==q.undefined){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.undefined,received:n.parsedType}),Y}return Sr(e.data)}};Tl.create=t=>new Tl({typeName:K.ZodUndefined,...ie(t)});var Ol=class extends ue{_parse(e){if(this._getType(e)!==q.null){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.null,received:n.parsedType}),Y}return Sr(e.data)}};Ol.create=t=>new Ol({typeName:K.ZodNull,...ie(t)});var cm=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return Sr(e.data)}};cm.create=t=>new cm({typeName:K.ZodAny,...ie(t)});var go=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Sr(e.data)}};go.create=t=>new go({typeName:K.ZodUnknown,...ie(t)});var bi=class extends ue{_parse(e){let r=this._getOrReturnCtx(e);return z(r,{code:O.invalid_type,expected:q.never,received:r.parsedType}),Y}};bi.create=t=>new bi({typeName:K.ZodNever,...ie(t)});var lm=class extends ue{_parse(e){if(this._getType(e)!==q.undefined){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.void,received:n.parsedType}),Y}return Sr(e.data)}};lm.create=t=>new lm({typeName:K.ZodVoid,...ie(t)});var ho=class t extends ue{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==q.array)return z(r,{code:O.invalid_type,expected:q.array,received:r.parsedType}),Y;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(z(r,{code:o?O.too_big:O.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(z(r,{code:O.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(z(r,{code:O.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new Sn(r,o,r.path,s)))).then(o=>sr.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new Sn(r,o,r.path,s)));return sr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:V.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:V.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:V.toString(r)}})}nonempty(e){return this.min(1,e)}};ho.create=(t,e)=>new ho({type:t,minLength:null,maxLength:null,exactLength:null,typeName:K.ZodArray,...ie(e)});function El(t){if(t instanceof an){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Vn.create(El(n))}return new an({...t._def,shape:()=>e})}else return t instanceof ho?new ho({...t._def,type:El(t.element)}):t instanceof Vn?Vn.create(El(t.unwrap())):t instanceof pa?pa.create(El(t.unwrap())):t instanceof da?da.create(t.items.map(e=>El(e))):t}var an=class t extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ye.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==q.object){let l=this._getOrReturnCtx(e);return z(l,{code:O.invalid_type,expected:q.object,received:l.parsedType}),Y}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof bi&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||s.push(l);let c=[];for(let l of o){let u=a[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Sn(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof bi){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(z(i,{code:O.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Sn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>sr.mergeObjectSync(n,l)):sr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:V.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:K.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ye.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ye.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return El(this)}partial(e){let r={};for(let n of ye.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ye.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Vn;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return h4(ye.objectKeys(this.shape))}};an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:bi.create(),typeName:K.ZodObject,...ie(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:bi.create(),typeName:K.ZodObject,...ie(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:bi.create(),typeName:K.ZodObject,...ie(e)});var Dl=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new nn(s.ctx.common.issues));return z(r,{code:O.invalid_union,unionErrors:o}),Y}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new nn(c));return z(r,{code:O.invalid_union,unionErrors:s}),Y}}get options(){return this._def.options}};Dl.create=(t,e)=>new Dl({options:t,typeName:K.ZodUnion,...ie(e)});var ua=t=>t instanceof Nl?ua(t.schema):t instanceof Wn?ua(t.innerType()):t instanceof jl?[t.value]:t instanceof Ml?t.options:t instanceof Ll?ye.objectValues(t.enum):t instanceof zl?ua(t._def.innerType):t instanceof Tl?[void 0]:t instanceof Ol?[null]:t instanceof Vn?[void 0,...ua(t.unwrap())]:t instanceof pa?[null,...ua(t.unwrap())]:t instanceof Bb||t instanceof Fl?ua(t.unwrap()):t instanceof Ul?ua(t._def.innerType):[],Kk=class t extends ue{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==q.object)return z(r,{code:O.invalid_type,expected:q.object,received:r.parsedType}),Y;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(z(r,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=ua(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:K.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ie(n)})}};function Jk(t,e){let r=la(t),n=la(e);if(t===e)return{valid:!0,data:t};if(r===q.object&&n===q.object){let i=ye.objectKeys(e),a=ye.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=Jk(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===q.array&&n===q.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],c=Jk(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===q.date&&n===q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var $l=class extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Hk(a)||Hk(o))return Y;let s=Jk(a.value,o.value);return s.valid?((Zk(a)||Zk(o))&&r.dirty(),{status:r.value,value:s.data}):(z(n,{code:O.invalid_intersection_types}),Y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};$l.create=(t,e,r)=>new $l({left:t,right:e,typeName:K.ZodIntersection,...ie(r)});var da=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return z(n,{code:O.invalid_type,expected:q.array,received:n.parsedType}),Y;if(n.data.length<this._def.items.length)return z(n,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&n.data.length>this._def.items.length&&(z(n,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Sn(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>sr.mergeArray(r,o)):sr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};da.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new da({items:t,typeName:K.ZodTuple,rest:null,...ie(e)})};var Yk=class t extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return z(n,{code:O.invalid_type,expected:q.object,received:n.parsedType}),Y;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new Sn(n,s,n.path,s)),value:o._parse(new Sn(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?sr.mergeObjectAsync(r,i):sr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ue?new t({keyType:e,valueType:r,typeName:K.ZodRecord,...ie(n)}):new t({keyType:Al.create(),valueType:e,typeName:K.ZodRecord,...ie(r)})}},um=class extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.map)return z(n,{code:O.invalid_type,expected:q.map,received:n.parsedType}),Y;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,c],l)=>({key:i._parse(new Sn(n,s,n.path,[l,"key"])),value:a._parse(new Sn(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Y;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Y;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}};um.create=(t,e,r)=>new um({valueType:e,keyType:t,typeName:K.ZodMap,...ie(r)});var dm=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return z(n,{code:O.invalid_type,expected:q.set,received:n.parsedType}),Y;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(z(n,{code:O.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(z(n,{code:O.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return Y;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((c,l)=>a._parse(new Sn(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:V.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:V.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};dm.create=(t,e)=>new dm({valueType:t,minSize:null,maxSize:null,typeName:K.ZodSet,...ie(e)});var Xk=class t extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==q.function)return z(r,{code:O.invalid_type,expected:q.function,received:r.parsedType}),Y;function n(s,c){return qb({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,tm(),fo].filter(l=>!!l),issueData:{code:O.invalid_arguments,argumentsError:c}})}function i(s,c){return qb({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,tm(),fo].filter(l=>!!l),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof As){let s=this;return Sr(async function(...c){let l=new nn([]),u=await s._def.args.parseAsync(c,a).catch(m=>{throw l.addIssue(n(c,m)),l}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(m=>{throw l.addIssue(i(d,m)),l})})}else{let s=this;return Sr(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new nn([n(c,l.error)]);let u=Reflect.apply(o,this,l.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new nn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:da.create(e).rest(go.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||da.create([]).rest(go.create()),returns:r||go.create(),typeName:K.ZodFunction,...ie(n)})}},Nl=class extends ue{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Nl.create=(t,e)=>new Nl({getter:t,typeName:K.ZodLazy,...ie(e)});var jl=class extends ue{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return z(r,{received:r.data,code:O.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:e.data}}get value(){return this._def.value}};jl.create=(t,e)=>new jl({value:t,typeName:K.ZodLiteral,...ie(e)});function h4(t,e){return new Ml({values:t,typeName:K.ZodEnum,...ie(e)})}var Ml=class t extends ue{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return z(r,{expected:ye.joinValues(n),received:r.parsedType,code:O.invalid_type}),Y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return z(r,{received:r.data,code:O.invalid_enum_value,options:n}),Y}return Sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Ml.create=h4;var Ll=class extends ue{_parse(e){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let i=ye.objectValues(r);return z(n,{expected:ye.joinValues(i),received:n.parsedType,code:O.invalid_type}),Y}if(this._cache||(this._cache=new Set(ye.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ye.objectValues(r);return z(n,{received:n.data,code:O.invalid_enum_value,options:i}),Y}return Sr(e.data)}get enum(){return this._def.values}};Ll.create=(t,e)=>new Ll({values:t,typeName:K.ZodNativeEnum,...ie(e)});var As=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==q.promise&&r.common.async===!1)return z(r,{code:O.invalid_type,expected:q.promise,received:r.parsedType}),Y;let n=r.parsedType===q.promise?r.data:Promise.resolve(r.data);return Sr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};As.create=(t,e)=>new As({type:t,typeName:K.ZodPromise,...ie(e)});var Wn=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===K.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{z(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return Y;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?Y:c.status==="dirty"?Rl(c.value):r.value==="dirty"?Rl(c.value):c});{if(r.value==="aborted")return Y;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Y:s.status==="dirty"?Rl(s.value):r.value==="dirty"?Rl(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Y:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Y:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Es(o))return Y;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Es(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):Y);ye.assertNever(i)}};Wn.create=(t,e,r)=>new Wn({schema:t,typeName:K.ZodEffects,effect:e,...ie(r)});Wn.createWithPreprocess=(t,e,r)=>new Wn({schema:e,effect:{type:"preprocess",transform:t},typeName:K.ZodEffects,...ie(r)});var Vn=class extends ue{_parse(e){return this._getType(e)===q.undefined?Sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vn.create=(t,e)=>new Vn({innerType:t,typeName:K.ZodOptional,...ie(e)});var pa=class extends ue{_parse(e){return this._getType(e)===q.null?Sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pa.create=(t,e)=>new pa({innerType:t,typeName:K.ZodNullable,...ie(e)});var zl=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};zl.create=(t,e)=>new zl({innerType:t,typeName:K.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var Ul=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rm(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new nn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new nn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ul.create=(t,e)=>new Ul({innerType:t,typeName:K.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var pm=class extends ue{_parse(e){if(this._getType(e)!==q.nan){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.nan,received:n.parsedType}),Y}return{status:"valid",value:e.data}}};pm.create=t=>new pm({typeName:K.ZodNaN,...ie(t)});var u4e=Symbol("zod_brand"),Bb=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Vb=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Y:a.status==="dirty"?(r.dirty(),Rl(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Y:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:K.ZodPipeline})}},Fl=class extends ue{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Es(i)&&(i.value=Object.freeze(i.value)),i);return rm(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fl.create=(t,e)=>new Fl({innerType:t,typeName:K.ZodReadonly,...ie(e)});var d4e={object:an.lazycreate},K;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(K||(K={}));var p4e=Al.create,m4e=nm.create,f4e=pm.create,g4e=im.create,h4e=am.create,y4e=om.create,v4e=sm.create,b4e=Tl.create,_4e=Ol.create,x4e=cm.create,S4e=go.create,w4e=bi.create,I4e=lm.create,P4e=ho.create,Cne=an.create,C4e=an.strictCreate,k4e=Dl.create,R4e=Kk.create,E4e=$l.create,A4e=da.create,T4e=Yk.create,O4e=um.create,D4e=dm.create,$4e=Xk.create,N4e=Nl.create,j4e=jl.create,M4e=Ml.create,L4e=Ll.create,z4e=As.create,U4e=Wn.create,F4e=Vn.create,q4e=pa.create,B4e=Wn.createWithPreprocess,V4e=Vb.create;function ql(t){return!!t._zod}function yo(t,e){return ql(t)?fs(t,e):t.safeParse(e)}function Wb(t){if(!t)return;let e;if(ql(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function b4(t){if(ql(t)){let a=t._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}function vo(t){return t==="completed"||t==="failed"||t==="cancelled"}var Dne=Symbol("Let zodToJsonSchema decide on which parser to use");var Qze=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Qk(t){let r=Wb(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=b4(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function eR(t,e){let r=yo(t,e);if(!r.success)throw r.error;return r.data}var zne=6e4,Hb=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Rb,r=>{this._oncancel(r)}),this.setNotificationHandler(Ab,r=>{this._onprogress(r)}),this.setRequestHandler(Eb,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Tb,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new se(ve.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Db,async(r,n)=>{let i=async()=>{let a=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(a,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),s.type==="response")u(c);else{let d=c,p=new se(d.error.code,d.error.message,d.error.data);u(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let o=await this._taskStore.getTask(a,n.sessionId);if(!o)throw new se(ve.InvalidParams,`Task not found: ${a}`);if(!vo(o.status))return await this._waitForTaskUpdate(a,n.signal),await i();if(vo(o.status)){let s=await this._taskStore.getTaskResult(a,n.sessionId);return this._clearTaskQueue(a),{...s,_meta:{...s._meta,[mo]:{taskId:a}}}}return await i()};return await i()}),this.setRequestHandler($b,async(r,n)=>{try{let{tasks:i,nextCursor:a}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:a,_meta:{}}}catch(i){throw new se(ve.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(jb,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new se(ve.InvalidParams,`Task not found: ${r.params.taskId}`);if(vo(i.status))throw new se(ve.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new se(ve.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof se?i:new se(ve.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),se.fromError(ve.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=a=>{n?.(a),this._onerror(a)};let i=this._transport?.onmessage;this._transport.onmessage=(a,o)=>{i?.(a,o),Hp(a)||t4(a)?this._onresponse(a):Rk(a)?this._onrequest(a,o):e4(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=se.fromError(ve.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,a=e.params?._meta?.[mo]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:ve.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=YL(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,l={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{let d={relatedRequestId:e.id};a&&(d.relatedTask={taskId:a}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{let m={...p,relatedRequestId:e.id};a&&!m.relatedTask&&(m.relatedTask={taskId:a});let f=m.relatedTask?.taskId??a;return f&&c&&await c.updateTaskStatus(f,"input_required"),await this.request(u,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:a,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,l)).then(async u=>{if(o.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(o.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:ve.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(c);return}a(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Hp(e))n(e);else{let o=new se(e.error.code,e.error.message,e.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(Hp(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,r))}}if(a||this._progressHandlers.delete(r),Hp(e))i(e);else{let o=se.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(e,r,n)}}catch(o){yield{type:"error",error:o instanceof se?o:new se(ve.InternalError,String(o))}}return}let a;try{let o=await this.request(e,Cl,n);if(o.task)a=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new se(ve.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:a},n);if(yield{type:"taskStatus",task:s},vo(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)}:s.status==="failed"?yield{type:"error",error:new se(ve.InternalError,`Task ${a} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new se(ve.InternalError,`Task ${a} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),n?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof se?o:new se(ve.InternalError,String(o))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:c}=n??{};return new Promise((l,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[mo]:c}});let f=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`)));let x=b instanceof se?b:new se(ve.RequestTimeout,String(b));u(x)};this._responseHandlers.set(p,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return u(b);try{let x=yo(r,b.result);x.success?l(x.data):u(x.error)}catch(x){u(x)}}}),n?.signal?.addEventListener("abort",()=>{f(n?.signal?.reason)});let g=n?.timeout??zne,h=()=>f(se.fromError(ve.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,n?.maxTotalTimeout,h,n?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=x=>{let P=this._responseHandlers.get(p);P?P(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),u(x)})}else this._transport.send(m,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(b=>{this._cleanupTimeout(p),u(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ob,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Nb,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},i4,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[mo]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[mo]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let o={...e,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[mo]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(e,r){let n=Qk(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=eR(e,i);return Promise.resolve(r(o,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Qk(e);this._notificationHandlers.set(n,i=>{let a=eR(e,i);return Promise.resolve(r(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&Rk(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new se(ve.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,a)=>{if(r.aborted){a(new se(ve.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),a(new se(ve.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let a=await n.getTask(i,r);if(!a)throw new se(ve.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await n.storeTaskResult(i,a,o,r);let s=await n.getTask(i,r);if(s){let c=Yp.parse({method:"notifications/tasks/status",params:s});await this.notification(c),vo(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,a,o)=>{let s=await n.getTask(i,r);if(!s)throw new se(ve.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(vo(s.status))throw new se(ve.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,a,o,r);let c=await n.getTask(i,r);if(c){let l=Yp.parse({method:"notifications/tasks/status",params:c});await this.notification(l),vo(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function _4(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function x4(t,e){let r={...t};for(let n in e){let i=n,a=e[i];if(a===void 0)continue;let o=r[i];_4(o)&&_4(a)?r[i]={...o,...a}:r[i]=a}return r}var sF=$t(zE(),1),cF=$t(oF(),1);function Ele(){let t=new sF.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,cF.default)(t),t}var E_=class{constructor(e){this._ajv=e??Ele()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var A_=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function lF(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function uF(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var T_=class extends Hb{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(em.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new E_,this.setRequestHandler(Tk,n=>this._oninitialize(n)),this.setNotificationHandler(Ok,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(qk,async(n,i)=>{let a=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=n.params,s=em.safeParse(o);return s.success&&this._loggingLevels.set(a,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new A_(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=x4(this._capabilities,e)}setRequestHandler(e,r){let i=Wb(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let a;if(ql(i)){let s=i;a=s._zod?.def?.value??s.value}else{let s=i;a=s._def?.value??s.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let s=async(c,l)=>{let u=yo(Qp,c);if(!u.success){let f=u.error instanceof Error?u.error.message:String(u.error);throw new se(ve.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:d}=u.data,p=await Promise.resolve(r(c,l));if(d.task){let f=yo(Cl,p);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new se(ve.InvalidParams,`Invalid task creation result: ${g}`)}return f.data}let m=yo(Mb,p);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new se(ve.InvalidParams,`Invalid tools/call result: ${f}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){uF(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&lF(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:GL.includes(r)?r:Ck,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},kb)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],a=i.some(l=>l.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],c=s.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Vk,r):this.request({method:"sampling/createMessage",params:e},Bk,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},Lb,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},Lb,r);if(a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new se(ve.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){throw o instanceof se?o:new se(ve.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return a}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Wk,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function Ale(){let t=process.env.WEPPY_ROBLOX_MCP_VERSION?.trim();return t||null}var Fe=Ale()??"2.16.1";var ZE={"claude-code":"Claude Code",claude:"Claude",cursor:"Cursor","codex-cli":"Codex CLI","openai-codex":"Codex CLI","gemini-cli":"Gemini CLI",windsurf:"Windsurf",cline:"Cline",continue:"Continue",zed:"Zed",vscode:"VS Code"};function dF(t){let e=t.toLowerCase();if(ZE[e])return ZE[e];for(let[r,n]of Object.entries(ZE))if(e.includes(r))return n;return t}function pF(){return process.env.CLAUDECODE||process.env.CLAUDE_CODE_ENTRYPOINT?{name:"Claude Code",version:""}:process.env.CURSOR_EDITOR?{name:"Cursor",version:""}:process.env.WINDSURF_EDITOR?{name:"Windsurf",version:""}:process.env.CONTINUE_GLOBAL_DIR?{name:"Continue",version:""}:process.env.CLINE_CONTEXT?{name:"Cline",version:""}:null}var GE="weppy://ui-studio/guide",KE="weppy://ui-studio/tokens",JE="weppy://ui-studio/functional-rules",mF=`# UI Studio Guide
245
+ `}var Ub=class{constructor(e=d4.stdin,r=d4.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new zb,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}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(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=u4(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Fb=class{startPromise=null;stopPromise=null;start(e){return this.startPromise??=e(),this.startPromise}stop(e){return this.stopPromise??=(async()=>{this.startPromise&&await this.startPromise.catch(()=>{}),await e()})(),this.stopPromise}};var ye;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ye||(ye={}));var p4;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(p4||(p4={}));var q=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),la=t=>{switch(typeof t){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(t)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(t)?q.array:t===null?q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?q.promise:typeof Map<"u"&&t instanceof Map?q.map:typeof Set<"u"&&t instanceof Set?q.set:typeof Date<"u"&&t instanceof Date?q.date:q.object;default:return q.unknown}};var O=ye.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"]);var nn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};nn.create=t=>new nn(t);var rne=(t,e)=>{let r;switch(t.code){case O.invalid_type:t.received===q.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ye.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:r=`Unrecognized key(s) in object: ${ye.joinValues(t.keys,", ")}`;break;case O.invalid_union:r="Invalid input";break;case O.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ye.joinValues(t.options)}`;break;case O.invalid_enum_value:r=`Invalid enum value. Expected ${ye.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:r="Invalid function arguments";break;case O.invalid_return_type:r="Invalid function return type";break;case O.invalid_date:r="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ye.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case O.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case O.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case O.custom:r="Invalid input";break;case O.invalid_intersection_types:r="Intersection results could not be merged";break;case O.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:r="Number must be finite";break;default:r=e.defaultError,ye.assertNever(t)}return{message:r}},fo=rne;var nne=fo;function tm(){return nne}var qb=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}};function z(t,e){let r=tm(),n=qb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===fo?void 0:fo].filter(i=>!!i)});t.common.issues.push(n)}var sr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Y;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;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"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},Y=Object.freeze({status:"aborted"}),Rl=t=>({status:"dirty",value:t}),Sr=t=>({status:"valid",value:t}),Hk=t=>t.status==="aborted",Zk=t=>t.status==="dirty",Es=t=>t.status==="valid",rm=t=>typeof Promise<"u"&&t instanceof Promise;var V;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Sn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}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}},m4=(t,e)=>{if(Es(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new nn(t.common.issues);return this._error=r,this._error}}};function ie(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var ue=class{get description(){return this._def.description}_getType(e){return la(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:la(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sr,ctx:{common:e.parent.common,data:e.data,parsedType:la(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(rm(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:la(e)},i=this._parseSync({data:e,path:n.path,parent:n});return m4(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:la(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Es(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Es(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:la(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(rm(i)?i:Promise.resolve(i));return m4(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:O.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Wn({schema:this,typeName:K.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:r=>this["~validate"](r)}}optional(){return Vn.create(this,this._def)}nullable(){return pa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ho.create(this)}promise(){return As.create(this,this._def)}or(e){return Dl.create([this,e],this._def)}and(e){return $l.create(this,e,this._def)}transform(e){return new Wn({...ie(this._def),schema:this,typeName:K.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new zl({...ie(this._def),innerType:this,defaultValue:r,typeName:K.ZodDefault})}brand(){return new Bb({typeName:K.ZodBranded,type:this,...ie(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ul({...ie(this._def),innerType:this,catchValue:r,typeName:K.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Vb.create(this,e)}readonly(){return Fl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ine=/^c[^\s-]{8,}$/i,ane=/^[0-9a-z]+$/,one=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sne=/^[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,cne=/^[a-z0-9_-]{21}$/i,lne=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,une=/^[-+]?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)?)??$/,dne=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pne="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gk,mne=/^(?:(?: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])$/,fne=/^(?:(?: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])$/,gne=/^(([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]))$/,hne=/^(([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])$/,yne=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vne=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,f4="((\\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])))",bne=new RegExp(`^${f4}$`);function g4(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function _ne(t){return new RegExp(`^${g4(t)}$`)}function xne(t){let e=`${f4}T${g4(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Sne(t,e){return!!((e==="v4"||!e)&&mne.test(t)||(e==="v6"||!e)&&gne.test(t))}function wne(t,e){if(!lne.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Ine(t,e){return!!((e==="v4"||!e)&&fne.test(t)||(e==="v6"||!e)&&hne.test(t))}var Al=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_type,expected:q.string,received:a.parsedType}),Y}let n=new sr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?z(i,{code:O.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&z(i,{code:O.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")dne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"email",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Gk||(Gk=new RegExp(pne,"u")),Gk.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"emoji",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")sne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"uuid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")cne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"nanoid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")ine.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ane.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid2",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")one.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ulid",code:O.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),z(i,{validation:"url",code:O.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"regex",code:O.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.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)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?xne(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?bne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?_ne(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:O.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?une.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"duration",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Sne(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ip",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?wne(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"jwt",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Ine(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cidr",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?yne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64",code:O.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?vne.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64url",code:O.invalid_string,message:a.message}),n.dirty()):ye.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:O.invalid_string,...V.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.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,...V.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,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...V.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...V.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...V.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...V.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...V.errToObj(r)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Al.create=t=>new Al({checks:[],typeName:K.ZodString,coerce:t?.coerce??!1,...ie(t)});function Pne(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var nm=class t extends ue{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)!==q.number){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_type,expected:q.number,received:a.parsedType}),Y}let n,i=new sr;for(let a of this._def.checks)a.kind==="int"?ye.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),z(n,{code:O.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Pne(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),z(n,{code:O.not_finite,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:V.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ye.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nm.create=t=>new nm({checks:[],typeName:K.ZodNumber,coerce:t?.coerce||!1,...ie(t)});var im=class t extends ue{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)!==q.bigint)return this._getInvalidInput(e);let n,i=new sr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),z(n,{code:O.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):ye.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return z(r,{code:O.invalid_type,expected:q.bigint,received:r.parsedType}),Y}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:V.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};im.create=t=>new im({checks:[],typeName:K.ZodBigInt,coerce:t?.coerce??!1,...ie(t)});var am=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.boolean,received:n.parsedType}),Y}return Sr(e.data)}};am.create=t=>new am({typeName:K.ZodBoolean,coerce:t?.coerce||!1,...ie(t)});var om=class t extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_type,expected:q.date,received:a.parsedType}),Y}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return z(a,{code:O.invalid_date}),Y}let n=new sr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:O.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ye.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};om.create=t=>new om({checks:[],coerce:t?.coerce||!1,typeName:K.ZodDate,...ie(t)});var sm=class extends ue{_parse(e){if(this._getType(e)!==q.symbol){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.symbol,received:n.parsedType}),Y}return Sr(e.data)}};sm.create=t=>new sm({typeName:K.ZodSymbol,...ie(t)});var Tl=class extends ue{_parse(e){if(this._getType(e)!==q.undefined){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.undefined,received:n.parsedType}),Y}return Sr(e.data)}};Tl.create=t=>new Tl({typeName:K.ZodUndefined,...ie(t)});var Ol=class extends ue{_parse(e){if(this._getType(e)!==q.null){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.null,received:n.parsedType}),Y}return Sr(e.data)}};Ol.create=t=>new Ol({typeName:K.ZodNull,...ie(t)});var cm=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return Sr(e.data)}};cm.create=t=>new cm({typeName:K.ZodAny,...ie(t)});var go=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Sr(e.data)}};go.create=t=>new go({typeName:K.ZodUnknown,...ie(t)});var bi=class extends ue{_parse(e){let r=this._getOrReturnCtx(e);return z(r,{code:O.invalid_type,expected:q.never,received:r.parsedType}),Y}};bi.create=t=>new bi({typeName:K.ZodNever,...ie(t)});var lm=class extends ue{_parse(e){if(this._getType(e)!==q.undefined){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.void,received:n.parsedType}),Y}return Sr(e.data)}};lm.create=t=>new lm({typeName:K.ZodVoid,...ie(t)});var ho=class t extends ue{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==q.array)return z(r,{code:O.invalid_type,expected:q.array,received:r.parsedType}),Y;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(z(r,{code:o?O.too_big:O.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(z(r,{code:O.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(z(r,{code:O.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new Sn(r,o,r.path,s)))).then(o=>sr.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new Sn(r,o,r.path,s)));return sr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:V.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:V.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:V.toString(r)}})}nonempty(e){return this.min(1,e)}};ho.create=(t,e)=>new ho({type:t,minLength:null,maxLength:null,exactLength:null,typeName:K.ZodArray,...ie(e)});function El(t){if(t instanceof an){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Vn.create(El(n))}return new an({...t._def,shape:()=>e})}else return t instanceof ho?new ho({...t._def,type:El(t.element)}):t instanceof Vn?Vn.create(El(t.unwrap())):t instanceof pa?pa.create(El(t.unwrap())):t instanceof da?da.create(t.items.map(e=>El(e))):t}var an=class t extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ye.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==q.object){let l=this._getOrReturnCtx(e);return z(l,{code:O.invalid_type,expected:q.object,received:l.parsedType}),Y}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof bi&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||s.push(l);let c=[];for(let l of o){let u=a[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Sn(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof bi){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(z(i,{code:O.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Sn(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>sr.mergeObjectSync(n,l)):sr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:V.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:K.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ye.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ye.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return El(this)}partial(e){let r={};for(let n of ye.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ye.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Vn;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return h4(ye.objectKeys(this.shape))}};an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:bi.create(),typeName:K.ZodObject,...ie(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:bi.create(),typeName:K.ZodObject,...ie(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:bi.create(),typeName:K.ZodObject,...ie(e)});var Dl=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new nn(s.ctx.common.issues));return z(r,{code:O.invalid_union,unionErrors:o}),Y}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new nn(c));return z(r,{code:O.invalid_union,unionErrors:s}),Y}}get options(){return this._def.options}};Dl.create=(t,e)=>new Dl({options:t,typeName:K.ZodUnion,...ie(e)});var ua=t=>t instanceof Nl?ua(t.schema):t instanceof Wn?ua(t.innerType()):t instanceof jl?[t.value]:t instanceof Ml?t.options:t instanceof Ll?ye.objectValues(t.enum):t instanceof zl?ua(t._def.innerType):t instanceof Tl?[void 0]:t instanceof Ol?[null]:t instanceof Vn?[void 0,...ua(t.unwrap())]:t instanceof pa?[null,...ua(t.unwrap())]:t instanceof Bb||t instanceof Fl?ua(t.unwrap()):t instanceof Ul?ua(t._def.innerType):[],Kk=class t extends ue{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==q.object)return z(r,{code:O.invalid_type,expected:q.object,received:r.parsedType}),Y;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(z(r,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=ua(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:K.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ie(n)})}};function Jk(t,e){let r=la(t),n=la(e);if(t===e)return{valid:!0,data:t};if(r===q.object&&n===q.object){let i=ye.objectKeys(e),a=ye.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=Jk(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===q.array&&n===q.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],c=Jk(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===q.date&&n===q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var $l=class extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Hk(a)||Hk(o))return Y;let s=Jk(a.value,o.value);return s.valid?((Zk(a)||Zk(o))&&r.dirty(),{status:r.value,value:s.data}):(z(n,{code:O.invalid_intersection_types}),Y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};$l.create=(t,e,r)=>new $l({left:t,right:e,typeName:K.ZodIntersection,...ie(r)});var da=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.array)return z(n,{code:O.invalid_type,expected:q.array,received:n.parsedType}),Y;if(n.data.length<this._def.items.length)return z(n,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&n.data.length>this._def.items.length&&(z(n,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Sn(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>sr.mergeArray(r,o)):sr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};da.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new da({items:t,typeName:K.ZodTuple,rest:null,...ie(e)})};var Yk=class t extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return z(n,{code:O.invalid_type,expected:q.object,received:n.parsedType}),Y;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new Sn(n,s,n.path,s)),value:o._parse(new Sn(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?sr.mergeObjectAsync(r,i):sr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ue?new t({keyType:e,valueType:r,typeName:K.ZodRecord,...ie(n)}):new t({keyType:Al.create(),valueType:e,typeName:K.ZodRecord,...ie(r)})}},um=class extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.map)return z(n,{code:O.invalid_type,expected:q.map,received:n.parsedType}),Y;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,c],l)=>({key:i._parse(new Sn(n,s,n.path,[l,"key"])),value:a._parse(new Sn(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Y;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Y;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}};um.create=(t,e,r)=>new um({valueType:e,keyType:t,typeName:K.ZodMap,...ie(r)});var dm=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==q.set)return z(n,{code:O.invalid_type,expected:q.set,received:n.parsedType}),Y;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(z(n,{code:O.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(z(n,{code:O.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return Y;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((c,l)=>a._parse(new Sn(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:V.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:V.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};dm.create=(t,e)=>new dm({valueType:t,minSize:null,maxSize:null,typeName:K.ZodSet,...ie(e)});var Xk=class t extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==q.function)return z(r,{code:O.invalid_type,expected:q.function,received:r.parsedType}),Y;function n(s,c){return qb({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,tm(),fo].filter(l=>!!l),issueData:{code:O.invalid_arguments,argumentsError:c}})}function i(s,c){return qb({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,tm(),fo].filter(l=>!!l),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof As){let s=this;return Sr(async function(...c){let l=new nn([]),u=await s._def.args.parseAsync(c,a).catch(m=>{throw l.addIssue(n(c,m)),l}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(m=>{throw l.addIssue(i(d,m)),l})})}else{let s=this;return Sr(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new nn([n(c,l.error)]);let u=Reflect.apply(o,this,l.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new nn([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:da.create(e).rest(go.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||da.create([]).rest(go.create()),returns:r||go.create(),typeName:K.ZodFunction,...ie(n)})}},Nl=class extends ue{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Nl.create=(t,e)=>new Nl({getter:t,typeName:K.ZodLazy,...ie(e)});var jl=class extends ue{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return z(r,{received:r.data,code:O.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:e.data}}get value(){return this._def.value}};jl.create=(t,e)=>new jl({value:t,typeName:K.ZodLiteral,...ie(e)});function h4(t,e){return new Ml({values:t,typeName:K.ZodEnum,...ie(e)})}var Ml=class t extends ue{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return z(r,{expected:ye.joinValues(n),received:r.parsedType,code:O.invalid_type}),Y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return z(r,{received:r.data,code:O.invalid_enum_value,options:n}),Y}return Sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Ml.create=h4;var Ll=class extends ue{_parse(e){let r=ye.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){let i=ye.objectValues(r);return z(n,{expected:ye.joinValues(i),received:n.parsedType,code:O.invalid_type}),Y}if(this._cache||(this._cache=new Set(ye.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ye.objectValues(r);return z(n,{received:n.data,code:O.invalid_enum_value,options:i}),Y}return Sr(e.data)}get enum(){return this._def.values}};Ll.create=(t,e)=>new Ll({values:t,typeName:K.ZodNativeEnum,...ie(e)});var As=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==q.promise&&r.common.async===!1)return z(r,{code:O.invalid_type,expected:q.promise,received:r.parsedType}),Y;let n=r.parsedType===q.promise?r.data:Promise.resolve(r.data);return Sr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};As.create=(t,e)=>new As({type:t,typeName:K.ZodPromise,...ie(e)});var Wn=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===K.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{z(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return Y;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?Y:c.status==="dirty"?Rl(c.value):r.value==="dirty"?Rl(c.value):c});{if(r.value==="aborted")return Y;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Y:s.status==="dirty"?Rl(s.value):r.value==="dirty"?Rl(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Y:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Y:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Es(o))return Y;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Es(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):Y);ye.assertNever(i)}};Wn.create=(t,e,r)=>new Wn({schema:t,typeName:K.ZodEffects,effect:e,...ie(r)});Wn.createWithPreprocess=(t,e,r)=>new Wn({schema:e,effect:{type:"preprocess",transform:t},typeName:K.ZodEffects,...ie(r)});var Vn=class extends ue{_parse(e){return this._getType(e)===q.undefined?Sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Vn.create=(t,e)=>new Vn({innerType:t,typeName:K.ZodOptional,...ie(e)});var pa=class extends ue{_parse(e){return this._getType(e)===q.null?Sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pa.create=(t,e)=>new pa({innerType:t,typeName:K.ZodNullable,...ie(e)});var zl=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};zl.create=(t,e)=>new zl({innerType:t,typeName:K.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var Ul=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rm(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new nn(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new nn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ul.create=(t,e)=>new Ul({innerType:t,typeName:K.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var pm=class extends ue{_parse(e){if(this._getType(e)!==q.nan){let n=this._getOrReturnCtx(e);return z(n,{code:O.invalid_type,expected:q.nan,received:n.parsedType}),Y}return{status:"valid",value:e.data}}};pm.create=t=>new pm({typeName:K.ZodNaN,...ie(t)});var u4e=Symbol("zod_brand"),Bb=class extends ue{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Vb=class t extends ue{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Y:a.status==="dirty"?(r.dirty(),Rl(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Y:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:K.ZodPipeline})}},Fl=class extends ue{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Es(i)&&(i.value=Object.freeze(i.value)),i);return rm(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fl.create=(t,e)=>new Fl({innerType:t,typeName:K.ZodReadonly,...ie(e)});var d4e={object:an.lazycreate},K;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(K||(K={}));var p4e=Al.create,m4e=nm.create,f4e=pm.create,g4e=im.create,h4e=am.create,y4e=om.create,v4e=sm.create,b4e=Tl.create,_4e=Ol.create,x4e=cm.create,S4e=go.create,w4e=bi.create,I4e=lm.create,P4e=ho.create,Cne=an.create,C4e=an.strictCreate,k4e=Dl.create,R4e=Kk.create,E4e=$l.create,A4e=da.create,T4e=Yk.create,O4e=um.create,D4e=dm.create,$4e=Xk.create,N4e=Nl.create,j4e=jl.create,M4e=Ml.create,L4e=Ll.create,z4e=As.create,U4e=Wn.create,F4e=Vn.create,q4e=pa.create,B4e=Wn.createWithPreprocess,V4e=Vb.create;function ql(t){return!!t._zod}function yo(t,e){return ql(t)?fs(t,e):t.safeParse(e)}function Wb(t){if(!t)return;let e;if(ql(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function b4(t){if(ql(t)){let a=t._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}function vo(t){return t==="completed"||t==="failed"||t==="cancelled"}var Dne=Symbol("Let zodToJsonSchema decide on which parser to use");var Qze=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Qk(t){let r=Wb(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=b4(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function eR(t,e){let r=yo(t,e);if(!r.success)throw r.error;return r.data}var zne=6e4,Hb=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Rb,r=>{this._oncancel(r)}),this.setNotificationHandler(Ab,r=>{this._onprogress(r)}),this.setRequestHandler(Eb,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Tb,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new se(ve.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Db,async(r,n)=>{let i=async()=>{let a=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(a,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),s.type==="response")u(c);else{let d=c,p=new se(d.error.code,d.error.message,d.error.data);u(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let o=await this._taskStore.getTask(a,n.sessionId);if(!o)throw new se(ve.InvalidParams,`Task not found: ${a}`);if(!vo(o.status))return await this._waitForTaskUpdate(a,n.signal),await i();if(vo(o.status)){let s=await this._taskStore.getTaskResult(a,n.sessionId);return this._clearTaskQueue(a),{...s,_meta:{...s._meta,[mo]:{taskId:a}}}}return await i()};return await i()}),this.setRequestHandler($b,async(r,n)=>{try{let{tasks:i,nextCursor:a}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:a,_meta:{}}}catch(i){throw new se(ve.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(jb,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new se(ve.InvalidParams,`Task not found: ${r.params.taskId}`);if(vo(i.status))throw new se(ve.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let a=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!a)throw new se(ve.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof se?i:new se(ve.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),se.fromError(ve.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=a=>{n?.(a),this._onerror(a)};let i=this._transport?.onmessage;this._transport.onmessage=(a,o)=>{i?.(a,o),Hp(a)||t4(a)?this._onresponse(a):Rk(a)?this._onrequest(a,o):e4(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=se.fromError(ve.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,a=e.params?._meta?.[mo]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:ve.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=YL(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,l={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{let d={relatedRequestId:e.id};a&&(d.relatedTask={taskId:a}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{let m={...p,relatedRequestId:e.id};a&&!m.relatedTask&&(m.relatedTask={taskId:a});let f=m.relatedTask?.taskId??a;return f&&c&&await c.updateTaskStatus(f,"input_required"),await this.request(u,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:a,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,l)).then(async u=>{if(o.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(o.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:ve.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(c);return}a(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Hp(e))n(e);else{let o=new se(e.error.code,e.error.message,e.error.data);n(o)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let a=!1;if(Hp(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,r))}}if(a||this._progressHandlers.delete(r),Hp(e))i(e);else{let o=se.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(e,r,n)}}catch(o){yield{type:"error",error:o instanceof se?o:new se(ve.InternalError,String(o))}}return}let a;try{let o=await this.request(e,Cl,n);if(o.task)a=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new se(ve.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:a},n);if(yield{type:"taskStatus",task:s},vo(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)}:s.status==="failed"?yield{type:"error",error:new se(ve.InternalError,`Task ${a} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new se(ve.InternalError,`Task ${a} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),n?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof se?o:new se(ve.InternalError,String(o))}}}request(e,r,n){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:c}=n??{};return new Promise((l,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[mo]:c}});let f=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`)));let x=b instanceof se?b:new se(ve.RequestTimeout,String(b));u(x)};this._responseHandlers.set(p,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return u(b);try{let x=yo(r,b.result);x.success?l(x.data):u(x.error)}catch(x){u(x)}}}),n?.signal?.addEventListener("abort",()=>{f(n?.signal?.reason)});let g=n?.timeout??zne,h=()=>f(se.fromError(ve.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,n?.maxTotalTimeout,h,n?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=x=>{let P=this._responseHandlers.get(p);P?P(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),u(x)})}else this._transport.send(m,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(b=>{this._cleanupTimeout(p),u(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ob,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Nb,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},i4,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[mo]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[mo]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let o={...e,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[mo]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(e,r){let n=Qk(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,a)=>{let o=eR(e,i);return Promise.resolve(r(o,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Qk(e);this._notificationHandlers.set(n,i=>{let a=eR(e,i);return Promise.resolve(r(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,i)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let i of n)if(i.type==="request"&&Rk(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new se(ve.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,a)=>{if(r.aborted){a(new se(ve.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(o),a(new se(ve.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await n.createTask(i,e.id,{method:e.method,params:e.params},r)},getTask:async i=>{let a=await n.getTask(i,r);if(!a)throw new se(ve.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await n.storeTaskResult(i,a,o,r);let s=await n.getTask(i,r);if(s){let c=Yp.parse({method:"notifications/tasks/status",params:s});await this.notification(c),vo(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,a,o)=>{let s=await n.getTask(i,r);if(!s)throw new se(ve.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(vo(s.status))throw new se(ve.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,a,o,r);let c=await n.getTask(i,r);if(c){let l=Yp.parse({method:"notifications/tasks/status",params:c});await this.notification(l),vo(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function _4(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function x4(t,e){let r={...t};for(let n in e){let i=n,a=e[i];if(a===void 0)continue;let o=r[i];_4(o)&&_4(a)?r[i]={...o,...a}:r[i]=a}return r}var sF=$t(zE(),1),cF=$t(oF(),1);function Ele(){let t=new sF.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,cF.default)(t),t}var E_=class{constructor(e){this._ajv=e??Ele()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var A_=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function lF(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function uF(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var T_=class extends Hb{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(em.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new E_,this.setRequestHandler(Tk,n=>this._oninitialize(n)),this.setNotificationHandler(Ok,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(qk,async(n,i)=>{let a=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=n.params,s=em.safeParse(o);return s.success&&this._loggingLevels.set(a,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new A_(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=x4(this._capabilities,e)}setRequestHandler(e,r){let i=Wb(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let a;if(ql(i)){let s=i;a=s._zod?.def?.value??s.value}else{let s=i;a=s._def?.value??s.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let s=async(c,l)=>{let u=yo(Qp,c);if(!u.success){let f=u.error instanceof Error?u.error.message:String(u.error);throw new se(ve.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:d}=u.data,p=await Promise.resolve(r(c,l));if(d.task){let f=yo(Cl,p);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new se(ve.InvalidParams,`Invalid task creation result: ${g}`)}return f.data}let m=yo(Mb,p);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new se(ve.InvalidParams,`Invalid tools/call result: ${f}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){uF(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&lF(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:GL.includes(r)?r:Ck,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},kb)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],a=i.some(l=>l.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],c=s.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Vk,r):this.request({method:"sampling/createMessage",params:e},Bk,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},Lb,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},Lb,r);if(a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new se(ve.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){throw o instanceof se?o:new se(ve.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return a}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Wk,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function Ale(){let t=process.env.WEPPY_ROBLOX_MCP_VERSION?.trim();return t||null}var Fe=Ale()??"2.16.2";var ZE={"claude-code":"Claude Code",claude:"Claude",cursor:"Cursor","codex-cli":"Codex CLI","openai-codex":"Codex CLI","gemini-cli":"Gemini CLI",windsurf:"Windsurf",cline:"Cline",continue:"Continue",zed:"Zed",vscode:"VS Code"};function dF(t){let e=t.toLowerCase();if(ZE[e])return ZE[e];for(let[r,n]of Object.entries(ZE))if(e.includes(r))return n;return t}function pF(){return process.env.CLAUDECODE||process.env.CLAUDE_CODE_ENTRYPOINT?{name:"Claude Code",version:""}:process.env.CURSOR_EDITOR?{name:"Cursor",version:""}:process.env.WINDSURF_EDITOR?{name:"Windsurf",version:""}:process.env.CONTINUE_GLOBAL_DIR?{name:"Continue",version:""}:process.env.CLINE_CONTEXT?{name:"Cline",version:""}:null}var GE="weppy://ui-studio/guide",KE="weppy://ui-studio/tokens",JE="weppy://ui-studio/functional-rules",mF=`# UI Studio Guide
246
246
 
247
247
  **Audience:** AI agents and developers building Roblox interfaces through UI Studio.
248
248
  **Resource:** \`weppy://ui-studio/guide\`