xmcp 0.6.11 → 0.6.13

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.
@@ -1,39 +1,81 @@
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($.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 $=/[^\\]\\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=I(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=I(this.rhs,e,t),this}get names(){return O(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=I(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)=>j(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 _(N(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=I(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&j(e,this.else.names),e}}_.kind="if";class b extends y{}b.kind="for";class $ 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=I(this.iteration,e,t),this}get names(){return j(super.names,this.iteration.names)}}class w 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=O(super.names,this.from);return O(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=I(this.iterable,e,t),this}get names(){return j(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&&j(e,this.catch.names),this.finally&&j(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 j(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function O(e,t){return t instanceof a._CodeOrName?j(e,t.names):e}function I(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 N(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 $(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 w(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=N;let z=C(t.operators.AND);t.and=function(...e){return e.reduce(z)};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
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
2
  || (${n} == "string" && ${i} && ${i} == +${i})`).assign(o,(0,l._)`+${i}`);return;case"integer":a.elseIf((0,l._)`${n} === "boolean" || ${i} === null
3
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 w(e,[],!1,t);let r=(0,i.getSchemaTypes)(e.schema),a=(0,i.coerceAndCheckDataType)(e,r);w(e,r,!a,t)}function $({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 w(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&&$(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",O(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&&$(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)*$/,j=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(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=j.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=O},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,j=null==(t=e.code)?void 0:t.optimize,O=!0===j||void 0===j?1:j||0,I=null!=(a=null==(r=e.code)?void 0:r.regExp)?a:m,N=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:O,regExp:I}:{optimize:O,regExp:I},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==($=e.inlineRefs)||$,schemaId:null!=(w=e.schemaId)?w:"$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:N}}(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)(),$.call(this,v,e,"NOT SUPPORTED"),$.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=w.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=w.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(j.call(this,r,t),!t)return(0,p.eachItem)(r,e=>O.call(this,e)),this;N.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=>O.call(this,e,a):e=>a.type.forEach(t=>O.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 $(e,t,r,a="error"){for(let i in e)i in t&&this.logger[a](`${r}: option ${i}. ${e[i]}`)}function w(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 j(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 O(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?I.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 I(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 N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}let z={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,z]}}},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(8041);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},
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(8041);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
5
  missingProperty: ${i},
6
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 $=o.resolveRef.call(_,b,m,f);if(void 0===$)throw new a.default(h.opts.uriResolver,m,f);return $ instanceof o.SchemaEnv?(i=u(e,t=$),void d(e,i,t,t.$async)):(r=$,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")},8041(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(1900),{SCHEMES:p,getSchemeHandler:f}=r(1441);function h(e,t,r,a){let s={};return a||(e=v(m(e,r),r),t=v(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;function g(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(y);if(l){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]);let t=void 0!==l[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 p=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!p||!p.unicodeSupport)&&i.host&&(r.domainHost||p&&p.domainHost)&&!1===n&&c(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}if((!p||p&&!p.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"}p&&p.parse&&p.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:s}}function v(e,t){return g(e,t).parsed}function _(e,t){let{parsed:r,malformedAuthorityOrPort:a}=g(e,t);return{normalized:a?e:m(r,t),malformedAuthorityOrPort:a}}function b(e,t){if("string"==typeof e){let{normalized:r,malformedAuthorityOrPort:a}=_(e,t);return a?void 0:r}if("object"==typeof e)return m(e,t)}let $={SCHEMES:p,normalize:function(e,t){return"string"==typeof e?e=_(e,t).normalized:"object"==typeof e&&(e=v(m(e,t),t)),e},resolve:function(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=h(v(e,a),v(t,a),a,!0);return a.skipEscape=!0,m(i,a)},resolveComponent:h,equal:function(e,t,r){let a=b(e,r),i=b(t,r);return void 0!==a&&void 0!==i&&a.toLowerCase()===i.toLowerCase()},serialize:m,parse:v};e.exports=$,e.exports.default=$,e.exports.fastUri=$},1441(e,t,r){"use strict";let{isUUID:a}=r(1900),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}},1900(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,s,n=require("node:process");function o(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}Object.freeze({status:"aborted"}),Symbol("zod_brand");class l extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class u extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}let d={};function c(e){return e&&Object.assign(d,e),d}function p(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 f(e,t="|"){return e.map(e=>I(e)).join(t)}function h(e,t){return"bigint"==typeof t?t.toString():t}function m(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function y(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let g=Symbol("evaluating");function v(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==g)return void 0===a&&(a=g,a=r()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function _(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function b(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function $(e){return JSON.stringify(e)}let w="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function k(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let x=m(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function S(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 E(e){return S(e)?{...e}:Array.isArray(e)?[...e]:e}let T=new Set(["string","number","symbol"]);function P(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function O(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}function I(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let N={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 z(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 R(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function C(e){return"string"==typeof e?e:e?.message}function A(e,t,r){let a={...e,path:e.path??[]};return e.message||(a.message=C(e.inst?._zod.def?.error?.(e))??C(t?.error?.(e))??C(r.customError?.(e))??C(r.localeError?.(e))??"Invalid input"),delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function M(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Z(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}let D=(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,h,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},q=o("$ZodError",D),F=o("$ZodError",D,{Parent:Error}),L=e=>(t,r,a,i)=>{let s=a?Object.assign(a,{async:!1}):{async:!1},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise)throw new l;if(n.issues.length){let t=new(i?.Err??e)(n.issues.map(e=>A(e,s,c())));throw w(t,i?.callee),t}return n.value},V=L(F),U=e=>async(t,r,a,i)=>{let s=a?Object.assign(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=>A(e,s,c())));throw w(t,i?.callee),t}return n.value},H=U(F),K=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 l;return s.issues.length?{success:!1,error:new(e??q)(s.issues.map(e=>A(e,i,c())))}:{success:!0,data:s.value}},J=K(F),B=e=>async(t,r,a)=>{let i=a?Object.assign(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=>A(e,i,c())))}:{success:!0,data:s.value}},G=B(F),W=/^[cC][^\s-]{8,}$/,Y=/^[0-9a-z]+$/,Q=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,X=/^[0-9a-vA-V]{20}$/,ee=/^[A-Za-z0-9]{27}$/,et=/^[a-zA-Z0-9_-]{21}$/,er=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ea=/^([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})$/,ei=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)$/,es=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,en=/^(?:(?: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])$/,eo=/^(([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}|:))$/,el=/^((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])$/,eu=/^(([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])$/,ed=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ec=/^[A-Za-z0-9_-]*$/,ep=/^\+(?:[0-9]){6,14}[0-9]$/,ef="(?:(?:\\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])))",eh=RegExp(`^${ef}$`);function em(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 ey=/^-?\d+$/,eg=/^-?\d+(?:\.\d+)?/,ev=/^(?:true|false)$/i,e_=/^null$/i,eb=/^[^A-Z]*$/,e$=/^[^a-z]*$/,ew=o("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ek={number:"number",bigint:"bigint",object:"date"},ex=o("$ZodCheckLessThan",(e,t)=>{ew.init(e,t);let r=ek[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:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eS=o("$ZodCheckGreaterThan",(e,t)=>{ew.init(e,t);let r=ek[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:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eE=o("$ZodCheckMultipleOf",(e,t)=>{ew.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{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===function(e,t){let r=(e.toString().split(".")[1]||"").length,a=t.toString(),i=(a.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(a)){let e=a.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let s=r>i?r:i;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eT=o("$ZodCheckNumberFormat",(e,t)=>{ew.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[i,s]=N[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=ey)}),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,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,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,inst:e})}}),eP=o("$ZodCheckMaxLength",(e,t)=>{var r;ew.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=M(a);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),ej=o("$ZodCheckMinLength",(e,t)=>{var r;ew.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=M(a);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eO=o("$ZodCheckLengthEquals",(e,t)=>{var r;ew.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=M(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})}}),eI=o("$ZodCheckStringFormat",(e,t)=>{var r,a;ew.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=()=>{})}),eN=o("$ZodCheckRegex",(e,t)=>{eI.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})}}),ez=o("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eb),eI.init(e,t)}),eR=o("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=e$),eI.init(e,t)}),eC=o("$ZodCheckIncludes",(e,t)=>{ew.init(e,t);let r=P(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})}}),eA=o("$ZodCheckStartsWith",(e,t)=>{ew.init(e,t);let r=RegExp(`^${P(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})}}),eM=o("$ZodCheckEndsWith",(e,t)=>{ew.init(e,t);let r=RegExp(`.*${P(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})}}),eZ=o("$ZodCheckOverwrite",(e,t)=>{ew.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class eD{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 eq={major:4,minor:1,patch:13},eF=o("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=eq;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=z(e);for(let s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,n=s._zod.check(e);if(n instanceof Promise&&r?.async===!1)throw new l;if(a||n instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await n,e.issues.length!==t&&(i||(i=z(e,t)))});else{if(e.issues.length===t)continue;i||(i=z(e,t))}}return a?a.then(()=>e):e},r=(r,i,s)=>{if(z(r))return r.aborted=!0,r;let n=t(i,a,s);if(n instanceof Promise){if(!1===s.async)throw new l;return n.then(t=>e._zod.parse(t,s))}return e._zod.parse(n,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 n=e._zod.parse(i,s);if(n instanceof Promise){if(!1===s.async)throw new l;return n.then(e=>t(e,a,s))}return t(n,a,s)}}e["~standard"]={validate:t=>{try{let r=J(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return G(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),eL=o("$ZodString",(e,t)=>{var r;let a;eF.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}}),eV=o("$ZodStringFormat",(e,t)=>{eI.init(e,t),eL.init(e,t)}),eU=o("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ea),eV.init(e,t)}),eH=o("$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=ei(e))}else t.pattern??(t.pattern=ei());eV.init(e,t)}),eK=o("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=es),eV.init(e,t)}),eJ=o("$ZodURL",(e,t)=>{eV.init(e,t),e._zod.check=r=>{try{let a=r.value.trim(),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})}}}),eB=o("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),eV.init(e,t)}),eG=o("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=et),eV.init(e,t)}),eW=o("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=W),eV.init(e,t)}),eY=o("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Y),eV.init(e,t)}),eQ=o("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Q),eV.init(e,t)}),eX=o("$ZodXID",(e,t)=>{t.pattern??(t.pattern=X),eV.init(e,t)}),e0=o("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ee),eV.init(e,t)}),e1=o("$ZodISODateTime",(e,t)=>{let r,a,i;t.pattern??(r=em({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(`^${ef}T(?:${i})$`)),eV.init(e,t)}),e9=o("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=eh),eV.init(e,t)}),e2=o("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${em(t)}$`)),eV.init(e,t)}),e4=o("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=er),eV.init(e,t)}),e6=o("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=en),eV.init(e,t),e._zod.bag.format="ipv4"}),e5=o("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=eo),eV.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})}}}),e8=o("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=el),eV.init(e,t)}),e3=o("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=eu),eV.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 e7(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let te=o("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ed),eV.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{e7(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),tt=o("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ec),eV.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!ec.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return e7(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})}}),tr=o("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ep),eV.init(e,t)}),ta=o("$ZodJWT",(e,t)=>{eV.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})}}),ti=o("$ZodNumber",(e,t)=>{eF.init(e,t),e._zod.pattern=e._zod.bag.pattern??eg,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}}),ts=o("$ZodNumberFormat",(e,t)=>{eT.init(e,t),ti.init(e,t)}),tn=o("$ZodBoolean",(e,t)=>{eF.init(e,t),e._zod.pattern=ev,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}}),to=o("$ZodNull",(e,t)=>{eF.init(e,t),e._zod.pattern=e_,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}}),tl=o("$ZodUnknown",(e,t)=>{eF.init(e,t),e._zod.parse=e=>e}),tu=o("$ZodNever",(e,t)=>{eF.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function td(e,t,r){e.issues.length&&t.issues.push(...R(r,e.issues)),t.value[r]=e.value}let tc=o("$ZodArray",(e,t)=>{eF.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=>td(t,r,e))):td(o,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function tp(e,t,r,a){e.issues.length&&t.issues.push(...R(r,e.issues)),void 0===e.value?r in a&&(t.value[r]=void 0):t.value[r]=e.value}function tf(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 th(e,t,r,a,i,s){let n=[],o=i.keySet,l=i.catchall._zod,u=l.def.type;for(let i in t){if(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=>tp(e,r,i,t))):tp(s,r,i,t)}return(n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:s}),e.length)?Promise.all(e).then(()=>r):r}let tm=o("$ZodObject",(e,t)=>{let r;eF.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=m(()=>tf(t));v(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]._zod.run({value:n[e],issues:[]},a);r instanceof Promise?o.push(r.then(r=>tp(r,t,e,n))):tp(r,t,e,n)}return s?th(o,n,t,a,i.value,e):o.length?Promise.all(o).then(()=>t):t}}),ty=o("$ZodObjectJIT",(e,t)=>{let r,a;tm.init(e,t);let i=e._zod.parse,s=m(()=>tf(t)),n=!d.jitless,o=n&&x.value,l=t.catchall;e._zod.parse=(u,d)=>{a??(a=s.value);let c=u.value;return k(c)?n&&o&&d?.async===!1&&!0!==d.jitless?(r||(r=(e=>{let t=new eD(["shape","payload","ctx"]),r=s.value,a=e=>{let t=$(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 e of(t.write("const newResult = {};"),r.keys)){let r=i[e],s=$(e);t.write(`const ${r} = ${a(e)};`),t.write(`
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")},8041(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(1900),{SCHEMES:p,getSchemeHandler:f}=r(1441);function h(e,t,r,a){let s={};return a||(e=v(m(e,r),r),t=v(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;function g(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(y);if(l){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]);let t=void 0!==l[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 p=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!p||!p.unicodeSupport)&&i.host&&(r.domainHost||p&&p.domainHost)&&!1===n&&c(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}if((!p||p&&!p.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"}p&&p.parse&&p.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:s}}function v(e,t){return g(e,t).parsed}function _(e,t){let{parsed:r,malformedAuthorityOrPort:a}=g(e,t);return{normalized:a?e:m(r,t),malformedAuthorityOrPort:a}}function b(e,t){if("string"==typeof e){let{normalized:r,malformedAuthorityOrPort:a}=_(e,t);return a?void 0:r}if("object"==typeof e)return m(e,t)}let w={SCHEMES:p,normalize:function(e,t){return"string"==typeof e?e=_(e,t).normalized:"object"==typeof e&&(e=v(m(e,t),t)),e},resolve:function(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=h(v(e,a),v(t,a),a,!0);return a.skipEscape=!0,m(i,a)},resolveComponent:h,equal:function(e,t,r){let a=b(e,r),i=b(t,r);return void 0!==a&&void 0!==i&&a.toLowerCase()===i.toLowerCase()},serialize:m,parse:v};e.exports=w,e.exports.default=w,e.exports.fastUri=w},1441(e,t,r){"use strict";let{isUUID:a}=r(1900),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}},1900(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"}}(o5=globalThis).__zod_globalConfig??(o5.__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 e5(e){if(""===e)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let e8=s("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=x),eD.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{e5(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 e5(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(`
8
+ if (${r}.issues.length) {
9
+ if (${n} in input) {
10
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
11
+ ...iss,
12
+ path: iss.path ? [${n}, ...iss.path] : [${n}]
13
+ })));
14
+ }
15
+ }
16
+
17
+ if (${r}.value === undefined) {
18
+ if (${n} in input) {
19
+ newResult[${n}] = undefined;
20
+ }
21
+ } else {
22
+ newResult[${n}] = ${r}.value;
23
+ }
24
+
25
+ `):l?t.write(`
8
26
  if (${r}.issues.length) {
9
27
  payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
10
28
  ...iss,
11
- path: iss.path ? [${s}, ...iss.path] : [${s}]
29
+ path: iss.path ? [${n}, ...iss.path] : [${n}]
12
30
  })));
13
31
  }
14
32
 
15
-
16
33
  if (${r}.value === undefined) {
17
- if (${s} in input) {
18
- newResult[${s}] = undefined;
34
+ if (${n} in input) {
35
+ newResult[${n}] = undefined;
19
36
  }
20
37
  } else {
21
- newResult[${s}] = ${r}.value;
38
+ newResult[${n}] = ${r}.value;
22
39
  }
23
40
 
24
- `)}t.write("payload.value = newResult;"),t.write("return payload;");let o=t.compile();return(t,r)=>o(e,t,r)})(t.shape)),u=r(u,d),l)?th([],c,u,d,a,e):u:i(u,d):(u.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),u)}});function tg(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=>!z(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=>A(e,a,c())))}),t)}let tv=o("$ZodUnion",(e,t)=>{eF.init(e,t),v(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),v(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),v(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),v(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=>y(e.source)).join("|")})$`)}});let r=1===t.options.length,a=t.options[0]._zod.run;e._zod.parse=(i,s)=>{if(r)return a(i,s);let n=!1,o=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},s);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=>tg(t,i,e,s)):tg(o,i,e,s)}}),t_=o("$ZodDiscriminatedUnion",(e,t)=>{tv.init(e,t);let r=e._zod.parse;v(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=m(()=>{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?r(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:n,path:[t.discriminator],inst:e}),i)}}),tb=o("$ZodIntersection",(e,t)=>{eF.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])=>t$(e,t,r)):t$(e,i,s)}});function t$(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),z(e))return e;let a=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(S(t)&&S(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(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}let tw=o("$ZodRecord",(e,t)=>{eF.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!S(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 e of n)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){l.add("number"==typeof e?e.toString():e);let n=t.valueType._zod.run({value:i[e],issues:[]},a);n instanceof Promise?s.push(n.then(t=>{t.issues.length&&r.issues.push(...R(e,t.issues)),r.value[e]=t.value})):(n.issues.length&&r.issues.push(...R(e,n.issues)),r.value[e]=n.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)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(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>A(e,a,c())),input:n,path:[n],inst:e}),r.value[o.value]=o.value;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(...R(n,e.issues)),r.value[o.value]=e.value})):(l.issues.length&&r.issues.push(...R(n,l.issues)),r.value[o.value]=l.value)}return s.length?Promise.all(s).then(()=>r):r}}),tk=o("$ZodEnum",(e,t)=>{eF.init(e,t);let r=p(t.entries),a=new Set(r);e._zod.values=a,e._zod.pattern=RegExp(`^(${r.filter(e=>T.has(typeof e)).map(e=>"string"==typeof e?P(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}}),tx=o("$ZodLiteral",(e,t)=>{if(eF.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?P(e):e?P(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}}),tS=o("$ZodTransform",(e,t)=>{eF.init(e,t),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new u(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));if(i instanceof Promise)throw new l;return r.value=i,r}});function tE(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let tT=o("$ZodOptional",(e,t)=>{eF.init(e,t),e._zod.optin="optional",e._zod.optout="optional",v(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),v(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(t=>tE(t,e.value)):tE(a,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),tP=o("$ZodNullable",(e,t)=>{eF.init(e,t),v(e._zod,"optin",()=>t.innerType._zod.optin),v(e._zod,"optout",()=>t.innerType._zod.optout),v(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)}|null)$`):void 0}),v(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)}),tj=o("$ZodDefault",(e,t)=>{eF.init(e,t),e._zod.optin="optional",v(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=>tO(e,t)):tO(a,t)}});function tO(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let tI=o("$ZodPrefault",(e,t)=>{eF.init(e,t),e._zod.optin="optional",v(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))}),tN=o("$ZodNonOptional",(e,t)=>{eF.init(e,t),v(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=>tz(t,e)):tz(i,e)}});function tz(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 tR=o("$ZodCatch",(e,t)=>{eF.init(e,t),v(e._zod,"optin",()=>t.innerType._zod.optin),v(e._zod,"optout",()=>t.innerType._zod.optout),v(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=>A(e,r,c()))},input:e.value}),e.issues=[]),e)):(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>A(e,r,c()))},input:e.value}),e.issues=[]),e)}}),tC=o("$ZodPipe",(e,t)=>{eF.init(e,t),v(e._zod,"values",()=>t.in._zod.values),v(e._zod,"optin",()=>t.in._zod.optin),v(e._zod,"optout",()=>t.out._zod.optout),v(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=>tA(e,t.in,r)):tA(a,t.in,r)}let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>tA(e,t.out,r)):tA(a,t.out,r)}});function tA(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}let tM=o("$ZodReadonly",(e,t)=>{eF.init(e,t),v(e._zod,"propValues",()=>t.innerType._zod.propValues),v(e._zod,"values",()=>t.innerType._zod.values),v(e._zod,"optin",()=>t.innerType?._zod?.optin),v(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(tZ):tZ(a)}});function tZ(e){return e.value=Object.freeze(e.value),e}let tD=o("$ZodCustom",(e,t)=>{ew.init(e,t),eF.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(Z(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class tF{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return 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)}}(oz=globalThis).__zod_globalRegistry??(oz.__zod_globalRegistry=new tF);let tL=globalThis.__zod_globalRegistry;function tV(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function tU(e,t){return new ex({check:"less_than",...O(t),value:e,inclusive:!1})}function tH(e,t){return new ex({check:"less_than",...O(t),value:e,inclusive:!0})}function tK(e,t){return new eS({check:"greater_than",...O(t),value:e,inclusive:!1})}function tJ(e,t){return new eS({check:"greater_than",...O(t),value:e,inclusive:!0})}function tB(e,t){return new eE({check:"multiple_of",...O(t),value:e})}function tG(e,t){return new eP({check:"max_length",...O(t),maximum:e})}function tW(e,t){return new ej({check:"min_length",...O(t),minimum:e})}function tY(e,t){return new eO({check:"length_equals",...O(t),length:e})}function tQ(e){return new eZ({check:"overwrite",tx:e})}class tX{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??tL,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var r;let a=e._zod.def,i=this.seen.get(e);if(i)return i.count++,t.schemaPath.includes(e)&&(i.cycle=t.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,s);let n=e._zod.toJSONSchema?.();if(n)s.schema=n;else{let r={...t,schemaPath:[...t.schemaPath,e],path:t.path},i=e._zod.parent;if(i)s.ref=i,this.process(i,r),this.seen.get(i).isParent=!0;else{let t=s.schema;switch(a.type){case"string":{t.type="string";let{minimum:r,maximum:a,format:i,patterns:n,contentEncoding:o}=e._zod.bag;if("number"==typeof r&&(t.minLength=r),"number"==typeof a&&(t.maxLength=a),i&&(t.format=({guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""})[i]??i,""===t.format&&delete t.format),o&&(t.contentEncoding=o),n&&n.size>0){let e=[...n];1===e.length?t.pattern=e[0].source:e.length>1&&(s.schema.allOf=[...e.map(e=>({..."draft-7"===this.target||"draft-4"===this.target||"openapi-3.0"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{let{minimum:r,maximum:a,format:i,multipleOf:s,exclusiveMaximum:n,exclusiveMinimum:o}=e._zod.bag;"string"==typeof i&&i.includes("int")?t.type="integer":t.type="number","number"==typeof o&&("draft-4"===this.target||"openapi-3.0"===this.target?(t.minimum=o,t.exclusiveMinimum=!0):t.exclusiveMinimum=o),"number"==typeof r&&(t.minimum=r,"number"==typeof o&&"draft-4"!==this.target&&(o>=r?delete t.minimum:delete t.exclusiveMinimum)),"number"==typeof n&&("draft-4"===this.target||"openapi-3.0"===this.target?(t.maximum=n,t.exclusiveMaximum=!0):t.exclusiveMaximum=n),"number"==typeof a&&(t.maximum=a,"number"==typeof n&&"draft-4"!==this.target&&(n<=a?delete t.maximum:delete t.exclusiveMaximum)),"number"==typeof s&&(t.multipleOf=s);break}case"boolean":case"success":t.type="boolean";break;case"bigint":if("throw"===this.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema");break;case"symbol":if("throw"===this.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema");break;case"null":"openapi-3.0"===this.target?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null";break;case"any":case"unknown":break;case"undefined":if("throw"===this.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema");break;case"void":if("throw"===this.unrepresentable)throw Error("Void cannot be represented in JSON Schema");break;case"never":t.not={};break;case"date":if("throw"===this.unrepresentable)throw Error("Date cannot be represented in JSON Schema");break;case"array":{let{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(t.minItems=i),"number"==typeof s&&(t.maxItems=s),t.type="array",t.items=this.process(a.element,{...r,path:[...r.path,"items"]});break}case"object":{t.type="object",t.properties={};let e=a.shape;for(let a in e)t.properties[a]=this.process(e[a],{...r,path:[...r.path,"properties",a]});let i=new Set([...new Set(Object.keys(e))].filter(e=>{let t=a.shape[e]._zod;return"input"===this.io?void 0===t.optin:void 0===t.optout}));i.size>0&&(t.required=Array.from(i)),a.catchall?._zod.def.type==="never"?t.additionalProperties=!1:a.catchall?a.catchall&&(t.additionalProperties=this.process(a.catchall,{...r,path:[...r.path,"additionalProperties"]})):"output"===this.io&&(t.additionalProperties=!1);break}case"union":{let e=void 0!==a.discriminator,i=a.options.map((t,a)=>this.process(t,{...r,path:[...r.path,e?"oneOf":"anyOf",a]}));e?t.oneOf=i:t.anyOf=i;break}case"intersection":{let e=this.process(a.left,{...r,path:[...r.path,"allOf",0]}),i=this.process(a.right,{...r,path:[...r.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length;t.allOf=[...s(e)?e.allOf:[e],...s(i)?i.allOf:[i]];break}case"tuple":{t.type="array";let i="draft-2020-12"===this.target?"prefixItems":"items",s="draft-2020-12"===this.target||"openapi-3.0"===this.target?"items":"additionalItems",n=a.items.map((e,t)=>this.process(e,{...r,path:[...r.path,i,t]})),o=a.rest?this.process(a.rest,{...r,path:[...r.path,s,..."openapi-3.0"===this.target?[a.items.length]:[]]}):null;"draft-2020-12"===this.target?(t.prefixItems=n,o&&(t.items=o)):"openapi-3.0"===this.target?(t.items={anyOf:n},o&&t.items.anyOf.push(o),t.minItems=n.length,o||(t.maxItems=n.length)):(t.items=n,o&&(t.additionalItems=o));let{minimum:l,maximum:u}=e._zod.bag;"number"==typeof l&&(t.minItems=l),"number"==typeof u&&(t.maxItems=u);break}case"record":t.type="object",("draft-7"===this.target||"draft-2020-12"===this.target)&&(t.propertyNames=this.process(a.keyType,{...r,path:[...r.path,"propertyNames"]})),t.additionalProperties=this.process(a.valueType,{...r,path:[...r.path,"additionalProperties"]});break;case"map":if("throw"===this.unrepresentable)throw Error("Map cannot be represented in JSON Schema");break;case"set":if("throw"===this.unrepresentable)throw Error("Set cannot be represented in JSON Schema");break;case"enum":{let e=p(a.entries);e.every(e=>"number"==typeof e)&&(t.type="number"),e.every(e=>"string"==typeof e)&&(t.type="string"),t.enum=e;break}case"literal":{let e=[];for(let t of a.values)if(void 0===t){if("throw"===this.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof t)if("throw"===this.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else e.push(Number(t));else e.push(t);if(0===e.length);else if(1===e.length){let r=e[0];t.type=null===r?"null":typeof r,"draft-4"===this.target||"openapi-3.0"===this.target?t.enum=[r]:t.const=r}else e.every(e=>"number"==typeof e)&&(t.type="number"),e.every(e=>"string"==typeof e)&&(t.type="string"),e.every(e=>"boolean"==typeof e)&&(t.type="string"),e.every(e=>null===e)&&(t.type="null"),t.enum=e;break}case"file":{let r={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:i,mime:s}=e._zod.bag;void 0!==a&&(r.minLength=a),void 0!==i&&(r.maxLength=i),s?1===s.length?(r.contentMediaType=s[0],Object.assign(t,r)):t.anyOf=s.map(e=>({...r,contentMediaType:e})):Object.assign(t,r);break}case"transform":if("throw"===this.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema");break;case"nullable":{let e=this.process(a.innerType,r);"openapi-3.0"===this.target?(s.ref=a.innerType,t.nullable=!0):t.anyOf=[e,{type:"null"}];break}case"nonoptional":case"promise":case"optional":this.process(a.innerType,r),s.ref=a.innerType;break;case"default":this.process(a.innerType,r),s.ref=a.innerType,t.default=JSON.parse(JSON.stringify(a.defaultValue));break;case"prefault":this.process(a.innerType,r),s.ref=a.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(a.defaultValue)));break;case"catch":{let e;this.process(a.innerType,r),s.ref=a.innerType;try{e=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}t.default=e;break}case"nan":if("throw"===this.unrepresentable)throw Error("NaN cannot be represented in JSON Schema");break;case"template_literal":{let r=e._zod.pattern;if(!r)throw Error("Pattern not found in template literal");t.type="string",t.pattern=r.source;break}case"pipe":{let e="input"===this.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;this.process(e,r),s.ref=e;break}case"readonly":this.process(a.innerType,r),s.ref=a.innerType,t.readOnly=!0;break;case"lazy":{let t=e._zod.innerType;this.process(t,r),s.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema");break;case"function":if("throw"===this.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")}}}let o=this.metadataRegistry.get(e);return o&&Object.assign(s.schema,o),"input"===this.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 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 s.schema.examples,delete s.schema.default),"input"===this.io&&s.schema._prefault&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,t){let r={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},a=this.seen.get(e);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let i=e=>{let t="draft-2020-12"===this.target?"$defs":"definitions";if(r.external){let a=r.external.registry.get(e[0])?.id,i=r.external.uri??(e=>e);if(a)return{ref:i(a)};let s=e[1].defId??e[1].schema.id??`schema${this.counter++}`;return e[1].defId=s,{defId:s,ref:`${i("__shared")}#/${t}/${s}`}}if(e[1]===a)return{ref:"#"};let i=`#/${t}/`,s=e[1].schema.id??`__schema${this.counter++}`;return{defId:s,ref:i+s}},s=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:r,defId:a}=i(e);t.def={...t.schema},a&&(t.defId=a);let s=t.schema;for(let e in s)delete s[e];s.$ref=r};if("throw"===r.cycles)for(let e of this.seen.entries()){let t=e[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
41
+ `):t.write(`
42
+ const ${r}_present = ${n} in input;
43
+ if (${r}.issues.length) {
44
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
45
+ ...iss,
46
+ path: iss.path ? [${n}, ...iss.path] : [${n}]
47
+ })));
48
+ }
49
+ if (!${r}_present && !${r}.issues.length) {
50
+ payload.issues.push({
51
+ code: "invalid_type",
52
+ expected: "nonoptional",
53
+ input: undefined,
54
+ path: [${n}]
55
+ });
56
+ }
57
+
58
+ if (${r}_present) {
59
+ if (${r}.value === undefined) {
60
+ newResult[${n}] = undefined;
61
+ } else {
62
+ newResult[${n}] = ${r}.value;
63
+ }
64
+ }
65
+
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");(o8=globalThis).__zod_globalRegistry??(o8.__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>
25
67
 
