xmcp 0.8.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.ts +4 -5
- package/dist/config.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +38 -27
- package/dist/runtime/adapter-express.js +65 -353
- package/dist/runtime/adapter-fastify.js +65 -353
- package/dist/runtime/adapter-nestjs.js +41 -329
- package/dist/runtime/adapter-nextjs.js +61 -349
- package/dist/runtime/http.js +55 -44
- package/dist/runtime/stdio.js +40 -40
- package/dist/runtime/transports/http/base-streamable-http.d.ts +0 -15
- package/dist/runtime/utils/client-info.d.ts +1 -1
- package/dist/runtime/utils/elicitation.d.ts +3 -4
- package/dist/runtime/utils/prompts.d.ts +1 -1
- package/dist/runtime/utils/resources.d.ts +1 -1
- package/dist/runtime/utils/sampling.d.ts +3 -0
- package/dist/runtime/utils/schema-compat.d.ts +61 -0
- package/dist/runtime/utils/server.d.ts +1 -2
- package/dist/runtime/utils/tools.d.ts +1 -1
- package/dist/runtime/utils/transformers/prompt.d.ts +3 -4
- package/dist/runtime/utils/transformers/resource.d.ts +3 -4
- package/dist/runtime/utils/transformers/tool.d.ts +3 -4
- package/dist/types/middleware.d.ts +1 -1
- package/dist/types/tool.d.ts +18 -1
- package/package.json +15 -7
package/dist/runtime/stdio.js
CHANGED
|
@@ -1,49 +1,43 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,()=>(()=>{var e={5888(e,t){"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(s,n),time:r(l(!0),u),"date-time":r(p(!0),f),"iso-time":r(l(),d),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&y.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return g.lastIndex=0,g.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(e){var t;let r=a.exec(e);if(!r)return!1;let s=+r[1],n=+r[2],o=+r[3];return n>=1&&n<=12&&o>=1&&o<=(2===n&&(t=s)%4==0&&(t%100!=0||t%400==0)?29:i[n])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(e){return function(t){let r=o.exec(t);if(!r)return!1;let a=+r[1],i=+r[2],s=+r[3],n=r[4],l="-"===r[5]?-1:1,u=+(r[6]||0),d=+(r[7]||0);if(u>23||d>59||e&&!n)return!1;if(a<=23&&i<=59&&s<60)return!0;let c=i-d*l,p=a-u*l-(c<0);return(23===p||-1===p)&&(59===c||-1===c)&&s<61}}function u(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),a=new Date("2020-01-01T"+t).valueOf();if(r&&a)return r-a}function d(e,t){if(!(e&&t))return;let r=o.exec(e),a=o.exec(t);if(r&&a)return(e=r[1]+r[2]+r[3])>(t=a[1]+a[2]+a[3])?1:e<t?-1:0}let c=/t|\s/i;function p(e){let t=l(e);return function(e){let r=e.split(c);return 2===r.length&&s(r[0])&&t(r[1])}}function f(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function h(e,t){if(!(e&&t))return;let[r,a]=e.split(c),[i,s]=t.split(c),o=n(r,i);if(void 0!==o)return o||u(a,s)}let m=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let w=/[^\\]\\Z/},1712(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(5888),i=r(9035),s=r(8994),n=new s.Name("fullFormats"),o=new s.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,a.fullFormats,n),e;let[r,s]="fast"===t.mode?[a.fastFormats,o]:[a.fullFormats,n];return u(e,t.formats||a.formatNames,r,s),t.keywords&&(0,i.default)(e),e};function u(e,t,r,a){var i;for(let n of(null!=(i=e.opts.code).formats||(i.formats=(0,s._)`require("ajv-formats/dist/formats").${a}`),t))e.addFormat(n,r[n])}l.get=(e,t="full")=>{let r=("fast"===t?a.fastFormats:a.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r},e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l},9035(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let a=r(8825),i=r(8994),s=i.operators,n={formatMaximum:{okStr:"<=",ok:s.LTE,fail:s.GT},formatMinimum:{okStr:">=",ok:s.GTE,fail:s.LT},formatExclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},formatExclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,i.str)`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,i._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:s,data:o,schemaCode:l,keyword:u,it:d}=e,{opts:c,self:p}=d;if(!c.validateFormats)return;let f=new a.KeywordCxt(d,p.RULES.all.format.definition,"format");function h(e){return(0,i._)`${e}.compare(${o}, ${l}) ${n[u].fail} 0`}f.$data?(t=s.scopeValue("formats",{ref:p.formats,code:c.code.formats}),r=s.const("fmt",(0,i._)`${t}[${f.schemaCode}]`),e.fail$data((0,i.or)((0,i._)`typeof ${r} != "object"`,(0,i._)`${r} instanceof RegExp`,(0,i._)`typeof ${r}.compare != "function"`,h(r)))):function(){let t=f.schema,r=p.formats[t];if(!r||!0===r)return;if("object"!=typeof r||r instanceof RegExp||"function"!=typeof r.compare)throw Error(`"${u}": format "${t}" does not define "compare" function`);let a=s.scopeValue("formats",{key:t,ref:r,code:c.code.formats?(0,i._)`${c.code.formats}${(0,i.getProperty)(t)}`:void 0});e.fail$data(h(a))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},8825(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=r(1967),i=r(3959),s=r(9376),n=r(7456),o=["/properties"],l="http://json-schema.org/draft-07/schema";class u extends a.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var d=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var c=r(8994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var p=r(4383);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=r(4220);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})},8261(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class i extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof a&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function s(e,...t){let r=[e[0]],a=0;for(;a<t.length;)l(r,t[a]),r.push(e[++a]);return new i(r)}t._Code=i,t.nil=new i(""),t._=s;let n=new i("+");function o(e,...t){let r=[u(e[0])],s=0;for(;s<t.length;)r.push(n),l(r,t[s]),r.push(n,u(e[++s]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var r,i;let s=(r=e[t-1],'""'===(i=e[t+1])?r:'""'===r?i:"string"==typeof r?i instanceof a||'"'!==r[r.length-1]?void 0:"string"!=typeof i?`${r.slice(0,-1)}${i}"`:'"'===i[0]?r.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||r instanceof a?void 0:`"${r}${i.slice(1)}`);if(void 0!==s){e.splice(t-1,3,s);continue}e[t++]="+"}t++}}(r),new i(r)}function l(e,t){var r;t instanceof i?e.push(...t._items):t instanceof a?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:u(Array.isArray(r)?r.join(","):r))}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=o,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},t.stringify=function(e){return new i(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):s`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},8994(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let a=r(8261),i=r(4490);var s=r(8261);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}});var n=r(4490);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new a._Code(">"),GTE:new a._Code(">="),LT:new a._Code("<"),LTE:new a._Code("<="),EQ:new a._Code("==="),NEQ:new a._Code("!=="),NOT:new a._Code("!"),OR:new a._Code("||"),AND:new a._Code("&&"),ADD:new a._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends o{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?i.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${a};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,e,t)),this}get names(){return this.rhs instanceof a._CodeOrName?this.rhs.names:{}}}class u extends o{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof a.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,e,t),this}get names(){return j(this.lhs instanceof a.Name?{}:{...this.lhs.names},this.rhs)}}class d extends u{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class c extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class f extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=N(this.code,e,t),this}get names(){return this.code instanceof a._CodeOrName?this.code.names:{}}}class m extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,a=r.length;for(;a--;){let i=r[a];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>O(e,t.names),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class g extends m{}class v extends y{}v.kind="else";class _ extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(z(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=N(this.condition,e,t),this}get names(){let e=super.names;return j(e,this.condition),this.else&&O(e,this.else.names),e}}_.kind="if";class b extends y{}b.kind="for";class w extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=N(this.iteration,e,t),this}get names(){return O(super.names,this.iteration.names)}}class $ extends b{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?i.varKinds.var:this.varKind,{name:r,from:a,to:s}=this;return`for(${t} ${r}=${a}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=j(super.names,this.from);return j(e,this.to)}}class k extends b{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=N(this.iterable,e,t),this}get names(){return O(super.names,this.iterable.names)}}class x extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}x.kind="func";class S extends m{render(e){return"return "+super.render(e)}}S.kind="return";class E extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&O(e,this.catch.names),this.finally&&O(e,this.finally.names),e}}class T extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}T.kind="catch";class P extends y{render(e){return"finally"+super.render(e)}}function O(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function j(e,t){return t instanceof a._CodeOrName?O(e,t.names):e}function N(e,t,r){var i;if(e instanceof a.Name)return s(e);if(!((i=e)instanceof a._Code&&i._items.some(e=>e instanceof a.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new a._Code(e._items.reduce((e,t)=>(t instanceof a.Name&&(t=s(t)),t instanceof a._Code?e.push(...t._items):e.push(t),e),[]));function s(e){let a=r[e.str];return void 0===a||1!==t[e.str]?e:(delete t[e.str],a)}}function z(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,a._)`!${A(e)}`}P.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,a){let i=this._scope.toName(t);return void 0!==r&&a&&(this._constants[i.str]=r),this._leafNode(new l(e,i,r)),i}const(e,t,r){return this._def(i.varKinds.const,e,t,r)}let(e,t,r){return this._def(i.varKinds.let,e,t,r)}var(e,t,r){return this._def(i.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new d(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==a.nil&&this._leafNode(new h(e)),this}object(...e){let t=["{"];for(let[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0,a.addCodeArg)(t,i));return t.push("}"),new a._Code(t)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(_,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,a,s=this.opts.es5?i.varKinds.var:i.varKinds.let){let n=this._scope.toName(e);return this._for(new $(s,n,t,r),()=>a(n))}forOf(e,t,r,s=i.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let e=t instanceof a.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,a._)`${e}.length`,t=>{this.var(n,(0,a._)`${e}[${t}]`),r(n)})}return this._for(new k("of",s,n,t),()=>r(n))}forIn(e,t,r,s=this.opts.es5?i.varKinds.var:i.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,a._)`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new k("in",s,n,t),()=>r(n))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new c(e))}break(e){return this._leafNode(new p(e))}return(e){let t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new E;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new T(e),t(e)}return r&&(this._currNode=a.finally=new P,this.code(r)),this._endBlockNode(T,P)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=a.nil,r,i){return this._blockNode(new x(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=z;let I=C(t.operators.AND);t.and=function(...e){return e.reduce(I)};let R=C(t.operators.OR);function C(e){return(t,r)=>t===a.nil?r:r===a.nil?t:(0,a._)`${A(t)} ${e} ${A(r)}`}function A(e){return e instanceof a.Name?e:(0,a._)`(${e})`}t.or=function(...e){return e.reduce(R)}},4490(e,t,r){"use strict";var a,i;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let s=r(8261);class n extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(i=a||(t.UsedValueState=a={}))[i.Started=0]="Started",i[i.Completed=1]="Completed",t.varKinds={const:new s.Name("const"),let:new s.Name("let"),var:new s.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof s.Name?e:this.name(e)}name(e){return new s.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class l extends s.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,s._)`.${new s.Name(t)}[${r}]`}}t.ValueScopeName=l;let u=(0,s._)`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?u:s.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:i}=a,s=null!=(r=t.key)?r:t.ref,n=this._values[i];if(n){let e=n.get(s);if(e)return e}else n=this._values[i]=new Map;n.set(s,a);let o=this._scope[i]||(this._scope[i]=[]),l=o.length;return o[l]=t.ref,a.setValue(t,{property:i,itemIndex:l}),a}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,s._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,i={},o){let l=s.nil;for(let u in e){let d=e[u];if(!d)continue;let c=i[u]=i[u]||new Map;d.forEach(e=>{if(c.has(e))return;c.set(e,a.Started);let i=r(e);if(i){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,s._)`${l}${r} ${e} = ${i};${this.opts._n}`}else if(i=null==o?void 0:o(e))l=(0,s._)`${l}${i}${this.opts._n}`;else throw new n(e);c.set(e,a.Completed)})}return l}}},8425(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let a=r(8994),i=r(7218),s=r(6660);function n(e,t){let r=e.const("err",t);e.if((0,a._)`${s.default.vErrors} === null`,()=>e.assign(s.default.vErrors,(0,a._)`[${r}]`),(0,a._)`${s.default.vErrors}.push(${r})`),e.code((0,a._)`${s.default.errors}++`)}function o(e,t){let{gen:r,validateName:i,schemaEnv:s}=e;s.$async?r.throw((0,a._)`new ${e.ValidationError}(${t})`):(r.assign((0,a._)`${i}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>(0,a.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,a.str)`"${e}" keyword must be ${t} ($data)`:(0,a.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,i,s){let{it:l}=e,{gen:d,compositeRule:c,allErrors:p}=l,f=u(e,r,i);(null!=s?s:c||p)?n(d,f):o(l,(0,a._)`[${f}]`)},t.reportExtraError=function(e,r=t.keywordError,a){let{it:i}=e,{gen:l,compositeRule:d,allErrors:c}=i;n(l,u(e,r,a)),d||c||o(i,s.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(s.default.errors,t),e.if((0,a._)`${s.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,a._)`${s.default.vErrors}.length`,t),()=>e.assign(s.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(void 0===n)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",n,s.default.errors,n=>{e.const(l,(0,a._)`${s.default.vErrors}[${n}]`),e.if((0,a._)`${l}.instancePath === undefined`,()=>e.assign((0,a._)`${l}.instancePath`,(0,a.strConcat)(s.default.instancePath,o.errorPath))),e.assign((0,a._)`${l}.schemaPath`,(0,a.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,a._)`${l}.schema`,r),e.assign((0,a._)`${l}.data`,i))})};let l={keyword:new a.Name("keyword"),schemaPath:new a.Name("schemaPath"),params:new a.Name("params"),propertyName:new a.Name("propertyName"),message:new a.Name("message"),schema:new a.Name("schema"),parentSchema:new a.Name("parentSchema")};function u(e,t,r){let{createErrors:n}=e.it;return!1===n?(0,a._)`{}`:function(e,t,r={}){let{gen:n,it:o}=e,u=[function({errorPath:e},{instancePath:t}){let r=t?(0,a.str)`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[s.default.instancePath,(0,a.strConcat)(s.default.instancePath,r)]}(o,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:s}){let n=s?t:(0,a.str)`${t}/${e}`;return r&&(n=(0,a.str)`${n}${(0,i.getErrorPath)(r,i.Type.Str)}`),[l.schemaPath,n]}(e,r)];return function(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:u,it:d}=e,{opts:c,propertyName:p,topSchemaRef:f,schemaPath:h}=d;i.push([l.keyword,n],[l.params,"function"==typeof t?t(e):t||(0,a._)`{}`]),c.messages&&i.push([l.message,"function"==typeof r?r(e):r]),c.verbose&&i.push([l.schema,u],[l.parentSchema,(0,a._)`${f}${h}`],[s.default.data,o]),p&&i.push([l.propertyName,p])}(e,t,u),n.object(...u)}(e,t,r)}},1688(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let a=r(8994),i=r(4383),s=r(6660),n=r(9008),o=r(7218),l=r(6023);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function d(e){let t,r,o=p.call(this,e);if(o)return o;let u=(0,n.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:c}=this.opts.code,{ownProperties:f}=this.opts,h=new a.CodeGen(this.scope,{es5:d,lines:c,ownProperties:f});e.$async&&(t=h.scopeValue("Error",{ref:i.default,code:(0,a._)`require("ajv/dist/runtime/validation_error").default`}));let m=h.scopeName("validate");e.validateName=m;let y={gen:h,allErrors:this.opts.allErrors,data:s.default.data,parentData:s.default.parentData,parentDataProperty:s.default.parentDataProperty,dataNames:[s.default.data],dataPathArr:[a.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,a.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:u,baseId:e.baseId||u,schemaPath:a.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,a._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(y),h.optimize(this.opts.code.optimize);let t=h.toString();r=`${h.scopeRefs(s.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let i=Function(`${s.default.self}`,`${s.default.scope}`,r)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:m,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:t}=y;i.evaluated={props:e instanceof a.Name?void 0:e,items:t instanceof a.Name?void 0:t,dynamicProps:e instanceof a.Name,dynamicItems:t instanceof a.Name},i.source&&(i.source.evaluated=(0,a.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function c(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:d.call(this,e)}function p(e){for(let a of this._compilations){var t,r;if(t=a,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return a}}function f(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){let r=this.opts.uriResolver.parse(t),a=(0,n._getFullPath)(this.opts.uriResolver,r),i=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===i)return y.call(this,r,e);let s=(0,n.normalizeId)(a),o=this.refs[s]||this.schemas[s];if("string"==typeof o){let t=h.call(this,e,o);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||d.call(this,o),s===(0,n.normalizeId)(t)){let{schema:t}=o,{schemaId:r}=this.opts,a=t[r];return a&&(i=(0,n.resolveUrl)(this.opts.uriResolver,i,a)),new u({schema:t,schemaId:r,root:e,baseId:i})}return y.call(this,r,o)}}t.SchemaEnv=u,t.compileSchema=d,t.resolveRef=function(e,t,r){var a;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let s=f.call(this,e,r);if(void 0===s){let i=null==(a=e.localRefs)?void 0:a[r],{schemaId:n}=this.opts;i&&(s=new u({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==s)return e.refs[r]=c.call(this,s)},t.getCompilingSchema=p,t.resolveSchema=h;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:a}){var i;let s;if((null==(i=e.fragment)?void 0:i[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,o.unescapeFragment)(a)];if(void 0===e)return;let i="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&i&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,i))}if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){let e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=h.call(this,a,e)}let{schemaId:l}=this.opts;if((s=s||new u({schema:r,schemaId:l,root:a,baseId:t})).schema!==s.root.schema)return s}},6660(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994);t.default={data:new a.Name("data"),valCxt:new a.Name("valCxt"),instancePath:new a.Name("instancePath"),parentData:new a.Name("parentData"),parentDataProperty:new a.Name("parentDataProperty"),rootData:new a.Name("rootData"),dynamicAnchors:new a.Name("dynamicAnchors"),vErrors:new a.Name("vErrors"),errors:new a.Name("errors"),this:new a.Name("this"),self:new a.Name("self"),scope:new a.Name("scope"),json:new a.Name("json"),jsonPos:new a.Name("jsonPos"),jsonLen:new a.Name("jsonLen"),jsonPart:new a.Name("jsonPart")}},4220(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(9008);t.default=class extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,a.resolveUrl)(e,t,r),this.missingSchema=(0,a.normalizeId)((0,a.getFullPath)(e,this.missingRef))}}},9008(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let a=r(7218),i=r(7371),s=r(205),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(o.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let i in t)if("$ref"===i||(r++,!n.has(i)&&("object"==typeof t[i]&&(0,a.eachItem)(t[i],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=c(t));let a=e.parse(t);return u(e,a)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=u;let d=/#\/?$/;function c(e){return e?e.replace(d,""):""}t.normalizeId=c,t.resolveUrl=function(e,t,r){return r=c(r),e.resolve(t,r)};let p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:a}=this.opts,n=c(e[r]||t),o={"":n},u=l(a,n,!1),d={},f=new Set;return s(e,{allKeys:!0},(e,t,a,i)=>{if(void 0===i)return;let s=u+t,n=o[i];function l(t){let r=this.opts.uriResolver.resolve;if(t=c(n?r(n,t):t),f.has(t))throw m(t);f.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?h(e,a.schema,t):t!==c(s)&&("#"===t[0]?(h(e,d[t],t),d[t]=e):this.refs[t]=s),t}function y(e){if("string"==typeof e){if(!p.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(n=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),o[t]=n}),d;function h(e,t,r){if(void 0!==t&&!i(e,t))throw m(r)}function m(e){return Error(`reference "${e}" resolves to more than one schema`)}}},6247(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},7218(e,t,r){"use strict";var a,i;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let s=r(8994),n=r(8261);function o(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=a.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function l(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function u(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function d(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(i,n,o,l)=>{let u=void 0===o?n:o instanceof s.Name?(n instanceof s.Name?e(i,n,o):t(i,n,o),o):n instanceof s.Name?(t(i,o,n),n):r(n,o);return l!==s.Name||u instanceof s.Name?u:a(i,u)}}function p(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,s._)`{}`);return void 0!==t&&f(e,r,t),r}function f(e,t,r){Object.keys(r).forEach(r=>e.assign((0,s._)`${t}${(0,s.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!l(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=l,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,a,i){if(!i){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,s._)`${r}`}return(0,s._)`${e}${t}${(0,s.getProperty)(a)}`},t.unescapeFragment=function(e){return d(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(u(e))},t.escapeJsonPointer=u,t.unescapeJsonPointer=d,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if((0,s._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,s._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,s._)`${r} || {}`).code((0,s._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,s._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,s._)`${r} || {}`),f(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:p}),items:c({mergeNames:(e,t,r)=>e.if((0,s._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,s._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,s._)`${r} !== true`,()=>e.assign(r,!0===t||(0,s._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=p,t.setEvaluated=f;let h={};function m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new n._Code(t.code))})},(i=a||(t.Type=a={}))[i.Num=0]="Num",i[i.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof s.Name){let i=t===a.Num;return r?i?(0,s._)`"[" + ${e} + "]"`:(0,s._)`"['" + ${e} + "']"`:i?(0,s._)`"/" + ${e}`:(0,s._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,s.getProperty)(e).toString():"/"+u(e)},t.checkStrictMode=m},238(e,t){"use strict";function r(e,t){return t.rules.some(t=>a(e,t))}function a(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},a){let i=t.RULES.types[a];return i&&!0!==i&&r(e,i)},t.shouldUseGroup=r,t.shouldUseRule=a},564(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let a=r(8425),i=r(8994),s=r(6660),n={message:"boolean schema is false"};function o(e,t){let{gen:r,data:i}=e;(0,a.reportError)({gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},n,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:a}=e;!1===r?o(e,!1):"object"==typeof r&&!0===r.$async?t.return(s.default.data):(t.assign((0,i._)`${a}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),o(e)):r.var(t,!0)}},6419(e,t,r){"use strict";var a,i;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let s=r(6247),n=r(238),o=r(8425),l=r(8994),u=r(7218);function d(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(s.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(i=a||(t.DataType=a={}))[i.Correct=0]="Correct",i[i.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=d(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=d,t.coerceAndCheckDataType=function(e,t){var r,i;let{gen:s,data:o,opts:u}=e,d=(r=t,(i=u.coerceTypes)?r.filter(e=>c.has(e)||"array"===i&&"array"===e):[]),p=t.length>0&&!(0===d.length&&1===t.length&&(0,n.schemaHasRulesForType)(e,t[0]));if(p){let r=f(t,o,u.strictNumbers,a.Wrong);s.if(r,()=>{d.length?function(e,t,r){let{gen:a,data:i,opts:s}=e,n=a.let("dataType",(0,l._)`typeof ${i}`),o=a.let("coerced",(0,l._)`undefined`);for(let e of("array"===s.coerceTypes&&a.if((0,l._)`${n} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,l._)`${i}[0]`).assign(n,(0,l._)`typeof ${i}`).if(f(t,i,s.strictNumbers),()=>a.assign(o,i))),a.if((0,l._)`${o} !== undefined`),r))(c.has(e)||"array"===e&&"array"===s.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,l._)`${n} == "number" || ${n} == "boolean"`).assign(o,(0,l._)`"" + ${i}`).elseIf((0,l._)`${i} === null`).assign(o,(0,l._)`""`);return;case"number":a.elseIf((0,l._)`${n} == "boolean" || ${i} === null
|
|
2
|
-
|| (${n} == "string" && ${i} && ${i} == +${i})`).assign(o,(0,l._)`+${i}`);return;case"integer":a.elseIf((0,l._)`${n} === "boolean" || ${i} === null
|
|
3
|
-
|| (${n} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(o,(0,l._)`+${i}`);return;case"boolean":a.elseIf((0,l._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(o,!1).elseIf((0,l._)`${i} === "true" || ${i} === 1`).assign(o,!0);return;case"null":a.elseIf((0,l._)`${i} === "" || ${i} === 0 || ${i} === false`),a.assign(o,null);return;case"array":a.elseIf((0,l._)`${n} === "string" || ${n} === "number"
|
|
4
|
-
|| ${n} === "boolean" || ${i} === null`).assign(o,(0,l._)`[${i}]`)}}(e);a.else(),m(e),a.endIf(),a.if((0,l._)`${o} !== undefined`,()=>{a.assign(i,o),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,l._)`${t} !== undefined`,()=>e.assign((0,l._)`${t}[${r}]`,a))}(e,o)})}(e,t,d):m(e)})}return p};let c=new Set(["string","number","integer","boolean","null"]);function p(e,t,r,i=a.Correct){let s,n=i===a.Correct?l.operators.EQ:l.operators.NEQ;switch(e){case"null":return(0,l._)`${t} ${n} null`;case"array":s=(0,l._)`Array.isArray(${t})`;break;case"object":s=(0,l._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=o((0,l._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=o();break;default:return(0,l._)`typeof ${t} ${n} ${e}`}return i===a.Correct?s:(0,l.not)(s);function o(e=l.nil){return(0,l.and)((0,l._)`typeof ${t} == "number"`,e,r?(0,l._)`isFinite(${t})`:l.nil)}}function f(e,t,r,a){let i;if(1===e.length)return p(e[0],t,r,a);let s=(0,u.toHash)(e);if(s.array&&s.object){let e=(0,l._)`typeof ${t} != "object"`;i=s.null?e:(0,l._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else i=l.nil;for(let e in s.number&&delete s.integer,s)i=(0,l.and)(i,p(e,t,r,a));return i}t.checkDataType=p,t.checkDataTypes=f;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,l._)`{type: ${e}}`:(0,l._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:a}=e,i=(0,u.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:i,schemaValue:i,parentSchema:a,params:{},it:e}}(e);(0,o.reportError)(t,h)}t.reportTypeError=m},6593(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let a=r(8994),i=r(7218);function s(e,t,r){let{gen:s,compositeRule:n,data:o,opts:l}=e;if(void 0===r)return;let u=(0,a._)`${o}${(0,a.getProperty)(t)}`;if(n)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let d=(0,a._)`${u} === undefined`;"empty"===l.useDefaults&&(d=(0,a._)`${d} || ${u} === null || ${u} === ""`),s.if(d,(0,a._)`${u} = ${(0,a.stringify)(r)}`)}t.assignDefaults=function(e,t){let{properties:r,items:a}=e.schema;if("object"===t&&r)for(let t in r)s(e,t,r[t].default);else"array"===t&&Array.isArray(a)&&a.forEach((t,r)=>s(e,r,t.default))}},6023(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let a=r(564),i=r(6419),s=r(238),n=r(6419),o=r(6593),l=r(9820),u=r(3826),d=r(8994),c=r(6660),p=r(9008),f=r(7218),h=r(8425);function m({gen:e,validateName:t,schema:r,schemaEnv:a,opts:i},s){var n;i.code.es5?e.func(t,(0,d._)`${c.default.data}, ${c.default.valCxt}`,a.$async,()=>{var t,a;e.code((0,d._)`"use strict"; ${y(r,i)}`),t=e,a=i,t.if(c.default.valCxt,()=>{t.var(c.default.instancePath,(0,d._)`${c.default.valCxt}.${c.default.instancePath}`),t.var(c.default.parentData,(0,d._)`${c.default.valCxt}.${c.default.parentData}`),t.var(c.default.parentDataProperty,(0,d._)`${c.default.valCxt}.${c.default.parentDataProperty}`),t.var(c.default.rootData,(0,d._)`${c.default.valCxt}.${c.default.rootData}`),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,d._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{t.var(c.default.instancePath,(0,d._)`""`),t.var(c.default.parentData,(0,d._)`undefined`),t.var(c.default.parentDataProperty,(0,d._)`undefined`),t.var(c.default.rootData,c.default.data),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,d._)`{}`)}),e.code(s)}):e.func(t,(0,d._)`${c.default.data}, ${(n=i,(0,d._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${n.dynamicRef?(0,d._)`, ${c.default.dynamicAnchors}={}`:d.nil}}={}`)}`,a.$async,()=>e.code(y(r,i)).code(s))}function y(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,d._)`/*# sourceURL=${r} */`:d.nil}function g({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function _(e){(0,f.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:a,self:i}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return $(e,[],!1,t);let r=(0,i.getSchemaTypes)(e.schema),a=(0,i.coerceAndCheckDataType)(e,r);$(e,r,!a,t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:i}){let s=r.$comment;if(!0===i.$comment)e.code((0,d._)`${c.default.self}.logger.log(${s})`);else if("function"==typeof i.$comment){let r=(0,d.str)`${a}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,d._)`${c.default.self}.opts.$comment(${s}, ${r}, ${i}.schema)`)}}function $(e,t,r,a){var i,o,l,u;let{gen:p,schema:h,data:m,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(h.$ref&&(g.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(h,_)))return void p.block(()=>T(e,"$ref",_.all.$ref.definition));function b(i){(0,s.shouldUseGroup)(h,i)&&(i.type?(p.if((0,n.checkDataType)(i.type,m,g.strictNumbers)),k(e,i),1===t.length&&t[0]===i.type&&r&&(p.else(),(0,n.reportTypeError)(e)),p.endIf()):k(e,i),y||p.if((0,d._)`${c.default.errors} === ${a||0}`))}g.jtd||(i=e,o=t,!i.schemaEnv.meta&&i.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{x(e.dataTypes,t)||S(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let a of e.dataTypes)x(t,a)?r.push(a):t.includes("integer")&&"number"===a&&r.push("integer");e.dataTypes=r}(e,t)}}(i,o),i.opts.allowUnionTypes||(l=i,(u=o).length>1&&!(2===u.length&&u.includes("null"))&&S(l,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let a in r){let i=r[a];if("object"==typeof i&&(0,s.shouldUseRule)(e.schema,i)){let{type:r}=i.definition;r.length&&!r.some(e=>{var r,a;return r=t,a=e,r.includes(a)||"number"===a&&r.includes("integer")})&&S(e,`missing type "${r.join(",")}" for keyword "${a}"`)}}}(i,i.dataTypes))),p.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function k(e,t){let{gen:r,schema:a,opts:{useDefaults:i}}=e;i&&(0,o.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,s.shouldUseRule)(a,r)&&T(e,r.keyword,r.definition,t.type)})}function x(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){v(e)&&(_(e),g(e))?function(e){let{schema:t,opts:r,gen:a}=e;m(e,()=>{r.$comment&&t.$comment&&w(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),a.let(c.default.vErrors,null),a.let(c.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,d._)`${r}.evaluated`),t.if((0,d._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,d._)`${e.evaluated}.props`,(0,d._)`undefined`)),t.if((0,d._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,d._)`${e.evaluated}.items`,(0,d._)`undefined`))}(e),b(e),function(e){let{gen:t,schemaEnv:r,validateName:a,ValidationError:i,opts:s}=e;r.$async?t.if((0,d._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,d._)`new ${i}(${c.default.vErrors})`)):(t.assign((0,d._)`${a}.errors`,c.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:a}){r instanceof d.Name&&e.assign((0,d._)`${t}.props`,r),a instanceof d.Name&&e.assign((0,d._)`${t}.items`,a)}(e),t.return((0,d._)`${c.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,a.topBoolOrEmptySchema)(e))};class E{constructor(e,t,r){if((0,l.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",j(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,d.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,d.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,d._)`${t} !== undefined && (${(0,d.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=d.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=d.nil,t=d.nil){if(!this.$data)return;let{gen:r,schemaCode:a,schemaType:i,def:s}=this;r.if((0,d.or)((0,d._)`${a} === undefined`,t)),e!==d.nil&&r.assign(e,!0),(i.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==d.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:a,it:i}=this;return(0,d.or)(function(){if(r.length){if(!(t instanceof d.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,d._)`${(0,n.checkDataTypes)(e,t,i.opts.strictNumbers,n.DataType.Wrong)}`}return d.nil}(),function(){if(a.validateSchema){let r=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,d._)`!${r}(${t})`}return d.nil}())}subschema(e,t){let r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return!function(e,t){if(v(e)&&(_(e),g(e)))return function(e,t){var r;let a,{schema:i,gen:s,opts:n}=e;n.$comment&&i.$comment&&w(e),(a=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,p.resolveUrl)(r.opts.uriResolver,r.baseId,a)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let o=s.const("_errs",c.default.errors);b(e,o),s.var(t,(0,d._)`${o} === ${c.default.errors}`)}(e,t);(0,a.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){let{it:r,gen:a}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=f.mergeEvaluated.props(a,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=f.mergeEvaluated.items(a,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:a}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return a.if(t,()=>this.mergeEvaluated(e,d.Name)),!0}}function T(e,t,r,a){let i=new E(e,r,t);"code"in r?r.code(i,a):i.$data&&r.validate?(0,l.funcKeywordCode)(i,r):"macro"in r?(0,l.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,l.funcKeywordCode)(i,r)}t.KeywordCxt=E;let P=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function j(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let i,s;if(""===e)return c.default.rootData;if("/"===e[0]){if(!P.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,s=c.default.rootData}else{let n=O.exec(e);if(!n)throw Error(`Invalid JSON-pointer: ${e}`);let l=+n[1];if("#"===(i=n[2])){if(l>=t)throw Error(o("property/index",l));return a[t-l]}if(l>t)throw Error(o("data",l));if(s=r[t-l],!i)return s}let n=s;for(let e of i.split("/"))e&&(s=(0,d._)`${s}${(0,d.getProperty)((0,f.unescapeJsonPointer)(e))}`,n=(0,d._)`${n} && ${s}`);return n;function o(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=j},9820(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let a=r(8994),i=r(6660),s=r(4954),n=r(8425);function o(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,a._)`${i.parentData}[${i.parentDataProperty}]`))}function l(e,t,r){if(void 0===r)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,a.stringify)(r)})}t.macroKeywordCode=function(e,t){let{gen:r,keyword:i,schema:s,parentSchema:n,it:o}=e,u=t.macro.call(o.self,s,n,o),d=l(r,i,u);!1!==o.opts.validateSchema&&o.self.validateSchema(u,!0);let c=r.name("valid");e.subschema({schema:u,schemaPath:a.nil,errSchemaPath:`${o.errSchemaPath}/${i}`,topSchemaRef:d,compositeRule:!0},c),e.pass(c,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;let{gen:u,keyword:d,schema:c,parentSchema:p,$data:f,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,t);let m=l(u,d,!f&&t.compile?t.compile.call(h.self,c,p,h):t.validate),y=u.let("valid");function g(r=t.async?(0,a._)`await `:a.nil){let n=h.opts.passContext?i.default.this:i.default.self,o=!("compile"in t&&!f||!1===t.schema);u.assign(y,(0,a._)`${r}${(0,s.callValidateCode)(e,m,n,o)}`,t.modifying)}function v(e){var r;u.if((0,a.not)(null!=(r=t.valid)?r:y),e)}e.block$data(y,function(){if(!1===t.errors)g(),t.modifying&&o(e),v(()=>e.error());else{let r,s,l=t.async?(r=u.let("ruleErrs",null),u.try(()=>g((0,a._)`await `),e=>u.assign(y,!1).if((0,a._)`${e} instanceof ${h.ValidationError}`,()=>u.assign(r,(0,a._)`${e}.errors`),()=>u.throw(e))),r):(s=(0,a._)`${m}.errors`,u.assign(s,null),g(a.nil),s);t.modifying&&o(e),v(()=>(function(e,t){let{gen:r}=e;r.if((0,a._)`Array.isArray(${t})`,()=>{r.assign(i.default.vErrors,(0,a._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,(0,a._)`${i.default.vErrors}.length`),(0,n.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(r=t.valid)?r:y)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:a},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw Error("ajv implementation error");let n=i.dependencies;if(null==n?void 0:n.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${s}: ${n.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[s])){let e=`keyword "${s}" value is invalid at path "${a}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}},3826(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let a=r(8994),i=r(7218);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:s,schemaPath:n,errSchemaPath:o,topSchemaRef:l}){if(void 0!==t&&void 0!==s)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let s=e.schema[t];return void 0===r?{schema:s,schemaPath:(0,a._)`${e.schemaPath}${(0,a.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,a._)`${e.schemaPath}${(0,a.getProperty)(t)}${(0,a.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(r)}`}}if(void 0!==s){if(void 0===n||void 0===o||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:n,topSchemaRef:l,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:s,data:n,dataTypes:o,propertyName:l}){if(void 0!==n&&void 0!==r)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=t;if(void 0!==r){let{errorPath:n,dataPathArr:o,opts:l}=t;d(u.let("data",(0,a._)`${t.data}${(0,a.getProperty)(r)}`,!0)),e.errorPath=(0,a.str)`${n}${(0,i.getErrorPath)(r,s,l.jsPropertySyntax)}`,e.parentDataProperty=(0,a._)`${r}`,e.dataPathArr=[...o,e.parentDataProperty]}function d(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==n&&(d(n instanceof a.Name?n:u.let("data",n,!0)),void 0!==l&&(e.propertyName=l)),o&&(e.dataTypes=o)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:i,allErrors:s}){void 0!==a&&(e.compositeRule=a),void 0!==i&&(e.createErrors=i),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}},1967(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var a=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var i=r(8994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});let s=r(4383),n=r(4220),o=r(6247),l=r(1688),u=r(8994),d=r(9008),c=r(6419),p=r(7218),f=r(114),h=r(8951),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let y=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,a,i,s,n,o,l,u,d,c,p,f,y,g,v,_,b,w,$,k,x,S,E,T;let P=e.strict,O=null==(t=e.code)?void 0:t.optimize,j=!0===O||void 0===O?1:O||0,N=null!=(a=null==(r=e.code)?void 0:r.regExp)?a:m,z=null!=(i=e.uriResolver)?i:h.default;return{strictSchema:null==(n=null!=(s=e.strictSchema)?s:P)||n,strictNumbers:null==(l=null!=(o=e.strictNumbers)?o:P)||l,strictTypes:null!=(d=null!=(u=e.strictTypes)?u:P)?d:"log",strictTuples:null!=(p=null!=(c=e.strictTuples)?c:P)?p:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:P)&&y,code:e.code?{...e.code,optimize:j,regExp:N}:{optimize:j,regExp:N},loopRequired:null!=(g=e.loopRequired)?g:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(w=e.inlineRefs)||w,schemaId:null!=($=e.schemaId)?$:"$id",addUsedSchema:null==(k=e.addUsedSchema)||k,validateSchema:null==(x=e.validateSchema)||x,validateFormats:null==(S=e.validateFormats)||S,unicodeRegExp:null==(E=e.unicodeRegExp)||E,int32range:null==(T=e.int32range)||T,uriResolver:z}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:g,es5:t,lines:r}),this.logger=function(e){if(!1===e)return T;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const a=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,v,e,"NOT SUPPORTED"),w.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=E.call(this),e.formats&&x.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&S.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),k.call(this),e.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,a=f;"id"===r&&((a={...f}).id=a.$id,delete a.$id),t&&e&&this.addMetaSchema(a,a[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let a=r(t);return"$async"in r||(this.errors=r.errors),a}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return a.call(this,e,t);async function a(e,t){await i.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||s.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return o.call(this,t),await l.call(this,t.missingSchema),s.call(this,e)}}function o({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,a=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,a);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,d.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,a,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let a=this.validate(r,e);if(!a&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return a}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,a=new l.SchemaEnv({schema:{},schemaId:r});if(!(t=l.resolveSchema.call(this,a,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,d.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(O.call(this,r,t),!t)return(0,p.eachItem)(r,e=>j.call(this,e)),this;z.call(this,t);let a={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,p.eachItem)(r,0===a.type.length?e=>j.call(this,e,a):e=>a.type.forEach(t=>j.call(this,e,a,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let a of(e=JSON.parse(JSON.stringify(e)),t)){let t=a.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:a}=t.definition,s=i[e];a&&s&&(i[e]=R(s))}}return e}_removeAllSchemas(e,t){for(let r in e){let a=e[r];(!t||t.test(r))&&("string"==typeof a?delete e[r]:a&&!a.meta&&(this._cache.delete(a.schema),delete e[r]))}}_addSchema(e,t,r,a=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:n}=this.opts;if("object"==typeof e)s=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let o=this._cache.get(e);if(void 0!==o)return o;r=(0,d.normalizeId)(s||r);let u=d.getSchemaRefs.call(this,e,r);return o=new l.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(o.schema,o),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=o),a&&this.validateSchema(e,!0),o}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,a="error"){for(let i in e)i in t&&this.logger[a](`${r}: option ${i}. ${e[i]}`)}function $(e){return e=(0,d.normalizeId)(e),this.schemas[e]||this.refs[e]}function k(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function x(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function S(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function E(){let e={...this.opts};for(let t of y)delete e[t];return e}b.ValidationError=s.default,b.MissingRefError=n.default,t.default=b;let T={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function O(e,t){let{RULES:r}=this;if((0,p.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!P.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function j(e,t,r){var a;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,n=i?s.post:s.rules.find(({type:e})=>e===r);if(n||(n={type:r,rules:[]},s.rules.push(n)),s.keywords[e]=!0,!t)return;let o={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?N.call(this,n,o,t.before):n.rules.push(o),s.all[e]=o,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function N(e,t,r){let a=e.rules.findIndex(e=>e.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function z(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}let I={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,I]}}},6013(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(7371);a.code='require("ajv/dist/runtime/equal").default',t.default=a},5532(e,t){"use strict";function r(e){let t,r=e.length,a=0,i=0;for(;i<r;)a++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return a}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},8951(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(7980);a.code='require("ajv/dist/runtime/uri").default',t.default=a},4383(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}},714(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let a=r(8994),i=r(7218);function s(e,t){let{gen:r,schema:s,data:n,keyword:o,it:l}=e;l.items=!0;let u=r.const("len",(0,a._)`${n}.length`);if(!1===s)e.setParams({len:t.length}),e.pass((0,a._)`${u} <= ${t.length}`);else if("object"==typeof s&&!(0,i.alwaysValidSchema)(l,s)){let s=r.var("valid",(0,a._)`${u} <= ${t.length}`);r.if((0,a.not)(s),()=>{var n;return n=s,void r.forRange("i",t.length,u,t=>{e.subschema({keyword:o,dataProp:t,dataPropType:i.Type.Num},n),l.allErrors||r.if((0,a.not)(n),()=>r.break())})}),e.ok(s)}}t.validateAdditionalItems=s,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,a._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;Array.isArray(a)?s(e,a):(0,i.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}}},8401(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(4954),i=r(8994),s=r(6660),n=r(7218);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,i._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:r,parentSchema:o,data:l,errsCount:u,it:d}=e;if(!u)throw Error("ajv implementation error");let{allErrors:c,opts:p}=d;if(d.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(d,r))return;let f=(0,a.allSchemaProperties)(o.properties),h=(0,a.allSchemaProperties)(o.patternProperties);function m(e){t.code((0,i._)`delete ${l}[${e}]`)}function y(a){if("all"===p.removeAdditional||p.removeAdditional&&!1===r)return void m(a);if(!1===r){e.setParams({additionalProperty:a}),e.error(),c||t.break();return}if("object"==typeof r&&!(0,n.alwaysValidSchema)(d,r)){let r=t.name("valid");"failing"===p.removeAdditional?(g(a,r,!1),t.if((0,i.not)(r),()=>{e.reset(),m(a)})):(g(a,r),c||t.if((0,i.not)(r),()=>t.break()))}}function g(t,r,a){let i={keyword:"additionalProperties",dataProp:t,dataPropType:n.Type.Str};!1===a&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",l,r=>{f.length||h.length?t.if(function(r){let s;if(f.length>8){let e=(0,n.schemaRefOrVal)(d,o.properties,"properties");s=(0,a.isOwnProperty)(t,e,r)}else s=f.length?(0,i.or)(...f.map(e=>(0,i._)`${r} === ${e}`)):i.nil;return h.length&&(s=(0,i.or)(s,...h.map(t=>(0,i._)`${(0,a.usePattern)(e,t)}.test(${r})`))),(0,i.not)(s)}(r),()=>y(r)):y(r)}),e.ok((0,i._)`${u} === ${s.default.errors}`)}}},2003(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(7218);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((t,r)=>{if((0,a.alwaysValidSchema)(i,t))return;let n=e.subschema({keyword:"allOf",schemaProp:r},s);e.ok(s),e.mergeEvaluated(n)})}}},1070(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(4954).validateUnion,error:{message:"must match a schema in anyOf"}}},2692(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,a.str)`must contain at least ${e} valid item(s)`:(0,a.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,a._)`{minContains: ${e}}`:(0,a._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,r,{gen:s,schema:n,parentSchema:o,data:l,it:u}=e,{minContains:d,maxContains:c}=o;u.opts.next?(t=void 0===d?1:d,r=c):t=1;let p=s.const("len",(0,a._)`${l}.length`);if(e.setParams({min:t,max:r}),void 0===r&&0===t)return void(0,i.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==r&&t>r){(0,i.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,i.alwaysValidSchema)(u,n)){let i=(0,a._)`${p} >= ${t}`;void 0!==r&&(i=(0,a._)`${i} && ${p} <= ${r}`),e.pass(i);return}u.items=!0;let f=s.name("valid");function h(){let e=s.name("_valid"),i=s.let("count",0);m(e,()=>s.if(e,()=>{var e;return e=i,void(s.code((0,a._)`${e}++`),void 0===r?s.if((0,a._)`${e} >= ${t}`,()=>s.assign(f,!0).break()):(s.if((0,a._)`${e} > ${r}`,()=>s.assign(f,!1).break()),1===t?s.assign(f,!0):s.if((0,a._)`${e} >= ${t}`,()=>s.assign(f,!0))))}))}function m(t,r){s.forRange("i",0,p,a=>{e.subschema({keyword:"contains",dataProp:a,dataPropType:i.Type.Num,compositeRule:!0},t),r()})}void 0===r&&1===t?m(f,()=>s.if(f,()=>s.break())):0===t?(s.let(f,!0),void 0!==r&&s.if((0,a._)`${l}.length > 0`,h)):(s.let(f,!1),h()),e.result(f,()=>e.reset())}}},5860(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let a=r(8994),i=r(7218),s=r(4954);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>(0,a.str)`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,a._)`{property: ${e},
|
|
5
|
-
missingProperty: ${i},
|
|
6
|
-
depsCount: ${t},
|
|
7
|
-
deps: ${r}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let a in e)"__proto__"!==a&&((Array.isArray(e[a])?t:r)[a]=e[a]);return[t,r]}(e);o(e,t),l(e,r)}};function o(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(0===Object.keys(t).length)return;let l=r.let("missing");for(let o in t){let u=t[o];if(0===u.length)continue;let d=(0,s.propertyInData)(r,i,o,n.opts.ownProperties);e.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),n.allErrors?r.if(d,()=>{for(let t of u)(0,s.checkReportMissingProp)(e,t)}):(r.if((0,a._)`${d} && (${(0,s.checkMissingProp)(e,u,l)})`),(0,s.reportMissingProp)(e,l),r.else())}}function l(e,t=e.schema){let{gen:r,data:a,keyword:n,it:o}=e,u=r.name("valid");for(let l in t)(0,i.alwaysValidSchema)(o,t[l])||(r.if((0,s.propertyInData)(r,a,l,o.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:l},u);e.mergeValidEvaluated(t,u)},()=>r.var(u,!0)),e.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=l,t.default=n},8102(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218);function s(e,t){let r=e.schema[t];return void 0!==r&&!(0,i.alwaysValidSchema)(e,r)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,a.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,a._)`{failingKeyword: ${e.ifClause}}`},code(e){let t,{gen:r,parentSchema:n,it:o}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let l=s(o,"then"),u=s(o,"else");if(!l&&!u)return;let d=r.let("valid",!0),c=r.name("_valid");if(t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c),e.mergeEvaluated(t),e.reset(),l&&u){let t=r.let("ifClause");e.setParams({ifClause:t}),r.if(c,p("then",t),p("else",t))}else l?r.if(c,p("then")):r.if((0,a.not)(c),p("else"));function p(t,i){return()=>{let s=e.subschema({keyword:t},c);r.assign(d,c),e.mergeValidEvaluated(s,d),i?r.assign(i,(0,a._)`${t}`):e.setParams({ifClause:t})}}e.pass(d,()=>e.error(!0))}}},8313(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(714),i=r(1997),s=r(3665),n=r(5153),o=r(2692),l=r(5860),u=r(374),d=r(8401),c=r(3252),p=r(6398),f=r(4948),h=r(1070),m=r(5368),y=r(2003),g=r(8102),v=r(1871);t.default=function(e=!1){let t=[f.default,h.default,m.default,y.default,g.default,v.default,u.default,d.default,l.default,c.default,p.default];return e?t.push(i.default,n.default):t.push(a.default,s.default),t.push(o.default),t}},3665(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let a=r(8994),i=r(7218),s=r(4954);function n(e,t,r=e.schema){let{gen:s,parentSchema:o,data:l,keyword:u,it:d}=e;(function(e){let{opts:a,errSchemaPath:s}=d,n=r.length,o=n===e.minItems&&(n===e.maxItems||!1===e[t]);if(a.strictTuples&&!o){let e=`"${u}" is ${n}-tuple, but minItems or maxItems/${t} are not specified or different at path "${s}"`;(0,i.checkStrictMode)(d,e,a.strictTuples)}})(o),d.opts.unevaluated&&r.length&&!0!==d.items&&(d.items=i.mergeEvaluated.items(s,r.length,d.items));let c=s.name("valid"),p=s.const("len",(0,a._)`${l}.length`);r.forEach((t,r)=>{(0,i.alwaysValidSchema)(d,t)||(s.if((0,a._)`${p} > ${r}`,()=>e.subschema({keyword:u,schemaProp:r,dataProp:r},c)),e.ok(c))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return n(e,"additionalItems",t);r.items=!0,(0,i.alwaysValidSchema)(r,t)||e.ok((0,s.validateArray)(e))}}},5153(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218),s=r(4954),n=r(714);t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,a._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:r,it:a}=e,{prefixItems:o}=r;a.items=!0,(0,i.alwaysValidSchema)(a,t)||(o?(0,n.validateAdditionalItems)(e,o):e.ok((0,s.validateArray)(e)))}}},4948(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(7218);t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,a.alwaysValidSchema)(i,r))return void e.fail();let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}},5368(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218);t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,a._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:t,schema:r,parentSchema:s,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&s.discriminator)return;let o=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block(function(){r.forEach((r,s)=>{let d;(0,i.alwaysValidSchema)(n,r)?t.var(u,!0):d=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&t.if((0,a._)`${u} && ${o}`).assign(o,!1).assign(l,(0,a._)`[${l}, ${s}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(l,s),d&&e.mergeEvaluated(d,a.Name)})})}),e.result(o,()=>e.reset(),()=>e.error(!0))}}},6398(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(4954),i=r(8994),s=r(7218),n=r(7218);t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:l,it:u}=e,{opts:d}=u,c=(0,a.allSchemaProperties)(r),p=c.filter(e=>(0,s.alwaysValidSchema)(u,r[e]));if(0===c.length||p.length===c.length&&(!u.opts.unevaluated||!0===u.props))return;let f=d.strictSchema&&!d.allowMatchingProperties&&l.properties,h=t.name("valid");!0===u.props||u.props instanceof i.Name||(u.props=(0,n.evaluatedPropsToName)(t,u.props));let{props:m}=u;for(let e of c)f&&function(e){for(let t in f)new RegExp(e).test(t)&&(0,s.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),u.allErrors?y(e):(t.var(h,!0),y(e),t.if(h));function y(r){t.forIn("key",o,s=>{t.if((0,i._)`${(0,a.usePattern)(e,r)}.test(${s})`,()=>{let a=p.includes(r);a||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:s,dataPropType:n.Type.Str},h),u.opts.unevaluated&&!0!==m?t.assign((0,i._)`${m}[${s}]`,!0):a||u.allErrors||t.if((0,i.not)(h),()=>t.break())})})}}}},1997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(3665);t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,a.validateTuple)(e,"items")}},3252(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(6023),i=r(4954),s=r(7218),n=r(8401);t.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:l,it:u}=e;"all"===u.opts.removeAdditional&&void 0===o.additionalProperties&&n.default.code(new a.KeywordCxt(u,n.default,"additionalProperties"));let d=(0,i.allSchemaProperties)(r);for(let e of d)u.definedProperties.add(e);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=s.mergeEvaluated.props(t,(0,s.toHash)(d),u.props));let c=d.filter(e=>!(0,s.alwaysValidSchema)(u,r[e]));if(0===c.length)return;let p=t.name("valid");for(let a of c){var f;(f=a,u.opts.useDefaults&&!u.compositeRule&&void 0!==r[f].default)?h(a):(t.if((0,i.propertyInData)(t,l,a,u.opts.ownProperties)),h(a),u.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(a),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}},374(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218);t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,a._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:t,schema:r,data:s,it:n}=e;if((0,i.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",s,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),t.if((0,a.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}}},1871(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(7218);t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,a.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}},4954(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let a=r(8994),i=r(7218),s=r(6660),n=r(7218);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,a._)`Object.prototype.hasOwnProperty`})}function l(e,t,r){return(0,a._)`${o(e)}.call(${t}, ${r})`}function u(e,t,r,i){let s=(0,a._)`${t}${(0,a.getProperty)(r)} === undefined`;return i?(0,a.or)(s,(0,a.not)(l(e,t,r))):s}function d(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}t.checkReportMissingProp=function(e,t){let{gen:r,data:i,it:s}=e;r.if(u(r,i,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,a._)`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},i,s){return(0,a.or)(...i.map(i=>(0,a.and)(u(e,t,i,r.ownProperties),(0,a._)`${s} = ${i}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=l,t.propertyInData=function(e,t,r,i){let s=(0,a._)`${t}${(0,a.getProperty)(r)} !== undefined`;return i?(0,a._)`${s} && ${l(e,t,r)}`:s},t.noPropertyInData=u,t.allSchemaProperties=d,t.schemaProperties=function(e,t){return d(t).filter(r=>!(0,i.alwaysValidSchema)(e,t[r]))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:l},u,d,c){let p=c?(0,a._)`${e}, ${t}, ${i}${n}`:t,f=[[s.default.instancePath,(0,a.strConcat)(s.default.instancePath,o)],[s.default.parentData,l.parentData],[s.default.parentDataProperty,l.parentDataProperty],[s.default.rootData,s.default.rootData]];l.opts.dynamicRef&&f.push([s.default.dynamicAnchors,s.default.dynamicAnchors]);let h=(0,a._)`${p}, ${r.object(...f)}`;return d!==a.nil?(0,a._)`${u}.call(${d}, ${h})`:(0,a._)`${u}(${h})`};let c=(0,a._)`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,a._)`${"new RegExp"===s.code?c:(0,n.useFunc)(e,s)}(${r}, ${i})`})},t.validateArray=function(e){let{gen:t,data:r,keyword:s,it:n}=e,o=t.name("valid");if(n.allErrors){let e=t.let("valid",!0);return l(()=>t.assign(e,!1)),e}return t.var(o,!0),l(()=>t.break()),o;function l(n){let l=t.const("len",(0,a._)`${r}.length`);t.forRange("i",0,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:i.Type.Num},o),t.if((0,a.not)(o),n)})}},t.validateUnion=function(e){let{gen:t,schema:r,keyword:s,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(e=>(0,i.alwaysValidSchema)(n,e))&&!n.opts.unevaluated)return;let o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((r,i)=>{let n=e.subschema({keyword:s,schemaProp:i,compositeRule:!0},l);t.assign(o,(0,a._)`${o} || ${l}`),e.mergeValidEvaluated(n,l)||t.if((0,a.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}},3330(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}},8119(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(3330),i=r(930);t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",a.default,i.default]},930(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let a=r(4220),i=r(4954),s=r(8994),n=r(6660),o=r(1688),l=r(7218);function u(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,s._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function d(e,t,r,a){let{gen:o,it:u}=e,{allErrors:d,schemaEnv:c,opts:p}=u,f=p.passContext?n.default.this:s.nil;function h(e){let t=(0,s._)`${e}.errors`;o.assign(n.default.vErrors,(0,s._)`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),o.assign(n.default.errors,(0,s._)`${n.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;let a=null==(t=null==r?void 0:r.validate)?void 0:t.evaluated;if(!0!==u.props)if(a&&!a.dynamicProps)void 0!==a.props&&(u.props=l.mergeEvaluated.props(o,a.props,u.props));else{let t=o.var("props",(0,s._)`${e}.evaluated.props`);u.props=l.mergeEvaluated.props(o,t,u.props,s.Name)}if(!0!==u.items)if(a&&!a.dynamicItems)void 0!==a.items&&(u.items=l.mergeEvaluated.items(o,a.items,u.items));else{let t=o.var("items",(0,s._)`${e}.evaluated.items`);u.items=l.mergeEvaluated.items(o,t,u.items,s.Name)}}a?function(){if(!c.$async)throw Error("async schema referenced by sync schema");let r=o.let("valid");o.try(()=>{o.code((0,s._)`await ${(0,i.callValidateCode)(e,t,f)}`),m(t),d||o.assign(r,!0)},e=>{o.if((0,s._)`!(${e} instanceof ${u.ValidationError})`,()=>o.throw(e)),h(e),d||o.assign(r,!1)}),e.ok(r)}():e.result((0,i.callValidateCode)(e,t,f),()=>m(t),()=>h(t))}t.getValidate=u,t.callRef=d,t.default={keyword:"$ref",schemaType:"string",code(e){var t,r;let i,n,l,c,{gen:p,schema:f,it:h}=e,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===f||"#/"===f)&&m===b.baseId){if(y===b)return d(e,g,y,y.$async);let t=p.scopeValue("root",{ref:b});return d(e,(0,s._)`${t}.validate`,b,b.$async)}let w=o.resolveRef.call(_,b,m,f);if(void 0===w)throw new a.default(h.opts.uriResolver,m,f);return w instanceof o.SchemaEnv?(i=u(e,t=w),void d(e,i,t,t.$async)):(r=w,n=p.scopeValue("schema",!0===v.code.source?{ref:r,code:(0,s.stringify)(r)}:{ref:r}),l=p.name("valid"),c=e.subschema({schema:r,dataTypes:[],schemaPath:s.nil,topSchemaRef:n,errSchemaPath:f},l),void(e.mergeEvaluated(c),e.ok(l)))}}},9376(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(5141),s=r(1688),n=r(4220),o=r(7218);t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,a._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){let{gen:t,data:r,schema:l,parentSchema:u,it:d}=e,{oneOf:c}=u;if(!d.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!c)throw Error("discriminator: requires oneOf keyword");let f=t.let("valid",!1),h=t.const("tag",(0,a._)`${r}${(0,a.getProperty)(p)}`);t.if((0,a._)`typeof ${h} == "string"`,()=>(function(){let r=function(){var e;let t={},r=i(u),a=!0;for(let t=0;t<c.length;t++){let u=c[t];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,d.self.RULES)){let e=u.$ref;if((u=s.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e))instanceof s.SchemaEnv&&(u=u.schema),void 0===u)throw new n.default(d.opts.uriResolver,d.baseId,e)}let f=null==(e=null==u?void 0:u.properties)?void 0:e[p];if("object"!=typeof f)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);a=a&&(r||i(u)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(f,t)}if(!a)throw Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let i in t.if(!1),r)t.elseIf((0,a._)`${h} === ${i}`),t.assign(f,function(r){let i=t.name("valid"),s=e.subschema({keyword:"oneOf",schemaProp:r},i);return e.mergeEvaluated(s,a.Name),i}(r[i]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:h,tagName:p}),t.endIf()})(),()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:h,tagName:p})),e.ok(f)}}},5141(e,t){"use strict";var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"},3959(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8119),i=r(659),s=r(8313),n=r(8563),o=r(4618);t.default=[a.default,i.default,(0,s.default)(),n.default,o.metadataVocabulary,o.contentVocabulary]},424(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994);t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,a._)`{format: ${e}}`},code(e,t){let r,i,s,n,o,l,{gen:u,data:d,$data:c,schema:p,schemaCode:f,it:h}=e,{opts:m,errSchemaPath:y,schemaEnv:g,self:v}=h;m.validateFormats&&(c?(r=u.scopeValue("formats",{ref:v.formats,code:m.code.formats}),i=u.const("fDef",(0,a._)`${r}[${f}]`),s=u.let("fType"),n=u.let("format"),u.if((0,a._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(s,(0,a._)`${i}.type || "string"`).assign(n,(0,a._)`${i}.validate`),()=>u.assign(s,(0,a._)`"string"`).assign(n,i)),e.fail$data((0,a.or)(!1===m.strictSchema?a.nil:(0,a._)`${f} && !${n}`,(o=g.$async?(0,a._)`(${i}.async ? await ${n}(${d}) : ${n}(${d}))`:(0,a._)`${n}(${d})`,l=(0,a._)`(typeof ${n} == "function" ? ${o} : ${n}.test(${d}))`,(0,a._)`${n} && ${n} !== true && ${s} === ${t} && !${l}`)))):function(){var r;let i,s,n=v.formats[p];if(!n){if(!1===m.strictSchema)return v.logger.warn(o());throw Error(o());function o(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===n)return;let[l,c,f]=(i=(r=n)instanceof RegExp?(0,a.regexpCode)(r):m.code.formats?(0,a._)`${m.code.formats}${(0,a.getProperty)(p)}`:void 0,s=u.scopeValue("formats",{key:p,ref:r,code:i}),"object"!=typeof r||r instanceof RegExp?["string",r,s]:[r.type||"string",r.validate,(0,a._)`${s}.validate`]);l===t&&e.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!g.$async)throw Error("async format in sync schema");return(0,a._)`await ${f}(${d})`}return"function"==typeof c?(0,a._)`${f}(${d})`:(0,a._)`${f}.test(${d})`}())}())}}},8563(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[r(424).default]},4618(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7080(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218),s=r(6013);t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,a._)`{allowedValue: ${e}}`},code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:l}=e;n||l&&"object"==typeof l?e.fail$data((0,a._)`!${(0,i.useFunc)(t,s.default)}(${r}, ${o})`):e.fail((0,a._)`${l} !== ${r}`)}}},5358(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218),s=r(6013);t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,a._)`{allowedValues: ${e}}`},code(e){let t,r,{gen:n,data:o,$data:l,schema:u,schemaCode:d,it:c}=e;if(!l&&0===u.length)throw Error("enum must have non-empty array");let p=u.length>=c.opts.loopEnum,f=()=>null!=t?t:t=(0,i.useFunc)(n,s.default);if(p||l)r=n.let("valid"),e.block$data(r,function(){n.assign(r,!1),n.forOf("v",d,e=>n.if((0,a._)`${f()}(${o}, ${e})`,()=>n.assign(r,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let e=n.const("vSchema",d);r=(0,a.or)(...u.map((t,r)=>{var i,s;let n;return i=e,"object"==typeof(n=u[s=r])&&null!==n?(0,a._)`${f()}(${o}, ${i}[${s}])`:(0,a._)`${o} === ${n}`}))}e.pass(r)}}},659(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8997),i=r(9190),s=r(4280),n=r(8805),o=r(2189),l=r(3138),u=r(8870),d=r(1858),c=r(7080),p=r(5358);t.default=[a.default,i.default,s.default,n.default,o.default,l.default,u.default,d.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,p.default]},8870(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994);t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>(0,a._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,s="maxItems"===t?a.operators.GT:a.operators.LT;e.fail$data((0,a._)`${r}.length ${s} ${i}`)}}},4280(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=r(7218),s=r(5532);t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>(0,a._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,l="maxLength"===t?a.operators.GT:a.operators.LT,u=!1===o.opts.unicode?(0,a._)`${r}.length`:(0,a._)`${(0,i.useFunc)(e.gen,s.default)}(${r})`;e.fail$data((0,a._)`${u} ${l} ${n}`)}}},8997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994),i=a.operators,s={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.default={keyword:Object.keys(s),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,a._)`{comparison: ${s[e].okStr}, limit: ${t}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,a._)`${r} ${s[t].fail} ${i} || isNaN(${r})`)}}},2189(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994);t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>(0,a._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,s="maxProperties"===t?a.operators.GT:a.operators.LT;e.fail$data((0,a._)`Object.keys(${r}).length ${s} ${i}`)}}},9190(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(8994);t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,a._)`{multipleOf: ${e}}`},code(e){let{gen:t,data:r,schemaCode:i,it:s}=e,n=s.opts.multipleOfPrecision,o=t.let("res"),l=n?(0,a._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${n}`:(0,a._)`${o} !== parseInt(${o})`;e.fail$data((0,a._)`(${i} === 0 || (${o} = ${r}/${i}, ${l}))`)}}},8805(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(4954),i=r(7218),s=r(8994);t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,s._)`{pattern: ${e}}`},code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:l,it:u}=e,d=u.opts.unicodeRegExp?"u":"";if(n){let{regExp:a}=u.opts.code,n="new RegExp"===a.code?(0,s._)`new RegExp`:(0,i.useFunc)(t,a),o=t.let("valid");t.try(()=>t.assign(o,(0,s._)`${n}(${l}, ${d}).test(${r})`),()=>t.assign(o,!1)),e.fail$data((0,s._)`!${o}`)}else{let t=(0,a.usePattern)(e,o);e.fail$data((0,s._)`!${t}.test(${r})`)}}}},3138(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(4954),i=r(8994),s=r(7218);t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,i.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,i._)`{missingProperty: ${e}}`},code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:l,it:u}=e,{opts:d}=u;if(!l&&0===r.length)return;let c=r.length>=d.loopRequired;if(u.allErrors?function(){if(c||l)e.block$data(i.nil,p);else for(let t of r)(0,a.checkReportMissingProp)(e,t)}():function(){let s=t.let("missing");if(c||l){let r=t.let("valid",!0);e.block$data(r,()=>{var l,u;return l=s,u=r,void(e.setParams({missingProperty:l}),t.forOf(l,n,()=>{t.assign(u,(0,a.propertyInData)(t,o,l,d.ownProperties)),t.if((0,i.not)(u),()=>{e.error(),t.break()})},i.nil))}),e.ok(r)}else t.if((0,a.checkMissingProp)(e,r,s)),(0,a.reportMissingProp)(e,s),t.else()}(),d.strictRequired){let t=e.parentSchema.properties,{definedProperties:a}=e.it;for(let e of r)if((null==t?void 0:t[e])===void 0&&!a.has(e)){let t=u.schemaEnv.baseId+u.errSchemaPath,r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,s.checkStrictMode)(u,r,u.opts.strictRequired)}}function p(){t.forOf("prop",n,r=>{e.setParams({missingProperty:r}),t.if((0,a.noPropertyInData)(t,o,r,d.ownProperties),()=>e.error())})}}}},1858(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let a=r(6419),i=r(8994),s=r(7218),n=r(6013);t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,i.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,i._)`{i: ${e}, j: ${t}}`},code(e){let{gen:t,data:r,$data:o,schema:l,parentSchema:u,schemaCode:d,it:c}=e;if(!o&&!l)return;let p=t.let("valid"),f=u.items?(0,a.getSchemaTypes)(u.items):[];e.block$data(p,function(){let o=t.let("i",(0,i._)`${r}.length`),l=t.let("j");e.setParams({i:o,j:l}),t.assign(p,!0),t.if((0,i._)`${o} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?function(s,n){let o=t.name("item"),l=(0,a.checkDataTypes)(f,o,c.opts.strictNumbers,a.DataType.Wrong),u=t.const("indices",(0,i._)`{}`);t.for((0,i._)`;${s}--;`,()=>{t.let(o,(0,i._)`${r}[${s}]`),t.if(l,(0,i._)`continue`),f.length>1&&t.if((0,i._)`typeof ${o} == "string"`,(0,i._)`${o} += "_"`),t.if((0,i._)`typeof ${u}[${o}] == "number"`,()=>{t.assign(n,(0,i._)`${u}[${o}]`),e.error(),t.assign(p,!1).break()}).code((0,i._)`${u}[${o}] = ${s}`)})}:function(a,o){let l=(0,s.useFunc)(t,n.default),u=t.name("outer");t.label(u).for((0,i._)`;${a}--;`,()=>t.for((0,i._)`${o} = ${a}; ${o}--;`,()=>t.if((0,i._)`${l}(${r}[${a}], ${r}[${o}])`,()=>{e.error(),t.assign(p,!1).break(u)})))})(o,l))},(0,i._)`${d} === false`),e.ok(p)}}},8583(e,t,r){let a=r(9896),i=r(6928),s=r(857),n=r(6982),o=r(4519).version,l=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(e){console.log(`[dotenv@${o}][DEBUG] ${e}`)}function d(e){console.log(`[dotenv@${o}] ${e}`)}function c(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function p(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)a.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=i.resolve(process.cwd(),".env.vault");return a.existsSync(t)?t:null}function f(e){return"~"===e[0]?i.join(s.homedir(),e.slice(1)):e}let h={configDotenv:function(e){let t,r=i.resolve(process.cwd(),".env"),s="utf8",n=!!(e&&e.debug),o=!e||!("quiet"in e)||e.quiet;e&&e.encoding?s=e.encoding:n&&u("No encoding is specified. UTF-8 is used by default");let l=[r];if(e&&e.path)if(Array.isArray(e.path))for(let t of(l=[],e.path))l.push(f(t));else l=[f(e.path)];let c={};for(let r of l)try{let t=h.parse(a.readFileSync(r,{encoding:s}));h.populate(c,t,e)}catch(e){n&&u(`Failed to load ${r} ${e.message}`),t=e}let p=process.env;if(e&&null!=e.processEnv&&(p=e.processEnv),h.populate(p,c,e),n||!o){let e=Object.keys(c).length,r=[];for(let e of l)try{let t=i.relative(process.cwd(),e);r.push(t)}catch(r){n&&u(`Failed to load ${e} ${r.message}`),t=r}d(`injecting env (${e}) from ${r.join(",")}`)}return t?{parsed:c,error:t}:{parsed:c}},_configVault:function(e){let t=!!(e&&e.debug),r=!e||!("quiet"in e)||e.quiet;(t||!r)&&d("Loading env from encrypted .env.vault");let a=h._parseVault(e),i=process.env;return e&&null!=e.processEnv&&(i=e.processEnv),h.populate(i,a,e),{parsed:a}},_parseVault:function(e){let t,r=p(e=e||{});e.path=r;let a=h.configDotenv(e);if(!a.parsed){let e=Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw e.code="MISSING_DATA",e}let i=c(e).split(","),s=i.length;for(let e=0;e<s;e++)try{let r=i[e].trim(),s=function(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){let e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}let a=r.password;if(!a){let e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}let i=r.searchParams.get("environment");if(!i){let e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}let s=`DOTENV_VAULT_${i.toUpperCase()}`,n=e.parsed[s];if(!n){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:n,key:a}}(a,r);t=h.decrypt(s.ciphertext,s.key);break}catch(t){if(e+1>=s)throw t}return h.parse(t)},config:function(e){if(0===c(e).length)return h.configDotenv(e);let t=p(e);if(!t){var r;return r=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${o}][WARN] ${r}`),h.configDotenv(e)}return h._configVault(e)},decrypt:function(e,t){let r=Buffer.from(t.slice(-64),"hex"),a=Buffer.from(e,"base64"),i=a.subarray(0,12),s=a.subarray(-16);a=a.subarray(12,-16);try{let e=n.createDecipheriv("aes-256-gcm",r,i);return e.setAuthTag(s),`${e.update(a)}${e.final()}`}catch(a){let e=a instanceof RangeError,t="Invalid key length"===a.message,r="Unsupported state or unable to authenticate data"===a.message;if(e||t){let e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){let e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw a}},parse:function(e){let t,r={},a=e.toString();for(a=a.replace(/\r\n?/mg,"\n");null!=(t=l.exec(a));){let e=t[1],a=t[2]||"",i=(a=a.trim())[0];a=a.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(a=(a=a.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),r[e]=a}return r},populate:function(e,t,r={}){let a=!!(r&&r.debug),i=!!(r&&r.override);if("object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===i&&(e[r]=t[r]),a&&(!0===i?u(`"${r}" is already defined and WAS overwritten`):u(`"${r}" is already defined and was NOT overwritten`))):e[r]=t[r]}};e.exports.configDotenv=h.configDotenv,e.exports._configVault=h._configVault,e.exports._parseVault=h._parseVault,e.exports.config=h.config,e.exports.decrypt=h.decrypt,e.exports.parse=h.parse,e.exports.populate=h.populate,e.exports=h},7371(e){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(i=a;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=a;0!=i--;){var a,i,s,n=s[i];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}},205(e){"use strict";var t=e.exports=function(e,r,a){"function"==typeof r&&(a=r,r={});var i="function"==typeof(a=r.cb||a)?a:a.pre||function(){};!function e(r,a,i,s,n,o,l,u,d,c){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var p in a(s,n,o,l,u,d,c),s){var f=s[p];if(Array.isArray(f)){if(p in t.arrayKeywords)for(var h=0;h<f.length;h++)e(r,a,i,f[h],n+"/"+p+"/"+h,o,n,p,s,h)}else if(p in t.propsKeywords){if(f&&"object"==typeof f)for(var m in f)e(r,a,i,f[m],n+"/"+p+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),o,n,p,s,m)}else(p in t.keywords||r.allKeys&&!(p in t.skipKeywords))&&e(r,a,i,f,n+"/"+p,o,n,p,s)}i(s,n,o,l,u,d,c)}}(r,i,a.post||function(){},e,"",e)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},6982(e){"use strict";e.exports=require("crypto")},9896(e){"use strict";e.exports=require("fs")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},7980(e,t,r){"use strict";let{normalizeIPv6:a,removeDotSegments:i,recomposeAuthority:s,normalizePercentEncoding:n,normalizePathEncoding:o,escapePreservingEscapes:l,reescapeHostDelimiters:u,isIPv4:d,nonSimpleDomain:c}=r(609),{SCHEMES:p,getSchemeHandler:f}=r(4848);function h(e,t,r,a){let s={};return a||(e=b(m(e,r),r),t=b(m(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=i(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=i(t.path||""),s.query=t.query):(t.path?("/"===t.path[0]?s.path=i(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=i(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function m(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},a=Object.assign({},t),o=[],u=f(a.scheme||r.scheme);u&&u.serialize&&u.serialize(r,a),void 0!==r.path&&(a.skipEscape?r.path=n(r.path):(r.path=l(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==a.reference&&r.scheme&&o.push(r.scheme,":");let d=s(r);if(void 0!==d&&("suffix"!==a.reference&&o.push("//"),o.push(d),r.path&&"/"!==r.path[0]&&o.push("/")),void 0!==r.path){let e=r.path;a.absolutePath||u&&u.absolutePath||(e=i(e)),void 0===d&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),o.push(e)}return void 0!==r.query&&o.push("?",r.query),void 0!==r.fragment&&o.push("#",r.fragment),o.join("")}let y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,g=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,v=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function _(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,n=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);let l=e.match(g);null!==l&&-1!==l[1].indexOf("\\")&&(i.error="URI authority must not contain a literal backslash.",s=!0);let p=e.match(v);if(null!==p){let e=p[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(i.error=i.error||"URI authority must not contain a literal backslash.",s=!0):e.length!==t.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",s=!0))}let h=e.match(y);if(h){i.scheme=h[1],i.userinfo=h[3],i.host=h[4],i.port=parseInt(h[5],10),i.path=h[6]||"",i.query=h[7],i.fragment=h[8],isNaN(i.port)&&(i.port=h[5]);let t=void 0!==h[2]&&i.path&&"/"!==i.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof i.port&&(i.port<0||i.port>65535)?"URI port is malformed.":void 0;if(void 0!==t&&(i.error=i.error||t,s=!0),i.host)if(!1===d(i.host)){let e=a(i.host);i.host=e.host.toLowerCase(),n=e.isIPV6}else n=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let l=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!l||!l.unicodeSupport)&&i.host&&(r.domainHost||l&&l.domainHost)&&!1===n&&c(i.host))try{i.host=new URL("http://"+i.host).hostname}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}if((!l||l&&!l.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=u(unescape(i.host),n))),i.path&&(i.path=o(i.path)),i.fragment))try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}l&&l.parse&&l.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:s}}function b(e,t){return _(e,t).parsed}function w(e,t){let{parsed:r,malformedAuthorityOrPort:a}=_(e,t);return{normalized:a?e:m(r,t),malformedAuthorityOrPort:a}}function $(e,t){if("string"==typeof e){let{normalized:r,malformedAuthorityOrPort:a}=w(e,t);return a?void 0:r}if("object"==typeof e)return m(e,t)}let k={SCHEMES:p,normalize:function(e,t){return"string"==typeof e?e=w(e,t).normalized:"object"==typeof e&&(e=b(m(e,t),t)),e},resolve:function(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:s}=_(e,a),{parsed:n,malformedAuthorityOrPort:o}=_(t,a);if(s||o)throw Error(i.error||n.error||"URI is malformed.");let l=h(i,n,a,!0);return a.skipEscape=!0,m(l,a)},resolveComponent:h,equal:function(e,t,r){let a=$(e,r),i=$(t,r);return void 0!==a&&void 0!==i&&a.toLowerCase()===i.toLowerCase()},serialize:m,parse:b};e.exports=k,e.exports.default=k,e.exports.fastUri=k},4848(e,t,r){"use strict";let{isUUID:a}=r(609),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,s=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function l(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let u={scheme:"http",domainHost:!0,parse:o,serialize:l},d={scheme:"https",domainHost:u.domainHost,parse:o,serialize:l},c={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},p={scheme:"wss",domainHost:c.domainHost,parse:c.parse,serialize:c.serialize},f={http:u,https:d,ws:c,wss:p,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(i);if(r){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=h(`${a}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",a=e.nid.toLowerCase(),i=h(`${r}:${t.nid||a}`);i&&(e=i.serialize(e,t));let s=e,n=e.nss;return s.path=`${a||t.nid}:${n}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&a(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function h(e){return e&&(f[e]||f[e.toLowerCase()])||void 0}Object.setPrototypeOf(f,null),e.exports={wsIsSecure:n,SCHEMES:f,isValidSchemeName:function(e){return -1!==s.indexOf(e)},getSchemeHandler:h}},609(e){"use strict";let t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),a=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),i=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),s=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function n(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(48!==(r=e[a].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(!((r=e[a].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}let o=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(e){return e.length=0,!0}function u(e,t,r){if(e.length){let a=n(e);if(""===a)return r.error=!0,!1;t.push(a),e.length=0}return!0}function d(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,":"))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},a=[],i=[],s=!1,o=!1,d=u;for(let n=0;n<e.length;n++){let u=e[n];if("["!==u&&"]"!==u)if(":"===u){if(!0===s&&(o=!0),!d(i,a,r))break;if(++t>7){r.error=!0;break}n>0&&":"===e[n-1]&&(s=!0),a.push(":");continue}else if("%"===u){if(!d(i,a,r))break;d=l}else{i.push(u);continue}}return i.length&&(d===l?r.zone=i.join(""):o?a.push(i.join("")):a.push(n(i))),r.address=a.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}let c={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},p=/[@/?#:]/g,f=/[@/?#]/g;function h(e,t){let r=t?f:p;return r.lastIndex=0,e.replace(r,e=>c[e])}e.exports={nonSimpleDomain:o,recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let a=unescape(e.host);if(!r(a)){let e=d(a);a=!0===e.isIPV6?`[${e.escapedHost}]`:h(a,!1)}t.push(a)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},reescapeHostDelimiters:h,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let s=0;s<e.length;s++){if("%"===e[s]&&s+2<e.length){let n=e.slice(s+1,s+3);if(a(n)){let e=n.toUpperCase(),a=String.fromCharCode(parseInt(e,16));t&&i(a)?r+=a:r+="%"+e,s+=2;continue}}r+=e[s]}return r},normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){let s=e.slice(r+1,r+3);if(a(s)){let e=s.toUpperCase(),a=String.fromCharCode(parseInt(e,16));"."!==a&&i(a)?t+=a:t+="%"+e,r+=2;continue}}s(e[r])?t+=e[r]:t+=escape(e[r])}return t},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){let i=e.slice(r+1,r+3);if(a(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e,r=[],a=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===i&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(a=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:d,stringArrayToHexStripped:n}},114(e){"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},7456(e){"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},4519(e){"use strict";e.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')}},t={};function r(a){var i=t[a];if(void 0!==i)return i.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";let e,t,a,i=require("node:process");function s(e,t,r){function a(r,a){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:a,constr:n,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,a);let i=n.prototype,s=Object.keys(i);for(let e=0;e<s.length;e++){let t=s[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class s extends i{}function n(e){var t;let i=r?.Parent?new s:this;for(let r of(a(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(n,"init",{value:a}),Object.defineProperty(n,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}Symbol("zod_brand");class n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class o extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(o8=globalThis).__zod_globalConfig??(o8.__zod_globalConfig={});let l=globalThis.__zod_globalConfig;function u(e){return e&&Object.assign(l,e),l}let d=/^[cC][0-9a-z]{6,}$/,c=/^[0-9a-z]+$/,p=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,f=/^[0-9a-vA-V]{20}$/,h=/^[A-Za-z0-9]{27}$/,m=/^[a-zA-Z0-9_-]{21}$/,y=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,g=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,v=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,b=/^(?:(?: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])$/,w=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,$=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,k=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,x=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,S=/^[A-Za-z0-9_-]*$/,E=/^https?$/,T=/^\+[1-9]\d{6,14}$/,P="(?:(?:\\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])))",O=RegExp(`^${P}$`);function j(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let N=/^-?\d+$/,z=/^-?\d+(?:\.\d+)?$/,I=/^(?:true|false)$/i,R=/^null$/i,C=/^[^A-Z]*$/,A=/^[^a-z]*$/;function M(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function Z(e,t){return"bigint"==typeof t?t.toString():t}function q(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function D(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let F=Symbol("evaluating");function L(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==F)return void 0===a&&(a=F,a=r()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function V(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function U(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function H(e){return JSON.stringify(e)}let J="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function K(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let B=q(()=>{if(l.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function G(e){if(!1===K(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==K(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function W(e){return G(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let Y=new Set(["string","number","symbol"]);function Q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function ee(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}let et={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function er(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ea(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function ei(e){return"string"==typeof e?e:e?.message}function es(e,t,r){let a=e.message?e.message:ei(e.inst?._zod.def?.error?.(e))??ei(t?.error?.(e))??ei(r.customError?.(e))??ei(r.localeError?.(e))??"Invalid input",{inst:i,continue:s,input:n,...o}=e;return o.path??(o.path=[]),o.message=a,t?.reportInput&&(o.input=n),o}function en(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eo(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}let el=s("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),eu={number:"number",bigint:"bigint",object:"date"},ed=s("$ZodCheckLessThan",(e,t)=>{el.init(e,t);let r=eu[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<a&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ec=s("$ZodCheckGreaterThan",(e,t)=>{el.init(e,t);let r=eu[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>a&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ep=s("$ZodCheckMultipleOf",(e,t)=>{el.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let a,i,s;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0==(i=Math.round(a=r.value/t.value),s=Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-i)<s?0:a-i))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ef=s("$ZodCheckNumberFormat",(e,t)=>{el.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,s]=et[t.format];e._zod.onattach.push(e=>{let a=e._zod.bag;a.format=t.format,a.minimum=i,a.maximum=s,r&&(a.pattern=N)}),e._zod.check=n=>{let o=n.value;if(r){if(!Number.isInteger(o))return void n.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?n.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):n.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}))}o<i&&n.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),o>s&&n.issues.push({origin:"number",input:o,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),eh=s("$ZodCheckMaxLength",(e,t)=>{var r;el.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let a=r.value;if(a.length<=t.maximum)return;let i=en(a);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),em=s("$ZodCheckMinLength",(e,t)=>{var r;el.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let a=r.value;if(a.length>=t.minimum)return;let i=en(a);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),ey=s("$ZodCheckLengthEquals",(e,t)=>{var r;el.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let a=r.value,i=a.length;if(i===t.length)return;let s=en(a),n=i>t.length;r.issues.push({origin:s,...n?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eg=s("$ZodCheckStringFormat",(e,t)=>{var r,a;el.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),ev=s("$ZodCheckRegex",(e,t)=>{eg.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),e_=s("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=C),eg.init(e,t)}),eb=s("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=A),eg.init(e,t)}),ew=s("$ZodCheckIncludes",(e,t)=>{el.init(e,t);let r=Q(t.includes),a=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=a,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),e$=s("$ZodCheckStartsWith",(e,t)=>{el.init(e,t);let r=RegExp(`^${Q(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),ek=s("$ZodCheckEndsWith",(e,t)=>{el.init(e,t);let r=RegExp(`.*${Q(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),ex=s("$ZodCheckOverwrite",(e,t)=>{el.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class eS{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let eE=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Z,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eT=s("$ZodError",eE),eP=s("$ZodError",eE,{Parent:Error}),eO=e=>(t,r,a,i)=>{let s=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new n;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>es(e,s,u())));throw J(t,i?.callee),t}return o.value},ej=eO(eP),eN=e=>async(t,r,a,i)=>{let s=a?{...a,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise&&(n=await n),n.issues.length){let t=new(i?.Err??e)(n.issues.map(e=>es(e,s,u())));throw J(t,i?.callee),t}return n.value},ez=eN(eP),eI=e=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new n;return s.issues.length?{success:!1,error:new(e??eT)(s.issues.map(e=>es(e,i,u())))}:{success:!0,data:s.value}},eR=eI(eP),eC=e=>async(t,r,a)=>{let i=a?{...a,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>es(e,i,u())))}:{success:!0,data:s.value}},eA=eC(eP),eM={major:4,minor:4,patch:3},eZ=s("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=eM;let a=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&a.unshift(e),a))for(let r of t._zod.onattach)r(e);if(0===a.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let a,i=er(e);for(let s of t){if(s._zod.def.when){if(function(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}(e)||!s._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=s._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new n;if(a||o instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=er(e,t)))});else{if(e.issues.length===t)continue;i||(i=er(e,t))}}return a?a.then(()=>e):e},r=(r,i,s)=>{if(er(r))return r.aborted=!0,r;let o=t(i,a,s);if(o instanceof Promise){if(!1===s.async)throw new n;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if("backward"===s.direction){let t=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,s)):r(t,i,s)}let o=e._zod.parse(i,s);if(o instanceof Promise){if(!1===s.async)throw new n;return o.then(e=>t(e,a,s))}return t(o,a,s)}}L(e,"~standard",()=>({validate:t=>{try{let r=eR(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return eA(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),eq=s("$ZodString",(e,t)=>{var r;let a;eZ.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(a=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${a}$`)),e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),eD=s("$ZodStringFormat",(e,t)=>{eg.init(e,t),eq.init(e,t)}),eF=s("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=g),eD.init(e,t)}),eL=s("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=v(e))}else t.pattern??(t.pattern=v());eD.init(e,t)}),eV=s("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=_),eD.init(e,t)}),eU=s("$ZodURL",(e,t)=>{eD.init(e,t),e._zod.check=r=>{try{let a=r.value.trim();if(!t.normalize&&t.protocol?.source===E.source&&!/^https?:\/\//i.test(a))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=a;return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),eH=s("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),eD.init(e,t)}),eJ=s("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=m),eD.init(e,t)}),eK=s("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=d),eD.init(e,t)}),eB=s("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=c),eD.init(e,t)}),eG=s("$ZodULID",(e,t)=>{t.pattern??(t.pattern=p),eD.init(e,t)}),eW=s("$ZodXID",(e,t)=>{t.pattern??(t.pattern=f),eD.init(e,t)}),eY=s("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=h),eD.init(e,t)}),eQ=s("$ZodISODateTime",(e,t)=>{let r,a,i;t.pattern??(r=j({precision:t.precision}),a=["Z"],t.local&&a.push(""),t.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${r}(?:${a.join("|")})`,t.pattern=RegExp(`^${P}T(?:${i})$`)),eD.init(e,t)}),eX=s("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=O),eD.init(e,t)}),e0=s("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${j(t)}$`)),eD.init(e,t)}),e1=s("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=y),eD.init(e,t)}),e9=s("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=b),eD.init(e,t),e._zod.bag.format="ipv4"}),e2=s("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=w),eD.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),e4=s("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$),eD.init(e,t)}),e6=s("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=k),eD.init(e,t),e._zod.check=r=>{let a=r.value.split("/");try{if(2!==a.length)throw Error();let[e,t]=a;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function e8(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let e5=s("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=x),eD.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{e8(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),e3=s("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=S),eD.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!S.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return e8(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),e7=s("$ZodE164",(e,t)=>{t.pattern??(t.pattern=T),eD.init(e,t)}),te=s("$ZodJWT",(e,t)=>{eD.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[a]=r;if(!a)return!1;let i=JSON.parse(atob(a));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),tt=s("$ZodNumber",(e,t)=>{eZ.init(e,t),e._zod.pattern=e._zod.bag.pattern??z,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),r}}),tr=s("$ZodNumberFormat",(e,t)=>{ef.init(e,t),tt.init(e,t)}),ta=s("$ZodBoolean",(e,t)=>{eZ.init(e,t),e._zod.pattern=I,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),ti=s("$ZodNull",(e,t)=>{eZ.init(e,t),e._zod.pattern=R,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let a=t.value;return null===a||t.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),t}}),ts=s("$ZodUnknown",(e,t)=>{eZ.init(e,t),e._zod.parse=e=>e}),tn=s("$ZodNever",(e,t)=>{eZ.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function to(e,t,r){e.issues.length&&t.issues.push(...ea(r,e.issues)),t.value[r]=e.value}let tl=s("$ZodArray",(e,t)=>{eZ.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let s=[];for(let e=0;e<i.length;e++){let n=i[e],o=t.element._zod.run({value:n,issues:[]},a);o instanceof Promise?s.push(o.then(t=>to(t,r,e))):to(o,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function tu(e,t,r,a,i,s){let n=r in a;if(e.issues.length){if(i&&s&&!n)return;t.issues.push(...ea(r,e.issues))}if(!n&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?n&&(t.value[r]=void 0):t.value[r]=e.value}function td(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let a=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(a)}}function tc(e,t,r,a,i,s){let n=[],o=i.keySet,l=i.catchall._zod,u=l.def.type,d="optional"===l.optin,c="optional"===l.optout;for(let i in t){if("__proto__"===i||o.has(i))continue;if("never"===u){n.push(i);continue}let s=l.run({value:t[i],issues:[]},a);s instanceof Promise?e.push(s.then(e=>tu(e,r,i,t,d,c))):tu(s,r,i,t,d,c)}return(n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:s}),e.length)?Promise.all(e).then(()=>r):r}let tp=s("$ZodObject",(e,t)=>{let r;eZ.init(e,t);let a=Object.getOwnPropertyDescriptor(t,"shape");if(!a?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=q(()=>td(t));L(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let a=e[t]._zod;if(a.values)for(let e of(r[t]??(r[t]=new Set),a.values))r[t].add(e)}return r});let s=t.catchall;e._zod.parse=(t,a)=>{r??(r=i.value);let n=t.value;if(!K(n))return t.issues.push({expected:"object",code:"invalid_type",input:n,inst:e}),t;t.value={};let o=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optin,s="optional"===r._zod.optout,u=r._zod.run({value:n[e],issues:[]},a);u instanceof Promise?o.push(u.then(r=>tu(r,t,e,n,i,s))):tu(u,t,e,n,i,s)}return s?tc(o,n,t,a,i.value,e):o.length?Promise.all(o).then(()=>t):t}}),tf=s("$ZodObjectJIT",(e,t)=>{let r,a;tp.init(e,t);let i=e._zod.parse,s=q(()=>td(t)),n=!l.jitless,o=n&&B.value,u=t.catchall;e._zod.parse=(l,d)=>{a??(a=s.value);let c=l.value;return K(c)?n&&o&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new eS(["shape","payload","ctx"]),r=s.value,a=e=>{let t=H(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),n=0;for(let e of r.keys)i[e]=`key_${n++}`;for(let s of(t.write("const newResult = {};"),r.keys)){let r=i[s],n=H(s),o=e[s],l=o?._zod?.optin==="optional",u=o?._zod?.optout==="optional";t.write(`const ${r} = ${a(s)};`),l&&u?t.write(`
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,()=>(()=>{var e={8583(e,t,r){let a=r(9896),i=r(6928),n=r(857),o=r(6982),s=r(4519).version,l=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function c(e){console.log(`[dotenv@${s}][DEBUG] ${e}`)}function u(e){console.log(`[dotenv@${s}] ${e}`)}function d(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function p(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)a.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=i.resolve(process.cwd(),".env.vault");return a.existsSync(t)?t:null}function m(e){return"~"===e[0]?i.join(n.homedir(),e.slice(1)):e}let h={configDotenv:function(e){let t,r=i.resolve(process.cwd(),".env"),n="utf8",o=!!(e&&e.debug),s=!e||!("quiet"in e)||e.quiet;e&&e.encoding?n=e.encoding:o&&c("No encoding is specified. UTF-8 is used by default");let l=[r];if(e&&e.path)if(Array.isArray(e.path))for(let t of(l=[],e.path))l.push(m(t));else l=[m(e.path)];let d={};for(let r of l)try{let t=h.parse(a.readFileSync(r,{encoding:n}));h.populate(d,t,e)}catch(e){o&&c(`Failed to load ${r} ${e.message}`),t=e}let p=process.env;if(e&&null!=e.processEnv&&(p=e.processEnv),h.populate(p,d,e),o||!s){let e=Object.keys(d).length,r=[];for(let e of l)try{let t=i.relative(process.cwd(),e);r.push(t)}catch(r){o&&c(`Failed to load ${e} ${r.message}`),t=r}u(`injecting env (${e}) from ${r.join(",")}`)}return t?{parsed:d,error:t}:{parsed:d}},_configVault:function(e){let t=!!(e&&e.debug),r=!e||!("quiet"in e)||e.quiet;(t||!r)&&u("Loading env from encrypted .env.vault");let a=h._parseVault(e),i=process.env;return e&&null!=e.processEnv&&(i=e.processEnv),h.populate(i,a,e),{parsed:a}},_parseVault:function(e){let t,r=p(e=e||{});e.path=r;let a=h.configDotenv(e);if(!a.parsed){let e=Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw e.code="MISSING_DATA",e}let i=d(e).split(","),n=i.length;for(let e=0;e<n;e++)try{let r=i[e].trim(),n=function(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){let e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}let a=r.password;if(!a){let e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}let i=r.searchParams.get("environment");if(!i){let e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}let n=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[n];if(!o){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:o,key:a}}(a,r);t=h.decrypt(n.ciphertext,n.key);break}catch(t){if(e+1>=n)throw t}return h.parse(t)},config:function(e){if(0===d(e).length)return h.configDotenv(e);let t=p(e);if(!t){var r;return r=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${s}][WARN] ${r}`),h.configDotenv(e)}return h._configVault(e)},decrypt:function(e,t){let r=Buffer.from(t.slice(-64),"hex"),a=Buffer.from(e,"base64"),i=a.subarray(0,12),n=a.subarray(-16);a=a.subarray(12,-16);try{let e=o.createDecipheriv("aes-256-gcm",r,i);return e.setAuthTag(n),`${e.update(a)}${e.final()}`}catch(a){let e=a instanceof RangeError,t="Invalid key length"===a.message,r="Unsupported state or unable to authenticate data"===a.message;if(e||t){let e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){let e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw a}},parse:function(e){let t,r={},a=e.toString();for(a=a.replace(/\r\n?/mg,"\n");null!=(t=l.exec(a));){let e=t[1],a=t[2]||"",i=(a=a.trim())[0];a=a.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(a=(a=a.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),r[e]=a}return r},populate:function(e,t,r={}){let a=!!(r&&r.debug),i=!!(r&&r.override);if("object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===i&&(e[r]=t[r]),a&&(!0===i?c(`"${r}" is already defined and WAS overwritten`):c(`"${r}" is already defined and was NOT overwritten`))):e[r]=t[r]}};e.exports.configDotenv=h.configDotenv,e.exports._configVault=h._configVault,e.exports._parseVault=h._parseVault,e.exports.config=h.config,e.exports.decrypt=h.decrypt,e.exports.parse=h.parse,e.exports.populate=h.populate,e.exports=h},6982(e){"use strict";e.exports=require("crypto")},9896(e){"use strict";e.exports=require("fs")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},4519(e){"use strict";e.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')}},t={};function r(a){var i=t[a];if(void 0!==i)return i.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,r),n.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";let e,t,a,i,n,o,s,l,c,u,d;var p,m,h,f,g,y,v,_,b,S,$,w,k,R=Object.create,x=Object.defineProperty,P=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,T=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);let C=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),N=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),I=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),q=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]),z=Object.freeze({status:"aborted"});function A(e,t,r){function a(r,a){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:a,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,a);let i=o.prototype,n=Object.keys(i);for(let e=0;e<n.length;e++){let t=n[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class n extends i{}function o(e){var t;let i=r?.Parent?new n:this;for(let r of(a(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(n,"name",{value:e}),Object.defineProperty(o,"init",{value:a}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}Symbol("zod_brand");class M extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class L extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(v=globalThis).__zod_globalConfig??(v.__zod_globalConfig={});let Z=globalThis.__zod_globalConfig;function D(e){return e&&Object.assign(Z,e),Z}let V=/^[cC][0-9a-z]{6,}$/,U=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,H=/^[0-9a-vA-V]{20}$/,J=/^[A-Za-z0-9]{27}$/,K=/^[a-zA-Z0-9_-]{21}$/,B=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,G=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,W=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Y=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,X=/^(?:(?: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])$/,Q=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ee=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,et=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,er=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ea=/^[A-Za-z0-9_-]*$/,ei=/^https?$/,en=/^\+[1-9]\d{6,14}$/,eo="(?:(?:\\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])))",es=RegExp(`^${eo}$`);function el(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let ec=/^-?\d+$/,eu=/^-?\d+(?:\.\d+)?$/,ed=/^(?:true|false)$/i,ep=/^null$/i,em=/^[^A-Z]*$/,eh=/^[^a-z]*$/;function ef(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function eg(e,t){return"bigint"==typeof t?t.toString():t}function ey(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ev(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let e_=Symbol("evaluating");function eb(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==e_)return void 0===a&&(a=e_,a=r()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function eS(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function e$(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function ew(e){return JSON.stringify(e)}let ek="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eR(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let ex=ey(()=>{if(Z.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function eP(e){if(!1===eR(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==eR(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function eE(e){return eP(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let eT=new Set(["string","number","symbol"]);function ej(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eO(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function eC(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}let eN={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function eI(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function eq(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function ez(e){return"string"==typeof e?e:e?.message}function eA(e,t,r){let a=e.message?e.message:ez(e.inst?._zod.def?.error?.(e))??ez(t?.error?.(e))??ez(r.customError?.(e))??ez(r.localeError?.(e))??"Invalid input",{inst:i,continue:n,input:o,...s}=e;return s.path??(s.path=[]),s.message=a,t?.reportInput&&(s.input=o),s}function eM(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function eL(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}let eZ=A("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),eD={number:"number",bigint:"bigint",object:"date"},eV=A("$ZodCheckLessThan",(e,t)=>{eZ.init(e,t);let r=eD[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<a&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eU=A("$ZodCheckGreaterThan",(e,t)=>{eZ.init(e,t);let r=eD[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>a&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eF=A("$ZodCheckMultipleOf",(e,t)=>{eZ.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{let a,i,n;if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0==(i=Math.round(a=r.value/t.value),n=Number.EPSILON*Math.max(Math.abs(a),1),Math.abs(a-i)<n?0:a-i))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eH=A("$ZodCheckNumberFormat",(e,t)=>{eZ.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,n]=eN[t.format];e._zod.onattach.push(e=>{let a=e._zod.bag;a.format=t.format,a.minimum=i,a.maximum=n,r&&(a.pattern=ec)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s))return void o.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}))}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>n&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),eJ=A("$ZodCheckMaxLength",(e,t)=>{var r;eZ.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let a=r.value;if(a.length<=t.maximum)return;let i=eM(a);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eK=A("$ZodCheckMinLength",(e,t)=>{var r;eZ.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let a=r.value;if(a.length>=t.minimum)return;let i=eM(a);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eB=A("$ZodCheckLengthEquals",(e,t)=>{var r;eZ.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let a=r.value,i=a.length;if(i===t.length)return;let n=eM(a),o=i>t.length;r.issues.push({origin:n,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eG=A("$ZodCheckStringFormat",(e,t)=>{var r,a;eZ.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),eW=A("$ZodCheckRegex",(e,t)=>{eG.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eY=A("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=em),eG.init(e,t)}),eX=A("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=eh),eG.init(e,t)}),eQ=A("$ZodCheckIncludes",(e,t)=>{eZ.init(e,t);let r=ej(t.includes),a=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=a,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),e0=A("$ZodCheckStartsWith",(e,t)=>{eZ.init(e,t);let r=RegExp(`^${ej(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),e1=A("$ZodCheckEndsWith",(e,t)=>{eZ.init(e,t);let r=RegExp(`.*${ej(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),e2=A("$ZodCheckOverwrite",(e,t)=>{eZ.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class e9{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let e4=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,eg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},e6=A("$ZodError",e4),e5=A("$ZodError",e4,{Parent:Error}),e3=e=>(t,r,a,i)=>{let n=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new M;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>eA(e,n,D())));throw ek(t,i?.callee),t}return o.value},e8=e=>async(t,r,a,i)=>{let n=a?{...a,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>eA(e,n,D())));throw ek(t,i?.callee),t}return o.value},e7=e=>(t,r,a)=>{let i=a?{...a,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise)throw new M;return n.issues.length?{success:!1,error:new(e??e6)(n.issues.map(e=>eA(e,i,D())))}:{success:!0,data:n.value}},te=e7(e5),tt=e=>async(t,r,a)=>{let i=a?{...a,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length?{success:!1,error:new e(n.issues.map(e=>eA(e,i,D())))}:{success:!0,data:n.value}},tr=tt(e5),ta={major:4,minor:4,patch:3},ti=A("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ta;let a=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&a.unshift(e),a))for(let r of t._zod.onattach)r(e);if(0===a.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let a,i=eI(e);for(let n of t){if(n._zod.def.when){if(function(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}(e)||!n._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=n._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new M;if(a||o instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=eI(e,t)))});else{if(e.issues.length===t)continue;i||(i=eI(e,t))}}return a?a.then(()=>e):e},r=(r,i,n)=>{if(eI(r))return r.aborted=!0,r;let o=t(i,a,n);if(o instanceof Promise){if(!1===n.async)throw new M;return o.then(t=>e._zod.parse(t,n))}return e._zod.parse(o,n)};e._zod.run=(i,n)=>{if(n.skipChecks)return e._zod.parse(i,n);if("backward"===n.direction){let t=e._zod.parse({value:i.value,issues:[]},{...n,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,n)):r(t,i,n)}let o=e._zod.parse(i,n);if(o instanceof Promise){if(!1===n.async)throw new M;return o.then(e=>t(e,a,n))}return t(o,a,n)}}eb(e,"~standard",()=>({validate:t=>{try{let r=te(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return tr(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),tn=A("$ZodString",(e,t)=>{var r;let a;ti.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(a=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${a}$`)),e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),to=A("$ZodStringFormat",(e,t)=>{eG.init(e,t),tn.init(e,t)}),ts=A("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=G),to.init(e,t)}),tl=A("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=W(e))}else t.pattern??(t.pattern=W());to.init(e,t)}),tc=A("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Y),to.init(e,t)}),tu=A("$ZodURL",(e,t)=>{to.init(e,t),e._zod.check=r=>{try{let a=r.value.trim();if(!t.normalize&&t.protocol?.source===ei.source&&!/^https?:\/\//i.test(a))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});let i=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=a;return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),td=A("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),to.init(e,t)}),tp=A("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=K),to.init(e,t)}),tm=A("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=V),to.init(e,t)}),th=A("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=U),to.init(e,t)}),tf=A("$ZodULID",(e,t)=>{t.pattern??(t.pattern=F),to.init(e,t)}),tg=A("$ZodXID",(e,t)=>{t.pattern??(t.pattern=H),to.init(e,t)}),ty=A("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=J),to.init(e,t)}),tv=A("$ZodISODateTime",(e,t)=>{let r,a,i;t.pattern??(r=el({precision:t.precision}),a=["Z"],t.local&&a.push(""),t.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${r}(?:${a.join("|")})`,t.pattern=RegExp(`^${eo}T(?:${i})$`)),to.init(e,t)}),t_=A("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=es),to.init(e,t)}),tb=A("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${el(t)}$`)),to.init(e,t)}),tS=A("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=B),to.init(e,t)}),t$=A("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=X),to.init(e,t),e._zod.bag.format="ipv4"}),tw=A("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Q),to.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),tk=A("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ee),to.init(e,t)}),tR=A("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=et),to.init(e,t),e._zod.check=r=>{let a=r.value.split("/");try{if(2!==a.length)throw Error();let[e,t]=a;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function tx(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let tP=A("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=er),to.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{tx(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),tE=A("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ea),to.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!ea.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tx(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),tT=A("$ZodE164",(e,t)=>{t.pattern??(t.pattern=en),to.init(e,t)}),tj=A("$ZodJWT",(e,t)=>{to.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[a]=r;if(!a)return!1;let i=JSON.parse(atob(a));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),tO=A("$ZodNumber",(e,t)=>{ti.init(e,t),e._zod.pattern=e._zod.bag.pattern??eu,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let n="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...n?{received:n}:{}}),r}}),tC=A("$ZodNumberFormat",(e,t)=>{eH.init(e,t),tO.init(e,t)}),tN=A("$ZodBoolean",(e,t)=>{ti.init(e,t),e._zod.pattern=ed,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),tI=A("$ZodNull",(e,t)=>{ti.init(e,t),e._zod.pattern=ep,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let a=t.value;return null===a||t.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),t}}),tq=A("$ZodAny",(e,t)=>{ti.init(e,t),e._zod.parse=e=>e}),tz=A("$ZodUnknown",(e,t)=>{ti.init(e,t),e._zod.parse=e=>e}),tA=A("$ZodNever",(e,t)=>{ti.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function tM(e,t,r){e.issues.length&&t.issues.push(...eq(r,e.issues)),t.value[r]=e.value}let tL=A("$ZodArray",(e,t)=>{ti.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let n=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},a);s instanceof Promise?n.push(s.then(t=>tM(t,r,e))):tM(s,r,e)}return n.length?Promise.all(n).then(()=>r):r}});function tZ(e,t,r,a,i,n){let o=r in a;if(e.issues.length){if(i&&n&&!o)return;t.issues.push(...eq(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}void 0===e.value?o&&(t.value[r]=void 0):t.value[r]=e.value}function tD(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let a=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(a)}}function tV(e,t,r,a,i,n){let o=[],s=i.keySet,l=i.catchall._zod,c=l.def.type,u="optional"===l.optin,d="optional"===l.optout;for(let i in t){if("__proto__"===i||s.has(i))continue;if("never"===c){o.push(i);continue}let n=l.run({value:t[i],issues:[]},a);n instanceof Promise?e.push(n.then(e=>tZ(e,r,i,t,u,d))):tZ(n,r,i,t,u,d)}return(o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:n}),e.length)?Promise.all(e).then(()=>r):r}let tU=A("$ZodObject",(e,t)=>{let r;ti.init(e,t);let a=Object.getOwnPropertyDescriptor(t,"shape");if(!a?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=ey(()=>tD(t));eb(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let a=e[t]._zod;if(a.values)for(let e of(r[t]??(r[t]=new Set),a.values))r[t].add(e)}return r});let n=t.catchall;e._zod.parse=(t,a)=>{r??(r=i.value);let o=t.value;if(!eR(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};let s=[],l=r.shape;for(let e of r.keys){let r=l[e],i="optional"===r._zod.optin,n="optional"===r._zod.optout,c=r._zod.run({value:o[e],issues:[]},a);c instanceof Promise?s.push(c.then(r=>tZ(r,t,e,o,i,n))):tZ(c,t,e,o,i,n)}return n?tV(s,o,t,a,i.value,e):s.length?Promise.all(s).then(()=>t):t}}),tF=A("$ZodObjectJIT",(e,t)=>{let r,a;tU.init(e,t);let i=e._zod.parse,n=ey(()=>tD(t)),o=!Z.jitless,s=o&&ex.value,l=t.catchall;e._zod.parse=(c,u)=>{a??(a=n.value);let d=c.value;return eR(d)?o&&s&&u?.async===!1&&!0!==u.jitless?(r||(r=(e=>{let t=new e9(["shape","payload","ctx"]),r=n.value,a=e=>{let t=ew(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),o=0;for(let e of r.keys)i[e]=`key_${o++}`;for(let n of(t.write("const newResult = {};"),r.keys)){let r=i[n],o=ew(n),s=e[n],l=s?._zod?.optin==="optional",c=s?._zod?.optout==="optional";t.write(`const ${r} = ${a(n)};`),l&&c?t.write(`
|
|
8
2
|
if (${r}.issues.length) {
|
|
9
|
-
if (${
|
|
3
|
+
if (${o} in input) {
|
|
10
4
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
11
5
|
...iss,
|
|
12
|
-
path: iss.path ? [${
|
|
6
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
13
7
|
})));
|
|
14
8
|
}
|
|
15
9
|
}
|
|
16
10
|
|
|
17
11
|
if (${r}.value === undefined) {
|
|
18
|
-
if (${
|
|
19
|
-
newResult[${
|
|
12
|
+
if (${o} in input) {
|
|
13
|
+
newResult[${o}] = undefined;
|
|
20
14
|
}
|
|
21
15
|
} else {
|
|
22
|
-
newResult[${
|
|
16
|
+
newResult[${o}] = ${r}.value;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
`):l?t.write(`
|
|
26
20
|
if (${r}.issues.length) {
|
|
27
21
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
28
22
|
...iss,
|
|
29
|
-
path: iss.path ? [${
|
|
23
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
30
24
|
})));
|
|
31
25
|
}
|
|
32
26
|
|
|
33
27
|
if (${r}.value === undefined) {
|
|
34
|
-
if (${
|
|
35
|
-
newResult[${
|
|
28
|
+
if (${o} in input) {
|
|
29
|
+
newResult[${o}] = undefined;
|
|
36
30
|
}
|
|
37
31
|
} else {
|
|
38
|
-
newResult[${
|
|
32
|
+
newResult[${o}] = ${r}.value;
|
|
39
33
|
}
|
|
40
34
|
|
|
41
35
|
`):t.write(`
|
|
42
|
-
const ${r}_present = ${
|
|
36
|
+
const ${r}_present = ${o} in input;
|
|
43
37
|
if (${r}.issues.length) {
|
|
44
38
|
payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
|
|
45
39
|
...iss,
|
|
46
|
-
path: iss.path ? [${
|
|
40
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
47
41
|
})));
|
|
48
42
|
}
|
|
49
43
|
if (!${r}_present && !${r}.issues.length) {
|
|
@@ -51,31 +45,37 @@
|
|
|
51
45
|
code: "invalid_type",
|
|
52
46
|
expected: "nonoptional",
|
|
53
47
|
input: undefined,
|
|
54
|
-
path: [${
|
|
48
|
+
path: [${o}]
|
|
55
49
|
});
|
|
56
50
|
}
|
|
57
51
|
|
|
58
52
|
if (${r}_present) {
|
|
59
53
|
if (${r}.value === undefined) {
|
|
60
|
-
newResult[${
|
|
54
|
+
newResult[${o}] = undefined;
|
|
61
55
|
} else {
|
|
62
|
-
newResult[${
|
|
56
|
+
newResult[${o}] = ${r}.value;
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
59
|
|
|
66
|
-
`)}t.write("payload.value = newResult;"),t.write("return payload;");let o=t.compile();return(t,r)=>o(e,t,r)})(t.shape)),l=r(l,d),u)?tc([],c,l,d,a,e):l:i(l,d):(l.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),l)}});function th(e,t,r,a){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!er(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>es(e,a,u())))}),t)}let tm=s("$ZodUnion",(e,t)=>{eZ.init(e,t),L(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),L(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),L(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),L(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>D(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(a,i)=>{if(r)return r(a,i);let s=!1,n=[];for(let e of t.options){let t=e._zod.run({value:a.value,issues:[]},i);if(t instanceof Promise)n.push(t),s=!0;else{if(0===t.issues.length)return t;n.push(t)}}return s?Promise.all(n).then(t=>th(t,a,e,i)):th(n,a,e,i)}}),ty=s("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,tm.init(e,t);let r=e._zod.parse;L(e._zod,"propValues",()=>{let e={};for(let r of t.options){let a=r._zod.propValues;if(!a||0===Object.keys(a).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(a))for(let a of(e[t]||(e[t]=new Set),r))e[t].add(a)}return e});let a=q(()=>{let e=t.options,r=new Map;for(let a of e){let e=a._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,a)}}return r});e._zod.parse=(i,s)=>{let n=i.value;if(!K(n))return i.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),i;let o=a.value.get(n?.[t.discriminator]);return o?o._zod.run(i,s):t.unionFallback||"backward"===s.direction?r(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(a.value.keys()),input:n,path:[t.discriminator],inst:e}),i)}}),tg=s("$ZodIntersection",(e,t)=>{eZ.init(e,t),e._zod.parse=(e,r)=>{let a=e.value,i=t.left._zod.run({value:a,issues:[]},r),s=t.right._zod.run({value:a,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([t,r])=>tv(e,t,r)):tv(e,i,s)}});function tv(e,t,r){let a,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(a??(a=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let s=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&a&&e.issues.push({...a,keys:s}),er(e))return e;let n=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(G(t)&&G(r)){let a=Object.keys(r),i=Object.keys(t).filter(e=>-1!==a.indexOf(e)),s={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};s[a]=i.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let i=0;i<t.length;i++){let s=e(t[i],r[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};a.push(s.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!n.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}let t_=s("$ZodRecord",(e,t)=>{eZ.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!G(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],n=t.keyType._zod.values;if(n){let o;r.value={};let l=new Set;for(let o of n)if("string"==typeof o||"number"==typeof o||"symbol"==typeof o){l.add("number"==typeof o?o.toString():o);let n=t.keyType._zod.run({value:o,issues:[]},a);if(n instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(n.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:n.issues.map(e=>es(e,a,u())),input:o,path:[o],inst:e});continue}let d=n.value,c=t.valueType._zod.run({value:i[o],issues:[]},a);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&r.issues.push(...ea(o,e.issues)),r.value[d]=e.value})):(c.issues.length&&r.issues.push(...ea(o,c.issues)),r.value[d]=c.value)}for(let e in i)l.has(e)||(o=o??[]).push(e);o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:o})}else for(let n of(r.value={},Reflect.ownKeys(i))){if("__proto__"===n||!Object.prototype.propertyIsEnumerable.call(i,n))continue;let o=t.keyType._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof n&&z.test(n)&&o.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},a);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(o=e)}if(o.issues.length){"loose"===t.mode?r.value[n]=i[n]:r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>es(e,a,u())),input:n,path:[n],inst:e});continue}let l=t.valueType._zod.run({value:i[n],issues:[]},a);l instanceof Promise?s.push(l.then(e=>{e.issues.length&&r.issues.push(...ea(n,e.issues)),r.value[o.value]=e.value})):(l.issues.length&&r.issues.push(...ea(n,l.issues)),r.value[o.value]=l.value)}return s.length?Promise.all(s).then(()=>r):r}}),tb=s("$ZodEnum",(e,t)=>{eZ.init(e,t);let r=M(t.entries),a=new Set(r);e._zod.values=a,e._zod.pattern=RegExp(`^(${r.filter(e=>Y.has(typeof e)).map(e=>"string"==typeof e?Q(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let s=t.value;return a.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),tw=s("$ZodLiteral",(e,t)=>{if(eZ.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?Q(e):e?Q(e.toString()):String(e)).join("|")})$`),e._zod.parse=(a,i)=>{let s=a.value;return r.has(s)||a.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),a}}),t$=s("$ZodTransform",(e,t)=>{eZ.init(e,t),e._zod.optin="optional",e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new o(e.constructor.name);let i=t.transform(r.value,r);if(a.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new n;return r.value=i,r.fallback=!0,r}});function tk(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let tx=s("$ZodOptional",(e,t)=>{eZ.init(e,t),e._zod.optin="optional",e._zod.optout="optional",L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),L(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${D(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let a=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>tk(e,a)):tk(i,a)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),tS=s("$ZodExactOptional",(e,t)=>{tx.init(e,t),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),tE=s("$ZodNullable",(e,t)=>{eZ.init(e,t),L(e._zod,"optin",()=>t.innerType._zod.optin),L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${D(e.source)}|null)$`):void 0}),L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),tT=s("$ZodDefault",(e,t)=>{eZ.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(e=>tP(e,t)):tP(a,t)}});function tP(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let tO=s("$ZodPrefault",(e,t)=>{eZ.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),tj=s("$ZodNonOptional",(e,t)=>{eZ.init(e,t),L(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,a)=>{let i=t.innerType._zod.run(r,a);return i instanceof Promise?i.then(t=>tN(t,e)):tN(i,e)}});function tN(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let tz=s("$ZodCatch",(e,t)=>{eZ.init(e,t),e._zod.optin="optional",L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(a=>(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>es(e,r,u()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>es(e,r,u()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),tI=s("$ZodPipe",(e,t)=>{eZ.init(e,t),L(e._zod,"values",()=>t.in._zod.values),L(e._zod,"optin",()=>t.in._zod.optin),L(e._zod,"optout",()=>t.out._zod.optout),L(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let a=t.out._zod.run(e,r);return a instanceof Promise?a.then(e=>tR(e,t.in,r)):tR(a,t.in,r)}let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>tR(e,t.out,r)):tR(a,t.out,r)}});function tR(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let tC=s("$ZodPreprocess",(e,t)=>{tI.init(e,t)}),tA=s("$ZodReadonly",(e,t)=>{eZ.init(e,t),L(e._zod,"propValues",()=>t.innerType._zod.propValues),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"optin",()=>t.innerType?._zod?.optin),L(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(tM):tM(a)}});function tM(e){return e.value=Object.freeze(e.value),e}let tZ=s("$ZodCustom",(e,t)=>{el.init(e,t),eZ.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let a=r.value,i=t.fn(a);if(i instanceof Promise)return i.then(t=>tq(t,r,a,e));tq(i,r,a,e)}});function tq(e,t,r,a){if(!e){let e={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(e.params=a._zod.def.params),t.issues.push(eo(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(o5=globalThis).__zod_globalRegistry??(o5.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let a={...r,...this._map.get(e)};return Object.keys(a).length?a:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let tD=globalThis.__zod_globalRegistry;function tF(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ee(t)})}function tL(e,t){return new ed({check:"less_than",...ee(t),value:e,inclusive:!1})}function tV(e,t){return new ed({check:"less_than",...ee(t),value:e,inclusive:!0})}function tU(e,t){return new ec({check:"greater_than",...ee(t),value:e,inclusive:!1})}function tH(e,t){return new ec({check:"greater_than",...ee(t),value:e,inclusive:!0})}function tJ(e,t){return new ep({check:"multiple_of",...ee(t),value:e})}function tK(e,t){return new eh({check:"max_length",...ee(t),maximum:e})}function tB(e,t){return new em({check:"min_length",...ee(t),minimum:e})}function tG(e,t){return new ey({check:"length_equals",...ee(t),length:e})}function tW(e){return new ex({check:"overwrite",tx:e})}function tY(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??tD,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function tQ(e,t,r={path:[],schemaPath:[]}){var a;let i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let n={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,n);let o=e._zod.toJSONSchema?.();if(o)n.schema=o;else{let a={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,n.schema,a);else{let r=n.schema,s=t.processors[i.type];if(!s)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);s(e,t,r,a)}let s=e._zod.parent;s&&(n.ref||(n.ref=s),tQ(s,t,a),t.seen.get(s).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(n.schema,l),"input"===t.io&&function e(t,r){let a=r??{seen:new Set};if(a.seen.has(t))return!1;a.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,a);if("set"===i.type)return e(i.valueType,a);if("lazy"===i.type)return e(i.getter(),a);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,a);if("intersection"===i.type)return e(i.left,a)||e(i.right,a);if("record"===i.type||"map"===i.type)return e(i.keyType,a)||e(i.valueType,a);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,a)||e(i.out,a);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],a))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,a))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,a))return!0;if(i.rest&&e(i.rest,a))return!0}return!1}(e)&&(delete n.schema.examples,delete n.schema.default),"input"===t.io&&"_prefault"in n.schema&&((a=n.schema).default??(a.default=n.schema._prefault)),delete n.schema._prefault,t.seen.get(e).schema}function tX(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=a.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let a=t[1],{ref:i,defId:s}=(t=>{let a="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let s=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=s,{defId:s,ref:`${i("__shared")}#/${a}/${s}`}}if(t[1]===r)return{ref:"#"};let i=`#/${a}/`,s=t[1].schema.id??`__schema${e.counter++}`;return{defId:s,ref:i+s}})(t);a.def={...a.schema},s&&(a.defId=s);let n=a.schema;for(let e in n)delete n[e];n.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
60
|
+
`)}t.write("payload.value = newResult;"),t.write("return payload;");let s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),c=r(c,u),l)?tV([],d,c,u,a,e):c:i(c,u):(c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c)}});function tH(e,t,r,a){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!eI(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>eA(e,a,D())))}),t)}let tJ=A("$ZodUnion",(e,t)=>{ti.init(e,t),eb(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),eb(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),eb(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),eb(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ev(e.source)).join("|")})$`)}});let r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(a,i)=>{if(r)return r(a,i);let n=!1,o=[];for(let e of t.options){let t=e._zod.run({value:a.value,issues:[]},i);if(t instanceof Promise)o.push(t),n=!0;else{if(0===t.issues.length)return t;o.push(t)}}return n?Promise.all(o).then(t=>tH(t,a,e,i)):tH(o,a,e,i)}}),tK=A("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,tJ.init(e,t);let r=e._zod.parse;eb(e._zod,"propValues",()=>{let e={};for(let r of t.options){let a=r._zod.propValues;if(!a||0===Object.keys(a).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(a))for(let a of(e[t]||(e[t]=new Set),r))e[t].add(a)}return e});let a=ey(()=>{let e=t.options,r=new Map;for(let a of e){let e=a._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,a)}}return r});e._zod.parse=(i,n)=>{let o=i.value;if(!eR(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=a.value.get(o?.[t.discriminator]);return s?s._zod.run(i,n):t.unionFallback||"backward"===n.direction?r(i,n):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(a.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),tB=A("$ZodIntersection",(e,t)=>{ti.init(e,t),e._zod.parse=(e,r)=>{let a=e.value,i=t.left._zod.run({value:a,issues:[]},r),n=t.right._zod.run({value:a,issues:[]},r);return i instanceof Promise||n instanceof Promise?Promise.all([i,n]).then(([t,r])=>tG(e,t,r)):tG(e,i,n)}});function tG(e,t,r){let a,i=new Map;for(let r of t.issues)if("unrecognized_keys"===r.code)for(let e of(a??(a=r),r.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(r);for(let t of r.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let n=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(n.length&&a&&e.issues.push({...a,keys:n}),eI(e))return e;let o=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(eP(t)&&eP(r)){let a=Object.keys(r),i=Object.keys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};n[a]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};a.push(n.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let tW=A("$ZodRecord",(e,t)=>{ti.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!eP(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let n=[],o=t.keyType._zod.values;if(o){let s;r.value={};let l=new Set;for(let s of o)if("string"==typeof s||"number"==typeof s||"symbol"==typeof s){l.add("number"==typeof s?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},a);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>eA(e,a,D())),input:s,path:[s],inst:e});continue}let c=o.value,u=t.valueType._zod.run({value:i[s],issues:[]},a);u instanceof Promise?n.push(u.then(e=>{e.issues.length&&r.issues.push(...eq(s,e.issues)),r.value[c]=e.value})):(u.issues.length&&r.issues.push(...eq(s,u.issues)),r.value[c]=u.value)}for(let e in i)l.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},a);if(s instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof o&&eu.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},a);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(s=e)}if(s.issues.length){"loose"===t.mode?r.value[o]=i[o]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>eA(e,a,D())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},a);l instanceof Promise?n.push(l.then(e=>{e.issues.length&&r.issues.push(...eq(o,e.issues)),r.value[s.value]=e.value})):(l.issues.length&&r.issues.push(...eq(o,l.issues)),r.value[s.value]=l.value)}return n.length?Promise.all(n).then(()=>r):r}}),tY=A("$ZodEnum",(e,t)=>{ti.init(e,t);let r=ef(t.entries),a=new Set(r);e._zod.values=a,e._zod.pattern=RegExp(`^(${r.filter(e=>eT.has(typeof e)).map(e=>"string"==typeof e?ej(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let n=t.value;return a.has(n)||t.issues.push({code:"invalid_value",values:r,input:n,inst:e}),t}}),tX=A("$ZodLiteral",(e,t)=>{if(ti.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?ej(e):e?ej(e.toString()):String(e)).join("|")})$`),e._zod.parse=(a,i)=>{let n=a.value;return r.has(n)||a.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),a}}),tQ=A("$ZodTransform",(e,t)=>{ti.init(e,t),e._zod.optin="optional",e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new L(e.constructor.name);let i=t.transform(r.value,r);if(a.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r.fallback=!0,r));if(i instanceof Promise)throw new M;return r.value=i,r.fallback=!0,r}});function t0(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let t1=A("$ZodOptional",(e,t)=>{ti.init(e,t),e._zod.optin="optional",e._zod.optout="optional",eb(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),eb(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ev(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let a=e.value,i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>t0(e,a)):t0(i,a)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),t2=A("$ZodExactOptional",(e,t)=>{t1.init(e,t),eb(e._zod,"values",()=>t.innerType._zod.values),eb(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),t9=A("$ZodNullable",(e,t)=>{ti.init(e,t),eb(e._zod,"optin",()=>t.innerType._zod.optin),eb(e._zod,"optout",()=>t.innerType._zod.optout),eb(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ev(e.source)}|null)$`):void 0}),eb(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),t4=A("$ZodDefault",(e,t)=>{ti.init(e,t),e._zod.optin="optional",eb(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(e=>t6(e,t)):t6(a,t)}});function t6(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let t5=A("$ZodPrefault",(e,t)=>{ti.init(e,t),e._zod.optin="optional",eb(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),t3=A("$ZodNonOptional",(e,t)=>{ti.init(e,t),eb(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,a)=>{let i=t.innerType._zod.run(r,a);return i instanceof Promise?i.then(t=>t8(t,e)):t8(i,e)}});function t8(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let t7=A("$ZodCatch",(e,t)=>{ti.init(e,t),e._zod.optin="optional",eb(e._zod,"optout",()=>t.innerType._zod.optout),eb(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(a=>(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>eA(e,r,D()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>eA(e,r,D()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),re=A("$ZodPipe",(e,t)=>{ti.init(e,t),eb(e._zod,"values",()=>t.in._zod.values),eb(e._zod,"optin",()=>t.in._zod.optin),eb(e._zod,"optout",()=>t.out._zod.optout),eb(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let a=t.out._zod.run(e,r);return a instanceof Promise?a.then(e=>rt(e,t.in,r)):rt(a,t.in,r)}let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>rt(e,t.out,r)):rt(a,t.out,r)}});function rt(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}let rr=A("$ZodPreprocess",(e,t)=>{re.init(e,t)}),ra=A("$ZodReadonly",(e,t)=>{ti.init(e,t),eb(e._zod,"propValues",()=>t.innerType._zod.propValues),eb(e._zod,"values",()=>t.innerType._zod.values),eb(e._zod,"optin",()=>t.innerType?._zod?.optin),eb(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(ri):ri(a)}});function ri(e){return e.value=Object.freeze(e.value),e}let rn=A("$ZodLazy",(e,t)=>{ti.init(e,t),eb(e._zod,"innerType",()=>(t._cachedInner||(t._cachedInner=t.getter()),t._cachedInner)),eb(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),eb(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),eb(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),eb(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),ro=A("$ZodCustom",(e,t)=>{eZ.init(e,t),ti.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let a=r.value,i=t.fn(a);if(i instanceof Promise)return i.then(t=>rs(t,r,a,e));rs(i,r,a,e)}});function rs(e,t,r,a){if(!e){let e={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(e.params=a._zod.def.params),t.issues.push(eL(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(_=globalThis).__zod_globalRegistry??(_.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let a={...r,...this._map.get(e)};return Object.keys(a).length?a:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let rl=globalThis.__zod_globalRegistry;function rc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...eC(t)})}function ru(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...eC(t)})}function rd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...eC(t)})}function rp(e,t){return new eV({check:"less_than",...eC(t),value:e,inclusive:!1})}function rm(e,t){return new eV({check:"less_than",...eC(t),value:e,inclusive:!0})}function rh(e,t){return new eU({check:"greater_than",...eC(t),value:e,inclusive:!1})}function rf(e,t){return new eU({check:"greater_than",...eC(t),value:e,inclusive:!0})}function rg(e,t){return new eF({check:"multiple_of",...eC(t),value:e})}function ry(e,t){return new eJ({check:"max_length",...eC(t),maximum:e})}function rv(e,t){return new eK({check:"min_length",...eC(t),minimum:e})}function r_(e,t){return new eB({check:"length_equals",...eC(t),length:e})}function rb(e){return new e2({check:"overwrite",tx:e})}function rS(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??rl,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function r$(e,t,r={path:[],schemaPath:[]}){var a;let i=e._zod.def,n=t.seen.get(e);if(n)return n.count++,r.schemaPath.includes(e)&&(n.cycle=r.path),n.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let a={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,a);else{let r=o.schema,n=t.processors[i.type];if(!n)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);n(e,t,r,a)}let n=e._zod.parent;n&&(o.ref||(o.ref=n),r$(n,t,a),t.seen.get(n).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),"input"===t.io&&function e(t,r){let a=r??{seen:new Set};if(a.seen.has(t))return!1;a.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,a);if("set"===i.type)return e(i.valueType,a);if("lazy"===i.type)return e(i.getter(),a);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,a);if("intersection"===i.type)return e(i.left,a)||e(i.right,a);if("record"===i.type||"map"===i.type)return e(i.keyType,a)||e(i.valueType,a);if("pipe"===i.type)return!!t._zod.traits.has("$ZodCodec")||e(i.in,a)||e(i.out,a);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],a))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,a))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,a))return!0;if(i.rest&&e(i.rest,a))return!0}return!1}(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&"_prefault"in o.schema&&((a=o.schema).default??(a.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function rw(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=new Map;for(let t of e.seen.entries()){let r=e.metadataRegistry.get(t[0])?.id;if(r){let e=a.get(r);if(e&&e!==t[0])throw Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(r,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let a=t[1],{ref:i,defId:n}=(t=>{let a="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let r=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(r)return{ref:i(r)};let n=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=n,{defId:n,ref:`${i("__shared")}#/${a}/${n}`}}if(t[1]===r)return{ref:"#"};let i=`#/${a}/`,n=t[1].schema.id??`__schema${e.counter++}`;return{defId:n,ref:i+n}})(t);a.def={...a.schema},n&&(a.defId=n);let o=a.schema;for(let e in o)delete o[e];o.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
67
61
|
|
|
68
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let a=r[1];if(t===r[0]){i(r);continue}if(e.external){let a=e.external.registry.get(r[0])?.id;if(t!==r[0]&&a){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||a.cycle||a.count>1&&"ref"===e.reused){i(r);continue}}}function t0(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,s={...i},n=r.ref;if(r.ref=null,n){a(n);let r=e.seen.get(n),o=r.schema;if(o.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(o)):Object.assign(i,o),Object.assign(i,s),t._zod.parent===n)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in s||delete i[e]);if(o.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let o=t._zod.parent;if(o&&o!==n){a(o);let t=e.seen.get(o);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())a(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;void 0!==s&&i.id===s&&delete i.id;let n=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,n[e.defId]=e.def)}e.external||Object.keys(n).length>0&&("draft-2020-12"===e.target?i.$defs=n:i.definitions=n);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:t1(t,"input",e.processors),output:t1(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let t1=(e,t,r={})=>a=>{let{libraryOptions:i,target:s}=a??{},n=tY({...i??{},target:s,io:t,processors:r});return tQ(e,n),tX(n,e),t0(n,e)},t9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},t2=(e,t,r,a)=>{r.type="string";let{minimum:i,maximum:s,format:n,patterns:o,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof s&&(r.maxLength=s),n&&(r.format=t9[n]??n,""===r.format&&delete r.format,"time"===n&&delete r.format),l&&(r.contentEncoding=l),o&&o.size>0){let e=[...o];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},t4=(e,t,r,a)=>{let{minimum:i,maximum:s,format:n,multipleOf:o,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;"string"==typeof n&&n.includes("int")?r.type="integer":r.type="number";let d="number"==typeof u&&u>=(i??-1/0),c="number"==typeof l&&l<=(s??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(r.minimum=u,r.exclusiveMinimum=!0):r.exclusiveMinimum=u:"number"==typeof i&&(r.minimum=i),c?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof s&&(r.maximum=s),"number"==typeof o&&(r.multipleOf=o)},t6=(e,t,r,a)=>{r.type="boolean"},t8=(e,t,r,a)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},t5=(e,t,r,a)=>{r.not={}},t3=(e,t,r,a)=>{},t7=(e,t,r,a)=>{let i=M(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},re=(e,t,r,a)=>{let i=e._zod.def,s=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(e));else s.push(e);if(0===s.length);else if(1===s.length){let e=s[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else s.every(e=>"number"==typeof e)&&(r.type="number"),s.every(e=>"string"==typeof e)&&(r.type="string"),s.every(e=>"boolean"==typeof e)&&(r.type="boolean"),s.every(e=>null===e)&&(r.type="null"),r.enum=s},rt=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},rr=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},ra=(e,t,r,a)=>{let i=e._zod.def,{minimum:s,maximum:n}=e._zod.bag;"number"==typeof s&&(r.minItems=s),"number"==typeof n&&(r.maxItems=n),r.type="array",r.items=tQ(i.element,t,{...a,path:[...a.path,"items"]})},ri=(e,t,r,a)=>{let i=e._zod.def;r.type="object",r.properties={};let s=i.shape;for(let e in s)r.properties[e]=tQ(s[e],t,{...a,path:[...a.path,"properties",e]});let n=new Set([...new Set(Object.keys(s))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));n.size>0&&(r.required=Array.from(n)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=tQ(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},rs=(e,t,r,a)=>{let i=e._zod.def,s=!1===i.inclusive,n=i.options.map((e,r)=>tQ(e,t,{...a,path:[...a.path,s?"oneOf":"anyOf",r]}));s?r.oneOf=n:r.anyOf=n},rn=(e,t,r,a)=>{let i=e._zod.def,s=tQ(i.left,t,{...a,path:[...a.path,"allOf",0]}),n=tQ(i.right,t,{...a,path:[...a.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...o(s)?s.allOf:[s],...o(n)?n.allOf:[n]]},ro=(e,t,r,a)=>{let i=e._zod.def;r.type="object";let s=i.keyType,n=s._zod.bag,o=n?.patterns;if("loose"===i.mode&&o&&o.size>0){let e=tQ(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});for(let t of(r.patternProperties={},o))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=tQ(i.keyType,t,{...a,path:[...a.path,"propertyNames"]})),r.additionalProperties=tQ(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]});let l=s._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},rl=(e,t,r,a)=>{let i=e._zod.def,s=tQ(i.innerType,t,a),n=t.seen.get(e);"openapi-3.0"===t.target?(n.ref=i.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},ru=(e,t,r,a)=>{let i=e._zod.def;tQ(i.innerType,t,a),t.seen.get(e).ref=i.innerType},rd=(e,t,r,a)=>{let i=e._zod.def;tQ(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},rc=(e,t,r,a)=>{let i=e._zod.def;tQ(i.innerType,t,a),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},rp=(e,t,r,a)=>{let i,s=e._zod.def;tQ(s.innerType,t,a),t.seen.get(e).ref=s.innerType;try{i=s.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},rf=(e,t,r,a)=>{let i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),n="input"===t.io?s?i.out:i.in:i.out;tQ(n,t,a),t.seen.get(e).ref=n},rh=(e,t,r,a)=>{let i=e._zod.def;tQ(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.readOnly=!0},rm=(e,t,r,a)=>{let i=e._zod.def;tQ(i.innerType,t,a),t.seen.get(e).ref=i.innerType},ry={string:t2,number:t4,boolean:t6,bigint:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},symbol:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},null:t8,undefined:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},void:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},never:t5,any:(e,t,r,a)=>{},unknown:t3,date:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},enum:t7,literal:re,nan:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},template_literal:(e,t,r,a)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},file:(e,t,r,a)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:n,mime:o}=e._zod.bag;void 0!==s&&(i.minLength=s),void 0!==n&&(i.maxLength=n),o?1===o.length?(i.contentMediaType=o[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=o.map(e=>({contentMediaType:e}))):Object.assign(r,i)},success:(e,t,r,a)=>{r.type="boolean"},custom:rt,function:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},transform:rr,map:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},set:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},array:ra,object:ri,union:rs,intersection:rn,tuple:(e,t,r,a)=>{let i=e._zod.def;r.type="array";let s="draft-2020-12"===t.target?"prefixItems":"items",n="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",o=i.items.map((e,r)=>tQ(e,t,{...a,path:[...a.path,s,r]})),l=i.rest?tQ(i.rest,t,{...a,path:[...a.path,n,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=o,l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:o},l&&r.items.anyOf.push(l),r.minItems=o.length,l||(r.maxItems=o.length)):(r.items=o,l&&(r.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;"number"==typeof u&&(r.minItems=u),"number"==typeof d&&(r.maxItems=d)},record:ro,nullable:rl,nonoptional:ru,default:rd,prefault:rc,catch:rp,pipe:rf,readonly:rh,promise:(e,t,r,a)=>{let i=e._zod.def;tQ(i.innerType,t,a),t.seen.get(e).ref=i.innerType},optional:rm,lazy:(e,t,r,a)=>{let i=e._zod.innerType;tQ(i,t,a),t.seen.get(e).ref=i}},rg=s("ZodISODateTime",(e,t)=>{eQ.init(e,t),rF.init(e,t)});function rv(e){return new rg({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ee(e)})}let r_=s("ZodISODate",(e,t)=>{eX.init(e,t),rF.init(e,t)}),rb=s("ZodISOTime",(e,t)=>{e0.init(e,t),rF.init(e,t)}),rw=s("ZodISODuration",(e,t)=>{e1.init(e,t),rF.init(e,t)}),r$=s("ZodError",(e,t)=>{eT.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},a=(e,i=[])=>{for(let s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>a({issues:e},[...i,...s.path]));else if("invalid_key"===s.code)a({issues:s.issues},[...i,...s.path]);else if("invalid_element"===s.code)a({issues:s.issues},[...i,...s.path]);else{let e=[...i,...s.path];if(0===e.length)r._errors.push(t(s));else{let a=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(a[r]=a[r]||{_errors:[]},a[r]._errors.push(t(s))):a[r]=a[r]||{_errors:[]},a=a[r],i++}}}};return a(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},a=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Z,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Z,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),rk=eO(r$),rx=eN(r$),rS=eI(r$),rE=eC(r$),rT=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return eO(r$)(e,t,a)},rP=(e,t,r)=>eO(r$)(e,t,r),rO=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return eN(r$)(e,t,a)},rj=async(e,t,r)=>eN(r$)(e,t,r),rN=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return eI(r$)(e,t,a)},rz=(e,t,r)=>eI(r$)(e,t,r),rI=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return eC(r$)(e,t,a)},rR=async(e,t,r)=>eC(r$)(e,t,r),rC=new WeakMap;function rA(e,t,r){let a=Object.getPrototypeOf(e),i=rC.get(a);if(i||(i=new Set,rC.set(a,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(a,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let rM=s("ZodType",(e,t)=>(eZ.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:t1(e,"input"),output:t1(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let a=tY({...r,processors:t});return tQ(e,a),tX(a,e),t0(a,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>rk(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>rS(e,t,r),e.parseAsync=async(t,r)=>rx(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>rE(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>rT(e,t,r),e.decode=(t,r)=>rP(e,t,r),e.encodeAsync=async(t,r)=>rO(e,t,r),e.decodeAsync=async(t,r)=>rj(e,t,r),e.safeEncode=(t,r)=>rN(e,t,r),e.safeDecode=(t,r)=>rz(e,t,r),e.safeEncodeAsync=async(t,r)=>rI(e,t,r),e.safeDecodeAsync=async(t,r)=>rR(e,t,r),rA(e,"ZodType",{check(...e){let t=this.def;return this.clone(U(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return X(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new aD({type:"custom",check:"custom",fn:e,...ee(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let a,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eo(e,t.value,a._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=a),e.continue??(e.continue=!a._zod.def.abort),t.issues.push(eo(e)))},e(t.value,t)),(i=new el({check:"custom",...ee(t)}))._zod.check=r,a=i}(e,t))},overwrite(e){return this.check(tW(e))},optional(){return aP(this)},exactOptional(){var e;return e=this,new aO({type:"optional",innerType:e})},nullable(){return aN(this)},nullish(){return aP(aN(this))},nonoptional(e){var t;return t=this,new aR({type:"nonoptional",innerType:t,...ee(e)})},array(){return au(this)},or(e){return ah([this,e])},and(e){return av(this,e)},transform(e){return aM(this,aE(e))},default(e){var t,r;return t=this,r=e,new az({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():W(r)}})},prefault(e){var t,r;return t=this,r=e,new aI({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():W(r)}})},catch(e){var t,r;return t=this,new aC({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return aM(this,e)},readonly(){var e;return e=this,new aq({type:"readonly",innerType:e})},describe(e){let t=this.clone();return tD.add(t,{description:e}),t},meta(...e){if(0===e.length)return tD.get(this);let t=this.clone();return tD.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>tD.get(e)?.description,configurable:!0}),e)),rZ=s("_ZodString",(e,t)=>{eq.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>t2(e,t,r,a);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,rA(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new ev({check:"string_format",format:"regex",...ee(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new ew({check:"string_format",format:"includes",...ee(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new e$({check:"string_format",format:"starts_with",...ee(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new ek({check:"string_format",format:"ends_with",...ee(t),suffix:e})}(...e))},min(...e){return this.check(tB(...e))},max(...e){return this.check(tK(...e))},length(...e){return this.check(tG(...e))},nonempty(...e){return this.check(tB(1,...e))},lowercase(e){return this.check(new e_({check:"string_format",format:"lowercase",...ee(e)}))},uppercase(e){return this.check(new eb({check:"string_format",format:"uppercase",...ee(e)}))},trim(){return this.check(tW(e=>e.trim()))},normalize(...e){return this.check(function(e){return tW(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(tW(e=>e.toLowerCase()))},toUpperCase(){return this.check(tW(e=>e.toUpperCase()))},slugify(){return this.check(tW(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),rq=s("ZodString",(e,t)=>{eq.init(e,t),rZ.init(e,t),e.email=t=>e.check(new rL({type:"string",format:"email",check:"string_format",abort:!1,...ee(t)})),e.url=t=>e.check(new rH({type:"string",format:"url",check:"string_format",abort:!1,...ee(t)})),e.jwt=t=>e.check(new r8({type:"string",format:"jwt",check:"string_format",abort:!1,...ee(t)})),e.emoji=t=>e.check(new rJ({type:"string",format:"emoji",check:"string_format",abort:!1,...ee(t)})),e.guid=t=>e.check(tF(rV,t)),e.uuid=t=>e.check(new rU({type:"string",format:"uuid",check:"string_format",abort:!1,...ee(t)})),e.uuidv4=t=>e.check(new rU({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ee(t)})),e.uuidv6=t=>e.check(new rU({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ee(t)})),e.uuidv7=t=>e.check(new rU({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ee(t)})),e.nanoid=t=>e.check(new rK({type:"string",format:"nanoid",check:"string_format",abort:!1,...ee(t)})),e.guid=t=>e.check(tF(rV,t)),e.cuid=t=>e.check(new rB({type:"string",format:"cuid",check:"string_format",abort:!1,...ee(t)})),e.cuid2=t=>e.check(new rG({type:"string",format:"cuid2",check:"string_format",abort:!1,...ee(t)})),e.ulid=t=>e.check(new rW({type:"string",format:"ulid",check:"string_format",abort:!1,...ee(t)})),e.base64=t=>e.check(new r2({type:"string",format:"base64",check:"string_format",abort:!1,...ee(t)})),e.base64url=t=>e.check(new r4({type:"string",format:"base64url",check:"string_format",abort:!1,...ee(t)})),e.xid=t=>e.check(new rY({type:"string",format:"xid",check:"string_format",abort:!1,...ee(t)})),e.ksuid=t=>e.check(new rQ({type:"string",format:"ksuid",check:"string_format",abort:!1,...ee(t)})),e.ipv4=t=>e.check(new rX({type:"string",format:"ipv4",check:"string_format",abort:!1,...ee(t)})),e.ipv6=t=>e.check(new r0({type:"string",format:"ipv6",check:"string_format",abort:!1,...ee(t)})),e.cidrv4=t=>e.check(new r1({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ee(t)})),e.cidrv6=t=>e.check(new r9({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ee(t)})),e.e164=t=>e.check(new r6({type:"string",format:"e164",check:"string_format",abort:!1,...ee(t)})),e.datetime=t=>e.check(rv(t)),e.date=t=>e.check(new r_({type:"string",format:"date",check:"string_format",...ee(t)})),e.time=t=>e.check(new rb({type:"string",format:"time",check:"string_format",precision:null,...ee(t)})),e.duration=t=>e.check(new rw({type:"string",format:"duration",check:"string_format",...ee(t)}))});function rD(e){return new rq({type:"string",...ee(e)})}let rF=s("ZodStringFormat",(e,t)=>{eD.init(e,t),rZ.init(e,t)}),rL=s("ZodEmail",(e,t)=>{eV.init(e,t),rF.init(e,t)}),rV=s("ZodGUID",(e,t)=>{eF.init(e,t),rF.init(e,t)}),rU=s("ZodUUID",(e,t)=>{eL.init(e,t),rF.init(e,t)}),rH=s("ZodURL",(e,t)=>{eU.init(e,t),rF.init(e,t)}),rJ=s("ZodEmoji",(e,t)=>{eH.init(e,t),rF.init(e,t)}),rK=s("ZodNanoID",(e,t)=>{eJ.init(e,t),rF.init(e,t)}),rB=s("ZodCUID",(e,t)=>{eK.init(e,t),rF.init(e,t)}),rG=s("ZodCUID2",(e,t)=>{eB.init(e,t),rF.init(e,t)}),rW=s("ZodULID",(e,t)=>{eG.init(e,t),rF.init(e,t)}),rY=s("ZodXID",(e,t)=>{eW.init(e,t),rF.init(e,t)}),rQ=s("ZodKSUID",(e,t)=>{eY.init(e,t),rF.init(e,t)}),rX=s("ZodIPv4",(e,t)=>{e9.init(e,t),rF.init(e,t)}),r0=s("ZodIPv6",(e,t)=>{e2.init(e,t),rF.init(e,t)}),r1=s("ZodCIDRv4",(e,t)=>{e4.init(e,t),rF.init(e,t)}),r9=s("ZodCIDRv6",(e,t)=>{e6.init(e,t),rF.init(e,t)}),r2=s("ZodBase64",(e,t)=>{e5.init(e,t),rF.init(e,t)}),r4=s("ZodBase64URL",(e,t)=>{e3.init(e,t),rF.init(e,t)}),r6=s("ZodE164",(e,t)=>{e7.init(e,t),rF.init(e,t)}),r8=s("ZodJWT",(e,t)=>{te.init(e,t),rF.init(e,t)}),r5=s("ZodNumber",(e,t)=>{tt.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>t4(e,t,r,a),rA(e,"ZodNumber",{gt(e,t){return this.check(tU(e,t))},gte(e,t){return this.check(tH(e,t))},min(e,t){return this.check(tH(e,t))},lt(e,t){return this.check(tL(e,t))},lte(e,t){return this.check(tV(e,t))},max(e,t){return this.check(tV(e,t))},int(e){return this.check(ae(e))},safe(e){return this.check(ae(e))},positive(e){return this.check(tU(0,e))},nonnegative(e){return this.check(tH(0,e))},negative(e){return this.check(tL(0,e))},nonpositive(e){return this.check(tV(0,e))},multipleOf(e,t){return this.check(tJ(e,t))},step(e,t){return this.check(tJ(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function r3(e){return new r5({type:"number",checks:[],...ee(e)})}let r7=s("ZodNumberFormat",(e,t)=>{tr.init(e,t),r5.init(e,t)});function ae(e){return new r7({type:"number",check:"number_format",abort:!1,format:"safeint",...ee(e)})}let at=s("ZodBoolean",(e,t)=>{ta.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>t6(e,t,r,a)});function ar(e){return new at({type:"boolean",...ee(e)})}let aa=s("ZodNull",(e,t)=>{ti.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>t8(e,t,r,a)});function ai(e){return new aa({type:"null",...ee(e)})}let as=s("ZodUnknown",(e,t)=>{ts.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>t3(e,t,r,a)});function an(){return new as({type:"unknown"})}let ao=s("ZodNever",(e,t)=>{tn.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>t5(e,t,r,a)}),al=s("ZodArray",(e,t)=>{tl.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>ra(e,t,r,a),e.element=t.element,rA(e,"ZodArray",{min(e,t){return this.check(tB(e,t))},nonempty(e){return this.check(tB(1,e))},max(e,t){return this.check(tK(e,t))},length(e,t){return this.check(tG(e,t))},unwrap(){return this.element}})});function au(e,t){return new al({type:"array",element:e,...ee(t)})}let ad=s("ZodObject",(e,t)=>{tf.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>ri(e,t,r,a),L(e,"shape",()=>t.shape),rA(e,"ZodObject",{keyof(){return a$(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:an()})},loose(){return this.clone({...this._zod.def,catchall:an()})},strict(){return this.clone({...this._zod.def,catchall:new ao({type:"never",...ee(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!G(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let a=U(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return V(this,"shape",r),r}});return X(e,a)}(this,e)},safeExtend(e){var t=this;if(!G(e))throw Error("Invalid input to safeExtend: expected a plain object");let r=U(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e};return V(this,"shape",r),r}});return X(t,r)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=U(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return V(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return X(t,r)},pick(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=U(e._zod.def,{get shape(){let e={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);t[a]&&(e[a]=r.shape[a])}return V(this,"shape",e),e},checks:[]});return X(e,i)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=U(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete a[e]}return V(this,"shape",a),a},checks:[]});return X(e,i)}(this,e)},partial(...e){return function(e,t,r){let a=t._zod.def.checks;if(a&&a.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=U(t._zod.def,{get shape(){let a=t._zod.def.shape,i={...a};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:a[t]}):a[t])}else for(let t in a)i[t]=e?new e({type:"optional",innerType:a[t]}):a[t];return V(this,"shape",i),i},checks:[]});return X(t,i)}(aT,this,e[0])},required(...e){var t,r;let a;return t=this,r=e[0],a=U(t._zod.def,{get shape(){let e=t._zod.def.shape,a={...e};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new aR({type:"nonoptional",innerType:e[t]}))}else for(let t in e)a[t]=new aR({type:"nonoptional",innerType:e[t]});return V(this,"shape",a),a}}),X(t,a)}})});function ac(e,t){return new ad({type:"object",shape:e??{},...ee(t)})}function ap(e,t){return new ad({type:"object",shape:e,catchall:an(),...ee(t)})}let af=s("ZodUnion",(e,t)=>{tm.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rs(e,t,r,a),e.options=t.options});function ah(e,t){return new af({type:"union",options:e,...ee(t)})}let am=s("ZodDiscriminatedUnion",(e,t)=>{af.init(e,t),ty.init(e,t)});function ay(e,t,r){return new am({type:"union",options:t,discriminator:e,...ee(r)})}let ag=s("ZodIntersection",(e,t)=>{tg.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rn(e,t,r,a)});function av(e,t){return new ag({type:"intersection",left:e,right:t})}let a_=s("ZodRecord",(e,t)=>{t_.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>ro(e,t,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function ab(e,t,r){return new a_(t&&t._zod?{type:"record",keyType:e,valueType:t,...ee(r)}:{type:"record",keyType:rD(),valueType:e,...ee(t)})}let aw=s("ZodEnum",(e,t)=>{tb.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>t7(e,t,r,a),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,a)=>{let i={};for(let a of e)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new aw({...t,checks:[],...ee(a),entries:i})},e.exclude=(e,a)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new aw({...t,checks:[],...ee(a),entries:i})}});function a$(e,t){return new aw({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...ee(t)})}let ak=s("ZodLiteral",(e,t)=>{tw.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>re(e,t,r,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ax(e,t){return new ak({type:"literal",values:Array.isArray(e)?e:[e],...ee(t)})}let aS=s("ZodTransform",(e,t)=>{t$.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rr(e,t,r,a),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new o(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(eo(a,r.value,t)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(eo(a)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function aE(e){return new aS({type:"transform",transform:e})}let aT=s("ZodOptional",(e,t)=>{tx.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rm(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function aP(e){return new aT({type:"optional",innerType:e})}let aO=s("ZodExactOptional",(e,t)=>{tS.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rm(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),aj=s("ZodNullable",(e,t)=>{tE.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rl(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function aN(e){return new aj({type:"nullable",innerType:e})}let az=s("ZodDefault",(e,t)=>{tT.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rd(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),aI=s("ZodPrefault",(e,t)=>{tO.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rc(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),aR=s("ZodNonOptional",(e,t)=>{tj.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>ru(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),aC=s("ZodCatch",(e,t)=>{tz.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rp(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),aA=s("ZodPipe",(e,t)=>{tI.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rf(e,t,r,a),e.in=t.in,e.out=t.out});function aM(e,t){return new aA({type:"pipe",in:e,out:t})}let aZ=s("ZodPreprocess",(e,t)=>{aA.init(e,t),tC.init(e,t)}),aq=s("ZodReadonly",(e,t)=>{tA.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rh(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),aD=s("ZodCustom",(e,t)=>{tZ.init(e,t),rM.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rt(e,t,r,a)});function aF(e,t){return new aZ({type:"pipe",in:aE(e),out:t})}let aL="2025-11-25",aV=[aL,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],aU="io.modelcontextprotocol/related-task",aH=(o1=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),(t=ee(void 0)).abort??(t.abort=!0),new aD({type:"custom",check:"custom",fn:o1,...t})),aJ=ah([rD(),r3().int()]),aK=rD();ap({ttl:ah([r3(),ai()]).optional(),pollInterval:r3().optional()});let aB=ac({ttl:r3().optional()}),aG=ac({taskId:rD()}),aW=ap({progressToken:aJ.optional(),[aU]:aG.optional()}),aY=ac({_meta:aW.optional()}),aQ=aY.extend({task:aB.optional()}),aX=ac({method:rD(),params:aY.loose().optional()}),a0=ac({_meta:aW.optional()}),a1=ac({method:rD(),params:a0.loose().optional()}),a9=ap({_meta:aW.optional()}),a2=ah([rD(),r3().int()]),a4=ac({jsonrpc:ax("2.0"),id:a2,...aX.shape}).strict(),a6=e=>a4.safeParse(e).success,a8=ac({jsonrpc:ax("2.0"),...a1.shape}).strict(),a5=ac({jsonrpc:ax("2.0"),id:a2,result:a9}).strict();(o9=o3||(o3={}))[o9.ConnectionClosed=-32e3]="ConnectionClosed",o9[o9.RequestTimeout=-32001]="RequestTimeout",o9[o9.ParseError=-32700]="ParseError",o9[o9.InvalidRequest=-32600]="InvalidRequest",o9[o9.MethodNotFound=-32601]="MethodNotFound",o9[o9.InvalidParams=-32602]="InvalidParams",o9[o9.InternalError=-32603]="InternalError",o9[o9.UrlElicitationRequired=-32042]="UrlElicitationRequired";let a3=ac({jsonrpc:ax("2.0"),id:a2.optional(),error:ac({code:r3().int(),message:rD(),data:an().optional()})}).strict(),a7=ah([a4,a8,a5,a3]);ah([a5,a3]);let ie=a9.strict(),it=a0.extend({requestId:a2.optional(),reason:rD().optional()}),ir=a1.extend({method:ax("notifications/cancelled"),params:it}),ia=ac({src:rD(),mimeType:rD().optional(),sizes:au(rD()).optional(),theme:a$(["light","dark"]).optional()}),ii=ac({icons:au(ia).optional()}),is=ac({name:rD(),title:rD().optional()}),io=is.extend({...is.shape,...ii.shape,version:rD(),websiteUrl:rD().optional(),description:rD().optional()}),il=av(ac({applyDefaults:ar().optional()}),ab(rD(),an())),iu=aF(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,av(ac({form:il.optional(),url:aH.optional()}),ab(rD(),an()).optional())),id=ap({list:aH.optional(),cancel:aH.optional(),requests:ap({sampling:ap({createMessage:aH.optional()}).optional(),elicitation:ap({create:aH.optional()}).optional()}).optional()}),ic=ap({list:aH.optional(),cancel:aH.optional(),requests:ap({tools:ap({call:aH.optional()}).optional()}).optional()}),ip=ac({experimental:ab(rD(),aH).optional(),sampling:ac({context:aH.optional(),tools:aH.optional()}).optional(),elicitation:iu.optional(),roots:ac({listChanged:ar().optional()}).optional(),tasks:id.optional()}),ih=aY.extend({protocolVersion:rD(),capabilities:ip,clientInfo:io}),im=aX.extend({method:ax("initialize"),params:ih}),iy=ac({experimental:ab(rD(),aH).optional(),logging:aH.optional(),completions:aH.optional(),prompts:ac({listChanged:ar().optional()}).optional(),resources:ac({subscribe:ar().optional(),listChanged:ar().optional()}).optional(),tools:ac({listChanged:ar().optional()}).optional(),tasks:ic.optional()}),ig=a9.extend({protocolVersion:rD(),capabilities:iy,serverInfo:io,instructions:rD().optional()}),iv=a1.extend({method:ax("notifications/initialized"),params:a0.optional()}),i_=aX.extend({method:ax("ping"),params:aY.optional()}),ib=ac({progress:r3(),total:aP(r3()),message:aP(rD())}),iw=ac({...a0.shape,...ib.shape,progressToken:aJ}),i$=a1.extend({method:ax("notifications/progress"),params:iw}),ik=aY.extend({cursor:aK.optional()}),ix=aX.extend({params:ik.optional()}),iS=a9.extend({nextCursor:aK.optional()}),iE=a$(["working","input_required","completed","failed","cancelled"]),iT=ac({taskId:rD(),status:iE,ttl:ah([r3(),ai()]),createdAt:rD(),lastUpdatedAt:rD(),pollInterval:aP(r3()),statusMessage:aP(rD())}),iP=a9.extend({task:iT}),iO=a0.merge(iT),ij=a1.extend({method:ax("notifications/tasks/status"),params:iO}),iN=aX.extend({method:ax("tasks/get"),params:aY.extend({taskId:rD()})}),iz=a9.merge(iT),iI=aX.extend({method:ax("tasks/result"),params:aY.extend({taskId:rD()})});a9.loose();let iR=ix.extend({method:ax("tasks/list")}),iC=iS.extend({tasks:au(iT)}),iA=aX.extend({method:ax("tasks/cancel"),params:aY.extend({taskId:rD()})}),iM=a9.merge(iT),iZ=ac({uri:rD(),mimeType:aP(rD()),_meta:ab(rD(),an()).optional()}),iq=iZ.extend({text:rD()}),iD=rD().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),iF=iZ.extend({blob:iD}),iL=a$(["user","assistant"]),iV=ac({audience:au(iL).optional(),priority:r3().min(0).max(1).optional(),lastModified:rv({offset:!0}).optional()}),iU=ac({...is.shape,...ii.shape,uri:rD(),description:aP(rD()),mimeType:aP(rD()),annotations:iV.optional(),_meta:aP(ap({}))}),iH=ac({...is.shape,...ii.shape,uriTemplate:rD(),description:aP(rD()),mimeType:aP(rD()),annotations:iV.optional(),_meta:aP(ap({}))}),iJ=ix.extend({method:ax("resources/list")}),iK=iS.extend({resources:au(iU)}),iB=ix.extend({method:ax("resources/templates/list")}),iG=iS.extend({resourceTemplates:au(iH)}),iW=aY.extend({uri:rD()}),iY=aX.extend({method:ax("resources/read"),params:iW}),iQ=a9.extend({contents:au(ah([iq,iF]))}),iX=a1.extend({method:ax("notifications/resources/list_changed"),params:a0.optional()}),i0=aX.extend({method:ax("resources/subscribe"),params:iW}),i1=aX.extend({method:ax("resources/unsubscribe"),params:iW}),i9=a0.extend({uri:rD()}),i2=a1.extend({method:ax("notifications/resources/updated"),params:i9}),i4=ac({name:rD(),description:aP(rD()),required:aP(ar())}),i6=ac({...is.shape,...ii.shape,description:aP(rD()),arguments:aP(au(i4)),_meta:aP(ap({}))}),i8=ix.extend({method:ax("prompts/list")}),i5=iS.extend({prompts:au(i6)}),i3=aY.extend({name:rD(),arguments:ab(rD(),rD()).optional()}),i7=aX.extend({method:ax("prompts/get"),params:i3}),se=ac({type:ax("text"),text:rD(),annotations:iV.optional(),_meta:ab(rD(),an()).optional()}),st=ac({type:ax("image"),data:iD,mimeType:rD(),annotations:iV.optional(),_meta:ab(rD(),an()).optional()}),sr=ac({type:ax("audio"),data:iD,mimeType:rD(),annotations:iV.optional(),_meta:ab(rD(),an()).optional()}),sa=ac({type:ax("tool_use"),name:rD(),id:rD(),input:ab(rD(),an()),_meta:ab(rD(),an()).optional()}),si=ac({type:ax("resource"),resource:ah([iq,iF]),annotations:iV.optional(),_meta:ab(rD(),an()).optional()}),ss=ah([se,st,sr,iU.extend({type:ax("resource_link")}),si]),sn=ac({role:iL,content:ss}),so=a9.extend({description:rD().optional(),messages:au(sn)}),sl=a1.extend({method:ax("notifications/prompts/list_changed"),params:a0.optional()}),su=ac({title:rD().optional(),readOnlyHint:ar().optional(),destructiveHint:ar().optional(),idempotentHint:ar().optional(),openWorldHint:ar().optional()}),sd=ac({taskSupport:a$(["required","optional","forbidden"]).optional()}),sc=ac({...is.shape,...ii.shape,description:rD().optional(),inputSchema:ac({type:ax("object"),properties:ab(rD(),aH).optional(),required:au(rD()).optional()}).catchall(an()),outputSchema:ac({type:ax("object"),properties:ab(rD(),aH).optional(),required:au(rD()).optional()}).catchall(an()).optional(),annotations:su.optional(),execution:sd.optional(),_meta:ab(rD(),an()).optional()}),sp=ix.extend({method:ax("tools/list")}),sf=iS.extend({tools:au(sc)}),sh=a9.extend({content:au(ss).default([]),structuredContent:ab(rD(),an()).optional(),isError:ar().optional()});sh.or(a9.extend({toolResult:an()}));let sm=aQ.extend({name:rD(),arguments:ab(rD(),an()).optional()}),sy=aX.extend({method:ax("tools/call"),params:sm}),sg=a1.extend({method:ax("notifications/tools/list_changed"),params:a0.optional()});ac({autoRefresh:ar().default(!0),debounceMs:r3().int().nonnegative().default(300)});let sv=a$(["debug","info","notice","warning","error","critical","alert","emergency"]),s_=aY.extend({level:sv}),sb=aX.extend({method:ax("logging/setLevel"),params:s_}),sw=a0.extend({level:sv,logger:rD().optional(),data:an()}),s$=a1.extend({method:ax("notifications/message"),params:sw}),sk=ac({name:rD().optional()}),sx=ac({hints:au(sk).optional(),costPriority:r3().min(0).max(1).optional(),speedPriority:r3().min(0).max(1).optional(),intelligencePriority:r3().min(0).max(1).optional()}),sS=ac({mode:a$(["auto","required","none"]).optional()}),sE=ac({type:ax("tool_result"),toolUseId:rD().describe("The unique identifier for the corresponding tool call."),content:au(ss).default([]),structuredContent:ac({}).loose().optional(),isError:ar().optional(),_meta:ab(rD(),an()).optional()}),sT=ay("type",[se,st,sr]),sP=ay("type",[se,st,sr,sa,sE]),sO=ac({role:iL,content:ah([sP,au(sP)]),_meta:ab(rD(),an()).optional()}),sj=aQ.extend({messages:au(sO),modelPreferences:sx.optional(),systemPrompt:rD().optional(),includeContext:a$(["none","thisServer","allServers"]).optional(),temperature:r3().optional(),maxTokens:r3().int(),stopSequences:au(rD()).optional(),metadata:aH.optional(),tools:au(sc).optional(),toolChoice:sS.optional()}),sN=aX.extend({method:ax("sampling/createMessage"),params:sj}),sz=a9.extend({model:rD(),stopReason:aP(a$(["endTurn","stopSequence","maxTokens"]).or(rD())),role:iL,content:sT}),sI=a9.extend({model:rD(),stopReason:aP(a$(["endTurn","stopSequence","maxTokens","toolUse"]).or(rD())),role:iL,content:ah([sP,au(sP)])}),sR=ac({type:ax("boolean"),title:rD().optional(),description:rD().optional(),default:ar().optional()}),sC=ac({type:ax("string"),title:rD().optional(),description:rD().optional(),minLength:r3().optional(),maxLength:r3().optional(),format:a$(["email","uri","date","date-time"]).optional(),default:rD().optional()}),sA=ac({type:a$(["number","integer"]),title:rD().optional(),description:rD().optional(),minimum:r3().optional(),maximum:r3().optional(),default:r3().optional()}),sM=ac({type:ax("string"),title:rD().optional(),description:rD().optional(),enum:au(rD()),default:rD().optional()}),sZ=ac({type:ax("string"),title:rD().optional(),description:rD().optional(),oneOf:au(ac({const:rD(),title:rD()})),default:rD().optional()}),sq=ac({type:ax("string"),title:rD().optional(),description:rD().optional(),enum:au(rD()),enumNames:au(rD()).optional(),default:rD().optional()}),sD=ah([sM,sZ]),sF=ah([ac({type:ax("array"),title:rD().optional(),description:rD().optional(),minItems:r3().optional(),maxItems:r3().optional(),items:ac({type:ax("string"),enum:au(rD())}),default:au(rD()).optional()}),ac({type:ax("array"),title:rD().optional(),description:rD().optional(),minItems:r3().optional(),maxItems:r3().optional(),items:ac({anyOf:au(ac({const:rD(),title:rD()}))}),default:au(rD()).optional()})]),sL=ah([sq,sD,sF]),sV=ah([sL,sR,sC,sA]),sU=aQ.extend({mode:ax("form").optional(),message:rD(),requestedSchema:ac({type:ax("object"),properties:ab(rD(),sV),required:au(rD()).optional()})}),sH=aQ.extend({mode:ax("url"),message:rD(),elicitationId:rD(),url:rD().url()}),sJ=ah([sU,sH]),sK=aX.extend({method:ax("elicitation/create"),params:sJ}),sB=a0.extend({elicitationId:rD()}),sG=a1.extend({method:ax("notifications/elicitation/complete"),params:sB}),sW=a9.extend({action:a$(["accept","decline","cancel"]),content:aF(e=>null===e?void 0:e,ab(rD(),ah([rD(),r3(),ar(),au(rD())])).optional())}),sY=ac({type:ax("ref/resource"),uri:rD()}),sQ=ac({type:ax("ref/prompt"),name:rD()}),sX=aY.extend({ref:ah([sQ,sY]),argument:ac({name:rD(),value:rD()}),context:ac({arguments:ab(rD(),rD()).optional()}).optional()}),s0=aX.extend({method:ax("completion/complete"),params:sX}),s1=a9.extend({completion:ap({values:au(rD()).max(100),total:aP(r3().int()),hasMore:aP(ar())})}),s9=ac({uri:rD().startsWith("file://"),name:rD().optional(),_meta:ab(rD(),an()).optional()}),s2=aX.extend({method:ax("roots/list"),params:aY.optional()}),s4=a9.extend({roots:au(s9)}),s6=a1.extend({method:ax("notifications/roots/list_changed"),params:a0.optional()});ah([i_,im,s0,sb,i7,i8,iJ,iB,iY,i0,i1,sy,sp,iN,iI,iR,iA]),ah([ir,i$,iv,s6,ij]),ah([ie,sz,sI,sW,s4,iz,iC,iP]),ah([i_,sN,sK,s2,iN,iI,iR,iA]),ah([ir,i$,s$,i2,iX,sg,sl,ij,sG]),ah([ie,ig,s1,so,i5,iK,iG,iQ,sh,sf,iz,iC,iP]);class s8 extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){return e===o3.UrlElicitationRequired&&r&&r.elicitations?new s5(r.elicitations,t):new s8(e,t,r)}}class s5 extends s8{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(o3.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}class s3{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){var e;if(!this._buffer)return null;let t=this._buffer.indexOf("\n");if(-1===t)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),e=r,a7.parse(JSON.parse(e))}clear(){this._buffer=void 0}}class s7{constructor(e=i.stdin,t=i.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new s3,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let r=JSON.stringify(e)+"\n";this._stdout.write(r)?t():this._stdout.once("drain",t)})}}(o2=o7||(o7={})).assertEqual=e=>{},o2.assertIs=function(e){},o2.assertNever=function(e){throw Error()},o2.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},o2.getValidEnumValues=e=>{let t=o2.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return o2.objectValues(r)},o2.objectValues=e=>o2.objectKeys(e).map(function(t){return e[t]}),o2.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},o2.find=(e,t)=>{for(let r of e)if(t(r))return r},o2.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,o2.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},o2.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(le||(le={})).mergeShapes=(e,t)=>({...e,...t});let ne=o7.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=e=>{switch(typeof e){case"undefined":return ne.undefined;case"string":return ne.string;case"number":return Number.isNaN(e)?ne.nan:ne.number;case"boolean":return ne.boolean;case"function":return ne.function;case"bigint":return ne.bigint;case"symbol":return ne.symbol;case"object":if(Array.isArray(e))return ne.array;if(null===e)return ne.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return ne.promise;if("undefined"!=typeof Map&&e instanceof Map)return ne.map;if("undefined"!=typeof Set&&e instanceof Set)return ne.set;if("undefined"!=typeof Date&&e instanceof Date)return ne.date;return ne.object;default:return ne.unknown}},nr=o7.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class na extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,a=0;for(;a<i.path.length;){let r=i.path[a];a===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof na))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,o7.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}na.create=e=>new na(e);let ni=(e,t)=>{let r;switch(e.code){case nr.invalid_type:r=e.received===ne.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case nr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,o7.jsonStringifyReplacer)}`;break;case nr.unrecognized_keys:r=`Unrecognized key(s) in object: ${o7.joinValues(e.keys,", ")}`;break;case nr.invalid_union:r="Invalid input";break;case nr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${o7.joinValues(e.options)}`;break;case nr.invalid_enum_value:r=`Invalid enum value. Expected ${o7.joinValues(e.options)}, received '${e.received}'`;break;case nr.invalid_arguments:r="Invalid function arguments";break;case nr.invalid_return_type:r="Invalid function return type";break;case nr.invalid_date:r="Invalid date";break;case nr.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:o7.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case nr.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case nr.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case nr.custom:r="Invalid input";break;case nr.invalid_intersection_types:r="Intersection results could not be merged";break;case nr.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case nr.not_finite:r="Number must be finite";break;default:r=t.defaultError,o7.assertNever(e)}return{message:r}};(o4=lt||(lt={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},o4.toString=e=>"string"==typeof e?e:e?.message;let ns=e=>{let{data:t,path:r,errorMaps:a,issueData:i}=e,s=[...r,...i.path||[]],n={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";for(let e of a.filter(e=>!!e).slice().reverse())o=e(n,{data:t,defaultError:o}).message;return{...i,path:s,message:o}};function nn(e,t){let r=ns({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,ni,void 0].filter(e=>!!e)});e.common.issues.push(r)}class no{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return nl;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return no.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:i}=a;if("aborted"===t.status||"aborted"===i.status)return nl;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||a.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let nl=Object.freeze({status:"aborted"}),nu=e=>({status:"dirty",value:e}),nd=e=>({status:"valid",value:e}),nc=e=>"undefined"!=typeof Promise&&e instanceof Promise;class np{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let nf=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new na(e.common.issues);return this._error=t,this._error}}};function nh(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:s}=e;return"invalid_enum_value"===t.code?{message:s??i.defaultError}:void 0===i.data?{message:s??a??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:s??r??i.defaultError}},description:i}}class nm{get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new no,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nc(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},a=this._parseSync({data:e,path:r.path,parent:r});return nf(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},a=this._parse({data:e,path:r.path,parent:r});return nf(r,await (nc(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let i=e(r),s=()=>a.addIssue({code:nr.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(s(),!1)):!!i||(s(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new n3({schema:this,typeName:lr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return n7.create(this,this._def)}nullable(){return oe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nH.create(this)}promise(){return n5.create(this,this._def)}or(e){return nK.create([this,e],this._def)}and(e){return nW.create(this,e,this._def)}transform(e){return new n3({...nh(this._def),schema:this,typeName:lr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ot({...nh(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:lr.ZodDefault})}brand(){return new oi({typeName:lr.ZodBranded,type:this,...nh(this._def)})}catch(e){return new or({...nh(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:lr.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return os.create(this,e)}readonly(){return on.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let ny=/^c[^\s-]{8,}$/i,ng=/^[0-9a-z]+$/,nv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,n_=/^[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,nb=/^[a-z0-9_-]{21}$/i,nw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,n$=/^[-+]?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)?)??$/,nk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nx=/^(?:(?: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])$/,nS=/^(?:(?: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])$/,nE=/^(([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]))$/,nT=/^(([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])$/,nP=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nj="((\\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])))",nN=RegExp(`^${nj}$`);function nz(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class nI extends nm{_parse(t){var r,a,i,s;let n;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ne.string){let e=this._getOrReturnCtx(t);return nn(e,{code:nr.invalid_type,expected:ne.string,received:e.parsedType}),nl}let o=new no;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(nn(n=this._getOrReturnCtx(t,n),{code:nr.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("max"===l.kind)t.data.length>l.value&&(nn(n=this._getOrReturnCtx(t,n),{code:nr.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("length"===l.kind){let e=t.data.length>l.value,r=t.data.length<l.value;(e||r)&&(n=this._getOrReturnCtx(t,n),e?nn(n,{code:nr.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&nn(n,{code:nr.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)nk.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"email",code:nr.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)e||(e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),e.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"emoji",code:nr.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)n_.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"uuid",code:nr.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)nb.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"nanoid",code:nr.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)ny.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"cuid",code:nr.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)ng.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"cuid2",code:nr.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)nv.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"ulid",code:nr.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{nn(n=this._getOrReturnCtx(t,n),{validation:"url",code:nr.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"regex",code:nr.invalid_string,message:l.message}),o.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(nn(n=this._getOrReturnCtx(t,n),{code:nr.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(nn(n=this._getOrReturnCtx(t,n),{code:nr.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(nn(n=this._getOrReturnCtx(t,n),{code:nr.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${nj}T${nz(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(l).test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{code:nr.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?nN.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{code:nr.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${nz(l)}$`).test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{code:nr.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?n$.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"duration",code:nr.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(a=l.version)||!a)&&nx.test(r)||("v6"===a||!a)&&nE.test(r))&&1&&(nn(n=this._getOrReturnCtx(t,n),{validation:"ip",code:nr.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!nw.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(nn(n=this._getOrReturnCtx(t,n),{validation:"jwt",code:nr.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(i=t.data,!(("v4"===(s=l.version)||!s)&&nS.test(i)||("v6"===s||!s)&&nT.test(i))&&1&&(nn(n=this._getOrReturnCtx(t,n),{validation:"cidr",code:nr.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?nP.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"base64",code:nr.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?nO.test(t.data)||(nn(n=this._getOrReturnCtx(t,n),{validation:"base64url",code:nr.invalid_string,message:l.message}),o.dirty()):o7.assertNever(l);return{status:o.value,value:t.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:nr.invalid_string,...lt.errToObj(r)})}_addCheck(e){return new nI({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...lt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...lt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...lt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...lt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...lt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...lt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...lt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...lt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...lt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...lt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...lt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...lt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...lt.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...lt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...lt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...lt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...lt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...lt.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...lt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...lt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...lt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...lt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...lt.errToObj(t)})}nonempty(e){return this.min(1,lt.errToObj(e))}trim(){return new nI({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new nI({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new nI({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}nI.create=e=>new nI({checks:[],typeName:lr.ZodString,coerce:e?.coerce??!1,...nh(e)});class nR extends nm{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ne.number){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.number,received:t.parsedType}),nl}let r=new no;for(let a of this._def.checks)"int"===a.kind?o7.isInteger(e.data)||(nn(t=this._getOrReturnCtx(e,t),{code:nr.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,a.value)&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(nn(t=this._getOrReturnCtx(e,t),{code:nr.not_finite,message:a.message}),r.dirty()):o7.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,lt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,lt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,lt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,lt.toString(t))}setLimit(e,t,r,a){return new nR({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:lt.toString(a)}]})}_addCheck(e){return new nR({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:lt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:lt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:lt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:lt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:lt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:lt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:lt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:lt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:lt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&o7.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}nR.create=e=>new nR({checks:[],typeName:lr.ZodNumber,coerce:e?.coerce||!1,...nh(e)});class nC extends nm{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ne.bigint)return this._getInvalidInput(e);let r=new no;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):o7.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.bigint,received:t.parsedType}),nl}gte(e,t){return this.setLimit("min",e,!0,lt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,lt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,lt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,lt.toString(t))}setLimit(e,t,r,a){return new nC({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:lt.toString(a)}]})}_addCheck(e){return new nC({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:lt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:lt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:lt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:lt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:lt.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}nC.create=e=>new nC({checks:[],typeName:lr.ZodBigInt,coerce:e?.coerce??!1,...nh(e)});class nA extends nm{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ne.boolean){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.boolean,received:t.parsedType}),nl}return nd(e.data)}}nA.create=e=>new nA({typeName:lr.ZodBoolean,coerce:e?.coerce||!1,...nh(e)});class nM extends nm{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.date,received:t.parsedType}),nl}if(Number.isNaN(e.data.getTime()))return nn(this._getOrReturnCtx(e),{code:nr.invalid_date}),nl;let r=new no;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(nn(t=this._getOrReturnCtx(e,t),{code:nr.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):o7.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new nM({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:lt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:lt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}nM.create=e=>new nM({checks:[],coerce:e?.coerce||!1,typeName:lr.ZodDate,...nh(e)});class nZ extends nm{_parse(e){if(this._getType(e)!==ne.symbol){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.symbol,received:t.parsedType}),nl}return nd(e.data)}}nZ.create=e=>new nZ({typeName:lr.ZodSymbol,...nh(e)});class nq extends nm{_parse(e){if(this._getType(e)!==ne.undefined){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.undefined,received:t.parsedType}),nl}return nd(e.data)}}nq.create=e=>new nq({typeName:lr.ZodUndefined,...nh(e)});class nD extends nm{_parse(e){if(this._getType(e)!==ne.null){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.null,received:t.parsedType}),nl}return nd(e.data)}}nD.create=e=>new nD({typeName:lr.ZodNull,...nh(e)});class nF extends nm{constructor(){super(...arguments),this._any=!0}_parse(e){return nd(e.data)}}nF.create=e=>new nF({typeName:lr.ZodAny,...nh(e)});class nL extends nm{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nd(e.data)}}nL.create=e=>new nL({typeName:lr.ZodUnknown,...nh(e)});class nV extends nm{_parse(e){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.never,received:t.parsedType}),nl}}nV.create=e=>new nV({typeName:lr.ZodNever,...nh(e)});class nU extends nm{_parse(e){if(this._getType(e)!==ne.undefined){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.void,received:t.parsedType}),nl}return nd(e.data)}}nU.create=e=>new nU({typeName:lr.ZodVoid,...nh(e)});class nH extends nm{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==ne.array)return nn(t,{code:nr.invalid_type,expected:ne.array,received:t.parsedType}),nl;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(nn(t,{code:e?nr.too_big:nr.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(nn(t,{code:nr.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(nn(t,{code:nr.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new np(t,e,t.path,r)))).then(e=>no.mergeArray(r,e));let i=[...t.data].map((e,r)=>a.type._parseSync(new np(t,e,t.path,r)));return no.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new nH({...this._def,minLength:{value:e,message:lt.toString(t)}})}max(e,t){return new nH({...this._def,maxLength:{value:e,message:lt.toString(t)}})}length(e,t){return new nH({...this._def,exactLength:{value:e,message:lt.toString(t)}})}nonempty(e){return this.min(1,e)}}nH.create=(e,t)=>new nH({type:e,minLength:null,maxLength:null,exactLength:null,typeName:lr.ZodArray,...nh(t)});class nJ extends nm{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=o7.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ne.object){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.object,received:t.parsedType}),nl}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof nV&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||s.push(e);let n=[];for(let e of i){let t=a[e],i=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new np(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof nV){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(nn(r,{code:nr.unrecognized_keys,keys:s}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let a=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new np(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of n){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>no.mergeObjectSync(t,e)):no.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return lt.errToObj,new nJ({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:lt.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new nJ({...this._def,unknownKeys:"strip"})}passthrough(){return new nJ({...this._def,unknownKeys:"passthrough"})}extend(e){return new nJ({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new nJ({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:lr.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new nJ({...this._def,catchall:e})}pick(e){let t={};for(let r of o7.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new nJ({...this._def,shape:()=>t})}omit(e){let t={};for(let r of o7.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new nJ({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof nJ){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=n7.create(e(i))}return new nJ({...t._def,shape:()=>r})}if(t instanceof nH)return new nH({...t._def,type:e(t.element)});if(t instanceof n7)return n7.create(e(t.unwrap()));if(t instanceof oe)return oe.create(e(t.unwrap()));if(t instanceof nY)return nY.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of o7.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new nJ({...this._def,shape:()=>t})}required(e){let t={};for(let r of o7.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof n7;)e=e._def.innerType;t[r]=e}return new nJ({...this._def,shape:()=>t})}keyof(){return n4(o7.objectKeys(this.shape))}}nJ.create=(e,t)=>new nJ({shape:()=>e,unknownKeys:"strip",catchall:nV.create(),typeName:lr.ZodObject,...nh(t)}),nJ.strictCreate=(e,t)=>new nJ({shape:()=>e,unknownKeys:"strict",catchall:nV.create(),typeName:lr.ZodObject,...nh(t)}),nJ.lazycreate=(e,t)=>new nJ({shape:e,unknownKeys:"strip",catchall:nV.create(),typeName:lr.ZodObject,...nh(t)});class nK extends nm{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new na(e.ctx.common.issues));return nn(t,{code:nr.invalid_union,unionErrors:r}),nl});{let e,a=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=a.map(e=>new na(e));return nn(t,{code:nr.invalid_union,unionErrors:i}),nl}}get options(){return this._def.options}}nK.create=(e,t)=>new nK({options:e,typeName:lr.ZodUnion,...nh(t)});let nB=e=>{if(e instanceof n9)return nB(e.schema);if(e instanceof n3)return nB(e.innerType());if(e instanceof n2)return[e.value];if(e instanceof n6)return e.options;if(e instanceof n8)return o7.objectValues(e.enum);else if(e instanceof ot)return nB(e._def.innerType);else if(e instanceof nq)return[void 0];else if(e instanceof nD)return[null];else if(e instanceof n7)return[void 0,...nB(e.unwrap())];else if(e instanceof oe)return[null,...nB(e.unwrap())];else if(e instanceof oi)return nB(e.unwrap());else if(e instanceof on)return nB(e.unwrap());else if(e instanceof or)return nB(e._def.innerType);else return[]};class nG extends nm{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ne.object)return nn(t,{code:nr.invalid_type,expected:ne.object,received:t.parsedType}),nl;let r=this.discriminator,a=t.data[r],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(nn(t,{code:nr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),nl)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=nB(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(a.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,r)}}return new nG({typeName:lr.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...nh(r)})}}class nW extends nm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return nl;let i=function e(t,r){let a=nt(t),i=nt(r);if(t===r)return{valid:!0,data:t};if(a===ne.object&&i===ne.object){let a=o7.objectKeys(r),i=o7.objectKeys(t).filter(e=>-1!==a.indexOf(e)),s={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1};s[a]=i.data}return{valid:!0,data:s}}if(a===ne.array&&i===ne.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let s=e(t[i],r[i]);if(!s.valid)return{valid:!1};a.push(s.data)}return{valid:!0,data:a}}if(a===ne.date&&i===ne.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,a.value);return i.valid?(("dirty"===e.status||"dirty"===a.status)&&t.dirty(),{status:t.value,value:i.data}):(nn(r,{code:nr.invalid_intersection_types}),nl)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}nW.create=(e,t,r)=>new nW({left:e,right:t,typeName:lr.ZodIntersection,...nh(r)});class nY extends nm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.array)return nn(r,{code:nr.invalid_type,expected:ne.array,received:r.parsedType}),nl;if(r.data.length<this._def.items.length)return nn(r,{code:nr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),nl;!this._def.rest&&r.data.length>this._def.items.length&&(nn(r,{code:nr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new np(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>no.mergeArray(t,e)):no.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new nY({...this._def,rest:e})}}nY.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new nY({items:e,typeName:lr.ZodTuple,rest:null,...nh(t)})};class nQ extends nm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.object)return nn(r,{code:nr.invalid_type,expected:ne.object,received:r.parsedType}),nl;let a=[],i=this._def.keyType,s=this._def.valueType;for(let e in r.data)a.push({key:i._parse(new np(r,e,r.path,e)),value:s._parse(new np(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?no.mergeObjectAsync(t,a):no.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new nQ(t instanceof nm?{keyType:e,valueType:t,typeName:lr.ZodRecord,...nh(r)}:{keyType:nI.create(),valueType:e,typeName:lr.ZodRecord,...nh(t)})}}class nX extends nm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.map)return nn(r,{code:nr.invalid_type,expected:ne.map,received:r.parsedType}),nl;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([e,t],s)=>({key:a._parse(new np(r,e,r.path,[s,"key"])),value:i._parse(new np(r,t,r.path,[s,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of s){let a=await r.key,i=await r.value;if("aborted"===a.status||"aborted"===i.status)return nl;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of s){let a=r.key,i=r.value;if("aborted"===a.status||"aborted"===i.status)return nl;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}nX.create=(e,t,r)=>new nX({valueType:t,keyType:e,typeName:lr.ZodMap,...nh(r)});class n0 extends nm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.set)return nn(r,{code:nr.invalid_type,expected:ne.set,received:r.parsedType}),nl;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(nn(r,{code:nr.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(nn(r,{code:nr.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let i=this._def.valueType;function s(e){let r=new Set;for(let a of e){if("aborted"===a.status)return nl;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let n=[...r.data.values()].map((e,t)=>i._parse(new np(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>s(e)):s(n)}min(e,t){return new n0({...this._def,minSize:{value:e,message:lt.toString(t)}})}max(e,t){return new n0({...this._def,maxSize:{value:e,message:lt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}n0.create=(e,t)=>new n0({valueType:e,minSize:null,maxSize:null,typeName:lr.ZodSet,...nh(t)});class n1 extends nm{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ne.function)return nn(t,{code:nr.invalid_type,expected:ne.function,received:t.parsedType}),nl;function r(e,r){return ns({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ni,ni].filter(e=>!!e),issueData:{code:nr.invalid_arguments,argumentsError:r}})}function a(e,r){return ns({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ni,ni].filter(e=>!!e),issueData:{code:nr.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof n5){let e=this;return nd(async function(...t){let n=new na([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw n.addIssue(r(t,e)),n}),l=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw n.addIssue(a(l,e)),n})})}{let e=this;return nd(function(...t){let n=e._def.args.safeParse(t,i);if(!n.success)throw new na([r(t,n.error)]);let o=Reflect.apply(s,this,n.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new na([a(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n1({...this._def,args:nY.create(e).rest(nL.create())})}returns(e){return new n1({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n1({args:e||nY.create([]).rest(nL.create()),returns:t||nL.create(),typeName:lr.ZodFunction,...nh(r)})}}class n9 extends nm{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}n9.create=(e,t)=>new n9({getter:e,typeName:lr.ZodLazy,...nh(t)});class n2 extends nm{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return nn(t,{received:t.data,code:nr.invalid_literal,expected:this._def.value}),nl}return{status:"valid",value:e.data}}get value(){return this._def.value}}function n4(e,t){return new n6({values:e,typeName:lr.ZodEnum,...nh(t)})}n2.create=(e,t)=>new n2({value:e,typeName:lr.ZodLiteral,...nh(t)});class n6 extends nm{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return nn(t,{expected:o7.joinValues(r),received:t.parsedType,code:nr.invalid_type}),nl}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return nn(t,{received:t.data,code:nr.invalid_enum_value,options:r}),nl}return nd(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n6.create(e,{...this._def,...t})}exclude(e,t=this._def){return n6.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}n6.create=n4;class n8 extends nm{_parse(e){let t=o7.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ne.string&&r.parsedType!==ne.number){let e=o7.objectValues(t);return nn(r,{expected:o7.joinValues(e),received:r.parsedType,code:nr.invalid_type}),nl}if(this._cache||(this._cache=new Set(o7.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=o7.objectValues(t);return nn(r,{received:r.data,code:nr.invalid_enum_value,options:e}),nl}return nd(e.data)}get enum(){return this._def.values}}n8.create=(e,t)=>new n8({values:e,typeName:lr.ZodNativeEnum,...nh(t)});class n5 extends nm{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==ne.promise&&!1===t.common.async?(nn(t,{code:nr.invalid_type,expected:ne.promise,received:t.parsedType}),nl):nd((t.parsedType===ne.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}n5.create=(e,t)=>new n5({type:e,typeName:lr.ZodPromise,...nh(t)});class n3 extends nm{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===lr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{nn(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){let e=a.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return nl;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?nl:"dirty"===a.status||"dirty"===t.value?nu(a.value):a});{if("aborted"===t.value)return nl;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?nl:"dirty"===a.status||"dirty"===t.value?nu(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?nl:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?nl:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?nl:Promise.resolve(a.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return nl;let s=a.transform(e.value,i);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}o7.assertNever(a)}}n3.create=(e,t,r)=>new n3({schema:e,typeName:lr.ZodEffects,effect:t,...nh(r)}),n3.createWithPreprocess=(e,t,r)=>new n3({schema:t,effect:{type:"preprocess",transform:e},typeName:lr.ZodEffects,...nh(r)});class n7 extends nm{_parse(e){return this._getType(e)===ne.undefined?nd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}n7.create=(e,t)=>new n7({innerType:e,typeName:lr.ZodOptional,...nh(t)});class oe extends nm{_parse(e){return this._getType(e)===ne.null?nd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}oe.create=(e,t)=>new oe({innerType:e,typeName:lr.ZodNullable,...nh(t)});class ot extends nm{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ot.create=(e,t)=>new ot({innerType:e,typeName:lr.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...nh(t)});class or extends nm{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return nc(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new na(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new na(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}or.create=(e,t)=>new or({innerType:e,typeName:lr.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...nh(t)});class oa extends nm{_parse(e){if(this._getType(e)!==ne.nan){let t=this._getOrReturnCtx(e);return nn(t,{code:nr.invalid_type,expected:ne.nan,received:t.parsedType}),nl}return{status:"valid",value:e.data}}}oa.create=e=>new oa({typeName:lr.ZodNaN,...nh(e)}),Symbol("zod_brand");class oi extends nm{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class os extends nm{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?nl:"dirty"===e.status?(t.dirty(),nu(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?nl:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new os({in:e,out:t,typeName:lr.ZodPipeline})}}class on extends nm{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return nc(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}on.create=(e,t)=>new on({innerType:e,typeName:lr.ZodReadonly,...nh(t)}),nJ.lazycreate,(o6=lr||(lr={})).ZodString="ZodString",o6.ZodNumber="ZodNumber",o6.ZodNaN="ZodNaN",o6.ZodBigInt="ZodBigInt",o6.ZodBoolean="ZodBoolean",o6.ZodDate="ZodDate",o6.ZodSymbol="ZodSymbol",o6.ZodUndefined="ZodUndefined",o6.ZodNull="ZodNull",o6.ZodAny="ZodAny",o6.ZodUnknown="ZodUnknown",o6.ZodNever="ZodNever",o6.ZodVoid="ZodVoid",o6.ZodArray="ZodArray",o6.ZodObject="ZodObject",o6.ZodUnion="ZodUnion",o6.ZodDiscriminatedUnion="ZodDiscriminatedUnion",o6.ZodIntersection="ZodIntersection",o6.ZodTuple="ZodTuple",o6.ZodRecord="ZodRecord",o6.ZodMap="ZodMap",o6.ZodSet="ZodSet",o6.ZodFunction="ZodFunction",o6.ZodLazy="ZodLazy",o6.ZodLiteral="ZodLiteral",o6.ZodEnum="ZodEnum",o6.ZodEffects="ZodEffects",o6.ZodNativeEnum="ZodNativeEnum",o6.ZodOptional="ZodOptional",o6.ZodNullable="ZodNullable",o6.ZodDefault="ZodDefault",o6.ZodCatch="ZodCatch",o6.ZodPromise="ZodPromise",o6.ZodBranded="ZodBranded",o6.ZodPipeline="ZodPipeline",o6.ZodReadonly="ZodReadonly",nI.create,nR.create,oa.create,nC.create,nA.create,nM.create,nZ.create,nq.create,nD.create,nF.create,nL.create,nV.create,nU.create,nH.create;let oo=nJ.create;nJ.strictCreate,nK.create,nG.create,nW.create,nY.create,nQ.create,nX.create,n0.create,n1.create,n9.create,n2.create,n6.create,n8.create,n5.create,n3.create,n7.create,oe.create,n3.createWithPreprocess,os.create;let ol=s("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");eZ.init(e,t),e.def=t,e.type=t.type,e.parse=(t,r)=>ej(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>eR(e,t,r),e.parseAsync=async(t,r)=>ez(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>eA(e,t,r),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,r)=>X(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.apply=t=>t(e)}),ou=s("ZodMiniObject",(e,t)=>{tp.init(e,t),ol.init(e,t),L(e,"shape",()=>t.shape)});function od(e,t){return new ou({type:"object",shape:e??{},...ee(t)})}function oc(e){return!!e._zod}function op(e){let t=Object.values(e);if(0===t.length)return od({});let r=t.every(oc),a=t.every(e=>!oc(e));if(r)return od(e);if(a)return oo(e);throw Error("Mixed Zod versions detected in object shape.")}function of(e,t){return oc(e)?eR(e,t):e.safeParse(t)}async function oh(e,t){return oc(e)?await eA(e,t):await e.safeParseAsync(t)}function om(e){let t;if(e&&(t=oc(e)?e._zod?.def?.shape:e.shape)){if("function"==typeof t)try{return t()}catch{return}return t}}function oy(e){if(e){if("object"==typeof e&&!e._def&&!e._zod){let t=Object.values(e);if(t.length>0&&t.every(e=>"object"==typeof e&&null!==e&&(void 0!==e._def||void 0!==e._zod||"function"==typeof e.parse)))return op(e)}if(oc(e)){let t=e._zod?.def;if(t&&("object"===t.type||void 0!==t.shape))return e}else if(void 0!==e.shape)return e}}function og(e){if(e&&"object"==typeof e){if("message"in e&&"string"==typeof e.message)return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&"object"==typeof t&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{}}return String(e)}function ov(e){if(oc(e)){let t=e._zod?.def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(void 0!==r)return r}function o_(e){return"completed"===e||"failed"===e||"cancelled"===e}let ob=Symbol("Let zodToJsonSchema decide on which parser to use"),ow={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},o$=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function ok(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?o$(t,e.currentPath):t.join("/")}}function ox(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function oS(e,t,r,a,i){e[t]=r,ox(e,t,a,i)}function oE(e,t){return oK(e.type._def,t)}let oT=/^[cC][^\s-]{8,}$/,oP=/^[0-9a-z]+$/,oO=/^[0-9A-HJKMNP-TV-Z]{26}$/,oj=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,oN=()=>(void 0===a&&(a=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a),oz=/^(?:(?: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])$/,oI=/^(([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])$/,oR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,oA=/^[a-zA-Z0-9_-]{21}$/,oM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function oZ(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":oS(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":oS(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":oF(r,"email",a.message,t);break;case"format:idn-email":oF(r,"idn-email",a.message,t);break;case"pattern:zod":oL(r,oj,a.message,t)}break;case"url":oF(r,"uri",a.message,t);break;case"uuid":oF(r,"uuid",a.message,t);break;case"regex":oL(r,a.regex,a.message,t);break;case"cuid":oL(r,oT,a.message,t);break;case"cuid2":oL(r,oP,a.message,t);break;case"startsWith":oL(r,RegExp(`^${oq(a.value,t)}`),a.message,t);break;case"endsWith":oL(r,RegExp(`${oq(a.value,t)}$`),a.message,t);break;case"datetime":oF(r,"date-time",a.message,t);break;case"date":oF(r,"date",a.message,t);break;case"time":oF(r,"time",a.message,t);break;case"duration":oF(r,"duration",a.message,t);break;case"length":oS(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),oS(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":oL(r,RegExp(oq(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&oF(r,"ipv4",a.message,t),"v4"!==a.version&&oF(r,"ipv6",a.message,t);break;case"base64url":oL(r,oC,a.message,t);break;case"jwt":oL(r,oM,a.message,t);break;case"cidr":"v6"!==a.version&&oL(r,oz,a.message,t),"v4"!==a.version&&oL(r,oI,a.message,t);break;case"emoji":oL(r,oN(),a.message,t);break;case"ulid":oL(r,oO,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":oF(r,"binary",a.message,t);break;case"contentEncoding:base64":oS(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":oL(r,oR,a.message,t)}break;case"nanoid":oL(r,oA,a.message,t)}return r}function oq(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)oD.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let oD=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function oF(e,t,r,a){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):oS(e,"format",t,r,a)}function oL(e,t,r,a){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:oV(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):oS(e,"pattern",oV(t,a),r,a)}function oV(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=r.i?e.source.toLowerCase():e.source,i="",s=!1,n=!1,o=!1;for(let e=0;e<a.length;e++){if(s){i+=a[e],s=!1;continue}if(r.i){if(n){if(a[e].match(/[a-z]/)){o?(i+=a[e],i+=`${a[e-2]}-${a[e]}`.toUpperCase(),o=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(i+=a[e],o=!0):i+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){i+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){i+=`(^|(?<=[\r
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let r of e.seen.entries()){let a=r[1];if(t===r[0]){i(r);continue}if(e.external){let a=e.external.registry.get(r[0])?.id;if(t!==r[0]&&a){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id||a.cycle||a.count>1&&"ref"===e.reused){i(r);continue}}}function rk(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let a=t=>{let r=e.seen.get(t);if(null===r.ref)return;let i=r.def??r.schema,n={...i},o=r.ref;if(r.ref=null,o){a(o);let r=e.seen.get(o),s=r.schema;if(s.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,n),t._zod.parent===o)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in n||delete i[e]);if(s.$ref&&r.def)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(i[e])===JSON.stringify(r.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){a(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:r.path??[]})};for(let t of[...e.seen.entries()].reverse())a(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let r=e.external.registry.get(t)?.id;if(!r)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(r)}Object.assign(i,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;void 0!==n&&i.id===n&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let r=JSON.parse(JSON.stringify(i));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:rR(t,"input",e.processors),output:rR(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw Error("Error converting schema to JSON.")}}let rR=(e,t,r={})=>a=>{let{libraryOptions:i,target:n}=a??{},o=rS({...i??{},target:n,io:t,processors:r});return r$(e,o),rw(o,e),rk(o,e)},rx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rP=(e,t,r,a)=>{r.type="string";let{minimum:i,maximum:n,format:o,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof n&&(r.maxLength=n),o&&(r.format=rx[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),l&&(r.contentEncoding=l),s&&s.size>0){let e=[...s];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},rE=(e,t,r,a)=>{let{minimum:i,maximum:n,format:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number";let u="number"==typeof c&&c>=(i??-1/0),d="number"==typeof l&&l<=(n??1/0),p="draft-04"===t.target||"openapi-3.0"===t.target;u?p?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:"number"==typeof i&&(r.minimum=i),d?p?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:"number"==typeof n&&(r.maximum=n),"number"==typeof s&&(r.multipleOf=s)},rT=(e,t,r,a)=>{r.type="boolean"},rj=(e,t,r,a)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},rO=(e,t,r,a)=>{r.not={}},rC=(e,t,r,a)=>{},rN=(e,t,r,a)=>{},rI=(e,t,r,a)=>{let i=ef(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(r.type="number"),i.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=i},rq=(e,t,r,a)=>{let i=e._zod.def,n=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else n.push(Number(e));else n.push(e);if(0===n.length);else if(1===n.length){let e=n[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),n.every(e=>"boolean"==typeof e)&&(r.type="boolean"),n.every(e=>null===e)&&(r.type="null"),r.enum=n},rz=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")},rA=(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")},rM=(e,t,r,a)=>{let i=e._zod.def,{minimum:n,maximum:o}=e._zod.bag;"number"==typeof n&&(r.minItems=n),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=r$(i.element,t,{...a,path:[...a.path,"items"]})},rL=(e,t,r,a)=>{let i=e._zod.def;r.type="object",r.properties={};let n=i.shape;for(let e in n)r.properties[e]=r$(n[e],t,{...a,path:[...a.path,"properties",e]});let o=new Set([...new Set(Object.keys(n))].filter(e=>{let r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));o.size>0&&(r.required=Array.from(o)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=r$(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},rZ=(e,t,r,a)=>{let i=e._zod.def,n=!1===i.inclusive,o=i.options.map((e,r)=>r$(e,t,{...a,path:[...a.path,n?"oneOf":"anyOf",r]}));n?r.oneOf=o:r.anyOf=o},rD=(e,t,r,a)=>{let i=e._zod.def,n=r$(i.left,t,{...a,path:[...a.path,"allOf",0]}),o=r$(i.right,t,{...a,path:[...a.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...s(n)?n.allOf:[n],...s(o)?o.allOf:[o]]},rV=(e,t,r,a)=>{let i=e._zod.def;r.type="object";let n=i.keyType,o=n._zod.bag,s=o?.patterns;if("loose"===i.mode&&s&&s.size>0){let e=r$(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});for(let t of(r.patternProperties={},s))r.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(r.propertyNames=r$(i.keyType,t,{...a,path:[...a.path,"propertyNames"]})),r.additionalProperties=r$(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]});let l=n._zod.values;if(l){let e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},rU=(e,t,r,a)=>{let i=e._zod.def,n=r$(i.innerType,t,a),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[n,{type:"null"}]},rF=(e,t,r,a)=>{let i=e._zod.def;r$(i.innerType,t,a),t.seen.get(e).ref=i.innerType},rH=(e,t,r,a)=>{let i=e._zod.def;r$(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},rJ=(e,t,r,a)=>{let i=e._zod.def;r$(i.innerType,t,a),t.seen.get(e).ref=i.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},rK=(e,t,r,a)=>{let i,n=e._zod.def;r$(n.innerType,t,a),t.seen.get(e).ref=n.innerType;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},rB=(e,t,r,a)=>{let i=e._zod.def,n=i.in._zod.traits.has("$ZodTransform"),o="input"===t.io?n?i.out:i.in:i.out;r$(o,t,a),t.seen.get(e).ref=o},rG=(e,t,r,a)=>{let i=e._zod.def;r$(i.innerType,t,a),t.seen.get(e).ref=i.innerType,r.readOnly=!0},rW=(e,t,r,a)=>{let i=e._zod.def;r$(i.innerType,t,a),t.seen.get(e).ref=i.innerType},rY=(e,t,r,a)=>{let i=e._zod.innerType;r$(i,t,a),t.seen.get(e).ref=i},rX={string:rP,number:rE,boolean:rT,bigint:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")},symbol:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")},null:rj,undefined:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")},void:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")},never:rO,any:rC,unknown:rN,date:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")},enum:rI,literal:rq,nan:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")},template_literal:(e,t,r,a)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},file:(e,t,r,a)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:n,maximum:o,mime:s}=e._zod.bag;void 0!==n&&(i.minLength=n),void 0!==o&&(i.maxLength=o),s?1===s.length?(i.contentMediaType=s[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=s.map(e=>({contentMediaType:e}))):Object.assign(r,i)},success:(e,t,r,a)=>{r.type="boolean"},custom:rz,function:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")},transform:rA,map:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")},set:(e,t,r,a)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")},array:rM,object:rL,union:rZ,intersection:rD,tuple:(e,t,r,a)=>{let i=e._zod.def;r.type="array";let n="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",s=i.items.map((e,r)=>r$(e,t,{...a,path:[...a.path,n,r]})),l=i.rest?r$(i.rest,t,{...a,path:[...a.path,o,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=s,l&&(r.items=l)):"openapi-3.0"===t.target?(r.items={anyOf:s},l&&r.items.anyOf.push(l),r.minItems=s.length,l||(r.maxItems=s.length)):(r.items=s,l&&(r.additionalItems=l));let{minimum:c,maximum:u}=e._zod.bag;"number"==typeof c&&(r.minItems=c),"number"==typeof u&&(r.maxItems=u)},record:rV,nullable:rU,nonoptional:rF,default:rH,prefault:rJ,catch:rK,pipe:rB,readonly:rG,promise:(e,t,r,a)=>{let i=e._zod.def;r$(i.innerType,t,a),t.seen.get(e).ref=i.innerType},optional:rW,lazy:rY};function rQ(e,t){if("_idmap"in e){let r=rS({...t,processors:rX}),a={};for(let t of e._idmap.entries()){let[e,a]=t;r$(a,r)}let i={};for(let n of(r.external={registry:e,uri:t?.uri,defs:a},e._idmap.entries())){let[e,t]=n;rw(r,t),i[e]=rk(r,t)}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let r=rS({...t,processors:rX});return r$(e,r),rw(r,e),rk(r,e)}let r0=A("ZodISODateTime",(e,t)=>{tv.init(e,t),af.init(e,t)});function r1(e){return new r0({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...eC(e)})}let r2=A("ZodISODate",(e,t)=>{t_.init(e,t),af.init(e,t)});function r9(e){return new r2({type:"string",format:"date",check:"string_format",...eC(e)})}let r4=A("ZodISOTime",(e,t)=>{tb.init(e,t),af.init(e,t)}),r6=A("ZodISODuration",(e,t)=>{tS.init(e,t),af.init(e,t)}),r5=A("ZodError",(e,t)=>{e6.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},a=(e,i=[])=>{for(let n of e.issues)if("invalid_union"===n.code&&n.errors.length)n.errors.map(e=>a({issues:e},[...i,...n.path]));else if("invalid_key"===n.code)a({issues:n.issues},[...i,...n.path]);else if("invalid_element"===n.code)a({issues:n.issues},[...i,...n.path]);else{let e=[...i,...n.path];if(0===e.length)r._errors.push(t(n));else{let a=r,i=0;for(;i<e.length;){let r=e[i];i===e.length-1?(a[r]=a[r]||{_errors:[]},a[r]._errors.push(t(n))):a[r]=a[r]||{_errors:[]},a=a[r],i++}}}};return a(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},a=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):a.push(t(i));return{formErrors:a,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,eg,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,eg,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),r3=e3(r5),r8=e8(r5),r7=e7(r5),ae=tt(r5),at=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return e3(r5)(e,t,a)},ar=(e,t,r)=>e3(r5)(e,t,r),aa=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return e8(r5)(e,t,a)},ai=async(e,t,r)=>e8(r5)(e,t,r),an=(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return e7(r5)(e,t,a)},ao=(e,t,r)=>e7(r5)(e,t,r),as=async(e,t,r)=>{let a=r?{...r,direction:"backward"}:{direction:"backward"};return tt(r5)(e,t,a)},al=async(e,t,r)=>tt(r5)(e,t,r),ac=new WeakMap;function au(e,t,r){let a=Object.getPrototypeOf(e),i=ac.get(a);if(i||(i=new Set,ac.set(a,i)),!i.has(t))for(let e in i.add(t),r){let t=r[e];Object.defineProperty(a,e,{configurable:!0,enumerable:!1,get(){let r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}let ad=A("ZodType",(e,t)=>(ti.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:rR(e,"input"),output:rR(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{let a=rS({...r,processors:t});return r$(e,a),rw(a,e),rk(a,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>r3(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>r7(e,t,r),e.parseAsync=async(t,r)=>r8(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ae(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>at(e,t,r),e.decode=(t,r)=>ar(e,t,r),e.encodeAsync=async(t,r)=>aa(e,t,r),e.decodeAsync=async(t,r)=>ai(e,t,r),e.safeEncode=(t,r)=>an(e,t,r),e.safeDecode=(t,r)=>ao(e,t,r),e.safeEncodeAsync=async(t,r)=>as(e,t,r),e.safeDecodeAsync=async(t,r)=>al(e,t,r),au(e,"ZodType",{check(...e){let t=this.def;return this.clone(e$(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return eO(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return new i_({type:"custom",check:"custom",fn:e,...eC(t)})}(e,t))},superRefine(e,t){return this.check(function(e,t){var r;let a,i;return r=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(eL(e,t.value,a._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=a),e.continue??(e.continue=!a._zod.def.abort),t.issues.push(eL(e)))},e(t.value,t)),(i=new eZ({check:"custom",...eC(t)}))._zod.check=r,a=i}(e,t))},overwrite(e){return this.check(rb(e))},optional(){return ia(this)},exactOptional(){var e;return e=this,new ii({type:"optional",innerType:e})},nullable(){return is(this)},nullish(){return ia(is(this))},nonoptional(e){var t;return t=this,new iu({type:"nonoptional",innerType:t,...eC(e)})},array(){return aB(this)},or(e){return aQ([this,e])},and(e){return a9(this,e)},transform(e){return im(this,it(e))},default(e){var t,r;return t=this,r=e,new il({type:"default",innerType:t,get defaultValue(){return"function"==typeof r?r():eE(r)}})},prefault(e){var t,r;return t=this,r=e,new ic({type:"prefault",innerType:t,get defaultValue(){return"function"==typeof r?r():eE(r)}})},catch(e){var t,r;return t=this,new id({type:"catch",innerType:t,catchValue:"function"==typeof(r=e)?r:()=>r})},pipe(e){return im(this,e)},readonly(){var e;return e=this,new ig({type:"readonly",innerType:e})},describe(e){let t=this.clone();return rl.add(t,{description:e}),t},meta(...e){if(0===e.length)return rl.get(this);let t=this.clone();return rl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>rl.get(e)?.description,configurable:!0}),e)),ap=A("_ZodString",(e,t)=>{tn.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rP(e,t,r,a);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,au(e,"_ZodString",{regex(...e){return this.check(function(e,t){return new eW({check:"string_format",format:"regex",...eC(t),pattern:e})}(...e))},includes(...e){return this.check(function(e,t){return new eQ({check:"string_format",format:"includes",...eC(t),includes:e})}(...e))},startsWith(...e){return this.check(function(e,t){return new e0({check:"string_format",format:"starts_with",...eC(t),prefix:e})}(...e))},endsWith(...e){return this.check(function(e,t){return new e1({check:"string_format",format:"ends_with",...eC(t),suffix:e})}(...e))},min(...e){return this.check(rv(...e))},max(...e){return this.check(ry(...e))},length(...e){return this.check(r_(...e))},nonempty(...e){return this.check(rv(1,...e))},lowercase(e){return this.check(new eY({check:"string_format",format:"lowercase",...eC(e)}))},uppercase(e){return this.check(new eX({check:"string_format",format:"uppercase",...eC(e)}))},trim(){return this.check(rb(e=>e.trim()))},normalize(...e){return this.check(function(e){return rb(t=>t.normalize(e))}(...e))},toLowerCase(){return this.check(rb(e=>e.toLowerCase()))},toUpperCase(){return this.check(rb(e=>e.toUpperCase()))},slugify(){return this.check(rb(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),am=A("ZodString",(e,t)=>{tn.init(e,t),ap.init(e,t),e.email=t=>e.check(rc(ag,t)),e.url=t=>e.check(rd(a_,t)),e.jwt=t=>e.check(new aI({type:"string",format:"jwt",check:"string_format",abort:!1,...eC(t)})),e.emoji=t=>e.check(new ab({type:"string",format:"emoji",check:"string_format",abort:!1,...eC(t)})),e.guid=t=>e.check(ru(ay,t)),e.uuid=t=>e.check(new av({type:"string",format:"uuid",check:"string_format",abort:!1,...eC(t)})),e.uuidv4=t=>e.check(new av({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...eC(t)})),e.uuidv6=t=>e.check(new av({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...eC(t)})),e.uuidv7=t=>e.check(new av({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...eC(t)})),e.nanoid=t=>e.check(new aS({type:"string",format:"nanoid",check:"string_format",abort:!1,...eC(t)})),e.guid=t=>e.check(ru(ay,t)),e.cuid=t=>e.check(new a$({type:"string",format:"cuid",check:"string_format",abort:!1,...eC(t)})),e.cuid2=t=>e.check(new aw({type:"string",format:"cuid2",check:"string_format",abort:!1,...eC(t)})),e.ulid=t=>e.check(new ak({type:"string",format:"ulid",check:"string_format",abort:!1,...eC(t)})),e.base64=t=>e.check(new aO({type:"string",format:"base64",check:"string_format",abort:!1,...eC(t)})),e.base64url=t=>e.check(new aC({type:"string",format:"base64url",check:"string_format",abort:!1,...eC(t)})),e.xid=t=>e.check(new aR({type:"string",format:"xid",check:"string_format",abort:!1,...eC(t)})),e.ksuid=t=>e.check(new ax({type:"string",format:"ksuid",check:"string_format",abort:!1,...eC(t)})),e.ipv4=t=>e.check(new aP({type:"string",format:"ipv4",check:"string_format",abort:!1,...eC(t)})),e.ipv6=t=>e.check(new aE({type:"string",format:"ipv6",check:"string_format",abort:!1,...eC(t)})),e.cidrv4=t=>e.check(new aT({type:"string",format:"cidrv4",check:"string_format",abort:!1,...eC(t)})),e.cidrv6=t=>e.check(new aj({type:"string",format:"cidrv6",check:"string_format",abort:!1,...eC(t)})),e.e164=t=>e.check(new aN({type:"string",format:"e164",check:"string_format",abort:!1,...eC(t)})),e.datetime=t=>e.check(r1(t)),e.date=t=>e.check(r9(t)),e.time=t=>e.check(new r4({type:"string",format:"time",check:"string_format",precision:null,...eC(t)})),e.duration=t=>e.check(new r6({type:"string",format:"duration",check:"string_format",...eC(t)}))});function ah(e){return new am({type:"string",...eC(e)})}let af=A("ZodStringFormat",(e,t)=>{to.init(e,t),ap.init(e,t)}),ag=A("ZodEmail",(e,t)=>{tc.init(e,t),af.init(e,t)}),ay=A("ZodGUID",(e,t)=>{ts.init(e,t),af.init(e,t)}),av=A("ZodUUID",(e,t)=>{tl.init(e,t),af.init(e,t)}),a_=A("ZodURL",(e,t)=>{tu.init(e,t),af.init(e,t)}),ab=A("ZodEmoji",(e,t)=>{td.init(e,t),af.init(e,t)}),aS=A("ZodNanoID",(e,t)=>{tp.init(e,t),af.init(e,t)}),a$=A("ZodCUID",(e,t)=>{tm.init(e,t),af.init(e,t)}),aw=A("ZodCUID2",(e,t)=>{th.init(e,t),af.init(e,t)}),ak=A("ZodULID",(e,t)=>{tf.init(e,t),af.init(e,t)}),aR=A("ZodXID",(e,t)=>{tg.init(e,t),af.init(e,t)}),ax=A("ZodKSUID",(e,t)=>{ty.init(e,t),af.init(e,t)}),aP=A("ZodIPv4",(e,t)=>{t$.init(e,t),af.init(e,t)}),aE=A("ZodIPv6",(e,t)=>{tw.init(e,t),af.init(e,t)}),aT=A("ZodCIDRv4",(e,t)=>{tk.init(e,t),af.init(e,t)}),aj=A("ZodCIDRv6",(e,t)=>{tR.init(e,t),af.init(e,t)}),aO=A("ZodBase64",(e,t)=>{tP.init(e,t),af.init(e,t)}),aC=A("ZodBase64URL",(e,t)=>{tE.init(e,t),af.init(e,t)}),aN=A("ZodE164",(e,t)=>{tT.init(e,t),af.init(e,t)}),aI=A("ZodJWT",(e,t)=>{tj.init(e,t),af.init(e,t)}),aq=A("ZodNumber",(e,t)=>{tO.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rE(e,t,r,a),au(e,"ZodNumber",{gt(e,t){return this.check(rh(e,t))},gte(e,t){return this.check(rf(e,t))},min(e,t){return this.check(rf(e,t))},lt(e,t){return this.check(rp(e,t))},lte(e,t){return this.check(rm(e,t))},max(e,t){return this.check(rm(e,t))},int(e){return this.check(aM(e))},safe(e){return this.check(aM(e))},positive(e){return this.check(rh(0,e))},nonnegative(e){return this.check(rf(0,e))},negative(e){return this.check(rp(0,e))},nonpositive(e){return this.check(rm(0,e))},multipleOf(e,t){return this.check(rg(e,t))},step(e,t){return this.check(rg(e,t))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function az(e){return new aq({type:"number",checks:[],...eC(e)})}let aA=A("ZodNumberFormat",(e,t)=>{tC.init(e,t),aq.init(e,t)});function aM(e){return new aA({type:"number",check:"number_format",abort:!1,format:"safeint",...eC(e)})}let aL=A("ZodBoolean",(e,t)=>{tN.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rT(e,t,r,a)});function aZ(e){return new aL({type:"boolean",...eC(e)})}let aD=A("ZodNull",(e,t)=>{tI.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rj(e,t,r,a)});function aV(e){return new aD({type:"null",...eC(e)})}let aU=A("ZodAny",(e,t)=>{tq.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rC(e,t,r,a)}),aF=A("ZodUnknown",(e,t)=>{tz.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rN(e,t,r,a)});function aH(){return new aF({type:"unknown"})}let aJ=A("ZodNever",(e,t)=>{tA.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rO(e,t,r,a)}),aK=A("ZodArray",(e,t)=>{tL.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rM(e,t,r,a),e.element=t.element,au(e,"ZodArray",{min(e,t){return this.check(rv(e,t))},nonempty(e){return this.check(rv(1,e))},max(e,t){return this.check(ry(e,t))},length(e,t){return this.check(r_(e,t))},unwrap(){return this.element}})});function aB(e,t){return new aK({type:"array",element:e,...eC(t)})}let aG=A("ZodObject",(e,t)=>{tF.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rL(e,t,r,a),eb(e,"shape",()=>t.shape),au(e,"ZodObject",{keyof(){return a3(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:aH()})},loose(){return this.clone({...this._zod.def,catchall:aH()})},strict(){return this.clone({...this._zod.def,catchall:new aJ({type:"never",...eC(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!eP(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let r=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let a=e$(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return eS(this,"shape",r),r}});return eO(e,a)}(this,e)},safeExtend(e){var t=this;if(!eP(e))throw Error("Invalid input to safeExtend: expected a plain object");let r=e$(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e};return eS(this,"shape",r),r}});return eO(t,r)},merge(e){var t=this;if(t._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=e$(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return eS(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return eO(t,r)},pick(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=e$(e._zod.def,{get shape(){let e={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);t[a]&&(e[a]=r.shape[a])}return eS(this,"shape",e),e},checks:[]});return eO(e,i)}(this,e)},omit(e){return function(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=e$(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete a[e]}return eS(this,"shape",a),a},checks:[]});return eO(e,i)}(this,e)},partial(...e){return function(e,t,r){let a=t._zod.def.checks;if(a&&a.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=e$(t._zod.def,{get shape(){let a=t._zod.def.shape,i={...a};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(i[t]=e?new e({type:"optional",innerType:a[t]}):a[t])}else for(let t in a)i[t]=e?new e({type:"optional",innerType:a[t]}):a[t];return eS(this,"shape",i),i},checks:[]});return eO(t,i)}(ir,this,e[0])},required(...e){var t,r;let a;return t=this,r=e[0],a=e$(t._zod.def,{get shape(){let e=t._zod.def.shape,a={...e};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new iu({type:"nonoptional",innerType:e[t]}))}else for(let t in e)a[t]=new iu({type:"nonoptional",innerType:e[t]});return eS(this,"shape",a),a}}),eO(t,a)}})});function aW(e,t){return new aG({type:"object",shape:e??{},...eC(t)})}function aY(e,t){return new aG({type:"object",shape:e,catchall:aH(),...eC(t)})}let aX=A("ZodUnion",(e,t)=>{tJ.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rZ(e,t,r,a),e.options=t.options});function aQ(e,t){return new aX({type:"union",options:e,...eC(t)})}let a0=A("ZodDiscriminatedUnion",(e,t)=>{aX.init(e,t),tK.init(e,t)});function a1(e,t,r){return new a0({type:"union",options:t,discriminator:e,...eC(r)})}let a2=A("ZodIntersection",(e,t)=>{tB.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rD(e,t,r,a)});function a9(e,t){return new a2({type:"intersection",left:e,right:t})}let a4=A("ZodRecord",(e,t)=>{tW.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rV(e,t,r,a),e.keyType=t.keyType,e.valueType=t.valueType});function a6(e,t,r){return new a4(t&&t._zod?{type:"record",keyType:e,valueType:t,...eC(r)}:{type:"record",keyType:ah(),valueType:e,...eC(t)})}let a5=A("ZodEnum",(e,t)=>{tY.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rI(e,t,r,a),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,a)=>{let i={};for(let a of e)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new a5({...t,checks:[],...eC(a),entries:i})},e.exclude=(e,a)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new a5({...t,checks:[],...eC(a),entries:i})}});function a3(e,t){return new a5({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...eC(t)})}let a8=A("ZodLiteral",(e,t)=>{tX.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rq(e,t,r,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function a7(e,t){return new a8({type:"literal",values:Array.isArray(e)?e:[e],...eC(t)})}let ie=A("ZodTransform",(e,t)=>{tQ.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rA(e,t,r,a),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new L(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(eL(a,r.value,t)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(eL(a)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function it(e){return new ie({type:"transform",transform:e})}let ir=A("ZodOptional",(e,t)=>{t1.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rW(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function ia(e){return new ir({type:"optional",innerType:e})}let ii=A("ZodExactOptional",(e,t)=>{t2.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rW(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),io=A("ZodNullable",(e,t)=>{t9.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rU(e,t,r,a),e.unwrap=()=>e._zod.def.innerType});function is(e){return new io({type:"nullable",innerType:e})}let il=A("ZodDefault",(e,t)=>{t4.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rH(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),ic=A("ZodPrefault",(e,t)=>{t5.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rJ(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iu=A("ZodNonOptional",(e,t)=>{t3.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rF(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),id=A("ZodCatch",(e,t)=>{t7.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rK(e,t,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ip=A("ZodPipe",(e,t)=>{re.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rB(e,t,r,a),e.in=t.in,e.out=t.out});function im(e,t){return new ip({type:"pipe",in:e,out:t})}let ih=A("ZodPreprocess",(e,t)=>{ip.init(e,t),rr.init(e,t)}),ig=A("ZodReadonly",(e,t)=>{ra.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rG(e,t,r,a),e.unwrap=()=>e._zod.def.innerType}),iy=A("ZodLazy",(e,t)=>{rn.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rY(e,t,r,a),e.unwrap=()=>e._zod.def.getter()});function iv(e){return new iy({type:"lazy",getter:e})}let i_=A("ZodCustom",(e,t)=>{ro.init(e,t),ad.init(e,t),e._zod.processJSONSchema=(t,r,a)=>rz(e,t,r,a)});function ib(e,t){return new ih({type:"pipe",in:it(e),out:t})}b||(b={});let iS="2025-11-25",i$=[iS,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],iw="io.modelcontextprotocol/protocolVersion",ik="io.modelcontextprotocol/clientInfo",iR="io.modelcontextprotocol/serverInfo",ix="io.modelcontextprotocol/clientCapabilities",iP="io.modelcontextprotocol/subscriptionId",iE="io.modelcontextprotocol/logLevel",iT=iv(()=>aQ([ah(),az(),aZ(),aV(),a6(ah(),iT),aB(iT)])),ij=a6(ah(),iT),iO=aB(iT),iC=aQ([ah(),az().int()]),iN=ah(),iI=aW({ttl:az().optional()}),iq=aW({taskId:ah()}),iz=aY({progressToken:iC.optional(),"io.modelcontextprotocol/related-task":iq.optional()}),iA=aW({_meta:iz.optional()}),iM=iA.extend({task:iI.optional()}),iL=aW({method:ah(),params:iA.loose().optional()}),iZ=aW({_meta:iz.optional()}),iD=aW({method:ah(),params:iZ.loose().optional()}),iV=aY({get[iR](){return i9.optional().catch(void 0)}}),iU=aY({_meta:iV.optional()}),iF=aQ([ah(),az().int()]),iH=aW({jsonrpc:a7("2.0"),id:iF,...iL.shape}).strict(),iJ=aW({jsonrpc:a7("2.0"),...iD.shape}).strict(),iK=aW({jsonrpc:a7("2.0"),id:iF,result:iU}).strict(),iB=aW({jsonrpc:a7("2.0"),id:iF.optional(),error:aW({code:az().int(),message:ah(),data:aH().optional()})}).strict(),iG=aQ([iH,iJ,iK,iB]),iW=aQ([iK,iB]),iY=iU.strict(),iX=iZ.extend({requestId:iF.optional(),reason:ah().optional()}),iQ=iD.extend({method:a7("notifications/cancelled"),params:iX}),i0=aW({src:ah(),mimeType:ah().optional(),sizes:aB(ah()).optional(),theme:a3(["light","dark"]).optional()}),i1=aW({icons:aB(i0).optional()}),i2=aW({name:ah(),title:ah().optional()}),i9=i2.extend({...i2.shape,...i1.shape,version:ah(),websiteUrl:ah().optional(),description:ah().optional()}),i4=a9(aW({applyDefaults:aZ().optional()}),ij),i6=ib(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a9(aW({form:i4.optional(),url:ij.optional()}),ij.optional())),i5=aY({list:ij.optional(),cancel:ij.optional(),requests:aY({sampling:aY({createMessage:ij.optional()}).optional(),elicitation:aY({create:ij.optional()}).optional()}).optional()}),i3=aY({list:ij.optional(),cancel:ij.optional(),requests:aY({tools:aY({call:ij.optional()}).optional()}).optional()}),i8=aW({experimental:a6(ah(),ij).optional(),sampling:aW({context:ij.optional(),tools:ij.optional()}).optional(),elicitation:i6.optional(),roots:aW({listChanged:aZ().optional()}).optional(),tasks:i5.optional(),extensions:a6(ah(),ij).optional()}),i7=iA.extend({protocolVersion:ah(),capabilities:i8,clientInfo:i9}),ne=iL.extend({method:a7("initialize"),params:i7}),nt=aW({experimental:a6(ah(),ij).optional(),logging:ij.optional(),completions:ij.optional(),prompts:aW({listChanged:aZ().optional()}).optional(),resources:aW({subscribe:aZ().optional(),listChanged:aZ().optional()}).optional(),tools:aW({listChanged:aZ().optional()}).optional(),tasks:i3.optional(),extensions:a6(ah(),ij).optional()}),nr=iU.extend({protocolVersion:ah(),capabilities:nt,serverInfo:i9,instructions:ah().optional()}),na=iD.extend({method:a7("notifications/initialized"),params:iZ.optional()}),ni=iL.extend({method:a7("server/discover"),params:iA.optional()}),nn=iU.extend({supportedVersions:aB(ah()),capabilities:nt,instructions:ah().optional()}),no=iL.extend({method:a7("ping"),params:iA.optional()}),ns=aW({progress:az(),total:ia(az()),message:ia(ah())}),nl=aW({...iZ.shape,...ns.shape,progressToken:iC}),nc=iD.extend({method:a7("notifications/progress"),params:nl}),nu=iA.extend({cursor:iN.optional()}),nd=iL.extend({params:nu.optional()}),np=iU.extend({nextCursor:iN.optional()}),nm=aW({uri:ah(),mimeType:ia(ah()),_meta:a6(ah(),aH()).optional()}),nh=nm.extend({text:ah()}),nf=ah().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ng=nm.extend({blob:nf}),ny=a3(["user","assistant"]),nv=aW({audience:aB(ny).optional(),priority:az().min(0).max(1).optional(),lastModified:r1({offset:!0}).optional()}),n_=aW({...i2.shape,...i1.shape,uri:ah(),description:ia(ah()),mimeType:ia(ah()),size:ia(az()),annotations:nv.optional(),_meta:ia(aY({}))}),nb=aW({...i2.shape,...i1.shape,uriTemplate:ah(),description:ia(ah()),mimeType:ia(ah()),annotations:nv.optional(),_meta:ia(aY({}))}),nS=nd.extend({method:a7("resources/list")}),n$=np.extend({resources:aB(n_)}),nw=nd.extend({method:a7("resources/templates/list")}),nk=np.extend({resourceTemplates:aB(nb)}),nR=iA.extend({uri:ah()}),nx=iL.extend({method:a7("resources/read"),params:nR}),nP=iU.extend({contents:aB(aQ([nh,ng]))}),nE=iD.extend({method:a7("notifications/resources/list_changed"),params:iZ.optional()}),nT=iL.extend({method:a7("resources/subscribe"),params:nR}),nj=iL.extend({method:a7("resources/unsubscribe"),params:nR}),nO=aW({toolsListChanged:aZ().optional(),promptsListChanged:aZ().optional(),resourcesListChanged:aZ().optional(),resourceSubscriptions:aB(ah()).optional()}),nC=iA.extend({notifications:nO}),nN=iL.extend({method:a7("subscriptions/listen"),params:nC}),nI=iZ.extend({notifications:nO}),nq=iD.extend({method:a7("notifications/subscriptions/acknowledged"),params:nI}),nz=iV.extend({[iP]:iF}),nA=iU.extend({_meta:nz}),nM=iZ.extend({uri:ah()}),nL=iD.extend({method:a7("notifications/resources/updated"),params:nM}),nZ=aW({name:ah(),description:ia(ah()),required:ia(aZ())}),nD=aW({...i2.shape,...i1.shape,description:ia(ah()),arguments:ia(aB(nZ)),_meta:ia(aY({}))}),nV=nd.extend({method:a7("prompts/list")}),nU=np.extend({prompts:aB(nD)}),nF=iA.extend({name:ah(),arguments:a6(ah(),ah()).optional()}),nH=iL.extend({method:a7("prompts/get"),params:nF}),nJ=aW({type:a7("text"),text:ah(),annotations:nv.optional(),_meta:a6(ah(),aH()).optional()}),nK=aW({type:a7("image"),data:nf,mimeType:ah(),annotations:nv.optional(),_meta:a6(ah(),aH()).optional()}),nB=aW({type:a7("audio"),data:nf,mimeType:ah(),annotations:nv.optional(),_meta:a6(ah(),aH()).optional()}),nG=aW({type:a7("tool_use"),name:ah(),id:ah(),input:a6(ah(),aH()),_meta:a6(ah(),aH()).optional()}),nW=aW({type:a7("resource"),resource:aQ([nh,ng]),annotations:nv.optional(),_meta:a6(ah(),aH()).optional()}),nY=n_.extend({type:a7("resource_link")}),nX=aQ([nJ,nK,nB,nY,nW]),nQ=aW({role:ny,content:nX}),n0=iU.extend({description:ah().optional(),messages:aB(nQ)}),n1=iD.extend({method:a7("notifications/prompts/list_changed"),params:iZ.optional()}),n2=aW({title:ah().optional(),readOnlyHint:aZ().optional(),destructiveHint:aZ().optional(),idempotentHint:aZ().optional(),openWorldHint:aZ().optional()}),n9=aW({taskSupport:a3(["required","optional","forbidden"]).optional()}),n4=aW({...i2.shape,...i1.shape,description:ah().optional(),inputSchema:aW({type:a7("object"),properties:a6(ah(),iT).optional(),required:aB(ah()).optional()}).catchall(aH()),outputSchema:aY({$schema:ah().optional()}).optional(),annotations:n2.optional(),execution:n9.optional(),_meta:a6(ah(),aH()).optional()}),n6=nd.extend({method:a7("tools/list")}),n5=np.extend({tools:aB(n4)}),n3=iU.extend({content:aB(nX).default([]),structuredContent:aH().optional(),isError:aZ().optional()}),n8=n3.or(iU.extend({toolResult:aH()})),n7=iM.extend({name:ah(),arguments:a6(ah(),aH()).optional()}),oe=iL.extend({method:a7("tools/call"),params:n7}),ot=iD.extend({method:a7("notifications/tools/list_changed"),params:iZ.optional()}),or=aW({autoRefresh:aZ().default(!0),debounceMs:az().int().nonnegative().default(300)}),oa=a3(["debug","info","notice","warning","error","critical","alert","emergency"]),oi=iA.extend({level:oa}),on=iL.extend({method:a7("logging/setLevel"),params:oi}),oo=iZ.extend({level:oa,logger:ah().optional(),data:aH()}),os=iD.extend({method:a7("notifications/message"),params:oo}),ol=aW({name:ah().optional()}),oc=aW({hints:aB(ol).optional(),costPriority:az().min(0).max(1).optional(),speedPriority:az().min(0).max(1).optional(),intelligencePriority:az().min(0).max(1).optional()}),ou=aW({mode:a3(["auto","required","none"]).optional()}),od=aW({type:a7("tool_result"),toolUseId:ah().describe("The unique identifier for the corresponding tool call."),content:aB(nX),structuredContent:aH().optional(),isError:aZ().optional(),_meta:a6(ah(),aH()).optional()}),op=a1("type",[nJ,nK,nB]),om=a1("type",[nJ,nK,nB,nG,od]),oh=aW({role:ny,content:aQ([om,aB(om)]),_meta:a6(ah(),aH()).optional()}),of=iM.extend({messages:aB(oh),modelPreferences:oc.optional(),systemPrompt:ah().optional(),includeContext:a3(["none","thisServer","allServers"]).optional(),temperature:az().optional(),maxTokens:az().int(),stopSequences:aB(ah()).optional(),metadata:ij.optional(),tools:aB(n4).optional(),toolChoice:ou.optional()}),og=iL.extend({method:a7("sampling/createMessage"),params:of}),oy=iU.extend({model:ah(),stopReason:ia(a3(["endTurn","stopSequence","maxTokens"]).or(ah())),role:ny,content:op}),ov=iU.extend({model:ah(),stopReason:ia(a3(["endTurn","stopSequence","maxTokens","toolUse"]).or(ah())),role:ny,content:aQ([om,aB(om)])}),o_=aW({type:a7("boolean"),title:ah().optional(),description:ah().optional(),default:aZ().optional()}),ob=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),minLength:az().optional(),maxLength:az().optional(),format:a3(["email","uri","date","date-time"]).optional(),default:ah().optional()}),oS=aW({type:a3(["number","integer"]),title:ah().optional(),description:ah().optional(),minimum:az().optional(),maximum:az().optional(),default:az().optional()}),o$=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),enum:aB(ah()),default:ah().optional()}),ow=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),oneOf:aB(aW({const:ah(),title:ah()})),default:ah().optional()}),ok=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),enum:aB(ah()),enumNames:aB(ah()).optional(),default:ah().optional()}),oR=aQ([o$,ow]),ox=aW({type:a7("array"),title:ah().optional(),description:ah().optional(),minItems:az().optional(),maxItems:az().optional(),items:aW({type:a7("string"),enum:aB(ah())}),default:aB(ah()).optional()}),oP=aW({type:a7("array"),title:ah().optional(),description:ah().optional(),minItems:az().optional(),maxItems:az().optional(),items:aW({anyOf:aB(aW({const:ah(),title:ah()}))}),default:aB(ah()).optional()}),oE=aQ([ox,oP]),oT=aQ([ok,oR,oE]),oj=aQ([oT,o_,ob,oS]),oO=iM.extend({mode:a7("form").optional(),message:ah(),requestedSchema:aW({type:a7("object"),properties:a6(ah(),oj),required:aB(ah()).optional()}).catchall(aH())}),oC=iM.extend({mode:a7("url"),message:ah(),elicitationId:ah(),url:ah().url()}),oN=aQ([oO,oC]),oI=iL.extend({method:a7("elicitation/create"),params:oN}),oq=iZ.extend({elicitationId:ah()}),oz=iD.extend({method:a7("notifications/elicitation/complete"),params:oq}),oA=iU.extend({action:a3(["accept","decline","cancel"]),content:ib(e=>null===e?void 0:e,a6(ah(),aQ([ah(),az(),aZ(),aB(ah())])).optional())}),oM=aW({type:a7("ref/resource"),uri:ah()}),oL=aW({type:a7("ref/prompt"),name:ah()}),oZ=iA.extend({ref:aQ([oL,oM]),argument:aW({name:ah(),value:ah()}),context:aW({arguments:a6(ah(),ah()).optional()}).optional()}),oD=iL.extend({method:a7("completion/complete"),params:oZ}),oV=iU.extend({completion:aY({values:aB(ah()).max(100),total:ia(az().int()),hasMore:ia(aZ())})}),oU=aW({uri:ah().startsWith("file://"),name:ah().optional(),_meta:a6(ah(),aH()).optional()}),oF=iL.extend({method:a7("roots/list"),params:iA.optional()}),oH=iU.extend({roots:aB(oU)}),oJ=iD.extend({method:a7("notifications/roots/list_changed"),params:iZ.optional()}),oK=aY({ttl:az().optional(),pollInterval:az().optional()}),oB=a3(["working","input_required","completed","failed","cancelled"]),oG=aW({taskId:ah(),status:oB,ttl:aQ([az(),aV()]),createdAt:ah(),lastUpdatedAt:ah(),pollInterval:ia(az()),statusMessage:ia(ah())}),oW=iU.extend({task:oG}),oY=iZ.merge(oG),oX=iD.extend({method:a7("notifications/tasks/status"),params:oY}),oQ=iL.extend({method:a7("tasks/get"),params:iA.extend({taskId:ah()})}),o0=iU.merge(oG),o1=iL.extend({method:a7("tasks/result"),params:iA.extend({taskId:ah()})}),o2=iU.loose(),o9=nd.extend({method:a7("tasks/list")}),o4=np.extend({tasks:aB(oG)}),o6=iL.extend({method:a7("tasks/cancel"),params:iA.extend({taskId:ah()})}),o5=iU.merge(oG),o3=aQ([no,ne,ni,oD,on,nH,nV,nS,nw,nx,nT,nj,nN,oe,n6]),o8=aQ([iQ,nc,na,oJ]),o7=aQ([iY,oy,ov,oA,oH]),se=aQ([no,og,oI,oF]),st=aQ([iQ,nc,os,nL,nE,ot,n1,nq,oz]),sr=aQ([iY,nr,nn,oV,n0,nU,n$,nk,nP,n3,n5,nA]),sa=rd(a_,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),z}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),si=aY({resource:ah().url(),authorization_servers:aB(sa).optional(),jwks_uri:ah().url().optional(),scopes_supported:aB(ah()).optional(),bearer_methods_supported:aB(ah()).optional(),resource_signing_alg_values_supported:aB(ah()).optional(),resource_name:ah().optional(),resource_documentation:ah().optional(),resource_policy_uri:ah().url().optional(),resource_tos_uri:ah().url().optional(),tls_client_certificate_bound_access_tokens:aZ().optional(),authorization_details_types_supported:aB(ah()).optional(),dpop_signing_alg_values_supported:aB(ah()).optional(),dpop_bound_access_tokens_required:aZ().optional()}),sn=aY({issuer:ah(),authorization_endpoint:sa,token_endpoint:sa,registration_endpoint:sa.optional(),scopes_supported:aB(ah()).optional(),response_types_supported:aB(ah()),response_modes_supported:aB(ah()).optional(),grant_types_supported:aB(ah()).optional(),token_endpoint_auth_methods_supported:aB(ah()).optional(),token_endpoint_auth_signing_alg_values_supported:aB(ah()).optional(),service_documentation:sa.optional(),revocation_endpoint:sa.optional(),revocation_endpoint_auth_methods_supported:aB(ah()).optional(),revocation_endpoint_auth_signing_alg_values_supported:aB(ah()).optional(),introspection_endpoint:ah().optional(),introspection_endpoint_auth_methods_supported:aB(ah()).optional(),introspection_endpoint_auth_signing_alg_values_supported:aB(ah()).optional(),code_challenge_methods_supported:aB(ah()).optional(),client_id_metadata_document_supported:aZ().optional(),authorization_response_iss_parameter_supported:aZ().optional().catch(void 0)}),so=aY({issuer:ah(),authorization_endpoint:sa,token_endpoint:sa,userinfo_endpoint:sa.optional(),jwks_uri:sa,registration_endpoint:sa.optional(),scopes_supported:aB(ah()).optional(),response_types_supported:aB(ah()),response_modes_supported:aB(ah()).optional(),grant_types_supported:aB(ah()).optional(),acr_values_supported:aB(ah()).optional(),subject_types_supported:aB(ah()),id_token_signing_alg_values_supported:aB(ah()),id_token_encryption_alg_values_supported:aB(ah()).optional(),id_token_encryption_enc_values_supported:aB(ah()).optional(),userinfo_signing_alg_values_supported:aB(ah()).optional(),userinfo_encryption_alg_values_supported:aB(ah()).optional(),userinfo_encryption_enc_values_supported:aB(ah()).optional(),request_object_signing_alg_values_supported:aB(ah()).optional(),request_object_encryption_alg_values_supported:aB(ah()).optional(),request_object_encryption_enc_values_supported:aB(ah()).optional(),token_endpoint_auth_methods_supported:aB(ah()).optional(),token_endpoint_auth_signing_alg_values_supported:aB(ah()).optional(),display_values_supported:aB(ah()).optional(),claim_types_supported:aB(ah()).optional(),claims_supported:aB(ah()).optional(),service_documentation:ah().optional(),claims_locales_supported:aB(ah()).optional(),ui_locales_supported:aB(ah()).optional(),claims_parameter_supported:aZ().optional(),request_parameter_supported:aZ().optional(),request_uri_parameter_supported:aZ().optional(),require_request_uri_registration:aZ().optional(),op_policy_uri:sa.optional(),op_tos_uri:sa.optional(),client_id_metadata_document_supported:aZ().optional(),authorization_response_iss_parameter_supported:aZ().optional().catch(void 0)}),ss=aW({...so.shape,...sn.pick({code_challenge_methods_supported:!0}).shape}),sl=aW({access_token:ah(),id_token:ah().optional(),token_type:ah(),expires_in:new aq({type:"number",coerce:!0,checks:[],...eC(void 0)}).optional(),scope:ah().optional(),refresh_token:ah().optional()}).strip(),sc=aW({issued_token_type:a7("urn:ietf:params:oauth:token-type:id-jag"),access_token:ah(),token_type:ah().optional(),expires_in:az().optional(),scope:ah().optional()}).strip(),su=aW({error:ah(),error_description:ah().optional(),error_uri:ah().optional()}),sd=sa.optional().or(a7("").transform(()=>void 0)),sp=aW({redirect_uris:aB(sa),token_endpoint_auth_method:ah().optional(),grant_types:aB(ah()).optional(),response_types:aB(ah()).optional(),application_type:ah().optional(),client_name:ah().optional(),client_uri:sa.optional(),logo_uri:sd,scope:ah().optional(),contacts:aB(ah()).optional(),tos_uri:sd,policy_uri:ah().optional(),jwks_uri:sa.optional(),jwks:new aU({type:"any"}).optional(),software_id:ah().optional(),software_version:ah().optional(),software_statement:ah().optional()}).strip(),sm=aW({client_id:ah(),client_secret:ah().optional(),client_id_issued_at:az().optional(),client_secret_expires_at:az().optional()}).strip(),sh=sp.merge(sm),sf=aW({error:ah(),error_description:ah().optional()}).strip(),sg=aW({token:ah(),token_type_hint:ah().optional()}).strip(),sy=Symbol.for("mcp.sdk.errorBrands");function sv(e,t){let r=new Set,a=t;for(;"function"==typeof a;){let e=a.mcpBrand;Object.prototype.hasOwnProperty.call(a,"mcpBrand")&&"string"==typeof e&&r.add(e),a=Object.getPrototypeOf(a)}0!==r.size&&Object.defineProperty(e,sy,{value:r,enumerable:!1,configurable:!0})}function s_(e,t){try{if("object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&"string"==typeof e.mcpBrand&&Object.prototype.hasOwnProperty.call(t,sy)){let r=t[sy];if(r&&"function"==typeof r.has&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](e){return s_(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return s_(this,e)}constructor(e,t,r){super(t),this.code=e,this.errorUri=r,this.name="OAuthError",sv(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});let sb=((p={}).NotConnected="NOT_CONNECTED",p.AlreadyConnected="ALREADY_CONNECTED",p.NotInitialized="NOT_INITIALIZED",p.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",p.RequestTimeout="REQUEST_TIMEOUT",p.ConnectionClosed="CONNECTION_CLOSED",p.SendFailed="SEND_FAILED",p.InvalidResult="INVALID_RESULT",p.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",p.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",p.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",p.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",p.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",p.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",p.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",p.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",p.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",p.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",p.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",p);var sS=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return s_(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return s_(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",sv(this,new.target)}};function s$(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function sw(e,t){let r={};for(let[a,i]of Object.entries(e)){if(void 0===i)continue;let e=void 0===t?void 0:t[a];if(void 0===e){r[a]=i;continue}if(s$(i)&&s$(e)){let t={};for(let[r,n]of Object.entries(i))void 0!==n&&void 0===e[r]&&("elicitation"!==a||"form"!==r||void 0!==e.form||void 0!==e.url)&&(t[r]=n);Object.keys(t).length>0&&(r[a]=t)}}return Object.keys(r).length>0?r:void 0}(class extends sS{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}});let sk="2026-07-28",sR=[sk];function sx(e){return e.filter(e=>e>=sk)}function sP(e){let t=e.structuredContent;return void 0===t||!("object"!=typeof t||null===t||Array.isArray(t))||e.content?.some(e=>"text"===e.type)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}let sE=["task","inputRequests","requestState"];function sT(e){return null===e||"object"!=typeof e||Array.isArray(e)||void 0!==e.content||sE.some(t=>t in e)?e:{...e,content:[]}}function sj(){let t,r,a,i,n,o,s,l,c,u,d,p,m,h,f,g,y,v,_,b,S,$,w,k,R,x,P,E,T,j,O,C,N,I,q,z,A,M,L,Z,D,V,U,F,H,J,K,B,G,W,Y,X,Q,ee,et,er,ea,ei,en,eo,es,el,ec,eu,ed,ep,em,eh,ef,eg,ey,ev,e_,eb,eS,e$,ew,ek,eR,ex,eP,eE,eT,ej,eO,eC,eN,eI,eq,ez,eA,eM,eL,eZ,eD,eV,eU,eF,eH,eJ,eK,eB,eG,eW,eY,eX,eQ,e0,e1,e2,e9,e4,e6,e5,e3,e8,e7,te,tt,tr,ta,ti,tn,to,ts,tl,tc,tu,td,tp,tm,th,tf,tg,ty,tv,t_,tb,tS,t$;return e??=(t=iv(()=>aQ([ah(),az(),aZ(),aV(),a6(ah(),t),aB(t)])),r=a6(ah(),t),a=aQ([ah(),az().int()]),i=ah(),n=aW({ttl:az().optional()}),o=aW({taskId:ah()}),c=(l=aW({_meta:(s=aY({progressToken:a.optional(),"io.modelcontextprotocol/related-task":o.optional()})).optional()})).extend({task:n.optional()}),u=aW({method:ah(),params:l.loose().optional()}),d=aW({_meta:s.optional()}),p=aW({method:ah(),params:d.loose().optional()}),m=aY({_meta:s.optional()}),h=aQ([ah(),az().int()]),f=m.strict(),g=d.extend({requestId:h.optional(),reason:ah().optional()}),y=p.extend({method:a7("notifications/cancelled"),params:g}),v=aW({src:ah(),mimeType:ah().optional(),sizes:aB(ah()).optional(),theme:a3(["light","dark"]).optional()}),_=aW({icons:aB(v).optional()}),S=(b=aW({name:ah(),title:ah().optional()})).extend({...b.shape,..._.shape,version:ah(),websiteUrl:ah().optional(),description:ah().optional()}),$=a9(aW({applyDefaults:aZ().optional()}),r),w=ib(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a9(aW({form:$.optional(),url:r.optional()}),r.optional())),k=aY({list:r.optional(),cancel:r.optional(),requests:aY({sampling:aY({createMessage:r.optional()}).optional(),elicitation:aY({create:r.optional()}).optional()}).optional()}),R=aY({list:r.optional(),cancel:r.optional(),requests:aY({tools:aY({call:r.optional()}).optional()}).optional()}),x=aW({experimental:a6(ah(),r).optional(),sampling:aW({context:r.optional(),tools:r.optional()}).optional(),elicitation:w.optional(),roots:aW({listChanged:aZ().optional()}).optional(),tasks:k.optional(),extensions:a6(ah(),r).optional()}),P=l.extend({protocolVersion:ah(),capabilities:x,clientInfo:S}),E=u.extend({method:a7("initialize"),params:P}),T=aW({experimental:a6(ah(),r).optional(),logging:r.optional(),completions:r.optional(),prompts:aW({listChanged:aZ().optional()}).optional(),resources:aW({subscribe:aZ().optional(),listChanged:aZ().optional()}).optional(),tools:aW({listChanged:aZ().optional()}).optional(),tasks:R.optional(),extensions:a6(ah(),r).optional()}),j=m.extend({protocolVersion:ah(),capabilities:T,serverInfo:S,instructions:ah().optional()}),O=p.extend({method:a7("notifications/initialized"),params:d.optional()}),C=u.extend({method:a7("ping"),params:l.optional()}),N=aW({progress:az(),total:ia(az()),message:ia(ah())}),I=aW({...d.shape,...N.shape,progressToken:a}),q=p.extend({method:a7("notifications/progress"),params:I}),z=l.extend({cursor:i.optional()}),A=u.extend({params:z.optional()}),M=m.extend({nextCursor:i.optional()}),Z=(L=aW({uri:ah(),mimeType:ia(ah()),_meta:a6(ah(),aH()).optional()})).extend({text:ah()}),D=ah().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),V=L.extend({blob:D}),F=aW({audience:aB(U=a3(["user","assistant"])).optional(),priority:az().min(0).max(1).optional(),lastModified:r1({offset:!0}).optional()}),H=aW({...b.shape,..._.shape,uri:ah(),description:ia(ah()),mimeType:ia(ah()),size:ia(az()),annotations:F.optional(),_meta:ia(aY({}))}),J=aW({...b.shape,..._.shape,uriTemplate:ah(),description:ia(ah()),mimeType:ia(ah()),annotations:F.optional(),_meta:ia(aY({}))}),K=A.extend({method:a7("resources/list")}),B=M.extend({resources:aB(H)}),G=A.extend({method:a7("resources/templates/list")}),W=M.extend({resourceTemplates:aB(J)}),Y=l.extend({uri:ah()}),X=u.extend({method:a7("resources/read"),params:Y}),Q=m.extend({contents:aB(aQ([Z,V]))}),ee=p.extend({method:a7("notifications/resources/list_changed"),params:d.optional()}),et=u.extend({method:a7("resources/subscribe"),params:Y}),er=u.extend({method:a7("resources/unsubscribe"),params:Y}),ea=d.extend({uri:ah()}),ei=p.extend({method:a7("notifications/resources/updated"),params:ea}),en=aW({name:ah(),description:ia(ah()),required:ia(aZ())}),eo=aW({...b.shape,..._.shape,description:ia(ah()),arguments:ia(aB(en)),_meta:ia(aY({}))}),es=A.extend({method:a7("prompts/list")}),el=M.extend({prompts:aB(eo)}),ec=l.extend({name:ah(),arguments:a6(ah(),ah()).optional()}),eu=u.extend({method:a7("prompts/get"),params:ec}),ed=aW({type:a7("text"),text:ah(),annotations:F.optional(),_meta:a6(ah(),aH()).optional()}),ep=aW({type:a7("image"),data:D,mimeType:ah(),annotations:F.optional(),_meta:a6(ah(),aH()).optional()}),em=aW({type:a7("audio"),data:D,mimeType:ah(),annotations:F.optional(),_meta:a6(ah(),aH()).optional()}),eh=aW({type:a7("tool_use"),name:ah(),id:ah(),input:a6(ah(),aH()),_meta:a6(ah(),aH()).optional()}),ef=aW({type:a7("resource"),resource:aQ([Z,V]),annotations:F.optional(),_meta:a6(ah(),aH()).optional()}),ev=aW({role:U,content:ey=aQ([ed,ep,em,eg=H.extend({type:a7("resource_link")}),ef])}),e_=m.extend({description:ah().optional(),messages:aB(ev)}),eb=p.extend({method:a7("notifications/prompts/list_changed"),params:d.optional()}),eS=aW({title:ah().optional(),readOnlyHint:aZ().optional(),destructiveHint:aZ().optional(),idempotentHint:aZ().optional(),openWorldHint:aZ().optional()}),e$=aW({taskSupport:a3(["required","optional","forbidden"]).optional()}),ew=aW({...b.shape,..._.shape,description:ah().optional(),inputSchema:aW({type:a7("object"),properties:a6(ah(),t).optional(),required:aB(ah()).optional()}).catchall(aH()),outputSchema:aW({type:a7("object"),properties:a6(ah(),t).optional(),required:aB(ah()).optional()}).catchall(aH()).optional(),annotations:eS.optional(),execution:e$.optional(),_meta:a6(ah(),aH()).optional()}),ek=A.extend({method:a7("tools/list")}),eR=M.extend({tools:aB(ew)}),ex=m.extend({content:aB(ey),structuredContent:a6(ah(),aH()).optional(),isError:aZ().optional()}),eP=c.extend({name:ah(),arguments:a6(ah(),aH()).optional()}),eE=u.extend({method:a7("tools/call"),params:eP}),eT=p.extend({method:a7("notifications/tools/list_changed"),params:d.optional()}),ej=a3(["debug","info","notice","warning","error","critical","alert","emergency"]),eO=l.extend({level:ej}),eC=u.extend({method:a7("logging/setLevel"),params:eO}),eN=d.extend({level:ej,logger:ah().optional(),data:aH()}),eI=p.extend({method:a7("notifications/message"),params:eN}),eq=aW({name:ah().optional()}),ez=aW({hints:aB(eq).optional(),costPriority:az().min(0).max(1).optional(),speedPriority:az().min(0).max(1).optional(),intelligencePriority:az().min(0).max(1).optional()}),eA=aW({mode:a3(["auto","required","none"]).optional()}),eM=aW({type:a7("tool_result"),toolUseId:ah().describe("The unique identifier for the corresponding tool call."),content:aB(ey),structuredContent:aW({}).loose().optional(),isError:aZ().optional(),_meta:a6(ah(),aH()).optional()}),eL=a1("type",[ed,ep,em]),eD=aW({role:U,content:aQ([eZ=a1("type",[ed,ep,em,eh,eM]),aB(eZ)]),_meta:a6(ah(),aH()).optional()}),eV=c.extend({messages:aB(eD),modelPreferences:ez.optional(),systemPrompt:ah().optional(),includeContext:a3(["none","thisServer","allServers"]).optional(),temperature:az().optional(),maxTokens:az().int(),stopSequences:aB(ah()).optional(),metadata:r.optional(),tools:aB(ew).optional(),toolChoice:eA.optional()}),eU=u.extend({method:a7("sampling/createMessage"),params:eV}),eF=m.extend({model:ah(),stopReason:ia(a3(["endTurn","stopSequence","maxTokens"]).or(ah())),role:U,content:eL}),eH=m.extend({model:ah(),stopReason:ia(a3(["endTurn","stopSequence","maxTokens","toolUse"]).or(ah())),role:U,content:aQ([eZ,aB(eZ)])}),eJ=aW({type:a7("boolean"),title:ah().optional(),description:ah().optional(),default:aZ().optional()}),eK=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),minLength:az().optional(),maxLength:az().optional(),format:a3(["email","uri","date","date-time"]).optional(),default:ah().optional()}),eB=aW({type:a3(["number","integer"]),title:ah().optional(),description:ah().optional(),minimum:az().optional(),maximum:az().optional(),default:az().optional()}),eG=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),enum:aB(ah()),default:ah().optional()}),eW=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),oneOf:aB(aW({const:ah(),title:ah()})),default:ah().optional()}),eY=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),enum:aB(ah()),enumNames:aB(ah()).optional(),default:ah().optional()}),eX=aQ([eG,eW]),eQ=aW({type:a7("array"),title:ah().optional(),description:ah().optional(),minItems:az().optional(),maxItems:az().optional(),items:aW({type:a7("string"),enum:aB(ah())}),default:aB(ah()).optional()}),e1=aQ([eQ,e0=aW({type:a7("array"),title:ah().optional(),description:ah().optional(),minItems:az().optional(),maxItems:az().optional(),items:aW({anyOf:aB(aW({const:ah(),title:ah()}))}),default:aB(ah()).optional()})]),e2=aQ([eY,eX,e1]),e9=aQ([e2,eJ,eK,eB]),e4=c.extend({mode:a7("form").optional(),message:ah(),requestedSchema:aW({type:a7("object"),properties:a6(ah(),e9),required:aB(ah()).optional()}).catchall(aH())}),e5=aQ([e4,e6=c.extend({mode:a7("url"),message:ah(),elicitationId:ah(),url:ah().url()})]),e3=u.extend({method:a7("elicitation/create"),params:e5}),e8=d.extend({elicitationId:ah()}),e7=p.extend({method:a7("notifications/elicitation/complete"),params:e8}),te=m.extend({action:a3(["accept","decline","cancel"]),content:ib(e=>null===e?void 0:e,a6(ah(),aQ([ah(),az(),aZ(),aB(ah())])).optional())}),tt=aW({type:a7("ref/resource"),uri:ah()}),tr=aW({type:a7("ref/prompt"),name:ah()}),ta=l.extend({ref:aQ([tr,tt]),argument:aW({name:ah(),value:ah()}),context:aW({arguments:a6(ah(),ah()).optional()}).optional()}),ti=u.extend({method:a7("completion/complete"),params:ta}),tn=m.extend({completion:aY({values:aB(ah()).max(100),total:ia(az().int()),hasMore:ia(aZ())})}),to=aW({uri:ah().startsWith("file://"),name:ah().optional(),_meta:a6(ah(),aH()).optional()}),ts=u.extend({method:a7("roots/list"),params:l.optional()}),tl=m.extend({roots:aB(to)}),tc=p.extend({method:a7("notifications/roots/list_changed"),params:d.optional()}),tu=aY({ttl:az().optional(),pollInterval:az().optional()}),td=a3(["working","input_required","completed","failed","cancelled"]),tp=aW({taskId:ah(),status:td,ttl:aQ([az(),aV()]),createdAt:ah(),lastUpdatedAt:ah(),pollInterval:ia(az()),statusMessage:ia(ah())}),tm=m.extend({task:tp}),th=d.merge(tp),tf=p.extend({method:a7("notifications/tasks/status"),params:th}),tg=u.extend({method:a7("tasks/get"),params:l.extend({taskId:ah()})}),ty=m.merge(tp),tv=u.extend({method:a7("tasks/result"),params:l.extend({taskId:ah()})}),t_=m.loose(),tb=A.extend({method:a7("tasks/list")}),tS=M.extend({tasks:aB(tp)}),t$=u.extend({method:a7("tasks/cancel"),params:l.extend({taskId:ah()})}),{JSONValueSchema:t,JSONObjectSchema:r,ProgressTokenSchema:a,CursorSchema:i,TaskMetadataSchema:n,RelatedTaskMetadataSchema:o,RequestMetaSchema:s,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:m,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:y,IconSchema:v,IconsSchema:_,BaseMetadataSchema:b,ImplementationSchema:S,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:x,InitializeRequestParamsSchema:P,InitializeRequestSchema:E,ServerCapabilitiesSchema:T,InitializeResultSchema:j,InitializedNotificationSchema:O,PingRequestSchema:C,ProgressSchema:N,ProgressNotificationParamsSchema:I,ProgressNotificationSchema:q,PaginatedRequestParamsSchema:z,PaginatedRequestSchema:A,PaginatedResultSchema:M,ResourceContentsSchema:L,TextResourceContentsSchema:Z,BlobResourceContentsSchema:V,RoleSchema:U,AnnotationsSchema:F,ResourceSchema:H,ResourceTemplateSchema:J,ListResourcesRequestSchema:K,ListResourcesResultSchema:B,ListResourceTemplatesRequestSchema:G,ListResourceTemplatesResultSchema:W,ResourceRequestParamsSchema:Y,ReadResourceRequestParamsSchema:Y,ReadResourceRequestSchema:X,ReadResourceResultSchema:Q,ResourceListChangedNotificationSchema:ee,SubscribeRequestParamsSchema:Y,SubscribeRequestSchema:et,UnsubscribeRequestParamsSchema:Y,UnsubscribeRequestSchema:er,ResourceUpdatedNotificationParamsSchema:ea,ResourceUpdatedNotificationSchema:ei,PromptArgumentSchema:en,PromptSchema:eo,ListPromptsRequestSchema:es,ListPromptsResultSchema:el,GetPromptRequestParamsSchema:ec,GetPromptRequestSchema:eu,TextContentSchema:ed,ImageContentSchema:ep,AudioContentSchema:em,ToolUseContentSchema:eh,EmbeddedResourceSchema:ef,ResourceLinkSchema:eg,ContentBlockSchema:ey,PromptMessageSchema:ev,GetPromptResultSchema:e_,PromptListChangedNotificationSchema:eb,ToolAnnotationsSchema:eS,ToolExecutionSchema:e$,ToolSchema:ew,ListToolsRequestSchema:ek,ListToolsResultSchema:eR,CallToolResultSchema:ex,CallToolRequestParamsSchema:eP,CallToolRequestSchema:eE,ToolListChangedNotificationSchema:eT,LoggingLevelSchema:ej,SetLevelRequestParamsSchema:eO,SetLevelRequestSchema:eC,LoggingMessageNotificationParamsSchema:eN,LoggingMessageNotificationSchema:eI,ModelHintSchema:eq,ModelPreferencesSchema:ez,ToolChoiceSchema:eA,ToolResultContentSchema:eM,SamplingContentSchema:eL,SamplingMessageContentBlockSchema:eZ,SamplingMessageSchema:eD,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eU,CreateMessageResultSchema:eF,CreateMessageResultWithToolsSchema:eH,BooleanSchemaSchema:eJ,StringSchemaSchema:eK,NumberSchemaSchema:eB,UntitledSingleSelectEnumSchemaSchema:eG,TitledSingleSelectEnumSchemaSchema:eW,LegacyTitledEnumSchemaSchema:eY,SingleSelectEnumSchemaSchema:eX,UntitledMultiSelectEnumSchemaSchema:eQ,TitledMultiSelectEnumSchemaSchema:e0,MultiSelectEnumSchemaSchema:e1,EnumSchemaSchema:e2,PrimitiveSchemaDefinitionSchema:e9,ElicitRequestFormParamsSchema:e4,ElicitRequestURLParamsSchema:e6,ElicitRequestParamsSchema:e5,ElicitRequestSchema:e3,ElicitationCompleteNotificationParamsSchema:e8,ElicitationCompleteNotificationSchema:e7,ElicitResultSchema:te,ResourceTemplateReferenceSchema:tt,PromptReferenceSchema:tr,CompleteRequestParamsSchema:ta,CompleteRequestSchema:ti,CompleteResultSchema:tn,RootSchema:to,ListRootsRequestSchema:ts,ListRootsResultSchema:tl,RootsListChangedNotificationSchema:tc,TaskCreationParamsSchema:tu,TaskStatusSchema:td,TaskSchema:tp,CreateTaskResultSchema:tm,TaskStatusNotificationParamsSchema:th,TaskStatusNotificationSchema:tf,GetTaskRequestSchema:tg,GetTaskResultSchema:ty,GetTaskPayloadRequestSchema:tv,GetTaskPayloadResultSchema:t_,ListTasksRequestSchema:tb,ListTasksResultSchema:tS,CancelTaskRequestSchema:t$,CancelTaskResultSchema:m.merge(tp),ClientRequestSchema:aQ([C,E,ti,eC,eu,es,K,G,X,et,er,eE,ek,tg,tv,tb,t$]),ClientNotificationSchema:aQ([y,q,O,tc,tf]),ClientResultSchema:aQ([f,eF,eH,te,tl,ty,tS,tm]),ServerRequestSchema:aQ([C,eU,e3,ts,tg,tv,tb,t$]),ServerNotificationSchema:aQ([y,q,eI,ei,ee,eT,eb,tf,e7]),ServerResultSchema:aQ([f,j,tn,e_,el,B,W,Q,ex,eR,ty,tS,tm]),CallToolResultWireSchema:aH().superRefine((e,t)=>{if(!("object"!=typeof e||null===e||Array.isArray(e))&&void 0===e.content){for(let r of sE)if(r in e)return void t.addIssue({code:"custom",message:`content is required when the body carries '${r}' — another result family cannot default into an empty tools/call success`})}}).transform(sT).pipe(ex)})}function sO(e){return"object"!==e.type}let sC=new Set(["const","enum","default","examples"]),sN=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function sI(e){return void 0!==e&&!("string"==typeof e&&e.startsWith("#"))}let sq={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},sz={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},sA={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};function sM(){if(t)return t;let e=sj();return t={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}}}function sL(e){return Object.prototype.hasOwnProperty.call(sq,e)}function sZ(e){return Object.prototype.hasOwnProperty.call(sz,e)}function sD(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function sV(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(sq),Object.keys(sz);let sU={ok:!1,reason:"not-in-era"};function sF(e){return sD(e)&&sD(e.outputSchema)&&sO(e.outputSchema)}let sH={era:"2025-11-25",hasRequestMethod:sL,hasNotificationMethod:sZ,validateRequest:(e,t)=>sV(sL(e)?sM().requestSchemas[e]:void 0,t),validateResult:(e,t)=>sV(Object.prototype.hasOwnProperty.call(sA,e)?sM().resultSchemas[e]:void 0,t),validateNotification:(e,t)=>sV(sZ(e)?sM().notificationSchemas[e]:void 0,t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>sU,validateInputResponse:()=>sU,samplingResultVariant:(e,t)=>{let r=sj();return sV(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=sP(e),a=r.structuredContent;if(void 0===a)return r;let i="object"!=typeof a||null===a||Array.isArray(a),n=void 0!==t&&sO(t);return i||n?{...r,structuredContent:{result:a}}:r},decodeResult(e,t){if(sD(t)&&"resultType"in t){let e={...t};return delete e.resultType,{kind:"complete",result:e}}return{kind:"complete",result:t}},encodeResult(e,t){if("tools/list"!==e)return t;let r=t.tools;return Array.isArray(r)&&r.some(e=>sF(e))?{...t,tools:r.map(e=>sF(e)?{...e,outputSchema:function(e){var t;let r="string"==typeof e.$schema?e.$schema:void 0;if(sI(e.$id))return{...void 0!==r&&{$schema:r},type:"object",properties:{result:e},required:["result"]};let a="string"==typeof(t=e.$schema)&&N.has(t.replace(/#$/,""))&&!0!==e.$recursiveAnchor,i=(e,t)=>{if(Array.isArray(e))return e.map(e=>i(e,!1));if(null===e||"object"!=typeof e||!t&&sI(e.$id))return e;let r={},n=!1;for(let[o,s]of Object.entries(e))t?r[o]=i(s,!1):("$ref"===o||"$dynamicRef"===o)&&"string"==typeof s?r[o]="#"===s?"#/properties/result":s.startsWith("#/")?`#/properties/result${s.slice(1)}`:s:"$recursiveRef"===o&&"#"===s&&a?n=!0:sC.has(o)?r[o]=s:sN.has(o)?r[o]=i(s,!0):r[o]=i(s,!1);return n&&("$ref"in r?r.allOf=[...Array.isArray(r.allOf)?r.allOf:[],{$ref:"#/properties/result"}]:r.$ref="#/properties/result"),r};return{...void 0!==r&&{$schema:r},type:"object",properties:{result:i(e,!1)},required:["result"]}}(e.outputSchema)}:e)}:t},encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope:e=>void 0};function sJ(){return a??=function(){let e=iv(()=>aQ([ah(),az(),aZ(),aV(),a6(ah(),e),aB(e)])),t=a6(ah(),e),r=aQ([ah(),az().int()]),a=ah(),i=aQ([ah(),az().int()]),n=a3(["user","assistant"]),o=a3(["debug","info","notice","warning","error","critical","alert","emergency"]),s=ah().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=aW({ttl:az().optional()}),c=aW({taskId:ah()}),u=aY({progressToken:r.optional(),"io.modelcontextprotocol/related-task":c.optional()}),d=aW({_meta:u.optional()}),p=d.extend({task:l.optional()}),m=aW({_meta:u.optional()}),h=aW({method:ah(),params:m.loose().optional()}),f=aW({src:ah(),mimeType:ah().optional(),sizes:aB(ah()).optional(),theme:a3(["light","dark"]).optional()}),g=aW({icons:aB(f).optional()}),y=aW({name:ah(),title:ah().optional()}),v=y.extend({...y.shape,...g.shape,version:ah(),websiteUrl:ah().optional(),description:ah().optional()}),_=a9(aW({applyDefaults:aZ().optional()}),t),b=ib(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,a9(aW({form:_.optional(),url:t.optional()}),t.optional())),S=aY({list:t.optional(),cancel:t.optional(),requests:aY({sampling:aY({createMessage:t.optional()}).optional(),elicitation:aY({create:t.optional()}).optional()}).optional()}),$=aY({list:t.optional(),cancel:t.optional(),requests:aY({tools:aY({call:t.optional()}).optional()}).optional()}),w=aW({experimental:a6(ah(),t).optional(),sampling:aW({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:aW({listChanged:aZ().optional()}).optional(),tasks:S.optional(),extensions:a6(ah(),t).optional()}),k=aW({experimental:a6(ah(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:aW({listChanged:aZ().optional()}).optional(),resources:aW({subscribe:aZ().optional(),listChanged:aZ().optional()}).optional(),tools:aW({listChanged:aZ().optional()}).optional(),tasks:$.optional(),extensions:a6(ah(),t).optional()}),R=aW({progress:az(),total:ia(az()),message:ia(ah())}),x=aW({...m.shape,...R.shape,progressToken:r}),P=h.extend({method:a7("notifications/progress"),params:x}),E=m.extend({level:o,logger:ah().optional(),data:aH()}),T=h.extend({method:a7("notifications/message"),params:E}),j=aW({uri:ah(),mimeType:ia(ah()),_meta:a6(ah(),aH()).optional()}),O=j.extend({text:ah()}),C=j.extend({blob:s}),N=aW({audience:aB(n).optional(),priority:az().min(0).max(1).optional(),lastModified:r1({offset:!0}).optional()}),I=aW({...y.shape,...g.shape,uri:ah(),description:ia(ah()),mimeType:ia(ah()),size:ia(az()),annotations:N.optional(),_meta:ia(aY({}))}),q=aW({...y.shape,...g.shape,uriTemplate:ah(),description:ia(ah()),mimeType:ia(ah()),annotations:N.optional(),_meta:ia(aY({}))}),z=h.extend({method:a7("notifications/resources/list_changed"),params:m.optional()}),A=m.extend({uri:ah()}),M=h.extend({method:a7("notifications/resources/updated"),params:A}),L=aW({name:ah(),description:ia(ah()),required:ia(aZ())}),Z=aW({...y.shape,...g.shape,description:ia(ah()),arguments:ia(aB(L)),_meta:ia(aY({}))}),D=h.extend({method:a7("notifications/prompts/list_changed"),params:m.optional()}),V=aW({type:a7("text"),text:ah(),annotations:N.optional(),_meta:a6(ah(),aH()).optional()}),U=aW({type:a7("image"),data:s,mimeType:ah(),annotations:N.optional(),_meta:a6(ah(),aH()).optional()}),F=aW({type:a7("audio"),data:s,mimeType:ah(),annotations:N.optional(),_meta:a6(ah(),aH()).optional()}),H=aW({type:a7("tool_use"),name:ah(),id:ah(),input:a6(ah(),aH()),_meta:a6(ah(),aH()).optional()}),J=aW({type:a7("resource"),resource:aQ([O,C]),annotations:N.optional(),_meta:a6(ah(),aH()).optional()}),K=I.extend({type:a7("resource_link")}),B=aQ([V,U,F,K,J]),G=aW({role:n,content:B}),W=aW({title:ah().optional(),readOnlyHint:aZ().optional(),destructiveHint:aZ().optional(),idempotentHint:aZ().optional(),openWorldHint:aZ().optional()}),Y=h.extend({method:a7("notifications/tools/list_changed"),params:m.optional()}),X=aW({name:ah().optional()}),Q=aW({hints:aB(X).optional(),costPriority:az().min(0).max(1).optional(),speedPriority:az().min(0).max(1).optional(),intelligencePriority:az().min(0).max(1).optional()}),ee=aW({mode:a3(["auto","required","none"]).optional()}),et=aW({type:a7("boolean"),title:ah().optional(),description:ah().optional(),default:aZ().optional()}),er=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),minLength:az().optional(),maxLength:az().optional(),format:a3(["email","uri","date","date-time"]).optional(),default:ah().optional()}),ea=aW({type:a3(["number","integer"]),title:ah().optional(),description:ah().optional(),minimum:az().optional(),maximum:az().optional(),default:az().optional()}),ei=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),enum:aB(ah()),default:ah().optional()}),en=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),oneOf:aB(aW({const:ah(),title:ah()})),default:ah().optional()}),eo=aW({type:a7("string"),title:ah().optional(),description:ah().optional(),enum:aB(ah()),enumNames:aB(ah()).optional(),default:ah().optional()}),es=aQ([ei,en]),el=aW({type:a7("array"),title:ah().optional(),description:ah().optional(),minItems:az().optional(),maxItems:az().optional(),items:aW({type:a7("string"),enum:aB(ah())}),default:aB(ah()).optional()}),ec=aW({type:a7("array"),title:ah().optional(),description:ah().optional(),minItems:az().optional(),maxItems:az().optional(),items:aW({anyOf:aB(aW({const:ah(),title:ah()}))}),default:aB(ah()).optional()}),eu=aQ([el,ec]),ed=aQ([eo,es,eu]),ep=aQ([ed,et,er,ea]),em=p.extend({mode:a7("form").optional(),message:ah(),requestedSchema:aW({type:a7("object"),properties:a6(ah(),ep),required:aB(ah()).optional()}).catchall(aH())}),eh=aW({type:a7("ref/resource"),uri:ah()}),ef=aW({type:a7("ref/prompt"),name:ah()}),eg=aW({uri:ah().startsWith("file://"),name:ah().optional(),_meta:a6(ah(),aH()).optional()}),ey=w.shape,ev=aW({experimental:ey.experimental,sampling:ey.sampling,elicitation:ey.elicitation,roots:ey.roots,extensions:ey.extensions}),e_=k.shape,eb=aW({experimental:e_.experimental,logging:e_.logging,completions:e_.completions,prompts:e_.prompts,resources:e_.resources,tools:e_.tools,extensions:e_.extensions}),eS=aY({progressToken:r.optional(),[iw]:ah(),[ik]:v.optional(),[ix]:ev,[iE]:o.optional()}),e$=aW({...y.shape,...g.shape,description:ah().optional(),inputSchema:aY({$schema:ah().optional(),type:a7("object")}),outputSchema:aY({$schema:ah().optional()}).optional(),annotations:W.optional(),_meta:a6(ah(),aH()).optional()}),ew=aW({type:a7("tool_result"),toolUseId:ah(),content:aB(B),structuredContent:aH().optional(),isError:aZ().optional(),_meta:a6(ah(),aH()).optional()}),ek=aQ([V,U,F,H,ew]),eR=aW({role:n,content:aQ([ek,aB(ek)]),_meta:a6(ah(),aH()).optional()}),ex=ah(),eP=aY({[iR]:v.optional().catch(void 0)}),eE=eP.optional();function eT(e){return aY({_meta:eE,resultType:ex.default("complete"),...e})}let ej=eT({}),eO=eT({nextCursor:a.optional()}),eC=eT({content:aB(B),structuredContent:aH().optional(),isError:aZ().optional()}),eN=eT({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),tools:aB(e$),nextCursor:a.optional()}),eI=eT({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),prompts:aB(Z),nextCursor:a.optional()}),eq=eT({description:ah().optional(),messages:aB(G)}),ez=eT({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),resources:aB(I),nextCursor:a.optional()}),eA=eT({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),resourceTemplates:aB(q),nextCursor:a.optional()}),eM=eT({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),contents:aB(aQ([O,C]))}),eL=eT({completion:aW({values:aB(ah()).max(100),total:az().int().optional(),hasMore:aZ().optional()}).loose()}),eZ=eT({ttlMs:az().int().min(0),cacheScope:a3(["public","private"])}),eD=eT({ttlMs:az().int().min(0).catch(0),cacheScope:a3(["public","private"]).catch("private"),supportedVersions:aB(ah()),capabilities:eb,instructions:ah().optional()}),eV=aW({messages:aB(eR),modelPreferences:Q.optional(),systemPrompt:ah().optional(),includeContext:a3(["none","thisServer","allServers"]).optional(),temperature:az().optional(),maxTokens:az().int(),stopSequences:aB(ah()).optional(),metadata:t.optional(),tools:aB(e$).optional(),toolChoice:ee.optional()}),eU=aW({method:a7("sampling/createMessage"),params:eV}),eF=aW({method:a7("roots/list"),params:aW({_meta:a6(ah(),aH()).optional()}).optional()}),eH=aW({...eR.shape,model:ah(),stopReason:ah().optional()}),eJ=aW({roots:aB(eg)}),eK=aW({action:a3(["accept","decline","cancel"]),content:a6(ah(),aQ([ah(),az(),aZ(),aB(ah())])).optional()}),eB=aW({mode:a7("url"),message:ah(),url:ah().url()}),eG=aQ([em,eB]),eW=aW({method:a7("elicitation/create"),params:eG}),eY=aQ([eU,eF,eW]),eX=aQ([eH,eJ,eK]),eQ=a6(ah(),eY),e0=a6(ah(),eX),e1=eT({inputRequests:eQ.optional(),requestState:ah().optional()}),e2={inputResponses:e0.optional(),requestState:ah().optional()},e9=aW({_meta:eS,...e2}),e4=aY({progressToken:r.optional()});function e6(e,t){return aW({method:a7(e),params:aW({_meta:eS,...t})})}function e5(e,t){return aW({method:a7(e),params:aW({_meta:e4.optional(),...t}).optional()})}let e3={name:ah(),arguments:a6(ah(),aH()).optional(),...e2},e8={cursor:a.optional()},e7=e6("tools/call",e3),te=e6("tools/list",e8),tt=e6("prompts/list",e8),tr=e6("prompts/get",{name:ah(),arguments:a6(ah(),ah()).optional(),...e2}),ta=e6("resources/list",e8),ti=e6("resources/templates/list",e8),tn=e6("resources/read",{uri:ah(),...e2}),to={ref:aQ([ef,eh]),argument:aW({name:ah(),value:ah()}),context:aW({arguments:a6(ah(),ah()).optional()}).optional()},ts=e6("completion/complete",to),tl=e6("server/discover",{}),tc=aW({toolsListChanged:aZ().optional(),promptsListChanged:aZ().optional(),resourcesListChanged:aZ().optional(),resourceSubscriptions:aB(ah()).optional()}),tu={notifications:tc},td=e6("subscriptions/listen",tu),tp=eP.extend({"io.modelcontextprotocol/subscriptionId":i}),tm=aY({_meta:tp,resultType:ex.default("complete")}),th={"tools/call":e5("tools/call",e3),"tools/list":e5("tools/list",e8),"prompts/get":e5("prompts/get",{name:ah(),arguments:a6(ah(),ah()).optional()}),"prompts/list":e5("prompts/list",e8),"resources/list":e5("resources/list",e8),"resources/templates/list":e5("resources/templates/list",e8),"resources/read":e5("resources/read",{uri:ah()}),"completion/complete":e5("completion/complete",to),"server/discover":e5("server/discover",{}),"subscriptions/listen":e5("subscriptions/listen",tu)};function tf(e){return aY({_meta:eE,...e})}let tg={"tools/call":tf({content:aB(B),structuredContent:aH().optional(),isError:aZ().optional()}),"tools/list":tf({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),tools:aB(e$),nextCursor:a.optional()}),"prompts/get":tf({description:ah().optional(),messages:aB(G)}),"prompts/list":tf({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),prompts:aB(Z),nextCursor:a.optional()}),"resources/list":tf({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),resources:aB(I),nextCursor:a.optional()}),"resources/templates/list":tf({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),resourceTemplates:aB(q),nextCursor:a.optional()}),"resources/read":tf({ttlMs:az().int().min(0),cacheScope:a3(["public","private"]),contents:aB(aQ([O,C]))}),"completion/complete":tf({completion:aW({values:aB(ah()).max(100),total:az().int().optional(),hasMore:aZ().optional()}).loose()}),"server/discover":tf({ttlMs:az().int().min(0).catch(0),cacheScope:a3(["public","private"]).catch("private"),supportedVersions:aB(ah()),capabilities:eb,instructions:ah().optional()}),"subscriptions/listen":tf({})},ty=aY({"io.modelcontextprotocol/subscriptionId":i.optional()}),tv=aW({method:a7("notifications/subscriptions/acknowledged"),params:aW({_meta:ty.optional(),notifications:tc})}),t_=aW({_meta:ty.optional(),requestId:i,reason:ah().optional()}),tb=aW({method:a7("notifications/cancelled"),params:t_}),tS=e=>aW({jsonrpc:a7("2.0"),id:aQ([ah(),az().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:a,RequestIdSchema:i,RoleSchema:n,LoggingLevelSchema:o,TaskMetadataSchema:l,RelatedTaskMetadataSchema:c,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:m,NotificationSchema:h,IconSchema:f,IconsSchema:g,BaseMetadataSchema:y,ImplementationSchema:v,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:$,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:k,ProgressSchema:R,ProgressNotificationParamsSchema:x,ProgressNotificationSchema:P,LoggingMessageNotificationParamsSchema:E,LoggingMessageNotificationSchema:T,ResourceContentsSchema:j,TextResourceContentsSchema:O,BlobResourceContentsSchema:C,AnnotationsSchema:N,ResourceSchema:I,ResourceTemplateSchema:q,ResourceListChangedNotificationSchema:z,ResourceUpdatedNotificationParamsSchema:A,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:L,PromptSchema:Z,PromptListChangedNotificationSchema:D,TextContentSchema:V,ImageContentSchema:U,AudioContentSchema:F,ToolUseContentSchema:H,EmbeddedResourceSchema:J,ResourceLinkSchema:K,ContentBlockSchema:B,PromptMessageSchema:G,ToolAnnotationsSchema:W,ToolListChangedNotificationSchema:Y,ModelHintSchema:X,ModelPreferencesSchema:Q,ToolChoiceSchema:ee,BooleanSchemaSchema:et,StringSchemaSchema:er,NumberSchemaSchema:ea,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:en,LegacyTitledEnumSchemaSchema:eo,SingleSelectEnumSchemaSchema:es,UntitledMultiSelectEnumSchemaSchema:el,TitledMultiSelectEnumSchemaSchema:ec,MultiSelectEnumSchemaSchema:eu,EnumSchemaSchema:ed,PrimitiveSchemaDefinitionSchema:ep,ElicitRequestFormParamsSchema:em,ResourceTemplateReferenceSchema:eh,PromptReferenceSchema:ef,RootSchema:eg,ClientCapabilities2026Schema:ev,ServerCapabilities2026Schema:eb,RequestMetaEnvelopeSchema:eS,ToolSchema:e$,ToolResultContentSchema:ew,SamplingMessageContentBlockSchema:ek,SamplingMessageSchema:eR,ResultTypeSchema:ex,ResultMetaSchema:eP,ResultSchema:ej,PaginatedResultSchema:eO,CallToolResultSchema:eC,ListToolsResultSchema:eN,ListPromptsResultSchema:eI,GetPromptResultSchema:eq,ListResourcesResultSchema:ez,ListResourceTemplatesResultSchema:eA,ReadResourceResultSchema:eM,CompleteResultSchema:eL,CacheableResultSchema:eZ,DiscoverResultSchema:eD,CreateMessageRequestParamsSchema:eV,CreateMessageRequestSchema:eU,ListRootsRequestSchema:eF,CreateMessageResultSchema:eH,ListRootsResultSchema:eJ,ElicitResultSchema:eK,ElicitRequestURLParamsSchema:eB,ElicitRequestParamsSchema:eG,ElicitRequestSchema:eW,InputRequestSchema:eY,InputResponseSchema:eX,InputRequestsSchema:eQ,InputResponsesSchema:e0,InputRequiredResultSchema:e1,InputResponseRequestParamsSchema:e9,CallToolRequestSchema:e7,ListToolsRequestSchema:te,ListPromptsRequestSchema:tt,GetPromptRequestSchema:tr,ListResourcesRequestSchema:ta,ListResourceTemplatesRequestSchema:ti,ReadResourceRequestSchema:tn,CompleteRequestSchema:ts,DiscoverRequestSchema:tl,SubscriptionFilterSchema:tc,SubscriptionsListenRequestSchema:td,SubscriptionsListenResultMetaSchema:tp,SubscriptionsListenResultSchema:tm,dispatchRequestSchemas:th,dispatchResultSchemas:tg,NotificationMetaSchema:ty,SubscriptionsAcknowledgedNotificationSchema:tv,CancelledNotificationParamsSchema:t_,CancelledNotificationSchema:tb,notificationSchemas2026:{"notifications/cancelled":tb,"notifications/progress":P,"notifications/message":T,"notifications/resources/updated":M,"notifications/resources/list_changed":z,"notifications/tools/list_changed":Y,"notifications/prompts/list_changed":D,"notifications/subscriptions/acknowledged":tv},JSONRPCResultResponseSchema:tS(ej),CallToolResultResponseSchema:tS(aQ([eC,e1])),ListToolsResultResponseSchema:tS(eN),ListPromptsResultResponseSchema:tS(eI),GetPromptResultResponseSchema:tS(aQ([eq,e1])),ListResourcesResultResponseSchema:tS(ez),ListResourceTemplatesResultResponseSchema:tS(eA),ReadResourceResultResponseSchema:tS(aQ([eM,e1])),CompleteResultResponseSchema:tS(eL),DiscoverResultResponseSchema:tS(eD)}}()}let sK=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"],sB=Symbol("modelcontextprotocol.resultCacheHintFallback");function sG(e,t){if(void 0===t)return e;let r=e[sB];if(void 0===r)return{...e,[sB]:t};let a={},i=r.ttlMs??t.ttlMs;void 0!==i&&(a.ttlMs=i);let n=r.cacheScope??t.cacheScope;return void 0!==n&&(a.cacheScope=n),{...e,[sB]:a}}function sW(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function sY(e){return"public"===e||"private"===e}function sX(e,t){if(void 0!==e.ttlMs&&!sW(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(void 0!==e.cacheScope&&!sY(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}let sQ=((m={})[m.ParseError=-32700]="ParseError",m[m.InvalidRequest=-32600]="InvalidRequest",m[m.MethodNotFound=-32601]="MethodNotFound",m[m.InvalidParams=-32602]="InvalidParams",m[m.InternalError=-32603]="InternalError",m[m.ResourceNotFound=-32002]="ResourceNotFound",m[m.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",m[m.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",m[m.UrlElicitationRequired=-32042]="UrlElicitationRequired",m);var s0=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](e){return s_(this,e)}static isInstance(e){if("function"!=typeof this)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return s_(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="ProtocolError",sv(this,new.target)}static fromError(t,r,a){return t===sQ.UrlElicitationRequired&&a&&a.elicitations?new s2(a.elicitations,r):t===sQ.UnsupportedProtocolVersion&&a&&Array.isArray(a.supported)&&"string"==typeof a.requested?new s9({supported:a.supported,requested:a.requested},r):(t===sQ.InvalidParams||t===sQ.ResourceNotFound)&&"string"==typeof a?.uri&&(t===sQ.ResourceNotFound||1===Object.keys(a).length)?new s1(a.uri,r):t===sQ.MissingRequiredClientCapability&&a&&null!==a.requiredCapabilities&&"object"==typeof a.requiredCapabilities&&!Array.isArray(a.requiredCapabilities)?new s4({requiredCapabilities:a.requiredCapabilities},r):new e(t,r,a)}},s1=class extends s0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(sQ.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},s2=class extends s0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(sQ.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},s9=class extends s0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(sQ.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},s4=class extends s0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(sQ.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}};let s6=["tools/call","prompts/get","resources/read"],s5=["elicitation/create","sampling/createMessage","roots/list"];function s3(){if(i)return i;let e=sJ();return i={request:{"elicitation/create":aW({method:a7("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":aW({method:a7("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":aW({method:a7("roots/list"),params:aY({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}}}function s8(e){return s5.includes(e)}function s7(e){return s8(e)?s3().request[e]:void 0}let le={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},lt={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function lr(e){return Object.prototype.hasOwnProperty.call(le,e)}function la(e){return Object.prototype.hasOwnProperty.call(lt,e)}function li(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ln(e,t){if(void 0===e)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}Object.keys(le),Object.keys(lt);let lo={ok:!1,reason:"not-in-era"},ls=[iw,ix],ll={era:"2026-07-28",hasRequestMethod:lr,hasNotificationMethod:la,hasInputRequestMethod:e=>void 0!==s7(e),validateRequest:(e,t)=>ln(lr(e)?sJ().dispatchRequestSchemas[e]:void 0,t),validateResult:(e,t)=>ln(Object.prototype.hasOwnProperty.call(le,e)?sJ().dispatchResultSchemas[e]:void 0,t),validateNotification:(e,t)=>ln(la(e)?sJ().notificationSchemas2026[e]:void 0,t),validateInputRequest:(e,t)=>ln(s7(e),t),validateInputResponse:(e,t)=>ln(s8(e)?s3().response[e]:void 0,t),samplingResultVariant:()=>lo,outboundEnvelope:e=>({[iw]:e.protocolVersion,[ik]:e.clientInfo,[ix]:e.clientCapabilities,...void 0!==e.logLevel&&{[iE]:e.logLevel}}),validateEnvelopeMeta(e){let t=[];for(let r of ls)r in e||t.push({key:r,problem:"missing"});let r=sJ().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let e of r.error.issues){let r=e.path.map(String),a=r.length>0?r.join("."):"_meta";1===r.length&&t.some(e=>e.key===a&&"missing"===e.problem)||t.push({key:a,problem:e.message})}return t},projectCallToolResult:e=>sP(e),inputRequestSchema:s7,decodeResult(e,t){if(!li(t))return{kind:"invalid",error:new sS(sb.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(void 0===r)return{kind:"invalid",error:new sS(sb.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if("string"!=typeof r)return{kind:"invalid",error:new sS(sb.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if("input_required"===r){let r=t.inputRequests,a=li(r)?r:{},i=t.requestState;return 0===Object.keys(a).length&&"string"!=typeof i?{kind:"invalid",error:new sS(sb.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:a,..."string"==typeof i&&{requestState:i}}}if("complete"!==r)return{kind:"invalid",error:new sS(sb.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let a=function(){if(n)return n;let e=sJ();return n={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema}}(),i=Object.hasOwn(a,e)?a[e]:void 0;if(void 0!==i){let r=i.safeParse(t);if(!r.success)return{kind:"invalid",error:new sS(sb.InvalidResult,`Invalid result for ${e}: ${r.error}`,{method:e})}}let o={...t};return delete o.resultType,{kind:"complete",result:o}},encodeResult:(e,t,r)=>(function(e,t){if(void 0===t)return e;let r=e._meta;return void 0===r?{...e,_meta:{[iR]:t}}:null===r||"object"!=typeof r||Array.isArray(r)||void 0!==r[iR]?e:{...e,_meta:{...r,[iR]:t}}})(function(e,t){var r,a;let i=t[sB];if("complete"!==t.resultType||!sK.includes(e)){let e;return void 0===i?t:(e={...t},delete e[sB],e)}let n=sW(t.ttlMs)?t.ttlMs:void 0!==(r=i)&&sW(r.ttlMs)?r.ttlMs:0,o=sY(t.cacheScope)?t.cacheScope:void 0!==(a=i)&&sY(a.cacheScope)?a.cacheScope:"private",s={...t,ttlMs:n,cacheScope:o};return delete s[sB],s}(e,function(e,t){let r=t.resultType;if(void 0===r)return{...t,resultType:"complete"};if("complete"===r||s6.includes(e))return t;throw new s0(sQ.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}(e,function(e,t){let r=t,a=!1,i=()=>(a||(r={...r},a=!0),r),n=t.tools;"tools/list"===e&&Array.isArray(n)&&n.some(e=>li(e)&&"execution"in e)&&(i().tools=n.map(e=>{if(!li(e)||!("execution"in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(li(o)&&"tasks"in o){let e={...o};delete e.tasks,i().capabilities=e}return r}(e,t))),r),encodeErrorCode:e=>-32002===e?-32602:e,checkInboundEnvelope(e){if(void 0===e.envelope)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=sJ().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join("; ")}`}},lc="2026-07-28";function lu(e){return void 0!==e&&e>=sk?ll:sH}function ld(e){return void 0!==e.revision?lu(e.revision).era:"modern"===e.era?ll.era:sH.era}function lp(e){return lh.some(t=>t.hasRequestMethod(e))}function lm(e){return lh.some(t=>t.hasNotificationMethod(e))}let lh=[sH,ll];function lf(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function lg(e){if(!lf(e))return;let t=e._meta;return lf(t)?t:void 0}function ly(e){let t=lg(e);return void 0!==t&&iw in t}function lv(e){let t=lg(e)?.[iw];return"string"==typeof t?t:void 0}function l_(e){return lu(lc).validateEnvelopeMeta(e)}var lb=((e,t)=>{let r={};for(var a in e)x(r,a,{get:e[a],enumerable:!0});return t&&x(r,Symbol.toStringTag,{value:"Module"}),r})({AnnotationsSchema:()=>nv,AudioContentSchema:()=>nB,BaseMetadataSchema:()=>i2,BaseRequestParamsSchema:()=>iA,BlobResourceContentsSchema:()=>ng,BooleanSchemaSchema:()=>o_,CallToolRequestParamsSchema:()=>n7,CallToolRequestSchema:()=>oe,CallToolResultSchema:()=>n3,CancelTaskRequestSchema:()=>o6,CancelTaskResultSchema:()=>o5,CancelledNotificationParamsSchema:()=>iX,CancelledNotificationSchema:()=>iQ,ClientCapabilitiesSchema:()=>i8,ClientNotificationSchema:()=>o8,ClientRequestSchema:()=>o3,ClientResultSchema:()=>o7,ClientTasksCapabilitySchema:()=>i5,CompatibilityCallToolResultSchema:()=>n8,CompleteRequestParamsSchema:()=>oZ,CompleteRequestSchema:()=>oD,CompleteResultSchema:()=>oV,ContentBlockSchema:()=>nX,CreateMessageRequestParamsSchema:()=>of,CreateMessageRequestSchema:()=>og,CreateMessageResultSchema:()=>oy,CreateMessageResultWithToolsSchema:()=>ov,CreateTaskResultSchema:()=>oW,CursorSchema:()=>iN,DiscoverRequestSchema:()=>ni,DiscoverResultSchema:()=>nn,ElicitRequestFormParamsSchema:()=>oO,ElicitRequestParamsSchema:()=>oN,ElicitRequestSchema:()=>oI,ElicitRequestURLParamsSchema:()=>oC,ElicitResultSchema:()=>oA,ElicitationCompleteNotificationParamsSchema:()=>oq,ElicitationCompleteNotificationSchema:()=>oz,EmbeddedResourceSchema:()=>nW,EmptyResultSchema:()=>iY,EnumSchemaSchema:()=>oT,GetPromptRequestParamsSchema:()=>nF,GetPromptRequestSchema:()=>nH,GetPromptResultSchema:()=>n0,GetTaskPayloadRequestSchema:()=>o1,GetTaskPayloadResultSchema:()=>o2,GetTaskRequestSchema:()=>oQ,GetTaskResultSchema:()=>o0,IconSchema:()=>i0,IconsSchema:()=>i1,ImageContentSchema:()=>nK,ImplementationSchema:()=>i9,InitializeRequestParamsSchema:()=>i7,InitializeRequestSchema:()=>ne,InitializeResultSchema:()=>nr,InitializedNotificationSchema:()=>na,JSONArraySchema:()=>iO,JSONObjectSchema:()=>ij,JSONRPCErrorResponseSchema:()=>iB,JSONRPCMessageSchema:()=>iG,JSONRPCNotificationSchema:()=>iJ,JSONRPCRequestSchema:()=>iH,JSONRPCResponseSchema:()=>iW,JSONRPCResultResponseSchema:()=>iK,JSONValueSchema:()=>iT,LegacyTitledEnumSchemaSchema:()=>ok,ListChangedOptionsBaseSchema:()=>or,ListPromptsRequestSchema:()=>nV,ListPromptsResultSchema:()=>nU,ListResourceTemplatesRequestSchema:()=>nw,ListResourceTemplatesResultSchema:()=>nk,ListResourcesRequestSchema:()=>nS,ListResourcesResultSchema:()=>n$,ListRootsRequestSchema:()=>oF,ListRootsResultSchema:()=>oH,ListTasksRequestSchema:()=>o9,ListTasksResultSchema:()=>o4,ListToolsRequestSchema:()=>n6,ListToolsResultSchema:()=>n5,LoggingLevelSchema:()=>oa,LoggingMessageNotificationParamsSchema:()=>oo,LoggingMessageNotificationSchema:()=>os,ModelHintSchema:()=>ol,ModelPreferencesSchema:()=>oc,MultiSelectEnumSchemaSchema:()=>oE,NotificationSchema:()=>iD,NotificationsParamsSchema:()=>iZ,NumberSchemaSchema:()=>oS,PaginatedRequestParamsSchema:()=>nu,PaginatedRequestSchema:()=>nd,PaginatedResultSchema:()=>np,PingRequestSchema:()=>no,PrimitiveSchemaDefinitionSchema:()=>oj,ProgressNotificationParamsSchema:()=>nl,ProgressNotificationSchema:()=>nc,ProgressSchema:()=>ns,ProgressTokenSchema:()=>iC,PromptArgumentSchema:()=>nZ,PromptListChangedNotificationSchema:()=>n1,PromptMessageSchema:()=>nQ,PromptReferenceSchema:()=>oL,PromptSchema:()=>nD,ReadResourceRequestParamsSchema:()=>nR,ReadResourceRequestSchema:()=>nx,ReadResourceResultSchema:()=>nP,RelatedTaskMetadataSchema:()=>iq,RequestIdSchema:()=>iF,RequestMetaSchema:()=>iz,RequestSchema:()=>iL,ResourceContentsSchema:()=>nm,ResourceLinkSchema:()=>nY,ResourceListChangedNotificationSchema:()=>nE,ResourceRequestParamsSchema:()=>nR,ResourceSchema:()=>n_,ResourceTemplateReferenceSchema:()=>oM,ResourceTemplateSchema:()=>nb,ResourceUpdatedNotificationParamsSchema:()=>nM,ResourceUpdatedNotificationSchema:()=>nL,ResultMetaObjectSchema:()=>iV,ResultSchema:()=>iU,RoleSchema:()=>ny,RootSchema:()=>oU,RootsListChangedNotificationSchema:()=>oJ,SamplingContentSchema:()=>op,SamplingMessageContentBlockSchema:()=>om,SamplingMessageSchema:()=>oh,ServerCapabilitiesSchema:()=>nt,ServerNotificationSchema:()=>st,ServerRequestSchema:()=>se,ServerResultSchema:()=>sr,ServerTasksCapabilitySchema:()=>i3,SetLevelRequestParamsSchema:()=>oi,SetLevelRequestSchema:()=>on,SingleSelectEnumSchemaSchema:()=>oR,StringSchemaSchema:()=>ob,SubscribeRequestParamsSchema:()=>nR,SubscribeRequestSchema:()=>nT,SubscriptionFilterSchema:()=>nO,SubscriptionsAcknowledgedNotificationParamsSchema:()=>nI,SubscriptionsAcknowledgedNotificationSchema:()=>nq,SubscriptionsListenRequestParamsSchema:()=>nC,SubscriptionsListenRequestSchema:()=>nN,SubscriptionsListenResultMetaSchema:()=>nz,SubscriptionsListenResultSchema:()=>nA,TaskAugmentedRequestParamsSchema:()=>iM,TaskCreationParamsSchema:()=>oK,TaskMetadataSchema:()=>iI,TaskSchema:()=>oG,TaskStatusNotificationParamsSchema:()=>oY,TaskStatusNotificationSchema:()=>oX,TaskStatusSchema:()=>oB,TextContentSchema:()=>nJ,TextResourceContentsSchema:()=>nh,TitledMultiSelectEnumSchemaSchema:()=>oP,TitledSingleSelectEnumSchemaSchema:()=>ow,ToolAnnotationsSchema:()=>n2,ToolChoiceSchema:()=>ou,ToolExecutionSchema:()=>n9,ToolListChangedNotificationSchema:()=>ot,ToolResultContentSchema:()=>od,ToolSchema:()=>n4,ToolUseContentSchema:()=>nG,UnsubscribeRequestParamsSchema:()=>nR,UnsubscribeRequestSchema:()=>nj,UntitledMultiSelectEnumSchemaSchema:()=>ox,UntitledSingleSelectEnumSchemaSchema:()=>o$});let lS=e=>iH.safeParse(e).success,l$=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&"input_required"===e.resultType,lw="x-mcp-header",lk=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,lR=new Set(["string","integer","boolean","number"]),lx=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],lP=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function lE(e){return 0===e.length?"<root>":e.join(".")}function lT(e,t,r,a,i){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:a.code,message:a.message,...void 0!==a.data&&{data:a.data},settled:i}}function lj(e){if(!ly(e))return!1;let t=lv(e);if(void 0===t||!(t>=sk))return!1;let r=lg(e);return void 0!==r&&0===l_(r).length}sQ.InvalidRequest,sQ.UnsupportedProtocolVersion,sQ.InvalidParams,sQ.MethodNotFound,sQ.InvalidParams,sQ.MissingRequiredClientCapability,sQ.ParseError,sQ.InvalidRequest,sQ.MethodNotFound,sQ.UnsupportedProtocolVersion,sQ.MissingRequiredClientCapability;function lO(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function lC(e){if(null==e)return!1;let t=typeof e;return("object"===t||"function"===t)&&"~standard"in e&&"function"==typeof e["~standard"]?.validate}let lN=!1,lI="draft-2020-12";function lq(e,t="input"){let r,a=e["~standard"];if(a.jsonSchema)r=a.jsonSchema[t]({target:lI});else if("zod"===a.vendor){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");lN||(lN=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=rQ(e,{target:lI,io:t})}else throw Error(`Schema library "${a.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if("output"===t)return void 0!==r.type||!function e(t){if("properties"in t||"patternProperties"in t||"additionalProperties"in t||"required"in t)return!0;for(let r of["oneOf","anyOf","allOf"]){let a=t[r];if(Array.isArray(a)&&a.length>0)return a.every(t=>null!==t&&"object"==typeof t&&("object"===t.type||e(t)))}return!1}(r)?r:{type:"object",...r};if(void 0!==r.type&&"object"!==r.type)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}async function lz(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(e=>e.path?.length?`${e.path.map(e=>String("object"==typeof e?e.key:e)).join(".")}: ${e.message}`:e.message).join(", ")}:{success:!0,data:r.value}}let lA=/\\\.\\d\{(\d+)\}/;function lM(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let lL=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function lZ(e){return lL.has(e)||e.startsWith("x-")}let lD=new Set(["$schema",...Object.keys(oO.shape.requestedSchema.shape)]),lV={string:lO([ob,o$,ow,ok]),number:lO([oS]),integer:lO([oS]),boolean:lO([o_]),array:lO([ox,oP])},lU=new Set(ob.shape.format.unwrap().options);Object.assign(function(e){let t=void 0!==e.inputRequests&&Object.keys(e.inputRequests).length>0,r="string"==typeof e.requestState;if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...void 0!==e.inputRequests&&{inputRequests:e.inputRequests},...void 0!==e.requestState&&{requestState:e.requestState}}},{elicit(e){try{return{method:"elicitation/create",params:function(e){var t;if(!lC(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let r=e.requestedSchema["~standard"].vendor,a=function(e,t){let r={},a=[];for(let[i,n]of Object.entries(e))"properties"===i&&lM(n)?r[i]=Object.fromEntries(Object.entries(n).map(([e,r])=>[e,function(e,t,r,a){if(!lM(e))return e;let i="string"==typeof e.type&&Object.hasOwn(lV,e.type)?lV[e.type]:void 0;if(void 0===i)return e;let n={};for(let[s,l]of Object.entries(e))if(i.has(s)||lZ(s))n[s]=l;else if("pattern"===s&&"string"===e.type&&"string"==typeof e.format)if(lU.has(e.format)){var o;"string"==typeof l&&(o=e.format,"zod"!==r||(function(e,t){let r;switch(e){case"email":r=[rc(ag,void 0)];break;case"uri":r=[rd(a_,void 0)];break;case"date":r=[r9()];break;case"date-time":let a,i;a=lA.exec(t),i=[void 0,-1,0],a&&i.push(Number(a[1])),r=[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>i.map(r=>r1({local:e,offset:t,precision:r}))))}return new Set(r.map(e=>{let t;return t=rQ(e,{target:lI,io:"input"}),"string"==typeof t.pattern?t.pattern:void 0}).filter(e=>void 0!==e))})(o,l).has(l))||a.push(`${t}.${s}`)}else n[s]=l;else a.push(`${t}.${s}`);return n}(r,`properties.${e}`,t,a)])):lD.has(i)?r[i]=n:lZ(i)||a.push(i);if(a.length>0)throw new s0(sQ.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${a.join(", ")}`);return r}(function(e){try{return lq(e,"input")}catch(t){let e=t instanceof Error?t.message:String(t);throw new s0(sQ.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${e}`)}}(e.requestedSchema),r),i=(t=oO.shape.requestedSchema,r7(t,a));if(!i.success)throw new s0(sQ.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${function(e,t){if(!lM(e.properties))return t;let r=Object.entries(e.properties).filter(([,e])=>!r7(oj,e).success).map(([e])=>`properties.${e}`);return r.length>0?r.join(", "):t}(a,i.error.message)}`);let n=function e(t,r,a=""){return Array.isArray(t)&&Array.isArray(r)?t.flatMap((t,i)=>e(t,r[i],`${a}[${i}]`)):lM(t)&&lM(r)?Object.entries(t).flatMap(([t,i])=>{let n=a?`${a}.${t}`:t;return Object.prototype.hasOwnProperty.call(r,t)?e(i,r[t],n):lZ(t)?[]:[n]}):[]}(a,i.data);if(n.length>0)throw new s0(sQ.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let o=(i.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(i.data.properties,e));if(o.length>0)throw new s0(sQ.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${o.join(", ")}`);return{...e,mode:"form",requestedSchema:i.data}}(e)}}catch(e){throw e instanceof s0?TypeError(e.message,{cause:e}):e}},elicitUrl:e=>({method:"elicitation/create",params:{...e,mode:"url"}}),createMessage:e=>({method:"sampling/createMessage",params:e}),listRoots:()=>({method:"roots/list"})});let lF={},lH={};function lJ(e,t){let r=e.slice(0,-6);lF[r]=t,lH[r]=e=>t.safeParse(e).success}for(let e of["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"])lJ(e,lb[e]);for(let[e,t]of Object.entries({IdJagTokenExchangeResponseSchema:sc,OAuthClientInformationFullSchema:sh,OAuthClientInformationSchema:sm,OAuthClientMetadataSchema:sp,OAuthClientRegistrationErrorSchema:sf,OAuthErrorResponseSchema:su,OAuthMetadataSchema:sn,OAuthProtectedResourceMetadataSchema:si,OAuthTokenRevocationRequestSchema:sg,OAuthTokensSchema:sl,OpenIdProviderDiscoveryMetadataSchema:ss,OpenIdProviderMetadataSchema:so}))lJ(e,t);Object.freeze(lF),Object.freeze(lH);let lK=[iw,ik,ix,iE],lB=["inputResponses","requestState"];function lG(e,t){let r=e.params;if(!l0(r))return{message:e,lifted:{}};let a=r._meta,i=l0(a)?lK.filter(e=>e in a):[],n="request"===t?lB.filter(e=>e in r):[];if(0===i.length&&0===n.length)return{message:e,lifted:{}};let o={},s={...r};if(i.length>0&&l0(a)){let e={},t={...a};for(let r of i)e[r]=a[r],delete t[r];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of n)"inputResponses"===e&&(o.inputResponses=s[e]),"requestState"===e&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function lW(e,t){let r=e.validateResult(t,void 0);if(r.ok||"not-in-era"!==r.reason)return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let a=e.validateResult(t,r);return a.ok?{value:a.value}:{issues:[{message:"invalid"===a.reason?a.message:`not-in-era: ${t}`}]}}}}}let lY=(h=void 0,()=>h);function lX(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:()=>t}}}var lQ=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{o=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??i$,this.setNotificationHandler("notifications/cancelled",e=>{this._oncancel(e)}),this.setNotificationHandler("notifications/progress",e=>{this._onprogress(e)}),this.setRequestHandler("ping",e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(void 0===t)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new sS(sb.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,a,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:a})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new sS(sb.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let a=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(a?.(e,t),iK.safeParse(e).success||iB.safeParse(e).success)this._onresponse(e);else if(lS(e))this._onrequest(e,t);else iJ.safeParse(e).success?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._timeoutInfo.values()))clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new sS(sb.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(r);for(let e of t.values())e.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=lG(e,"notification"),a=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return;if(t?.classification!==void 0){let e=ld(t.classification);if(e!==a.era)return void this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${e} but this instance serves ${a.era}`))}if(lm(r.method)&&!a.hasNotificationMethod(r.method))return;let i=this._notificationHandlers.get(r.method),n=this.fallbackNotificationHandler;(void 0!==i||void 0!==n)&&Promise.resolve().then(()=>void 0===i?n(r):i(r,a)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r;let{message:a,lifted:i}=lG(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&"drop"===this._shouldDropInbound(e))return void this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));let o=this._transport,s=(e,t,r)=>{let i={jsonrpc:"2.0",id:a.id,error:{code:e,message:t,...void 0!==r&&{data:r}}};o?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=ld(t.classification);if(e!==n.era){this._onerror(Error(`Era mismatch on inbound request '${a.method}': classified as ${e} but this instance serves ${n.era}`));let r=t.classification.revision??e;s(sQ.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(lp(a.method)&&!n.hasRequestMethod(a.method))return void s(sQ.MethodNotFound,"Method not found");let l=this._requestHandlers.get(a.method)??this.fallbackRequestHandler;if(void 0===l)return void s(sQ.MethodNotFound,"Method not found");let c=n.checkInboundEnvelope(i);if(void 0!==c)return void s(sQ.InvalidParams,c);let u=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:a.id}),d=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:a.id}),p=new AbortController;this._requestHandlerAbortControllers.set(a.id,p);let m=void 0===i.inputResponses?void 0:function(e){let t={},r=[];if(!l1(e))return{accepted:t,droppedKeys:r};for(let[a,i]of Object.entries(e)){if(!l1(i)||"method"in i||"result"in i){r.push(a);continue}t[a]=i}return{accepted:t,droppedKeys:r}}(i.inputResponses),h={sessionId:o?.sessionId,mcpReq:{id:a.id,method:a.method,_meta:a.params?._meta,...void 0!==i.envelope&&{envelope:i.envelope},...void 0!==m&&{inputResponses:m.accepted},...void 0!==m&&m.droppedKeys.length>0&&{droppedInputResponseKeys:m.droppedKeys},requestState:void 0===i.requestState?lY:(r=i.requestState,()=>r),signal:p.signal,send:(e,t,r)=>{let a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),lC(t))return d(e,t,r);let i=lW(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(e,i,t)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(h,t);Promise.resolve().then(()=>l(a,f)).then(async e=>{let t;if(p.signal.aborted)return;try{t=n.encodeResult(a.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${a.method}: ${e}`)),s(sQ.InternalError,"Internal error");return}let r={result:t,jsonrpc:"2.0",id:a.id};await o?.send(r)},async e=>{if(p.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:sQ.InternalError,r={jsonrpc:"2.0",id:a.id,error:{code:n.encodeErrorCode(t),message:e.message??"Internal error",...void 0!==e.data&&{data:e.data}}};await o?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(a.id)===p&&this._requestHandlerAbortControllers.delete(a.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,a=Number(t),i=this._progressHandlers.get(a);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let n=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&n&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),n(e);return}i(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);void 0===r?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),r(iK.safeParse(e).success?e:s0.fromError(e.error.code,e.error.message,e.error.data)))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let a=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(a,e.method),lC(t))return this._requestWithSchemaViaCodec(a,e,t,r);let i=lW(a,e.method);if(void 0===i)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(a,e,i,t)}_negotiatedWireCodec(){return lu(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(void 0===this._negotiatedProtocolVersion){let t=function(e){switch(e){case"initialize":case"notifications/initialized":return lu(void 0);case"server/discover":return lu(lc);default:return}}(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(lp(t)&&!e.hasRequestMethod(t))throw new sS(sb.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let a=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(a,e.method),this._requestWithSchemaViaCodec(a,e,t,r)}_requestWithSchemaViaCodec(e,t,r,a){let i,n,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c}=a??{},u=Date.now();return new Promise((d,p)=>{let m=e=>{p(e)};if(!this._transport)return void m(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){m(e);return}if(a?.signal?.aborted){let e=a.signal.reason;throw e instanceof sS?e:new sS(sb.RequestTimeout,String(e))}let h=e.era===lc&&!0===this._transport.hasPerRequestStream?new AbortController:void 0,f=this._requestMessageId++;n=f;let g={...t,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:f}});let y=this._envelopeOutbound(g),v=!1,_=e=>{v||(this._progressHandlers.delete(f),void 0===h?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(e)}}),{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):h.abort(),p(e instanceof sS?e:new sS(sb.RequestTimeout,String(e))))};this._responseHandlers.set(f,i=>{let n;if(!a?.signal?.aborted){if(v=!0,i instanceof Error)return p(i);try{n=e.decodeResult(t.method,i.result)}catch(e){return p(e instanceof Error?e:Error(String(e)))}if("invalid"===n.kind)return p(n.error);if("input_required"===n.kind){var o;return a?.allowInputRequired===!0?d({resultType:"input_required",inputRequests:(o=n).inputRequests,...void 0!==o.requestState&&{requestState:o.requestState}}):d(this._resolveNonCompleteResult(n,{codec:e,request:t,resultSchema:r,options:a,flowStartedAt:u,retry:(a,i)=>this._requestWithSchemaViaCodec(e,void 0===a?{method:t.method}:{method:t.method,params:a},r,i)}))}lz(r,n.result).then(e=>{e.success?d(e.data):p(new sS(sb.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},p)}}),i=()=>_(a?.signal?.reason),a?.signal?.addEventListener("abort",i,{once:!0});let b=a?.timeout??6e4;this._setupTimeout(f,b,a?.maxTotalTimeout,()=>_(new sS(sb.RequestTimeout,"Request timed out",{timeout:b})),a?.resetTimeoutOnProgress??!1),this._transport.send(y,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:l,headers:c,requestSignal:h?.signal}).catch(e=>{this._progressHandlers.delete(f),p(e)})}).finally(()=>{i&&a?.signal?.removeEventListener("abort",i),void 0!==n&&(this._responseHandlers.delete(n),this._cleanupTimeout(n))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new sS(sb.NotConnected,"Not connected");if(lm(t.method)&&!e.hasNotificationMethod(t.method))throw new sS(sb.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let a=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(a,r).catch(e=>this._onerror(e))});return}await this._transport.send(a,r)}setRequestHandler(e,t,r){let a;if(this.assertRequestHandlerCapability(e),"function"==typeof t){if(!lp(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);a=(r,a)=>{let i=this._negotiatedWireCodec(),n=i.validateRequest(e,r);if(n.ok||"not-in-era"!==n.reason||(n=i.validateInputRequest(e,r)),!n.ok){if("not-in-era"===n.reason)throw new s0(sQ.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value,a))}}else if(r)a=async(a,i)=>{let n=await lz(t.params,{...a.params});if(!n.success)throw new s0(sQ.InvalidParams,`Invalid params for ${e}: ${n.error}`);return r(n.data,i)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,a))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if("function"==typeof t){if(!lm(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,a)=>{let i=a.validateNotification(e,r);if(!i.ok){if("not-in-era"===i.reason)throw new s0(sQ.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async a=>{let i=await lz(t.params,{...a.params});if(!i.success)throw new s0(sQ.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await r(i.data,a)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function l0(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function l1(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}O(e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,a=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function i(e){this.parameters=Object.create(null),this.type=e}e.parse=function(e){if(!e)throw TypeError("argument string is required");var n,o,s,l="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof l)throw TypeError("argument string is required to be a string");var c=l.indexOf(";"),u=-1!==c?l.slice(0,c).trim():l.trim();if(!a.test(u))throw TypeError("invalid media type");var d=new i(u.toLowerCase());if(-1!==c){for(t.lastIndex=c;o=t.exec(l);){if(o.index!==c)throw TypeError("invalid parameter format");c+=o[0].length,n=o[1].toLowerCase(),34===(s=o[2]).charCodeAt(0)&&-1!==(s=s.slice(1,-1)).indexOf("\\")&&(s=s.replace(r,"$1")),d.parameters[n]=s}if(c!==l.length)throw TypeError("invalid parameter format")}return d}})();var l2=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??0xa00000}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let t=this._buffer.indexOf("\n");if(-1===t)break;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");this._buffer=this._buffer.subarray(t+1);try{var e;return e=r,iG.parse(JSON.parse(e))}catch(e){if(e instanceof SyntaxError)continue;throw e}}return null}clear(){this._buffer=void 0}};let l9=/^[A-Za-z0-9._-]{1,128}$/;function l4(e){let t=function(e){let t=[];if(0===e.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!l9.test(e)){let r=[...e].filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,r)=>r.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${r.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);var r=t.warnings;if(r.length>0){for(let t of(console.warn(`Tool name validation warning for "${e}":`),r))console.warn(` - ${t}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}return t.isValid}var l6=class e{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,r){if(e.length>t)throw Error(`${r} exceeds maximum length of ${t} characters (got ${e.length})`)}template;parts;get variableNames(){return this.parts.flatMap(e=>"string"==typeof e?[]:e.names)}constructor(t){e.validateLength(t,1e6,"Template"),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){let r=[],a="",i=0,n=0;for(;i<t.length;)if("{"===t[i]){a&&(r.push(a),a="");let o=t.indexOf("}",i);if(-1===o)throw Error("Unclosed template expression");if(++n>1e4)throw Error("Template contains too many expressions (max 10000)");let s=t.slice(i+1,o),l=this.getOperator(s),c=s.includes("*"),u=this.getNames(s),d=u[0];for(let t of u)e.validateLength(t,1e6,"Variable name");r.push({name:d,operator:l,names:u,exploded:c}),i=o+1}else a+=t[i],i++;return a&&r.push(a),r}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(",").map(e=>e.replace("*","").trim()).filter(e=>e.length>0)}encodeValue(t,r){return(e.validateLength(t,1e6,"Variable value"),"+"===r||"#"===r)?encodeURI(t):encodeURIComponent(t)}expandPart(e,t){if("?"===e.operator||"&"===e.operator){let r=e.names.map(r=>{let a=t[r];return void 0===a?"":`${r}=${Array.isArray(a)?a.map(t=>this.encodeValue(t,e.operator)).join(","):this.encodeValue(a.toString(),e.operator)}`}).filter(e=>e.length>0);return 0===r.length?"":("?"===e.operator?"?":"&")+r.join("&")}if(e.names.length>1){let r=e.names.map(e=>t[e]).filter(e=>void 0!==e);return 0===r.length?"":r.map(e=>Array.isArray(e)?e[0]:e).join(",")}let r=t[e.name];if(void 0===r)return"";let a=(Array.isArray(r)?r:[r]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case"":case"+":default:return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/")}}expand(e){let t="",r=!1;for(let a of this.parts){if("string"==typeof a){t+=a;continue}let i=this.expandPart(a,e);i&&(t+=("?"===a.operator||"&"===a.operator)&&r?i.replace("?","&"):i,("?"===a.operator||"&"===a.operator)&&(r=!0))}return t}escapeRegExp(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(t){let r,a=[];for(let r of t.names)e.validateLength(r,1e6,"Variable name");if("?"===t.operator||"&"===t.operator){for(let e=0;e<t.names.length;e++){let r=t.names[e],i=0===e?"\\"+t.operator:"&";a.push({pattern:i+this.escapeRegExp(r)+"=([^&]+)",name:r})}return a}let i=t.name;switch(t.operator){case"":r=t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":r="(.+)";break;case".":r=String.raw`\.([^/,]+)`;break;case"/":r="/"+(t.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:r="([^/]+)"}return a.push({pattern:r,name:i}),a}match(t){e.validateLength(t,1e6,"URI");let r="^",a=[];for(let e of this.parts)if("string"==typeof e)r+=this.escapeRegExp(e);else for(let{pattern:t,name:i}of this.partToRegExp(e))r+=t,a.push({name:i,exploded:e.exploded});r+="$",e.validateLength(r,1e6,"Generated regex pattern");let i=new RegExp(r),n=t.match(i);if(!n)return null;let o={};for(let[e,t]of a.entries()){let{name:r,exploded:a}=t,i=n[e+1];o[r.replace("*","")]=a&&i.includes(",")?i.split(","):i}return o}};function l5(e){if(void 0!==e){if(function(e){if("object"!=typeof e||null===e||lC(e))return!1;let t=Object.getPrototypeOf(e);return(t===Object.prototype||null===t)&&Object.values(e).every(e=>"object"==typeof e&&null!==e&&"_zod"in e)}(e))return aW(e);if("object"==typeof e&&null!==e&&!lC(e)&&Object.values(e).some(e=>"object"==typeof e&&null!==e&&!("_zod"in e)&&"_def"in e&&"string"==typeof e._def?.typeName))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!lC(e))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var l3=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var a=class extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}};function i(e,...t){let r=[e[0]],n=0;for(;n<t.length;)s(r,t[n]),r.push(e[++n]);return new a(r)}e._Code=a,e.nil=new a(""),e._=i;let n=new a("+");function o(e,...t){let i=[l(e[0])],c=0;for(;c<t.length;)i.push(n),s(i,t[c]),i.push(n,l(e[++c]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var a,i;let n=(a=e[t-1],'""'===(i=e[t+1])?a:'""'===a?i:"string"==typeof a?i instanceof r||'"'!==a[a.length-1]?void 0:"string"!=typeof i?`${a.slice(0,-1)}${i}"`:'"'===i[0]?a.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||a instanceof r?void 0:`"${a}${i.slice(1)}`);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(i),new a(i)}function s(e,t){var i;t instanceof a?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(i=t)||"boolean"==typeof i||null===i?i:l(Array.isArray(i)?i.join(","):i))}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=o,e.addCodeArg=s,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},e.stringify=function(e){return new a(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new a(`.${t}`):i`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new a(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new a(e.toString())}}),l8=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=l3();var r,a,i=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}};(r=a||(e.UsedValueState=a={}))[r.Started=0]="Started",r[r.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=n;var o=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:a}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(r)}[${a}]`}};e.ValueScopeName=o;let s=(0,t._)`\n`;var l=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?s:t.nil}}get(){return this._scope}name(e){return new o(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:i}=a,n=null!=(r=t.key)?r:t.ref,o=this._values[i];if(o){let e=o.get(n);if(e)return e}else o=this._values[i]=new Map;o.set(n,a);let s=this._scope[i]||(this._scope[i]=[]),l=s.length;return s[l]=t.ref,a.setValue(t,{property:i,itemIndex:l}),a}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw Error(`CodeGen: name "${r}" has no value`);return(0,t._)`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(r,n,o={},s){let l=t.nil;for(let c in r){let u=r[c];if(!u)continue;let d=o[c]=o[c]||new Map;u.forEach(r=>{if(d.has(r))return;d.set(r,a.Started);let o=n(r);if(o){let a=this.opts.es5?e.varKinds.var:e.varKinds.const;l=(0,t._)`${l}${a} ${r} = ${o};${this.opts._n}`}else if(o=null==s?void 0:s(r))l=(0,t._)`${l}${o}${this.opts._n}`;else throw new i(r);d.set(r,a.Completed)})}return l}};e.ValueScope=l}),l7=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=l3(),r=l8();var a=l3();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return a.Name}});var i=l8();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var n=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends n{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let a=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${a} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends n{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,r),this}get names(){return T(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},l=class extends s{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},c=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends n{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},d=class extends n{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},p=class extends n{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},m=class extends n{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,a=r.length;for(;a--;){let i=r[a];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>E(e,t.names),{})}},h=class extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},f=class extends m{},g=class extends h{};g.kind="else";var y=class e extends h{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(!0===t)return this.nodes;let r=this.else;if(r){let e=r.optimizeNodes();r=this.else=Array.isArray(e)?new g(e):e}return r?!1===t?r instanceof e?r:r.nodes:this.nodes.length?this:new e(O(t),r instanceof e?[r]:r.nodes):!1!==t&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){let e=super.names;return T(e,this.condition),this.else&&E(e,this.else.names),e}};y.kind="if";var v=class extends h{};v.kind="for";var _=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return E(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:a,from:i,to:n}=this;return`for(${t} ${a}=${i}; ${a}<${n}; ${a}++)`+super.render(e)}get names(){return T(T(super.names,this.from),this.to)}},S=class extends v{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return E(super.names,this.iterable.names)}},$=class extends h{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$.kind="func";var w=class extends m{render(e){return"return "+super.render(e)}};w.kind="return";var k=class extends h{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&E(e,this.catch.names),this.finally&&E(e,this.finally.names),e}},R=class extends h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};R.kind="catch";var x=class extends h{render(e){return"finally"+super.render(e)}};x.kind="finally";var P=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new f]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,a){let i=this._scope.toName(t);return void 0!==r&&a&&(this._constants[i.str]=r),this._leafNode(new o(e,i,r)),i}const(e,t,a){return this._def(r.varKinds.const,e,t,a)}let(e,t,a){return this._def(r.varKinds.let,e,t,a)}var(e,t,a){return this._def(r.varKinds.var,e,t,a)}assign(e,t,r){return this._leafNode(new s(e,t,r))}add(t,r){return this._leafNode(new l(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){let r=["{"];for(let[a,i]of e)r.length>1&&r.push(","),r.push(a),(a!==i||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,i));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.let){let o=this._scope.toName(e);return this._for(new b(n,o,t,a),()=>i(o))}forOf(e,a,i,n=r.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=a instanceof t.Name?a:this.var("_arr",a);return this.forRange("_i",0,(0,t._)`${e}.length`,r=>{this.var(o,(0,t._)`${e}[${r}]`),i(o)})}return this._for(new S("of",n,o,a),()=>i(o))}forIn(e,a,i,n=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${a})`,i);let o=this._scope.toName(e);return this._for(new S("in",n,o,a),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new c(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new w;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new k;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new R(e),t(e)}return r&&(this._currNode=a.finally=new x,this.code(r)),this._endBlockNode(R,x)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,a,i){return this._blockNode(new $(e,r,a)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function E(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,r){return r instanceof t._CodeOrName?E(e,r.names):e}function j(e,r,a){var i;if(e instanceof t.Name)return n(e);if(!((i=e)instanceof t._Code&&i._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==a[e.str])))return e;return new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=n(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[]));function n(e){let t=a[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function O(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,t._)`!${q(e)}`}e.CodeGen=P,e.not=O;let C=I(e.operators.AND);e.and=function(...e){return e.reduce(C)};let N=I(e.operators.OR);function I(e){return(r,a)=>r===t.nil?a:a===t.nil?r:(0,t._)`${q(r)} ${e} ${q(a)}`}function q(e){return e instanceof t.Name?e:(0,t._)`(${e})`}e.or=function(...e){return e.reduce(N)}}),ce=O(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let a=l7(),i=l3();function n(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=a.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function s(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,l)=>{let c=void 0===s?o:s instanceof a.Name?(o instanceof a.Name?e(n,o,s):t(n,o,s),s):o instanceof a.Name?(t(n,s,o),o):r(o,s);return l!==a.Name||c instanceof a.Name?c:i(n,c)}}function u(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,a._)`{}`);return void 0!==t&&d(e,r,t),r}function d(e,t,r){Object.keys(r).forEach(r=>e.assign((0,a._)`${t}${(0,a.getProperty)(r)}`,!0))}e.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},e.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(n(e,t),!o(t,e.self.RULES.all))},e.checkUnknownRules=n,e.schemaHasRules=o,e.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},e.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,a._)`${r}`}return(0,a._)`${e}${t}${(0,a.getProperty)(i)}`},e.unescapeFragment=function(e){return l(decodeURIComponent(e))},e.escapeFragment=function(e){return encodeURIComponent(s(e))},e.escapeJsonPointer=s,e.unescapeJsonPointer=l,e.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},e.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,a._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,a._)`${r} || {}`).code((0,a._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,a._)`${r} || {}`),d(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,a._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>e.assign(r,!0===t||(0,a._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},e.evaluatedPropsToName=u,e.setEvaluated=d;let p={};function m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}e.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:p[t.code]||(p[t.code]=new i._Code(t.code))})},(r=t||(e.Type=t={}))[r.Num=0]="Num",r[r.Str=1]="Str",e.getErrorPath=function(e,r,i){if(e instanceof a.Name){let n=r===t.Num;return i?n?(0,a._)`"[" + ${e} + "]"`:(0,a._)`"['" + ${e} + "']"`:n?(0,a._)`"/" + ${e}`:(0,a._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(e).toString():"/"+s(e)},e.checkStrictMode=m}),ct=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7();e.default={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")}}),cr=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=l7(),r=ce(),a=ct();function i(e,r){let i=e.const("err",r);e.if((0,t._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${a.default.vErrors}.push(${i})`),e.code((0,t._)`${a.default.errors}++`)}function n(e,r){let{gen:a,validateName:i,schemaEnv:n}=e;n.$async?a.throw((0,t._)`new ${e.ValidationError}(${r})`):(a.assign((0,t._)`${i}.errors`,r),a.return(!1))}e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?(0,t.str)`"${e}" keyword must be ${r} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`},e.reportError=function(r,a=e.keywordError,o,l){let{it:c}=r,{gen:u,compositeRule:d,allErrors:p}=c,m=s(r,a,o);(null!=l?l:d||p)?i(u,m):n(c,(0,t._)`[${m}]`)},e.reportExtraError=function(t,r=e.keywordError,o){let{it:l}=t,{gen:c,compositeRule:u,allErrors:d}=l;i(c,s(t,r,o)),u||d||n(l,a.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(a.default.errors,r),e.if((0,t._)`${a.default.vErrors} !== null`,()=>e.if(r,()=>e.assign((0,t._)`${a.default.vErrors}.length`,r),()=>e.assign(a.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:i,data:n,errsCount:o,it:s}){if(void 0===o)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",o,a.default.errors,o=>{e.const(l,(0,t._)`${a.default.vErrors}[${o}]`),e.if((0,t._)`${l}.instancePath === undefined`,()=>e.assign((0,t._)`${l}.instancePath`,(0,t.strConcat)(a.default.instancePath,s.errorPath))),e.assign((0,t._)`${l}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${r}`),s.opts.verbose&&(e.assign((0,t._)`${l}.schema`,i),e.assign((0,t._)`${l}.data`,n))})};let o={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function s(e,i,n){let{createErrors:s}=e.it;return!1===s?(0,t._)`{}`:function(e,i,n={}){let{gen:s,it:l}=e,c=[function({errorPath:e},{instancePath:i}){let n=i?(0,t.str)`${e}${(0,r.getErrorPath)(i,r.Type.Str)}`:e;return[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,n)]}(l,n),function({keyword:e,it:{errSchemaPath:a}},{schemaPath:i,parentSchema:n}){let s=n?a:(0,t.str)`${a}/${e}`;return i&&(s=(0,t.str)`${s}${(0,r.getErrorPath)(i,r.Type.Str)}`),[o.schemaPath,s]}(e,n)];return function(e,{params:r,message:i},n){let{keyword:s,data:l,schemaValue:c,it:u}=e,{opts:d,propertyName:p,topSchemaRef:m,schemaPath:h}=u;n.push([o.keyword,s],[o.params,"function"==typeof r?r(e):r||(0,t._)`{}`]),d.messages&&n.push([o.message,"function"==typeof i?i(e):i]),d.verbose&&n.push([o.schema,c],[o.parentSchema,(0,t._)`${m}${h}`],[a.default.data,l]),p&&n.push([o.propertyName,p])}(e,i,c),s.object(...c)}(e,i,n)}}),ca=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=cr(),r=l7(),a=ct(),i={message:"boolean schema is false"};function n(e,r){let{gen:a,data:n}=e;(0,t.reportError)({gen:a,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},i,void 0,r)}e.topBoolOrEmptySchema=function(e){let{gen:t,schema:i,validateName:o}=e;!1===i?n(e,!1):"object"==typeof i&&!0===i.$async?t.return(a.default.data):(t.assign((0,r._)`${o}.errors`,null),t.return(!0))},e.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),n(e)):r.var(t,!0)}}),ci=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);e.isJSONType=function(e){return"string"==typeof e&&t.has(e)},e.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}}),cn=O(e=>{function t(e,t){return t.rules.some(t=>r(e,t))}function r(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0,e.schemaHasRulesForType=function({schema:e,self:r},a){let i=r.RULES.types[a];return i&&!0!==i&&t(e,i)},e.shouldUseGroup=t,e.shouldUseRule=r}),co=O(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let a=ci(),i=cn(),n=cr(),o=l7(),s=ce();function l(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(r=t||(e.DataType=t={}))[r.Correct=0]="Correct",r[r.Wrong=1]="Wrong",e.getSchemaTypes=function(e){let t=l(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},e.getJSONTypes=l,e.coerceAndCheckDataType=function(e,r){var a,n;let{gen:s,data:l,opts:u}=e,p=(a=r,(n=u.coerceTypes)?a.filter(e=>c.has(e)||"array"===n&&"array"===e):[]),h=r.length>0&&!(0===p.length&&1===r.length&&(0,i.schemaHasRulesForType)(e,r[0]));if(h){let a=d(r,l,u.strictNumbers,t.Wrong);s.if(a,()=>{p.length?function(e,t,r){let{gen:a,data:i,opts:n}=e,s=a.let("dataType",(0,o._)`typeof ${i}`),l=a.let("coerced",(0,o._)`undefined`);for(let e of("array"===n.coerceTypes&&a.if((0,o._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>a.assign(i,(0,o._)`${i}[0]`).assign(s,(0,o._)`typeof ${i}`).if(d(t,i,n.strictNumbers),()=>a.assign(l,i))),a.if((0,o._)`${l} !== undefined`),r))(c.has(e)||"array"===e&&"array"===n.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,o._)`${s} == "number" || ${s} == "boolean"`).assign(l,(0,o._)`"" + ${i}`).elseIf((0,o._)`${i} === null`).assign(l,(0,o._)`""`);return;case"number":a.elseIf((0,o._)`${s} == "boolean" || ${i} === null
|
|
63
|
+
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(l,(0,o._)`+${i}`);return;case"integer":a.elseIf((0,o._)`${s} === "boolean" || ${i} === null
|
|
64
|
+
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,(0,o._)`+${i}`);return;case"boolean":a.elseIf((0,o._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf((0,o._)`${i} === "true" || ${i} === 1`).assign(l,!0);return;case"null":a.elseIf((0,o._)`${i} === "" || ${i} === 0 || ${i} === false`),a.assign(l,null);return;case"array":a.elseIf((0,o._)`${s} === "string" || ${s} === "number"
|
|
65
|
+
|| ${s} === "boolean" || ${i} === null`).assign(l,(0,o._)`[${i}]`)}}(e);a.else(),m(e),a.endIf(),a.if((0,o._)`${l} !== undefined`,()=>{a.assign(i,l),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,o._)`${t} !== undefined`,()=>e.assign((0,o._)`${t}[${r}]`,a))}(e,l)})}(e,r,p):m(e)})}return h};let c=new Set(["string","number","integer","boolean","null"]);function u(e,r,a,i=t.Correct){let n,s=i===t.Correct?o.operators.EQ:o.operators.NEQ;switch(e){case"null":return(0,o._)`${r} ${s} null`;case"array":n=(0,o._)`Array.isArray(${r})`;break;case"object":n=(0,o._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":n=l((0,o._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":n=l();break;default:return(0,o._)`typeof ${r} ${s} ${e}`}return i===t.Correct?n:(0,o.not)(n);function l(e=o.nil){return(0,o.and)((0,o._)`typeof ${r} == "number"`,e,a?(0,o._)`isFinite(${r})`:o.nil)}}function d(e,t,r,a){let i;if(1===e.length)return u(e[0],t,r,a);let n=(0,s.toHash)(e);if(n.array&&n.object){let e=(0,o._)`typeof ${t} != "object"`;i=n.null?e:(0,o._)`!${t} || ${e}`,delete n.null,delete n.array,delete n.object}else i=o.nil;for(let e in n.number&&delete n.integer,n)i=(0,o.and)(i,u(e,t,r,a));return i}e.checkDataType=u,e.checkDataTypes=d;let p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:a}=e,i=(0,s.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:i,schemaValue:i,parentSchema:a,params:{},it:e}}(e);(0,n.reportError)(t,p)}e.reportTypeError=m}),cs=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=l7(),r=ce();function a(e,a,i){let{gen:n,compositeRule:o,data:s,opts:l}=e;if(void 0===i)return;let c=(0,t._)`${s}${(0,t.getProperty)(a)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=(0,t._)`${c} === undefined`;"empty"===l.useDefaults&&(u=(0,t._)`${u} || ${c} === null || ${c} === ""`),n.if(u,(0,t._)`${c} = ${(0,t.stringify)(i)}`)}e.assignDefaults=function(e,t){let{properties:r,items:i}=e.schema;if("object"===t&&r)for(let t in r)a(e,t,r[t].default);else"array"===t&&Array.isArray(i)&&i.forEach((t,r)=>a(e,r,t.default))}}),cl=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=l7(),r=ce(),a=ct(),i=ce();function n(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}function o(e,r,a){return(0,t._)`${n(e)}.call(${r}, ${a})`}function s(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} === undefined`;return i?(0,t.or)(n,(0,t.not)(o(e,r,a))):n}function l(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}e.checkReportMissingProp=function(e,r){let{gen:a,data:i,it:n}=e;a.if(s(a,i,r,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${r}`},!0),e.error()})},e.checkMissingProp=function({gen:e,data:r,it:{opts:a}},i,n){return(0,t.or)(...i.map(i=>(0,t.and)(s(e,r,i,a.ownProperties),(0,t._)`${n} = ${i}`)))},e.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},e.hasPropFunc=n,e.isOwnProperty=o,e.propertyInData=function(e,r,a,i){let n=(0,t._)`${r}${(0,t.getProperty)(a)} !== undefined`;return i?(0,t._)`${n} && ${o(e,r,a)}`:n},e.noPropertyInData=s,e.allSchemaProperties=l,e.schemaProperties=function(e,t){return l(t).filter(a=>!(0,r.alwaysValidSchema)(e,t[a]))},e.callValidateCode=function({schemaCode:e,data:r,it:{gen:i,topSchemaRef:n,schemaPath:o,errorPath:s},it:l},c,u,d){let p=d?(0,t._)`${e}, ${r}, ${n}${o}`:r,m=[[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,s)],[a.default.parentData,l.parentData],[a.default.parentDataProperty,l.parentDataProperty],[a.default.rootData,a.default.rootData]];l.opts.dynamicRef&&m.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);let h=(0,t._)`${p}, ${i.object(...m)}`;return u!==t.nil?(0,t._)`${c}.call(${u}, ${h})`:(0,t._)`${c}(${h})`};let c=(0,t._)`new RegExp`;e.usePattern=function({gen:e,it:{opts:r}},a){let n=r.unicodeRegExp?"u":"",{regExp:o}=r.code,s=o(a,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,t._)`${"new RegExp"===o.code?c:(0,i.useFunc)(e,o)}(${a}, ${n})`})},e.validateArray=function(e){let{gen:a,data:i,keyword:n,it:o}=e,s=a.name("valid");if(o.allErrors){let e=a.let("valid",!0);return l(()=>a.assign(e,!1)),e}return a.var(s,!0),l(()=>a.break()),s;function l(o){let l=a.const("len",(0,t._)`${i}.length`);a.forRange("i",0,l,i=>{e.subschema({keyword:n,dataProp:i,dataPropType:r.Type.Num},s),a.if((0,t.not)(s),o)})}},e.validateUnion=function(e){let{gen:a,schema:i,keyword:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(i.some(e=>(0,r.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=a.let("valid",!1),l=a.name("_valid");a.block(()=>i.forEach((r,i)=>{let o=e.subschema({keyword:n,schemaProp:i,compositeRule:!0},l);a.assign(s,(0,t._)`${s} || ${l}`),e.mergeValidEvaluated(o,l)||a.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}}),cc=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=l7(),r=ct(),a=cl(),i=cr();function n(e){let{gen:r,data:a,it:i}=e;r.if(i.parentData,()=>r.assign(a,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function o(e,r,a){if(void 0===a)throw Error(`keyword "${r}" failed to compile`);return e.scopeValue("keyword","function"==typeof a?{ref:a}:{ref:a,code:(0,t.stringify)(a)})}e.macroKeywordCode=function(e,r){let{gen:a,keyword:i,schema:n,parentSchema:s,it:l}=e,c=r.macro.call(l.self,n,s,l),u=o(a,i,c);!1!==l.opts.validateSchema&&l.self.validateSchema(c,!0);let d=a.name("valid");e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${l.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},e.funcKeywordCode=function(e,s){var l;let{gen:c,keyword:u,schema:d,parentSchema:p,$data:m,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,s);let f=o(c,u,!m&&s.compile?s.compile.call(h.self,d,p,h):s.validate),g=c.let("valid");function y(i=s.async?(0,t._)`await `:t.nil){let n=h.opts.passContext?r.default.this:r.default.self,o=!("compile"in s&&!m||!1===s.schema);c.assign(g,(0,t._)`${i}${(0,a.callValidateCode)(e,f,n,o)}`,s.modifying)}function v(e){var r;c.if((0,t.not)(null!=(r=s.valid)?r:g),e)}e.block$data(g,function(){if(!1===s.errors)y(),s.modifying&&n(e),v(()=>e.error());else{let a,o,l=s.async?(a=c.let("ruleErrs",null),c.try(()=>y((0,t._)`await `),e=>c.assign(g,!1).if((0,t._)`${e} instanceof ${h.ValidationError}`,()=>c.assign(a,(0,t._)`${e}.errors`),()=>c.throw(e))),a):(o=(0,t._)`${f}.errors`,c.assign(o,null),y(t.nil),o);s.modifying&&n(e),v(()=>(function(e,a){let{gen:n}=e;n.if((0,t._)`Array.isArray(${a})`,()=>{n.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${a} : ${r.default.vErrors}.concat(${a})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(l=s.valid)?l:g)},e.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},e.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:a},i,n){if(Array.isArray(i.keyword)?!i.keyword.includes(n):i.keyword!==n)throw Error("ajv implementation error");let o=i.dependencies;if(null==o?void 0:o.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[n])){let e=`keyword "${n}" value is invalid at path "${a}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}}),cu=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=l7(),r=ce();e.getSubschema=function(e,{keyword:a,schemaProp:i,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:l}){if(void 0!==a&&void 0!==n)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==a){let n=e.schema[a];return void 0===i?{schema:n,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${e.errSchemaPath}/${a}`}:{schema:n[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${a}/${(0,r.escapeFragment)(i)}`}}if(void 0!==n){if(void 0===o||void 0===s||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:l,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')},e.extendSubschemaData=function(e,a,{dataProp:i,dataPropType:n,data:o,dataTypes:s,propertyName:l}){if(void 0!==o&&void 0!==i)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=a;if(void 0!==i){let{errorPath:o,dataPathArr:s,opts:l}=a;u(c.let("data",(0,t._)`${a.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,r.getErrorPath)(i,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}function u(t){e.data=t,e.dataLevel=a.dataLevel+1,e.dataTypes=[],a.definedProperties=new Set,e.parentData=a.data,e.dataNames=[...a.dataNames,t]}void 0!==o&&(u(o instanceof t.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),s&&(e.dataTypes=s)},e.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:i,allErrors:n}){void 0!==a&&(e.compositeRule=a),void 0!==i&&(e.createErrors=i),void 0!==n&&(e.allErrors=n),e.jtdDiscriminator=t,e.jtdMetadata=r}}),cd=O((e,t)=>{t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(i=a;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(n=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,n[i]))return!1;for(i=a;0!=i--;){var a,i,n,o=n[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}}),cp=O((e,t)=>{var r=t.exports=function(e,t,a){"function"==typeof t&&(a=t,t={});var i="function"==typeof(a=t.cb||a)?a:a.pre||function(){};!function e(t,a,i,n,o,s,l,c,u,d){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var p in a(n,o,s,l,c,u,d),n){var m=n[p];if(Array.isArray(m)){if(p in r.arrayKeywords)for(var h=0;h<m.length;h++)e(t,a,i,m[h],o+"/"+p+"/"+h,s,o,p,n,h)}else if(p in r.propsKeywords){if(m&&"object"==typeof m)for(var f in m)e(t,a,i,m[f],o+"/"+p+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),s,o,p,n,f)}else(p in r.keywords||t.allKeys&&!(p in r.skipKeywords))&&e(t,a,i,m,o+"/"+p,s,o,p,n)}i(n,o,s,l,c,u,d)}}(t,i,a.post||function(){},e,"",e)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}}),cm=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=ce(),r=cd(),a=cp(),i=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);e.inlineRef=function(e,r=!0){return"boolean"==typeof e||(!0===r?!function e(t){for(let r in t){if(n.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!r&&function e(r){let a=0;for(let n in r)if("$ref"===n||(a++,!i.has(n)&&("object"==typeof r[n]&&(0,t.eachItem)(r[n],t=>a+=e(t)),a===1/0)))return 1/0;return a}(e)<=r)};let n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function o(e,t="",r){return!1!==r&&(t=c(t)),s(e,e.parse(t))}function s(e,t){return e.serialize(t).split("#")[0]+"#"}e.getFullPath=o,e._getFullPath=s;let l=/#\/?$/;function c(e){return e?e.replace(l,""):""}e.normalizeId=c,e.resolveUrl=function(e,t,r){return r=c(r),e.resolve(t,r)};let u=/^[a-z_][-a-z0-9._]*$/i;e.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:i,uriResolver:n}=this.opts,s=c(e[i]||t),l={"":s},d=o(n,s,!1),p={},m=new Set;return a(e,{allKeys:!0},(e,t,r,a)=>{if(void 0===a)return;let n=d+t,o=l[a];function s(t){let r=this.opts.uriResolver.resolve;if(t=c(o?r(o,t):t),m.has(t))throw f(t);m.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?h(e,a.schema,t):t!==c(n)&&("#"===t[0]?(h(e,p[t],t),p[t]=e):this.refs[t]=n),t}function g(e){if("string"==typeof e){if(!u.test(e))throw Error(`invalid anchor "${e}"`);s.call(this,`#${e}`)}}"string"==typeof e[i]&&(o=s.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),l[t]=o}),p;function h(e,t,a){if(void 0!==t&&!r(e,t))throw f(a)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}}),ch=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=ca(),r=co(),a=cn(),i=co(),n=cs(),o=cc(),s=cu(),l=l7(),c=ct(),u=cm(),d=ce(),p=cr();function m({gen:e,validateName:t,schema:r,schemaEnv:a,opts:i},n){var o;i.code.es5?e.func(t,(0,l._)`${c.default.data}, ${c.default.valCxt}`,a.$async,()=>{var t,a;e.code((0,l._)`"use strict"; ${h(r,i)}`),t=e,a=i,t.if(c.default.valCxt,()=>{t.var(c.default.instancePath,(0,l._)`${c.default.valCxt}.${c.default.instancePath}`),t.var(c.default.parentData,(0,l._)`${c.default.valCxt}.${c.default.parentData}`),t.var(c.default.parentDataProperty,(0,l._)`${c.default.valCxt}.${c.default.parentDataProperty}`),t.var(c.default.rootData,(0,l._)`${c.default.valCxt}.${c.default.rootData}`),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{t.var(c.default.instancePath,(0,l._)`""`),t.var(c.default.parentData,(0,l._)`undefined`),t.var(c.default.parentDataProperty,(0,l._)`undefined`),t.var(c.default.rootData,c.default.data),a.dynamicRef&&t.var(c.default.dynamicAnchors,(0,l._)`{}`)}),e.code(n)}):e.func(t,(0,l._)`${c.default.data}, ${(o=i,(0,l._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${o.dynamicRef?(0,l._)`, ${c.default.dynamicAnchors}={}`:l.nil}}={}`)}`,a.$async,()=>e.code(h(r,i)).code(n))}function h(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,l._)`/*# sourceURL=${r} */`:l.nil}function f({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function y(e){(0,d.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:a,self:i}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,t){if(e.opts.jtd)return b(e,[],!1,t);let a=(0,r.getSchemaTypes)(e.schema);b(e,a,!(0,r.coerceAndCheckDataType)(e,a),t)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:i}){let n=r.$comment;if(!0===i.$comment)e.code((0,l._)`${c.default.self}.logger.log(${n})`);else if("function"==typeof i.$comment){let r=(0,l.str)`${a}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${c.default.self}.opts.$comment(${n}, ${r}, ${i}.schema)`)}}function b(e,t,r,n){var o,s,u,p;let{gen:m,schema:h,data:f,allErrors:g,opts:y,self:v}=e,{RULES:_}=v;if(h.$ref&&(y.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(h,_)))return void m.block(()=>R(e,"$ref",_.all.$ref.definition));function b(o){(0,a.shouldUseGroup)(h,o)&&(o.type?(m.if((0,i.checkDataType)(o.type,f,y.strictNumbers)),S(e,o),1===t.length&&t[0]===o.type&&r&&(m.else(),(0,i.reportTypeError)(e)),m.endIf()):S(e,o),g||m.if((0,l._)`${c.default.errors} === ${n||0}`))}y.jtd||(o=e,s=t,!o.schemaEnv.meta&&o.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{$(e.dataTypes,t)||w(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let a of e.dataTypes)$(t,a)?r.push(a):t.includes("integer")&&"number"===a&&r.push("integer");e.dataTypes=r}(e,t)}}(o,s),o.opts.allowUnionTypes||(u=o,(p=s).length>1&&!(2===p.length&&p.includes("null"))&&w(u,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if("object"==typeof n&&(0,a.shouldUseRule)(e.schema,n)){let{type:r}=n.definition;r.length&&!r.some(e=>{var r,a;return r=t,a=e,r.includes(a)||"number"===a&&r.includes("integer")})&&w(e,`missing type "${r.join(",")}" for keyword "${i}"`)}}}(o,o.dataTypes))),m.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function S(e,t){let{gen:r,schema:i,opts:{useDefaults:o}}=e;o&&(0,n.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,a.shouldUseRule)(i,r)&&R(e,r.keyword,r.definition,t.type)})}function $(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function w(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}e.validateFunctionCode=function(e){g(e)&&(y(e),f(e))?function(e){let{schema:t,opts:r,gen:a}=e;m(e,()=>{r.$comment&&t.$comment&&_(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),a.let(c.default.vErrors,null),a.let(c.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,l._)`${r}.evaluated`),t.if((0,l._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,l._)`${e.evaluated}.props`,(0,l._)`undefined`)),t.if((0,l._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,l._)`${e.evaluated}.items`,(0,l._)`undefined`))}(e),v(e),function(e){let{gen:t,schemaEnv:r,validateName:a,ValidationError:i,opts:n}=e;r.$async?t.if((0,l._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,l._)`new ${i}(${c.default.vErrors})`)):(t.assign((0,l._)`${a}.errors`,c.default.vErrors),n.unevaluated&&function({gen:e,evaluated:t,props:r,items:a}){r instanceof l.Name&&e.assign((0,l._)`${t}.props`,r),a instanceof l.Name&&e.assign((0,l._)`${t}.items`,a)}(e),t.return((0,l._)`${c.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,t.topBoolOrEmptySchema)(e))};var k=class{constructor(e,t,r){if((0,o.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",E(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,l.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,l._)`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=l.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=l.nil,t=l.nil){if(!this.$data)return;let{gen:r,schemaCode:a,schemaType:i,def:n}=this;r.if((0,l.or)((0,l._)`${a} === undefined`,t)),e!==l.nil&&r.assign(e,!0),(i.length||n.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==l.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:a,it:n}=this;return(0,l.or)(function(){if(r.length){if(!(t instanceof l.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,l._)`${(0,i.checkDataTypes)(e,t,n.opts.strictNumbers,i.DataType.Wrong)}`}return l.nil}(),function(){if(a.validateSchema){let r=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}())}subschema(e,r){let a=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(a,this.it,e),(0,s.extendSubschemaMode)(a,e);let i={...this.it,...a,items:void 0,props:void 0};return!function(e,r){if(g(e)&&(y(e),f(e)))return function(e,t){var r;let a,{schema:i,gen:n,opts:o}=e;o.$comment&&i.$comment&&_(e),(a=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,u.resolveUrl)(r.opts.uriResolver,r.baseId,a)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let s=n.const("_errs",c.default.errors);v(e,s),n.var(t,(0,l._)`${s} === ${c.default.errors}`)}(e,r);(0,t.boolOrEmptySchema)(e,r)}(i,r),i}mergeEvaluated(e,t){let{it:r,gen:a}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(a,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(a,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:a}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return a.if(t,()=>this.mergeEvaluated(e,l.Name)),!0}};function R(e,t,r,a){let i=new k(e,r,t);"code"in r?r.code(i,a):i.$data&&r.validate?(0,o.funcKeywordCode)(i,r):"macro"in r?(0,o.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,o.funcKeywordCode)(i,r)}e.KeywordCxt=k;let x=/^\/(?:[^~]|~0|~1)*$/,P=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function E(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let i,n;if(""===e)return c.default.rootData;if("/"===e[0]){if(!x.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,n=c.default.rootData}else{let o=P.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let l=+o[1];if("#"===(i=o[2])){if(l>=t)throw Error(s("property/index",l));return a[t-l]}if(l>t)throw Error(s("data",l));if(n=r[t-l],!i)return n}let o=n;for(let e of i.split("/"))e&&(n=(0,l._)`${n}${(0,l.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,l._)`${o} && ${n}`);return o;function s(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}e.getData=E}),cf=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}}),cg=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cm();e.default=class extends Error{constructor(e,r,a,i){super(i||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,t.resolveUrl)(e,r,a),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}}),cy=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=l7(),r=cf(),a=ct(),i=cm(),n=ce(),o=ch();var s=class{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,i.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}};function l(e){let n,s,l=u.call(this,e);if(l)return l;let c=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:d,lines:p}=this.opts.code,{ownProperties:m}=this.opts,h=new t.CodeGen(this.scope,{es5:d,lines:p,ownProperties:m});e.$async&&(n=h.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let f=h.scopeName("validate");e.validateName=f;let g={gen:h,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:n,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,o.validateFunctionCode)(g),h.optimize(this.opts.code.optimize);let r=h.toString();s=`${h.scopeRefs(a.default.scope)}return ${r}`,this.opts.code.process&&(s=this.opts.code.process(s,e));let i=Function(`${a.default.self}`,`${a.default.scope}`,s)(this,this.scope.get());if(this.scope.value(f,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:f,validateCode:r,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:r}=g;i.evaluated={props:e instanceof t.Name?void 0:e,items:r instanceof t.Name?void 0:r,dynamicProps:e instanceof t.Name,dynamicItems:r instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,s&&this.logger.error("Error compiling schema, function code:",s),t}finally{this._compilations.delete(e)}}function c(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:l.call(this,e)}function u(e){for(let a of this._compilations){var t,r;if(t=a,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return a}}function d(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){let r=this.opts.uriResolver.parse(t),a=(0,i._getFullPath)(this.opts.uriResolver,r),n=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===n)return h.call(this,r,e);let o=(0,i.normalizeId)(a),c=this.refs[o]||this.schemas[o];if("string"==typeof c){let t=p.call(this,e,c);if("object"!=typeof(null==t?void 0:t.schema))return;return h.call(this,r,t)}if("object"==typeof(null==c?void 0:c.schema)){if(c.validate||l.call(this,c),o===(0,i.normalizeId)(t)){let{schema:t}=c,{schemaId:r}=this.opts,a=t[r];return a&&(n=(0,i.resolveUrl)(this.opts.uriResolver,n,a)),new s({schema:t,schemaId:r,root:e,baseId:n})}return h.call(this,r,c)}}e.SchemaEnv=s,e.compileSchema=l,e.resolveRef=function(e,t,r){var a;r=(0,i.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=d.call(this,e,r);if(void 0===o){let i=null==(a=e.localRefs)?void 0:a[r],{schemaId:n}=this.opts;i&&(o=new s({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==o)return e.refs[r]=c.call(this,o)},e.getCompilingSchema=u,e.resolveSchema=p;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,{baseId:t,schema:r,root:a}){var o;let l;if((null==(o=e.fragment)?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;let o="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(a)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,r.$ref);l=p.call(this,a,e)}let{schemaId:c}=this.opts;if((l=l||new s({schema:r,schemaId:c,root:a,baseId:t})).schema!==l.root.schema)return l}}),cv=O((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),c_=O((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),a=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(48!==(r=e[a].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(!((r=e[a].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}function n(e){return e.length=0,!0}function o(e,t,r){if(e.length){let a=i(e);if(""===a)return r.error=!0,!1;t.push(a),e.length=0}return!0}function s(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,":"))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},a=[],s=[],l=!1,c=!1,u=o;for(let i=0;i<e.length;i++){let o=e[i];if("["!==o&&"]"!==o)if(":"===o){if(!0===l&&(c=!0),!u(s,a,r))break;if(++t>7){r.error=!0;break}i>0&&":"===e[i-1]&&(l=!0),a.push(":");continue}else if("%"===o){if(!u(s,a,r))break;u=n}else{s.push(o);continue}}return s.length&&(u===n?r.zone=s.join(""):c?a.push(s.join("")):a.push(i(s))),r.address=a.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}t.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let r=unescape(e.host);if(!a(r)){let t=s(r);r=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(r)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){let r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e,r=[],a=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===i&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(a=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")},isIPv4:a,isUUID:r,normalizeIPv6:s,stringArrayToHexStripped:i}}),cb=O((e,t)=>{let{isUUID:r}=c_(),a=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let l={scheme:"http",domainHost:!0,parse:o,serialize:s},c={scheme:"https",domainHost:l.domainHost,parse:o,serialize:s},u={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},d={scheme:"wss",domainHost:u.domainHost,parse:u.parse,serialize:u.serialize},p={http:l,https:c,ws:u,wss:d,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(a);if(r){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=m(`${a}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",a=e.nid.toLowerCase(),i=m(`${r}:${t.nid||a}`);i&&(e=i.serialize(e,t));let n=e,o=e.nss;return n.path=`${a||t.nid}:${o}`,t.skipEscape=!0,n},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&r(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function m(e){return e&&(p[e]||p[e.toLowerCase()])||void 0}Object.setPrototypeOf(p,null),t.exports={wsIsSecure:n,SCHEMES:p,isValidSchemeName:function(e){return -1!==i.indexOf(e)},getSchemeHandler:m}}),cS=O((e,t)=>{let{normalizeIPv6:r,removeDotSegments:a,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:s}=c_(),{SCHEMES:l,getSchemeHandler:c}=cb();function u(e,t,r,i){let n={};return i||(e=m(d(e,r),r),t=m(d(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=a(t.path||""),n.query=t.query):(t.path?("/"===t.path[0]?n.path=a(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=a(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function d(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],s=c(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),void 0!==r.path&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==n.reference&&r.scheme&&o.push(r.scheme,":");let l=i(r);if(void 0!==l&&("suffix"!==n.reference&&o.push("//"),o.push(l),r.path&&"/"!==r.path[0]&&o.push("/")),void 0!==r.path){let e=r.path;n.absolutePath||s&&s.absolutePath||(e=a(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),o.push(e)}return void 0!==r.query&&o.push("?",r.query),void 0!==r.fragment&&o.push("#",r.fragment),o.join("")}let p=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(e,t){let a=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;"suffix"===a.reference&&(e=a.scheme?a.scheme+":"+e:"//"+e);let l=e.match(p);if(l){if(i.scheme=l[1],i.userinfo=l[3],i.host=l[4],i.port=parseInt(l[5],10),i.path=l[6]||"",i.query=l[7],i.fragment=l[8],isNaN(i.port)&&(i.port=l[5]),i.host)if(!1===o(i.host)){let e=r(i.host);i.host=e.host.toLowerCase(),n=e.isIPV6}else n=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",a.reference&&"suffix"!==a.reference&&a.reference!==i.reference&&(i.error=i.error||"URI is not a "+a.reference+" reference.");let t=c(a.scheme||i.scheme);if(!a.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(a.domainHost||t&&t.domainHost)&&!1===n&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),t&&t.parse&&t.parse(i,a)}else i.error=i.error||"URI can not be parsed.";return i}let h={SCHEMES:l,normalize:function(e,t){return"string"==typeof e?e=d(m(e,t),t):"object"==typeof e&&(e=m(d(e,t),t)),e},resolve:function(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=u(m(e,a),m(t,a),a,!0);return a.skipEscape=!0,d(i,a)},resolveComponent:u,equal:function(e,t,r){return"string"==typeof e?e=d(n(m(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=d(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=d(n(m(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=d(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:d,parse:m};t.exports=h,t.exports.default=h,t.exports.fastUri=h}),c$=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cS();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),cw=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=ch();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=l7();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let a=cf(),i=cg(),n=ci(),o=cy(),s=l7(),l=cm(),c=co(),u=ce(),d=cv(),p=c$(),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let h=["removeAdditional","useDefaults","coerceTypes"],f=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};var v=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,a,i,n,o,s,l,c,u,d,h,f,g,y,v,_,b,S,$,w,k,R,x,P;let E=e.strict,T=null==(t=e.code)?void 0:t.optimize,j=!0===T||void 0===T?1:T||0,O=null!=(a=null==(r=e.code)?void 0:r.regExp)?a:m,C=null!=(i=e.uriResolver)?i:p.default;return{strictSchema:null==(o=null!=(n=e.strictSchema)?n:E)||o,strictNumbers:null==(l=null!=(s=e.strictNumbers)?s:E)||l,strictTypes:null!=(u=null!=(c=e.strictTypes)?c:E)?u:"log",strictTuples:null!=(h=null!=(d=e.strictTuples)?d:E)?h:"log",strictRequired:null!=(g=null!=(f=e.strictRequired)?f:E)&&g,code:e.code?{...e.code,optimize:j,regExp:O}:{optimize:j,regExp:O},loopRequired:null!=(y=e.loopRequired)?y:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(S=e.inlineRefs)||S,schemaId:null!=($=e.schemaId)?$:"$id",addUsedSchema:null==(w=e.addUsedSchema)||w,validateSchema:null==(k=e.validateSchema)||k,validateFormats:null==(R=e.validateFormats)||R,unicodeRegExp:null==(x=e.unicodeRegExp)||x,int32range:null==(P=e.int32range)||P,uriResolver:C}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:f,es5:t,lines:r}),this.logger=function(e){if(!1===e)return R;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const a=e.validateFormats;e.validateFormats=!1,this.RULES=(0,n.getRules)(),_.call(this,g,e,"NOT SUPPORTED"),_.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=k.call(this),e.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&w.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),S.call(this),e.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,a=d;"id"===r&&((a={...d}).id=a.$id,delete a.$id),t&&e&&this.addMetaSchema(a,a[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let a=r(t);return"$async"in r||(this.errors=r.errors),a}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return a.call(this,e,t);async function a(e,t){await n.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||o.call(this,r)}async function n(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await l.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await c.call(this,e);this.refs[e]||await n.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function c(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,a=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,a);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,a,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let a=this.validate(r,e);if(!a&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return a}getSchema(e){let t;for(;"string"==typeof(t=b.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:r});if(!(t=o.resolveSchema.call(this,a,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=b.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,l.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(P.call(this,r,t),!t)return(0,u.eachItem)(r,e=>E.call(this,e)),this;j.call(this,t);let a={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===a.type.length?e=>E.call(this,e,a):e=>a.type.forEach(t=>E.call(this,e,a,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let a of(e=JSON.parse(JSON.stringify(e)),t)){let t=a.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:a}=t.definition,n=i[e];a&&n&&(i[e]=C(n))}}return e}_removeAllSchemas(e,t){for(let r in e){let a=e[r];(!t||t.test(r))&&("string"==typeof a?delete e[r]:a&&!a.meta&&(this._cache.delete(a.schema),delete e[r]))}}_addSchema(e,t,r,a=this.opts.validateSchema,i=this.opts.addUsedSchema){let n,{schemaId:s}=this.opts;if("object"==typeof e)n=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let c=this._cache.get(e);if(void 0!==c)return c;r=(0,l.normalizeId)(n||r);let u=l.getSchemaRefs.call(this,e,r);return c=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:u}),this._cache.set(c.schema,c),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=c),a&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};function _(e,t,r,a="error"){for(let i in e)i in t&&this.logger[a](`${r}: option ${i}. ${e[i]}`)}function b(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function S(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function $(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function w(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function k(){let e={...this.opts};for(let t of h)delete e[t];return e}v.ValidationError=a.default,v.MissingRefError=i.default,e.default=v;let R={log(){},warn(){},error(){}},x=/^[a-z_$][a-z0-9_$:-]*$/i;function P(e,t){let{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!x.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function E(e,t,r){var a;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:n}=this,o=i?n.post:n.rules.find(({type:e})=>e===r);if(o||(o={type:r,rules:[]},n.rules.push(o)),n.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?T.call(this,o,s,t.before):o.rules.push(s),n.all[e]=s,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function T(e,t,r){let a=e.rules.findIndex(e=>e.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=C(t)),e.validateSchema=this.compile(t,!0))}let O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(e){return{anyOf:[e,O]}}}),ck=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}}),cR=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=cg(),r=cl(),a=l7(),i=ct(),n=cy(),o=ce();function s(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,a._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function l(e,t,n,s){let{gen:l,it:c}=e,{allErrors:u,schemaEnv:d,opts:p}=c,m=p.passContext?i.default.this:a.nil;function h(e){let t=(0,a._)`${e}.errors`;l.assign(i.default.vErrors,(0,a._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),l.assign(i.default.errors,(0,a._)`${i.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;let r=null==(t=null==n?void 0:n.validate)?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=o.mergeEvaluated.props(l,r.props,c.props));else{let t=l.var("props",(0,a._)`${e}.evaluated.props`);c.props=o.mergeEvaluated.props(l,t,c.props,a.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=o.mergeEvaluated.items(l,r.items,c.items));else{let t=l.var("items",(0,a._)`${e}.evaluated.items`);c.items=o.mergeEvaluated.items(l,t,c.items,a.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let i=l.let("valid");l.try(()=>{l.code((0,a._)`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),u||l.assign(i,!0)},e=>{l.if((0,a._)`!(${e} instanceof ${c.ValidationError})`,()=>l.throw(e)),h(e),u||l.assign(i,!1)}),e.ok(i)}():e.result((0,r.callValidateCode)(e,t,m),()=>f(t),()=>h(t))}e.getValidate=s,e.callRef=l,e.default={keyword:"$ref",schemaType:"string",code(e){var r,i;let o,c,u,{gen:d,schema:p,it:m}=e,{baseId:h,schemaEnv:f,validateName:g,opts:y,self:v}=m,{root:_}=f;if(("#"===p||"#/"===p)&&h===_.baseId){if(f===_)return l(e,g,f,f.$async);let t=d.scopeValue("root",{ref:_});return l(e,(0,a._)`${t}.validate`,_,_.$async)}let b=n.resolveRef.call(v,_,h,p);if(void 0===b)throw new t.default(m.opts.uriResolver,h,p);return b instanceof n.SchemaEnv?void l(e,s(e,r=b),r,r.$async):(i=b,o=d.scopeValue("schema",!0===y.code.source?{ref:i,code:(0,a.stringify)(i)}:{ref:i}),c=d.name("valid"),u=e.subschema({schema:i,dataTypes:[],schemaPath:a.nil,topSchemaRef:o,errSchemaPath:p},c),void(e.mergeEvaluated(u),e.ok(c)))}}}),cx=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ck(),r=cR();e.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default]}),cP=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=t.operators,a={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}};e.default={keyword:Object.keys(a),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must be ${a[e].okStr} ${r}`,params:({keyword:e,schemaCode:r})=>(0,t._)`{comparison: ${a[e].okStr}, limit: ${r}}`},code(e){let{keyword:r,data:i,schemaCode:n}=e;e.fail$data((0,t._)`${i} ${a[r].fail} ${n} || isNaN(${i})`)}}}),cE=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7();e.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:r,data:a,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=r.let("res"),l=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${a}/${i}, ${l}))`)}}}),cT=O(e=>{function t(e){let t,r=e.length,a=0,i=0;for(;i<r;)a++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return a}Object.defineProperty(e,"__esModule",{value:!0}),e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),cj=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce(),a=cT();e.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${r} characters`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:n,schemaCode:o,it:s}=e,l="maxLength"===i?t.operators.GT:t.operators.LT,c=!1===s.opts.unicode?(0,t._)`${n}.length`:(0,t._)`${(0,r.useFunc)(e.gen,a.default)}(${n})`;e.fail$data((0,t._)`${c} ${l} ${o}`)}}}),cO=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cl(),r=ce(),a=l7();e.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,a._)`{pattern: ${e}}`},code(e){let{gen:i,data:n,$data:o,schema:s,schemaCode:l,it:c}=e,u=c.opts.unicodeRegExp?"u":"";if(o){let{regExp:t}=c.opts.code,o="new RegExp"===t.code?(0,a._)`new RegExp`:(0,r.useFunc)(i,t),s=i.let("valid");i.try(()=>i.assign(s,(0,a._)`${o}(${l}, ${u}).test(${n})`),()=>i.assign(s,!1)),e.fail$data((0,a._)`!${s}`)}else{let r=(0,t.usePattern)(e,s);e.fail$data((0,a._)`!${r}.test(${n})`)}}}}),cC=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7();e.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${r} properties`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:a,schemaCode:i}=e,n="maxProperties"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${a}).length ${n} ${i}`)}}}),cN=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cl(),r=l7(),a=ce();e.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,r.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,r._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:n,schemaCode:o,data:s,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;let d=n.length>=u.loopRequired;if(c.allErrors?function(){if(d||l)e.block$data(r.nil,p);else for(let r of n)(0,t.checkReportMissingProp)(e,r)}():function(){let a=i.let("missing");if(d||l){let n=i.let("valid",!0);e.block$data(n,()=>{var l,c;return l=a,c=n,void(e.setParams({missingProperty:l}),i.forOf(l,o,()=>{i.assign(c,(0,t.propertyInData)(i,s,l,u.ownProperties)),i.if((0,r.not)(c),()=>{e.error(),i.break()})},r.nil))}),e.ok(n)}else i.if((0,t.checkMissingProp)(e,n,a)),(0,t.reportMissingProp)(e,a),i.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:r}=e.it;for(let e of n)if((null==t?void 0:t[e])===void 0&&!r.has(e)){let t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,a.checkStrictMode)(c,t,c.opts.strictRequired)}}function p(){i.forOf("prop",o,r=>{e.setParams({missingProperty:r}),i.if((0,t.noPropertyInData)(i,s,r,u.ownProperties),()=>e.error())})}}}}),cI=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7();e.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:r})=>(0,t.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${r} items`,params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:r,data:a,schemaCode:i}=e,n="maxItems"===r?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${a}.length ${n} ${i}`)}}}),cq=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cd();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),cz=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=co(),r=l7(),a=ce(),i=cq();e.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,r.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,r._)`{i: ${e}, j: ${t}}`},code(e){let{gen:n,data:o,$data:s,schema:l,parentSchema:c,schemaCode:u,it:d}=e;if(!s&&!l)return;let p=n.let("valid"),m=c.items?(0,t.getSchemaTypes)(c.items):[];e.block$data(p,function(){let s=n.let("i",(0,r._)`${o}.length`),l=n.let("j");e.setParams({i:s,j:l}),n.assign(p,!0),n.if((0,r._)`${s} > 1`,()=>(m.length>0&&!m.some(e=>"object"===e||"array"===e)?function(a,i){let s=n.name("item"),l=(0,t.checkDataTypes)(m,s,d.opts.strictNumbers,t.DataType.Wrong),c=n.const("indices",(0,r._)`{}`);n.for((0,r._)`;${a}--;`,()=>{n.let(s,(0,r._)`${o}[${a}]`),n.if(l,(0,r._)`continue`),m.length>1&&n.if((0,r._)`typeof ${s} == "string"`,(0,r._)`${s} += "_"`),n.if((0,r._)`typeof ${c}[${s}] == "number"`,()=>{n.assign(i,(0,r._)`${c}[${s}]`),e.error(),n.assign(p,!1).break()}).code((0,r._)`${c}[${s}] = ${a}`)})}:function(t,s){let l=(0,a.useFunc)(n,i.default),c=n.name("outer");n.label(c).for((0,r._)`;${t}--;`,()=>n.for((0,r._)`${s} = ${t}; ${s}--;`,()=>n.if((0,r._)`${l}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),n.assign(p,!1).break(c)})))})(s,l))},(0,r._)`${u} === false`),e.ok(p)}}}),cA=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce(),a=cq();e.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:n,$data:o,schemaCode:s,schema:l}=e;o||l&&"object"==typeof l?e.fail$data((0,t._)`!${(0,r.useFunc)(i,a.default)}(${n}, ${s})`):e.fail((0,t._)`${l} !== ${n}`)}}}),cM=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce(),a=cq();e.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let i,n,{gen:o,data:s,$data:l,schema:c,schemaCode:u,it:d}=e;if(!l&&0===c.length)throw Error("enum must have non-empty array");let p=c.length>=d.opts.loopEnum,m=()=>null!=i?i:i=(0,r.useFunc)(o,a.default);if(p||l)n=o.let("valid"),e.block$data(n,function(){o.assign(n,!1),o.forOf("v",u,e=>o.if((0,t._)`${m()}(${s}, ${e})`,()=>o.assign(n,!0).break()))});else{if(!Array.isArray(c))throw Error("ajv implementation error");let e=o.const("vSchema",u);n=(0,t.or)(...c.map((r,a)=>{var i,n;let o;return i=e,"object"==typeof(o=c[n=a])&&null!==o?(0,t._)`${m()}(${s}, ${i}[${n}])`:(0,t._)`${s} === ${o}`}))}e.pass(n)}}}),cL=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cP(),r=cE(),a=cj(),i=cO(),n=cC(),o=cN(),s=cI(),l=cz(),c=cA(),u=cM();e.default=[t.default,r.default,a.default,i.default,n.default,o.default,s.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default]}),cZ=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=l7(),r=ce();function a(e,a){let{gen:i,schema:n,data:o,keyword:s,it:l}=e;l.items=!0;let c=i.const("len",(0,t._)`${o}.length`);if(!1===n)e.setParams({len:a.length}),e.pass((0,t._)`${c} <= ${a.length}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(l,n)){let n=i.var("valid",(0,t._)`${c} <= ${a.length}`);i.if((0,t.not)(n),()=>{var o;return o=n,void i.forRange("i",a.length,c,a=>{e.subschema({keyword:s,dataProp:a,dataPropType:r.Type.Num},o),l.allErrors||i.if((0,t.not)(o),()=>i.break())})}),e.ok(n)}}e.validateAdditionalItems=a,e.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:i}=e,{items:n}=t;Array.isArray(n)?a(e,n):(0,r.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas')}}}),cD=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=l7(),r=ce(),a=cl();function i(e,a,n=e.schema){let{gen:o,parentSchema:s,data:l,keyword:c,it:u}=e;(function(e){let{opts:t,errSchemaPath:i}=u,o=n.length,s=o===e.minItems&&(o===e.maxItems||!1===e[a]);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${a} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(u,e,t.strictTuples)}})(s),u.opts.unevaluated&&n.length&&!0!==u.items&&(u.items=r.mergeEvaluated.items(o,n.length,u.items));let d=o.name("valid"),p=o.const("len",(0,t._)`${l}.length`);n.forEach((a,i)=>{(0,r.alwaysValidSchema)(u,a)||(o.if((0,t._)`${p} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},d)),e.ok(d))})}e.validateTuple=i,e.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return i(e,"additionalItems",t);n.items=!0,(0,r.alwaysValidSchema)(n,t)||e.ok((0,a.validateArray)(e))}}}),cV=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cD();e.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,t.validateTuple)(e,"items")}}),cU=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce(),a=cl(),i=cZ();e.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:n,it:o}=e,{prefixItems:s}=n;o.items=!0,(0,r.alwaysValidSchema)(o,t)||(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,a.validateArray)(e)))}}}),cF=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce();e.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:r}})=>void 0===r?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${r} valid item(s)`,params:({params:{min:e,max:r}})=>void 0===r?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${r}}`},code(e){let a,i,{gen:n,schema:o,parentSchema:s,data:l,it:c}=e,{minContains:u,maxContains:d}=s;c.opts.next?(a=void 0===u?1:u,i=d):a=1;let p=n.const("len",(0,t._)`${l}.length`);if(e.setParams({min:a,max:i}),void 0===i&&0===a)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&a>i){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,o)){let r=(0,t._)`${p} >= ${a}`;void 0!==i&&(r=(0,t._)`${r} && ${p} <= ${i}`),e.pass(r);return}c.items=!0;let m=n.name("valid");function h(){let e=n.name("_valid"),r=n.let("count",0);f(e,()=>n.if(e,()=>{var e;return e=r,void(n.code((0,t._)`${e}++`),void 0===i?n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0).break()):(n.if((0,t._)`${e} > ${i}`,()=>n.assign(m,!1).break()),1===a?n.assign(m,!0):n.if((0,t._)`${e} >= ${a}`,()=>n.assign(m,!0))))}))}function f(t,a){n.forRange("i",0,p,i=>{e.subschema({keyword:"contains",dataProp:i,dataPropType:r.Type.Num,compositeRule:!0},t),a()})}void 0===i&&1===a?f(m,()=>n.if(m,()=>n.break())):0===a?(n.let(m,!0),void 0!==i&&n.if((0,t._)`${l}.length > 0`,h)):(n.let(m,!1),h()),e.result(m,()=>e.reset())}}}),cH=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=l7(),r=ce(),a=cl();e.error={message:({params:{property:e,depsCount:r,deps:a}})=>(0,t.str)`must have ${1===r?"property":"properties"} ${a} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:a,missingProperty:i}})=>(0,t._)`{property: ${e},
|
|
66
|
+
missingProperty: ${i},
|
|
67
|
+
depsCount: ${r},
|
|
68
|
+
deps: ${a}}`};let i={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let a in e)"__proto__"!==a&&((Array.isArray(e[a])?t:r)[a]=e[a]);return[t,r]}(e);n(e,t),o(e,r)}};function n(e,r=e.schema){let{gen:i,data:o,it:s}=e;if(0===Object.keys(r).length)return;let l=i.let("missing");for(let n in r){let c=r[n];if(0===c.length)continue;let u=(0,a.propertyInData)(i,o,n,s.opts.ownProperties);e.setParams({property:n,depsCount:c.length,deps:c.join(", ")}),s.allErrors?i.if(u,()=>{for(let t of c)(0,a.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,a.checkMissingProp)(e,c,l)})`),(0,a.reportMissingProp)(e,l),i.else())}}function o(e,t=e.schema){let{gen:i,data:n,keyword:s,it:l}=e,c=i.name("valid");for(let o in t)(0,r.alwaysValidSchema)(l,t[o])||(i.if((0,a.propertyInData)(i,n,o,l.opts.ownProperties),()=>{let t=e.subschema({keyword:s,schemaProp:o},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validatePropertyDeps=n,e.validateSchemaDeps=o,e.default=i}),cJ=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce();e.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:a,schema:i,data:n,it:o}=e;if((0,r.alwaysValidSchema)(o,i))return;let s=a.name("valid");a.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),a.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||a.break()})}),e.ok(s)}}}),cK=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cl(),r=l7(),a=ct(),i=ce();e.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,r._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:n,schema:o,parentSchema:s,data:l,errsCount:c,it:u}=e;if(!c)throw Error("ajv implementation error");let{allErrors:d,opts:p}=u;if(u.props=!0,"all"!==p.removeAdditional&&(0,i.alwaysValidSchema)(u,o))return;let m=(0,t.allSchemaProperties)(s.properties),h=(0,t.allSchemaProperties)(s.patternProperties);function f(e){n.code((0,r._)`delete ${l}[${e}]`)}function g(t){if("all"===p.removeAdditional||p.removeAdditional&&!1===o)return void f(t);if(!1===o){e.setParams({additionalProperty:t}),e.error(),d||n.break();return}if("object"==typeof o&&!(0,i.alwaysValidSchema)(u,o)){let a=n.name("valid");"failing"===p.removeAdditional?(y(t,a,!1),n.if((0,r.not)(a),()=>{e.reset(),f(t)})):(y(t,a),d||n.if((0,r.not)(a),()=>n.break()))}}function y(t,r,a){let n={keyword:"additionalProperties",dataProp:t,dataPropType:i.Type.Str};!1===a&&Object.assign(n,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(n,r)}n.forIn("key",l,a=>{m.length||h.length?n.if(function(a){let o;if(m.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,"properties");o=(0,t.isOwnProperty)(n,e,a)}else o=m.length?(0,r.or)(...m.map(e=>(0,r._)`${a} === ${e}`)):r.nil;return h.length&&(o=(0,r.or)(o,...h.map(i=>(0,r._)`${(0,t.usePattern)(e,i)}.test(${a})`))),(0,r.not)(o)}(a),()=>g(a)):g(a)}),e.ok((0,r._)`${c} === ${a.default.errors}`)}}}),cB=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ch(),r=cl(),a=ce(),i=cK();e.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,parentSchema:s,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===s.additionalProperties&&i.default.code(new t.KeywordCxt(c,i.default,"additionalProperties"));let u=(0,r.allSchemaProperties)(o);for(let e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=a.mergeEvaluated.props(n,(0,a.toHash)(u),c.props));let d=u.filter(e=>!(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length)return;let p=n.name("valid");for(let t of d){var m;(m=t,c.opts.useDefaults&&!c.compositeRule&&void 0!==o[m].default)?h(t):(n.if((0,r.propertyInData)(n,l,t,c.opts.ownProperties)),h(t),c.allErrors||n.else().var(p,!0),n.endIf()),e.it.definedProperties.add(t),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}}),cG=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cl(),r=l7(),a=ce(),i=ce();e.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:n,schema:o,data:s,parentSchema:l,it:c}=e,{opts:u}=c,d=(0,t.allSchemaProperties)(o),p=d.filter(e=>(0,a.alwaysValidSchema)(c,o[e]));if(0===d.length||p.length===d.length&&(!c.opts.unevaluated||!0===c.props))return;let m=u.strictSchema&&!u.allowMatchingProperties&&l.properties,h=n.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,i.evaluatedPropsToName)(n,c.props));let{props:f}=c;for(let e of d)m&&function(e){for(let t in m)new RegExp(e).test(t)&&(0,a.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),c.allErrors?g(e):(n.var(h,!0),g(e),n.if(h));function g(a){n.forIn("key",s,o=>{n.if((0,r._)`${(0,t.usePattern)(e,a)}.test(${o})`,()=>{let t=p.includes(a);t||e.subschema({keyword:"patternProperties",schemaProp:a,dataProp:o,dataPropType:i.Type.Str},h),c.opts.unevaluated&&!0!==f?n.assign((0,r._)`${f}[${o}]`,!0):t||c.allErrors||n.if((0,r.not)(h),()=>n.break())})})}}}}),cW=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ce();e.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:r,schema:a,it:i}=e;if((0,t.alwaysValidSchema)(i,a))return void e.fail();let n=r.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}}),cY=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cl().validateUnion,error:{message:"must match a schema in anyOf"}}}),cX=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce();e.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:a,schema:i,parentSchema:n,it:o}=e;if(!Array.isArray(i))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=a.let("valid",!1),l=a.let("passing",null),c=a.name("_valid");e.setParams({passing:l}),a.block(function(){i.forEach((i,n)=>{let u;(0,r.alwaysValidSchema)(o,i)?a.var(c,!0):u=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&a.if((0,t._)`${c} && ${s}`).assign(s,!1).assign(l,(0,t._)`[${l}, ${n}]`).else(),a.if(c,()=>{a.assign(s,!0),a.assign(l,n),u&&e.mergeEvaluated(u,t.Name)})})}),e.result(s,()=>e.reset(),()=>e.error(!0))}}}),cQ=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ce();e.default={keyword:"allOf",schemaType:"array",code(e){let{gen:r,schema:a,it:i}=e;if(!Array.isArray(a))throw Error("ajv implementation error");let n=r.name("valid");a.forEach((r,a)=>{if((0,t.alwaysValidSchema)(i,r))return;let o=e.subschema({keyword:"allOf",schemaProp:a},n);e.ok(n),e.mergeEvaluated(o)})}}}),c0=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce();function a(e,t){let a=e.schema[t];return void 0!==a&&!(0,r.alwaysValidSchema)(e,a)}e.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let i,{gen:n,parentSchema:o,it:s}=e;void 0===o.then&&void 0===o.else&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let l=a(s,"then"),c=a(s,"else");if(!l&&!c)return;let u=n.let("valid",!0),d=n.name("_valid");if(i=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(i),e.reset(),l&&c){let t=n.let("ifClause");e.setParams({ifClause:t}),n.if(d,p("then",t),p("else",t))}else l?n.if(d,p("then")):n.if((0,t.not)(d),p("else"));function p(r,a){return()=>{let i=e.subschema({keyword:r},d);n.assign(u,d),e.mergeValidEvaluated(i,u),a?n.assign(a,(0,t._)`${r}`):e.setParams({ifClause:r})}}e.pass(u,()=>e.error(!0))}}}),c1=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ce();e.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:r,it:a}){void 0===r.if&&(0,t.checkStrictMode)(a,`"${e}" without "if" is ignored`)}}}),c2=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cZ(),r=cV(),a=cD(),i=cU(),n=cF(),o=cH(),s=cJ(),l=cK(),c=cB(),u=cG(),d=cW(),p=cY(),m=cX(),h=cQ(),f=c0(),g=c1();e.default=function(e=!1){let y=[d.default,p.default,m.default,h.default,f.default,g.default,s.default,l.default,o.default,c.default,u.default];return e?y.push(r.default,i.default):y.push(t.default,a.default),y.push(n.default),y}}),c9=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7();e.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,r){let a,i,n,o,s,l,{gen:c,data:u,$data:d,schema:p,schemaCode:m,it:h}=e,{opts:f,errSchemaPath:g,schemaEnv:y,self:v}=h;f.validateFormats&&(d?(a=c.scopeValue("formats",{ref:v.formats,code:f.code.formats}),i=c.const("fDef",(0,t._)`${a}[${m}]`),n=c.let("fType"),o=c.let("format"),c.if((0,t._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>c.assign(n,(0,t._)`${i}.type || "string"`).assign(o,(0,t._)`${i}.validate`),()=>c.assign(n,(0,t._)`"string"`).assign(o,i)),e.fail$data((0,t.or)(!1===f.strictSchema?t.nil:(0,t._)`${m} && !${o}`,(s=y.$async?(0,t._)`(${i}.async ? await ${o}(${u}) : ${o}(${u}))`:(0,t._)`${o}(${u})`,l=(0,t._)`(typeof ${o} == "function" ? ${s} : ${o}.test(${u}))`,(0,t._)`${o} && ${o} !== true && ${n} === ${r} && !${l}`)))):function(){var a;let i,n,o=v.formats[p];if(!o){if(!1===f.strictSchema)return v.logger.warn(s());throw Error(s());function s(){return`unknown format "${p}" ignored in schema at path "${g}"`}}if(!0===o)return;let[l,d,m]=(i=(a=o)instanceof RegExp?(0,t.regexpCode)(a):f.code.formats?(0,t._)`${f.code.formats}${(0,t.getProperty)(p)}`:void 0,n=c.scopeValue("formats",{key:p,ref:a,code:i}),"object"!=typeof a||a instanceof RegExp?["string",a,n]:[a.type||"string",a.validate,(0,t._)`${n}.validate`]);l===r&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!y.$async)throw Error("async format in sync schema");return(0,t._)`await ${m}(${u})`}return"function"==typeof d?(0,t._)`${m}(${u})`:(0,t._)`${m}.test(${u})`}())}())}}}),c4=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[c9().default]}),c6=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),c5=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cx(),r=cL(),a=c2(),i=c4(),n=c6();e.default=[t.default,r.default,(0,a.default)(),i.default,n.metadataVocabulary,n.contentVocabulary]}),c3=O(e=>{var t,r;Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,(r=t||(e.DiscrError=t={})).Tag="tag",r.Mapping="mapping"}),c8=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=c3(),a=cy(),i=cg(),n=ce();e.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:r,tagName:a}})=>(0,t._)`{error: ${e}, tag: ${a}, tagValue: ${r}}`},code(e){let{gen:o,data:s,schema:l,parentSchema:c,it:u}=e,{oneOf:d}=c;if(!u.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let m=o.let("valid",!1),h=o.const("tag",(0,t._)`${s}${(0,t.getProperty)(p)}`);o.if((0,t._)`typeof ${h} == "string"`,()=>(function(){let s=function(){var e;let t={},r=s(c),o=!0;for(let t=0;t<d.length;t++){let c=d[t];if((null==c?void 0:c.$ref)&&!(0,n.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if((c=a.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof a.SchemaEnv&&(c=c.schema),void 0===c)throw new i.default(u.opts.uriResolver,u.baseId,e)}let m=null==(e=null==c?void 0:c.properties)?void 0:e[p];if("object"!=typeof m)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);o=o&&(r||s(c)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(m,t)}if(!o)throw Error(`discriminator: "${p}" must be required`);return t;function s({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let r in o.if(!1),s)o.elseIf((0,t._)`${h} === ${r}`),o.assign(m,function(r){let a=o.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},a);return e.mergeEvaluated(i,t.Name),a}(s[r]));o.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:p}),o.endIf()})(),()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:p})),e.ok(m)}}}),c7=O((e,t)=>{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),ue=O((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=cw(),a=c5(),i=c8(),n=c7(),o=["/properties"],s="http://json-schema.org/draft-07/schema";var l=class extends r.default{_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,s,!1),this.refs["http://json-schema.org/schema"]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=ch();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=l7();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=cf();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=cg();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),ut=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=l7(),r=ct(),a=cy(),i=cR();function n(e,n){let{gen:o,it:s}=e;s.schemaEnv.root.dynamicAnchors[n]=!0;let l=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(n)}`,c="#"===s.errSchemaPath?s.validateName:function(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:o,baseId:s,localRefs:l,meta:c}=t.root,{schemaId:u}=n.opts,d=new a.SchemaEnv({schema:r,schemaId:u,root:o,baseId:s,localRefs:l,meta:c});return a.compileSchema.call(n,d),(0,i.getValidate)(e,d)}(e);o.if((0,t._)`!${l}`,()=>o.assign(l,c))}e.dynamicAnchor=n,e.default={keyword:"$dynamicAnchor",schemaType:"string",code:e=>n(e,e.schema)}}),ur=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=l7(),r=ct(),a=cR();function i(e,i){let{gen:n,keyword:o,it:s}=e;if("#"!==i[0])throw Error(`"${o}" only supports hash fragment reference`);let l=i.slice(1);if(s.allErrors)c();else{let t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(s.schemaEnv.root.dynamicAnchors[l]){let a=n.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`);n.if(a,u(a,e),u(s.validateName,e))}else u(s.validateName,e)()}function u(t,r){return r?()=>n.block(()=>{(0,a.callRef)(e,t),n.let(r,!0)}):()=>(0,a.callRef)(e,t)}}e.dynamicRef=i,e.default={keyword:"$dynamicRef",schemaType:"string",code:e=>i(e,e.schema)}}),ua=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r=ce();e.default={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,t.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}}}),ui=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ur();e.default={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,t.dynamicRef)(e,e.schema)}}),un=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ut(),r=ur(),a=ua(),i=ui();e.default=[t.default,r.default,a.default,i.default]}),uo=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cH();e.default={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:e=>(0,t.validatePropertyDeps)(e)}}),us=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cH();e.default={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,t.validateSchemaDeps)(e)}}),ul=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ce();e.default={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:r,it:a}){void 0===r.contains&&(0,t.checkStrictMode)(a,`"${e}" without "contains" is ignored`)}}}),uc=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uo(),r=us(),a=ul();e.default=[t.default,r.default,a.default]}),uu=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce(),a=ct();e.default={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>(0,t._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){let{gen:i,schema:n,data:o,errsCount:s,it:l}=e;if(!s)throw Error("ajv implementation error");let{allErrors:c,props:u}=l;function d(a){if(!1===n){e.setParams({unevaluatedProperty:a}),e.error(),c||i.break();return}if(!(0,r.alwaysValidSchema)(l,n)){let n=i.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:a,dataPropType:r.Type.Str},n),c||i.if((0,t.not)(n),()=>i.break())}}u instanceof t.Name?i.if((0,t._)`${u} !== true`,()=>i.forIn("key",o,e=>{var r,a;return i.if((r=u,a=e,(0,t._)`!${r} || !${r}[${a}]`),()=>d(e))})):!0!==u&&i.forIn("key",o,e=>void 0===u?d(e):i.if(function(e,r){let a=[];for(let i in e)!0===e[i]&&a.push((0,t._)`${r} !== ${i}`);return(0,t.and)(...a)}(u,e),()=>d(e))),l.props=!0,e.ok((0,t._)`${s} === ${a.default.errors}`)}}}),ud=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l7(),r=ce();e.default={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{gen:a,schema:i,data:n,it:o}=e,s=o.items||0;if(!0===s)return;let l=a.const("len",(0,t._)`${n}.length`);if(!1===i)e.setParams({len:s}),e.fail((0,t._)`${l} > ${s}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(o,i)){let i=a.var("valid",(0,t._)`${l} <= ${s}`);a.if((0,t.not)(i),()=>{var n,c;return n=i,c=s,void a.forRange("i",c,l,i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},n),o.allErrors||a.if((0,t.not)(n),()=>a.break())})}),e.ok(i)}o.items=!0}}}),up=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uu(),r=ud();e.default=[t.default,r.default]}),um=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),uh=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),uf=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),ug=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),uy=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),uv=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),u_=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),ub=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=um(),r=uh(),a=uf(),i=ug(),n=uy(),o=uv(),s=u_(),l=["/properties"];e.default=function(e){return[t,r,a,i,c(this,n),o,c(this,s)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function c(t,r){return e?t.$dataMetaSchema(r,l):r}}}),uS=O((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=cw(),a=c5(),i=un(),n=uc(),o=up(),s=c8(),l=ub(),c="https://json-schema.org/draft/2019-09/schema";var u=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(i.default),a.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(n.default),this.addVocabulary(o.default),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(l.default.call(this,e),this.refs["http://json-schema.org/schema"]=c)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv2019=u,t.exports=e=u,t.exports.Ajv2019=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var d=ch();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=l7();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var m=cf();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=cg();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),u$=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cx(),r=cL(),a=c2(),i=un(),n=uc(),o=up(),s=c4(),l=c6();e.default=[i.default,t.default,r.default,(0,a.default)(!0),s.default,l.metadataVocabulary,l.contentVocabulary,n.default,o.default]}),uw=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),uk=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),uR=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),ux=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),uP=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),uE=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),uT=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),uj=O((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),uO=O(e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=uw(),r=uk(),a=uR(),i=ux(),n=uP(),o=uE(),s=uT(),l=uj(),c=["/properties"];e.default=function(e){return[t,r,a,i,n,u(this,o),s,u(this,l)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function u(t,r){return e?t.$dataMetaSchema(r,c):r}}}),uC=O((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=cw(),a=u$(),i=c8(),n=uO(),o="https://json-schema.org/draft/2020-12/schema";var s=class extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),a.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;t&&(n.default.call(this,e),this.refs["http://json-schema.org/schema"]=o)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}};e.Ajv2020=s,t.exports=e=s,t.exports.Ajv2020=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var l=ch();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=l7();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var u=cf();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=cg();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),uN=O(e=>{function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(i,n),time:t(s(!0),l),"date-time":t(d(!0),p),"iso-time":t(s(),c),"iso-date-time":t(d(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return h.test(e)&&f.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(b.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return g.lastIndex=0,g.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=v&&e>=y}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let i=r.exec(e);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3];return o>=1&&o<=12&&s>=1&&s<=(2===o&&(t=n)%4==0&&(t%100!=0||t%400==0)?29:a[o])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function s(e){return function(t){let r=o.exec(t);if(!r)return!1;let a=+r[1],i=+r[2],n=+r[3],s=r[4],l="-"===r[5]?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!s)return!1;if(a<=23&&i<=59&&n<60)return!0;let d=i-u*l,p=a-c*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&n<61}}function l(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),a=new Date("2020-01-01T"+t).valueOf();if(r&&a)return r-a}function c(e,t){if(!(e&&t))return;let r=o.exec(e),a=o.exec(t);if(r&&a)return(e=r[1]+r[2]+r[3])>(t=a[1]+a[2]+a[3])?1:e<t?-1:0}let u=/t|\s/i;function d(e){let t=s(e);return function(e){let r=e.split(u);return 2===r.length&&i(r[0])&&t(r[1])}}function p(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function m(e,t){if(!(e&&t))return;let[r,a]=e.split(u),[i,o]=t.split(u),s=n(r,i);if(void 0!==s)return s||l(a,o)}let h=/\/|:/,f=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,y=-0x80000000,v=0x80000000-1;function _(){return!0}let b=/[^\\]\\Z/}),uI=O(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=ue(),r=l7(),a=r.operators,i={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,r.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,r._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let a,n,{gen:o,data:s,schemaCode:l,keyword:c,it:u}=e,{opts:d,self:p}=u;if(!d.validateFormats)return;let m=new t.KeywordCxt(u,p.RULES.all.format.definition,"format");function h(e){return(0,r._)`${e}.compare(${s}, ${l}) ${i[c].fail} 0`}m.$data?(a=o.scopeValue("formats",{ref:p.formats,code:d.code.formats}),n=o.const("fmt",(0,r._)`${a}[${m.schemaCode}]`),e.fail$data((0,r.or)((0,r._)`typeof ${n} != "object"`,(0,r._)`${n} instanceof RegExp`,(0,r._)`typeof ${n}.compare != "function"`,h(n)))):function(){let t=m.schema,a=p.formats[t];if(!a||!0===a)return;if("object"!=typeof a||a instanceof RegExp||"function"!=typeof a.compare)throw Error(`"${c}": format "${t}" does not define "compare" function`);let i=o.scopeValue("formats",{key:t,ref:a,code:d.code.formats?(0,r._)`${d.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(h(i))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}),uq=O((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=uN(),a=uI(),i=l7(),n=new i.Name("fullFormats"),o=new i.Name("fastFormats"),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return l(e,t,r.fullFormats,n),e;let[i,s]="fast"===t.mode?[r.fastFormats,o]:[r.fullFormats,n];return l(e,t.formats||r.formatNames,i,s),t.keywords&&(0,a.default)(e),e};function l(e,t,r,a){var n;for(let o of(null!=(n=e.opts.code).formats||(n.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),t))e.addFormat(o,r[o])}s.get=(e,t="full")=>{let a=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!a)throw Error(`Unknown format "${e}"`);return a},t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s}),uz=ue(),uA=uS(),uM=uC();let uL=((e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var i,n=E(t),o=0,s=n.length;o<s;o++)i=n[o],j.call(e,i)||i===r||x(e,i,{get:(e=>t[e]).bind(null,i),enumerable:!(a=P(t,i))||a.enumerable});return e})(x(null!=(u=uq())?R(T(u)):{},"default",{value:u,enumerable:!0}),u).default;function uZ(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return uL(t),t}var uD=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=void 0!==e,this._ajv=e}get ajv(){return this._ajv??=uZ(uM.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=function(e,t){if(!("$schema"in e)||"string"!=typeof e.$schema)return"2020-12";let r=e.$schema.replace(/#$/,"");if(C.has(r))return"2020-12";if(N.has(r))return"2019-09";if(I.has(r)||q.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return"2020-12"===t?this.ajv:"2019-09"===t?this._ajv2019??=uZ(uA.Ajv2019):this._ajvDraft7??=uZ(uz.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&"string"==typeof e.$id?t.getSchema(e.$id)??t.compile(e):t.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}};uz.Ajv;let uV=require("node:process");var uU=r.n(uV);let uF=Symbol.for("mcp.completable");function uH(e){return!!e&&"object"==typeof e&&uF in e}function uJ(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[iP]:t}}}}let uK=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]);var uB=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=1024,t,r){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=r}setServerCapabilities(e,t){this._serverCapabilities=e,void 0!==t&&(this._serverInfo=t)}has(e){return this._subs.has(e)}serve(e){var t;let r,a,i;if(void 0===this._serverCapabilities)throw Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let n=(r=lu(lc).validateRequest("subscriptions/listen",e)).ok?r.value.params?.notifications:void 0;if(void 0===n)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let o=(t=this._serverCapabilities,a={},i=e=>void 0===t||!0===e,!0===n.toolsListChanged&&i(t?.tools?.listChanged)&&(a.toolsListChanged=!0),!0===n.promptsListChanged&&i(t?.prompts?.listChanged)&&(a.promptsListChanged=!0),!0===n.resourcesListChanged&&i(t?.resources?.listChanged)&&(a.resourcesListChanged=!0),void 0!==n.resourceSubscriptions&&n.resourceSubscriptions.length>0&&i(t?.resources?.subscribe)&&(a.resourceSubscriptions=[...n.resourceSubscriptions]),a);return this._subs.set(e.id,o),uJ({method:"notifications/subscriptions/acknowledged",params:{notifications:o}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!uK.has(e.method))return"passthrough";let t=e.params?.uri,r=function(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}(e.method,"string"==typeof t?t:void 0),a=[];for(let[t,i]of this._subs)(function(e,t){switch(t.kind){case"tools_list_changed":return!0===e.toolsListChanged;case"prompts_list_changed":return!0===e.promptsListChanged;case"resources_list_changed":return!0===e.resourcesListChanged;case"resource_updated":return void 0!==e.resourceSubscriptions&&e.resourceSubscriptions.includes(t.uri)}})(i,r)&&a.push(uJ({method:e.method,params:e.params??{}},t));return a}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[iP]:t,...void 0!==this._serverInfo&&{[iR]:this._serverInfo}}}});return this._subs.clear(),e}};function uG(e,t,r){if(null===r||"object"!=typeof r||"string"!=typeof r.method)throw new s0(sQ.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let a=function(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(void 0!==t&&(void 0!==t.tools||void 0!==t.toolChoice))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}(r);if(void 0===a)throw new s0(sQ.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${r.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:r,required:a}}function uW(e,t){if("tools/call"===e)return{content:[{type:"text",text:t}],isError:!0};throw new s0(sQ.InternalError,t)}var uY=class{constructor(e){this._host=e}async fulfill(e,t,r,a,i){let{maxRounds:n,roundTimeoutMs:o}=this._host,s=a.mcpReq.signal,l=i,c=0;for(;;){let i;if((c+=1)>n)return uW(e,`Multi-round-trip request '${e}' still required input after ${n} rounds (inputRequired.maxRounds)`);let u=l.inputRequests,d=null!=u&&Object.keys(u).length>0,p="string"==typeof l.requestState?l.requestState:void 0;if(!d&&void 0===p)throw new s0(sQ.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(d){let t=this._host.resolvedClientCapabilities(a),r=[];for(let[a,i]of Object.entries(u)){let{embedded:n,required:o}=uG(e,a,i);if("roots/list"!==n.method&&void 0===n.params)throw new s0(sQ.InternalError,`Handler for ${e} returned an input request '${a}' of kind '${n.method}' without params`);if(void 0!==sw(o,t))return uW(e,`Cannot request input '${a}' (${n.method}): the client on this 2025-era connection did not declare the required capability${void 0===t?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);r.push([a,n])}let n=function(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener("abort",r)}}(s);try{let e={relatedRequestId:a.mcpReq.id,timeout:o,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:n.signal},t=await Promise.all(r.map(async([t,r])=>{try{return[t,await this._dispatchLeg(r,e)]}catch(e){throw n.abort(e),e}}));i=Object.fromEntries(t)}catch(t){if(s.aborted)throw t;return uW(e,`Fulfilling input required by '${e}' failed: ${t instanceof Error?t.message:String(t)}`)}finally{n.dispose()}}else await function(e,t){return new Promise((e,r)=>{if(t?.aborted)return void r(t.reason instanceof sS?t.reason:new sS(sb.RequestTimeout,String(t.reason)));let a=setTimeout(()=>{t?.removeEventListener("abort",i),e()},250),i=()=>{clearTimeout(a),r(t?.reason instanceof sS?t.reason:new sS(sb.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}(0,s);let m={...a,mcpReq:{...a.mcpReq,inputResponses:i,droppedInputResponseKeys:void 0,requestState:function(e){return()=>e}(p)}};if(void 0!==p){let t=await this._host.verifyRequestState(p,m,e);void 0!==t&&(m=lX(m,t))}let h=await t(r,m);if(!l$(h))return h;l=h}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return"url"===r.mode&&void 0===r.elicitationId&&(r={...r,elicitationId:function(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;let r=[...t].map(e=>e.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}};let uX=new Set(["tools/call","prompts/get","resources/read"]);var uQ=class extends lQ{_clientCapabilities;_clientVersion;static{s=(e,t)=>{let r=t.filter(t=>!e._supportedProtocolVersions.includes(t));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},l=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new uY({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new uD,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=function(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??8,roundTimeoutMs:e?.roundTimeoutMs??6e5,legacyShim:e?.legacyShim??!0}}(t?.inputRequired),t?.cacheHints!==void 0){for(const[e,r]of Object.entries(t.cacheHints))void 0!==r&&sX(r,`cacheHints['${e}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",e=>this._oninitialize(e)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),sx(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:a}=e.params,i=r7(oa,a);return i.success&&this._loggingLevels.set(r,i.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(t,r,a)=>{let i;if(!this._capabilities.logging)return Promise.resolve();if(this._servedModernEra()){if(void 0===(i=e.mcpReq.envelope?.[iE]))return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return void 0!==i&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:t,data:r,logger:a}})},elicitInput:(e,t)=>this.elicitInput(e,t),requestSampling:(e,t)=>this.createMessage(e,t)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(oa.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)};registerCapabilities(e){if(this.transport)throw new sS(sb.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=function(e,t){let r={...e};for(let e in t){let a=t[e];if(void 0===a)continue;let i=r[e];r[e]=l0(i)&&l0(a)?{...i,...a}:a}return r}(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if("tools/call"!==e){let r=this._cacheHints?.[e],a=uX.has(e);return void 0!==r||a?async(i,n)=>{let o=a?await this._invokeInputRequiredCapableHandler(e,t,i,n):await t(i,n);if(l$(o)){if(!a)throw new s0(sQ.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return o}return void 0===r?o:sG(o,r)}:async(r,a)=>{let i=await t(r,a);if(l$(i))throw new s0(sQ.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}}return async(e,r)=>{let a=lu(this._negotiatedProtocolVersion),i=a.validateRequest("tools/call",e);if(!i.ok)throw new s0("not-in-era"===i.reason?sQ.InternalError:sQ.InvalidParams,"not-in-era"===i.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let n=await this._invokeInputRequiredCapableHandler("tools/call",t,e,r);if(l$(n))return n;let o=sT(n),s=a.validateResult("tools/call",o);if(!s.ok)throw new s0("not-in-era"===s.reason?sQ.InternalError:sQ.InvalidParams,"not-in-era"===s.reason?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return void 0!==this._negotiatedProtocolVersion&&this._negotiatedProtocolVersion>=sk}async _invokeInputRequiredCapableHandler(e,t,r,a){let i,n=this._servedModernEra(),o=a.mcpReq.requestState();if(void 0!==o&&"string"!=typeof o)throw new s0(sQ.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let s=a;if("string"==typeof o){let t=await this._verifyRequestState(o,a,e);void 0!==t&&(s=lX(a,t))}try{i=await t(r,s)}catch(e){if(e instanceof s0&&e.code===sQ.UrlElicitationRequired){if(!n)throw e;throw new s0(sQ.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw e}if(!l$(i))return i;if(!n){if(!this._inputRequiredServing.legacyShim)throw new s0(sQ.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??iS}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,s,i)}let l=i.inputRequests,c=null!=l&&Object.keys(l).length>0,u="string"==typeof i.requestState;if(!c&&!u)throw new s0(sQ.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(c){let t=this._inputRequestCapabilityView(a);for(let[r,a]of Object.entries(l)){let{embedded:i,required:n}=uG(e,r,a),o=sw(n,t);if(void 0!==o)throw new s4({requiredCapabilities:o},`Cannot request input '${r}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return i}async _verifyRequestState(e,t,r){if(void 0!==this._requestStateVerify)try{return await this._requestStateVerify(e,t)}catch(e){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${e instanceof Error?e.message:String(e)}`)),new s0(sQ.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[ix]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new sS(sb.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new sS(sb.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new sS(sb.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new sS(sb.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new sS(sb.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new sS(sb.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new sS(sb.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new sS(sb.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new sS(sb.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new sS(sb.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new sS(sb.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new sS(sb.CapabilityNotSupported,`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 sS(sb.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new sS(sb.CapabilityNotSupported,`Server does not support tools (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=this._supportedProtocolVersions.filter(e=>!(e>=sk)),a=r.includes(t)?t:r[0]??iS;return this._negotiatedProtocolVersion=a,this.transport?.setProtocolVersion?.(a),{protocolVersion:a,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:sx(this._supportedProtocolVersions),capabilities:{...this.getCapabilities()},...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new sS(sb.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let t=e.messages.at(-1),r=Array.isArray(t.content)?t.content:[t.content],a=r.some(e=>"tool_result"===e.type),i=e.messages.length>1?e.messages.at(-2):void 0,n=i?Array.isArray(i.content)?i.content:[i.content]:[],o=n.some(e=>"tool_use"===e.type);if(a){if(r.some(e=>"tool_result"!==e.type))throw new s0(sQ.InvalidParams,"The last message must contain only tool_result content if any is present");if(!o)throw new s0(sQ.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(o){let e=new Set(n.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new s0(sQ.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),a=await this.request({method:"sampling/createMessage",params:e},t),i=this._wireCodec().samplingResultVariant(r,a);if(!i.ok)throw new sS(sb.InvalidResult,`Invalid sampling/createMessage result: ${"invalid"===i.reason?i.message:i.reason}`);return i.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new sS(sb.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new sS(sb.CapabilityNotSupported,"Client does not support form elicitation.")}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let a=e.mode??"form",i=r?.validateAcceptedContent??!0;switch(a){case"url":return this.request({method:"elicitation/create",params:e},t);case"form":{let r="form"===e.mode?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:r},t);if(i&&"accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new s0(sQ.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof s0)throw e;throw new s0(sQ.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new sS(sb.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))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"})}},u0=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(void 0!==t&&t.enabled){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(void 0===t.inputSchema)return u9;try{let r=lq(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new uQ(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?lq(t.inputSchema,"input"):u9,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(r.outputSchema=lq(t.outputSchema,"output")),r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new s0(sQ.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new s0(sQ.InvalidParams,`Tool ${e.params.name} disabled`);try{let a=await this.validateToolInput(r,e.params.arguments,e.params.name),i=await this.executeToolHandler(r,a,t);if(await this.validateToolOutput(r,i,e.params.name),l$(i))return i;return this.server.projectCallToolResult(i,r.outputSchemaJson)}catch(e){if(e instanceof s0&&e.code===sQ.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let a=await lz(e.inputSchema,t??{});if(!a.success)throw new s0(sQ.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a.error}`);return a.data}async validateToolOutput(e,t,r){if(!e.outputSchema||l$(t)||t.isError)return;if(void 0===t.structuredContent)throw new s0(sQ.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=await lz(e.outputSchema,t.structuredContent);if(!a.success)throw new s0(sQ.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${a.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`);return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`);return this.handleResourceCompletion(e,e.params.ref);default:throw new s0(sQ.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new s0(sQ.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new s0(sQ.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return u3;let a=u7(u8(r.argsSchema)?.[e.params.argument.name]);if(!uH(a))return u3;let i=a[uF]?.complete;return i?u5(await i(e.params.argument.value,e.params.context)):u3}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return u3;throw new s0(sQ.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?u5(await a(e.params.argument.value,e.params.context)):u3}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(let e of Object.values(this._registeredResourceTemplates))if(e.resourceTemplate.listCallback)for(let r of(await e.resourceTemplate.listCallback(t)).resources)a.push({...e.metadata,...r});return{resources:[...r,...a]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new s0(sQ.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new s0(sQ.InvalidParams,`Resource ${r} disabled`);return sG(await a.readCallback(r,t),a.cacheHint)}for(let e of Object.values(this._registeredResourceTemplates)){let a=e.resourceTemplate.uriTemplate.match(r.toString());if(a)return sG(await e.readCallback(r,a,t),e.cacheHint)}throw new s1(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{let r,a,i;return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(a=(r=lq(t.argsSchema,"input")).properties||{},i=r.required||[],Object.entries(a).map(([e,t])=>({name:e,description:t?.description,required:i.includes(e)}))):void 0,icons:t.icons,_meta:t._meta}})})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new s0(sQ.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new s0(sQ.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,a){let i=r.cacheHint,n=r;if(void 0!==i){sX(i,`resource ${e}`);let t={...r};delete t.cacheHint,n=t}if("string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,n,a);return void 0!==i&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,a,i){let n={name:e,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=n)),void 0!==e.name&&(n.name=e.name),void 0!==e.title&&(n.title=e.title),void 0!==e.metadata&&(n.metadata=e.metadata),void 0!==e.callback&&(n.readCallback=e.callback),void 0!==e.enabled&&(n.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=n,n}_createRegisteredResourceTemplate(e,t,r,a,i){let n={resourceTemplate:r,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=n)),void 0!==t.title&&(n.title=t.title),void 0!==t.template&&(n.resourceTemplate=t.template),void 0!==t.metadata&&(n.metadata=t.metadata),void 0!==t.callback&&(n.readCallback=t.callback),void 0!==t.enabled&&(n.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=n;let o=r.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!r.completeCallback(e))&&this.setCompletionRequestHandler(),n}_createRegisteredPrompt(e,t,r,a,i,n,o){let s=a,l=i,c={title:t,description:r,argsSchema:a,icons:n,_meta:o,handler:u6(e,a,i),enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=c)),void 0!==t.title&&(c.title=t.title),void 0!==t.description&&(c.description=t.description),void 0!==t.icons&&(c.icons=t.icons),void 0!==t._meta&&(c._meta=t._meta);let r=!1;void 0!==t.argsSchema&&(c.argsSchema=t.argsSchema,s=t.argsSchema,r=!0),void 0!==t.callback&&(l=t.callback,r=!0),r&&(c.handler=u6(e,s,l)),void 0!==t.enabled&&(c.enabled=t.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=c,a){let e=u8(a);e&&Object.values(e).some(e=>uH(u7(e)))&&this.setCompletionRequestHandler()}return c}_createRegisteredTool(e,t,r,a,i,n,o,s,l,c){if(l4(e),void 0!==a)try{let t,r,i,n,o=lq(a,"input");this._toolInputSchemaJson[e]=o;let s=(t=[],r=new Map,n=(i=(e,a,n)=>{if(null===e||"object"!=typeof e)return;if(lw in e){if(!n||0===a.length)return`${lE(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let i=e[lw];if("string"!=typeof i||0===i.length)return`${lE(a)}: x-mcp-header MUST be a non-empty string`;if(!lk.test(i))return`${lE(a)}: x-mcp-header '${i}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let o="string"==typeof e.type?e.type:void 0;if(void 0===o||!lR.has(o))return`${lE(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${o??"<none>"}`;let s=i.toLowerCase(),l=r.get(s);if(void 0!==l)return`x-mcp-header '${i}' is not case-insensitively unique (also declared as '${l}')`;r.set(s,i),t.push({path:a,headerName:i,type:o})}let o=e.properties;if(null!==o&&"object"==typeof o)for(let[e,t]of Object.entries(o)){let r=i(t,[...a,e],n);if(void 0!==r)return r}for(let t of lx){let r=e[t];if(void 0!==r)for(let e of Array.isArray(r)?r:null!==r&&"object"==typeof r&&lP.has(t)?Object.values(r):[r]){let r=i(e,[...a,`<${t}>`],!1);if(void 0!==r)return r}}})(o,[],!0),void 0===n?{valid:!0,declarations:t}:{valid:!1,reason:n});s.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${s.reason}`)}catch{}let u=c,d={title:t,description:r,inputSchema:a,outputSchema:i,outputSchemaJson:u4(i),annotations:n,icons:o,execution:s,_meta:l,handler:c,executor:u2(a,c),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&l4(t.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],t.name&&(delete this._toolInputSchemaJson[t.name],this._registeredTools[t.name]=d,e=t.name)),void 0!==t.title&&(d.title=t.title),void 0!==t.description&&(d.description=t.description);let r=!1;void 0!==t.paramsSchema&&(d.inputSchema=t.paramsSchema,delete this._toolInputSchemaJson[e],r=!0),void 0!==t.callback&&(d.handler=t.callback,u=t.callback,r=!0),r&&(d.executor=u2(d.inputSchema,u)),void 0!==t.outputSchema&&(d.outputSchema=t.outputSchema,d.outputSchemaJson=u4(t.outputSchema)),void 0!==t.annotations&&(d.annotations=t.annotations),void 0!==t.icons&&(d.icons=t.icons),void 0!==t._meta&&(d._meta=t._meta),void 0!==t.enabled&&(d.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:i,inputSchema:n,outputSchema:o,annotations:s,icons:l,_meta:c}=t;return this._createRegisteredTool(e,a,i,l5(n),l5(o),s,l,void 0,c,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:i,argsSchema:n,icons:o,_meta:s}=t,l=this._createRegisteredPrompt(e,a,i,l5(n),r,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},u1=class{_uriTemplate;constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new l6(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}};function u2(e,t){return e?async(e,r)=>t(e,r):async(e,r)=>t(r)}let u9={type:"object",properties:{}};function u4(e){if(void 0!==e)try{return lq(e,"output")}catch{return}}function u6(e,t,r){return t?async(a,i)=>{let n=await lz(t,a);if(!n.success)throw new s0(sQ.InvalidParams,`Invalid arguments for prompt ${e}: ${n.error}`);return r(n.data,i)}:async(e,t)=>r(t)}function u5(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}let u3={completion:{values:[],hasMore:!1}};function u8(e){if(e.shape&&"object"==typeof e.shape)return e.shape}function u7(e){return e?.type!=="optional"?e:e.def?.innerType??e}var de=class{_readBuffer;_started=!1;_closed=!1;constructor(e=uU().stdin,t=uU().stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new l2({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(e){this.onerror?.(e),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(Error("StdioServerTransport is closed")):new Promise((t,r)=>{let a=JSON.stringify(e)+"\n",i=!1,n=e=>{i||(i=!0,this._stdout.off("error",n),this._stdout.off("drain",o),r(e))},o=()=>{i||(i=!0,this._stdout.off("error",n),this._stdout.off("drain",o),t())};if(this._stdout.once("error",n),this._stdout.write(a)){if(i)return;i=!0,this._stdout.off("error",n),t()}else i||this._stdout.once("drain",o)})}},dt=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,r){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=r}async start(){}async send(e,t){if(iK.safeParse(e).success||iB.safeParse(e).success){let{id:t}=e;void 0!==t&&this._settle(t)}if(!this._closed&&this._outboundIntercept?.(e)!=="handled")return this._wire.send(e,t)}setProtocolVersion=e=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(!this._closed){if(lS(e))this._pendingRequests.add(e.id);else if(iJ.safeParse(e).success&&"notifications/cancelled"===e.method){let t=e.params?.requestId;void 0!==t&&this._settle(t)}this.onmessage?.(e,t)}}async whenRequestsAnswered(e){return!!this._closed||0===this._pendingRequests.size||await new Promise(t=>{let r=()=>{clearTimeout(a),t(!0)},a=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter(e=>e!==r),t(!1)},e);this._drainWaiters.push(r)})}async close(){if(!this._closed){this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}}_settle(e){this._pendingRequests.delete(e),0===this._pendingRequests.size&&this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;for(let t of(this._drainWaiters=[],e))t()}};function dr(e){return e instanceof Error?e:Error(String(e))}let da=Symbol("Let zodToJsonSchema decide on which parser to use"),di={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"};(f=S||(S={})).assertEqual=e=>{},f.assertIs=function(e){},f.assertNever=function(e){throw Error()},f.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},f.getValidEnumValues=e=>{let t=f.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return f.objectValues(r)},f.objectValues=e=>f.objectKeys(e).map(function(t){return e[t]}),f.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},f.find=(e,t)=>{for(let r of e)if(t(r))return r},f.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,f.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},f.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,($||($={})).mergeShapes=(e,t)=>({...e,...t});let dn=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ds=e=>{switch(typeof e){case"undefined":return dn.undefined;case"string":return dn.string;case"number":return Number.isNaN(e)?dn.nan:dn.number;case"boolean":return dn.boolean;case"function":return dn.function;case"bigint":return dn.bigint;case"symbol":return dn.symbol;case"object":if(Array.isArray(e))return dn.array;if(null===e)return dn.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return dn.promise;if("undefined"!=typeof Map&&e instanceof Map)return dn.map;if("undefined"!=typeof Set&&e instanceof Set)return dn.set;if("undefined"!=typeof Date&&e instanceof Date)return dn.date;return dn.object;default:return dn.unknown}},dl=S.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class dc extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,a=0;for(;a<i.path.length;){let r=i.path[a];a===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof dc))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,S.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}dc.create=e=>new dc(e);let du=(e,t)=>{let r;switch(e.code){case dl.invalid_type:r=e.received===dn.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case dl.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,S.jsonStringifyReplacer)}`;break;case dl.unrecognized_keys:r=`Unrecognized key(s) in object: ${S.joinValues(e.keys,", ")}`;break;case dl.invalid_union:r="Invalid input";break;case dl.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${S.joinValues(e.options)}`;break;case dl.invalid_enum_value:r=`Invalid enum value. Expected ${S.joinValues(e.options)}, received '${e.received}'`;break;case dl.invalid_arguments:r="Invalid function arguments";break;case dl.invalid_return_type:r="Invalid function return type";break;case dl.invalid_date:r="Invalid date";break;case dl.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:S.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case dl.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case dl.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case dl.custom:r="Invalid input";break;case dl.invalid_intersection_types:r="Intersection results could not be merged";break;case dl.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case dl.not_finite:r="Number must be finite";break;default:r=t.defaultError,S.assertNever(e)}return{message:r}};(g=w||(w={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},g.toString=e=>"string"==typeof e?e:e?.message;let dd=e=>{let{data:t,path:r,errorMaps:a,issueData:i}=e,n=[...r,...i.path||[]],o={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let s="";for(let e of a.filter(e=>!!e).slice().reverse())s=e(o,{data:t,defaultError:s}).message;return{...i,path:n,message:s}};function dp(e,t){let r=dd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,du,void 0].filter(e=>!!e)});e.common.issues.push(r)}class dm{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return dh;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return dm.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:i}=a;if("aborted"===t.status||"aborted"===i.status)return dh;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||a.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let dh=Object.freeze({status:"aborted"}),df=e=>({status:"dirty",value:e}),dg=e=>({status:"valid",value:e}),dy=e=>"undefined"!=typeof Promise&&e instanceof Promise;class dv{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let d_=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new dc(e.common.issues);return this._error=t,this._error}}};function db(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:n}=e;return"invalid_enum_value"===t.code?{message:n??i.defaultError}:void 0===i.data?{message:n??a??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:n??r??i.defaultError}},description:i}}class dS{get description(){return this._def.description}_getType(e){return ds(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ds(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new dm,ctx:{common:e.parent.common,data:e.data,parsedType:ds(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dy(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ds(e)},a=this._parseSync({data:e,path:r.path,parent:r});return d_(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ds(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ds(e)},a=this._parse({data:e,path:r.path,parent:r});return d_(r,await (dy(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let i=e(r),n=()=>a.addIssue({code:dl.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(n(),!1)):!!i||(n(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new pi({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:e=>this["~validate"](e)}}optional(){return pn.create(this,this._def)}nullable(){return po.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dY.create(this)}promise(){return pa.create(this,this._def)}or(e){return dQ.create([this,e],this._def)}and(e){return d2.create(this,e,this._def)}transform(e){return new pi({...db(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ps({...db(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:k.ZodDefault})}brand(){return new pu({typeName:k.ZodBranded,type:this,...db(this._def)})}catch(e){return new pl({...db(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:k.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return pd.create(this,e)}readonly(){return pp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let d$=/^c[^\s-]{8,}$/i,dw=/^[0-9a-z]+$/,dk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dR=/^[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,dx=/^[a-z0-9_-]{21}$/i,dP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dE=/^[-+]?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)?)??$/,dT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dj=/^(?:(?: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])$/,dO=/^(?:(?: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])$/,dC=/^(([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]))$/,dN=/^(([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])$/,dI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dz="((\\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])))",dA=RegExp(`^${dz}$`);function dM(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class dL extends dS{_parse(e){var t,r,a,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dn.string){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.string,received:t.parsedType}),dh}let o=new dm;for(let s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(dp(n=this._getOrReturnCtx(e,n),{code:dl.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("max"===s.kind)e.data.length>s.value&&(dp(n=this._getOrReturnCtx(e,n),{code:dl.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("length"===s.kind){let t=e.data.length>s.value,r=e.data.length<s.value;(t||r)&&(n=this._getOrReturnCtx(e,n),t?dp(n,{code:dl.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):r&&dp(n,{code:dl.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if("email"===s.kind)dT.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"email",code:dl.invalid_string,message:s.message}),o.dirty());else if("emoji"===s.kind)c||(c=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),c.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:dl.invalid_string,message:s.message}),o.dirty());else if("uuid"===s.kind)dR.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:dl.invalid_string,message:s.message}),o.dirty());else if("nanoid"===s.kind)dx.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:dl.invalid_string,message:s.message}),o.dirty());else if("cuid"===s.kind)d$.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:dl.invalid_string,message:s.message}),o.dirty());else if("cuid2"===s.kind)dw.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:dl.invalid_string,message:s.message}),o.dirty());else if("ulid"===s.kind)dk.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:dl.invalid_string,message:s.message}),o.dirty());else if("url"===s.kind)try{new URL(e.data)}catch{dp(n=this._getOrReturnCtx(e,n),{validation:"url",code:dl.invalid_string,message:s.message}),o.dirty()}else"regex"===s.kind?(s.regex.lastIndex=0,s.regex.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"regex",code:dl.invalid_string,message:s.message}),o.dirty())):"trim"===s.kind?e.data=e.data.trim():"includes"===s.kind?e.data.includes(s.value,s.position)||(dp(n=this._getOrReturnCtx(e,n),{code:dl.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty()):"toLowerCase"===s.kind?e.data=e.data.toLowerCase():"toUpperCase"===s.kind?e.data=e.data.toUpperCase():"startsWith"===s.kind?e.data.startsWith(s.value)||(dp(n=this._getOrReturnCtx(e,n),{code:dl.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty()):"endsWith"===s.kind?e.data.endsWith(s.value)||(dp(n=this._getOrReturnCtx(e,n),{code:dl.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty()):"datetime"===s.kind?(function(e){let t=`${dz}T${dM(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(s).test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{code:dl.invalid_string,validation:"datetime",message:s.message}),o.dirty()):"date"===s.kind?dA.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{code:dl.invalid_string,validation:"date",message:s.message}),o.dirty()):"time"===s.kind?RegExp(`^${dM(s)}$`).test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{code:dl.invalid_string,validation:"time",message:s.message}),o.dirty()):"duration"===s.kind?dE.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"duration",code:dl.invalid_string,message:s.message}),o.dirty()):"ip"===s.kind?(t=e.data,!(("v4"===(r=s.version)||!r)&&dj.test(t)||("v6"===r||!r)&&dC.test(t))&&1&&(dp(n=this._getOrReturnCtx(e,n),{validation:"ip",code:dl.invalid_string,message:s.message}),o.dirty())):"jwt"===s.kind?!function(e,t){if(!dP.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(e.data,s.alg)&&(dp(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:dl.invalid_string,message:s.message}),o.dirty()):"cidr"===s.kind?(a=e.data,!(("v4"===(i=s.version)||!i)&&dO.test(a)||("v6"===i||!i)&&dN.test(a))&&1&&(dp(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:dl.invalid_string,message:s.message}),o.dirty())):"base64"===s.kind?dI.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"base64",code:dl.invalid_string,message:s.message}),o.dirty()):"base64url"===s.kind?dq.test(e.data)||(dp(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:dl.invalid_string,message:s.message}),o.dirty()):S.assertNever(s);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:dl.invalid_string,...w.errToObj(r)})}_addCheck(e){return new dL({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...w.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...w.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...w.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...w.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new dL({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new dL({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new dL({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}dL.create=e=>new dL({checks:[],typeName:k.ZodString,coerce:e?.coerce??!1,...db(e)});class dZ extends dS{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==dn.number){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.number,received:t.parsedType}),dh}let r=new dm;for(let a of this._def.checks)"int"===a.kind?S.isInteger(e.data)||(dp(t=this._getOrReturnCtx(e,t),{code:dl.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,a.value)&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(dp(t=this._getOrReturnCtx(e,t),{code:dl.not_finite,message:a.message}),r.dirty()):S.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,r,a){return new dZ({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:w.toString(a)}]})}_addCheck(e){return new dZ({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&S.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}dZ.create=e=>new dZ({checks:[],typeName:k.ZodNumber,coerce:e?.coerce||!1,...db(e)});class dD extends dS{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==dn.bigint)return this._getInvalidInput(e);let r=new dm;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):S.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.bigint,received:t.parsedType}),dh}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,r,a){return new dD({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:w.toString(a)}]})}_addCheck(e){return new dD({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}dD.create=e=>new dD({checks:[],typeName:k.ZodBigInt,coerce:e?.coerce??!1,...db(e)});class dV extends dS{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dn.boolean){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.boolean,received:t.parsedType}),dh}return dg(e.data)}}dV.create=e=>new dV({typeName:k.ZodBoolean,coerce:e?.coerce||!1,...db(e)});class dU extends dS{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dn.date){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.date,received:t.parsedType}),dh}if(Number.isNaN(e.data.getTime()))return dp(this._getOrReturnCtx(e),{code:dl.invalid_date}),dh;let r=new dm;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(dp(t=this._getOrReturnCtx(e,t),{code:dl.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):S.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new dU({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}dU.create=e=>new dU({checks:[],coerce:e?.coerce||!1,typeName:k.ZodDate,...db(e)});class dF extends dS{_parse(e){if(this._getType(e)!==dn.symbol){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.symbol,received:t.parsedType}),dh}return dg(e.data)}}dF.create=e=>new dF({typeName:k.ZodSymbol,...db(e)});class dH extends dS{_parse(e){if(this._getType(e)!==dn.undefined){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.undefined,received:t.parsedType}),dh}return dg(e.data)}}dH.create=e=>new dH({typeName:k.ZodUndefined,...db(e)});class dJ extends dS{_parse(e){if(this._getType(e)!==dn.null){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.null,received:t.parsedType}),dh}return dg(e.data)}}dJ.create=e=>new dJ({typeName:k.ZodNull,...db(e)});class dK extends dS{constructor(){super(...arguments),this._any=!0}_parse(e){return dg(e.data)}}dK.create=e=>new dK({typeName:k.ZodAny,...db(e)});class dB extends dS{constructor(){super(...arguments),this._unknown=!0}_parse(e){return dg(e.data)}}dB.create=e=>new dB({typeName:k.ZodUnknown,...db(e)});class dG extends dS{_parse(e){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.never,received:t.parsedType}),dh}}dG.create=e=>new dG({typeName:k.ZodNever,...db(e)});class dW extends dS{_parse(e){if(this._getType(e)!==dn.undefined){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.void,received:t.parsedType}),dh}return dg(e.data)}}dW.create=e=>new dW({typeName:k.ZodVoid,...db(e)});class dY extends dS{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==dn.array)return dp(t,{code:dl.invalid_type,expected:dn.array,received:t.parsedType}),dh;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(dp(t,{code:e?dl.too_big:dl.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(dp(t,{code:dl.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(dp(t,{code:dl.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new dv(t,e,t.path,r)))).then(e=>dm.mergeArray(r,e));let i=[...t.data].map((e,r)=>a.type._parseSync(new dv(t,e,t.path,r)));return dm.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new dY({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new dY({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new dY({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}}dY.create=(e,t)=>new dY({type:e,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...db(t)});class dX extends dS{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=S.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==dn.object){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.object,received:t.parsedType}),dh}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof dG&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||n.push(e);let o=[];for(let e of i){let t=a[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new dv(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof dG){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of n)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(dp(r,{code:dl.unrecognized_keys,keys:n}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of n){let a=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new dv(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>dm.mergeObjectSync(t,e)):dm.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new dX({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:w.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new dX({...this._def,unknownKeys:"strip"})}passthrough(){return new dX({...this._def,unknownKeys:"passthrough"})}extend(e){return new dX({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new dX({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new dX({...this._def,catchall:e})}pick(e){let t={};for(let r of S.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new dX({...this._def,shape:()=>t})}omit(e){let t={};for(let r of S.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new dX({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof dX){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=pn.create(e(i))}return new dX({...t._def,shape:()=>r})}if(t instanceof dY)return new dY({...t._def,type:e(t.element)});if(t instanceof pn)return pn.create(e(t.unwrap()));if(t instanceof po)return po.create(e(t.unwrap()));if(t instanceof d9)return d9.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of S.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new dX({...this._def,shape:()=>t})}required(e){let t={};for(let r of S.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof pn;)e=e._def.innerType;t[r]=e}return new dX({...this._def,shape:()=>t})}keyof(){return pe(S.objectKeys(this.shape))}}dX.create=(e,t)=>new dX({shape:()=>e,unknownKeys:"strip",catchall:dG.create(),typeName:k.ZodObject,...db(t)}),dX.strictCreate=(e,t)=>new dX({shape:()=>e,unknownKeys:"strict",catchall:dG.create(),typeName:k.ZodObject,...db(t)}),dX.lazycreate=(e,t)=>new dX({shape:e,unknownKeys:"strip",catchall:dG.create(),typeName:k.ZodObject,...db(t)});class dQ extends dS{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new dc(e.ctx.common.issues));return dp(t,{code:dl.invalid_union,unionErrors:r}),dh});{let e,a=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=a.map(e=>new dc(e));return dp(t,{code:dl.invalid_union,unionErrors:i}),dh}}get options(){return this._def.options}}dQ.create=(e,t)=>new dQ({options:e,typeName:k.ZodUnion,...db(t)});let d0=e=>{if(e instanceof d8)return d0(e.schema);if(e instanceof pi)return d0(e.innerType());if(e instanceof d7)return[e.value];if(e instanceof pt)return e.options;if(e instanceof pr)return S.objectValues(e.enum);else if(e instanceof ps)return d0(e._def.innerType);else if(e instanceof dH)return[void 0];else if(e instanceof dJ)return[null];else if(e instanceof pn)return[void 0,...d0(e.unwrap())];else if(e instanceof po)return[null,...d0(e.unwrap())];else if(e instanceof pu)return d0(e.unwrap());else if(e instanceof pp)return d0(e.unwrap());else if(e instanceof pl)return d0(e._def.innerType);else return[]};class d1 extends dS{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dn.object)return dp(t,{code:dl.invalid_type,expected:dn.object,received:t.parsedType}),dh;let r=this.discriminator,a=t.data[r],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(dp(t,{code:dl.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),dh)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=d0(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(a.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,r)}}return new d1({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...db(r)})}}class d2 extends dS{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return dh;let i=function e(t,r){let a=ds(t),i=ds(r);if(t===r)return{valid:!0,data:t};if(a===dn.object&&i===dn.object){let a=S.objectKeys(r),i=S.objectKeys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1};n[a]=i.data}return{valid:!0,data:n}}if(a===dn.array&&i===dn.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}if(a===dn.date&&i===dn.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,a.value);return i.valid?(("dirty"===e.status||"dirty"===a.status)&&t.dirty(),{status:t.value,value:i.data}):(dp(r,{code:dl.invalid_intersection_types}),dh)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}d2.create=(e,t,r)=>new d2({left:e,right:t,typeName:k.ZodIntersection,...db(r)});class d9 extends dS{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dn.array)return dp(r,{code:dl.invalid_type,expected:dn.array,received:r.parsedType}),dh;if(r.data.length<this._def.items.length)return dp(r,{code:dl.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),dh;!this._def.rest&&r.data.length>this._def.items.length&&(dp(r,{code:dl.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new dv(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>dm.mergeArray(t,e)):dm.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new d9({...this._def,rest:e})}}d9.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new d9({items:e,typeName:k.ZodTuple,rest:null,...db(t)})};class d4 extends dS{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dn.object)return dp(r,{code:dl.invalid_type,expected:dn.object,received:r.parsedType}),dh;let a=[],i=this._def.keyType,n=this._def.valueType;for(let e in r.data)a.push({key:i._parse(new dv(r,e,r.path,e)),value:n._parse(new dv(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?dm.mergeObjectAsync(t,a):dm.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new d4(t instanceof dS?{keyType:e,valueType:t,typeName:k.ZodRecord,...db(r)}:{keyType:dL.create(),valueType:e,typeName:k.ZodRecord,...db(t)})}}class d6 extends dS{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dn.map)return dp(r,{code:dl.invalid_type,expected:dn.map,received:r.parsedType}),dh;let a=this._def.keyType,i=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new dv(r,e,r.path,[n,"key"])),value:i._parse(new dv(r,t,r.path,[n,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of n){let a=await r.key,i=await r.value;if("aborted"===a.status||"aborted"===i.status)return dh;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of n){let a=r.key,i=r.value;if("aborted"===a.status||"aborted"===i.status)return dh;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}d6.create=(e,t,r)=>new d6({valueType:t,keyType:e,typeName:k.ZodMap,...db(r)});class d5 extends dS{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==dn.set)return dp(r,{code:dl.invalid_type,expected:dn.set,received:r.parsedType}),dh;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(dp(r,{code:dl.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(dp(r,{code:dl.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let i=this._def.valueType;function n(e){let r=new Set;for(let a of e){if("aborted"===a.status)return dh;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>i._parse(new dv(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>n(e)):n(o)}min(e,t){return new d5({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new d5({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}d5.create=(e,t)=>new d5({valueType:e,minSize:null,maxSize:null,typeName:k.ZodSet,...db(t)});class d3 extends dS{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==dn.function)return dp(t,{code:dl.invalid_type,expected:dn.function,received:t.parsedType}),dh;function r(e,r){return dd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,du,du].filter(e=>!!e),issueData:{code:dl.invalid_arguments,argumentsError:r}})}function a(e,r){return dd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,du,du].filter(e=>!!e),issueData:{code:dl.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},n=t.data;if(this._def.returns instanceof pa){let e=this;return dg(async function(...t){let o=new dc([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(r(t,e)),o}),l=await Reflect.apply(n,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw o.addIssue(a(l,e)),o})})}{let e=this;return dg(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new dc([r(t,o.error)]);let s=Reflect.apply(n,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new dc([a(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new d3({...this._def,args:d9.create(e).rest(dB.create())})}returns(e){return new d3({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new d3({args:e||d9.create([]).rest(dB.create()),returns:t||dB.create(),typeName:k.ZodFunction,...db(r)})}}class d8 extends dS{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}d8.create=(e,t)=>new d8({getter:e,typeName:k.ZodLazy,...db(t)});class d7 extends dS{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return dp(t,{received:t.data,code:dl.invalid_literal,expected:this._def.value}),dh}return{status:"valid",value:e.data}}get value(){return this._def.value}}function pe(e,t){return new pt({values:e,typeName:k.ZodEnum,...db(t)})}d7.create=(e,t)=>new d7({value:e,typeName:k.ZodLiteral,...db(t)});class pt extends dS{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return dp(t,{expected:S.joinValues(r),received:t.parsedType,code:dl.invalid_type}),dh}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return dp(t,{received:t.data,code:dl.invalid_enum_value,options:r}),dh}return dg(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return pt.create(e,{...this._def,...t})}exclude(e,t=this._def){return pt.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}pt.create=pe;class pr extends dS{_parse(e){let t=S.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==dn.string&&r.parsedType!==dn.number){let e=S.objectValues(t);return dp(r,{expected:S.joinValues(e),received:r.parsedType,code:dl.invalid_type}),dh}if(this._cache||(this._cache=new Set(S.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=S.objectValues(t);return dp(r,{received:r.data,code:dl.invalid_enum_value,options:e}),dh}return dg(e.data)}get enum(){return this._def.values}}pr.create=(e,t)=>new pr({values:e,typeName:k.ZodNativeEnum,...db(t)});class pa extends dS{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==dn.promise&&!1===t.common.async?(dp(t,{code:dl.invalid_type,expected:dn.promise,received:t.parsedType}),dh):dg((t.parsedType===dn.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}pa.create=(e,t)=>new pa({type:e,typeName:k.ZodPromise,...db(t)});class pi extends dS{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:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{dp(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){let e=a.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return dh;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?dh:"dirty"===a.status||"dirty"===t.value?df(a.value):a});{if("aborted"===t.value)return dh;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?dh:"dirty"===a.status||"dirty"===t.value?df(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?dh:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?dh:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?dh:Promise.resolve(a.transform(e.value,i)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return dh;let n=a.transform(e.value,i);if(n instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}S.assertNever(a)}}pi.create=(e,t,r)=>new pi({schema:e,typeName:k.ZodEffects,effect:t,...db(r)}),pi.createWithPreprocess=(e,t,r)=>new pi({schema:t,effect:{type:"preprocess",transform:e},typeName:k.ZodEffects,...db(r)});class pn extends dS{_parse(e){return this._getType(e)===dn.undefined?dg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pn.create=(e,t)=>new pn({innerType:e,typeName:k.ZodOptional,...db(t)});class po extends dS{_parse(e){return this._getType(e)===dn.null?dg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}po.create=(e,t)=>new po({innerType:e,typeName:k.ZodNullable,...db(t)});class ps extends dS{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===dn.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ps.create=(e,t)=>new ps({innerType:e,typeName:k.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...db(t)});class pl extends dS{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return dy(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new dc(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new dc(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}pl.create=(e,t)=>new pl({innerType:e,typeName:k.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...db(t)});class pc extends dS{_parse(e){if(this._getType(e)!==dn.nan){let t=this._getOrReturnCtx(e);return dp(t,{code:dl.invalid_type,expected:dn.nan,received:t.parsedType}),dh}return{status:"valid",value:e.data}}}pc.create=e=>new pc({typeName:k.ZodNaN,...db(e)}),Symbol("zod_brand");class pu extends dS{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class pd extends dS{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?dh:"dirty"===e.status?(t.dirty(),df(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?dh:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new pd({in:e,out:t,typeName:k.ZodPipeline})}}class pp extends dS{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return dy(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}pp.create=(e,t)=>new pp({innerType:e,typeName:k.ZodReadonly,...db(t)}),dX.lazycreate,(y=k||(k={})).ZodString="ZodString",y.ZodNumber="ZodNumber",y.ZodNaN="ZodNaN",y.ZodBigInt="ZodBigInt",y.ZodBoolean="ZodBoolean",y.ZodDate="ZodDate",y.ZodSymbol="ZodSymbol",y.ZodUndefined="ZodUndefined",y.ZodNull="ZodNull",y.ZodAny="ZodAny",y.ZodUnknown="ZodUnknown",y.ZodNever="ZodNever",y.ZodVoid="ZodVoid",y.ZodArray="ZodArray",y.ZodObject="ZodObject",y.ZodUnion="ZodUnion",y.ZodDiscriminatedUnion="ZodDiscriminatedUnion",y.ZodIntersection="ZodIntersection",y.ZodTuple="ZodTuple",y.ZodRecord="ZodRecord",y.ZodMap="ZodMap",y.ZodSet="ZodSet",y.ZodFunction="ZodFunction",y.ZodLazy="ZodLazy",y.ZodLiteral="ZodLiteral",y.ZodEnum="ZodEnum",y.ZodEffects="ZodEffects",y.ZodNativeEnum="ZodNativeEnum",y.ZodOptional="ZodOptional",y.ZodNullable="ZodNullable",y.ZodDefault="ZodDefault",y.ZodCatch="ZodCatch",y.ZodPromise="ZodPromise",y.ZodBranded="ZodBranded",y.ZodPipeline="ZodPipeline",y.ZodReadonly="ZodReadonly",dL.create,dZ.create,pc.create,dD.create,dV.create,dU.create,dF.create,dH.create,dJ.create,dK.create,dB.create,dG.create,dW.create,dY.create,dX.create,dX.strictCreate,dQ.create,d1.create,d2.create,d9.create,d4.create,d6.create,d5.create,d3.create,d8.create,d7.create,pt.create,pr.create,pa.create,pi.create,pn.create,po.create,pi.createWithPreprocess,pd.create;let pm=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function ph(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?pm(t,e.currentPath):t.join("/")}}function pf(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function pg(e,t,r,a,i){e[t]=r,pf(e,t,a,i)}function py(e,t){return pM(e.type._def,t)}let pv=/^[cC][^\s-]{8,}$/,p_=/^[0-9a-z]+$/,pb=/^[0-9A-HJKMNP-TV-Z]{26}$/,pS=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,p$=()=>(void 0===d&&(d=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),d),pw=/^(?:(?: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])$/,pk=/^(([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])$/,pR=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,px=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pP=/^[a-zA-Z0-9_-]{21}$/,pE=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function pT(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":pg(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":pg(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":pC(r,"email",a.message,t);break;case"format:idn-email":pC(r,"idn-email",a.message,t);break;case"pattern:zod":pN(r,pS,a.message,t)}break;case"url":pC(r,"uri",a.message,t);break;case"uuid":pC(r,"uuid",a.message,t);break;case"regex":pN(r,a.regex,a.message,t);break;case"cuid":pN(r,pv,a.message,t);break;case"cuid2":pN(r,p_,a.message,t);break;case"startsWith":pN(r,RegExp(`^${pj(a.value,t)}`),a.message,t);break;case"endsWith":pN(r,RegExp(`${pj(a.value,t)}$`),a.message,t);break;case"datetime":pC(r,"date-time",a.message,t);break;case"date":pC(r,"date",a.message,t);break;case"time":pC(r,"time",a.message,t);break;case"duration":pC(r,"duration",a.message,t);break;case"length":pg(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),pg(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":pN(r,RegExp(pj(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&pC(r,"ipv4",a.message,t),"v4"!==a.version&&pC(r,"ipv6",a.message,t);break;case"base64url":pN(r,px,a.message,t);break;case"jwt":pN(r,pE,a.message,t);break;case"cidr":"v6"!==a.version&&pN(r,pw,a.message,t),"v4"!==a.version&&pN(r,pk,a.message,t);break;case"emoji":pN(r,p$(),a.message,t);break;case"ulid":pN(r,pb,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":pC(r,"binary",a.message,t);break;case"contentEncoding:base64":pg(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":pN(r,pR,a.message,t)}break;case"nanoid":pN(r,pP,a.message,t)}return r}function pj(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)pO.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let pO=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pC(e,t,r,a){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):pg(e,"format",t,r,a)}function pN(e,t,r,a){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:pI(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):pg(e,"pattern",pI(t,a),r,a)}function pI(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=r.i?e.source.toLowerCase():e.source,i="",n=!1,o=!1,s=!1;for(let e=0;e<a.length;e++){if(n){i+=a[e],n=!1;continue}if(r.i){if(o){if(a[e].match(/[a-z]/)){s?(i+=a[e],i+=`${a[e-2]}-${a[e]}`.toUpperCase(),s=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(i+=a[e],s=!0):i+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){i+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){i+=`(^|(?<=[\r
|
|
69
69
|
]))`;continue}else if("$"===a[e]){i+=`($|(?=[\r
|
|
70
|
-
]))`;continue}}if(r.s&&"."===a[e]){i+=
|
|
70
|
+
]))`;continue}}if(r.s&&"."===a[e]){i+=o?`${a[e]}\r
|
|
71
71
|
`:`[${a[e]}\r
|
|
72
|
-
]`;continue}i+=a[e],"\\"===a[e]?s=!0:n&&"]"===a[e]?n=!1:n||"["!==a[e]||(n=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function oU(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===lr.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:oK(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??ok(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:oK(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===lr.ZodString&&e.keyType._def.checks?.length){let{type:a,...i}=oZ(e.keyType._def,t);return{...r,propertyNames:i}}if(e.keyType?._def.typeName===lr.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===lr.ZodBranded&&e.keyType._def.type._def.typeName===lr.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...i}=oE(e.keyType._def,t);return{...r,propertyNames:i}}return r}let oH={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},oJ=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>oK(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function oK(e,t,r=!1){let a=t.seen.get(e);if(t.override){let i=t.override?.(e,t,a,r);if(i!==ob)return i}if(a&&!r){let e=oB(a,t);if(void 0!==e)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let s=((e,t,r)=>{switch(t){case lr.ZodString:return oZ(e,r);case lr.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",ox(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?oS(a,"minimum",t.value,t.message,r):oS(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),oS(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?oS(a,"maximum",t.value,t.message,r):oS(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),oS(a,"maximum",t.value,t.message,r));break;case"multipleOf":oS(a,"multipleOf",t.value,t.message,r)}return a;case lr.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},i=[],s=e.shape();for(let e in s){let n=s[e];if(void 0===n||void 0===n._def)continue;let o=function(e){try{return e.isOptional()}catch{return!0}}(n);o&&r&&("ZodOptional"===n._def.typeName&&(n=n._def.innerType),n.isNullable()||(n=n.nullable()),o=!1);let l=oK(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,o||i.push(e))}i.length&&(a.required=i);let n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return oK(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==n&&(a.additionalProperties=n),a}(e,r);case lr.ZodBigInt:let i={type:"integer",format:"int64"};if(!e.checks)return i;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?oS(i,"minimum",t.value,t.message,r):oS(i,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(i.exclusiveMinimum=!0),oS(i,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?oS(i,"maximum",t.value,t.message,r):oS(i,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(i.exclusiveMaximum=!0),oS(i,"maximum",t.value,t.message,r));break;case"multipleOf":oS(i,"multipleOf",t.value,t.message,r)}return i;case lr.ZodBoolean:return{type:"boolean"};case lr.ZodDate:return function e(t,r,a){let i=a??r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((a,i)=>e(t,r,a))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var s=t,n=r;let o={type:"integer",format:"unix-time"};if("openApi3"===n.target)return o;for(let e of s.checks)switch(e.kind){case"min":oS(o,"minimum",e.value,e.message,n);break;case"max":oS(o,"maximum",e.value,e.message,n)}return o}}(e,r);case lr.ZodUndefined:return{not:ok(r)};case lr.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case lr.ZodArray:let s;return s={type:"array"},e.type?._def&&e.type?._def?.typeName!==lr.ZodAny&&(s.items=oK(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&oS(s,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&oS(s,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(oS(s,"minItems",e.exactLength.value,e.exactLength.message,r),oS(s,"maxItems",e.exactLength.value,e.exactLength.message,r)),s;case lr.ZodUnion:case lr.ZodDiscriminatedUnion:if("openApi3"===r.target)return oJ(e,r);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in oH&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let r=oH[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=n.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return oJ(e,r);case lr.ZodIntersection:let o,l,u;return o=[oK(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),oK(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),l="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,u=[],o.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)u.push(...e.allOf),void 0===e.unevaluatedProperties&&(l=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else l=void 0;u.push(t)}}),u.length?{allOf:u,...l}:void 0;case lr.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>oK(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:oK(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>oK(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case lr.ZodRecord:return oU(e,r);case lr.ZodLiteral:let d;return"bigint"!=(d=typeof e.value)&&"number"!==d&&"boolean"!==d&&"string"!==d?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===d?"integer":d,enum:[e.value]}:{type:"bigint"===d?"integer":d,const:e.value};case lr.ZodEnum:return{type:"string",enum:Array.from(e.values)};case lr.ZodNativeEnum:let c,p,f;return c=e.values,{type:1===(f=Array.from(new Set((p=Object.keys(e.values).filter(e=>"number"!=typeof c[c[e]]).map(e=>c[e])).map(e=>typeof e)))).length?"string"===f[0]?"string":"number":["string","number"],enum:p};case lr.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===r.target?{type:oH[e.innerType._def.typeName],nullable:!0}:{type:[oH[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=oK(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let h=oK(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]};case lr.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return oK(e.innerType._def,r);let m=oK(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return m?{anyOf:[{not:ok(r)},m]}:ok(r);case lr.ZodMap:if("record"===r.mapStrategy)return oU(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[oK(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||ok(r),oK(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||ok(r)],minItems:2,maxItems:2}};case lr.ZodSet:let y;return y={type:"array",uniqueItems:!0,items:oK(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&oS(y,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&oS(y,"maxItems",e.maxSize.value,e.maxSize.message,r),y;case lr.ZodLazy:return()=>e.getter()._def;case lr.ZodPromise:return oK(e.type._def,r);case lr.ZodNaN:case lr.ZodNever:return"openAi"===r.target?void 0:{not:ok({...r,currentPath:[...r.currentPath,"not"]})};case lr.ZodEffects:return"input"===r.effectStrategy?oK(e.schema._def,r):ok(r);case lr.ZodAny:case lr.ZodUnknown:return ok(r);case lr.ZodDefault:return{...oK(e.innerType._def,r),default:e.defaultValue()};case lr.ZodBranded:return oE(e,r);case lr.ZodReadonly:case lr.ZodCatch:return oK(e.innerType._def,r);case lr.ZodPipeline:if("input"===r.pipeStrategy)return oK(e.in._def,r);if("output"===r.pipeStrategy)return oK(e.out._def,r);let g=oK(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=oK(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",g?"1":"0"]});return{allOf:[g,v].filter(e=>void 0!==e)};case lr.ZodFunction:case lr.ZodVoid:case lr.ZodSymbol:default:return}})(e,e.typeName,t),n="function"==typeof s?oK(s(),t):s;if(n&&oG(e,t,n),t.postProcess){let r=t.postProcess(n,e,t);return i.jsonSchema=n,r}return i.jsonSchema=n,n}let oB=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:o$(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),ok(t);return"seen"===t.$refStrategy?ok(t):void 0}},oG=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function oW(e,t){if(oc(e)){var r;return function(e,t){if("_idmap"in e){let r=tY({...t,processors:ry}),a={};for(let t of e._idmap.entries()){let[e,a]=t;tQ(a,r)}let i={};for(let s of(r.external={registry:e,uri:t?.uri,defs:a},e._idmap.entries())){let[e,t]=s;tX(r,t),i[e]=t0(r,t)}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let r=tY({...t,processors:ry});return tQ(e,r),tX(r,e),t0(r,e)}(e,{target:(r=t?.target)&&"jsonSchema7"!==r&&"draft-7"!==r&&("jsonSchema2019-09"===r||"draft-2020-12"===r)?"draft-2020-12":"draft-7",io:t?.pipeStrategy??"input"})}return((e,t)=>{let r,a,i=(a=void 0!==(r="string"==typeof t?{...ow,name:t}:{...ow,...t}).name?[...r.basePath,r.definitionPath,r.name]:r.basePath,{...r,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(r.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...r.basePath,r.definitionPath,e],jsonSchema:void 0}]))}),s="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:oK(r._def,{...i,currentPath:[...i.basePath,i.definitionPath,t]},!0)??ok(i)}),{}):void 0,n="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,o=oK(e._def,void 0===n?i:{...i,currentPath:[...i.basePath,i.definitionPath,n]},!1)??ok(i),l="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==l&&(o.title=l),i.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[i.openAiAnyTypeName]||(s[i.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===i.$refStrategy?"1":[...i.basePath,i.definitionPath,i.openAiAnyTypeName].join("/")}}));let u=void 0===n?s?{...o,[i.definitionPath]:s}:o:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,n].join("/"),[i.definitionPath]:{...s,[n]:o}};return"jsonSchema7"===i.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===i.target||"openAi"===i.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===i.target&&("anyOf"in u||"oneOf"in u||"allOf"in u||"type"in u&&Array.isArray(u.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),u})(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function oY(e){let t=om(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let a=ov(r);if("string"!=typeof a)throw Error("Schema method literal must be a string");return a}function oQ(e,t){let r=of(e,t);if(!r.success)throw r.error;return r.data}class oX{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(ir,e=>{this._oncancel(e)}),this.setNotificationHandler(i$,e=>{this._onprogress(e)}),this.setRequestHandler(i_,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(iN,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new s8(o3.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(iI,async(e,t)=>{let r=async()=>{let a=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(a,t.sessionId);){if("response"===e.type||"error"===e.type){let t=e.message,r=t.id,a=this._requestResolvers.get(r);if(a)this._requestResolvers.delete(r),a("response"===e.type?t:new s8(t.error.code,t.error.message,t.error.data));else{let t="response"===e.type?"Response":"Error";this._onerror(Error(`${t} handler missing for request ${r}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(a,t.sessionId);if(!i)throw new s8(o3.InvalidParams,`Task not found: ${a}`);if(!o_(i.status))return await this._waitForTaskUpdate(a,t.signal),await r();if(o_(i.status)){let e=await this._taskStore.getTaskResult(a,t.sessionId);return this._clearTaskQueue(a),{...e,_meta:{...e._meta,[aU]:{taskId:a}}}}return await r()};return await r()}),this.setRequestHandler(iR,async(e,t)=>{try{let{tasks:r,nextCursor:a}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:a,_meta:{}}}catch(e){throw new s8(o3.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(iA,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new s8(o3.InvalidParams,`Task not found: ${e.params.taskId}`);if(o_(r.status))throw new s8(o3.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);let a=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!a)throw new s8(o3.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...a}}catch(e){if(e instanceof s8)throw e;throw new s8(o3.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;let t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,a,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:a})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),s8.fromError(o3.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let a=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(a?.(e,t),a5.safeParse(e).success||a3.safeParse(e).success)this._onresponse(e);else if(a6(e))this._onrequest(e,t);else a8.safeParse(e).success?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear(),this._requestHandlerAbortControllers.values()))e.abort();this._requestHandlerAbortControllers.clear();let t=s8.fromError(o3.ConnectionClosed,"Connection closed");for(let r of(this._transport=void 0,this.onclose?.(),e.values()))r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let r,a=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,s=e.params?._meta?.[aU]?.taskId;if(void 0===a){let t={jsonrpc:"2.0",id:e.id,error:{code:o3.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:t,timestamp:Date.now()},i?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):i?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);let o=(r=e.params,aQ.safeParse(r).success)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,u={signal:n.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(n.signal.aborted)return;let r={relatedRequestId:e.id};s&&(r.relatedTask={taskId:s}),await this.notification(t,r)},sendRequest:async(t,r,a)=>{if(n.signal.aborted)throw new s8(o3.ConnectionClosed,"Request was cancelled");let i={...a,relatedRequestId:e.id};s&&!i.relatedTask&&(i.relatedTask={taskId:s});let o=i.relatedTask?.taskId??s;return o&&l&&await l.updateTaskStatus(o,"input_required"),await this.request(t,r,i)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:s,taskStore:l,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>a(e,u)).then(async t=>{if(n.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)},async t=>{if(n.signal.aborted)return;let r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:o3.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,a=Number(t),i=this._progressHandlers.get(a);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let s=this._responseHandlers.get(a),n=this._timeoutInfo.get(a);if(n&&s&&n.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),s(e);return}i(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r(a5.safeParse(e).success?e:new s8(e.error.code,e.error.message,e.error.data));return}let a=this._responseHandlers.get(t);if(void 0===a)return void this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(a5.safeParse(e).success&&e.result&&"object"==typeof e.result){let r=e.result;if(r.task&&"object"==typeof r.task){let e=r.task;"string"==typeof e.taskId&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),a(a5.safeParse(e).success?e:s8.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async *requestStream(e,t,r){let a,{task:i}=r??{};if(!i){try{let a=await this.request(e,t,r);yield{type:"result",result:a}}catch(e){yield{type:"error",error:e instanceof s8?e:new s8(o3.InternalError,String(e))}}return}try{let i=await this.request(e,iP,r);if(i.task)a=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new s8(o3.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:e},o_(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:a},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new s8(o3.InternalError,`Task ${a} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new s8(o3.InternalError,`Task ${a} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:a},t,r);yield{type:"result",result:e};return}let i=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,i)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof s8?e:new s8(o3.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:a,resumptionToken:i,onresumptiontoken:s,task:n,relatedTask:o}=r??{};return new Promise((l,u)=>{let d=e=>{u(e)};if(!this._transport)return void d(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),n&&this.assertTaskCapability(e.method)}catch(e){d(e);return}r?.signal?.throwIfAborted();let c=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:c};r?.onprogress&&(this._progressHandlers.set(c,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:c}}),n&&(p.params={...p.params,task:n}),o&&(p.params={...p.params,_meta:{...p.params?._meta||{},[aU]:o}});let f=e=>{this._responseHandlers.delete(c),this._progressHandlers.delete(c),this._cleanupTimeout(c),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:c,reason:String(e)}},{relatedRequestId:a,resumptionToken:i,onresumptiontoken:s}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),u(e instanceof s8?e:new s8(o3.RequestTimeout,String(e)))};this._responseHandlers.set(c,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return u(e);try{let r=of(t,e.result);r.success?l(r.data):u(r.error)}catch(e){u(e)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let h=r?.timeout??6e4;this._setupTimeout(c,h,r?.maxTotalTimeout,()=>f(s8.fromError(o3.RequestTimeout,"Request timed out",{timeout:h})),r?.resetTimeoutOnProgress??!1);let m=o?.taskId;if(m){let e=e=>{let t=this._responseHandlers.get(c);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${c}`))};this._requestResolvers.set(c,e),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(c),u(e)})}else this._transport.send(p,{relatedRequestId:a,resumptionToken:i,onresumptiontoken:s}).catch(e=>{this._cleanupTimeout(c),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},iz,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},iC,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},iM,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[aU]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.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 r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[aU]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))});return}let a={...e,jsonrpc:"2.0"};t?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[aU]:t.relatedTask}}}),await this._transport.send(a,t)}setRequestHandler(e,t){let r=oY(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,a)=>Promise.resolve(t(oQ(e,r),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=oY(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(oQ(e,r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let a=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,a)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){for(let r of(await this._taskMessageQueue.dequeueAll(e,t)))if("request"===r.type&&a6(r.message)){let t=r.message.id,a=this._requestResolvers.get(t);a?(a(new s8(o3.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(t)):this._onerror(Error(`Resolver missing for request ${t} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,a)=>{if(t.aborted)return void a(new s8(o3.InvalidRequest,"Request cancelled"));let i=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(i),a(new s8(o3.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async a=>{if(!e)throw Error("No request provided");return await r.createTask(a,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let a=await r.getTask(e,t);if(!a)throw new s8(o3.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(e,a,i)=>{await r.storeTaskResult(e,a,i,t);let s=await r.getTask(e,t);if(s){let t=ij.parse({method:"notifications/tasks/status",params:s});await this.notification(t),o_(s.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,a,i)=>{let s=await r.getTask(e,t);if(!s)throw new s8(o3.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(o_(s.status))throw new s8(o3.InvalidParams,`Cannot update task "${e}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,a,i,t);let n=await r.getTask(e,t);if(n){let t=ij.parse({method:"notifications/tasks/status",params:n});await this.notification(t),o_(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function o0(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var o1,o9,o2,o4,o6,o8,o5,o3,o7,le,lt,lr,la,li=r(8825),ls=r(1712);class ln{constructor(e){this._ajv=e??function(){let e=new li({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ls(e),e}()}getValidator(e){let t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class lo{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class ll extends oX{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(sv.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new ln,this.setRequestHandler(im,e=>this._oninitialize(e)),this.setNotificationHandler(iv,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(sb,async(e,t)=>{let r=t.sessionId||t.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=e.params,i=sv.safeParse(a);return i.success&&this._loggingLevels.set(r,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new lo(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let r={...e};for(let e in t){let a=t[e];if(void 0===a)continue;let i=r[e];o0(i)&&o0(a)?r[e]={...i,...a}:r[e]=a}return r}(this._capabilities,e)}setRequestHandler(e,t){let r,a=om(e),i=a?.method;if(!i)throw Error("Schema is missing a method literal");if(oc(i)){let e=i._zod?.def;r=e?.value??i.value}else{let e=i._def;r=e?.value??i.value}if("string"!=typeof r)throw Error("Schema method literal must be a string");if("tools/call"===r){let r=async(e,r)=>{let a=of(sy,e);if(!a.success){let e=a.error instanceof Error?a.error.message:String(a.error);throw new s8(o3.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=a.data,s=await Promise.resolve(t(e,r));if(i.task){let e=of(iP,s);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new s8(o3.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=of(sh,s);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new s8(o3.InvalidParams,`Invalid tools/call result: ${e}`)}return n.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t=this._clientCapabilities?.tasks?.requests,r="Client";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${e})`)}}assertTaskHandlerCapability(e){if(this._capabilities){var t=this._capabilities.tasks?.requests,r="Server";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);if("tools/call"===e&&!t.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:aV.includes(t)?t:aL,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"},ie)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let t=e.messages[e.messages.length-1],r=Array.isArray(t.content)?t.content:[t.content],a=r.some(e=>"tool_result"===e.type),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=i?Array.isArray(i.content)?i.content:[i.content]:[],n=s.some(e=>"tool_use"===e.type);if(a){if(r.some(e=>"tool_result"!==e.type))throw Error("The last message must contain only tool_result content if any is present");if(!n)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(n){let e=new Set(s.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw 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},sI,t):this.request({method:"sampling/createMessage",params:e},sz,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");return this.request({method:"elicitation/create",params:e},sW,t);case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let r="form"===e.mode?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:r},sW,t);if("accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new s8(o3.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof s8)throw e;throw new s8(o3.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},s4,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))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"})}}let lu=Symbol.for("mcp.completable");function ld(e){return!!e&&"object"==typeof e&&lu in e}(la||(la={})).Completable="McpCompletable";class lc{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,r){if(e.length>t)throw Error(`${r} exceeds maximum length of ${t} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>"string"==typeof e?[]:e.names)}constructor(e){lc.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let t=[],r="",a=0,i=0;for(;a<e.length;)if("{"===e[a]){r&&(t.push(r),r="");let s=e.indexOf("}",a);if(-1===s)throw Error("Unclosed template expression");if(++i>1e4)throw Error("Template contains too many expressions (max 10000)");let n=e.slice(a+1,s),o=this.getOperator(n),l=n.includes("*"),u=this.getNames(n),d=u[0];for(let e of u)lc.validateLength(e,1e6,"Variable name");t.push({name:d,operator:o,names:u,exploded:l}),a=s+1}else r+=e[a],a++;return r&&t.push(r),t}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(",").map(e=>e.replace("*","").trim()).filter(e=>e.length>0)}encodeValue(e,t){return(lc.validateLength(e,1e6,"Variable value"),"+"===t||"#"===t)?encodeURI(e):encodeURIComponent(e)}expandPart(e,t){if("?"===e.operator||"&"===e.operator){let r=e.names.map(r=>{let a=t[r];if(void 0===a)return"";let i=Array.isArray(a)?a.map(t=>this.encodeValue(t,e.operator)).join(","):this.encodeValue(a.toString(),e.operator);return`${r}=${i}`}).filter(e=>e.length>0);return 0===r.length?"":("?"===e.operator?"?":"&")+r.join("&")}if(e.names.length>1){let r=e.names.map(e=>t[e]).filter(e=>void 0!==e);return 0===r.length?"":r.map(e=>Array.isArray(e)?e[0]:e).join(",")}let r=t[e.name];if(void 0===r)return"";let a=(Array.isArray(r)?r:[r]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case"":case"+":default:return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/")}}expand(e){let t="",r=!1;for(let a of this.parts){if("string"==typeof a){t+=a;continue}let i=this.expandPart(a,e);i&&(("?"===a.operator||"&"===a.operator)&&r?t+=i.replace("?","&"):t+=i,("?"===a.operator||"&"===a.operator)&&(r=!0))}return t}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let t,r=[];for(let t of e.names)lc.validateLength(t,1e6,"Variable name");if("?"===e.operator||"&"===e.operator){for(let t=0;t<e.names.length;t++){let a=e.names[t],i=0===t?"\\"+e.operator:"&";r.push({pattern:i+this.escapeRegExp(a)+"=([^&]+)",name:a})}return r}let a=e.name;switch(e.operator){case"":t=e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":t="(.+)";break;case".":t="\\.([^/,]+)";break;case"/":t="/"+(e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:t="([^/]+)"}return r.push({pattern:t,name:a}),r}match(e){lc.validateLength(e,1e6,"URI");let t="^",r=[];for(let e of this.parts)if("string"==typeof e)t+=this.escapeRegExp(e);else for(let{pattern:a,name:i}of this.partToRegExp(e))t+=a,r.push({name:i,exploded:e.exploded});t+="$",lc.validateLength(t,1e6,"Generated regex pattern");let a=new RegExp(t),i=e.match(a);if(!i)return null;let s={};for(let e=0;e<r.length;e++){let{name:t,exploded:a}=r[e],n=i[e+1],o=t.replace("*","");a&&n.includes(",")?s[o]=n.split(","):s[o]=n}return s}}let lp=/^[A-Za-z0-9._-]{1,128}$/;function lf(e){let t=function(e){let t=[];if(0===e.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!lp.test(e)){let r=e.split("").filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,r)=>r.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${r.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);var r=t.warnings;if(r.length>0){for(let t of(console.warn(`Tool name validation warning for "${e}":`),r))console.warn(` - ${t}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}return t.isValid}class lh{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let a={taskSupport:"required",...t.execution};if("forbidden"===a.taskSupport)throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,a,t._meta,r)}}class lm{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ll(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new lh(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(lw(sp)),this.server.assertCanSetRequestHandler(lw(sy)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(sp,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r,a={name:e,title:t.title,description:t.description,inputSchema:(r=oy(t.inputSchema))?oW(r,{strictUnions:!0,pipeStrategy:"input"}):lg,annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=oy(t.outputSchema);e&&(a.outputSchema=oW(e,{strictUnions:!0,pipeStrategy:"output"}))}return a})})),this.server.setRequestHandler(sy,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new s8(o3.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new s8(o3.InvalidParams,`Tool ${e.params.name} disabled`);let a=!!e.params.task,i=r.execution?.taskSupport,s="createTask"in r.handler;if(("required"===i||"optional"===i)&&!s)throw new s8(o3.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if("required"===i&&!a)throw new s8(o3.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if("optional"===i&&!a&&s)return await this.handleAutomaticTaskPolling(r,e,t);let n=await this.validateToolInput(r,e.params.arguments,e.params.name),o=await this.executeToolHandler(r,n,t);if(a)return o;return await this.validateToolOutput(r,o,e.params.name),o}catch(e){if(e instanceof s8&&e.code===o3.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let a=oy(e.inputSchema)??e.inputSchema,i=await oh(a,t);if(!i.success){let e=og("error"in i?i.error:"Unknown error");throw new s8(o3.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${e}`)}return i.data}async validateToolOutput(e,t,r){if(!e.outputSchema||!("content"in t)||t.isError)return;if(!t.structuredContent)throw new s8(o3.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=oy(e.outputSchema),i=await oh(a,t.structuredContent);if(!i.success){let e=og("error"in i?i.error:"Unknown error");throw new s8(o3.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${e}`)}}async executeToolHandler(e,t,r){let a=e.handler;if("createTask"in a){if(!r.taskStore)throw Error("No task store provided.");let i={...r,taskStore:r.taskStore};return e.inputSchema?await Promise.resolve(a.createTask(t,i)):await Promise.resolve(a.createTask(i))}return e.inputSchema?await Promise.resolve(a(t,r)):await Promise.resolve(a(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let a=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,s={...r,taskStore:r.taskStore},n=a?await Promise.resolve(i.createTask(a,s)):await Promise.resolve(i.createTask(s)),o=n.task.taskId,l=n.task,u=l.pollInterval??5e3;for(;"completed"!==l.status&&"failed"!==l.status&&"cancelled"!==l.status;){await new Promise(e=>setTimeout(e,u));let e=await r.taskStore.getTask(o);if(!e)throw new s8(o3.InternalError,`Task ${o} not found during polling`);l=e}return await r.taskStore.getTaskResult(o)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(lw(s0)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(s0,async e=>{switch(e.params.ref.type){case"ref/prompt":if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`);return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`);return this.handleResourceCompletion(e,e.params.ref);default:throw new s8(o3.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r,a=this._registeredPrompts[t.name];if(!a)throw new s8(o3.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new s8(o3.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return lk;let i=om(a.argsSchema),s=i?.[e.params.argument.name];if(!ld(s))return lk;let n=(r=s[lu],r?.complete);return n?l$(await n(e.params.argument.value,e.params.context)):lk}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return lk;throw new s8(o3.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?l$(await a(e.params.argument.value,e.params.context)):lk}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(lw(iJ)),this.server.assertCanSetRequestHandler(lw(iB)),this.server.assertCanSetRequestHandler(lw(iY)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(iJ,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(let e of Object.values(this._registeredResourceTemplates))if(e.resourceTemplate.listCallback)for(let r of(await e.resourceTemplate.listCallback(t)).resources)a.push({...e.metadata,...r});return{resources:[...r,...a]}}),this.server.setRequestHandler(iB,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(iY,async(e,t)=>{let r=new URL(e.params.uri),a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new s8(o3.InvalidParams,`Resource ${r} disabled`);return a.readCallback(r,t)}for(let e of Object.values(this._registeredResourceTemplates)){let a=e.resourceTemplate.uriTemplate.match(r.toString());if(a)return e.readCallback(r,a,t)}throw new s8(o3.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(lw(i8)),this.server.assertCanSetRequestHandler(lw(i7)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(i8,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{let r;return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(r=om(t.argsSchema))?Object.entries(r).map(([e,t])=>({name:e,description:t.description,required:!(oc(t)?t._zod?.def?.type==="optional":"function"==typeof t.isOptional?t.isOptional():t._def?.typeName==="ZodOptional")})):[]:void 0}})})),this.server.setRequestHandler(i7,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new s8(o3.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new s8(o3.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let a=oy(r.argsSchema),i=await oh(a,e.params.arguments);if(!i.success){let t=og("error"in i?i.error:"Unknown error");throw new s8(o3.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}let s=i.data,n=r.callback;return await Promise.resolve(n(s,t))}{let e=r.callback;return await Promise.resolve(e(t))}}),this._promptHandlersInitialized=!0)}resource(e,t,...r){let a;"object"==typeof r[0]&&(a=r.shift());let i=r[0];if("string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let r=this._createRegisteredResource(e,void 0,t,a,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let r=this._createRegisteredResourceTemplate(e,void 0,t,a,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}}registerResource(e,t,r,a){if("string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,r,a,i){let s={name:e,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=s)),void 0!==e.name&&(s.name=e.name),void 0!==e.title&&(s.title=e.title),void 0!==e.metadata&&(s.metadata=e.metadata),void 0!==e.callback&&(s.readCallback=e.callback),void 0!==e.enabled&&(s.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,a,i){let s={resourceTemplate:r,title:t,metadata:a,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=s)),void 0!==t.title&&(s.title=t.title),void 0!==t.template&&(s.resourceTemplate=t.template),void 0!==t.metadata&&(s.metadata=t.metadata),void 0!==t.callback&&(s.readCallback=t.callback),void 0!==t.enabled&&(s.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let n=r.uriTemplate.variableNames;return Array.isArray(n)&&n.some(e=>!!r.completeCallback(e))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,t,r,a,i){let s={title:t,description:r,argsSchema:void 0===a?void 0:op(a),callback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=s)),void 0!==t.title&&(s.title=t.title),void 0!==t.description&&(s.description=t.description),void 0!==t.argsSchema&&(s.argsSchema=op(t.argsSchema)),void 0!==t.callback&&(s.callback=t.callback),void 0!==t.enabled&&(s.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=s,a&&Object.values(a).some(e=>ld(e instanceof aT?e._def?.innerType:e))&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,t,r,a,i,s,n,o,l){lf(e);let u={title:t,description:r,inputSchema:lb(a),outputSchema:lb(i),annotations:s,execution:n,_meta:o,handler:l,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&lf(t.name),delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=u)),void 0!==t.title&&(u.title=t.title),void 0!==t.description&&(u.description=t.description),void 0!==t.paramsSchema&&(u.inputSchema=op(t.paramsSchema)),void 0!==t.outputSchema&&(u.outputSchema=op(t.outputSchema)),void 0!==t.callback&&(u.handler=t.callback),void 0!==t.annotations&&(u.annotations=t.annotations),void 0!==t._meta&&(u._meta=t._meta),void 0!==t.enabled&&(u.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){let r,a,i,s;if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);if("string"==typeof t[0]&&(r=t.shift()),t.length>1){let e=t[0];l_(e)?(a=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!l_(t[0])&&(s=t.shift())):"object"==typeof e&&null!==e&&(s=t.shift())}let n=t[0];return this._createRegisteredTool(e,void 0,r,a,i,s,{taskSupport:"forbidden"},void 0,n)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:i,inputSchema:s,outputSchema:n,annotations:o,_meta:l}=t;return this._createRegisteredTool(e,a,i,s,n,o,{taskSupport:"forbidden"},l,r)}prompt(e,...t){let r,a;if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);"string"==typeof t[0]&&(r=t.shift()),t.length>1&&(a=t.shift());let i=t[0],s=this._createRegisteredPrompt(e,void 0,r,a,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:i,argsSchema:s}=t,n=this._createRegisteredPrompt(e,a,i,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),n}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class ly{constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new lc(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}}let lg={type:"object",properties:{}};function lv(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function l_(e){return"object"==typeof e&&null!==e&&!("_def"in e||"_zod"in e||lv(e))&&(0===Object.keys(e).length||Object.values(e).some(lv))}function lb(e){if(e)return l_(e)?op(e):e}function lw(e){let t=om(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let a=ov(r);if("string"==typeof a)return a;throw Error("Schema method literal must be a string")}function l$(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}let lk={completion:{values:[],hasMore:!1}},lx=require("async_hooks"),lS=(e,t)=>{globalThis[e]=t},lE=e=>globalThis[e];function lT({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if(lE(t))return lE(t);let a=new lx.AsyncLocalStorage,i=globalThis[r]??{current:null};lS(r,i);let s={provider:(e,t)=>(i.current=e,a.run(e,t)),getContext:()=>{let t=a.getStore();if(t)return t;if(i.current)return i.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:t=>{let r=a.getStore()??i.current;if(!r)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(r,t)}};return lS(t,s),s}let lP=lT({name:"http-request-context"});lP.setContext;let lO=lP.getContext;lP.provider;let lj=lT({name:"client-info-context"}),lN=lj.setContext,lz=lj.getContext,lI=lj.provider,lR=e=>{if(!("object"==typeof e&&null!==e&&!Array.isArray(e))||"string"!=typeof e.name||"string"!=typeof e.version)return;let t={name:e.name,version:e.version};return"string"==typeof e.title&&(t.title=e.title),"string"==typeof e.websiteUrl&&(t.websiteUrl=e.websiteUrl),"string"==typeof e.description&&(t.description=e.description),t},lC=(e,t)=>{let r=t.toLowerCase();for(let[t,a]of Object.entries(e)){if(t.toLowerCase()!==r)continue;let e=Array.isArray(a)?a[0]:a;if("string"!=typeof e)break;let i=e.trim();return i.length>0?i:void 0}},lA=new Set(["message","mode","requestedSchema"]),lM=new Set(["elicitationId","message","mode","url"]),lZ=new Set(["properties","required","type"]),lq=new Set(["default","description","format","maxLength","minLength","title","type"]),lD=new Set(["default","description","enum","enumNames","title","type"]),lF=new Set(["default","description","title","type"]),lL=new Set(["default","description","maximum","minimum","title","type"]),lV=new Set(["date","date-time","email","uri"]);async function lU(e,t,r){let a=function(e){let t=e.mode??"form";if("url"===t)return function(e){let t;lJ(e,"Elicitation request must be a plain object."),lH(e,lM,"URL elicitation"),lK(e.message,"URL elicitation requires a string message."),lB(e.elicitationId,"URL elicitation requires a non-empty elicitationId."),lB(e.url,"URL elicitation requires a non-empty URL.");try{t=new URL(e.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(e),sH.parse(e);if("form"!==t)throw Error(`Unsupported elicitation mode "${String(e.mode)}". Expected "form" or "url".`);return function(e){lJ(e,"Elicitation request must be a plain object."),lH(e,lA,"Form elicitation"),lK(e.message,"Form elicitation requires a string message.");let t=e.requestedSchema;if(lJ(t,"Form elicitation requires a flat object schema."),lH(t,lZ,"Form elicitation schema"),"object"!==t.type)throw Error('Form elicitation schema must use type "object".');for(let[e,r]of(lJ(t.properties,"Form elicitation schema requires a properties object."),Object.entries(t.properties)))!function(e,t){if(lJ(t,`Form elicitation field "${e}" must be a plain object.`),lG(t.title,`Form elicitation field "${e}" title must be a string.`),lG(t.description,`Form elicitation field "${e}" description must be a string.`),"string"===t.type&&"enum"in t){var r,a;if(lH(t,lD,`Form elicitation field "${e}"`),lY(t.enum,`Form elicitation field "${e}" enum values must be strings.`),r=t.enumNames,a=`Form elicitation field "${e}" enumNames must be strings.`,void 0!==r&&lY(r,a),void 0!==t.enumNames&&t.enumNames.length!==t.enum.length)throw Error(`Form elicitation field "${e}" enumNames length must match enum length.`);if(lG(t.default,`Form elicitation field "${e}" default must be a string.`),void 0!==t.default&&!t.enum.includes(t.default))throw Error(`Form elicitation field "${e}" default must be one of its enum values.`);return}if("string"===t.type&&!("enum"in t)){lH(t,lq,`Form elicitation field "${e}"`),lW(t.minLength,`Form elicitation field "${e}" minLength must be a number.`),lW(t.maxLength,`Form elicitation field "${e}" maxLength must be a number.`),lG(t.default,`Form elicitation field "${e}" default must be a string.`);let r=t.format;if(lG(r,`Form elicitation field "${e}" format must be a string.`),void 0!==r&&!lV.has(r))throw Error(`Form elicitation field "${e}" format must be one of: ${Array.from(lV).join(", ")}.`);return}if("boolean"===t.type){if(lH(t,lF,`Form elicitation field "${e}"`),void 0!==t.default&&"boolean"!=typeof t.default)throw Error(`Form elicitation field "${e}" default must be a boolean.`);return}if("number"===t.type||"integer"===t.type){lH(t,lL,`Form elicitation field "${e}"`),lW(t.minimum,`Form elicitation field "${e}" minimum must be a number.`),lW(t.maximum,`Form elicitation field "${e}" maximum must be a number.`),lW(t.default,`Form elicitation field "${e}" default must be a number.`);return}throw Error(`Form elicitation field "${e}" uses unsupported type "${String(t.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(e,r);if(void 0!==t.required){if(!Array.isArray(t.required)||t.required.some(e=>"string"!=typeof e))throw Error("Form elicitation schema required fields must be a string array.");for(let e of t.required)if(!(e in t.properties))throw Error(`Form elicitation schema required field "${e}" is not defined in properties.`)}}(e),sU.parse({...e,mode:"form"})}(t),i=await e.sendRequest({method:"elicitation/create",params:a},sW,r);return{...i,content:i.content??void 0}}function lH(e,t,r){let a=Object.keys(e).filter(e=>!t.has(e));if(0!==a.length)throw Error(`${r} includes unsupported key(s): ${a.join(", ")}.`)}function lJ(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}function lK(e,t){if("string"!=typeof e)throw Error(t)}function lB(e,t){if("string"!=typeof e||0===e.trim().length)throw Error(t)}function lG(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(t)}function lW(e,t){if(void 0!==e&&"number"!=typeof e)throw Error(t)}function lY(e,t){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e))throw Error(t)}let lQ={text:e=>"string"!=typeof e.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:e=>"string"!=typeof e.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:e=>"string"!=typeof e.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:e=>"string"!=typeof e.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof e.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==e.title&&"string"!=typeof e.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==e.description&&"string"!=typeof e.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==e.mimeType&&"string"!=typeof e.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function lX(e){if(!e||"object"!=typeof e)return{valid:!1,error:"Content must be an object"};if("string"!=typeof e.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==e._meta&&(null===e._meta||"object"!=typeof e._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let t=lQ[e.type];return t?t(e):{valid:!0}}function l0(e,t,r,a){if(null===e||"object"!=typeof e||Array.isArray(e))throw Error(`Tool "${r}" ${a}: expected a plain object.`);let i=new Set(Object.keys(t)),s=Object.keys(e).filter(e=>!i.has(e));if(s.length>0)throw Error(`Tool "${r}" ${a}: unrecognized key(s): ${s.join(", ")}`);for(let[i,s]of Object.entries(t))try{s.parse(e[i])}catch(e){throw Error(`Tool "${r}" ${a}: ${e?.message??`invalid field "${i}"`}`)}}function l1(e){return!!(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("ui/")))}function l9(e){return e.endsWith(".tsx")}let l2=new class{add(e,t){this.resources.set(e,t)}getAll(){return this.resources}clear(){this.resources.clear()}has(e){return this.resources.has(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"resources",new Map)}};function l4(e){let t={};return!function e(r,a=""){if(r&&"object"==typeof r)for(let[i,s]of Object.entries(r)){let r=a?`${a}/${i}`:i;!s||"object"!=typeof s||Array.isArray(s)||s instanceof Date||s instanceof RegExp?t[r]=s:e(s,r)}}(e),t}let l6=["ui/resourceUri","resourceUri","visibility"],l8=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function l5(e){return"object"==typeof e&&null!==e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&"object"==typeof t&&null!==t&&"parse"in t&&"function"==typeof t.parse)}function l3(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function l7(e){let t=e.split("/").filter(e=>""!==e),r=t.findIndex(e=>e.match(/^\(.+\)$/));if(-1===r)return null;let a=t[t.length-1];if(a&&a.match(/^\[.+\]\.ts$/))return null;let i=t[r].slice(1,-1),s=t.slice(r+1),n=s[s.length-1];if(n&&n.includes(".")){let e=n.split(".")[0];"index"!==e?s[s.length-1]=e:s.pop()}let o=[],l=[],u=s.map(e=>{if(!e.match(/^\[.+\]$/))return l.push(e),e;{let t=e.slice(1,-1);return o.push(t),`{${t}}`}}),d=`${i}://${u.join("/")}`,c=o.length>0?"template":"direct";return{filePath:e,uriTemplate:d,scheme:i,parameters:o,pathSegments:l,type:c}}function ue(e){let t=e.replace(/\\/g,"/");if(!t)throw Error("Invalid tool path: path is empty");let r=t.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:t,baseName:r}}function ut(e){return Error(`[xmcp] Invalid prompt file: ${e}
|
|
73
|
-
-> Default export must be a prompt handler function.`)}async function
|
|
74
|
-
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function
|
|
75
|
-
-> Default export must be a resource handler function.`)}async function
|
|
76
|
-
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function
|
|
77
|
-
-> Default export must be a tool handler function.`)}async function
|
|
78
|
-
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),
|
|
72
|
+
]`;continue}i+=a[e],"\\"===a[e]?n=!0:o&&"]"===a[e]?o=!1:o||"["!==a[e]||(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function pq(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===k.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:pM(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??ph(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:pM(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===k.ZodString&&e.keyType._def.checks?.length){let{type:a,...i}=pT(e.keyType._def,t);return{...r,propertyNames:i}}if(e.keyType?._def.typeName===k.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===k.ZodBranded&&e.keyType._def.type._def.typeName===k.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...i}=py(e.keyType._def,t);return{...r,propertyNames:i}}return r}let pz={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},pA=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>pM(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function pM(e,t,r=!1){let a=t.seen.get(e);if(t.override){let i=t.override?.(e,t,a,r);if(i!==da)return i}if(a&&!r){let e=pL(a,t);if(void 0!==e)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let n=((e,t,r)=>{switch(t){case k.ZodString:return pT(e,r);case k.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",pf(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?pg(a,"minimum",t.value,t.message,r):pg(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),pg(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?pg(a,"maximum",t.value,t.message,r):pg(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),pg(a,"maximum",t.value,t.message,r));break;case"multipleOf":pg(a,"multipleOf",t.value,t.message,r)}return a;case k.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},i=[],n=e.shape();for(let e in n){let o=n[e];if(void 0===o||void 0===o._def)continue;let s=function(e){try{return e.isOptional()}catch{return!0}}(o);s&&r&&("ZodOptional"===o._def.typeName&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let l=pM(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,s||i.push(e))}i.length&&(a.required=i);let o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return pM(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(a.additionalProperties=o),a}(e,r);case k.ZodBigInt:let i={type:"integer",format:"int64"};if(!e.checks)return i;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?pg(i,"minimum",t.value,t.message,r):pg(i,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(i.exclusiveMinimum=!0),pg(i,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?pg(i,"maximum",t.value,t.message,r):pg(i,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(i.exclusiveMaximum=!0),pg(i,"maximum",t.value,t.message,r));break;case"multipleOf":pg(i,"multipleOf",t.value,t.message,r)}return i;case k.ZodBoolean:return{type:"boolean"};case k.ZodDate:return function e(t,r,a){let i=a??r.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((a,i)=>e(t,r,a))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var n=t,o=r;let s={type:"integer",format:"unix-time"};if("openApi3"===o.target)return s;for(let e of n.checks)switch(e.kind){case"min":pg(s,"minimum",e.value,e.message,o);break;case"max":pg(s,"maximum",e.value,e.message,o)}return s}}(e,r);case k.ZodUndefined:return{not:ph(r)};case k.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case k.ZodArray:let n;return n={type:"array"},e.type?._def&&e.type?._def?.typeName!==k.ZodAny&&(n.items=pM(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&pg(n,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&pg(n,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(pg(n,"minItems",e.exactLength.value,e.exactLength.message,r),pg(n,"maxItems",e.exactLength.value,e.exactLength.message,r)),n;case k.ZodUnion:case k.ZodDiscriminatedUnion:if("openApi3"===r.target)return pA(e,r);let o=e.options instanceof Map?Array.from(e.options.values()):e.options;if(o.every(e=>e._def.typeName in pz&&(!e._def.checks||!e._def.checks.length))){let e=o.reduce((e,t)=>{let r=pz[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(o.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=o.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===o.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:o.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(o.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:o.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return pA(e,r);case k.ZodIntersection:let s,l,c;return s=[pM(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),pM(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),l="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,c=[],s.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)c.push(...e.allOf),void 0===e.unevaluatedProperties&&(l=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else l=void 0;c.push(t)}}),c.length?{allOf:c,...l}:void 0;case k.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>pM(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:pM(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>pM(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case k.ZodRecord:return pq(e,r);case k.ZodLiteral:let u;return"bigint"!=(u=typeof e.value)&&"number"!==u&&"boolean"!==u&&"string"!==u?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===u?"integer":u,enum:[e.value]}:{type:"bigint"===u?"integer":u,const:e.value};case k.ZodEnum:return{type:"string",enum:Array.from(e.values)};case k.ZodNativeEnum:let d,p,m;return d=e.values,{type:1===(m=Array.from(new Set((p=Object.keys(e.values).filter(e=>"number"!=typeof d[d[e]]).map(e=>d[e])).map(e=>typeof e)))).length?"string"===m[0]?"string":"number":["string","number"],enum:p};case k.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===r.target?{type:pz[e.innerType._def.typeName],nullable:!0}:{type:[pz[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=pM(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let h=pM(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]};case k.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return pM(e.innerType._def,r);let f=pM(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return f?{anyOf:[{not:ph(r)},f]}:ph(r);case k.ZodMap:if("record"===r.mapStrategy)return pq(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[pM(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||ph(r),pM(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||ph(r)],minItems:2,maxItems:2}};case k.ZodSet:let g;return g={type:"array",uniqueItems:!0,items:pM(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&pg(g,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&pg(g,"maxItems",e.maxSize.value,e.maxSize.message,r),g;case k.ZodLazy:return()=>e.getter()._def;case k.ZodPromise:return pM(e.type._def,r);case k.ZodNaN:case k.ZodNever:return"openAi"===r.target?void 0:{not:ph({...r,currentPath:[...r.currentPath,"not"]})};case k.ZodEffects:return"input"===r.effectStrategy?pM(e.schema._def,r):ph(r);case k.ZodAny:case k.ZodUnknown:return ph(r);case k.ZodDefault:return{...pM(e.innerType._def,r),default:e.defaultValue()};case k.ZodBranded:return py(e,r);case k.ZodReadonly:case k.ZodCatch:return pM(e.innerType._def,r);case k.ZodPipeline:if("input"===r.pipeStrategy)return pM(e.in._def,r);if("output"===r.pipeStrategy)return pM(e.out._def,r);let y=pM(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=pM(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",y?"1":"0"]});return{allOf:[y,v].filter(e=>void 0!==e)};case k.ZodFunction:case k.ZodVoid:case k.ZodSymbol:default:return}})(e,e.typeName,t),o="function"==typeof n?pM(n(),t):n;if(o&&pZ(e,t,o),t.postProcess){let r=t.postProcess(o,e,t);return i.jsonSchema=o,r}return i.jsonSchema=o,o}let pL=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:pm(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),ph(t);return"seen"===t.$refStrategy?ph(t):void 0}},pZ=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function pD(e,t={}){let{strict:r=!1}=t,a=Object.entries(e),i=e=>({target:t})=>{let i={},n=[];for(let[r,o]of a)i[r]=function(e,t,r){let a=e["~standard"];if(a.jsonSchema)return a.jsonSchema[r]({target:t});if("zod"===e["~standard"].vendor&&!("_zod"in e)&&"_def"in e){let r=((e,t)=>{let r,a,i=(a=void 0!==(r="string"==typeof t?{...di,name:t}:{...di,...t}).name?[...r.basePath,r.definitionPath,r.name]:r.basePath,{...r,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(r.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...r.basePath,r.definitionPath,e],jsonSchema:void 0}]))}),n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:pM(r._def,{...i,currentPath:[...i.basePath,i.definitionPath,t]},!0)??ph(i)}),{}):void 0,o="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,s=pM(e._def,void 0===o?i:{...i,currentPath:[...i.basePath,i.definitionPath,o]},!1)??ph(i),l="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==l&&(s.title=l),i.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[i.openAiAnyTypeName]||(n[i.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===i.$refStrategy?"1":[...i.basePath,i.definitionPath,i.openAiAnyTypeName].join("/")}}));let c=void 0===o?n?{...s,[i.definitionPath]:n}:s:{$ref:[..."relative"===i.$refStrategy?[]:i.basePath,i.definitionPath,o].join("/"),[i.definitionPath]:{...n,[o]:s}};return"jsonSchema7"===i.target?c.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===i.target||"openAi"===i.target)&&(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===i.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c})(e,{$refStrategy:"none",target:"openapi-3.0"===t?"openApi3":"jsonSchema7"});return delete r.$schema,r}if("zod"===a.vendor&&"_zod"in e)try{let t=rQ(e);return delete t.$schema,t}catch(e){throw Error(`Failed to convert a zod schema to JSON Schema (zod v4 without "~standard.jsonSchema"). Upgrade to zod >= 4.2.0. Original error: ${e instanceof Error?e.message:String(e)}`)}throw Error(`Schema library "${a.vendor}" cannot be converted to JSON Schema. Use zod v3 (>= 3.25.76), zod >= 4.2.0, or a Standard Schema library implementing "~standard.jsonSchema".`)}(o,t,e),!function(e,t){if("function"!=typeof e.safeParse)return!1;try{let r=e.safeParse(void 0);return r.success&&("input"===t||void 0===r.data)}catch{return!1}}(o,e)&&n.push(r);let o={type:"object",properties:i};return n.length>0&&(o.required=n),r&&(o.additionalProperties=!1),o},n=async t=>{if("object"!=typeof t||null===t||Array.isArray(t))return{issues:[{message:"Expected an object."}]};let i={},n=[];for(let[e,r]of a){let a=await r["~standard"].validate(t[e]);if(a.issues)for(let t of a.issues)n.push({message:t.message,path:[e,...t.path??[]]});else(e in t||void 0!==a.value)&&(i[e]=a.value)}if(r)for(let r of Object.keys(t))r in e||n.push({message:`Unrecognized key: "${r}"`,path:[r]});return n.length>0?{issues:n}:{value:i}};return{shape:e,"~standard":{version:1,vendor:"xmcp",validate:n,jsonSchema:{input:i("input"),output:i("output")}}}}let pV=require("async_hooks"),pU=(e,t)=>{globalThis[e]=t},pF=e=>globalThis[e];function pH({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if(pF(t))return pF(t);let a=new pV.AsyncLocalStorage,i=globalThis[r]??{current:null};pU(r,i);let n={provider:(e,t)=>(i.current=e,a.run(e,t)),getContext:()=>{let t=a.getStore();if(t)return t;if(i.current)return i.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:t=>{let r=a.getStore()??i.current;if(!r)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(r,t)}};return pU(t,n),n}let pJ=pH({name:"http-request-context"});pJ.setContext;let pK=pJ.getContext;pJ.provider;let pB=pH({name:"client-info-context"}),pG=pB.setContext,pW=pB.getContext,pY=pB.provider,pX=e=>{if(!("object"==typeof e&&null!==e&&!Array.isArray(e))||"string"!=typeof e.name||"string"!=typeof e.version)return;let t={name:e.name,version:e.version};return"string"==typeof e.title&&(t.title=e.title),"string"==typeof e.websiteUrl&&(t.websiteUrl=e.websiteUrl),"string"==typeof e.description&&(t.description=e.description),t},pQ=(e,t)=>{let r=t.toLowerCase();for(let[t,a]of Object.entries(e)){if(t.toLowerCase()!==r)continue;let e=Array.isArray(a)?a[0]:a;if("string"!=typeof e)break;let i=e.trim();return i.length>0?i:void 0}},p0=new Set(["message","mode","requestedSchema"]),p1=new Set(["elicitationId","message","mode","url"]),p2=new Set(["properties","required","type"]),p9=new Set(["default","description","format","maxLength","minLength","title","type"]),p4=new Set(["default","description","enum","enumNames","title","type"]),p6=new Set(["default","description","title","type"]),p5=new Set(["default","description","maximum","minimum","title","type"]),p3=new Set(["date","date-time","email","uri"]);async function p8(e,t,r){let a=function(e){let t=e.mode??"form";if("url"===t)return function(e){let t;me(e,"Elicitation request must be a plain object."),p7(e,p1,"URL elicitation"),mt(e.message,"URL elicitation requires a string message."),mr(e.elicitationId,"URL elicitation requires a non-empty elicitationId."),mr(e.url,"URL elicitation requires a non-empty URL.");try{t=new URL(e.url)}catch{throw Error("URL elicitation requires a valid http or https URL.")}if("http:"!==t.protocol&&"https:"!==t.protocol)throw Error("URL elicitation requires a valid http or https URL.")}(e),e;if("form"!==t)throw Error(`Unsupported elicitation mode "${String(e.mode)}". Expected "form" or "url".`);return function(e){me(e,"Elicitation request must be a plain object."),p7(e,p0,"Form elicitation"),mt(e.message,"Form elicitation requires a string message.");let t=e.requestedSchema;if(me(t,"Form elicitation requires a flat object schema."),p7(t,p2,"Form elicitation schema"),"object"!==t.type)throw Error('Form elicitation schema must use type "object".');for(let[e,r]of(me(t.properties,"Form elicitation schema requires a properties object."),Object.entries(t.properties)))!function(e,t){if(me(t,`Form elicitation field "${e}" must be a plain object.`),ma(t.title,`Form elicitation field "${e}" title must be a string.`),ma(t.description,`Form elicitation field "${e}" description must be a string.`),"string"===t.type&&"enum"in t){var r,a;if(p7(t,p4,`Form elicitation field "${e}"`),mn(t.enum,`Form elicitation field "${e}" enum values must be strings.`),r=t.enumNames,a=`Form elicitation field "${e}" enumNames must be strings.`,void 0!==r&&mn(r,a),void 0!==t.enumNames&&t.enumNames.length!==t.enum.length)throw Error(`Form elicitation field "${e}" enumNames length must match enum length.`);if(ma(t.default,`Form elicitation field "${e}" default must be a string.`),void 0!==t.default&&!t.enum.includes(t.default))throw Error(`Form elicitation field "${e}" default must be one of its enum values.`);return}if("string"===t.type&&!("enum"in t)){p7(t,p9,`Form elicitation field "${e}"`),mi(t.minLength,`Form elicitation field "${e}" minLength must be a number.`),mi(t.maxLength,`Form elicitation field "${e}" maxLength must be a number.`),ma(t.default,`Form elicitation field "${e}" default must be a string.`);let r=t.format;if(ma(r,`Form elicitation field "${e}" format must be a string.`),void 0!==r&&!p3.has(r))throw Error(`Form elicitation field "${e}" format must be one of: ${Array.from(p3).join(", ")}.`);return}if("boolean"===t.type){if(p7(t,p6,`Form elicitation field "${e}"`),void 0!==t.default&&"boolean"!=typeof t.default)throw Error(`Form elicitation field "${e}" default must be a boolean.`);return}if("number"===t.type||"integer"===t.type){p7(t,p5,`Form elicitation field "${e}"`),mi(t.minimum,`Form elicitation field "${e}" minimum must be a number.`),mi(t.maximum,`Form elicitation field "${e}" maximum must be a number.`),mi(t.default,`Form elicitation field "${e}" default must be a number.`);return}throw Error(`Form elicitation field "${e}" uses unsupported type "${String(t.type)}". Supported types are string, boolean, number, integer, and string enums.`)}(e,r);if(void 0!==t.required){if(!Array.isArray(t.required)||t.required.some(e=>"string"!=typeof e))throw Error("Form elicitation schema required fields must be a string array.");for(let e of t.required)if(!(e in t.properties))throw Error(`Form elicitation schema required field "${e}" is not defined in properties.`)}}(e),{...e,mode:"form"}}(t);try{let t=await e.mcpReq.elicitInput(a,r);return{...t,content:t.content??void 0}}catch(e){if(e instanceof sS&&e.code===sb.MethodNotSupportedByProtocolVersion)throw Error("extra.elicit() is not available on protocol revision 2026-07-28: server-initiated elicitation was replaced by multi round-trip requests. Return inputRequired({ ... }) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}}function p7(e,t,r){let a=Object.keys(e).filter(e=>!t.has(e));if(0!==a.length)throw Error(`${r} includes unsupported key(s): ${a.join(", ")}.`)}function me(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}function mt(e,t){if("string"!=typeof e)throw Error(t)}function mr(e,t){if("string"!=typeof e||0===e.trim().length)throw Error(t)}function ma(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(t)}function mi(e,t){if(void 0!==e&&"number"!=typeof e)throw Error(t)}function mn(e,t){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e))throw Error(t)}let mo=new Set(["_meta","includeContext","maxTokens","messages","metadata","modelPreferences","stopSequences","systemPrompt","temperature"]),ms=new Set(["task","toolChoice","tools"]),ml=new Set(["text","image","audio"]);async function mc(e,t,r){let a=function(e){mu(e,"Sampling request must be a plain object.");let t=Object.keys(e),r=t.filter(e=>ms.has(e));if(r.length>0)throw Error(`Sampling request key(s) not supported by xmcp yet: ${r.join(", ")}.`);let a=t.filter(e=>!mo.has(e));if(a.length>0)throw Error(`Sampling request includes unsupported key(s): ${a.join(", ")}.`);if(!Array.isArray(e.messages)||0===e.messages.length)throw Error("Sampling requires at least one message.");for(let[t,r]of e.messages.entries())!function(e,t){if(mu(t,`Sampling message at index ${e} must be a plain object.`),"user"!==t.role&&"assistant"!==t.role)throw Error(`Sampling message at index ${e} requires role "user" or "assistant".`);let r=t.content;mu(r,`Sampling message at index ${e} requires a content object.`);let a=r.type;if("string"!=typeof a||!ml.has(a))throw Error(`Sampling message at index ${e} uses unsupported content type "${String(a)}". Supported types are text, image, and audio.`);if("text"===a&&"string"!=typeof r.text)throw Error(`Sampling message at index ${e} requires string text content.`);if(("image"===a||"audio"===a)&&("string"!=typeof r.data||"string"!=typeof r.mimeType))throw Error(`Sampling message at index ${e} requires base64 data and a mimeType.`)}(t,r);if("number"!=typeof e.maxTokens)throw Error("Sampling requires a numeric maxTokens.");return e}(t);try{return await e.mcpReq.requestSampling(a,r)}catch(e){if(e instanceof sS&&e.code===sb.MethodNotSupportedByProtocolVersion)throw Error("extra.sample() is not available on protocol revision 2026-07-28: server-initiated sampling was replaced by multi round-trip requests. Return inputRequired({ ... }) with inputRequired.createMessage(...) from the tool handler instead (re-exported from xmcp); the client fulfils the embedded requests and retries the tool call.");throw e}}function mu(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}let md={text:e=>"string"!=typeof e.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:e=>"string"!=typeof e.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:e=>"string"!=typeof e.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:e=>"string"!=typeof e.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof e.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==e.title&&"string"!=typeof e.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==e.description&&"string"!=typeof e.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==e.mimeType&&"string"!=typeof e.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function mp(e){if(!e||"object"!=typeof e)return{valid:!1,error:"Content must be an object"};if("string"!=typeof e.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==e._meta&&(null===e._meta||"object"!=typeof e._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let t=md[e.type];return t?t(e):{valid:!0}}function mm(e,t,r,a){if(null===e||"object"!=typeof e||Array.isArray(e))throw Error(`Tool "${r}" ${a}: expected a plain object.`);let i=new Set(Object.keys(t)),n=Object.keys(e).filter(e=>!i.has(e));if(n.length>0)throw Error(`Tool "${r}" ${a}: unrecognized key(s): ${n.join(", ")}`);for(let[i,n]of Object.entries(t))try{n.parse(e[i])}catch(e){throw Error(`Tool "${r}" ${a}: ${e?.message??`invalid field "${i}"`}`)}}function mh(e){return!!(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("ui/")))}function mf(e){return e.endsWith(".tsx")}let mg=new class{add(e,t){this.resources.set(e,t)}getAll(){return this.resources}clear(){this.resources.clear()}has(e){return this.resources.has(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"resources",new Map)}};function my(e){let t={};return!function e(r,a=""){if(r&&"object"==typeof r)for(let[i,n]of Object.entries(r)){let r=a?`${a}/${i}`:i;!n||"object"!=typeof n||Array.isArray(n)||n instanceof Date||n instanceof RegExp?t[r]=n:e(n,r)}}(e),t}let mv=["ui/resourceUri","resourceUri","visibility"],m_=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function mb(e){return"object"==typeof e&&null!==e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&"object"==typeof t&&null!==t&&"parse"in t&&"function"==typeof t.parse)}function mS(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function m$(e){let t=e.split("/").filter(e=>""!==e),r=t.findIndex(e=>e.match(/^\(.+\)$/));if(-1===r)return null;let a=t[t.length-1];if(a&&a.match(/^\[.+\]\.ts$/))return null;let i=t[r].slice(1,-1),n=t.slice(r+1),o=n[n.length-1];if(o&&o.includes(".")){let e=o.split(".")[0];"index"!==e?n[n.length-1]=e:n.pop()}let s=[],l=[],c=n.map(e=>{if(!e.match(/^\[.+\]$/))return l.push(e),e;{let t=e.slice(1,-1);return s.push(t),`{${t}}`}}),u=`${i}://${c.join("/")}`,d=s.length>0?"template":"direct";return{filePath:e,uriTemplate:u,scheme:i,parameters:s,pathSegments:l,type:d}}function mw(e){let t=e.replace(/\\/g,"/");if(!t)throw Error("Invalid tool path: path is empty");let r=t.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:t,baseName:r}}function mk(e){return Error(`[xmcp] Invalid prompt file: ${e}
|
|
73
|
+
-> Default export must be a prompt handler function.`)}async function mR(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw mk(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw mk(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default prompt handler."}}:{skipped:!1,path:e,promptModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.promptModule)}return{promptModules:t,skippedPrompts:r}}let mx=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load prompt file: ${t}
|
|
74
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function mP(e){return Error(`[xmcp] Invalid resource file: ${e}
|
|
75
|
+
-> Default export must be a resource handler function.`)}async function mE(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw mP(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw mP(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default resource handler."}}:{skipped:!1,path:e,resourceModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.resourceModule)}return{resourceModules:t,skippedResources:r}}let mT=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load resource file: ${t}
|
|
76
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function mj(e){return Error(`[xmcp] Invalid tool file: ${e}
|
|
77
|
+
-> Default export must be a tool handler function.`)}async function mO(e){let t=new Map,r=[];for(let a of(await Promise.all(Object.entries(e).map(async([e,t])=>{let r=await t(),a=function(e,t){if("object"!=typeof e||null===e)throw mj(t);let r=Object.keys(e),a=e.default,i=r.filter(e=>"__esModule"!==e);if(0===r.length||1===i.length&&"default"===i[0]&&"object"==typeof a&&null!==a&&0===Object.keys(a).length)return"empty";if(!("default"in e)||void 0===e.default)return"missing-default";if("function"!=typeof e.default)throw mj(t);return"valid"}(r,e);return"empty"===a?{skipped:!0,issue:{path:e,message:"File is empty."}}:"missing-default"===a?{skipped:!0,issue:{path:e,message:"File does not export a default tool handler."}}:{skipped:!1,path:e,toolModule:r}})))){if(a.skipped){r.push(a.issue);continue}t.set(a.path,a.toolModule)}return{toolModules:t,skippedTools:r}}let mC=function(e=console){let t="";return r=>{let a=r.map(({path:e,message:t})=>`${e}:${t}`).sort().join("|");if(a===t||(t=a,0===r.length))return;r.forEach(({path:t,message:r})=>{e.warn(`[xmcp] Failed to load tool file: ${t}
|
|
78
|
+
-> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),mN=INJECTED_TOOLS,mI=INJECTED_PROMPTS,mq=INJECTED_RESOURCES,mz=SERVER_INFO;async function mA(e,t,a,i){return mg.clear(),t.forEach((t,r)=>{var a;let i,n,o={name:mS(r),description:"No description provided"},{default:s,metadata:l,schema:c,outputSchema:u}=t;if("object"==typeof l&&null!==l&&Object.assign(o,l),"function"==typeof s&&"__x402"in s){let e=global.__XMCP_X402_REGISTRY;e&&e.set(o.name,s.__x402)}let d={};if(mb(c)?d=c:null!=c&&console.warn(`Invalid schema for tool "${o.name}" at ${r}. Expected Record<string, z.ZodType>`),null!=u)if(mb(u))i=u;else throw Error(`Invalid outputSchema for tool "${o.name}" at ${r}. Expected Record<string, z.ZodType>`);o.annotations={...o.annotations??{}},void 0===o.annotations.title&&(o.annotations.title=o.name),void 0===o._meta&&(o._meta={});let p=mf(r),m=!!(a=o._meta)&&"object"==typeof a&&"ui"in a&&"object"==typeof a.ui||p,h=o._meta;if(m){let e=`ui://app/${o.name}.html`;o._meta.ui||(o._meta.ui={}),o._meta.ui.resourceUri||(o._meta.ui.resourceUri=e);let t=function(e){let t={},r={};if(e.ui&&"object"==typeof e.ui){let a=e.ui,i={},n={};for(let[e,t]of Object.entries(a))mv.includes(e)?i[e]=t:m_.includes(e)?n[e]=t:i[e]=t;Object.keys(i).length>0&&(t.ui=i),Object.keys(n).length>0&&(r.ui=n)}for(let[r,a]of Object.entries(e))"ui"!==r&&(t[r]=a);return{toolMeta:t,resourceMeta:r}}(h);h=t.toolMeta;let a=t.resourceMeta;a.ui=a.ui||{},a.ui.csp=a.ui.csp||{},a.ui.csp.resourceDomains=a.ui.csp.resourceDomains||[],a.ui.csp.resourceDomains.includes("https://esm.sh")||a.ui.csp.resourceDomains.push("https://esm.sh"),mg.add(o.name,{name:o.name,uri:e,handler:s,mimeType:"text/html;profile=mcp-app",_meta:a,toolPath:p?r:void 0})}let f=my(h),g=m?f:void 0;n=mf(r)&&m?async(e,t)=>({content:[{type:"text",text:""}],_meta:g,structuredContent:{args:e}}):function(e,t,r,a="unknown-tool"){return async(i,n)=>{let o=e(i,function(e){let t=e.mcpReq.envelope,r=pX(t?.[ik]);if(!r)try{let e,t=pK();r=t.clientInfo??(e=t.headers,pX({name:pQ(e,"x-mcp-client-name"),version:pQ(e,"x-mcp-client-version"),title:pQ(e,"x-mcp-client-title"),websiteUrl:pQ(e,"x-mcp-client-website-url"),description:pQ(e,"x-mcp-client-description")}))}catch{}if(!r)try{r=pW().clientInfo}catch{}let a=function(e){if(!e)return;let t={};return e.headers.forEach((e,r)=>{t[r]=e}),t}(e.http?.req);return{signal:e.mcpReq.signal,authInfo:e.http?.authInfo,sessionId:e.sessionId,_meta:e.mcpReq._meta,requestId:e.mcpReq.id,requestInfo:a?{headers:a}:void 0,clientInfo:r,sendNotification:t=>e.mcpReq.notify(t),sendRequest:(t,r,a)=>e.mcpReq.send(t,r,a),elicit:(t,r)=>p8(e,t,r),sample:(t,r)=>mc(e,t,r),inputResponses:e.mcpReq.inputResponses,requestState:e.mcpReq.requestState}}(n));if(o instanceof Promise&&(o=await o),l$(o))return o;if("string"==typeof o||"number"==typeof o){if(r){let e=Object.entries(r);if(1===e.length){let[t,r]=e[0];try{return r.parse(o),{content:[{type:"text",text:"number"==typeof o?`${o}`:o}],structuredContent:{[t]:o}}}catch{}}}return mh(t)?{content:[{type:"text",text:""}],structuredContent:{args:i},_meta:t}:{content:[{type:"text",text:"number"==typeof o?`${o}`:o}]}}if(!r||!o||"object"!=typeof o||Array.isArray(o)||"structuredContent"in o||"content"in o&&Array.isArray(o.content)||"_meta"in o||"isError"in o||(mm(o,r,a,"returned data that does not match outputSchema"),o={structuredContent:o}),o&&"object"==typeof o&&"_meta"in o&&!("content"in o)&&!("structuredContent"in o)){let e=o._meta;if(mh(e))return{content:[{type:"text",text:""}],_meta:e}}if(!o||"object"!=typeof o){let e=null===o?"null":typeof o,t=void 0===o?"undefined":null===o?"null":"object"==typeof o?JSON.stringify(o,null,2):String(o);throw Error(`Tool handler must return a CallToolResult, string, or number. Got ${e}: ${t}
|
|
79
79
|
|
|
80
80
|
Expected CallToolResult format:
|
|
81
81
|
{
|
|
@@ -104,7 +104,7 @@ Or for widget metadata only:
|
|
|
104
104
|
_meta: {
|
|
105
105
|
"ui/...": ...
|
|
106
106
|
}
|
|
107
|
-
}`)}let
|
|
107
|
+
}`)}let s="content"in o&&Array.isArray(o.content),l="structuredContent"in o,c="isError"in o&&!0===o.isError;if(!s&&!l&&!c){let e=JSON.stringify(o,null,2);throw Error(`Tool handler must return at least 'content' or 'structuredContent'. Got: ${e}
|
|
108
108
|
|
|
109
109
|
Expected CallToolResult format:
|
|
110
110
|
{
|
|
@@ -125,7 +125,7 @@ Or both for backwards compatibility:
|
|
|
125
125
|
{
|
|
126
126
|
content: [{ type: "text", text: "fallback" }],
|
|
127
127
|
structuredContent: { your: "data" }
|
|
128
|
-
}`)}if(
|
|
128
|
+
}`)}if(c&&!s&&!l){let{isError:e,...t}=o,r=Object.keys(t).length>0?`Tool execution failed: ${JSON.stringify(t)}`:"Tool execution failed";o.content=[{type:"text",text:r}],s=!0}if(r&&l&&!c&&mm(o.structuredContent,r,a,"returned structuredContent that does not match outputSchema"),!s&&l&&(o.content=[{type:"text",text:JSON.stringify(o.structuredContent)}],s=!0),s)for(let e=0;e<o.content.length;e++){let t=o.content[e],r=mp(t);if(!r.valid)throw Error(`Invalid content item at index ${e}: ${r.error}
|
|
129
129
|
|
|
130
130
|
Content item: ${JSON.stringify(t,null,2)}
|
|
131
131
|
|
|
@@ -134,7 +134,7 @@ Expected content formats:
|
|
|
134
134
|
- Image: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
135
135
|
- Audio: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
136
136
|
- Resource: { type: "resource_link", name: "name", uri: "uri" }
|
|
137
|
-
All content types support an optional "_meta" object property`)}if(l){let e=
|
|
137
|
+
All content types support an optional "_meta" object property`)}if(l){let e=o.structuredContent;if(null===e||"object"!=typeof e||Array.isArray(e)){let t=Array.isArray(e)?"array":typeof e;throw Error(`'structuredContent' must be a plain object (not an array or primitive). Got ${t}: ${JSON.stringify(e,null,2)}
|
|
138
138
|
|
|
139
139
|
Expected format:
|
|
140
140
|
{
|
|
@@ -142,7 +142,7 @@ Expected format:
|
|
|
142
142
|
key: "value",
|
|
143
143
|
nested: { data: "here" }
|
|
144
144
|
}
|
|
145
|
-
}`)}}return
|
|
145
|
+
}`)}}return o}}(s,g,i,o.name);let y={title:o.annotations?.title,description:o.description,inputSchema:pD(d),outputSchema:i?pD(i,{strict:!0}):void 0,annotations:o.annotations,_meta:f};e.registerTool(o.name,y,n)}),a.forEach((t,r)=>{let a=mS(r),i={name:a,title:a,description:"No description provided"},n={},{default:o,metadata:s,schema:l}=t;"object"==typeof s&&null!==s&&Object.assign(i,s);let c=function(e,t="assistant"){return async(r,a)=>{let i,n=e(r,a);if(n instanceof Promise&&(n=await n),"string"==typeof n||"number"==typeof n)i={type:"text",text:"number"==typeof n?`${n}`:n};else{let e=mp(n);if(e.valid)i=n;else{let t=null===n?"null":typeof n,r=void 0===n?"undefined":null===n?"null":"object"==typeof n?JSON.stringify(n,null,2):String(n);throw Error(`Prompt handler must return a PromptContent object, string, or number. Got ${t}: ${r}
|
|
146
146
|
|
|
147
147
|
Validation error: ${e.error}
|
|
148
148
|
|
|
@@ -153,9 +153,9 @@ Expected formats:
|
|
|
153
153
|
- Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
|
|
154
154
|
- Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
|
|
155
155
|
- Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
|
|
156
|
-
- All content types support an optional "_meta" object property`)}}if("user"!==t&&"assistant"!==t)throw Error(`Invalid role: ${t}`);return{messages:[{role:t,content:i}]}}}(
|
|
156
|
+
- All content types support an optional "_meta" object property`)}}if("user"!==t&&"assistant"!==t)throw Error(`Invalid role: ${t}`);return{messages:[{role:t,content:i}]}}}(o,i.role||"assistant");mb(l)?Object.assign(n,l):null!=l&&console.warn(`Invalid schema for prompt "${i.name}" at ${r}. Expected Record<string, z.ZodType>`),e.registerPrompt(i.name,{title:i.title,description:i.description,argsSchema:pD(n)},c)}),[...mg.getAll()].forEach(([t,a])=>{let i=a.mimeType||"text/html;profile=mcp-app",n=a?._meta?my(a._meta):void 0,o={name:a.name,description:`Auto-generated resource for ${a.name} tool`,mimeType:a.mimeType,_meta:n},s=async(e,t)=>{if(a.mimeType&&a.toolPath)try{var n;let e,t,o=(n=a.toolPath,IS_CLOUDFLARE?function(e){let{normalizedPath:t,baseName:r}=mw(e),a=5381;for(let e=0;e<t.length;e++)a=Math.imul(a,33)+t.charCodeAt(e)>>>0;let i=a.toString(16).slice(0,6).padStart(6,"0");return`${r}_${i}`}(n):function(e){let{normalizedPath:t,baseName:a}=mw(e),i=r(6982).createHash("md5").update(t).digest("hex").slice(0,6);return`${a}_${i}`}(n)),s=function(e){if(INJECTED_CLIENT_BUNDLES)return INJECTED_CLIENT_BUNDLES[e]||null;if(!IS_CLOUDFLARE)try{let t=r(9896),a=r(6928);for(let r of[a.join(process.cwd(),"dist","client"),a.join(process.cwd(),"client")]){let i=a.join(r,`${e}.bundle.js`),n=a.join(r,`${e}.bundle.css`);if(t.existsSync(i)){let e,r=t.readFileSync(i,"utf-8");return t.existsSync(n)&&(e=t.readFileSync(n,"utf-8")),{js:r,css:e}}}}catch{}return null}(o);if(!s)throw Error(`React client bundle not found for "${a.name}" (bundle: "${o}").
|
|
157
157
|
React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
|
|
158
|
-
Please re-run the build so the framework can regenerate the bundle.`);let l=
|
|
158
|
+
Please re-run the build so the framework can regenerate the bundle.`);let l=s.js,c=s.css,u=(e=`
|
|
159
159
|
<script type="module">
|
|
160
160
|
const componentSource = ${JSON.stringify(l)};
|
|
161
161
|
const blobUrl = URL.createObjectURL(
|
|
@@ -197,7 +197,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let l=o.js
|
|
|
197
197
|
requestAnimationFrame(() => {
|
|
198
198
|
URL.revokeObjectURL(blobUrl);
|
|
199
199
|
});
|
|
200
|
-
</script>`,t=
|
|
200
|
+
</script>`,t=c?`<style>${c}</style>`:"",`<!DOCTYPE html>
|
|
201
201
|
<html>
|
|
202
202
|
<head>
|
|
203
203
|
<meta charset="utf-8">
|
|
@@ -208,7 +208,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let l=o.js
|
|
|
208
208
|
<div id="root"></div>
|
|
209
209
|
${e}
|
|
210
210
|
</body>
|
|
211
|
-
</html>`);return{contents:[{uri:a.uri,text:
|
|
211
|
+
</html>`);return{contents:[{uri:a.uri,text:u,mimeType:i,_meta:a._meta}]}}catch(e){throw console.error(`React failed for ${a.name}:`,e),e}let o=a.handler({},t);if(o instanceof Promise&&(o=await o),"string"==typeof o)return{contents:[{uri:a.uri,text:o,mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"_meta"in o&&!("content"in o))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(o&&"object"==typeof o&&"content"in o&&Array.isArray(o.content)){let e=o.content.find(e=>"text"===e.type);if(e&&"text"===e.type&&"string"==typeof e.text)return{contents:[{uri:a.uri,text:e.text,mimeType:i,_meta:a._meta}]}}return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]}};e.registerResource(a.name,a.uri,o,s)}),i.forEach((t,r)=>{let a={name:mS(r),description:"No description provided"},{default:i,metadata:n,schema:o}=t;"object"==typeof n&&null!==n&&Object.assign(a,n);let s={};mb(o)?s=o:null!=o&&console.warn(`Invalid schema for resource "${a.name}" at ${r}. Expected Record<string, z.ZodType>`);let l=m$(r);if(!l)return void console.warn(`Skipping resource "${a.name}" at ${r}: Invalid file path format`);let c=l.uriTemplate;a.mimeType&&a.mimeType.includes("html")&&(c=c.endsWith(".html")?c:`${c}.html`);let u=function(e,t,r={}){let a=m$(t);if(!a)throw Error(`Invalid resource file path: ${t}. Must follow (scheme)/path/[param] convention.`);return async(t,i)=>{let n=e(function(e,t,r){let a={},i={};if(0===t.parameters.length)return i;let n=t.uriTemplate.split("://")[1]||"",o=e.split("://")[1]||"",s=n.split("/"),l=o.split("/");for(let e=0;e<s.length&&e<l.length;e++){let t=s[e],r=l[e],i=t.match(/^\{(.+)\}$/);i&&(a[i[1]]=r)}for(let e of t.parameters){let t=a[e],n=r[e];if(void 0===t)throw Error(`Missing required parameter: ${e}`);if(!n){i[e]=t;continue}try{i[e]=n.parse(t)}catch(r){throw Error(`Invalid parameter "${e}": ${t}. Validation error: ${r instanceof Error?r.message:String(r)}`)}}return i}(t.href,a,r),i);if(n instanceof Promise&&(n=await n),"string"==typeof n)return{contents:[{uri:t.href,text:n}]};if(!n||"object"!=typeof n||!Array.isArray(n.contents)){let e=null===n?"null":typeof n,t=void 0===n?"undefined":null===n?"null":"object"==typeof n?JSON.stringify(n,null,2):String(n);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${e}: ${t}
|
|
212
212
|
|
|
213
213
|
Expected ReadResourceResult format:
|
|
214
214
|
{
|
|
@@ -217,4 +217,4 @@ Expected ReadResourceResult format:
|
|
|
217
217
|
{ uri: "resource://uri", mimeType: "application/json", text: "json content" },
|
|
218
218
|
{ uri: "resource://uri", blob: base64data }
|
|
219
219
|
]
|
|
220
|
-
}`)}return
|
|
220
|
+
}`)}return n.contents.forEach(e=>{e.uri||(e.uri=t.href)}),n}}(i,r,s);if("direct"===l.type)e.registerResource(a.name,c,a,u);else{let t=new u1(c,{list:void 0}),r=async(e,t,r)=>{let a={};for(let e of l.parameters){let r=t[e],i=s[e];if(void 0===r)throw Error(`Missing required parameter: ${e}. Available variables: ${Object.keys(t)}`);i?a[e]=i.parse(r):a[e]=r}let n=i(a,r);return n instanceof Promise&&(n=await n),"string"==typeof n?{contents:[{uri:e.href,text:n}]}:n};e.registerResource(a.name,t,a,r)}}),e}async function mM(){let{toolModules:e,skippedTools:t}=await mO(mN);return mC(t),e}async function mL(){let{promptModules:e,skippedPrompts:t}=await mR(mI);return mx(t),e}async function mZ(){let{resourceModules:e,skippedResources:t}=await mE(mq);return mT(t),e}async function mD(){let{instructions:e,...t}=mz,r=new u0(t,{instructions:e}),a=mM(),i=mL(),n=mZ(),[o,s,l]=await Promise.all([a,i,n]);return mA(r,o,s,l)}var mV=r(8583);r.n(mV)().config();let mU=STDIO_CONFIG.debug||!1;if(STDIO_CONFIG.silent){let e=new console.Console(process.stderr,process.stderr);for(let t of["log","debug","info","warn","error","dir","table","trace","assert","time","timeEnd","timeLog","count","countReset","group","groupEnd","groupCollapsed","clear"])console[t]=e[t].bind(e)}pY({clientInfo:void 0},()=>{let e;!function(e,t={}){let r,a=t.legacy??"serve",i=t.transport??new de,n={phase:"opening"},c=!1,u=()=>c||"closed"===n.phase,d=e=>{try{t.onerror?.(e)}catch{}},p=(e,t,r,a)=>i.send({jsonrpc:"2.0",id:e,error:{code:t,message:r,...void 0!==a&&{data:a}}}).catch(e=>d(dr(e))),m=new uB(t.maxSubscriptions??1024),h=e=>{if(!iJ.safeParse(e).success)return;let t=m.routeOutbound(e);if("passthrough"!==t){for(let e of t)i.send({jsonrpc:"2.0",...e}).catch(e=>d(dr(e)));return"handled"}},f=async e=>{if(lS(e)&&"subscriptions/listen"===e.method){let t,r=lg(e.params),a=ly(e.params)?(void 0===r?[]:l_(r))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},n=lv(e.params);if(void 0!==a)t={jsonrpc:"2.0",id:e.id,error:{code:-32602,message:`Invalid _meta envelope: ${a.key}: ${a.problem}`}};else if(void 0!==n&&sR.includes(n))t=m.serve(e);else{let r=new s9({supported:[...sR],requested:n??"unknown"});t={jsonrpc:"2.0",id:e.id,error:{code:r.code,message:r.message,data:r.data}}}return await i.send("error"in t?t:{jsonrpc:"2.0",method:t.method,params:t.params}).catch(e=>d(dr(e))),!0}if(iJ.safeParse(e).success&&"notifications/cancelled"===e.method){let t=e.params?.requestId;if(void 0!==t&&m.cancel(t))return!0}return!1},g=(e,t,r)=>{let a=function(e,t){switch(e.reason){case"http-method":return lT("http-method","modern-only-method-not-allowed",405,new s0(-32e3,"Method not allowed."),!0);case"batch":return lT("jsonrpc-shape","modern-only-batch-not-supported",400,new s0(sQ.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return lT("jsonrpc-shape","modern-only-response-post",400,new s0(sQ.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return lT("era-classification","modern-only-missing-envelope",400,void 0===r?new s0(sQ.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new s9({supported:[...t],requested:r}),!0)}}}({kind:"legacy",reason:t,...void 0!==r&&{requestedVersion:r}},sR);return void 0===a?Promise.resolve():(d(Error(`Rejected 2025-era request on a modern-only stdio connection (${a.cell}): ${a.message}`)),p(e.id,a.code,a.message,a.data))},y=async(t,a)=>{let n=await e({era:t}),u=n instanceof u0?n.server:n;"modern"===t&&(o(u,a),s(u,sR),m.setServerCapabilities(u.getCapabilities(),l(u)));let d=new dt(i,()=>{!c&&d!==r&&k()},"modern"===t?h:void 0);return await n.connect(d),{product:n,channel:d}},v=e=>e.product.close().catch(e=>d(dr(e))),_=async e=>{r=e.channel;try{await e.channel.whenRequestsAnswered(3e3)||d(Error("Discarded the probe instance with requests still unanswered after 3000ms; continuing with the fallback")),await e.product.close()}catch(e){d(dr(e))}finally{r=void 0}},b=async e=>{if("closed"===n.phase)return;if("pinned"===n.phase)return"modern"===n.era&&lS(e)&&"initialize"===e.method&&!lj(e.params)?void await g(e,"initialize",null!==e.params&&"object"==typeof e.params&&"string"==typeof e.params.protocolVersion?e.params.protocolVersion:void 0):void("modern"===n.era&&await f(e)||n.instance.channel.deliver(e));if(!lS(e)&&!iJ.safeParse(e).success)return void d(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));let t=function(e){let t=e.params;if("initialize"===e.method&&!lj(t)){let e=null!==t&&"object"==typeof t&&"string"==typeof t.protocolVersion?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...void 0!==e&&{requestedVersion:e}}}if(!ly(t))return{kind:"legacy",reason:"no-claim"};let r=lg(t),a=(void 0===r?[]:l_(r))[0];if(void 0!==a)return{kind:"invalid-envelope",issue:a};let i=lv(t);return void 0!==i&&sR.includes(i)?{kind:"modern",revision:i,classification:{era:"modern",revision:i}}:{kind:"unsupported-revision",requested:i??"unknown"}}(e);switch(t.kind){case"invalid-envelope":{let r=`Invalid _meta envelope for protocol revision 2026-07-28: ${t.issue.key}: ${t.issue.problem}`;lS(e)?await p(e.id,sQ.InvalidParams,r,{envelope:t.issue}):d(Error(`Discarded a notification with a malformed envelope: ${r}`));return}case"unsupported-revision":if(lS(e)){let r=new s9({supported:[...sR],requested:t.requested});d(r),await p(e.id,r.code,r.message,r.data)}else d(Error(`Discarded a notification claiming unsupported protocol revision ${t.requested}`));return;case"modern":if(lS(e)&&"server/discover"===e.method){if("probe"===n.phase)return void n.instance.channel.deliver(e,{classification:t.classification});let r=await y("modern",t.revision);if(u())return void await v(r);n={phase:"probe",instance:r},r.channel.deliver(e,{classification:t.classification});return}if("probe"===n.phase){if(iJ.safeParse(e).success)return void n.instance.channel.deliver(e,{classification:t.classification});n={phase:"pinned",era:"modern",instance:n.instance}}else{let e=await y("modern",t.revision);if(u())return void await v(e);n={phase:"pinned",era:"modern",instance:e}}if(await f(e))return;n.instance.channel.deliver(e,{classification:t.classification});return;case"legacy":{if("reject"===a){lS(e)&&await g(e,t.reason,t.requestedVersion);return}if("probe"===n.phase){if(await _(n.instance),u())return;n={phase:"opening"}}let r=await y("legacy");if(u())return void await v(r);(n={phase:"pinned",era:"legacy",instance:r}).instance.channel.deliver(e);return}}},S=[],$=!1,w=async()=>{if(!$){$=!0;try{for(;S.length>0;){let e=S.shift();try{await b(e)}catch(t){lS(e)&&await p(e.id,sQ.InternalError,"Internal server error"),d(dr(t))}}}finally{$=!1}}},k=async()=>{if(c||"closed"===n.phase)return;c=!0;let e=n;for(let e of(n={phase:"closed"},m.teardownAll()))await i.send(e).catch(e=>d(dr(e)));("probe"===e.phase||"pinned"===e.phase)&&await e.instance.product.close().catch(e=>d(dr(e))),await i.close().catch(e=>d(dr(e)))};i.onmessage=e=>{S.push(e),w()},i.onerror=e=>{d(e),("probe"===n.phase||"pinned"===n.phase)&&n.instance.channel.onerror?.(e)},i.onclose=()=>{if(c||"closed"===n.phase)return;c=!0;let e=n;n={phase:"closed"},("probe"===e.phase||"pinned"===e.phase)&&e.instance.product.close().catch(e=>d(dr(e)))},i.start().catch(e=>{throw d(dr(e)),e}).catch(()=>{})}(async()=>{let e=await mD();return e.server.oninitialized=()=>{let t=pX(e.server.getClientVersion());pG({clientInfo:t}),mU&&t&&console.log(`[STDIO] MCP client initialized: ${t.name}@${t.version}`)},e},{legacy:"serve",onerror:mU?e=>console.error("[STDIO] Error:",e):void 0}),mU&&console.log("[STDIO] MCP Server running with STDIO transport"),e=()=>{mU&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)},process.on("SIGINT",e),process.on("SIGTERM",e)})})(),{}})());
|