26
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let t of this.seen.entries()){let a=t[1];if(e===t[0]){s(t);continue}if(r.external){let a=r.external.registry.get(t[0])?.id;if(e!==t[0]&&a){s(t);continue}}if(this.metadataRegistry.get(t[0])?.id||a.cycle||a.count>1&&"ref"===r.reused){s(t);continue}}let n=(e,t)=>{let r=this.seen.get(e),a=r.def??r.schema,i={...a};if(null===r.ref)return;let s=r.ref;if(r.ref=null,s){n(s,t);let e=this.seen.get(s).schema;e.$ref&&("draft-7"===t.target||"draft-4"===t.target||"openapi-3.0"===t.target)?(a.allOf=a.allOf??[],a.allOf.push(e)):(Object.assign(a,e),Object.assign(a,i))}r.isParent||this.override({zodSchema:e,jsonSchema:a,path:r.path??[]})};for(let e of[...this.seen.entries()].reverse())n(e[0],{target:this.target});let o={};if("draft-2020-12"===this.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-7"===this.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-4"===this.target?o.$schema="http://json-schema.org/draft-04/schema#":"openapi-3.0"===this.target||console.warn(`Invalid target: ${this.target}`),r.external?.uri){let t=r.external.registry.get(e)?.id;if(!t)throw Error("Schema is missing an `id` property");o.$id=r.external.uri(t)}Object.assign(o,a.def);let l=r.external?.defs??{};for(let e of this.seen.entries()){let t=e[1];t.def&&t.defId&&(l[t.defId]=t.def)}r.external||Object.keys(l).length>0&&("draft-2020-12"===this.target?o.$defs=l:o.definitions=l);try{return JSON.parse(JSON.stringify(o))}catch(e){throw Error("Error converting schema to JSON.")}}}let t0=o("ZodISODateTime",(e,t)=>{e1.init(e,t),rf.init(e,t)});function t1(e){return new t0({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(e)})}let t9=o("ZodISODate",(e,t)=>{e9.init(e,t),rf.init(e,t)}),t2=o("ZodISOTime",(e,t)=>{e2.init(e,t),rf.init(e,t)}),t4=o("ZodISODuration",(e,t)=>{e4.init(e,t),rf.init(e,t)}),t6=(e,t)=>{q.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},a=e=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>a({issues:e}));else if("invalid_key"===i.code)a({issues:i.issues});else if("invalid_element"===i.code)a({issues:i.issues});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(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,h,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,h,2)}},isEmpty:{get:()=>0===e.issues.length}})};o("ZodError",t6);let t5=o("ZodError",t6,{Parent:Error}),t8=L(t5),t3=U(t5),t7=K(t5),re=B(t5),rt=(e,t,r)=>{let a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return L(t5)(e,t,a)},rr=(e,t,r)=>L(t5)(e,t,r),ra=async(e,t,r)=>{let a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return U(t5)(e,t,a)},ri=async(e,t,r)=>U(t5)(e,t,r),rs=(e,t,r)=>{let a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return K(t5)(e,t,a)},rn=(e,t,r)=>K(t5)(e,t,r),ro=async(e,t,r)=>{let a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return B(t5)(e,t,a)},rl=async(e,t,r)=>B(t5)(e,t,r),ru=o("ZodType",(e,t)=>(eF.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(b(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,r)=>j(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>t8(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>t7(e,t,r),e.parseAsync=async(t,r)=>t3(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)=>rr(e,t,r),e.encodeAsync=async(t,r)=>ra(e,t,r),e.decodeAsync=async(t,r)=>ri(e,t,r),e.safeEncode=(t,r)=>rs(e,t,r),e.safeDecode=(t,r)=>rn(e,t,r),e.safeEncodeAsync=async(t,r)=>ro(e,t,r),e.safeDecodeAsync=async(t,r)=>rl(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return new ad({type:"custom",check:"custom",fn:e,...O(t)})}(t,r)),e.superRefine=t=>e.check(function(e){var t;let r,a;return t=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(Z(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(Z(e)))},e(t.value,t)),(a=new ew({check:"custom",...O(void 0)}))._zod.check=t,r=a}(t)),e.overwrite=t=>e.check(tQ(t)),e.optional=()=>ae(e),e.nullable=()=>ar(e),e.nullish=()=>ae(ar(e)),e.nonoptional=t=>new as({type:"nonoptional",innerType:e,...O(t)}),e.array=()=>rH(e),e.or=t=>rW([e,t]),e.and=t=>r0(e,t),e.transform=t=>al(e,r3(t)),e.default=t=>{var r,a;return r=e,a=t,new aa({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():E(a)}})},e.prefault=t=>{var r,a;return r=e,a=t,new ai({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():E(a)}})},e.catch=t=>{var r;return new an({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r})},e.pipe=t=>al(e,t),e.readonly=()=>new au({type:"readonly",innerType:e}),e.describe=t=>{let r=e.clone();return tL.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>tL.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return tL.get(e);let r=e.clone();return tL.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),rd=o("_ZodString",(e,t)=>{eL.init(e,t),ru.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new eN({check:"string_format",format:"regex",...O(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new eC({check:"string_format",format:"includes",...O(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new eA({check:"string_format",format:"starts_with",...O(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new eM({check:"string_format",format:"ends_with",...O(t),suffix:e})}(...t)),e.min=(...t)=>e.check(tW(...t)),e.max=(...t)=>e.check(tG(...t)),e.length=(...t)=>e.check(tY(...t)),e.nonempty=(...t)=>e.check(tW(1,...t)),e.lowercase=t=>e.check(new ez({check:"string_format",format:"lowercase",...O(t)})),e.uppercase=t=>e.check(new eR({check:"string_format",format:"uppercase",...O(t)})),e.trim=()=>e.check(tQ(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return tQ(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(tQ(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(tQ(e=>e.toUpperCase())),e.slugify=()=>e.check(tQ(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}),rc=o("ZodString",(e,t)=>{eL.init(e,t),rd.init(e,t),e.email=t=>e.check(new rh({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})),e.url=t=>e.check(new rg({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})),e.jwt=t=>e.check(new rN({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})),e.emoji=t=>e.check(new rv({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})),e.guid=t=>e.check(tV(rm,t)),e.uuid=t=>e.check(new ry({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})),e.uuidv4=t=>e.check(new ry({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})),e.uuidv6=t=>e.check(new ry({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})),e.uuidv7=t=>e.check(new ry({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})),e.nanoid=t=>e.check(new r_({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})),e.guid=t=>e.check(tV(rm,t)),e.cuid=t=>e.check(new rb({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})),e.cuid2=t=>e.check(new r$({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})),e.ulid=t=>e.check(new rw({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})),e.base64=t=>e.check(new rj({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})),e.base64url=t=>e.check(new rO({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})),e.xid=t=>e.check(new rk({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})),e.ksuid=t=>e.check(new rx({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})),e.ipv4=t=>e.check(new rS({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})),e.ipv6=t=>e.check(new rE({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})),e.cidrv4=t=>e.check(new rT({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})),e.cidrv6=t=>e.check(new rP({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})),e.e164=t=>e.check(new rI({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})),e.datetime=t=>e.check(t1(t)),e.date=t=>e.check(new t9({type:"string",format:"date",check:"string_format",...O(t)})),e.time=t=>e.check(new t2({type:"string",format:"time",check:"string_format",precision:null,...O(t)})),e.duration=t=>e.check(new t4({type:"string",format:"duration",check:"string_format",...O(t)}))});function rp(e){return new rc({type:"string",...O(e)})}let rf=o("ZodStringFormat",(e,t)=>{eV.init(e,t),rd.init(e,t)}),rh=o("ZodEmail",(e,t)=>{eK.init(e,t),rf.init(e,t)}),rm=o("ZodGUID",(e,t)=>{eU.init(e,t),rf.init(e,t)}),ry=o("ZodUUID",(e,t)=>{eH.init(e,t),rf.init(e,t)}),rg=o("ZodURL",(e,t)=>{eJ.init(e,t),rf.init(e,t)}),rv=o("ZodEmoji",(e,t)=>{eB.init(e,t),rf.init(e,t)}),r_=o("ZodNanoID",(e,t)=>{eG.init(e,t),rf.init(e,t)}),rb=o("ZodCUID",(e,t)=>{eW.init(e,t),rf.init(e,t)}),r$=o("ZodCUID2",(e,t)=>{eY.init(e,t),rf.init(e,t)}),rw=o("ZodULID",(e,t)=>{eQ.init(e,t),rf.init(e,t)}),rk=o("ZodXID",(e,t)=>{eX.init(e,t),rf.init(e,t)}),rx=o("ZodKSUID",(e,t)=>{e0.init(e,t),rf.init(e,t)}),rS=o("ZodIPv4",(e,t)=>{e6.init(e,t),rf.init(e,t)}),rE=o("ZodIPv6",(e,t)=>{e5.init(e,t),rf.init(e,t)}),rT=o("ZodCIDRv4",(e,t)=>{e8.init(e,t),rf.init(e,t)}),rP=o("ZodCIDRv6",(e,t)=>{e3.init(e,t),rf.init(e,t)}),rj=o("ZodBase64",(e,t)=>{te.init(e,t),rf.init(e,t)}),rO=o("ZodBase64URL",(e,t)=>{tt.init(e,t),rf.init(e,t)}),rI=o("ZodE164",(e,t)=>{tr.init(e,t),rf.init(e,t)}),rN=o("ZodJWT",(e,t)=>{ta.init(e,t),rf.init(e,t)}),rz=o("ZodNumber",(e,t)=>{ti.init(e,t),ru.init(e,t),e.gt=(t,r)=>e.check(tK(t,r)),e.gte=(t,r)=>e.check(tJ(t,r)),e.min=(t,r)=>e.check(tJ(t,r)),e.lt=(t,r)=>e.check(tU(t,r)),e.lte=(t,r)=>e.check(tH(t,r)),e.max=(t,r)=>e.check(tH(t,r)),e.int=t=>e.check(rA(t)),e.safe=t=>e.check(rA(t)),e.positive=t=>e.check(tK(0,t)),e.nonnegative=t=>e.check(tJ(0,t)),e.negative=t=>e.check(tU(0,t)),e.nonpositive=t=>e.check(tH(0,t)),e.multipleOf=(t,r)=>e.check(tB(t,r)),e.step=(t,r)=>e.check(tB(t,r)),e.finite=()=>e;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 rR(e){return new rz({type:"number",checks:[],...O(e)})}let rC=o("ZodNumberFormat",(e,t)=>{ts.init(e,t),rz.init(e,t)});function rA(e){return new rC({type:"number",check:"number_format",abort:!1,format:"safeint",...O(e)})}let rM=o("ZodBoolean",(e,t)=>{tn.init(e,t),ru.init(e,t)});function rZ(e){return new rM({type:"boolean",...O(e)})}let rD=o("ZodNull",(e,t)=>{to.init(e,t),ru.init(e,t)});function rq(e){return new rD({type:"null",...O(e)})}let rF=o("ZodUnknown",(e,t)=>{tl.init(e,t),ru.init(e,t)});function rL(){return new rF({type:"unknown"})}let rV=o("ZodNever",(e,t)=>{tu.init(e,t),ru.init(e,t)}),rU=o("ZodArray",(e,t)=>{tc.init(e,t),ru.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(tW(t,r)),e.nonempty=t=>e.check(tW(1,t)),e.max=(t,r)=>e.check(tG(t,r)),e.length=(t,r)=>e.check(tY(t,r)),e.unwrap=()=>e.element});function rH(e,t){return new rU({type:"array",element:e,...O(t)})}let rK=o("ZodObject",(e,t)=>{ty.init(e,t),ru.init(e,t),v(e,"shape",()=>t.shape),e.keyof=()=>r4(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:rL()}),e.loose=()=>e.clone({...e._zod.def,catchall:rL()}),e.strict=()=>e.clone({...e._zod.def,catchall:new rV({type:"never",...O(void 0)})}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>(function(e,t){if(!S(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let a=b(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return _(this,"shape",r),r},checks:[]});return j(e,a)})(e,t),e.safeExtend=t=>(function(e,t){if(!S(t))throw Error("Invalid input to safeExtend: expected a plain object");let r={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return _(this,"shape",r),r},checks:e._zod.def.checks};return j(e,r)})(e,t),e.merge=t=>{let r;return r=b(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return _(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]}),j(e,r)},e.pick=t=>{let r,a;return r=e._zod.def,a=b(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 _(this,"shape",e),e},checks:[]}),j(e,a)},e.omit=t=>{let r,a;return r=e._zod.def,a=b(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 _(this,"shape",a),a},checks:[]}),j(e,a)},e.partial=(...t)=>{var r;let a;return r=t[0],a=b(e._zod.def,{get shape(){let t=e._zod.def.shape,a={...t};if(r)for(let e in r){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);r[e]&&(a[e]=r7?new r7({type:"optional",innerType:t[e]}):t[e])}else for(let e in t)a[e]=r7?new r7({type:"optional",innerType:t[e]}):t[e];return _(this,"shape",a),a},checks:[]}),j(e,a)},e.required=(...t)=>{var r;let a;return r=t[0],a=b(e._zod.def,{get shape(){let t=e._zod.def.shape,a={...t};if(r)for(let e in r){if(!(e in a))throw Error(`Unrecognized key: "${e}"`);r[e]&&(a[e]=new as({type:"nonoptional",innerType:t[e]}))}else for(let e in t)a[e]=new as({type:"nonoptional",innerType:t[e]});return _(this,"shape",a),a},checks:[]}),j(e,a)}});function rJ(e,t){return new rK({type:"object",shape:e??{},...O(t)})}function rB(e,t){return new rK({type:"object",shape:e,catchall:rL(),...O(t)})}let rG=o("ZodUnion",(e,t)=>{tv.init(e,t),ru.init(e,t),e.options=t.options});function rW(e,t){return new rG({type:"union",options:e,...O(t)})}let rY=o("ZodDiscriminatedUnion",(e,t)=>{rG.init(e,t),t_.init(e,t)});function rQ(e,t,r){return new rY({type:"union",options:t,discriminator:e,...O(r)})}let rX=o("ZodIntersection",(e,t)=>{tb.init(e,t),ru.init(e,t)});function r0(e,t){return new rX({type:"intersection",left:e,right:t})}let r1=o("ZodRecord",(e,t)=>{tw.init(e,t),ru.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function r9(e,t,r){return new r1({type:"record",keyType:e,valueType:t,...O(r)})}let r2=o("ZodEnum",(e,t)=>{tk.init(e,t),ru.init(e,t),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 r2({...t,checks:[],...O(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 r2({...t,checks:[],...O(a),entries:i})}});function r4(e,t){return new r2({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O(t)})}let r6=o("ZodLiteral",(e,t)=>{tx.init(e,t),ru.init(e,t),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 r5(e,t){return new r6({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}let r8=o("ZodTransform",(e,t)=>{tS.init(e,t),ru.init(e,t),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new u(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(Z(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(Z(a)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function r3(e){return new r8({type:"transform",transform:e})}let r7=o("ZodOptional",(e,t)=>{tT.init(e,t),ru.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new r7({type:"optional",innerType:e})}let at=o("ZodNullable",(e,t)=>{tP.init(e,t),ru.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ar(e){return new at({type:"nullable",innerType:e})}let aa=o("ZodDefault",(e,t)=>{tj.init(e,t),ru.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),ai=o("ZodPrefault",(e,t)=>{tI.init(e,t),ru.init(e,t),e.unwrap=()=>e._zod.def.innerType}),as=o("ZodNonOptional",(e,t)=>{tN.init(e,t),ru.init(e,t),e.unwrap=()=>e._zod.def.innerType}),an=o("ZodCatch",(e,t)=>{tR.init(e,t),ru.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),ao=o("ZodPipe",(e,t)=>{tC.init(e,t),ru.init(e,t),e.in=t.in,e.out=t.out});function al(e,t){return new ao({type:"pipe",in:e,out:t})}let au=o("ZodReadonly",(e,t)=>{tM.init(e,t),ru.init(e,t),e.unwrap=()=>e._zod.def.innerType}),ad=o("ZodCustom",(e,t)=>{tD.init(e,t),ru.init(e,t)});oR||(oR={}),c({localeError:(e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}},t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r=>{switch(r.code){case"invalid_type":return`Invalid input: expected ${r.expected}, received ${(e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}return t})(r.input)}`;case"invalid_value":if(1===r.values.length)return`Invalid input: expected ${I(r.values[0])}`;return`Invalid option: expected one of ${f(r.values,"|")}`;case"too_big":{let t=r.inclusive?"<=":"<",a=e[r.origin]??null;if(a)return`Too big: expected ${r.origin??"value"} to have ${t}${r.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${r.origin??"value"} to be ${t}${r.maximum.toString()}`}case"too_small":{let t=r.inclusive?">=":">",a=e[r.origin]??null;if(a)return`Too small: expected ${r.origin} to have ${t}${r.minimum.toString()} ${a.unit}`;return`Too small: expected ${r.origin} to be ${t}${r.minimum.toString()}`}case"invalid_format":if("starts_with"===r.format)return`Invalid string: must start with "${r.prefix}"`;if("ends_with"===r.format)return`Invalid string: must end with "${r.suffix}"`;if("includes"===r.format)return`Invalid string: must include "${r.includes}"`;if("regex"===r.format)return`Invalid string: must match pattern ${r.pattern}`;return`Invalid ${t[r.format]??r.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${f(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`}})});let ac="2025-11-25",ap=[ac,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],af="io.modelcontextprotocol/related-task",ah=(ox=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),(i=O(void 0)).abort??(i.abort=!0),new ad({type:"custom",check:"custom",fn:ox,...i})),am=rW([rp(),rR().int()]),ay=rp();rB({ttl:rW([rR(),rq()]).optional(),pollInterval:rR().optional()});let ag=rJ({ttl:rR().optional()}),av=rJ({taskId:rp()}),a_=rB({progressToken:am.optional(),[af]:av.optional()}),ab=rJ({_meta:a_.optional()}),a$=ab.extend({task:ag.optional()}),aw=rJ({method:rp(),params:ab.loose().optional()}),ak=rJ({_meta:a_.optional()}),ax=rJ({method:rp(),params:ak.loose().optional()}),aS=rB({_meta:a_.optional()}),aE=rW([rp(),rR().int()]),aT=rJ({jsonrpc:r5("2.0"),id:aE,...aw.shape}).strict(),aP=e=>aT.safeParse(e).success,aj=rJ({jsonrpc:r5("2.0"),...ax.shape}).strict(),aO=rJ({jsonrpc:r5("2.0"),id:aE,result:aS}).strict();(oS=oC||(oC={}))[oS.ConnectionClosed=-32e3]="ConnectionClosed",oS[oS.RequestTimeout=-32001]="RequestTimeout",oS[oS.ParseError=-32700]="ParseError",oS[oS.InvalidRequest=-32600]="InvalidRequest",oS[oS.MethodNotFound=-32601]="MethodNotFound",oS[oS.InvalidParams=-32602]="InvalidParams",oS[oS.InternalError=-32603]="InternalError",oS[oS.UrlElicitationRequired=-32042]="UrlElicitationRequired";let aI=rJ({jsonrpc:r5("2.0"),id:aE.optional(),error:rJ({code:rR().int(),message:rp(),data:rL().optional()})}).strict(),aN=rW([aT,aj,aO,aI]);rW([aO,aI]);let az=aS.strict(),aR=ak.extend({requestId:aE.optional(),reason:rp().optional()}),aC=ax.extend({method:r5("notifications/cancelled"),params:aR}),aA=rJ({src:rp(),mimeType:rp().optional(),sizes:rH(rp()).optional(),theme:r4(["light","dark"]).optional()}),aM=rJ({icons:rH(aA).optional()}),aZ=rJ({name:rp(),title:rp().optional()}),aD=aZ.extend({...aZ.shape,...aM.shape,version:rp(),websiteUrl:rp().optional(),description:rp().optional()}),aq=r0(rJ({applyDefaults:rZ().optional()}),r9(rp(),rL())),aF=(oE=e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,oT=r0(rJ({form:aq.optional(),url:ah.optional()}),r9(rp(),rL()).optional()),al(r3(oE),oT)),aL=rB({list:ah.optional(),cancel:ah.optional(),requests:rB({sampling:rB({createMessage:ah.optional()}).optional(),elicitation:rB({create:ah.optional()}).optional()}).optional()}),aV=rB({list:ah.optional(),cancel:ah.optional(),requests:rB({tools:rB({call:ah.optional()}).optional()}).optional()}),aU=rJ({experimental:r9(rp(),ah).optional(),sampling:rJ({context:ah.optional(),tools:ah.optional()}).optional(),elicitation:aF.optional(),roots:rJ({listChanged:rZ().optional()}).optional(),tasks:aL.optional()}),aH=ab.extend({protocolVersion:rp(),capabilities:aU,clientInfo:aD}),aK=aw.extend({method:r5("initialize"),params:aH}),aJ=rJ({experimental:r9(rp(),ah).optional(),logging:ah.optional(),completions:ah.optional(),prompts:rJ({listChanged:rZ().optional()}).optional(),resources:rJ({subscribe:rZ().optional(),listChanged:rZ().optional()}).optional(),tools:rJ({listChanged:rZ().optional()}).optional(),tasks:aV.optional()}),aB=aS.extend({protocolVersion:rp(),capabilities:aJ,serverInfo:aD,instructions:rp().optional()}),aG=ax.extend({method:r5("notifications/initialized"),params:ak.optional()}),aW=aw.extend({method:r5("ping"),params:ab.optional()}),aY=rJ({progress:rR(),total:ae(rR()),message:ae(rp())}),aQ=rJ({...ak.shape,...aY.shape,progressToken:am}),aX=ax.extend({method:r5("notifications/progress"),params:aQ}),a0=ab.extend({cursor:ay.optional()}),a1=aw.extend({params:a0.optional()}),a9=aS.extend({nextCursor:ay.optional()}),a2=r4(["working","input_required","completed","failed","cancelled"]),a4=rJ({taskId:rp(),status:a2,ttl:rW([rR(),rq()]),createdAt:rp(),lastUpdatedAt:rp(),pollInterval:ae(rR()),statusMessage:ae(rp())}),a6=aS.extend({task:a4}),a5=ak.merge(a4),a8=ax.extend({method:r5("notifications/tasks/status"),params:a5}),a3=aw.extend({method:r5("tasks/get"),params:ab.extend({taskId:rp()})}),a7=aS.merge(a4),ie=aw.extend({method:r5("tasks/result"),params:ab.extend({taskId:rp()})});aS.loose();let it=a1.extend({method:r5("tasks/list")}),ir=a9.extend({tasks:rH(a4)}),ia=aw.extend({method:r5("tasks/cancel"),params:ab.extend({taskId:rp()})}),ii=aS.merge(a4),is=rJ({uri:rp(),mimeType:ae(rp()),_meta:r9(rp(),rL()).optional()}),io=is.extend({text:rp()}),il=rp().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),iu=is.extend({blob:il}),id=r4(["user","assistant"]),ic=rJ({audience:rH(id).optional(),priority:rR().min(0).max(1).optional(),lastModified:t1({offset:!0}).optional()}),ip=rJ({...aZ.shape,...aM.shape,uri:rp(),description:ae(rp()),mimeType:ae(rp()),annotations:ic.optional(),_meta:ae(rB({}))}),ih=rJ({...aZ.shape,...aM.shape,uriTemplate:rp(),description:ae(rp()),mimeType:ae(rp()),annotations:ic.optional(),_meta:ae(rB({}))}),im=a1.extend({method:r5("resources/list")}),iy=a9.extend({resources:rH(ip)}),ig=a1.extend({method:r5("resources/templates/list")}),iv=a9.extend({resourceTemplates:rH(ih)}),i_=ab.extend({uri:rp()}),ib=aw.extend({method:r5("resources/read"),params:i_}),i$=aS.extend({contents:rH(rW([io,iu]))}),iw=ax.extend({method:r5("notifications/resources/list_changed"),params:ak.optional()}),ik=aw.extend({method:r5("resources/subscribe"),params:i_}),ix=aw.extend({method:r5("resources/unsubscribe"),params:i_}),iS=ak.extend({uri:rp()}),iE=ax.extend({method:r5("notifications/resources/updated"),params:iS}),iT=rJ({name:rp(),description:ae(rp()),required:ae(rZ())}),iP=rJ({...aZ.shape,...aM.shape,description:ae(rp()),arguments:ae(rH(iT)),_meta:ae(rB({}))}),ij=a1.extend({method:r5("prompts/list")}),iO=a9.extend({prompts:rH(iP)}),iI=ab.extend({name:rp(),arguments:r9(rp(),rp()).optional()}),iN=aw.extend({method:r5("prompts/get"),params:iI}),iz=rJ({type:r5("text"),text:rp(),annotations:ic.optional(),_meta:r9(rp(),rL()).optional()}),iR=rJ({type:r5("image"),data:il,mimeType:rp(),annotations:ic.optional(),_meta:r9(rp(),rL()).optional()}),iC=rJ({type:r5("audio"),data:il,mimeType:rp(),annotations:ic.optional(),_meta:r9(rp(),rL()).optional()}),iA=rJ({type:r5("tool_use"),name:rp(),id:rp(),input:r9(rp(),rL()),_meta:r9(rp(),rL()).optional()}),iM=rJ({type:r5("resource"),resource:rW([io,iu]),annotations:ic.optional(),_meta:r9(rp(),rL()).optional()}),iZ=rW([iz,iR,iC,ip.extend({type:r5("resource_link")}),iM]),iD=rJ({role:id,content:iZ}),iq=aS.extend({description:rp().optional(),messages:rH(iD)}),iF=ax.extend({method:r5("notifications/prompts/list_changed"),params:ak.optional()}),iL=rJ({title:rp().optional(),readOnlyHint:rZ().optional(),destructiveHint:rZ().optional(),idempotentHint:rZ().optional(),openWorldHint:rZ().optional()}),iV=rJ({taskSupport:r4(["required","optional","forbidden"]).optional()}),iU=rJ({...aZ.shape,...aM.shape,description:rp().optional(),inputSchema:rJ({type:r5("object"),properties:r9(rp(),ah).optional(),required:rH(rp()).optional()}).catchall(rL()),outputSchema:rJ({type:r5("object"),properties:r9(rp(),ah).optional(),required:rH(rp()).optional()}).catchall(rL()).optional(),annotations:iL.optional(),execution:iV.optional(),_meta:r9(rp(),rL()).optional()}),iH=a1.extend({method:r5("tools/list")}),iK=a9.extend({tools:rH(iU)}),iJ=aS.extend({content:rH(iZ).default([]),structuredContent:r9(rp(),rL()).optional(),isError:rZ().optional()});iJ.or(aS.extend({toolResult:rL()}));let iB=a$.extend({name:rp(),arguments:r9(rp(),rL()).optional()}),iG=aw.extend({method:r5("tools/call"),params:iB}),iW=ax.extend({method:r5("notifications/tools/list_changed"),params:ak.optional()});rJ({autoRefresh:rZ().default(!0),debounceMs:rR().int().nonnegative().default(300)});let iY=r4(["debug","info","notice","warning","error","critical","alert","emergency"]),iQ=ab.extend({level:iY}),iX=aw.extend({method:r5("logging/setLevel"),params:iQ}),i0=ak.extend({level:iY,logger:rp().optional(),data:rL()}),i1=ax.extend({method:r5("notifications/message"),params:i0}),i9=rJ({name:rp().optional()}),i2=rJ({hints:rH(i9).optional(),costPriority:rR().min(0).max(1).optional(),speedPriority:rR().min(0).max(1).optional(),intelligencePriority:rR().min(0).max(1).optional()}),i4=rJ({mode:r4(["auto","required","none"]).optional()}),i6=rJ({type:r5("tool_result"),toolUseId:rp().describe("The unique identifier for the corresponding tool call."),content:rH(iZ).default([]),structuredContent:rJ({}).loose().optional(),isError:rZ().optional(),_meta:r9(rp(),rL()).optional()}),i5=rQ("type",[iz,iR,iC]),i8=rQ("type",[iz,iR,iC,iA,i6]),i3=rJ({role:id,content:rW([i8,rH(i8)]),_meta:r9(rp(),rL()).optional()}),i7=a$.extend({messages:rH(i3),modelPreferences:i2.optional(),systemPrompt:rp().optional(),includeContext:r4(["none","thisServer","allServers"]).optional(),temperature:rR().optional(),maxTokens:rR().int(),stopSequences:rH(rp()).optional(),metadata:ah.optional(),tools:rH(iU).optional(),toolChoice:i4.optional()}),se=aw.extend({method:r5("sampling/createMessage"),params:i7}),st=aS.extend({model:rp(),stopReason:ae(r4(["endTurn","stopSequence","maxTokens"]).or(rp())),role:id,content:i5}),sr=aS.extend({model:rp(),stopReason:ae(r4(["endTurn","stopSequence","maxTokens","toolUse"]).or(rp())),role:id,content:rW([i8,rH(i8)])}),sa=rJ({type:r5("boolean"),title:rp().optional(),description:rp().optional(),default:rZ().optional()}),si=rJ({type:r5("string"),title:rp().optional(),description:rp().optional(),minLength:rR().optional(),maxLength:rR().optional(),format:r4(["email","uri","date","date-time"]).optional(),default:rp().optional()}),ss=rJ({type:r4(["number","integer"]),title:rp().optional(),description:rp().optional(),minimum:rR().optional(),maximum:rR().optional(),default:rR().optional()}),sn=rJ({type:r5("string"),title:rp().optional(),description:rp().optional(),enum:rH(rp()),default:rp().optional()}),so=rJ({type:r5("string"),title:rp().optional(),description:rp().optional(),oneOf:rH(rJ({const:rp(),title:rp()})),default:rp().optional()}),sl=rJ({type:r5("string"),title:rp().optional(),description:rp().optional(),enum:rH(rp()),enumNames:rH(rp()).optional(),default:rp().optional()}),su=rW([sn,so]),sd=rW([rJ({type:r5("array"),title:rp().optional(),description:rp().optional(),minItems:rR().optional(),maxItems:rR().optional(),items:rJ({type:r5("string"),enum:rH(rp())}),default:rH(rp()).optional()}),rJ({type:r5("array"),title:rp().optional(),description:rp().optional(),minItems:rR().optional(),maxItems:rR().optional(),items:rJ({anyOf:rH(rJ({const:rp(),title:rp()}))}),default:rH(rp()).optional()})]),sc=rW([sl,su,sd]),sp=rW([sc,sa,si,ss]),sf=a$.extend({mode:r5("form").optional(),message:rp(),requestedSchema:rJ({type:r5("object"),properties:r9(rp(),sp),required:rH(rp()).optional()})}),sh=a$.extend({mode:r5("url"),message:rp(),elicitationId:rp(),url:rp().url()}),sm=rW([sf,sh]),sy=aw.extend({method:r5("elicitation/create"),params:sm}),sg=ak.extend({elicitationId:rp()}),sv=ax.extend({method:r5("notifications/elicitation/complete"),params:sg}),s_=aS.extend({action:r4(["accept","decline","cancel"]),content:(oP=e=>null===e?void 0:e,oj=r9(rp(),rW([rp(),rR(),rZ(),rH(rp())])).optional(),al(r3(oP),oj))}),sb=rJ({type:r5("ref/resource"),uri:rp()}),s$=rJ({type:r5("ref/prompt"),name:rp()}),sw=ab.extend({ref:rW([s$,sb]),argument:rJ({name:rp(),value:rp()}),context:rJ({arguments:r9(rp(),rp()).optional()}).optional()}),sk=aw.extend({method:r5("completion/complete"),params:sw}),sx=aS.extend({completion:rB({values:rH(rp()).max(100),total:ae(rR().int()),hasMore:ae(rZ())})}),sS=rJ({uri:rp().startsWith("file://"),name:rp().optional(),_meta:r9(rp(),rL()).optional()}),sE=aw.extend({method:r5("roots/list"),params:ab.optional()}),sT=aS.extend({roots:rH(sS)}),sP=ax.extend({method:r5("notifications/roots/list_changed"),params:ak.optional()});rW([aW,aK,sk,iX,iN,ij,im,ig,ib,ik,ix,iG,iH,a3,ie,it,ia]),rW([aC,aX,aG,sP,a8]),rW([az,st,sr,s_,sT,a7,ir,a6]),rW([aW,se,sy,sE,a3,ie,it,ia]),rW([aC,aX,i1,iE,iw,iW,iF,a8,sv]),rW([az,aB,sx,iq,iO,iy,iv,i$,iJ,iK,a7,ir,a6]);class sj 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===oC.UrlElicitationRequired&&r&&r.elicitations?new sO(r.elicitations,t):new sj(e,t,r)}}class sO extends sj{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(oC.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}class sI{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,aN.parse(JSON.parse(e))}clear(){this._buffer=void 0}}class sN{constructor(e=n.stdin,t=n.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new sI,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)})}}(oO=oA||(oA={})).assertEqual=e=>{},oO.assertIs=function(e){},oO.assertNever=function(e){throw Error()},oO.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},oO.getValidEnumValues=e=>{let t=oO.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return oO.objectValues(r)},oO.objectValues=e=>oO.objectKeys(e).map(function(t){return e[t]}),oO.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},oO.find=(e,t)=>{for(let r of e)if(t(r))return r},oO.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,oO.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},oO.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(oM||(oM={})).mergeShapes=(e,t)=>({...e,...t});let sz=oA.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sR=e=>{switch(typeof e){case"undefined":return sz.undefined;case"string":return sz.string;case"number":return Number.isNaN(e)?sz.nan:sz.number;case"boolean":return sz.boolean;case"function":return sz.function;case"bigint":return sz.bigint;case"symbol":return sz.symbol;case"object":if(Array.isArray(e))return sz.array;if(null===e)return sz.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return sz.promise;if("undefined"!=typeof Map&&e instanceof Map)return sz.map;if("undefined"!=typeof Set&&e instanceof Set)return sz.set;if("undefined"!=typeof Date&&e instanceof Date)return sz.date;return sz.object;default:return sz.unknown}},sC=oA.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 sA 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 sA))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,oA.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()}}sA.create=e=>new sA(e);let sM=(e,t)=>{let r;switch(e.code){case sC.invalid_type:r=e.received===sz.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case sC.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,oA.jsonStringifyReplacer)}`;break;case sC.unrecognized_keys:r=`Unrecognized key(s) in object: ${oA.joinValues(e.keys,", ")}`;break;case sC.invalid_union:r="Invalid input";break;case sC.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${oA.joinValues(e.options)}`;break;case sC.invalid_enum_value:r=`Invalid enum value. Expected ${oA.joinValues(e.options)}, received '${e.received}'`;break;case sC.invalid_arguments:r="Invalid function arguments";break;case sC.invalid_return_type:r="Invalid function return type";break;case sC.invalid_date:r="Invalid date";break;case sC.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}"`:oA.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case sC.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 sC.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 sC.custom:r="Invalid input";break;case sC.invalid_intersection_types:r="Intersection results could not be merged";break;case sC.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case sC.not_finite:r="Number must be finite";break;default:r=t.defaultError,oA.assertNever(e)}return{message:r}},sZ=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 sD(e,t){let r=sZ({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,sM,void 0].filter(e=>!!e)});e.common.issues.push(r)}class sq{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 sF;"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 sq.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 sF;"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 sF=Object.freeze({status:"aborted"}),sL=e=>({status:"dirty",value:e}),sV=e=>({status:"valid",value:e}),sU=e=>"undefined"!=typeof Promise&&e instanceof Promise;(oI=oZ||(oZ={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},oI.toString=e=>"string"==typeof e?e:e?.message;class sH{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 sK=(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 sA(e.common.issues);return this._error=t,this._error}}};function sJ(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 sB{get description(){return this._def.description}_getType(e){return sR(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:sR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sq,ctx:{common:e.parent.common,data:e.data,parsedType:sR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(sU(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:sR(e)},a=this._parseSync({data:e,path:r.path,parent:r});return sK(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sR(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:sR(e)},a=this._parse({data:e,path:r.path,parent:r});return sK(r,await (sU(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let i=e(r),s=()=>a.addIssue({code:sC.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 nI({schema:this,typeName:oD.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 nN.create(this,this._def)}nullable(){return nz.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nh.create(this)}promise(){return nO.create(this,this._def)}or(e){return ny.create([this,e],this._def)}and(e){return n_.create(this,e,this._def)}transform(e){return new nI({...sJ(this._def),schema:this,typeName:oD.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new nR({...sJ(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:oD.ZodDefault})}brand(){return new nM({typeName:oD.ZodBranded,type:this,...sJ(this._def)})}catch(e){return new nC({...sJ(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:oD.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return nZ.create(this,e)}readonly(){return nD.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let sG=/^c[^\s-]{8,}$/i,sW=/^[0-9a-z]+$/,sY=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sQ=/^[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,sX=/^[a-z0-9_-]{21}$/i,s0=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,s1=/^[-+]?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)?)??$/,s9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,s2=/^(?:(?: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])$/,s4=/^(?:(?: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])$/,s6=/^(([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]))$/,s5=/^(([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])$/,s8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,s3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,s7="((\\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])))",ne=RegExp(`^${s7}$`);function nt(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 nr extends sB{_parse(e){var t,r,i,s;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==sz.string){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.string,received:t.parsedType}),sF}let o=new sq;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(sD(n=this._getOrReturnCtx(e,n),{code:sC.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("max"===l.kind)e.data.length>l.value&&(sD(n=this._getOrReturnCtx(e,n),{code:sC.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("length"===l.kind){let t=e.data.length>l.value,r=e.data.length<l.value;(t||r)&&(n=this._getOrReturnCtx(e,n),t?sD(n,{code:sC.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&sD(n,{code:sC.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)s9.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"email",code:sC.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)a||(a=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:sC.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)sQ.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:sC.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)sX.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:sC.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)sG.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:sC.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)sW.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:sC.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)sY.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:sC.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{sD(n=this._getOrReturnCtx(e,n),{validation:"url",code:sC.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"regex",code:sC.invalid_string,message:l.message}),o.dirty())):"trim"===l.kind?e.data=e.data.trim():"includes"===l.kind?e.data.includes(l.value,l.position)||(sD(n=this._getOrReturnCtx(e,n),{code:sC.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):"toLowerCase"===l.kind?e.data=e.data.toLowerCase():"toUpperCase"===l.kind?e.data=e.data.toUpperCase():"startsWith"===l.kind?e.data.startsWith(l.value)||(sD(n=this._getOrReturnCtx(e,n),{code:sC.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(sD(n=this._getOrReturnCtx(e,n),{code:sC.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${s7}T${nt(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(e.data)||(sD(n=this._getOrReturnCtx(e,n),{code:sC.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?ne.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{code:sC.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${nt(l)}$`).test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{code:sC.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?s1.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"duration",code:sC.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(t=e.data,!(("v4"===(r=l.version)||!r)&&s2.test(t)||("v6"===r||!r)&&s6.test(t))&&1&&(sD(n=this._getOrReturnCtx(e,n),{validation:"ip",code:sC.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!s0.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,l.alg)&&(sD(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:sC.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(i=e.data,!(("v4"===(s=l.version)||!s)&&s4.test(i)||("v6"===s||!s)&&s5.test(i))&&1&&(sD(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:sC.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?s8.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"base64",code:sC.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?s3.test(e.data)||(sD(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:sC.invalid_string,message:l.message}),o.dirty()):oA.assertNever(l);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:sC.invalid_string,...oZ.errToObj(r)})}_addCheck(e){return new nr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...oZ.errToObj(e)})}url(e){return this._addCheck({kind:"url",...oZ.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...oZ.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...oZ.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...oZ.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...oZ.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...oZ.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...oZ.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...oZ.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...oZ.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...oZ.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...oZ.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...oZ.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,...oZ.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,...oZ.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...oZ.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...oZ.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...oZ.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...oZ.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...oZ.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...oZ.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...oZ.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...oZ.errToObj(t)})}nonempty(e){return this.min(1,oZ.errToObj(e))}trim(){return new nr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new nr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new nr({...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}}nr.create=e=>new nr({checks:[],typeName:oD.ZodString,coerce:e?.coerce??!1,...sJ(e)});class na extends sB{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)!==sz.number){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.number,received:t.parsedType}),sF}let r=new sq;for(let a of this._def.checks)"int"===a.kind?oA.isInteger(e.data)||(sD(t=this._getOrReturnCtx(e,t),{code:sC.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.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)&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.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)&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(sD(t=this._getOrReturnCtx(e,t),{code:sC.not_finite,message:a.message}),r.dirty()):oA.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,oZ.toString(t))}gt(e,t){return this.setLimit("min",e,!1,oZ.toString(t))}lte(e,t){return this.setLimit("max",e,!0,oZ.toString(t))}lt(e,t){return this.setLimit("max",e,!1,oZ.toString(t))}setLimit(e,t,r,a){return new na({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:oZ.toString(a)}]})}_addCheck(e){return new na({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:oZ.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:oZ.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:oZ.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:oZ.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:oZ.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:oZ.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:oZ.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:oZ.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:oZ.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&&oA.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)}}na.create=e=>new na({checks:[],typeName:oD.ZodNumber,coerce:e?.coerce||!1,...sJ(e)});class ni extends sB{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)!==sz.bigint)return this._getInvalidInput(e);let r=new sq;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.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)&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):oA.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.bigint,received:t.parsedType}),sF}gte(e,t){return this.setLimit("min",e,!0,oZ.toString(t))}gt(e,t){return this.setLimit("min",e,!1,oZ.toString(t))}lte(e,t){return this.setLimit("max",e,!0,oZ.toString(t))}lt(e,t){return this.setLimit("max",e,!1,oZ.toString(t))}setLimit(e,t,r,a){return new ni({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:oZ.toString(a)}]})}_addCheck(e){return new ni({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:oZ.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:oZ.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:oZ.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:oZ.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:oZ.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}}ni.create=e=>new ni({checks:[],typeName:oD.ZodBigInt,coerce:e?.coerce??!1,...sJ(e)});class ns extends sB{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==sz.boolean){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.boolean,received:t.parsedType}),sF}return sV(e.data)}}ns.create=e=>new ns({typeName:oD.ZodBoolean,coerce:e?.coerce||!1,...sJ(e)});class nn extends sB{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==sz.date){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.date,received:t.parsedType}),sF}if(Number.isNaN(e.data.getTime()))return sD(this._getOrReturnCtx(e),{code:sC.invalid_date}),sF;let r=new sq;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(sD(t=this._getOrReturnCtx(e,t),{code:sC.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):oA.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new nn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:oZ.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:oZ.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}}nn.create=e=>new nn({checks:[],coerce:e?.coerce||!1,typeName:oD.ZodDate,...sJ(e)});class no extends sB{_parse(e){if(this._getType(e)!==sz.symbol){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.symbol,received:t.parsedType}),sF}return sV(e.data)}}no.create=e=>new no({typeName:oD.ZodSymbol,...sJ(e)});class nl extends sB{_parse(e){if(this._getType(e)!==sz.undefined){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.undefined,received:t.parsedType}),sF}return sV(e.data)}}nl.create=e=>new nl({typeName:oD.ZodUndefined,...sJ(e)});class nu extends sB{_parse(e){if(this._getType(e)!==sz.null){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.null,received:t.parsedType}),sF}return sV(e.data)}}nu.create=e=>new nu({typeName:oD.ZodNull,...sJ(e)});class nd extends sB{constructor(){super(...arguments),this._any=!0}_parse(e){return sV(e.data)}}nd.create=e=>new nd({typeName:oD.ZodAny,...sJ(e)});class nc extends sB{constructor(){super(...arguments),this._unknown=!0}_parse(e){return sV(e.data)}}nc.create=e=>new nc({typeName:oD.ZodUnknown,...sJ(e)});class np extends sB{_parse(e){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.never,received:t.parsedType}),sF}}np.create=e=>new np({typeName:oD.ZodNever,...sJ(e)});class nf extends sB{_parse(e){if(this._getType(e)!==sz.undefined){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.void,received:t.parsedType}),sF}return sV(e.data)}}nf.create=e=>new nf({typeName:oD.ZodVoid,...sJ(e)});class nh extends sB{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==sz.array)return sD(t,{code:sC.invalid_type,expected:sz.array,received:t.parsedType}),sF;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(sD(t,{code:e?sC.too_big:sC.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&&(sD(t,{code:sC.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&&(sD(t,{code:sC.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 sH(t,e,t.path,r)))).then(e=>sq.mergeArray(r,e));let i=[...t.data].map((e,r)=>a.type._parseSync(new sH(t,e,t.path,r)));return sq.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new nh({...this._def,minLength:{value:e,message:oZ.toString(t)}})}max(e,t){return new nh({...this._def,maxLength:{value:e,message:oZ.toString(t)}})}length(e,t){return new nh({...this._def,exactLength:{value:e,message:oZ.toString(t)}})}nonempty(e){return this.min(1,e)}}nh.create=(e,t)=>new nh({type:e,minLength:null,maxLength:null,exactLength:null,typeName:oD.ZodArray,...sJ(t)});class nm extends sB{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=oA.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==sz.object){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.object,received:t.parsedType}),sF}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof np&&"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 sH(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof np){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&&(sD(r,{code:sC.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 sH(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=>sq.mergeObjectSync(t,e)):sq.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return oZ.errToObj,new nm({...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:oZ.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new nm({...this._def,unknownKeys:"strip"})}passthrough(){return new nm({...this._def,unknownKeys:"passthrough"})}extend(e){return new nm({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new nm({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:oD.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new nm({...this._def,catchall:e})}pick(e){let t={};for(let r of oA.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new nm({...this._def,shape:()=>t})}omit(e){let t={};for(let r of oA.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new nm({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof nm){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=nN.create(e(i))}return new nm({...t._def,shape:()=>r})}if(t instanceof nh)return new nh({...t._def,type:e(t.element)});if(t instanceof nN)return nN.create(e(t.unwrap()));if(t instanceof nz)return nz.create(e(t.unwrap()));if(t instanceof nb)return nb.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of oA.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new nm({...this._def,shape:()=>t})}required(e){let t={};for(let r of oA.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof nN;)e=e._def.innerType;t[r]=e}return new nm({...this._def,shape:()=>t})}keyof(){return nT(oA.objectKeys(this.shape))}}nm.create=(e,t)=>new nm({shape:()=>e,unknownKeys:"strip",catchall:np.create(),typeName:oD.ZodObject,...sJ(t)}),nm.strictCreate=(e,t)=>new nm({shape:()=>e,unknownKeys:"strict",catchall:np.create(),typeName:oD.ZodObject,...sJ(t)}),nm.lazycreate=(e,t)=>new nm({shape:e,unknownKeys:"strip",catchall:np.create(),typeName:oD.ZodObject,...sJ(t)});class ny extends sB{_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 sA(e.ctx.common.issues));return sD(t,{code:sC.invalid_union,unionErrors:r}),sF});{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 sA(e));return sD(t,{code:sC.invalid_union,unionErrors:i}),sF}}get options(){return this._def.options}}ny.create=(e,t)=>new ny({options:e,typeName:oD.ZodUnion,...sJ(t)});let ng=e=>{if(e instanceof nS)return ng(e.schema);if(e instanceof nI)return ng(e.innerType());if(e instanceof nE)return[e.value];if(e instanceof nP)return e.options;if(e instanceof nj)return oA.objectValues(e.enum);else if(e instanceof nR)return ng(e._def.innerType);else if(e instanceof nl)return[void 0];else if(e instanceof nu)return[null];else if(e instanceof nN)return[void 0,...ng(e.unwrap())];else if(e instanceof nz)return[null,...ng(e.unwrap())];else if(e instanceof nM)return ng(e.unwrap());else if(e instanceof nD)return ng(e.unwrap());else if(e instanceof nC)return ng(e._def.innerType);else return[]};class nv extends sB{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==sz.object)return sD(t,{code:sC.invalid_type,expected:sz.object,received:t.parsedType}),sF;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}):(sD(t,{code:sC.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),sF)}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=ng(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 nv({typeName:oD.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...sJ(r)})}}class n_ extends sB{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return sF;let i=function e(t,r){let a=sR(t),i=sR(r);if(t===r)return{valid:!0,data:t};if(a===sz.object&&i===sz.object){let a=oA.objectKeys(r),i=oA.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===sz.array&&i===sz.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===sz.date&&i===sz.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}):(sD(r,{code:sC.invalid_intersection_types}),sF)};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}))}}n_.create=(e,t,r)=>new n_({left:e,right:t,typeName:oD.ZodIntersection,...sJ(r)});class nb extends sB{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==sz.array)return sD(r,{code:sC.invalid_type,expected:sz.array,received:r.parsedType}),sF;if(r.data.length<this._def.items.length)return sD(r,{code:sC.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),sF;!this._def.rest&&r.data.length>this._def.items.length&&(sD(r,{code:sC.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 sH(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>sq.mergeArray(t,e)):sq.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new nb({...this._def,rest:e})}}nb.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new nb({items:e,typeName:oD.ZodTuple,rest:null,...sJ(t)})};class n$ extends sB{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!==sz.object)return sD(r,{code:sC.invalid_type,expected:sz.object,received:r.parsedType}),sF;let a=[],i=this._def.keyType,s=this._def.valueType;for(let e in r.data)a.push({key:i._parse(new sH(r,e,r.path,e)),value:s._parse(new sH(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?sq.mergeObjectAsync(t,a):sq.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new n$(t instanceof sB?{keyType:e,valueType:t,typeName:oD.ZodRecord,...sJ(r)}:{keyType:nr.create(),valueType:e,typeName:oD.ZodRecord,...sJ(t)})}}class nw extends sB{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!==sz.map)return sD(r,{code:sC.invalid_type,expected:sz.map,received:r.parsedType}),sF;let a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([e,t],s)=>({key:a._parse(new sH(r,e,r.path,[s,"key"])),value:i._parse(new sH(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 sF;("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 sF;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}nw.create=(e,t,r)=>new nw({valueType:t,keyType:e,typeName:oD.ZodMap,...sJ(r)});class nk extends sB{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==sz.set)return sD(r,{code:sC.invalid_type,expected:sz.set,received:r.parsedType}),sF;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(sD(r,{code:sC.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&&(sD(r,{code:sC.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 sF;"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 sH(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>s(e)):s(n)}min(e,t){return new nk({...this._def,minSize:{value:e,message:oZ.toString(t)}})}max(e,t){return new nk({...this._def,maxSize:{value:e,message:oZ.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}nk.create=(e,t)=>new nk({valueType:e,minSize:null,maxSize:null,typeName:oD.ZodSet,...sJ(t)});class nx extends sB{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==sz.function)return sD(t,{code:sC.invalid_type,expected:sz.function,received:t.parsedType}),sF;function r(e,r){return sZ({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,sM,sM].filter(e=>!!e),issueData:{code:sC.invalid_arguments,argumentsError:r}})}function a(e,r){return sZ({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,sM,sM].filter(e=>!!e),issueData:{code:sC.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof nO){let e=this;return sV(async function(...t){let n=new sA([]),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 sV(function(...t){let n=e._def.args.safeParse(t,i);if(!n.success)throw new sA([r(t,n.error)]);let o=Reflect.apply(s,this,n.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new sA([a(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new nx({...this._def,args:nb.create(e).rest(nc.create())})}returns(e){return new nx({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new nx({args:e||nb.create([]).rest(nc.create()),returns:t||nc.create(),typeName:oD.ZodFunction,...sJ(r)})}}class nS extends sB{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})}}nS.create=(e,t)=>new nS({getter:e,typeName:oD.ZodLazy,...sJ(t)});class nE extends sB{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return sD(t,{received:t.data,code:sC.invalid_literal,expected:this._def.value}),sF}return{status:"valid",value:e.data}}get value(){return this._def.value}}function nT(e,t){return new nP({values:e,typeName:oD.ZodEnum,...sJ(t)})}nE.create=(e,t)=>new nE({value:e,typeName:oD.ZodLiteral,...sJ(t)});class nP extends sB{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return sD(t,{expected:oA.joinValues(r),received:t.parsedType,code:sC.invalid_type}),sF}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 sD(t,{received:t.data,code:sC.invalid_enum_value,options:r}),sF}return sV(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 nP.create(e,{...this._def,...t})}exclude(e,t=this._def){return nP.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}nP.create=nT;class nj extends sB{_parse(e){let t=oA.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==sz.string&&r.parsedType!==sz.number){let e=oA.objectValues(t);return sD(r,{expected:oA.joinValues(e),received:r.parsedType,code:sC.invalid_type}),sF}if(this._cache||(this._cache=new Set(oA.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=oA.objectValues(t);return sD(r,{received:r.data,code:sC.invalid_enum_value,options:e}),sF}return sV(e.data)}get enum(){return this._def.values}}nj.create=(e,t)=>new nj({values:e,typeName:oD.ZodNativeEnum,...sJ(t)});class nO extends sB{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==sz.promise&&!1===t.common.async?(sD(t,{code:sC.invalid_type,expected:sz.promise,received:t.parsedType}),sF):sV((t.parsedType===sz.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}nO.create=(e,t)=>new nO({type:e,typeName:oD.ZodPromise,...sJ(t)});class nI extends sB{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oD.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=>{sD(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 sF;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?sF:"dirty"===a.status||"dirty"===t.value?sL(a.value):a});{if("aborted"===t.value)return sF;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?sF:"dirty"===a.status||"dirty"===t.value?sL(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?sF:("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?sF:("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?sF: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 sF;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}}oA.assertNever(a)}}nI.create=(e,t,r)=>new nI({schema:e,typeName:oD.ZodEffects,effect:t,...sJ(r)}),nI.createWithPreprocess=(e,t,r)=>new nI({schema:t,effect:{type:"preprocess",transform:e},typeName:oD.ZodEffects,...sJ(r)});class nN extends sB{_parse(e){return this._getType(e)===sz.undefined?sV(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nN.create=(e,t)=>new nN({innerType:e,typeName:oD.ZodOptional,...sJ(t)});class nz extends sB{_parse(e){return this._getType(e)===sz.null?sV(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nz.create=(e,t)=>new nz({innerType:e,typeName:oD.ZodNullable,...sJ(t)});class nR extends sB{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===sz.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}nR.create=(e,t)=>new nR({innerType:e,typeName:oD.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...sJ(t)});class nC extends sB{_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 sU(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new sA(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new sA(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}nC.create=(e,t)=>new nC({innerType:e,typeName:oD.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...sJ(t)});class nA extends sB{_parse(e){if(this._getType(e)!==sz.nan){let t=this._getOrReturnCtx(e);return sD(t,{code:sC.invalid_type,expected:sz.nan,received:t.parsedType}),sF}return{status:"valid",value:e.data}}}nA.create=e=>new nA({typeName:oD.ZodNaN,...sJ(e)}),Symbol("zod_brand");class nM extends sB{_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 nZ extends sB{_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?sF:"dirty"===e.status?(t.dirty(),sL(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?sF:"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 nZ({in:e,out:t,typeName:oD.ZodPipeline})}}class nD extends sB{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return sU(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}nD.create=(e,t)=>new nD({innerType:e,typeName:oD.ZodReadonly,...sJ(t)}),nm.lazycreate,(oN=oD||(oD={})).ZodString="ZodString",oN.ZodNumber="ZodNumber",oN.ZodNaN="ZodNaN",oN.ZodBigInt="ZodBigInt",oN.ZodBoolean="ZodBoolean",oN.ZodDate="ZodDate",oN.ZodSymbol="ZodSymbol",oN.ZodUndefined="ZodUndefined",oN.ZodNull="ZodNull",oN.ZodAny="ZodAny",oN.ZodUnknown="ZodUnknown",oN.ZodNever="ZodNever",oN.ZodVoid="ZodVoid",oN.ZodArray="ZodArray",oN.ZodObject="ZodObject",oN.ZodUnion="ZodUnion",oN.ZodDiscriminatedUnion="ZodDiscriminatedUnion",oN.ZodIntersection="ZodIntersection",oN.ZodTuple="ZodTuple",oN.ZodRecord="ZodRecord",oN.ZodMap="ZodMap",oN.ZodSet="ZodSet",oN.ZodFunction="ZodFunction",oN.ZodLazy="ZodLazy",oN.ZodLiteral="ZodLiteral",oN.ZodEnum="ZodEnum",oN.ZodEffects="ZodEffects",oN.ZodNativeEnum="ZodNativeEnum",oN.ZodOptional="ZodOptional",oN.ZodNullable="ZodNullable",oN.ZodDefault="ZodDefault",oN.ZodCatch="ZodCatch",oN.ZodPromise="ZodPromise",oN.ZodBranded="ZodBranded",oN.ZodPipeline="ZodPipeline",oN.ZodReadonly="ZodReadonly",nr.create,na.create,nA.create,ni.create,ns.create,nn.create,no.create,nl.create,nu.create,nd.create,nc.create,np.create,nf.create,nh.create;let nq=nm.create;nm.strictCreate,ny.create,nv.create,n_.create,nb.create,n$.create,nw.create,nk.create,nx.create,nS.create,nE.create,nP.create,nj.create,nO.create,nI.create,nN.create,nz.create,nI.createWithPreprocess,nZ.create;let nF=o("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");eF.init(e,t),e.def=t,e.type=t.type,e.parse=(t,r)=>V(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>J(e,t,r),e.parseAsync=async(t,r)=>H(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>G(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)]}),e.clone=(t,r)=>j(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e)}),nL=o("ZodMiniObject",(e,t)=>{tm.init(e,t),nF.init(e,t),v(e,"shape",()=>t.shape)});function nV(e,t){return new nL({type:"object",shape:e??{},...O(t)})}function nU(e){return!!e._zod}function nH(e){let t=Object.values(e);if(0===t.length)return nV({});let r=t.every(nU),a=t.every(e=>!nU(e));if(r)return nV(e);if(a)return nq(e);throw Error("Mixed Zod versions detected in object shape.")}function nK(e,t){return nU(e)?J(e,t):e.safeParse(t)}async function nJ(e,t){return nU(e)?await G(e,t):await e.safeParseAsync(t)}function nB(e){let t;if(e&&(t=nU(e)?e._zod?.def?.shape:e.shape)){if("function"==typeof t)try{return t()}catch{return}return t}}function nG(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 nH(e)}if(nU(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 nW(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 nY(e){if(nU(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 nQ(e){return"completed"===e||"failed"===e||"cancelled"===e}let nX=Symbol("Let zodToJsonSchema decide on which parser to use"),n0={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"},n1=(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 n9(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?n1(t,e.currentPath):t.join("/")}}function n2(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function n4(e,t,r,a,i){e[t]=r,n2(e,t,a,i)}function n6(e,t){return oy(e.type._def,t)}let n5=/^[cC][^\s-]{8,}$/,n8=/^[0-9a-z]+$/,n3=/^[0-9A-HJKMNP-TV-Z]{26}$/,n7=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,oe=()=>(void 0===s&&(s=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),s),ot=/^(?:(?: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])$/,or=/^(([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])$/,oa=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,os=/^[a-zA-Z0-9_-]{21}$/,on=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function oo(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":n4(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":n4(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":od(r,"email",a.message,t);break;case"format:idn-email":od(r,"idn-email",a.message,t);break;case"pattern:zod":oc(r,n7,a.message,t)}break;case"url":od(r,"uri",a.message,t);break;case"uuid":od(r,"uuid",a.message,t);break;case"regex":oc(r,a.regex,a.message,t);break;case"cuid":oc(r,n5,a.message,t);break;case"cuid2":oc(r,n8,a.message,t);break;case"startsWith":oc(r,RegExp(`^${ol(a.value,t)}`),a.message,t);break;case"endsWith":oc(r,RegExp(`${ol(a.value,t)}$`),a.message,t);break;case"datetime":od(r,"date-time",a.message,t);break;case"date":od(r,"date",a.message,t);break;case"time":od(r,"time",a.message,t);break;case"duration":od(r,"duration",a.message,t);break;case"length":n4(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),n4(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":oc(r,RegExp(ol(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&od(r,"ipv4",a.message,t),"v4"!==a.version&&od(r,"ipv6",a.message,t);break;case"base64url":oc(r,oi,a.message,t);break;case"jwt":oc(r,on,a.message,t);break;case"cidr":"v6"!==a.version&&oc(r,ot,a.message,t),"v4"!==a.version&&oc(r,or,a.message,t);break;case"emoji":oc(r,oe(),a.message,t);break;case"ulid":oc(r,n3,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":od(r,"binary",a.message,t);break;case"contentEncoding:base64":n4(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":oc(r,oa,a.message,t)}break;case"nanoid":oc(r,os,a.message,t)}return r}function ol(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)ou.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let ou=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function od(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}}})):n4(e,"format",t,r,a)}function oc(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:op(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):n4(e,"pattern",op(t,a),r,a)}function op(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
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"},t5=(e,t,r,a)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},t8=(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:t5,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:t8,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 r5({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)=>{e8.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)}),r5=s("ZodJWT",(e,t)=>{te.init(e,t),rF.init(e,t)}),r8=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 r8({type:"number",checks:[],...ee(e)})}let r7=s("ZodNumberFormat",(e,t)=>{tr.init(e,t),r8.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)=>t5(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)=>t8(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,a5=ac({jsonrpc:ax("2.0"),...a1.shape}).strict(),a8=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,a5,a8,a3]);ah([a8,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({}))}),i5=ix.extend({method:ax("prompts/list")}),i8=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,i5,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,i8,iK,iG,iQ,sh,sf,iz,iC,iP]);class s5 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 s8(r.elicitations,t):new s5(e,t,r)}}class s8 extends s5{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 n8.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 n5)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 n8){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 n5 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}}n5.create=(e,t)=>new n5({values:e,typeName:lr.ZodNativeEnum,...nh(t)});class n8 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})))}}n8.create=(e,t)=>new n8({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,n5.create,n8.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
27
69
  ]))`;continue}else if("$"===a[e]){i+=`($|(?=[\r
28
70
  ]))`;continue}}if(r.s&&"."===a[e]){i+=n?`${a[e]}\r
29
71
  `:`[${a[e]}\r
30
- ]`;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 of(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===oD.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:oy(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??n9(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:oy(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===oD.ZodString&&e.keyType._def.checks?.length){let{type:a,...i}=oo(e.keyType._def,t);return{...r,propertyNames:i}}if(e.keyType?._def.typeName===oD.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===oD.ZodBranded&&e.keyType._def.type._def.typeName===oD.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...i}=n6(e.keyType._def,t);return{...r,propertyNames:i}}return r}let oh={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},om=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>oy(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 oy(e,t,r=!1){let a=t.seen.get(e);if(t.override){let i=t.override?.(e,t,a,r);if(i!==nX)return i}if(a&&!r){let e=og(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 oD.ZodString:return oo(e,r);case oD.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",n2(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?n4(a,"minimum",t.value,t.message,r):n4(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),n4(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?n4(a,"maximum",t.value,t.message,r):n4(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),n4(a,"maximum",t.value,t.message,r));break;case"multipleOf":n4(a,"multipleOf",t.value,t.message,r)}return a;case oD.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=oy(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 oy(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 oD.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?n4(i,"minimum",t.value,t.message,r):n4(i,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(i.exclusiveMinimum=!0),n4(i,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?n4(i,"maximum",t.value,t.message,r):n4(i,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(i.exclusiveMaximum=!0),n4(i,"maximum",t.value,t.message,r));break;case"multipleOf":n4(i,"multipleOf",t.value,t.message,r)}return i;case oD.ZodBoolean:return{type:"boolean"};case oD.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":n4(o,"minimum",e.value,e.message,n);break;case"max":n4(o,"maximum",e.value,e.message,n)}return o}}(e,r);case oD.ZodUndefined:return{not:n9(r)};case oD.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case oD.ZodArray:let s;return s={type:"array"},e.type?._def&&e.type?._def?.typeName!==oD.ZodAny&&(s.items=oy(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&n4(s,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&n4(s,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(n4(s,"minItems",e.exactLength.value,e.exactLength.message,r),n4(s,"maxItems",e.exactLength.value,e.exactLength.message,r)),s;case oD.ZodUnion:case oD.ZodDiscriminatedUnion:if("openApi3"===r.target)return om(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 om(e,r);case oD.ZodIntersection:let o,l,u;return o=[oy(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),oy(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 oD.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>oy(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:oy(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>oy(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case oD.ZodRecord:return of(e,r);case oD.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 oD.ZodEnum:return{type:"string",enum:Array.from(e.values)};case oD.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 oD.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=oy(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let h=oy(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return h&&{anyOf:[h,{type:"null"}]};case oD.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return oy(e.innerType._def,r);let m=oy(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return m?{anyOf:[{not:n9(r)},m]}:n9(r);case oD.ZodMap:if("record"===r.mapStrategy)return of(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[oy(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||n9(r),oy(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||n9(r)],minItems:2,maxItems:2}};case oD.ZodSet:let y;return y={type:"array",uniqueItems:!0,items:oy(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&n4(y,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&n4(y,"maxItems",e.maxSize.value,e.maxSize.message,r),y;case oD.ZodLazy:return()=>e.getter()._def;case oD.ZodPromise:return oy(e.type._def,r);case oD.ZodNaN:case oD.ZodNever:return"openAi"===r.target?void 0:{not:n9({...r,currentPath:[...r.currentPath,"not"]})};case oD.ZodEffects:return"input"===r.effectStrategy?oy(e.schema._def,r):n9(r);case oD.ZodAny:case oD.ZodUnknown:return n9(r);case oD.ZodDefault:return{...oy(e.innerType._def,r),default:e.defaultValue()};case oD.ZodBranded:return n6(e,r);case oD.ZodReadonly:case oD.ZodCatch:return oy(e.innerType._def,r);case oD.ZodPipeline:if("input"===r.pipeStrategy)return oy(e.in._def,r);if("output"===r.pipeStrategy)return oy(e.out._def,r);let g=oy(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=oy(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",g?"1":"0"]});return{allOf:[g,v].filter(e=>void 0!==e)};case oD.ZodFunction:case oD.ZodVoid:case oD.ZodSymbol:default:return}})(e,e.typeName,t),n="function"==typeof s?oy(s(),t):s;if(n&&ov(e,t,n),t.postProcess){let r=t.postProcess(n,e,t);return i.jsonSchema=n,r}return i.jsonSchema=n,n}let og=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:n1(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`),n9(t);return"seen"===t.$refStrategy?n9(t):void 0}},ov=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function o_(e,t){if(nU(e)){var r;return function(e,t){if(e instanceof tF){let r=new tX(t),a={};for(let t of e._idmap.entries()){let[e,a]=t;r.process(a)}let i={},s={registry:e,uri:t?.uri,defs:a};for(let a of e._idmap.entries()){let[e,n]=a;i[e]=r.emit(n,{...t,external:s})}return Object.keys(a).length>0&&(i.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:i}}let r=new tX(t);return r.process(e),r.emit(e,t)}(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?{...n0,name:t}:{...n0,...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]:oy(r._def,{...i,currentPath:[...i.basePath,i.definitionPath,t]},!0)??n9(i)}),{}):void 0,n="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,o=oy(e._def,void 0===n?i:{...i,currentPath:[...i.basePath,i.definitionPath,n]},!1)??n9(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 ob(e){let t=nB(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let a=nY(r);if("string"!=typeof a)throw Error("Schema method literal must be a string");return a}function o$(e,t){let r=nK(e,t);if(!r.success)throw r.error;return r.data}class ow{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(aC,e=>{this._oncancel(e)}),this.setNotificationHandler(aX,e=>{this._onprogress(e)}),this.setRequestHandler(aW,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(a3,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new sj(oC.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(ie,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 sj(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 sj(oC.InvalidParams,`Task not found: ${a}`);if(!nQ(i.status))return await this._waitForTaskUpdate(a,t.signal),await r();if(nQ(i.status)){let e=await this._taskStore.getTaskResult(a,t.sessionId);return this._clearTaskQueue(a),{...e,_meta:{...e._meta,[af]:{taskId:a}}}}return await r()};return await r()}),this.setRequestHandler(it,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 sj(oC.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 sj(oC.InvalidParams,`Task not found: ${e.params.taskId}`);if(nQ(r.status))throw new sj(oC.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 sj(oC.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...a}}catch(e){if(e instanceof sj)throw e;throw new sj(oC.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),sj.fromError(oC.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),aO.safeParse(e).success||aI.safeParse(e).success)this._onresponse(e);else if(aP(e))this._onrequest(e,t);else aj.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=sj.fromError(oC.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?.[af]?.taskId;if(void 0===a){let t={jsonrpc:"2.0",id:e.id,error:{code:oC.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,a$.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 sj(oC.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:oC.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(aO.safeParse(e).success?e:new sj(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(aO.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(aO.safeParse(e).success?e:sj.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 sj?e:new sj(oC.InternalError,String(e))}}return}try{let i=await this.request(e,a6,r);if(i.task)a=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new sj(oC.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:e},nQ(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 sj(oC.InternalError,`Task ${a} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new sj(oC.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 sj?e:new sj(oC.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||{},[af]: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 sj?e:new sj(oC.RequestTimeout,String(e)))};this._responseHandlers.set(c,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return u(e);try{let r=nK(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(sj.fromError(oC.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},a7,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},ir,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},ii,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||{},[af]: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||{},[af]: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||{},[af]:t.relatedTask}}}),await this._transport.send(a,t)}setRequestHandler(e,t){let r=ob(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,a)=>Promise.resolve(t(o$(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=ob(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(o$(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&&aP(r.message)){let t=r.message.id,a=this._requestResolvers.get(t);a?(a(new sj(oC.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 sj(oC.InvalidRequest,"Request cancelled"));let i=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(i),a(new sj(oC.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 sj(oC.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=a8.parse({method:"notifications/tasks/status",params:s});await this.notification(t),nQ(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 sj(oC.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(nQ(s.status))throw new sj(oC.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=a8.parse({method:"notifications/tasks/status",params:n});await this.notification(t),nQ(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function ok(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var ox,oS,oE,oT,oP,oj,oO,oI,oN,oz,oR,oC,oA,oM,oZ,oD,oq,oF=r(8825),oL=r(1712);class oV{constructor(e){this._ajv=e??function(){let e=new oF({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return oL(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 oU{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 oH extends ow{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(iY.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 oV,this.setRequestHandler(aK,e=>this._oninitialize(e)),this.setNotificationHandler(aG,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(iX,async(e,t)=>{let r=t.sessionId||t.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=e.params,i=iY.safeParse(a);return i.success&&this._loggingLevels.set(r,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new oU(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];ok(i)&&ok(a)?r[e]={...i,...a}:r[e]=a}return r}(this._capabilities,e)}setRequestHandler(e,t){let r,a=nB(e),i=a?.method;if(!i)throw Error("Schema is missing a method literal");if(nU(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=nK(iG,e);if(!a.success){let e=a.error instanceof Error?a.error.message:String(a.error);throw new sj(oC.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=a.data,s=await Promise.resolve(t(e,r));if(i.task){let e=nK(a6,s);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new sj(oC.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=nK(iJ,s);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new sj(oC.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:ap.includes(t)?t:ac,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"},az)}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},sr,t):this.request({method:"sampling/createMessage",params:e},st,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},s_,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},s_,t);if("accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new sj(oC.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof sj)throw e;throw new sj(oC.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},sT,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 oK=Symbol.for("mcp.completable");function oJ(e){return!!e&&"object"==typeof e&&oK in e}(oq||(oq={})).Completable="McpCompletable";class oB{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){oB.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)oB.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(oB.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)oB.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){oB.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+="$",oB.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 oG=/^[A-Za-z0-9._-]{1,128}$/;function oW(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"),!oG.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 oY{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 oQ{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 oH(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new oY(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(o4(iH)),this.server.assertCanSetRequestHandler(o4(iG)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(iH,()=>({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=nG(t.inputSchema))?o_(r,{strictUnions:!0,pipeStrategy:"input"}):o0,annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=nG(t.outputSchema);e&&(a.outputSchema=o_(e,{strictUnions:!0,pipeStrategy:"output"}))}return a})})),this.server.setRequestHandler(iG,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new sj(oC.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new sj(oC.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 sj(oC.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if("required"===i&&!a)throw new sj(oC.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 sj&&e.code===oC.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=nG(e.inputSchema)??e.inputSchema,i=await nJ(a,t);if(!i.success){let e=nW("error"in i?i.error:"Unknown error");throw new sj(oC.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 sj(oC.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=nG(e.outputSchema),i=await nJ(a,t.structuredContent);if(!i.success){let e=nW("error"in i?i.error:"Unknown error");throw new sj(oC.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 sj(oC.InternalError,`Task ${o} not found during polling`);l=e}return await r.taskStore.getTaskResult(o)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(o4(sk)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(sk,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 sj(oC.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 sj(oC.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new sj(oC.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return o5;let i=nB(a.argsSchema),s=i?.[e.params.argument.name];if(!oJ(s))return o5;let n=(r=s[oK],r?.complete);return n?o6(await n(e.params.argument.value,e.params.context)):o5}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 o5;throw new sj(oC.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?o6(await a(e.params.argument.value,e.params.context)):o5}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(o4(im)),this.server.assertCanSetRequestHandler(o4(ig)),this.server.assertCanSetRequestHandler(o4(ib)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(im,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(ig,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(ib,async(e,t)=>{let r=new URL(e.params.uri),a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new sj(oC.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 sj(oC.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(o4(ij)),this.server.assertCanSetRequestHandler(o4(iN)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(ij,()=>({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=nB(t.argsSchema))?Object.entries(r).map(([e,t])=>({name:e,description:t.description,required:!(nU(t)?t._zod?.def?.type==="optional":"function"==typeof t.isOptional?t.isOptional():t._def?.typeName==="ZodOptional")})):[]:void 0}})})),this.server.setRequestHandler(iN,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new sj(oC.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new sj(oC.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let a=nG(r.argsSchema),i=await nJ(a,e.params.arguments);if(!i.success){let t=nW("error"in i?i.error:"Unknown error");throw new sj(oC.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:nH(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=nH(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=>oJ(e instanceof r7?e._def?.innerType:e))&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,t,r,a,i,s,n,o,l){oW(e);let u={title:t,description:r,inputSchema:o2(a),outputSchema:o2(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&&oW(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=nH(t.paramsSchema)),void 0!==t.outputSchema&&(u.outputSchema=nH(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];o9(e)?(a=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!o9(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 oX{constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new oB(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}}let o0={type:"object",properties:{}};function o1(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function o9(e){return"object"==typeof e&&null!==e&&!("_def"in e||"_zod"in e||o1(e))&&(0===Object.keys(e).length||Object.values(e).some(o1))}function o2(e){if(e)return o9(e)?nH(e):e}function o4(e){let t=nB(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let a=nY(r);if("string"==typeof a)return a;throw Error("Schema method literal must be a string")}function o6(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}let o5={completion:{values:[],hasMore:!1}},o8=require("async_hooks"),o3=(e,t)=>{globalThis[e]=t},o7=e=>globalThis[e];function le({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if(o7(t))return o7(t);let a=new o8.AsyncLocalStorage,i=globalThis[r]??{current:null};o3(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 o3(t,s),s}let lt=le({name:"http-request-context"});lt.setContext;let lr=lt.getContext;lt.provider;let la=le({name:"client-info-context"}),li=la.setContext,ls=la.getContext,ln=la.provider,lo=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},ll=(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}},lu=new Set(["message","mode","requestedSchema"]),ld=new Set(["elicitationId","message","mode","url"]),lc=new Set(["properties","required","type"]),lp=new Set(["default","description","format","maxLength","minLength","title","type"]),lf=new Set(["default","description","enum","enumNames","title","type"]),lh=new Set(["default","description","title","type"]),lm=new Set(["default","description","maximum","minimum","title","type"]),ly=new Set(["date","date-time","email","uri"]);async function lg(e,t,r){let a=function(e){let t=e.mode??"form";if("url"===t)return function(e){let t;l_(e,"Elicitation request must be a plain object."),lv(e,ld,"URL elicitation"),lb(e.message,"URL elicitation requires a string message."),l$(e.elicitationId,"URL elicitation requires a non-empty elicitationId."),l$(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){l_(e,"Elicitation request must be a plain object."),lv(e,lu,"Form elicitation"),lb(e.message,"Form elicitation requires a string message.");let t=e.requestedSchema;if(l_(t,"Form elicitation requires a flat object schema."),lv(t,lc,"Form elicitation schema"),"object"!==t.type)throw Error('Form elicitation schema must use type "object".');for(let[e,r]of(l_(t.properties,"Form elicitation schema requires a properties object."),Object.entries(t.properties)))!function(e,t){if(l_(t,`Form elicitation field "${e}" must be a plain object.`),lw(t.title,`Form elicitation field "${e}" title must be a string.`),lw(t.description,`Form elicitation field "${e}" description must be a string.`),"string"===t.type&&"enum"in t){var r,a;if(lv(t,lf,`Form elicitation field "${e}"`),lx(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&&lx(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(lw(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)){lv(t,lp,`Form elicitation field "${e}"`),lk(t.minLength,`Form elicitation field "${e}" minLength must be a number.`),lk(t.maxLength,`Form elicitation field "${e}" maxLength must be a number.`),lw(t.default,`Form elicitation field "${e}" default must be a string.`);let r=t.format;if(lw(r,`Form elicitation field "${e}" format must be a string.`),void 0!==r&&!ly.has(r))throw Error(`Form elicitation field "${e}" format must be one of: ${Array.from(ly).join(", ")}.`);return}if("boolean"===t.type){if(lv(t,lh,`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){lv(t,lm,`Form elicitation field "${e}"`),lk(t.minimum,`Form elicitation field "${e}" minimum must be a number.`),lk(t.maximum,`Form elicitation field "${e}" maximum must be a number.`),lk(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),sf.parse({...e,mode:"form"})}(t),i=await e.sendRequest({method:"elicitation/create",params:a},s_,r);return{...i,content:i.content??void 0}}function lv(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 l_(e,t){if("object"!=typeof e||null===e||Array.isArray(e))throw Error(t)}function lb(e,t){if("string"!=typeof e)throw Error(t)}function l$(e,t){if("string"!=typeof e||0===e.trim().length)throw Error(t)}function lw(e,t){if(void 0!==e&&"string"!=typeof e)throw Error(t)}function lk(e,t){if(void 0!==e&&"number"!=typeof e)throw Error(t)}function lx(e,t){if(!Array.isArray(e)||e.some(e=>"string"!=typeof e))throw Error(t)}let lS={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 lE(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=lS[e.type];return t?t(e):{valid:!0}}function lT(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 lP(e){return!!(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("ui/")))}function lj(e){return e.endsWith(".tsx")}let lO=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 lI(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 lN=["ui/resourceUri","resourceUri","visibility"],lz=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function lR(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 lC(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function lA(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 lM(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 lZ(e){return Error(`[xmcp] Invalid prompt file: ${e}
31
- -> Default export must be a prompt handler function.`)}async function lD(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 lZ(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 lZ(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 lq=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}
32
- -> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} prompt${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function lF(e){return Error(`[xmcp] Invalid resource file: ${e}
33
- -> Default export must be a resource handler function.`)}async function lL(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 lF(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 lF(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 lV=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}
34
- -> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} resource${1===i?"":"s"} skipped due to empty files or missing default exports`)}}();function lU(e){return Error(`[xmcp] Invalid tool file: ${e}
35
- -> Default export must be a tool handler function.`)}async function lH(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 lU(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 lU(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 lK=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}
36
- -> ${r}`)});let i=r.length;e.warn(`[xmcp] ${i} tool${1===i?"":"s"} skipped due to empty files or missing default exports`)}}(),lJ=INJECTED_TOOLS,lB=INJECTED_PROMPTS,lG=INJECTED_RESOURCES,lW=SERVER_INFO;async function lY(e,t,a,i){return lO.clear(),t.forEach((t,r)=>{var a;let i,s,n={name:lC(r),description:"No description provided"},{default:o,metadata:l,schema:u,outputSchema:d}=t;if("object"==typeof l&&null!==l&&Object.assign(n,l),"function"==typeof o&&"__x402"in o){let e=global.__XMCP_X402_REGISTRY;e&&e.set(n.name,o.__x402)}let c={};if(lR(u)?c=u:null!=u&&console.warn(`Invalid schema for tool "${n.name}" at ${r}. Expected Record<string, z.ZodType>`),null!=d)if(lR(d))i=d;else throw Error(`Invalid outputSchema for tool "${n.name}" at ${r}. Expected Record<string, z.ZodType>`);n.annotations={...n.annotations??{}},void 0===n.annotations.title&&(n.annotations.title=n.name),void 0===n._meta&&(n._meta={});let p=lj(r),f=!!(a=n._meta)&&"object"==typeof a&&"ui"in a&&"object"==typeof a.ui||p,h=n._meta;if(f){let e=`ui://app/${n.name}.html`;n._meta.ui||(n._meta.ui={}),n._meta.ui.resourceUri||(n._meta.ui.resourceUri=e);let t=function(e){let t={},r={};if(e.ui&&"object"==typeof e.ui){let a=e.ui,i={},s={};for(let[e,t]of Object.entries(a))lN.includes(e)?i[e]=t:lz.includes(e)?s[e]=t:i[e]=t;Object.keys(i).length>0&&(t.ui=i),Object.keys(s).length>0&&(r.ui=s)}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"),lO.add(n.name,{name:n.name,uri:e,handler:o,mimeType:"text/html;profile=mcp-app",_meta:a,toolPath:p?r:void 0})}let m=lI(h),y=f?m:void 0;s=lj(r)&&f?async(e,t)=>({content:[{type:"text",text:""}],_meta:y,structuredContent:{args:e}}):function(e,t,r,a="unknown-tool"){return async(i,s)=>{let n=e(i,function(e){let t;try{let e,r=lr();t=r.clientInfo??(e=r.headers,lo({name:ll(e,"x-mcp-client-name"),version:ll(e,"x-mcp-client-version"),title:ll(e,"x-mcp-client-title"),websiteUrl:ll(e,"x-mcp-client-website-url"),description:ll(e,"x-mcp-client-description")}))}catch{}if(!t)try{t=ls().clientInfo}catch{}return{...e,clientInfo:t,elicit:(t,r)=>lg(e,t,r)}}(s));if(n instanceof Promise&&(n=await n),"string"==typeof n||"number"==typeof n){if(r){let e=Object.entries(r);if(1===e.length){let[t,r]=e[0];try{return r.parse(n),{content:[{type:"text",text:"number"==typeof n?`${n}`:n}],structuredContent:{[t]:n}}}catch{}}}return lP(t)?{content:[{type:"text",text:""}],structuredContent:{args:i},_meta:t}:{content:[{type:"text",text:"number"==typeof n?`${n}`:n}]}}if(!r||!n||"object"!=typeof n||Array.isArray(n)||"structuredContent"in n||"content"in n&&Array.isArray(n.content)||"_meta"in n||"isError"in n||(lT(n,r,a,"returned data that does not match outputSchema"),n={structuredContent:n}),n&&"object"==typeof n&&"_meta"in n&&!("content"in n)&&!("structuredContent"in n)){let e=n._meta;if(lP(e))return{content:[{type:"text",text:""}],_meta:e}}if(!n||"object"!=typeof n){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(`Tool handler must return a CallToolResult, string, or number. Got ${e}: ${t}
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 s5(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 s5(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 s5(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 s5(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 s5(o3.InvalidParams,`Task not found: ${e.params.taskId}`);if(o_(r.status))throw new s5(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 s5(o3.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...a}}catch(e){if(e instanceof s5)throw e;throw new s5(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),s5.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),a8.safeParse(e).success||a3.safeParse(e).success)this._onresponse(e);else if(a6(e))this._onrequest(e,t);else a5.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=s5.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 s5(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(a8.safeParse(e).success?e:new s5(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(a8.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(a8.safeParse(e).success?e:s5.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 s5?e:new s5(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 s5(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 s5(o3.InternalError,`Task ${a} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new s5(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 s5?e:new s5(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 s5?e:new s5(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(s5.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 s5(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 s5(o3.InvalidRequest,"Request cancelled"));let i=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(i),a(new s5(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 s5(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 s5(o3.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(o_(s.status))throw new s5(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,o5,o8,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 s5(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 s5(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 s5(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 s5(o3.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof s5)throw e;throw new s5(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 s5(o3.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new s5(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 s5(o3.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if("required"===i&&!a)throw new s5(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 s5&&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 s5(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 s5(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 s5(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 s5(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 s5(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 s5(o3.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new s5(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 s5(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 s5(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 s5(o3.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(lw(i5)),this.server.assertCanSetRequestHandler(lw(i7)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(i5,()=>({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 s5(o3.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new s5(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 s5(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"],l5=["prefersBorder","domain","csp","permissions","connectDomains","resourceDomains","frameDomains","baseUriDomains"];function l8(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 ur(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 ut(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 ut(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 ua=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 ui(e){return Error(`[xmcp] Invalid resource file: ${e}
75
+ -> Default export must be a resource handler function.`)}async function us(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 ui(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 ui(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 un=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 uo(e){return Error(`[xmcp] Invalid tool file: ${e}
77
+ -> Default export must be a tool handler function.`)}async function ul(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 uo(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 uo(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 uu=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`)}}(),ud=INJECTED_TOOLS,uc=INJECTED_PROMPTS,up=INJECTED_RESOURCES,uf=SERVER_INFO;async function uh(e,t,a,i){return l2.clear(),t.forEach((t,r)=>{var a;let i,s,n={name:l3(r),description:"No description provided"},{default:o,metadata:l,schema:u,outputSchema:d}=t;if("object"==typeof l&&null!==l&&Object.assign(n,l),"function"==typeof o&&"__x402"in o){let e=global.__XMCP_X402_REGISTRY;e&&e.set(n.name,o.__x402)}let c={};if(l8(u)?c=u:null!=u&&console.warn(`Invalid schema for tool "${n.name}" at ${r}. Expected Record<string, z.ZodType>`),null!=d)if(l8(d))i=d;else throw Error(`Invalid outputSchema for tool "${n.name}" at ${r}. Expected Record<string, z.ZodType>`);n.annotations={...n.annotations??{}},void 0===n.annotations.title&&(n.annotations.title=n.name),void 0===n._meta&&(n._meta={});let p=l9(r),f=!!(a=n._meta)&&"object"==typeof a&&"ui"in a&&"object"==typeof a.ui||p,h=n._meta;if(f){let e=`ui://app/${n.name}.html`;n._meta.ui||(n._meta.ui={}),n._meta.ui.resourceUri||(n._meta.ui.resourceUri=e);let t=function(e){let t={},r={};if(e.ui&&"object"==typeof e.ui){let a=e.ui,i={},s={};for(let[e,t]of Object.entries(a))l6.includes(e)?i[e]=t:l5.includes(e)?s[e]=t:i[e]=t;Object.keys(i).length>0&&(t.ui=i),Object.keys(s).length>0&&(r.ui=s)}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"),l2.add(n.name,{name:n.name,uri:e,handler:o,mimeType:"text/html;profile=mcp-app",_meta:a,toolPath:p?r:void 0})}let m=l4(h),y=f?m:void 0;s=l9(r)&&f?async(e,t)=>({content:[{type:"text",text:""}],_meta:y,structuredContent:{args:e}}):function(e,t,r,a="unknown-tool"){return async(i,s)=>{let n=e(i,function(e){let t;try{let e,r=lO();t=r.clientInfo??(e=r.headers,lR({name:lC(e,"x-mcp-client-name"),version:lC(e,"x-mcp-client-version"),title:lC(e,"x-mcp-client-title"),websiteUrl:lC(e,"x-mcp-client-website-url"),description:lC(e,"x-mcp-client-description")}))}catch{}if(!t)try{t=lz().clientInfo}catch{}return{...e,clientInfo:t,elicit:(t,r)=>lU(e,t,r)}}(s));if(n instanceof Promise&&(n=await n),"string"==typeof n||"number"==typeof n){if(r){let e=Object.entries(r);if(1===e.length){let[t,r]=e[0];try{return r.parse(n),{content:[{type:"text",text:"number"==typeof n?`${n}`:n}],structuredContent:{[t]:n}}}catch{}}}return l1(t)?{content:[{type:"text",text:""}],structuredContent:{args:i},_meta:t}:{content:[{type:"text",text:"number"==typeof n?`${n}`:n}]}}if(!r||!n||"object"!=typeof n||Array.isArray(n)||"structuredContent"in n||"content"in n&&Array.isArray(n.content)||"_meta"in n||"isError"in n||(l0(n,r,a,"returned data that does not match outputSchema"),n={structuredContent:n}),n&&"object"==typeof n&&"_meta"in n&&!("content"in n)&&!("structuredContent"in n)){let e=n._meta;if(l1(e))return{content:[{type:"text",text:""}],_meta:e}}if(!n||"object"!=typeof n){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(`Tool handler must return a CallToolResult, string, or number. Got ${e}: ${t}
37
79
 
38
80
  Expected CallToolResult format:
39
81
  {
@@ -83,7 +125,7 @@ Or both for backwards compatibility:
83
125
  {
84
126
  content: [{ type: "text", text: "fallback" }],
85
127
  structuredContent: { your: "data" }
86
- }`)}if(u&&!o&&!l){let{isError:e,...t}=n,r=Object.keys(t).length>0?`Tool execution failed: ${JSON.stringify(t)}`:"Tool execution failed";n.content=[{type:"text",text:r}],o=!0}if(r&&l&&!u&&lT(n.structuredContent,r,a,"returned structuredContent that does not match outputSchema"),!o&&l&&(n.content=[{type:"text",text:JSON.stringify(n.structuredContent)}],o=!0),o)for(let e=0;e<n.content.length;e++){let t=n.content[e],r=lE(t);if(!r.valid)throw Error(`Invalid content item at index ${e}: ${r.error}
128
+ }`)}if(u&&!o&&!l){let{isError:e,...t}=n,r=Object.keys(t).length>0?`Tool execution failed: ${JSON.stringify(t)}`:"Tool execution failed";n.content=[{type:"text",text:r}],o=!0}if(r&&l&&!u&&l0(n.structuredContent,r,a,"returned structuredContent that does not match outputSchema"),!o&&l&&(n.content=[{type:"text",text:JSON.stringify(n.structuredContent)}],o=!0),o)for(let e=0;e<n.content.length;e++){let t=n.content[e],r=lX(t);if(!r.valid)throw Error(`Invalid content item at index ${e}: ${r.error}
87
129
 
88
130
  Content item: ${JSON.stringify(t,null,2)}
89
131
 
@@ -100,7 +142,7 @@ Expected format:
100
142
  key: "value",
101
143
  nested: { data: "here" }
102
144
  }
103
- }`)}}return n}}(o,y,i,n.name);let g={title:n.annotations?.title,description:n.description,inputSchema:rJ(c),outputSchema:i?rJ(i).strict():void 0,annotations:n.annotations,_meta:m};e.registerTool(n.name,g,s)}),a.forEach((t,r)=>{let a=lC(r),i={name:a,title:a,description:"No description provided"},{default:s,metadata:n,schema:o}=t;"object"==typeof n&&null!==n&&Object.assign(i,n);let l=function(e,t="assistant"){return async(r,a)=>{let i,s=e(r,a);if(s instanceof Promise&&(s=await s),"string"==typeof s||"number"==typeof s)i={type:"text",text:"number"==typeof s?`${s}`:s};else{let e=lE(s);if(e.valid)i=s;else{let t=null===s?"null":typeof s,r=void 0===s?"undefined":null===s?"null":"object"==typeof s?JSON.stringify(s,null,2):String(s);throw Error(`Prompt handler must return a PromptContent object, string, or number. Got ${t}: ${r}
145
+ }`)}}return n}}(o,y,i,n.name);let g={title:n.annotations?.title,description:n.description,inputSchema:ac(c),outputSchema:i?ac(i).strict():void 0,annotations:n.annotations,_meta:m};e.registerTool(n.name,g,s)}),a.forEach((t,r)=>{let a=l3(r),i={name:a,title:a,description:"No description provided"},{default:s,metadata:n,schema:o}=t;"object"==typeof n&&null!==n&&Object.assign(i,n);let l=function(e,t="assistant"){return async(r,a)=>{let i,s=e(r,a);if(s instanceof Promise&&(s=await s),"string"==typeof s||"number"==typeof s)i={type:"text",text:"number"==typeof s?`${s}`:s};else{let e=lX(s);if(e.valid)i=s;else{let t=null===s?"null":typeof s,r=void 0===s?"undefined":null===s?"null":"object"==typeof s?JSON.stringify(s,null,2):String(s);throw Error(`Prompt handler must return a PromptContent object, string, or number. Got ${t}: ${r}
104
146
 
105
147
  Validation error: ${e.error}
106
148
 
@@ -111,7 +153,7 @@ Expected formats:
111
153
  - Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
112
154
  - Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
113
155
  - Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
114
- - 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}]}}}(s,i.role||"assistant");lR(o)?Object.assign({},o):null!=o&&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:o},l)}),[...lO.getAll()].forEach(([t,a])=>{let i=a.mimeType||"text/html;profile=mcp-app",s=a?._meta?lI(a._meta):void 0,n={name:a.name,description:`Auto-generated resource for ${a.name} tool`,mimeType:a.mimeType,_meta:s},o=async(e,t)=>{if(a.mimeType&&a.toolPath)try{var s;let e,t,n=(s=a.toolPath,IS_CLOUDFLARE?function(e){let{normalizedPath:t,baseName:r}=lM(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}`}(s):function(e){let{normalizedPath:t,baseName:a}=lM(e),i=r(6982).createHash("md5").update(t).digest("hex").slice(0,6);return`${a}_${i}`}(s)),o=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`),s=a.join(r,`${e}.bundle.css`);if(t.existsSync(i)){let e,r=t.readFileSync(i,"utf-8");return t.existsSync(s)&&(e=t.readFileSync(s,"utf-8")),{js:r,css:e}}}}catch{}return null}(n);if(!o)throw Error(`React client bundle not found for "${a.name}" (bundle: "${n}").
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}]}}}(s,i.role||"assistant");l8(o)?Object.assign({},o):null!=o&&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:o},l)}),[...l2.getAll()].forEach(([t,a])=>{let i=a.mimeType||"text/html;profile=mcp-app",s=a?._meta?l4(a._meta):void 0,n={name:a.name,description:`Auto-generated resource for ${a.name} tool`,mimeType:a.mimeType,_meta:s},o=async(e,t)=>{if(a.mimeType&&a.toolPath)try{var s;let e,t,n=(s=a.toolPath,IS_CLOUDFLARE?function(e){let{normalizedPath:t,baseName:r}=ue(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}`}(s):function(e){let{normalizedPath:t,baseName:a}=ue(e),i=r(6982).createHash("md5").update(t).digest("hex").slice(0,6);return`${a}_${i}`}(s)),o=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`),s=a.join(r,`${e}.bundle.css`);if(t.existsSync(i)){let e,r=t.readFileSync(i,"utf-8");return t.existsSync(s)&&(e=t.readFileSync(s,"utf-8")),{js:r,css:e}}}}catch{}return null}(n);if(!o)throw Error(`React client bundle not found for "${a.name}" (bundle: "${n}").
115
157
  React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
116
158
  Please re-run the build so the framework can regenerate the bundle.`);let l=o.js,u=o.css,d=(e=`
117
159
  <script type="module">
@@ -166,7 +208,7 @@ Please re-run the build so the framework can regenerate the bundle.`);let l=o.js
166
208
  <div id="root"></div>
167
209
  ${e}
168
210
  </body>
169
- </html>`);return{contents:[{uri:a.uri,text:d,mimeType:i,_meta:a._meta}]}}catch(e){throw console.error(`React failed for ${a.name}:`,e),e}let n=a.handler({},t);if(n instanceof Promise&&(n=await n),"string"==typeof n)return{contents:[{uri:a.uri,text:n,mimeType:i,_meta:a._meta}]};if(n&&"object"==typeof n&&"_meta"in n&&!("content"in n))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(n&&"object"==typeof n&&"content"in n&&Array.isArray(n.content)){let e=n.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,n,o)}),i.forEach((t,r)=>{let a={name:lC(r),description:"No description provided"},{default:i,metadata:s,schema:n}=t;"object"==typeof s&&null!==s&&Object.assign(a,s);let o={};lR(n)?o=n:null!=n&&console.warn(`Invalid schema for resource "${a.name}" at ${r}. Expected Record<string, z.ZodType>`);let l=lA(r);if(!l)return void console.warn(`Skipping resource "${a.name}" at ${r}: Invalid file path format`);let u=l.uriTemplate;a.mimeType&&a.mimeType.includes("html")&&(u=u.endsWith(".html")?u:`${u}.html`);let d=function(e,t,r={}){let a=lA(t);if(!a)throw Error(`Invalid resource file path: ${t}. Must follow (scheme)/path/[param] convention.`);return async(t,i)=>{let s=e(function(e,t,r){let a={},i={};if(0===t.parameters.length)return i;let s=t.uriTemplate.split("://")[1]||"",n=e.split("://")[1]||"",o=s.split("/"),l=n.split("/");for(let e=0;e<o.length&&e<l.length;e++){let t=o[e],r=l[e],i=t.match(/^\{(.+)\}$/);i&&(a[i[1]]=r)}for(let e of t.parameters){let t=a[e],s=r[e];if(void 0===t)throw Error(`Missing required parameter: ${e}`);if(!s){i[e]=t;continue}try{i[e]=s.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(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:t.href,text:s}]};if(!s||"object"!=typeof s||!Array.isArray(s.contents)){let e=null===s?"null":typeof s,t=void 0===s?"undefined":null===s?"null":"object"==typeof s?JSON.stringify(s,null,2):String(s);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${e}: ${t}
211
+ </html>`);return{contents:[{uri:a.uri,text:d,mimeType:i,_meta:a._meta}]}}catch(e){throw console.error(`React failed for ${a.name}:`,e),e}let n=a.handler({},t);if(n instanceof Promise&&(n=await n),"string"==typeof n)return{contents:[{uri:a.uri,text:n,mimeType:i,_meta:a._meta}]};if(n&&"object"==typeof n&&"_meta"in n&&!("content"in n))return{contents:[{uri:a.uri,text:"",mimeType:i,_meta:a._meta}]};if(n&&"object"==typeof n&&"content"in n&&Array.isArray(n.content)){let e=n.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,n,o)}),i.forEach((t,r)=>{let a={name:l3(r),description:"No description provided"},{default:i,metadata:s,schema:n}=t;"object"==typeof s&&null!==s&&Object.assign(a,s);let o={};l8(n)?o=n:null!=n&&console.warn(`Invalid schema for resource "${a.name}" at ${r}. Expected Record<string, z.ZodType>`);let l=l7(r);if(!l)return void console.warn(`Skipping resource "${a.name}" at ${r}: Invalid file path format`);let u=l.uriTemplate;a.mimeType&&a.mimeType.includes("html")&&(u=u.endsWith(".html")?u:`${u}.html`);let d=function(e,t,r={}){let a=l7(t);if(!a)throw Error(`Invalid resource file path: ${t}. Must follow (scheme)/path/[param] convention.`);return async(t,i)=>{let s=e(function(e,t,r){let a={},i={};if(0===t.parameters.length)return i;let s=t.uriTemplate.split("://")[1]||"",n=e.split("://")[1]||"",o=s.split("/"),l=n.split("/");for(let e=0;e<o.length&&e<l.length;e++){let t=o[e],r=l[e],i=t.match(/^\{(.+)\}$/);i&&(a[i[1]]=r)}for(let e of t.parameters){let t=a[e],s=r[e];if(void 0===t)throw Error(`Missing required parameter: ${e}`);if(!s){i[e]=t;continue}try{i[e]=s.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(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:t.href,text:s}]};if(!s||"object"!=typeof s||!Array.isArray(s.contents)){let e=null===s?"null":typeof s,t=void 0===s?"undefined":null===s?"null":"object"==typeof s?JSON.stringify(s,null,2):String(s);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${e}: ${t}
170
212
 
171
213
  Expected ReadResourceResult format:
172
214
  {
@@ -175,4 +217,4 @@ Expected ReadResourceResult format:
175
217
  { uri: "resource://uri", mimeType: "application/json", text: "json content" },
176
218
  { uri: "resource://uri", blob: base64data }
177
219
  ]
178
- }`)}return s.contents.forEach(e=>{e.uri||(e.uri=t.href)}),s}}(i,r,o);if("direct"===l.type)e.registerResource(a.name,u,a,d);else{let t=new oX(u,{list:void 0}),r=async(e,t,r)=>{let a={};for(let e of l.parameters){let r=t[e],i=o[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 s=i(a,r);return s instanceof Promise&&(s=await s),"string"==typeof s?{contents:[{uri:e.href,text:s}]}:s};e.registerResource(a.name,t,a,r)}}),e}async function lQ(){let{toolModules:e,skippedTools:t}=await lH(lJ);return lK(t),e}async function lX(){let{promptModules:e,skippedPrompts:t}=await lD(lB);return lq(t),e}async function l0(){let{resourceModules:e,skippedResources:t}=await lL(lG);return lV(t),e}async function l1(){let{instructions:e,...t}=lW,r=new oQ(t,{instructions:e}),a=lQ(),i=lX(),s=l0(),[n,o,l]=await Promise.all([a,i,s]);return lY(r,n,o,l)}var l9=r(8583);function l2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.n(l9)().config();class l4{start(){try{this.mcpServer.server.oninitialized=()=>{let e=this.mcpServer.server.getClientVersion(),t=lo(e);li({clientInfo:t}),this.debug&&t&&console.log(`[STDIO] MCP client initialized: ${t.name}@${t.version}`)},this.mcpServer.connect(this.transport),this.debug&&console.log("[STDIO] MCP Server running with STDIO transport"),this.setupShutdownHandlers()}catch(e){this.debug&&console.error("[STDIO] Error starting STDIO transport:",e),process.exit(1)}}setupShutdownHandlers(){let e=()=>{this.debug&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)};process.on("SIGINT",e),process.on("SIGTERM",e)}shutdown(){this.debug&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)}constructor(e,t=!1){l2(this,"mcpServer",void 0),l2(this,"transport",void 0),l2(this,"debug",void 0),this.mcpServer=e,this.transport=new sN,this.debug=t}}let l6=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)}l1().then(e=>{let t=new l4(e,l6);ln({clientInfo:void 0},()=>{t.start()})})})(),{}})());
220
+ }`)}return s.contents.forEach(e=>{e.uri||(e.uri=t.href)}),s}}(i,r,o);if("direct"===l.type)e.registerResource(a.name,u,a,d);else{let t=new ly(u,{list:void 0}),r=async(e,t,r)=>{let a={};for(let e of l.parameters){let r=t[e],i=o[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 s=i(a,r);return s instanceof Promise&&(s=await s),"string"==typeof s?{contents:[{uri:e.href,text:s}]}:s};e.registerResource(a.name,t,a,r)}}),e}async function um(){let{toolModules:e,skippedTools:t}=await ul(ud);return uu(t),e}async function uy(){let{promptModules:e,skippedPrompts:t}=await ur(uc);return ua(t),e}async function ug(){let{resourceModules:e,skippedResources:t}=await us(up);return un(t),e}async function uv(){let{instructions:e,...t}=uf,r=new lm(t,{instructions:e}),a=um(),i=uy(),s=ug(),[n,o,l]=await Promise.all([a,i,s]);return uh(r,n,o,l)}var u_=r(8583);function ub(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.n(u_)().config();class uw{start(){try{this.mcpServer.server.oninitialized=()=>{let e=this.mcpServer.server.getClientVersion(),t=lR(e);lN({clientInfo:t}),this.debug&&t&&console.log(`[STDIO] MCP client initialized: ${t.name}@${t.version}`)},this.mcpServer.connect(this.transport),this.debug&&console.log("[STDIO] MCP Server running with STDIO transport"),this.setupShutdownHandlers()}catch(e){this.debug&&console.error("[STDIO] Error starting STDIO transport:",e),process.exit(1)}}setupShutdownHandlers(){let e=()=>{this.debug&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)};process.on("SIGINT",e),process.on("SIGTERM",e)}shutdown(){this.debug&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)}constructor(e,t=!1){ub(this,"mcpServer",void 0),ub(this,"transport",void 0),ub(this,"debug",void 0),this.mcpServer=e,this.transport=new s7,this.debug=t}}let u$=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)}uv().then(e=>{let t=new uw(e,u$);lI({clientInfo:void 0},()=>{t.start()})})})(),{}})());