@fugood/bricks-cli 2.25.0-beta.63 → 2.25.0-beta.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/lib/1010.js +1 -0
  2. package/lib/1178.js +1 -0
  3. package/lib/1215.js +1 -0
  4. package/lib/{708.js → 1708.js} +2 -2
  5. package/lib/1759.js +1 -0
  6. package/lib/1936.js +1 -0
  7. package/lib/2151.js +1 -0
  8. package/lib/{209.js → 2209.js} +3 -3
  9. package/lib/2247.js +1 -0
  10. package/lib/2486.js +1 -0
  11. package/lib/2557.js +1 -0
  12. package/lib/{223.js → 3223.js} +1 -1
  13. package/lib/3332.js +13 -0
  14. package/lib/3690.js +1 -0
  15. package/lib/3774.js +44 -0
  16. package/lib/3976.js +14 -0
  17. package/lib/4305.js +1 -0
  18. package/lib/4456.js +3 -0
  19. package/lib/{192.js → 4479.js} +4 -4
  20. package/lib/4530.js +22 -0
  21. package/lib/4642.js +9 -0
  22. package/lib/4685.js +1202 -0
  23. package/lib/5212.js +1 -0
  24. package/lib/{658.js → 5658.js} +1 -1
  25. package/lib/5785.js +1 -0
  26. package/lib/6194.js +3 -0
  27. package/lib/6370.js +1 -0
  28. package/lib/6645.js +1 -0
  29. package/lib/6818.js +1 -0
  30. package/lib/7111.js +2 -0
  31. package/lib/7456.js +1 -0
  32. package/lib/7511.js +1 -0
  33. package/lib/7574.js +1 -0
  34. package/lib/7648.js +1 -0
  35. package/lib/8026.js +1 -0
  36. package/lib/{117.js → 8117.js} +2 -2
  37. package/lib/8166.js +1 -0
  38. package/lib/853.js +1 -0
  39. package/lib/915.js +3 -3
  40. package/lib/9320.js +3 -0
  41. package/lib/{387.js → 9387.js} +1 -1
  42. package/lib/9405.js +1 -0
  43. package/lib/9430.js +1 -0
  44. package/lib/{583.js → 9583.js} +1 -1
  45. package/lib/9663.js +1 -0
  46. package/lib/{866.js → 9866.js} +1 -1
  47. package/lib/9940.js +19 -0
  48. package/lib/index.js +17 -17
  49. package/package.json +5 -5
  50. package/lib/10.js +0 -1
  51. package/lib/111.js +0 -2
  52. package/lib/166.js +0 -1
  53. package/lib/178.js +0 -1
  54. package/lib/212.js +0 -1
  55. package/lib/215.js +0 -1
  56. package/lib/247.js +0 -1
  57. package/lib/274.js +0 -55
  58. package/lib/305.js +0 -1
  59. package/lib/306.js +0 -1
  60. package/lib/320.js +0 -3
  61. package/lib/332.js +0 -13
  62. package/lib/358.js +0 -1
  63. package/lib/370.js +0 -1
  64. package/lib/405.js +0 -1
  65. package/lib/430.js +0 -1
  66. package/lib/456.js +0 -3
  67. package/lib/479.js +0 -1231
  68. package/lib/486.js +0 -1
  69. package/lib/511.js +0 -1
  70. package/lib/557.js +0 -1
  71. package/lib/574.js +0 -1
  72. package/lib/645.js +0 -1
  73. package/lib/648.js +0 -1
  74. package/lib/663.js +0 -1
  75. package/lib/690.js +0 -1
  76. package/lib/75.js +0 -1
  77. package/lib/759.js +0 -1
  78. package/lib/785.js +0 -1
  79. package/lib/818.js +0 -1
  80. package/lib/917.js +0 -1
  81. package/lib/936.js +0 -1
  82. package/lib/940.js +0 -19
@@ -1,10 +1,10 @@
1
- export const __rspack_esm_id=192;export const __rspack_esm_ids=[192];export const __webpack_modules__={65733(e,t){function r(e,t){return{validate:e,compare:t}}t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(i,n),time:r(l(!0),u),"date-time":r(p(!0),h),"iso-time":r(l(),d),"iso-date-time":r(p(),f),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)&&g.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(b.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return v.lastIndex=0,v.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=y&&e>=_}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:k},double:{type:"number",validate:k},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,h),"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,f),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)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let r=a.exec(e);if(!r)return!1;let i=+r[1],n=+r[2],o=+r[3];return n>=1&&n<=12&&o>=1&&o<=(2===n&&(t=i)%4==0&&(t%100!=0||t%400==0)?29:s[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],s=+r[2],i=+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&&s<=59&&i<60)return!0;let c=s-d*l,p=a-u*l-(c<0);return(23===p||-1===p)&&(59===c||-1===c)&&i<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&&i(r[0])&&t(r[1])}}function h(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function f(e,t){if(!(e&&t))return;let[r,a]=e.split(c),[s,i]=t.split(c),o=n(r,s);if(void 0!==o)return o||u(a,i)}let m=/\/|:/,g=/^(?:[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,v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,_=-0x80000000,y=0x80000000-1;function k(){return!0}let b=/[^\\]\\Z/},74421(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(65733),s=r(31038),i=r(17898),n=new i.Name("fullFormats"),o=new i.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,a.fullFormats,n),e;let[r,i]="fast"===t.mode?[a.fastFormats,o]:[a.fullFormats,n];return u(e,t.formats||a.formatNames,r,i),t.keywords&&(0,s.default)(e),e};function u(e,t,r,a){var s;for(let n of(null!=(s=e.opts.code).formats||(s.formats=(0,i._)`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},31038(e,t,r){t.A=void 0;let a=r(11601),s=r(17898),i=s.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.A={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:i,data:o,schemaCode:l,keyword:u,it:d}=e,{opts:c,self:p}=d;if(!c.validateFormats)return;let h=new a.KeywordCxt(d,p.RULES.all.format.definition,"format");function f(e){return(0,s._)`${e}.compare(${o}, ${l}) ${n[u].fail} 0`}h.$data?(t=i.scopeValue("formats",{ref:p.formats,code:c.code.formats}),r=i.const("fmt",(0,s._)`${t}[${h.schemaCode}]`),e.fail$data((0,s.or)((0,s._)`typeof ${r} != "object"`,(0,s._)`${r} instanceof RegExp`,(0,s._)`typeof ${r}.compare != "function"`,f(r)))):function(){let t=h.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=i.scopeValue("formats",{key:t,ref:r,code:c.code.formats?(0,s._)`${c.code.formats}${(0,s.getProperty)(t)}`:void 0});e.fail$data(f(a))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.A),e)},65372(e){e.exports=function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},30409(e){function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},40906(e,t,r){var a=r(69893);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},63315(e,t,r){var a=r(14319).default,s=r(65372);e.exports=function(e,t){if(t&&("object"==a(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return s(e)},e.exports.__esModule=!0,e.exports.default=e.exports},69893(e){function t(r,a){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,a)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},25326(e,t,r){let a;r.d(t,{_:()=>em});var s,i=r(84867),n=r(98824),o=r(83605),l=r(18399),u=r(7432);let d=n.xI("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");o.W4.init(e,t),e.def=t,e.parse=(t,r)=>u.qg(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>u.xL(e,t,r),e.parseAsync=async(t,r)=>u.EJ(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>u.bp(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)=>l.o8(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e)}),c=n.xI("ZodMiniObject",(e,t)=>{o.L8.init(e,t),d.init(e,t),l.gJ(e,"shape",()=>t.shape)});function p(e,t){return new c({type:"object",get shape(){return l.Vy(this,"shape",{...e}),this.shape},...l.A2(t)})}function h(e){return!!e._zod}function f(e){let t=Object.values(e);if(0===t.length)return p({});let r=t.every(h),a=t.every(e=>!h(e));if(r)return p(e);if(a)return i.Ik(e);throw Error("Mixed Zod versions detected in object shape.")}function m(e,t){return h(e)?u.xL(e,t):e.safeParse(t)}async function g(e,t){return h(e)?await u.bp(e,t):await e.safeParseAsync(t)}function v(e){var t,r;let a;if(e&&(a=h(e)?null==(r=null==(t=e._zod)?void 0:t.def)?void 0:r.shape:e.shape)){if("function"==typeof a)try{return a()}catch(e){return}return a}}function _(e){var t;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 f(e)}if(h(e)){let r=null==(t=e._zod)?void 0:t.def;if(r&&("object"===r.type||void 0!==r.shape))return e}else if(void 0!==e.shape)return e}}function y(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(e){}}return String(e)}function k(e){var t;if(h(e)){let r=null==(t=e._zod)?void 0:t.def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}}let r=e._def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let a=e.value;if(void 0!==a)return a}var b=r(82699);function w(e){return"completed"===e||"failed"===e||"cancelled"===e}var x=r(1080);class T{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??x.fd,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,s=this.seen.get(e);if(s)return s.count++,t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,i);let n=e._zod.toJSONSchema?.();if(n)i.schema=n;else{let r={...t,schemaPath:[...t.schemaPath,e],path:t.path},s=e._zod.parent;if(s)i.ref=s,this.process(s,r),this.seen.get(s).isParent=!0;else{let t=i.schema;switch(a.type){case"string":{t.type="string";let{minimum:r,maximum:a,format:s,patterns:n,contentEncoding:o}=e._zod.bag;if("number"==typeof r&&(t.minLength=r),"number"==typeof a&&(t.maxLength=a),s&&(t.format=({guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""})[s]??s,""===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&&(i.schema.allOf=[...e.map(e=>({..."draft-7"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{let{minimum:r,maximum:a,format:s,multipleOf:i,exclusiveMaximum:n,exclusiveMinimum:o}=e._zod.bag;"string"==typeof s&&s.includes("int")?t.type="integer":t.type="number","number"==typeof o&&(t.exclusiveMinimum=o),"number"==typeof r&&(t.minimum=r,"number"==typeof o&&(o>=r?delete t.minimum:delete t.exclusiveMinimum)),"number"==typeof n&&(t.exclusiveMaximum=n),"number"==typeof a&&(t.maximum=a,"number"==typeof n&&(n<=a?delete t.maximum:delete t.exclusiveMaximum)),"number"==typeof i&&(t.multipleOf=i);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":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:s,maximum:i}=e._zod.bag;"number"==typeof s&&(t.minItems=s),"number"==typeof i&&(t.maxItems=i),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 s=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}));s.size>0&&(t.required=Array.from(s)),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":t.anyOf=a.options.map((e,t)=>this.process(e,{...r,path:[...r.path,"anyOf",t]}));break;case"intersection":{let e=this.process(a.left,{...r,path:[...r.path,"allOf",0]}),s=this.process(a.right,{...r,path:[...r.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length;t.allOf=[...i(e)?e.allOf:[e],...i(s)?s.allOf:[s]];break}case"tuple":{t.type="array";let s=a.items.map((e,t)=>this.process(e,{...r,path:[...r.path,"prefixItems",t]}));if("draft-2020-12"===this.target?t.prefixItems=s:t.items=s,a.rest){let e=this.process(a.rest,{...r,path:[...r.path,"items"]});"draft-2020-12"===this.target?t.items=e:t.additionalItems=e}a.rest&&(t.items=this.process(a.rest,{...r,path:[...r.path,"items"]}));let{minimum:i,maximum:n}=e._zod.bag;"number"==typeof i&&(t.minItems=i),"number"==typeof n&&(t.maxItems=n);break}case"record":t.type="object",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=(0,l.w5)(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,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:s,mime:i}=e._zod.bag;void 0!==a&&(r.minLength=a),void 0!==s&&(r.maxLength=s),i?1===i.length?(r.contentMediaType=i[0],Object.assign(t,r)):t.anyOf=i.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":t.anyOf=[this.process(a.innerType,r),{type:"null"}];break;case"nonoptional":case"promise":case"optional":this.process(a.innerType,r),i.ref=a.innerType;break;case"default":this.process(a.innerType,r),i.ref=a.innerType,t.default=JSON.parse(JSON.stringify(a.defaultValue));break;case"prefault":this.process(a.innerType,r),i.ref=a.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(a.defaultValue)));break;case"catch":{let e;this.process(a.innerType,r),i.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),i.ref=e;break}case"readonly":this.process(a.innerType,r),i.ref=a.innerType,t.readOnly=!0;break;case"lazy":{let t=e._zod.innerType;this.process(t,r),i.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")}}}let o=this.metadataRegistry.get(e);return o&&Object.assign(i.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 s=t._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":case"custom":case"success":case"catch":return!1;case"array":return e(s.element,a);case"object":for(let t in s.shape)if(e(s.shape[t],a))return!0;return!1;case"union":for(let t of s.options)if(e(t,a))return!0;return!1;case"intersection":return e(s.left,a)||e(s.right,a);case"tuple":for(let t of s.items)if(e(t,a))return!0;if(s.rest&&e(s.rest,a))return!0;return!1;case"record":case"map":return e(s.keyType,a)||e(s.valueType,a);case"set":return e(s.valueType,a);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":case"default":case"prefault":return e(s.innerType,a);case"lazy":return e(s.getter(),a);case"transform":return!0;case"pipe":return e(s.in,a)||e(s.out,a)}throw Error(`Unknown schema type: ${s.type}`)}(e)&&(delete i.schema.examples,delete i.schema.default),"input"===this.io&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.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 s=e=>{let t="draft-2020-12"===this.target?"$defs":"definitions";if(r.external){let a=r.external.registry.get(e[0])?.id,s=r.external.uri??(e=>e);if(a)return{ref:s(a)};let i=e[1].defId??e[1].schema.id??`schema${this.counter++}`;return e[1].defId=i,{defId:i,ref:`${s("__shared")}#/${t}/${i}`}}if(e[1]===a)return{ref:"#"};let s=`#/${t}/`,i=e[1].schema.id??`__schema${this.counter++}`;return{defId:i,ref:s+i}},i=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:r,defId:a}=s(e);t.def={...t.schema},a&&(t.defId=a);let i=t.schema;for(let e in i)delete i[e];i.$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>
1
+ export const __rspack_esm_id=4479;export const __rspack_esm_ids=[4479];export const __webpack_modules__={65733(e,t){function r(e,t){return{validate:e,compare:t}}t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(i,n),time:r(l(!0),u),"date-time":r(p(!0),h),"iso-time":r(l(),d),"iso-date-time":r(p(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return f.test(e)&&g.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(b.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return v.lastIndex=0,v.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=y&&e>=_}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:k},double:{type:"number",validate:k},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,h),"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,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let r=a.exec(e);if(!r)return!1;let i=+r[1],n=+r[2],o=+r[3];return n>=1&&n<=12&&o>=1&&o<=(2===n&&(t=i)%4==0&&(t%100!=0||t%400==0)?29:s[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],s=+r[2],i=+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&&s<=59&&i<60)return!0;let c=s-d*l,p=a-u*l-(c<0);return(23===p||-1===p)&&(59===c||-1===c)&&i<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&&i(r[0])&&t(r[1])}}function h(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function m(e,t){if(!(e&&t))return;let[r,a]=e.split(c),[s,i]=t.split(c),o=n(r,s);if(void 0!==o)return o||u(a,i)}let f=/\/|:/,g=/^(?:[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,v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,_=-0x80000000,y=0x80000000-1;function k(){return!0}let b=/[^\\]\\Z/},74421(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(65733),s=r(31038),i=r(17898),n=new i.Name("fullFormats"),o=new i.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,a.fullFormats,n),e;let[r,i]="fast"===t.mode?[a.fastFormats,o]:[a.fullFormats,n];return u(e,t.formats||a.formatNames,r,i),t.keywords&&(0,s.default)(e),e};function u(e,t,r,a){var s;for(let n of(null!=(s=e.opts.code).formats||(s.formats=(0,i._)`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},31038(e,t,r){t.A=void 0;let a=r(11601),s=r(17898),i=s.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.A={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:i,data:o,schemaCode:l,keyword:u,it:d}=e,{opts:c,self:p}=d;if(!c.validateFormats)return;let h=new a.KeywordCxt(d,p.RULES.all.format.definition,"format");function m(e){return(0,s._)`${e}.compare(${o}, ${l}) ${n[u].fail} 0`}h.$data?(t=i.scopeValue("formats",{ref:p.formats,code:c.code.formats}),r=i.const("fmt",(0,s._)`${t}[${h.schemaCode}]`),e.fail$data((0,s.or)((0,s._)`typeof ${r} != "object"`,(0,s._)`${r} instanceof RegExp`,(0,s._)`typeof ${r}.compare != "function"`,m(r)))):function(){let t=h.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=i.scopeValue("formats",{key:t,ref:r,code:c.code.formats?(0,s._)`${c.code.formats}${(0,s.getProperty)(t)}`:void 0});e.fail$data(m(a))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.A),e)},25326(e,t,r){let a;r.d(t,{_:()=>ef});var s,i=r(84867),n=r(98824),o=r(83605),l=r(18399),u=r(7432);let d=n.xI("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");o.W4.init(e,t),e.def=t,e.parse=(t,r)=>u.qg(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>u.xL(e,t,r),e.parseAsync=async(t,r)=>u.EJ(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>u.bp(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)=>l.o8(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e)}),c=n.xI("ZodMiniObject",(e,t)=>{o.L8.init(e,t),d.init(e,t),l.gJ(e,"shape",()=>t.shape)});function p(e,t){return new c({type:"object",get shape(){return l.Vy(this,"shape",{...e}),this.shape},...l.A2(t)})}function h(e){return!!e._zod}function m(e){let t=Object.values(e);if(0===t.length)return p({});let r=t.every(h),a=t.every(e=>!h(e));if(r)return p(e);if(a)return i.Ik(e);throw Error("Mixed Zod versions detected in object shape.")}function f(e,t){return h(e)?u.xL(e,t):e.safeParse(t)}async function g(e,t){return h(e)?await u.bp(e,t):await e.safeParseAsync(t)}function v(e){var t,r;let a;if(e&&(a=h(e)?null==(r=null==(t=e._zod)?void 0:t.def)?void 0:r.shape:e.shape)){if("function"==typeof a)try{return a()}catch(e){return}return a}}function _(e){var t;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 m(e)}if(h(e)){let r=null==(t=e._zod)?void 0:t.def;if(r&&("object"===r.type||void 0!==r.shape))return e}else if(void 0!==e.shape)return e}}function y(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(e){}}return String(e)}function k(e){var t;if(h(e)){let r=null==(t=e._zod)?void 0:t.def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}}let r=e._def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let a=e.value;if(void 0!==a)return a}var b=r(82699);function w(e){return"completed"===e||"failed"===e||"cancelled"===e}var x=r(1080);class T{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??x.fd,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,s=this.seen.get(e);if(s)return s.count++,t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,i);let n=e._zod.toJSONSchema?.();if(n)i.schema=n;else{let r={...t,schemaPath:[...t.schemaPath,e],path:t.path},s=e._zod.parent;if(s)i.ref=s,this.process(s,r),this.seen.get(s).isParent=!0;else{let t=i.schema;switch(a.type){case"string":{t.type="string";let{minimum:r,maximum:a,format:s,patterns:n,contentEncoding:o}=e._zod.bag;if("number"==typeof r&&(t.minLength=r),"number"==typeof a&&(t.maxLength=a),s&&(t.format=({guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""})[s]??s,""===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&&(i.schema.allOf=[...e.map(e=>({..."draft-7"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{let{minimum:r,maximum:a,format:s,multipleOf:i,exclusiveMaximum:n,exclusiveMinimum:o}=e._zod.bag;"string"==typeof s&&s.includes("int")?t.type="integer":t.type="number","number"==typeof o&&(t.exclusiveMinimum=o),"number"==typeof r&&(t.minimum=r,"number"==typeof o&&(o>=r?delete t.minimum:delete t.exclusiveMinimum)),"number"==typeof n&&(t.exclusiveMaximum=n),"number"==typeof a&&(t.maximum=a,"number"==typeof n&&(n<=a?delete t.maximum:delete t.exclusiveMaximum)),"number"==typeof i&&(t.multipleOf=i);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":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:s,maximum:i}=e._zod.bag;"number"==typeof s&&(t.minItems=s),"number"==typeof i&&(t.maxItems=i),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 s=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}));s.size>0&&(t.required=Array.from(s)),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":t.anyOf=a.options.map((e,t)=>this.process(e,{...r,path:[...r.path,"anyOf",t]}));break;case"intersection":{let e=this.process(a.left,{...r,path:[...r.path,"allOf",0]}),s=this.process(a.right,{...r,path:[...r.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length;t.allOf=[...i(e)?e.allOf:[e],...i(s)?s.allOf:[s]];break}case"tuple":{t.type="array";let s=a.items.map((e,t)=>this.process(e,{...r,path:[...r.path,"prefixItems",t]}));if("draft-2020-12"===this.target?t.prefixItems=s:t.items=s,a.rest){let e=this.process(a.rest,{...r,path:[...r.path,"items"]});"draft-2020-12"===this.target?t.items=e:t.additionalItems=e}a.rest&&(t.items=this.process(a.rest,{...r,path:[...r.path,"items"]}));let{minimum:i,maximum:n}=e._zod.bag;"number"==typeof i&&(t.minItems=i),"number"==typeof n&&(t.maxItems=n);break}case"record":t.type="object",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=(0,l.w5)(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,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:s,mime:i}=e._zod.bag;void 0!==a&&(r.minLength=a),void 0!==s&&(r.maxLength=s),i?1===i.length?(r.contentMediaType=i[0],Object.assign(t,r)):t.anyOf=i.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":t.anyOf=[this.process(a.innerType,r),{type:"null"}];break;case"nonoptional":case"promise":case"optional":this.process(a.innerType,r),i.ref=a.innerType;break;case"default":this.process(a.innerType,r),i.ref=a.innerType,t.default=JSON.parse(JSON.stringify(a.defaultValue));break;case"prefault":this.process(a.innerType,r),i.ref=a.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(a.defaultValue)));break;case"catch":{let e;this.process(a.innerType,r),i.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),i.ref=e;break}case"readonly":this.process(a.innerType,r),i.ref=a.innerType,t.readOnly=!0;break;case"lazy":{let t=e._zod.innerType;this.process(t,r),i.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")}}}let o=this.metadataRegistry.get(e);return o&&Object.assign(i.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 s=t._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":case"custom":case"success":case"catch":return!1;case"array":return e(s.element,a);case"object":for(let t in s.shape)if(e(s.shape[t],a))return!0;return!1;case"union":for(let t of s.options)if(e(t,a))return!0;return!1;case"intersection":return e(s.left,a)||e(s.right,a);case"tuple":for(let t of s.items)if(e(t,a))return!0;if(s.rest&&e(s.rest,a))return!0;return!1;case"record":case"map":return e(s.keyType,a)||e(s.valueType,a);case"set":return e(s.valueType,a);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":case"default":case"prefault":return e(s.innerType,a);case"lazy":return e(s.getter(),a);case"transform":return!0;case"pipe":return e(s.in,a)||e(s.out,a)}throw Error(`Unknown schema type: ${s.type}`)}(e)&&(delete i.schema.examples,delete i.schema.default),"input"===this.io&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.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 s=e=>{let t="draft-2020-12"===this.target?"$defs":"definitions";if(r.external){let a=r.external.registry.get(e[0])?.id,s=r.external.uri??(e=>e);if(a)return{ref:s(a)};let i=e[1].defId??e[1].schema.id??`schema${this.counter++}`;return e[1].defId=i,{defId:i,ref:`${s("__shared")}#/${t}/${i}`}}if(e[1]===a)return{ref:"#"};let s=`#/${t}/`,i=e[1].schema.id??`__schema${this.counter++}`;return{defId:i,ref:s+i}},i=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:r,defId:a}=s(e);t.def={...t.schema},a&&(t.defId=a);let i=t.schema;for(let e in i)delete i[e];i.$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>
2
2
 
3
- 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]){i(t);continue}if(r.external){let a=r.external.registry.get(t[0])?.id;if(e!==t[0]&&a){i(t);continue}}if(this.metadataRegistry.get(t[0])?.id||a.cycle||a.count>1&&"ref"===r.reused){i(t);continue}}let n=(e,t)=>{let r=this.seen.get(e),a=r.def??r.schema,s={...a};if(null===r.ref)return;let i=r.ref;if(r.ref=null,i){n(i,t);let e=this.seen.get(i).schema;e.$ref&&"draft-7"===t.target?(a.allOf=a.allOf??[],a.allOf.push(e)):(Object.assign(a,e),Object.assign(a,s))}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#":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 $=Symbol("Let zodToJsonSchema decide on which parser to use"),I={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"},z=(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 S(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?z(t,e.currentPath):t.join("/")}}function O(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function P(e,t,r,a,s){e[t]=r,O(e,t,a,s)}function A(e,t){return G(e.type._def,t)}let Z=/^[cC][^\s-]{8,}$/,E=/^[0-9a-z]+$/,R=/^[0-9A-HJKMNP-TV-Z]{26}$/,N=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,C=()=>(void 0===a&&(a=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a),j=/^(?:(?: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])$/,M=/^(([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])$/,q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,F=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L=/^[a-zA-Z0-9_-]{21}$/,H=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function U(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":P(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":P(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":J(r,"email",a.message,t);break;case"format:idn-email":J(r,"idn-email",a.message,t);break;case"pattern:zod":W(r,N,a.message,t)}break;case"url":J(r,"uri",a.message,t);break;case"uuid":J(r,"uuid",a.message,t);break;case"regex":W(r,a.regex,a.message,t);break;case"cuid":W(r,Z,a.message,t);break;case"cuid2":W(r,E,a.message,t);break;case"startsWith":W(r,RegExp(`^${D(a.value,t)}`),a.message,t);break;case"endsWith":W(r,RegExp(`${D(a.value,t)}$`),a.message,t);break;case"datetime":J(r,"date-time",a.message,t);break;case"date":J(r,"date",a.message,t);break;case"time":J(r,"time",a.message,t);break;case"duration":J(r,"duration",a.message,t);break;case"length":P(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),P(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":W(r,RegExp(D(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&J(r,"ipv4",a.message,t),"v4"!==a.version&&J(r,"ipv6",a.message,t);break;case"base64url":W(r,F,a.message,t);break;case"jwt":W(r,H,a.message,t);break;case"cidr":"v6"!==a.version&&W(r,j,a.message,t),"v4"!==a.version&&W(r,M,a.message,t);break;case"emoji":W(r,C(),a.message,t);break;case"ulid":W(r,R,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":J(r,"binary",a.message,t);break;case"contentEncoding:base64":P(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":W(r,q,a.message,t)}break;case"nanoid":W(r,L,a.message,t)}return r}function D(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)V.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let V=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function J(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}}})):P(e,"format",t,r,a)}function W(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:Y(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):P(e,"pattern",Y(t,a),r,a)}function Y(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,s="",i=!1,n=!1,o=!1;for(let e=0;e<a.length;e++){if(i){s+=a[e],i=!1;continue}if(r.i){if(n){if(a[e].match(/[a-z]/)){o?(s+=a[e],s+=`${a[e-2]}-${a[e]}`.toUpperCase(),o=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(s+=a[e],o=!0):s+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){s+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){s+=`(^|(?<=[\r
3
+ 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]){i(t);continue}if(r.external){let a=r.external.registry.get(t[0])?.id;if(e!==t[0]&&a){i(t);continue}}if(this.metadataRegistry.get(t[0])?.id||a.cycle||a.count>1&&"ref"===r.reused){i(t);continue}}let n=(e,t)=>{let r=this.seen.get(e),a=r.def??r.schema,s={...a};if(null===r.ref)return;let i=r.ref;if(r.ref=null,i){n(i,t);let e=this.seen.get(i).schema;e.$ref&&"draft-7"===t.target?(a.allOf=a.allOf??[],a.allOf.push(e)):(Object.assign(a,e),Object.assign(a,s))}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#":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 $=Symbol("Let zodToJsonSchema decide on which parser to use"),I={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"},z=(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 S(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?z(t,e.currentPath):t.join("/")}}function O(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function P(e,t,r,a,s){e[t]=r,O(e,t,a,s)}function A(e,t){return G(e.type._def,t)}let Z=/^[cC][^\s-]{8,}$/,E=/^[0-9a-z]+$/,R=/^[0-9A-HJKMNP-TV-Z]{26}$/,N=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,C=()=>(void 0===a&&(a=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a),j=/^(?:(?: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])$/,q=/^(([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])$/,M=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,F=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L=/^[a-zA-Z0-9_-]{21}$/,H=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function U(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":P(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":P(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":J(r,"email",a.message,t);break;case"format:idn-email":J(r,"idn-email",a.message,t);break;case"pattern:zod":W(r,N,a.message,t)}break;case"url":J(r,"uri",a.message,t);break;case"uuid":J(r,"uuid",a.message,t);break;case"regex":W(r,a.regex,a.message,t);break;case"cuid":W(r,Z,a.message,t);break;case"cuid2":W(r,E,a.message,t);break;case"startsWith":W(r,RegExp(`^${D(a.value,t)}`),a.message,t);break;case"endsWith":W(r,RegExp(`${D(a.value,t)}$`),a.message,t);break;case"datetime":J(r,"date-time",a.message,t);break;case"date":J(r,"date",a.message,t);break;case"time":J(r,"time",a.message,t);break;case"duration":J(r,"duration",a.message,t);break;case"length":P(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),P(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":W(r,RegExp(D(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&J(r,"ipv4",a.message,t),"v4"!==a.version&&J(r,"ipv6",a.message,t);break;case"base64url":W(r,F,a.message,t);break;case"jwt":W(r,H,a.message,t);break;case"cidr":"v6"!==a.version&&W(r,j,a.message,t),"v4"!==a.version&&W(r,q,a.message,t);break;case"emoji":W(r,C(),a.message,t);break;case"ulid":W(r,R,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":J(r,"binary",a.message,t);break;case"contentEncoding:base64":P(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":W(r,M,a.message,t)}break;case"nanoid":W(r,L,a.message,t)}return r}function D(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)V.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let V=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function J(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}}})):P(e,"format",t,r,a)}function W(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:Y(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):P(e,"pattern",Y(t,a),r,a)}function Y(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,s="",i=!1,n=!1,o=!1;for(let e=0;e<a.length;e++){if(i){s+=a[e],i=!1;continue}if(r.i){if(n){if(a[e].match(/[a-z]/)){o?(s+=a[e],s+=`${a[e-2]}-${a[e]}`.toUpperCase(),o=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(s+=a[e],o=!0):s+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){s+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){s+=`(^|(?<=[\r
4
4
  ]))`;continue}else if("$"===a[e]){s+=`($|(?=[\r
5
5
  ]))`;continue}}if(r.s&&"."===a[e]){s+=n?`${a[e]}\r
6
6
  `:`[${a[e]}\r
7
- ]`;continue}s+=a[e],"\\"===a[e]?i=!0:n&&"]"===a[e]?n=!1:n||"["!==a[e]||(n=!0)}try{new RegExp(s)}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 s}function K(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===i.kY.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:G(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??S(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:G(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===i.kY.ZodString&&e.keyType._def.checks?.length){let{type:a,...s}=U(e.keyType._def,t);return{...r,propertyNames:s}}if(e.keyType?._def.typeName===i.kY.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===i.kY.ZodBranded&&e.keyType._def.type._def.typeName===i.kY.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...s}=A(e.keyType._def,t);return{...r,propertyNames:s}}return r}let Q={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},B=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>G(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 G(e,t,r=!1){let a=t.seen.get(e);if(t.override){let s=t.override?.(e,t,a,r);if(s!==$)return s}if(a&&!r){let e=X(a,t);if(void 0!==e)return e}let s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);let n=((e,t,r)=>{switch(t){case i.kY.ZodString:return U(e,r);case i.kY.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",O(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?P(a,"minimum",t.value,t.message,r):P(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),P(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?P(a,"maximum",t.value,t.message,r):P(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),P(a,"maximum",t.value,t.message,r));break;case"multipleOf":P(a,"multipleOf",t.value,t.message,r)}return a;case i.kY.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},s=[],i=e.shape();for(let e in i){let n=i[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=G(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,o||s.push(e))}s.length&&(a.required=s);let n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return G(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 i.kY.ZodBigInt:let s={type:"integer",format:"int64"};if(!e.checks)return s;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?P(s,"minimum",t.value,t.message,r):P(s,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(s.exclusiveMinimum=!0),P(s,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?P(s,"maximum",t.value,t.message,r):P(s,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(s.exclusiveMaximum=!0),P(s,"maximum",t.value,t.message,r));break;case"multipleOf":P(s,"multipleOf",t.value,t.message,r)}return s;case i.kY.ZodBoolean:return{type:"boolean"};case i.kY.ZodDate:return function e(t,r,a){let s=a??r.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((a,s)=>e(t,r,a))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var i=t,n=r;let o={type:"integer",format:"unix-time"};if("openApi3"===n.target)return o;for(let e of i.checks)switch(e.kind){case"min":P(o,"minimum",e.value,e.message,n);break;case"max":P(o,"maximum",e.value,e.message,n)}return o}}(e,r);case i.kY.ZodUndefined:return{not:S(r)};case i.kY.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case i.kY.ZodArray:let n;return n={type:"array"},e.type?._def&&e.type?._def?.typeName!==i.kY.ZodAny&&(n.items=G(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&P(n,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&P(n,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(P(n,"minItems",e.exactLength.value,e.exactLength.message,r),P(n,"maxItems",e.exactLength.value,e.exactLength.message,r)),n;case i.kY.ZodUnion:case i.kY.ZodDiscriminatedUnion:if("openApi3"===r.target)return B(e,r);let o=e.options instanceof Map?Array.from(e.options.values()):e.options;if(o.every(e=>e._def.typeName in Q&&(!e._def.checks||!e._def.checks.length))){let e=o.reduce((e,t)=>{let r=Q[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(o.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=o.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===o.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:o.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(o.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:o.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return B(e,r);case i.kY.ZodIntersection:let l,u,d;return l=[G(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),G(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),u="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,d=[],l.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)d.push(...e.allOf),void 0===e.unevaluatedProperties&&(u=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else u=void 0;d.push(t)}}),d.length?{allOf:d,...u}:void 0;case i.kY.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>G(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:G(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>G(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case i.kY.ZodRecord:return K(e,r);case i.kY.ZodLiteral:let c;return"bigint"!=(c=typeof e.value)&&"number"!==c&&"boolean"!==c&&"string"!==c?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===c?"integer":c,enum:[e.value]}:{type:"bigint"===c?"integer":c,const:e.value};case i.kY.ZodEnum:return{type:"string",enum:Array.from(e.values)};case i.kY.ZodNativeEnum:let p,h,f;return p=e.values,{type:1===(f=Array.from(new Set((h=Object.keys(e.values).filter(e=>"number"!=typeof p[p[e]]).map(e=>p[e])).map(e=>typeof e)))).length?"string"===f[0]?"string":"number":["string","number"],enum:h};case i.kY.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:Q[e.innerType._def.typeName],nullable:!0}:{type:[Q[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=G(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let m=G(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return m&&{anyOf:[m,{type:"null"}]};case i.kY.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return G(e.innerType._def,r);let g=G(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return g?{anyOf:[{not:S(r)},g]}:S(r);case i.kY.ZodMap:if("record"===r.mapStrategy)return K(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[G(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||S(r),G(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||S(r)],minItems:2,maxItems:2}};case i.kY.ZodSet:let v;return v={type:"array",uniqueItems:!0,items:G(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&P(v,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&P(v,"maxItems",e.maxSize.value,e.maxSize.message,r),v;case i.kY.ZodLazy:return()=>e.getter()._def;case i.kY.ZodPromise:return G(e.type._def,r);case i.kY.ZodNaN:case i.kY.ZodNever:return"openAi"===r.target?void 0:{not:S({...r,currentPath:[...r.currentPath,"not"]})};case i.kY.ZodEffects:return"input"===r.effectStrategy?G(e.schema._def,r):S(r);case i.kY.ZodAny:case i.kY.ZodUnknown:return S(r);case i.kY.ZodDefault:return{...G(e.innerType._def,r),default:e.defaultValue()};case i.kY.ZodBranded:return A(e,r);case i.kY.ZodReadonly:case i.kY.ZodCatch:return G(e.innerType._def,r);case i.kY.ZodPipeline:if("input"===r.pipeStrategy)return G(e.in._def,r);if("output"===r.pipeStrategy)return G(e.out._def,r);let _=G(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),y=G(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",_?"1":"0"]});return{allOf:[_,y].filter(e=>void 0!==e)};case i.kY.ZodFunction:case i.kY.ZodVoid:case i.kY.ZodSymbol:default:return}})(e,e.typeName,t),o="function"==typeof n?G(n(),t):n;if(o&&ee(e,t,o),t.postProcess){let r=t.postProcess(o,e,t);return s.jsonSchema=o,r}return s.jsonSchema=o,o}let X=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:z(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`),S(t);return"seen"===t.$refStrategy?S(t):void 0}},ee=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function et(e,t){var r,a,s,i;return h(e)?function(e,t){if(e instanceof x.rs){let r=new T(t),a={};for(let t of e._idmap.entries()){let[e,a]=t;r.process(a)}let s={},i={registry:e,uri:t?.uri,defs:a};for(let a of e._idmap.entries()){let[e,n]=a;s[e]=r.emit(n,{...t,external:i})}return Object.keys(a).length>0&&(s.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:s}}let r=new T(t);return r.process(e),r.emit(e,t)}(e,{target:(i=null==t?void 0:t.target)&&"jsonSchema7"!==i&&"draft-7"!==i&&("jsonSchema2019-09"===i||"draft-2020-12"===i)?"draft-2020-12":"draft-7",io:null!=(r=null==t?void 0:t.pipeStrategy)?r:"input"}):((e,t)=>{let r,a,s=(a=void 0!==(r="string"==typeof t?{...I,name:t}:{...I,...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}]))}),i="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:G(r._def,{...s,currentPath:[...s.basePath,s.definitionPath,t]},!0)??S(s)}),{}):void 0,n="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,o=G(e._def,void 0===n?s:{...s,currentPath:[...s.basePath,s.definitionPath,n]},!1)??S(s),l="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==l&&(o.title=l),s.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[s.openAiAnyTypeName]||(i[s.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===s.$refStrategy?"1":[...s.basePath,s.definitionPath,s.openAiAnyTypeName].join("/")}}));let u=void 0===n?i?{...o,[s.definitionPath]:i}:o:{$ref:[..."relative"===s.$refStrategy?[]:s.basePath,s.definitionPath,n].join("/"),[s.definitionPath]:{...i,[n]:o}};return"jsonSchema7"===s.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===s.target||"openAi"===s.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===s.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:null==(a=null==t?void 0:t.strictUnions)||a,pipeStrategy:null!=(s=null==t?void 0:t.pipeStrategy)?s:"input"})}function er(e){let t=v(e),r=null==t?void 0:t.method;if(!r)throw Error("Schema is missing a method literal");let a=k(r);if("string"!=typeof a)throw Error("Schema method literal must be a string");return a}function ea(e,t){let r=m(e,t);if(!r.success)throw r.error;return r.data}class es{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(b.Sq,e=>{this._oncancel(e)}),this.setNotificationHandler(b._r,e=>{this._onprogress(e)}),this.setRequestHandler(b.tC,e=>({})),this._taskStore=null==e?void 0:e.taskStore,this._taskMessageQueue=null==e?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(b.Ql,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new b.Nh(b.O4.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(b.oQ,async(e,t)=>{let r=async()=>{var a;let s=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(s,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 b.Nh(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 (null==(a=this._transport)?void 0:a.send(e.message,{relatedRequestId:t.requestId}))}}let i=await this._taskStore.getTask(s,t.sessionId);if(!i)throw new b.Nh(b.O4.InvalidParams,`Task not found: ${s}`);if(!w(i.status))return await this._waitForTaskUpdate(s,t.signal),await r();if(w(i.status)){let e=await this._taskStore.getTaskResult(s,t.sessionId);return this._clearTaskQueue(s),{...e,_meta:{...e._meta,[b.EV]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(b.zR,async(e,t)=>{var r;try{let{tasks:a,nextCursor:s}=await this._taskStore.listTasks(null==(r=e.params)?void 0:r.cursor,t.sessionId);return{tasks:a,nextCursor:s,_meta:{}}}catch(e){throw new b.Nh(b.O4.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(b.gd,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new b.Nh(b.O4.InvalidParams,`Task not found: ${e.params.taskId}`);if(w(r.status))throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...a}}catch(e){if(e instanceof b.Nh)throw e;throw new b.Nh(b.O4.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){let t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}_setupTimeout(e,t,r,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,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),b.Nh.fromError(b.O4.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){var t,r,a;this._transport=e;let s=null==(t=this.transport)?void 0:t.onclose;this._transport.onclose=()=>{null==s||s(),this._onclose()};let i=null==(r=this.transport)?void 0:r.onerror;this._transport.onerror=e=>{null==i||i(e),this._onerror(e)};let n=null==(a=this._transport)?void 0:a.onmessage;this._transport.onmessage=(e,t)=>{null==n||n(e,t),(0,b.tG)(e)||(0,b.o$)(e)?this._onresponse(e):(0,b.vo)(e)?this._onrequest(e,t):(0,b.lg)(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=b.Nh.fromError(b.O4.ConnectionClosed,"Connection closed");for(let a of(this._transport=void 0,null==(e=this.onclose)||e.call(this),t.values()))a(r)}_onerror(e){var t;null==(t=this.onerror)||t.call(this,e)}_onnotification(e){var t;let r=null!=(t=this._notificationHandlers.get(e.method))?t:this.fallbackNotificationHandler;void 0!==r&&Promise.resolve().then(()=>r(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r,a,s,i,n,o;let l=null!=(r=this._requestHandlers.get(e.method))?r:this.fallbackRequestHandler,u=this._transport,d=null==(i=null==(s=null==(a=e.params)?void 0:a._meta)?void 0:s[b.EV])?void 0:i.taskId;if(void 0===l){let t={jsonrpc:"2.0",id:e.id,error:{code:b.O4.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:t,timestamp:Date.now()},null==u?void 0:u.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):null==u||u.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);let p=null==(n=e.params)?void 0:n.task,h=this._taskStore?this.requestTaskStore(e,null==u?void 0:u.sessionId):void 0,f={signal:c.signal,sessionId:null==u?void 0:u.sessionId,_meta:null==(o=e.params)?void 0:o._meta,sendNotification:async t=>{let r={relatedRequestId:e.id};d&&(r.relatedTask={taskId:d}),await this.notification(t,r)},sendRequest:async(t,r,a)=>{var s,i;let n={...a,relatedRequestId:e.id};d&&!n.relatedTask&&(n.relatedTask={taskId:d});let o=null!=(i=null==(s=n.relatedTask)?void 0:s.taskId)?i:d;return o&&h&&await h.updateTaskStatus(o,"input_required"),await this.request(t,r,n)},authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo,taskId:d,taskStore:h,taskRequestedTtl:null==p?void 0:p.ttl,closeSSEStream:null==t?void 0:t.closeSSEStream,closeStandaloneSSEStream:null==t?void 0:t.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>l(e,f)).then(async t=>{if(c.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:r,timestamp:Date.now()},null==u?void 0:u.sessionId):await (null==u?void 0:u.send(r))},async t=>{var r;if(c.signal.aborted)return;let a={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:b.O4.InternalError,message:null!=(r=t.message)?r:"Internal error",...void 0!==t.data&&{data:t.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:a,timestamp:Date.now()},null==u?void 0:u.sessionId):await (null==u?void 0:u.send(a))}).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),s=this._progressHandlers.get(a);if(!s)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let i=this._responseHandlers.get(a),n=this._timeoutInfo.get(a);if(n&&i&&n.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),i(e);return}s(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r((0,b.tG)(e)?e:new b.Nh(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 s=!1;if((0,b.tG)(e)&&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&&(s=!0,this._taskProgressTokens.set(e.taskId,t))}}s||this._progressHandlers.delete(t),a((0,b.tG)(e)?e:b.Nh.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){var e;await (null==(e=this._transport)?void 0:e.close())}async *requestStream(e,t,r){var a,s,i,n;let o,{task:l}=null!=r?r:{};if(!l){try{let a=await this.request(e,t,r);yield{type:"result",result:a}}catch(e){yield{type:"error",error:e instanceof b.Nh?e:new b.Nh(b.O4.InternalError,String(e))}}return}try{let l=await this.request(e,b.Mg,r);if(l.task)o=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new b.Nh(b.O4.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:e},w(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:o},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new b.Nh(b.O4.InternalError,`Task ${o} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new b.Nh(b.O4.InternalError,`Task ${o} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:o},t,r);yield{type:"result",result:e};return}let l=null!=(i=null!=(a=e.pollInterval)?a:null==(s=this._options)?void 0:s.defaultTaskPollInterval)?i:1e3;await new Promise(e=>setTimeout(e,l)),null==(n=null==r?void 0:r.signal)||n.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof b.Nh?e:new b.Nh(b.O4.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i,task:n,relatedTask:o}=null!=r?r:{};return new Promise((l,u)=>{var d,c,p,h,f,g,v;let _=e=>{u(e)};if(!this._transport)return void _(Error("Not connected"));if((null==(d=this._options)?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),n&&this.assertTaskCapability(e.method)}catch(e){_(e);return}null==(c=null==r?void 0:r.signal)||c.throwIfAborted();let y=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:y};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(y,r.onprogress),k.params={...e.params,_meta:{...(null==(p=e.params)?void 0:p._meta)||{},progressToken:y}}),n&&(k.params={...k.params,task:n}),o&&(k.params={...k.params,_meta:{...(null==(h=k.params)?void 0:h._meta)||{},[b.EV]:o}});let w=e=>{var t;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),null==(t=this._transport)||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(e)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),u(e instanceof b.Nh?e:new b.Nh(b.O4.RequestTimeout,String(e)))};this._responseHandlers.set(y,e=>{var a;if(null==(a=null==r?void 0:r.signal)||!a.aborted){if(e instanceof Error)return u(e);try{let r=m(t,e.result);r.success?l(r.data):u(r.error)}catch(e){u(e)}}}),null==(f=null==r?void 0:r.signal)||f.addEventListener("abort",()=>{var e;w(null==(e=null==r?void 0:r.signal)?void 0:e.reason)});let x=null!=(g=null==r?void 0:r.timeout)?g:6e4;this._setupTimeout(y,x,null==r?void 0:r.maxTotalTimeout,()=>w(b.Nh.fromError(b.O4.RequestTimeout,"Request timed out",{timeout:x})),null!=(v=null==r?void 0:r.resetTimeoutOnProgress)&&v);let T=null==o?void 0:o.taskId;if(T){let e=e=>{let t=this._responseHandlers.get(y);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${y}`))};this._requestResolvers.set(y,e),this._enqueueTaskMessage(T,{type:"request",message:k,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(y),u(e)})}else this._transport.send(k,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>{this._cleanupTimeout(y),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},b.Sc,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},b.a5,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},b.gH,t)}async notification(e,t){var r,a,s,i,n;if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let o=null==(r=null==t?void 0:t.relatedTask)?void 0:r.taskId;if(o){let r={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...(null==(a=e.params)?void 0:a._meta)||{},[b.EV]:t.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:r,timestamp:Date.now()});return}if((null!=(i=null==(s=this._options)?void 0:s.debouncedNotificationMethods)?i:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)&&!(null==t?void 0:t.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var r,a;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(s={...s,params:{...s.params,_meta:{...(null==(r=s.params)?void 0:r._meta)||{},[b.EV]:t.relatedTask}}}),null==(a=this._transport)||a.send(s,t).catch(e=>this._onerror(e))});return}let l={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(l={...l,params:{...l.params,_meta:{...(null==(n=l.params)?void 0:n._meta)||{},[b.EV]:t.relatedTask}}}),await this._transport.send(l,t)}setRequestHandler(e,t){let r=er(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,a)=>Promise.resolve(t(ea(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=er(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(ea(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){var a;if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=null==(a=this._options)?void 0:a.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,s)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){for(let r of(await this._taskMessageQueue.dequeueAll(e,t)))if("request"===r.type&&(0,b.vo)(r.message)){let t=r.message.id,a=this._requestResolvers.get(t);a?(a(new b.Nh(b.O4.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){var r,a,s;let i=null!=(a=null==(r=this._options)?void 0:r.defaultTaskPollInterval)?a:1e3;try{let t=await (null==(s=this._taskStore)?void 0:s.getTask(e));(null==t?void 0:t.pollInterval)&&(i=t.pollInterval)}catch(e){}return new Promise((e,r)=>{if(t.aborted)return void r(new b.Nh(b.O4.InvalidRequest,"Request cancelled"));let a=setTimeout(e,i);t.addEventListener("abort",()=>{clearTimeout(a),r(new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(e,a,s)=>{await r.storeTaskResult(e,a,s,t);let i=await r.getTask(e,t);if(i){let t=b.ki.parse({method:"notifications/tasks/status",params:i});await this.notification(t),w(i.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,a,s)=>{let i=await r.getTask(e,t);if(!i)throw new b.Nh(b.O4.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(w(i.status))throw new b.Nh(b.O4.InvalidParams,`Cannot update task "${e}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,a,s,t);let n=await r.getTask(e,t);if(n){let t=b.ki.parse({method:"notifications/tasks/status",params:n});await this.notification(t),w(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function ei(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var en=r(11601),eo=r(74421);class el{constructor(e){let t;this._ajv=null!=e?e:(eo(t=new en.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0})),t)}getValidator(e){var t;let r="$id"in e&&"string"==typeof e.$id&&null!=(t=this._ajv.getSchema(e.$id))?t:this._ajv.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class eu{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 ed extends es{constructor(e,t){var r,a;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(b.FP.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=null!=(r=null==t?void 0:t.capabilities)?r:{},this._instructions=null==t?void 0:t.instructions,this._jsonSchemaValidator=null!=(a=null==t?void 0:t.jsonSchemaValidator)?a:new el,this.setRequestHandler(b.rk,e=>this._oninitialize(e)),this.setNotificationHandler(b.ZC,()=>{var e;return null==(e=this.oninitialized)?void 0:e.call(this)}),this._capabilities.logging&&this.setRequestHandler(b.b_,async(e,t)=>{var r;let a=t.sessionId||(null==(r=t.requestInfo)?void 0:r.headers["mcp-session-id"])||void 0,{level:s}=e.params,i=b.FP.safeParse(s);return i.success&&this._loggingLevels.set(a,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new eu(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 s=r[e];ei(s)&&ei(a)?r[e]={...s,...a}:r[e]=a}return r}(this._capabilities,e)}setRequestHandler(e,t){var r,a,s;let i,n=v(e),o=null==n?void 0:n.method;if(!o)throw Error("Schema is missing a method literal");if(h(o)){let e=null==(r=o._zod)?void 0:r.def;i=null!=(a=null==e?void 0:e.value)?a:o.value}else{let e=o._def;i=null!=(s=null==e?void 0:e.value)?s:o.value}if("string"!=typeof i)throw Error("Schema method literal must be a string");if("tools/call"===i){let r=async(e,r)=>{let a=m(b.FT,e);if(!a.success){let e=a.error instanceof Error?a.error.message:String(a.error);throw new b.Nh(b.O4.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:s}=a.data,i=await Promise.resolve(t(e,r));if(s.task){let e=m(b.Mg,i);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new b.Nh(b.O4.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=m(b.TF,i);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new b.Nh(b.O4.InvalidParams,`Invalid tools/call result: ${e}`)}return n.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){var t,r,a;switch(e){case"sampling/createMessage":if(!(null==(t=this._clientCapabilities)?void 0:t.sampling))throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null==(r=this._clientCapabilities)?void 0:r.elicitation))throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null==(a=this._clientCapabilities)?void 0:a.roots))throw Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){var t,r;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(!(null==(r=null==(t=this._clientCapabilities)?void 0:t.elicitation)?void 0:r.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,r,a,s,i=null==(r=null==(t=this._clientCapabilities)?void 0:t.tasks)?void 0:r.requests,n="Client";if(!i)throw Error(`${n} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(null==(a=i.sampling)?void 0:a.createMessage))throw Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(null==(s=i.elicitation)?void 0:s.create))throw Error(`${n} does not support task creation for elicitation/create (required for ${e})`)}}assertTaskHandlerCapability(e){var t;if(this._capabilities){var r,a=null==(t=this._capabilities.tasks)?void 0:t.requests,s="Server";if(!a)throw Error(`${s} does not support task creation (required for ${e})`);if("tools/call"===e&&!(null==(r=a.tools)?void 0:r.call))throw Error(`${s} 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:b.Iu.includes(t)?t:b.aE,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"},b.wR)}async createMessage(e,t){var r,a;if((e.tools||e.toolChoice)&&!(null==(a=null==(r=this._clientCapabilities)?void 0:r.sampling)?void 0:a.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),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],n=i.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(i.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},b.TI,t):this.request({method:"sampling/createMessage",params:e},b.K1,t)}async elicitInput(e,t){var r,a,s,i,n;switch(null!=(r=e.mode)?r:"form"){case"url":if(!(null==(s=null==(a=this._clientCapabilities)?void 0:a.elicitation)?void 0:s.url))throw Error("Client does not support url elicitation.");return this.request({method:"elicitation/create",params:e},b.n_,t);case"form":{if(!(null==(n=null==(i=this._clientCapabilities)?void 0:i.elicitation)?void 0:n.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},b.n_,t);if("accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new b.Nh(b.O4.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof b.Nh)throw e;throw new b.Nh(b.O4.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){var r,a;if(!(null==(a=null==(r=this._clientCapabilities)?void 0:r.elicitation)?void 0:a.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},b.Cs,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 ec=Symbol.for("mcp.completable");(s||(s={})).Completable="McpCompletable";let ep=/^[A-Za-z0-9._-]{1,128}$/;function eh(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"),!ep.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 ef{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 em{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 ed(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new ef(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(ek(b.gW)),this.server.assertCanSetRequestHandler(ek(b.FT)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(b.gW,()=>({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=_(t.inputSchema))?et(r,{strictUnions:!0,pipeStrategy:"input"}):eg,annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=_(t.outputSchema);e&&(a.outputSchema=et(e,{strictUnions:!0,pipeStrategy:"output"}))}return a})})),this.server.setRequestHandler(b.FT,async(e,t)=>{var r;try{let a=this._registeredTools[e.params.name];if(!a)throw new b.Nh(b.O4.InvalidParams,`Tool ${e.params.name} not found`);if(!a.enabled)throw new b.Nh(b.O4.InvalidParams,`Tool ${e.params.name} disabled`);let s=!!e.params.task,i=null==(r=a.execution)?void 0:r.taskSupport,n="createTask"in a.handler;if(("required"===i||"optional"===i)&&!n)throw new b.Nh(b.O4.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if("required"===i&&!s)throw new b.Nh(b.O4.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if("optional"===i&&!s&&n)return await this.handleAutomaticTaskPolling(a,e,t);let o=await this.validateToolInput(a,e.params.arguments,e.params.name),l=await this.executeToolHandler(a,o,t);if(s)return l;return await this.validateToolOutput(a,l,e.params.name),l}catch(e){if(e instanceof b.Nh&&e.code===b.O4.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=_(e.inputSchema),s=null!=a?a:e.inputSchema,i=await g(s,t);if(!i.success){let e=y("error"in i?i.error:"Unknown error");throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=_(e.outputSchema),s=await g(a,t.structuredContent);if(!s.success){let e=y("error"in s?s.error:"Unknown error");throw new b.Nh(b.O4.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 s={...r,taskStore:r.taskStore};return e.inputSchema?await Promise.resolve(a.createTask(t,s)):await Promise.resolve(a.createTask(s))}return e.inputSchema?await Promise.resolve(a(t,r)):await Promise.resolve(a(r))}async handleAutomaticTaskPolling(e,t,r){var a;if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let s=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,n={...r,taskStore:r.taskStore},o=s?await Promise.resolve(i.createTask(s,n)):await Promise.resolve(i.createTask(n)),l=o.task.taskId,u=o.task,d=null!=(a=u.pollInterval)?a:5e3;for(;"completed"!==u.status&&"failed"!==u.status&&"cancelled"!==u.status;){await new Promise(e=>setTimeout(e,d));let e=await r.taskStore.getTask(l);if(!e)throw new b.Nh(b.O4.InternalError,`Task ${l} not found during polling`);u=e}return await r.taskStore.getTaskResult(l)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ek(b.iK)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(b.iK,async e=>{switch(e.params.ref.type){case"ref/prompt":return(0,b.uv)(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return(0,b.X6)(e),this.handleResourceCompletion(e,e.params.ref);default:throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new b.Nh(b.O4.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return ew;let s=v(a.argsSchema),i=null==s?void 0:s[e.params.argument.name];if(!(i&&"object"==typeof i&&ec in i))return ew;let n=null==(r=i[ec])?void 0:r.complete;return n?eb(await n(e.params.argument.value,e.params.context)):ew}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 ew;throw new b.Nh(b.O4.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?eb(await a(e.params.argument.value,e.params.context)):ew}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(ek(b.OI)),this.server.assertCanSetRequestHandler(ek(b.s)),this.server.assertCanSetRequestHandler(ek(b.R6)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(b.OI,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(b.s,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(b.R6,async(e,t)=>{let r=new URL(e.params.uri),a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Resource ${r} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(ek(b.Qq)),this.server.assertCanSetRequestHandler(ek(b.$p)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(b.Qq,()=>({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=v(t.argsSchema))?Object.entries(r).map(([e,t])=>{var r,a,s,i,n,o,l;return{name:e,description:h(t)?null==(a=null==(r=t._zod)?void 0:r.def)?void 0:a.description:null!=(s=t.description)?s:null==(i=t._def)?void 0:i.description,required:!(h(t)?(null==(o=null==(n=t._zod)?void 0:n.def)?void 0:o.type)==="optional":"function"==typeof t.isOptional?t.isOptional():(null==(l=t._def)?void 0:l.typeName)==="ZodOptional")}}):[]:void 0}})})),this.server.setRequestHandler(b.$p,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new b.Nh(b.O4.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new b.Nh(b.O4.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let a=_(r.argsSchema),s=await g(a,e.params.arguments);if(!s.success){let t=y("error"in s?s.error:"Unknown error");throw new b.Nh(b.O4.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}let i=s.data,n=r.callback;return await Promise.resolve(n(i,t))}{let e=r.callback;return await Promise.resolve(e(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...r){let a;"object"==typeof r[0]&&(a=r.shift());let s=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,s);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,s);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 s=this._createRegisteredResource(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,t,r,a,s){let i={name:e,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=i)),void 0!==e.name&&(i.name=e.name),void 0!==e.title&&(i.title=e.title),void 0!==e.metadata&&(i.metadata=e.metadata),void 0!==e.callback&&(i.readCallback=e.callback),void 0!==e.enabled&&(i.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,a,s){let i={resourceTemplate:r,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.template&&(i.resourceTemplate=t.template),void 0!==t.metadata&&(i.metadata=t.metadata),void 0!==t.callback&&(i.readCallback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,t,r,a,s){let i={title:t,description:r,argsSchema:void 0===a?void 0:f(a),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.description&&(i.description=t.description),void 0!==t.argsSchema&&(i.argsSchema=f(t.argsSchema)),void 0!==t.callback&&(i.callback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,t,r,a,s,i,n,o,l){eh(e);let u={title:t,description:r,inputSchema:ey(a),outputSchema:ey(s),annotations:i,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&&eh(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=f(t.paramsSchema)),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,s,i;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];e_(e)?(a=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!e_(t[0])&&(i=t.shift())):"object"==typeof e&&null!==e&&(i=t.shift())}let n=t[0];return this._createRegisteredTool(e,void 0,r,a,s,i,{taskSupport:"forbidden"},void 0,n)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:s,inputSchema:i,outputSchema:n,annotations:o,_meta:l}=t;return this._createRegisteredTool(e,a,s,i,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 s=t[0],i=this._createRegisteredPrompt(e,void 0,r,a,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:s,argsSchema:i}=t,n=this._createRegisteredPrompt(e,a,s,i,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()}}let eg={type:"object",properties:{}};function ev(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function e_(e){return"object"==typeof e&&null!==e&&!("_def"in e||"_zod"in e||ev(e))&&(0===Object.keys(e).length||Object.values(e).some(ev))}function ey(e){if(e)return e_(e)?f(e):e}function ek(e){let t=v(e),r=null==t?void 0:t.method;if(!r)throw Error("Schema is missing a method literal");let a=k(r);if("string"==typeof a)return a;throw Error("Schema method literal must be a string")}function eb(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}let ew={completion:{values:[],hasMore:!1}}},66029(e,t,r){r.d(t,{S:()=>n});var a=r(1708),s=r(82699);class i{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,s.OR.parse(JSON.parse(e))}clear(){this._buffer=void 0}}class n{constructor(e=a.stdin,t=a.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new i,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{var t;null==(t=this.onerror)||t.call(this,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(var e,t;;)try{let t=this._readBuffer.readMessage();if(null===t)break;null==(e=this.onmessage)||e.call(this,t)}catch(e){null==(t=this.onerror)||t.call(this,e)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),null==(e=this.onclose)||e.call(this)}send(e){return new Promise(t=>{let r=JSON.stringify(e)+"\n";this._stdout.write(r)?t():this._stdout.once("drain",t)})}}},82699(e,t,r){let a;r.d(t,{oQ:()=>tH,ZC:()=>tS,ki:()=>tq,uv:()=>r6,X6:()=>r8,Mg:()=>tj,$p:()=>ro,Ql:()=>tF,Iu:()=>eX,tG:()=>tl,R6:()=>t5,rk:()=>t$,gW:()=>rk,K1:()=>rF,aE:()=>eG,b_:()=>rS,Sc:()=>tL,vo:()=>ts,OI:()=>t0,_r:()=>tZ,OR:()=>tc,o$:()=>td,O4:()=>c,Cs:()=>ar,FT:()=>rT,tC:()=>tO,TI:()=>rL,Qq:()=>rs,Nh:()=>as,EV:()=>e0,iK:()=>r3,s:()=>t9,gH:()=>tJ,lg:()=>tn,zR:()=>tU,a5:()=>tD,TF:()=>rw,n_:()=>r9,Sq:()=>tf,gd:()=>tV,FP:()=>rI,wR:()=>tp});var s,i,n,o,l,u,d,c,p=r(98824),h=r(83605),f=r(18399),m=r(1080),g=r(45830);function v(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f.A2(t)})}function _(e,t){return new g.sm({check:"less_than",...f.A2(t),value:e,inclusive:!1})}function y(e,t){return new g.sm({check:"less_than",...f.A2(t),value:e,inclusive:!0})}function k(e,t){return new g.J_({check:"greater_than",...f.A2(t),value:e,inclusive:!1})}function b(e,t){return new g.J_({check:"greater_than",...f.A2(t),value:e,inclusive:!0})}function w(e,t){return new g.Jk({check:"multiple_of",...f.A2(t),value:e})}function x(e,t){return new g.Yk({check:"max_length",...f.A2(t),maximum:e})}function T(e,t){return new g.Kk({check:"min_length",...f.A2(t),minimum:e})}function $(e,t){return new g.RM({check:"length_equals",...f.A2(t),length:e})}function I(e){return new g.v$({check:"overwrite",tx:e})}let z=p.xI("ZodISODateTime",(e,t)=>{h.Ko.init(e,t),D.init(e,t)});function S(e){return new z({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f.A2(e)})}let O=p.xI("ZodISODate",(e,t)=>{h.v1.init(e,t),D.init(e,t)}),P=p.xI("ZodISOTime",(e,t)=>{h.Ax.init(e,t),D.init(e,t)}),A=p.xI("ZodISODuration",(e,t)=>{h.$N.init(e,t),D.init(e,t)});var Z=r(7432),E=r(29896);let R=(e,t)=>{E.a$.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>E.Wk(e,t)},flatten:{value:t=>E.JM(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})};p.xI("ZodError",R);let N=p.xI("ZodError",R,{Parent:Error}),C=Z.Tj(N),j=Z.Rb(N),M=Z.Od(N),q=Z.wG(N),F=p.xI("ZodType",(e,t)=>(h.W4.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),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)=>f.o8(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>C(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>M(e,t,r),e.parseAsync=async(t,r)=>j(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>q(e,t,r),e.spa=e.safeParseAsync,e.refine=(t,r)=>e.check(function(e,t={}){return new eB({type:"custom",check:"custom",fn:e,...f.A2(t)})}(t,r)),e.superRefine=t=>{var r,a;let s,i;return e.check((r=t,i=(a=e=>(e.addIssue=t=>{"string"==typeof t?e.issues.push(f.sn(t,e.value,i._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=e.value),t.inst??(t.inst=i),t.continue??(t.continue=!i._zod.def.abort),e.issues.push(f.sn(t)))},r(e.value,e)),(s=new g.QP({check:"custom"}))._zod.check=a,s)))},e.overwrite=t=>e.check(I(t)),e.optional=()=>eL(e),e.nullable=()=>eU(e),e.nullish=()=>eL(eU(e)),e.nonoptional=t=>{var r,a;return r=e,a=t,new eJ({type:"nonoptional",innerType:r,...f.A2(a)})},e.array=()=>ew(e),e.or=t=>ez([e,t]),e.and=t=>eA(e,t),e.transform=t=>eK(e,eq(t)),e.default=t=>{var r,a;return r=e,a=t,new eD({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():a}})},e.prefault=t=>{var r,a;return r=e,a=t,new eV({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():a}})},e.catch=t=>{var r;return new eW({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r})},e.pipe=t=>eK(e,t),e.readonly=()=>new eQ({type:"readonly",innerType:e}),e.describe=t=>{let r=e.clone();return m.fd.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>m.fd.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return m.fd.get(e);let r=e.clone();return m.fd.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),L=p.xI("_ZodString",(e,t)=>{h.$v.init(e,t),F.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 g.DG({check:"string_format",format:"regex",...f.A2(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new g.Tt({check:"string_format",format:"includes",...f.A2(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new g.J({check:"string_format",format:"starts_with",...f.A2(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new g.E6({check:"string_format",format:"ends_with",...f.A2(t),suffix:e})}(...t)),e.min=(...t)=>e.check(T(...t)),e.max=(...t)=>e.check(x(...t)),e.length=(...t)=>e.check($(...t)),e.nonempty=(...t)=>e.check(T(1,...t)),e.lowercase=t=>e.check(new g.NI({check:"string_format",format:"lowercase",...f.A2(t)})),e.uppercase=t=>e.check(new g.kH({check:"string_format",format:"uppercase",...f.A2(t)})),e.trim=()=>e.check(I(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return I(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(I(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(I(e=>e.toUpperCase()))}),H=p.xI("ZodString",(e,t)=>{h.$v.init(e,t),L.init(e,t),e.email=t=>e.check(new V({type:"string",format:"email",check:"string_format",abort:!1,...f.A2(t)})),e.url=t=>e.check(new Y({type:"string",format:"url",check:"string_format",abort:!1,...f.A2(t)})),e.jwt=t=>e.check(new eu({type:"string",format:"jwt",check:"string_format",abort:!1,...f.A2(t)})),e.emoji=t=>e.check(new K({type:"string",format:"emoji",check:"string_format",abort:!1,...f.A2(t)})),e.guid=t=>e.check(v(J,t)),e.uuid=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,...f.A2(t)})),e.uuidv4=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f.A2(t)})),e.uuidv6=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f.A2(t)})),e.uuidv7=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f.A2(t)})),e.nanoid=t=>e.check(new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...f.A2(t)})),e.guid=t=>e.check(v(J,t)),e.cuid=t=>e.check(new B({type:"string",format:"cuid",check:"string_format",abort:!1,...f.A2(t)})),e.cuid2=t=>e.check(new G({type:"string",format:"cuid2",check:"string_format",abort:!1,...f.A2(t)})),e.ulid=t=>e.check(new X({type:"string",format:"ulid",check:"string_format",abort:!1,...f.A2(t)})),e.base64=t=>e.check(new en({type:"string",format:"base64",check:"string_format",abort:!1,...f.A2(t)})),e.base64url=t=>e.check(new eo({type:"string",format:"base64url",check:"string_format",abort:!1,...f.A2(t)})),e.xid=t=>e.check(new ee({type:"string",format:"xid",check:"string_format",abort:!1,...f.A2(t)})),e.ksuid=t=>e.check(new et({type:"string",format:"ksuid",check:"string_format",abort:!1,...f.A2(t)})),e.ipv4=t=>e.check(new er({type:"string",format:"ipv4",check:"string_format",abort:!1,...f.A2(t)})),e.ipv6=t=>e.check(new ea({type:"string",format:"ipv6",check:"string_format",abort:!1,...f.A2(t)})),e.cidrv4=t=>e.check(new es({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f.A2(t)})),e.cidrv6=t=>e.check(new ei({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f.A2(t)})),e.e164=t=>e.check(new el({type:"string",format:"e164",check:"string_format",abort:!1,...f.A2(t)})),e.datetime=t=>e.check(S(t)),e.date=t=>e.check(new O({type:"string",format:"date",check:"string_format",...f.A2(t)})),e.time=t=>e.check(new P({type:"string",format:"time",check:"string_format",precision:null,...f.A2(t)})),e.duration=t=>e.check(new A({type:"string",format:"duration",check:"string_format",...f.A2(t)}))});function U(e){return new H({type:"string",...f.A2(e)})}let D=p.xI("ZodStringFormat",(e,t)=>{h.EY.init(e,t),L.init(e,t)}),V=p.xI("ZodEmail",(e,t)=>{h.qG.init(e,t),D.init(e,t)}),J=p.xI("ZodGUID",(e,t)=>{h.Zc.init(e,t),D.init(e,t)}),W=p.xI("ZodUUID",(e,t)=>{h.Zn.init(e,t),D.init(e,t)}),Y=p.xI("ZodURL",(e,t)=>{h.VY.init(e,t),D.init(e,t)}),K=p.xI("ZodEmoji",(e,t)=>{h.cG.init(e,t),D.init(e,t)}),Q=p.xI("ZodNanoID",(e,t)=>{h.Py.init(e,t),D.init(e,t)}),B=p.xI("ZodCUID",(e,t)=>{h.bl.init(e,t),D.init(e,t)}),G=p.xI("ZodCUID2",(e,t)=>{h.Zu.init(e,t),D.init(e,t)}),X=p.xI("ZodULID",(e,t)=>{h.g5.init(e,t),D.init(e,t)}),ee=p.xI("ZodXID",(e,t)=>{h.TF.init(e,t),D.init(e,t)}),et=p.xI("ZodKSUID",(e,t)=>{h.GY.init(e,t),D.init(e,t)}),er=p.xI("ZodIPv4",(e,t)=>{h.Lc.init(e,t),D.init(e,t)}),ea=p.xI("ZodIPv6",(e,t)=>{h.Zy.init(e,t),D.init(e,t)}),es=p.xI("ZodCIDRv4",(e,t)=>{h.CI.init(e,t),D.init(e,t)}),ei=p.xI("ZodCIDRv6",(e,t)=>{h.Cn.init(e,t),D.init(e,t)}),en=p.xI("ZodBase64",(e,t)=>{h.Dq.init(e,t),D.init(e,t)}),eo=p.xI("ZodBase64URL",(e,t)=>{h.CQ.init(e,t),D.init(e,t)}),el=p.xI("ZodE164",(e,t)=>{h.Oy.init(e,t),D.init(e,t)}),eu=p.xI("ZodJWT",(e,t)=>{h.h8.init(e,t),D.init(e,t)}),ed=p.xI("ZodNumber",(e,t)=>{h.vz.init(e,t),F.init(e,t),e.gt=(t,r)=>e.check(k(t,r)),e.gte=(t,r)=>e.check(b(t,r)),e.min=(t,r)=>e.check(b(t,r)),e.lt=(t,r)=>e.check(_(t,r)),e.lte=(t,r)=>e.check(y(t,r)),e.max=(t,r)=>e.check(y(t,r)),e.int=t=>e.check(eh(t)),e.safe=t=>e.check(eh(t)),e.positive=t=>e.check(k(0,t)),e.nonnegative=t=>e.check(b(0,t)),e.negative=t=>e.check(_(0,t)),e.nonpositive=t=>e.check(y(0,t)),e.multipleOf=(t,r)=>e.check(w(t,r)),e.step=(t,r)=>e.check(w(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 ec(e){return new ed({type:"number",checks:[],...f.A2(e)})}let ep=p.xI("ZodNumberFormat",(e,t)=>{h.I.init(e,t),ed.init(e,t)});function eh(e){return new ep({type:"number",check:"number_format",abort:!1,format:"safeint",...f.A2(e)})}let ef=p.xI("ZodBoolean",(e,t)=>{h.sF.init(e,t),F.init(e,t)});function em(e){return new ef({type:"boolean",...f.A2(e)})}let eg=p.xI("ZodNull",(e,t)=>{h.x8.init(e,t),F.init(e,t)});function ev(e){return new eg({type:"null",...f.A2(e)})}let e_=p.xI("ZodUnknown",(e,t)=>{h.GP.init(e,t),F.init(e,t)});function ey(){return new e_({type:"unknown"})}let ek=p.xI("ZodNever",(e,t)=>{h.Um.init(e,t),F.init(e,t)}),eb=p.xI("ZodArray",(e,t)=>{h.$p.init(e,t),F.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(T(t,r)),e.nonempty=t=>e.check(T(1,t)),e.max=(t,r)=>e.check(x(t,r)),e.length=(t,r)=>e.check($(t,r)),e.unwrap=()=>e.element});function ew(e,t){return new eb({type:"array",element:e,...f.A2(t)})}let ex=p.xI("ZodObject",(e,t)=>{h.L8.init(e,t),F.init(e,t),f.gJ(e,"shape",()=>t.shape),e.keyof=()=>eN(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ey()}),e.loose=()=>e.clone({...e._zod.def,catchall:ey()}),e.strict=()=>{var t;return e.clone({...e._zod.def,catchall:(t=void 0,new ek({type:"never",...f.A2(t)}))})},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>f.X$(e,t),e.merge=t=>f.h1(e,t),e.pick=t=>f.Up(e,t),e.omit=t=>f.cJ(e,t),e.partial=(...t)=>f.OH(eF,e,t[0]),e.required=(...t)=>f.mw(eJ,e,t[0])});function eT(e,t){return new ex({type:"object",get shape(){return f.Vy(this,"shape",{...e}),this.shape},...f.A2(t)})}function e$(e,t){return new ex({type:"object",get shape(){return f.Vy(this,"shape",{...e}),this.shape},catchall:ey(),...f.A2(t)})}let eI=p.xI("ZodUnion",(e,t)=>{h.cu.init(e,t),F.init(e,t),e.options=t.options});function ez(e,t){return new eI({type:"union",options:e,...f.A2(t)})}let eS=p.xI("ZodDiscriminatedUnion",(e,t)=>{eI.init(e,t),h.P0.init(e,t)});function eO(e,t,r){return new eS({type:"union",options:t,discriminator:e,...f.A2(r)})}let eP=p.xI("ZodIntersection",(e,t)=>{h.LJ.init(e,t),F.init(e,t)});function eA(e,t){return new eP({type:"intersection",left:e,right:t})}let eZ=p.xI("ZodRecord",(e,t)=>{h.h.init(e,t),F.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function eE(e,t,r){return new eZ({type:"record",keyType:e,valueType:t,...f.A2(r)})}let eR=p.xI("ZodEnum",(e,t)=>{h.VO.init(e,t),F.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 s={};for(let a of e)if(r.has(a))s[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new eR({...t,checks:[],...f.A2(a),entries:s})},e.exclude=(e,a)=>{let s={...t.entries};for(let t of e)if(r.has(t))delete s[t];else throw Error(`Key ${t} not found in enum`);return new eR({...t,checks:[],...f.A2(a),entries:s})}});function eN(e,t){return new eR({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...f.A2(t)})}let eC=p.xI("ZodLiteral",(e,t)=>{h.nu.init(e,t),F.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 ej(e,t){return new eC({type:"literal",values:Array.isArray(e)?e:[e],...f.A2(t)})}let eM=p.xI("ZodTransform",(e,t)=>{h.Wc.init(e,t),F.init(e,t),e._zod.parse=(r,a)=>{r.addIssue=a=>{"string"==typeof a?r.issues.push(f.sn(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),a.continue??(a.continue=!0),r.issues.push(f.sn(a)))};let s=t.transform(r.value,r);return s instanceof Promise?s.then(e=>(r.value=e,r)):(r.value=s,r)}});function eq(e){return new eM({type:"transform",transform:e})}let eF=p.xI("ZodOptional",(e,t)=>{h.ig.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eL(e){return new eF({type:"optional",innerType:e})}let eH=p.xI("ZodNullable",(e,t)=>{h.qc.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eU(e){return new eH({type:"nullable",innerType:e})}let eD=p.xI("ZodDefault",(e,t)=>{h.rv.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),eV=p.xI("ZodPrefault",(e,t)=>{h.VF.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType}),eJ=p.xI("ZodNonOptional",(e,t)=>{h.N$.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType}),eW=p.xI("ZodCatch",(e,t)=>{h.t$.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),eY=p.xI("ZodPipe",(e,t)=>{h._m.init(e,t),F.init(e,t),e.in=t.in,e.out=t.out});function eK(e,t){return new eY({type:"pipe",in:e,out:t})}let eQ=p.xI("ZodReadonly",(e,t)=>{h.Sb.init(e,t),F.init(e,t)}),eB=p.xI("ZodCustom",(e,t)=>{h.b0.init(e,t),F.init(e,t)}),eG="2025-11-25",eX=[eG,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],e0="io.modelcontextprotocol/related-task",e1=(s=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),i=void 0,(a=f.A2(i)).abort??(a.abort=!0),new eB({type:"custom",check:"custom",fn:s,...a})),e9=ez([U(),ec().int()]),e2=U(),e4=e$({ttl:ez([ec(),ev()]).optional(),pollInterval:ec().optional()}),e5=e$({taskId:U()}),e3=e$({progressToken:e9.optional(),[e0]:e5.optional()}),e6=e$({task:e4.optional(),_meta:e3.optional()}),e8=eT({method:U(),params:e6.optional()}),e7=e$({_meta:eT({[e0]:eL(e5)}).passthrough().optional()}),te=eT({method:U(),params:e7.optional()}),tt=e$({_meta:e$({[e0]:e5.optional()}).optional()}),tr=ez([U(),ec().int()]),ta=eT({jsonrpc:ej("2.0"),id:tr,...e8.shape}).strict(),ts=e=>ta.safeParse(e).success,ti=eT({jsonrpc:ej("2.0"),...te.shape}).strict(),tn=e=>ti.safeParse(e).success,to=eT({jsonrpc:ej("2.0"),id:tr,result:tt}).strict(),tl=e=>to.safeParse(e).success;(n=c||(c={}))[n.ConnectionClosed=-32e3]="ConnectionClosed",n[n.RequestTimeout=-32001]="RequestTimeout",n[n.ParseError=-32700]="ParseError",n[n.InvalidRequest=-32600]="InvalidRequest",n[n.MethodNotFound=-32601]="MethodNotFound",n[n.InvalidParams=-32602]="InvalidParams",n[n.InternalError=-32603]="InternalError",n[n.UrlElicitationRequired=-32042]="UrlElicitationRequired";let tu=eT({jsonrpc:ej("2.0"),id:tr,error:eT({code:ec().int(),message:U(),data:eL(ey())})}).strict(),td=e=>tu.safeParse(e).success,tc=ez([ta,ti,to,tu]),tp=tt.strict(),th=e7.extend({requestId:tr,reason:U().optional()}),tf=te.extend({method:ej("notifications/cancelled"),params:th}),tm=eT({src:U(),mimeType:U().optional(),sizes:ew(U()).optional()}),tg=eT({icons:ew(tm).optional()}),tv=eT({name:U(),title:U().optional()}),t_=tv.extend({...tv.shape,...tg.shape,version:U(),websiteUrl:U().optional()}),ty=eA(eT({applyDefaults:em().optional()}),eE(U(),ey())),tk=(o=e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,l=eA(eT({form:ty.optional(),url:e1.optional()}),eE(U(),ey()).optional()),eK(eq(o),l)),tb=eT({list:eL(eT({}).passthrough()),cancel:eL(eT({}).passthrough()),requests:eL(eT({sampling:eL(eT({createMessage:eL(eT({}).passthrough())}).passthrough()),elicitation:eL(eT({create:eL(eT({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),tw=eT({list:eL(eT({}).passthrough()),cancel:eL(eT({}).passthrough()),requests:eL(eT({tools:eL(eT({call:eL(eT({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),tx=eT({experimental:eE(U(),e1).optional(),sampling:eT({context:e1.optional(),tools:e1.optional()}).optional(),elicitation:tk.optional(),roots:eT({listChanged:em().optional()}).optional(),tasks:eL(tb)}),tT=e6.extend({protocolVersion:U(),capabilities:tx,clientInfo:t_}),t$=e8.extend({method:ej("initialize"),params:tT}),tI=eT({experimental:eE(U(),e1).optional(),logging:e1.optional(),completions:e1.optional(),prompts:eL(eT({listChanged:eL(em())})),resources:eT({subscribe:em().optional(),listChanged:em().optional()}).optional(),tools:eT({listChanged:em().optional()}).optional(),tasks:eL(tw)}).passthrough(),tz=tt.extend({protocolVersion:U(),capabilities:tI,serverInfo:t_,instructions:U().optional()}),tS=te.extend({method:ej("notifications/initialized")}),tO=e8.extend({method:ej("ping")}),tP=eT({progress:ec(),total:eL(ec()),message:eL(U())}),tA=eT({...e7.shape,...tP.shape,progressToken:e9}),tZ=te.extend({method:ej("notifications/progress"),params:tA}),tE=e6.extend({cursor:e2.optional()}),tR=e8.extend({params:tE.optional()}),tN=tt.extend({nextCursor:eL(e2)}),tC=eT({taskId:U(),status:eN(["working","input_required","completed","failed","cancelled"]),ttl:ez([ec(),ev()]),createdAt:U(),lastUpdatedAt:U(),pollInterval:eL(ec()),statusMessage:eL(U())}),tj=tt.extend({task:tC}),tM=e7.merge(tC),tq=te.extend({method:ej("notifications/tasks/status"),params:tM}),tF=e8.extend({method:ej("tasks/get"),params:e6.extend({taskId:U()})}),tL=tt.merge(tC),tH=e8.extend({method:ej("tasks/result"),params:e6.extend({taskId:U()})}),tU=tR.extend({method:ej("tasks/list")}),tD=tN.extend({tasks:ew(tC)}),tV=e8.extend({method:ej("tasks/cancel"),params:e6.extend({taskId:U()})}),tJ=tt.merge(tC),tW=eT({uri:U(),mimeType:eL(U()),_meta:eE(U(),ey()).optional()}),tY=tW.extend({text:U()}),tK=U().refine(e=>{try{return atob(e),!0}catch(e){return!1}},{message:"Invalid Base64 string"}),tQ=tW.extend({blob:tK}),tB=eT({audience:ew(eN(["user","assistant"])).optional(),priority:ec().min(0).max(1).optional(),lastModified:S({offset:!0}).optional()}),tG=eT({...tv.shape,...tg.shape,uri:U(),description:eL(U()),mimeType:eL(U()),annotations:tB.optional(),_meta:eL(e$({}))}),tX=eT({...tv.shape,...tg.shape,uriTemplate:U(),description:eL(U()),mimeType:eL(U()),annotations:tB.optional(),_meta:eL(e$({}))}),t0=tR.extend({method:ej("resources/list")}),t1=tN.extend({resources:ew(tG)}),t9=tR.extend({method:ej("resources/templates/list")}),t2=tN.extend({resourceTemplates:ew(tX)}),t4=e6.extend({uri:U()}),t5=e8.extend({method:ej("resources/read"),params:t4}),t3=tt.extend({contents:ew(ez([tY,tQ]))}),t6=te.extend({method:ej("notifications/resources/list_changed")}),t8=e8.extend({method:ej("resources/subscribe"),params:t4}),t7=e8.extend({method:ej("resources/unsubscribe"),params:t4}),re=e7.extend({uri:U()}),rt=te.extend({method:ej("notifications/resources/updated"),params:re}),rr=eT({name:U(),description:eL(U()),required:eL(em())}),ra=eT({...tv.shape,...tg.shape,description:eL(U()),arguments:eL(ew(rr)),_meta:eL(e$({}))}),rs=tR.extend({method:ej("prompts/list")}),ri=tN.extend({prompts:ew(ra)}),rn=e6.extend({name:U(),arguments:eE(U(),U()).optional()}),ro=e8.extend({method:ej("prompts/get"),params:rn}),rl=eT({type:ej("text"),text:U(),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),ru=eT({type:ej("image"),data:tK,mimeType:U(),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),rd=eT({type:ej("audio"),data:tK,mimeType:U(),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),rc=eT({type:ej("tool_use"),name:U(),id:U(),input:eT({}).passthrough(),_meta:eL(eT({}).passthrough())}).passthrough(),rp=eT({type:ej("resource"),resource:ez([tY,tQ]),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),rh=ez([rl,ru,rd,tG.extend({type:ej("resource_link")}),rp]),rf=eT({role:eN(["user","assistant"]),content:rh}),rm=tt.extend({description:eL(U()),messages:ew(rf)}),rg=te.extend({method:ej("notifications/prompts/list_changed")}),rv=eT({title:U().optional(),readOnlyHint:em().optional(),destructiveHint:em().optional(),idempotentHint:em().optional(),openWorldHint:em().optional()}),r_=eT({taskSupport:eN(["required","optional","forbidden"]).optional()}),ry=eT({...tv.shape,...tg.shape,description:U().optional(),inputSchema:eT({type:ej("object"),properties:eE(U(),e1).optional(),required:ew(U()).optional()}).catchall(ey()),outputSchema:eT({type:ej("object"),properties:eE(U(),e1).optional(),required:ew(U()).optional()}).catchall(ey()).optional(),annotations:eL(rv),execution:eL(r_),_meta:eE(U(),ey()).optional()}),rk=tR.extend({method:ej("tools/list")}),rb=tN.extend({tools:ew(ry)}),rw=tt.extend({content:ew(rh).default([]),structuredContent:eE(U(),ey()).optional(),isError:eL(em())});rw.or(tt.extend({toolResult:ey()}));let rx=e6.extend({name:U(),arguments:eL(eE(U(),ey()))}),rT=e8.extend({method:ej("tools/call"),params:rx}),r$=te.extend({method:ej("notifications/tools/list_changed")}),rI=eN(["debug","info","notice","warning","error","critical","alert","emergency"]),rz=e6.extend({level:rI}),rS=e8.extend({method:ej("logging/setLevel"),params:rz}),rO=e7.extend({level:rI,logger:U().optional(),data:ey()}),rP=te.extend({method:ej("notifications/message"),params:rO}),rA=eT({name:U().optional()}),rZ=eT({hints:eL(ew(rA)),costPriority:eL(ec().min(0).max(1)),speedPriority:eL(ec().min(0).max(1)),intelligencePriority:eL(ec().min(0).max(1))}),rE=eT({mode:eL(eN(["auto","required","none"]))}),rR=eT({type:ej("tool_result"),toolUseId:U().describe("The unique identifier for the corresponding tool call."),content:ew(rh).default([]),structuredContent:eT({}).passthrough().optional(),isError:eL(em()),_meta:eL(eT({}).passthrough())}).passthrough(),rN=eO("type",[rl,ru,rd]),rC=eO("type",[rl,ru,rd,rc,rR]),rj=eT({role:eN(["user","assistant"]),content:ez([rC,ew(rC)]),_meta:eL(eT({}).passthrough())}).passthrough(),rM=e6.extend({messages:ew(rj),modelPreferences:rZ.optional(),systemPrompt:U().optional(),includeContext:eN(["none","thisServer","allServers"]).optional(),temperature:ec().optional(),maxTokens:ec().int(),stopSequences:ew(U()).optional(),metadata:e1.optional(),tools:eL(ew(ry)),toolChoice:eL(rE)}),rq=e8.extend({method:ej("sampling/createMessage"),params:rM}),rF=tt.extend({model:U(),stopReason:eL(eN(["endTurn","stopSequence","maxTokens"]).or(U())),role:eN(["user","assistant"]),content:rN}),rL=tt.extend({model:U(),stopReason:eL(eN(["endTurn","stopSequence","maxTokens","toolUse"]).or(U())),role:eN(["user","assistant"]),content:ez([rC,ew(rC)])}),rH=eT({type:ej("boolean"),title:U().optional(),description:U().optional(),default:em().optional()}),rU=eT({type:ej("string"),title:U().optional(),description:U().optional(),minLength:ec().optional(),maxLength:ec().optional(),format:eN(["email","uri","date","date-time"]).optional(),default:U().optional()}),rD=eT({type:eN(["number","integer"]),title:U().optional(),description:U().optional(),minimum:ec().optional(),maximum:ec().optional(),default:ec().optional()}),rV=eT({type:ej("string"),title:U().optional(),description:U().optional(),enum:ew(U()),default:U().optional()}),rJ=eT({type:ej("string"),title:U().optional(),description:U().optional(),oneOf:ew(eT({const:U(),title:U()})),default:U().optional()}),rW=eT({type:ej("string"),title:U().optional(),description:U().optional(),enum:ew(U()),enumNames:ew(U()).optional(),default:U().optional()}),rY=ez([rV,rJ]),rK=ez([eT({type:ej("array"),title:U().optional(),description:U().optional(),minItems:ec().optional(),maxItems:ec().optional(),items:eT({type:ej("string"),enum:ew(U())}),default:ew(U()).optional()}),eT({type:ej("array"),title:U().optional(),description:U().optional(),minItems:ec().optional(),maxItems:ec().optional(),items:eT({anyOf:ew(eT({const:U(),title:U()}))}),default:ew(U()).optional()})]),rQ=ez([rW,rY,rK]),rB=ez([rQ,rH,rU,rD]),rG=ez([e6.extend({mode:ej("form").optional(),message:U(),requestedSchema:eT({type:ej("object"),properties:eE(U(),rB),required:ew(U()).optional()})}),e6.extend({mode:ej("url"),message:U(),elicitationId:U(),url:U().url()})]),rX=e8.extend({method:ej("elicitation/create"),params:rG}),r0=e7.extend({elicitationId:U()}),r1=te.extend({method:ej("notifications/elicitation/complete"),params:r0}),r9=tt.extend({action:eN(["accept","decline","cancel"]),content:(u=e=>null===e?void 0:e,d=eE(U(),ez([U(),ec(),em(),ew(U())])).optional(),eK(eq(u),d))}),r2=eT({type:ej("ref/resource"),uri:U()}),r4=eT({type:ej("ref/prompt"),name:U()}),r5=e6.extend({ref:ez([r4,r2]),argument:eT({name:U(),value:U()}),context:eT({arguments:eE(U(),U()).optional()}).optional()}),r3=e8.extend({method:ej("completion/complete"),params:r5});function r6(e){if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function r8(e){if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}let r7=tt.extend({completion:e$({values:ew(U()).max(100),total:eL(ec().int()),hasMore:eL(em())})}),ae=eT({uri:U().startsWith("file://"),name:U().optional(),_meta:eE(U(),ey()).optional()}),at=e8.extend({method:ej("roots/list")}),ar=tt.extend({roots:ew(ae)}),aa=te.extend({method:ej("notifications/roots/list_changed")});ez([tO,t$,r3,rS,ro,rs,t0,t9,t5,t8,t7,rT,rk,tF,tH,tU]),ez([tf,tZ,tS,aa,tq]),ez([tp,rF,rL,r9,ar,tL,tD,tj]),ez([tO,rq,rX,at,tF,tH,tU]),ez([tf,tZ,rP,rt,t6,r$,rg,tq,r1]),ez([tp,tz,r7,rm,ri,t1,t2,t3,rw,rb,tL,tD,tj]);class as 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===c.UrlElicitationRequired&&r&&r.elicitations?new ai(r.elicitations,t):new as(e,t,r)}}class ai extends as{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(c.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){var e,t;return null!=(t=null==(e=this.data)?void 0:e.elicitations)?t:[]}}},84867(e,t,r){var a,s,i,n,o,l,u;let d;r.d(t,{k5:()=>eC,bz:()=>eA,g1:()=>eN,zM:()=>eP,ai:()=>eO,kY:()=>n,Ik:()=>eE,YO:()=>eZ,Yj:()=>eS,KC:()=>eR}),(o=a||(a={})).assertEqual=e=>{},o.assertIs=function(e){},o.assertNever=function(e){throw Error()},o.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},o.getValidEnumValues=e=>{let t=o.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return o.objectValues(r)},o.objectValues=e=>o.objectKeys(e).map(function(t){return e[t]}),o.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},o.find=(e,t)=>{for(let r of e)if(t(r))return r},o.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,o.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},o.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(s||(s={})).mergeShapes=(e,t)=>({...e,...t});let c=a.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),p=e=>{switch(typeof e){case"undefined":return c.undefined;case"string":return c.string;case"number":return Number.isNaN(e)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":if(Array.isArray(e))return c.array;if(null===e)return c.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return c.promise;if("u">typeof Map&&e instanceof Map)return c.map;if("u">typeof Set&&e instanceof Set)return c.set;if("u">typeof Date&&e instanceof Date)return c.date;return c.object;default:return c.unknown}},h=a.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 f 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]};let 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 s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){let r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof f))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,a.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},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()}}f.create=e=>new f(e);let m=(e,t)=>{let r;switch(e.code){case h.invalid_type:r=e.received===c.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,a.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:r=`Unrecognized key(s) in object: ${a.joinValues(e.keys,", ")}`;break;case h.invalid_union:r="Invalid input";break;case h.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${a.joinValues(e.options)}`;break;case h.invalid_enum_value:r=`Invalid enum value. Expected ${a.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:r="Invalid function arguments";break;case h.invalid_return_type:r="Invalid function return type";break;case h.invalid_date:r="Invalid date";break;case h.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}"`:a.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case h.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 h.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 h.custom:r="Invalid input";break;case h.invalid_intersection_types:r="Intersection results could not be merged";break;case h.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:r="Number must be finite";break;default:r=t.defaultError,a.assertNever(e)}return{message:r}};(l=i||(i={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},l.toString=e=>"string"==typeof e?e:e?.message;let g=e=>{let{data:t,path:r,errorMaps:a,issueData:s}=e,i=[...r,...s.path||[]],n={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";for(let e of a.filter(e=>!!e).slice().reverse())o=e(n,{data:t,defaultError:o}).message;return{...s,path:i,message:o}};function v(e,t){let r=g({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,m,void 0].filter(e=>!!e)});e.common.issues.push(r)}class _{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 y;"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 _.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:s}=a;if("aborted"===t.status||"aborted"===s.status)return y;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==s.value||a.alwaysSet)&&(r[t.value]=s.value)}return{status:e.value,value:r}}}let y=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),b=e=>({status:"valid",value:e}),w=e=>"u">typeof Promise&&e instanceof Promise;class x{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 T=(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 f(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:s}=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:s}:{errorMap:(t,s)=>{let{message:i}=e;return"invalid_enum_value"===t.code?{message:i??s.defaultError}:void 0===s.data?{message:i??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:i??r??s.defaultError}},description:s}}class I{get description(){return this._def.description}_getType(e){return p(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _,ctx:{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(w(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:p(e)},a=this._parseSync({data:e,path:r.path,parent:r});return T(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(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:p(e)},a=this._parse({data:e,path:r.path,parent:r});return T(r,await (w(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let s=e(r),i=()=>a.addIssue({code:h.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&s instanceof Promise?s.then(e=>!!e||(i(),!1)):!!s||(i(),!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 ey({schema:this,typeName:n.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 ek.create(this,this._def)}nullable(){return eb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return er.create(this)}promise(){return e_.create(this,this._def)}or(e){return es.create([this,e],this._def)}and(e){return eo.create(this,e,this._def)}transform(e){return new ey({...$(this._def),schema:this,typeName:n.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ew({...$(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:n.ZodDefault})}brand(){return new e$({typeName:n.ZodBranded,type:this,...$(this._def)})}catch(e){return new ex({...$(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:n.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eI.create(this,e)}readonly(){return ez.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let z=/^c[^\s-]{8,}$/i,S=/^[0-9a-z]+$/,O=/^[0-9A-HJKMNP-TV-Z]{26}$/i,P=/^[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,A=/^[a-z0-9_-]{21}$/i,Z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,E=/^[-+]?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)?)??$/,R=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,N=/^(?:(?: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])$/,C=/^(?:(?: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])$/,j=/^(([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]))$/,M=/^(([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])$/,q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,F=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L="((\\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])))",H=RegExp(`^${L}$`);function U(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 D extends I{_parse(e){var t,r,s,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==c.string){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.string,received:t.parsedType}),y}let o=new _;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(v(n=this._getOrReturnCtx(e,n),{code:h.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&&(v(n=this._getOrReturnCtx(e,n),{code:h.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?v(n,{code:h.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&v(n,{code:h.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)R.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"email",code:h.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)d||(d=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),d.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:h.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)P.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:h.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)A.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:h.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)z.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:h.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)S.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:h.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)O.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:h.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{v(n=this._getOrReturnCtx(e,n),{validation:"url",code:h.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"regex",code:h.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)||(v(n=this._getOrReturnCtx(e,n),{code:h.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)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${L}T${U(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)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?H.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${U(l)}$`).test(e.data)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?E.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"duration",code:h.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(t=e.data,!(("v4"===(r=l.version)||!r)&&N.test(t)||("v6"===r||!r)&&j.test(t))&&1&&(v(n=this._getOrReturnCtx(e,n),{validation:"ip",code:h.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!Z.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,"="),s=JSON.parse(atob(a));if("object"!=typeof s||null===s||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)return!1;return!0}catch{return!1}}(e.data,l.alg)&&(v(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:h.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(s=e.data,!(("v4"===(i=l.version)||!i)&&C.test(s)||("v6"===i||!i)&&M.test(s))&&1&&(v(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:h.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?q.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"base64",code:h.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?F.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:h.invalid_string,message:l.message}),o.dirty()):a.assertNever(l);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:h.invalid_string,...i.errToObj(r)})}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...i.errToObj(e)})}url(e){return this._addCheck({kind:"url",...i.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...i.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...i.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...i.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...i.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...i.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...i.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...i.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...i.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...i.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...i.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...i.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,...i.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,...i.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...i.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...i.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...i.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...i.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...i.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...i.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...i.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...i.errToObj(t)})}nonempty(e){return this.min(1,i.errToObj(e))}trim(){return new D({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new D({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new D({...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}}D.create=e=>new D({checks:[],typeName:n.ZodString,coerce:e?.coerce??!1,...$(e)});class V extends I{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)!==c.number){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.number,received:t.parsedType}),y}let r=new _;for(let s of this._def.checks)"int"===s.kind?a.isInteger(e.data)||(v(t=this._getOrReturnCtx(e,t),{code:h.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"multipleOf"===s.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(e.data,s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(v(t=this._getOrReturnCtx(e,t),{code:h.not_finite,message:s.message}),r.dirty()):a.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,i.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.toString(t))}setLimit(e,t,r,a){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:i.toString(a)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:i.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:i.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:i.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:i.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:i.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:i.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:i.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:i.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&&a.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)}}V.create=e=>new V({checks:[],typeName:n.ZodNumber,coerce:e?.coerce||!1,...$(e)});class J extends I{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)!==c.bigint)return this._getInvalidInput(e);let r=new _;for(let s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(v(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):a.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,i.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.toString(t))}setLimit(e,t,r,a){return new J({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:i.toString(a)}]})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:i.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:i.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:i.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:i.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.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}}J.create=e=>new J({checks:[],typeName:n.ZodBigInt,coerce:e?.coerce??!1,...$(e)});class W extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==c.boolean){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.boolean,received:t.parsedType}),y}return b(e.data)}}W.create=e=>new W({typeName:n.ZodBoolean,coerce:e?.coerce||!1,...$(e)});class Y extends I{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==c.date){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.date,received:t.parsedType}),y}if(Number.isNaN(e.data.getTime()))return v(this._getOrReturnCtx(e),{code:h.invalid_date}),y;let r=new _;for(let s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):a.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:i.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:i.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}}Y.create=e=>new Y({checks:[],coerce:e?.coerce||!1,typeName:n.ZodDate,...$(e)});class K extends I{_parse(e){if(this._getType(e)!==c.symbol){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.symbol,received:t.parsedType}),y}return b(e.data)}}K.create=e=>new K({typeName:n.ZodSymbol,...$(e)});class Q extends I{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.undefined,received:t.parsedType}),y}return b(e.data)}}Q.create=e=>new Q({typeName:n.ZodUndefined,...$(e)});class B extends I{_parse(e){if(this._getType(e)!==c.null){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.null,received:t.parsedType}),y}return b(e.data)}}B.create=e=>new B({typeName:n.ZodNull,...$(e)});class G extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return b(e.data)}}G.create=e=>new G({typeName:n.ZodAny,...$(e)});class X extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return b(e.data)}}X.create=e=>new X({typeName:n.ZodUnknown,...$(e)});class ee extends I{_parse(e){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.never,received:t.parsedType}),y}}ee.create=e=>new ee({typeName:n.ZodNever,...$(e)});class et extends I{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.void,received:t.parsedType}),y}return b(e.data)}}et.create=e=>new et({typeName:n.ZodVoid,...$(e)});class er extends I{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==c.array)return v(t,{code:h.invalid_type,expected:c.array,received:t.parsedType}),y;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(v(t,{code:e?h.too_big:h.too_small,minimum:s?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&&(v(t,{code:h.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&&(v(t,{code:h.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 x(t,e,t.path,r)))).then(e=>_.mergeArray(r,e));let s=[...t.data].map((e,r)=>a.type._parseSync(new x(t,e,t.path,r)));return _.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new er({...this._def,minLength:{value:e,message:i.toString(t)}})}max(e,t){return new er({...this._def,maxLength:{value:e,message:i.toString(t)}})}length(e,t){return new er({...this._def,exactLength:{value:e,message:i.toString(t)}})}nonempty(e){return this.min(1,e)}}er.create=(e,t)=>new er({type:e,minLength:null,maxLength:null,exactLength:null,typeName:n.ZodArray,...$(t)});class ea extends I{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=a.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==c.object){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),y}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof ee&&"strip"===this._def.unknownKeys))for(let e in r.data)s.includes(e)||i.push(e);let n=[];for(let e of s){let t=a[e],s=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new x(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ee){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of i)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(v(r,{code:h.unrecognized_keys,keys:i}),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 i){let a=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new x(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=>_.mergeObjectSync(t,e)):_.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return i.errToObj,new ea({...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:i.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new ea({...this._def,unknownKeys:"strip"})}passthrough(){return new ea({...this._def,unknownKeys:"passthrough"})}extend(e){return new ea({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ea({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:n.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ea({...this._def,catchall:e})}pick(e){let t={};for(let r of a.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ea({...this._def,shape:()=>t})}omit(e){let t={};for(let r of a.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ea({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ea){let r={};for(let a in t.shape){let s=t.shape[a];r[a]=ek.create(e(s))}return new ea({...t._def,shape:()=>r})}if(t instanceof er)return new er({...t._def,type:e(t.element)});if(t instanceof ek)return ek.create(e(t.unwrap()));if(t instanceof eb)return eb.create(e(t.unwrap()));if(t instanceof el)return el.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of a.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new ea({...this._def,shape:()=>t})}required(e){let t={};for(let r of a.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ek;)e=e._def.innerType;t[r]=e}return new ea({...this._def,shape:()=>t})}keyof(){return em(a.objectKeys(this.shape))}}ea.create=(e,t)=>new ea({shape:()=>e,unknownKeys:"strip",catchall:ee.create(),typeName:n.ZodObject,...$(t)}),ea.strictCreate=(e,t)=>new ea({shape:()=>e,unknownKeys:"strict",catchall:ee.create(),typeName:n.ZodObject,...$(t)}),ea.lazycreate=(e,t)=>new ea({shape:e,unknownKeys:"strip",catchall:ee.create(),typeName:n.ZodObject,...$(t)});class es extends I{_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 f(e.ctx.common.issues));return v(t,{code:h.invalid_union,unionErrors:r}),y});{let e,a=[];for(let s of r){let r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,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 s=a.map(e=>new f(e));return v(t,{code:h.invalid_union,unionErrors:s}),y}}get options(){return this._def.options}}es.create=(e,t)=>new es({options:e,typeName:n.ZodUnion,...$(t)});let ei=e=>{if(e instanceof eh)return ei(e.schema);if(e instanceof ey)return ei(e.innerType());if(e instanceof ef)return[e.value];if(e instanceof eg)return e.options;if(e instanceof ev)return a.objectValues(e.enum);else if(e instanceof ew)return ei(e._def.innerType);else if(e instanceof Q)return[void 0];else if(e instanceof B)return[null];else if(e instanceof ek)return[void 0,...ei(e.unwrap())];else if(e instanceof eb)return[null,...ei(e.unwrap())];else if(e instanceof e$)return ei(e.unwrap());else if(e instanceof ez)return ei(e.unwrap());else if(e instanceof ex)return ei(e._def.innerType);else return[]};class en extends I{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.object)return v(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),y;let r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(v(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),y)}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=ei(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of t){if(a.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new en({typeName:n.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$(r)})}}class eo extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if("aborted"===e.status||"aborted"===s.status)return y;let i=function e(t,r){let s=p(t),i=p(r);if(t===r)return{valid:!0,data:t};if(s===c.object&&i===c.object){let s=a.objectKeys(r),i=a.objectKeys(t).filter(e=>-1!==s.indexOf(e)),n={...t,...r};for(let a of i){let s=e(t[a],r[a]);if(!s.valid)return{valid:!1};n[a]=s.data}return{valid:!0,data:n}}if(s===c.array&&i===c.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};a.push(i.data)}return{valid:!0,data:a}}if(s===c.date&&i===c.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,s.value);return i.valid?(("dirty"===e.status||"dirty"===s.status)&&t.dirty(),{status:t.value,value:i.data}):(v(r,{code:h.invalid_intersection_types}),y)};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])=>s(e,t)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eo.create=(e,t,r)=>new eo({left:e,right:t,typeName:n.ZodIntersection,...$(r)});class el extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.array)return v(r,{code:h.invalid_type,expected:c.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return v(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(v(r,{code:h.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 x(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>_.mergeArray(t,e)):_.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new el({...this._def,rest:e})}}el.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new el({items:e,typeName:n.ZodTuple,rest:null,...$(t)})};class eu extends I{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!==c.object)return v(r,{code:h.invalid_type,expected:c.object,received:r.parsedType}),y;let a=[],s=this._def.keyType,i=this._def.valueType;for(let e in r.data)a.push({key:s._parse(new x(r,e,r.path,e)),value:i._parse(new x(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?_.mergeObjectAsync(t,a):_.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new eu(t instanceof I?{keyType:e,valueType:t,typeName:n.ZodRecord,...$(r)}:{keyType:D.create(),valueType:e,typeName:n.ZodRecord,...$(t)})}}class ed extends I{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!==c.map)return v(r,{code:h.invalid_type,expected:c.map,received:r.parsedType}),y;let a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new x(r,e,r.path,[i,"key"])),value:s._parse(new x(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of i){let a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return y;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of i){let a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return y;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}ed.create=(e,t,r)=>new ed({valueType:t,keyType:e,typeName:n.ZodMap,...$(r)});class ec extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.set)return v(r,{code:h.invalid_type,expected:c.set,received:r.parsedType}),y;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(v(r,{code:h.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&&(v(r,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function i(e){let r=new Set;for(let a of e){if("aborted"===a.status)return y;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let n=[...r.data.values()].map((e,t)=>s._parse(new x(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>i(e)):i(n)}min(e,t){return new ec({...this._def,minSize:{value:e,message:i.toString(t)}})}max(e,t){return new ec({...this._def,maxSize:{value:e,message:i.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ec.create=(e,t)=>new ec({valueType:e,minSize:null,maxSize:null,typeName:n.ZodSet,...$(t)});class ep extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.function)return v(t,{code:h.invalid_type,expected:c.function,received:t.parsedType}),y;function r(e,r){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m,m].filter(e=>!!e),issueData:{code:h.invalid_arguments,argumentsError:r}})}function a(e,r){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m,m].filter(e=>!!e),issueData:{code:h.invalid_return_type,returnTypeError:r}})}let s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof e_){let e=this;return b(async function(...t){let n=new f([]),o=await e._def.args.parseAsync(t,s).catch(e=>{throw n.addIssue(r(t,e)),n}),l=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(l,s).catch(e=>{throw n.addIssue(a(l,e)),n})})}{let e=this;return b(function(...t){let n=e._def.args.safeParse(t,s);if(!n.success)throw new f([r(t,n.error)]);let o=Reflect.apply(i,this,n.data),l=e._def.returns.safeParse(o,s);if(!l.success)throw new f([a(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ep({...this._def,args:el.create(e).rest(X.create())})}returns(e){return new ep({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ep({args:e||el.create([]).rest(X.create()),returns:t||X.create(),typeName:n.ZodFunction,...$(r)})}}class eh extends I{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})}}eh.create=(e,t)=>new eh({getter:e,typeName:n.ZodLazy,...$(t)});class ef extends I{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}function em(e,t){return new eg({values:e,typeName:n.ZodEnum,...$(t)})}ef.create=(e,t)=>new ef({value:e,typeName:n.ZodLiteral,...$(t)});class eg extends I{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return v(t,{expected:a.joinValues(r),received:t.parsedType,code:h.invalid_type}),y}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 v(t,{received:t.data,code:h.invalid_enum_value,options:r}),y}return b(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 eg.create(e,{...this._def,...t})}exclude(e,t=this._def){return eg.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}eg.create=em;class ev extends I{_parse(e){let t=a.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==c.string&&r.parsedType!==c.number){let e=a.objectValues(t);return v(r,{expected:a.joinValues(e),received:r.parsedType,code:h.invalid_type}),y}if(this._cache||(this._cache=new Set(a.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=a.objectValues(t);return v(r,{received:r.data,code:h.invalid_enum_value,options:e}),y}return b(e.data)}get enum(){return this._def.values}}ev.create=(e,t)=>new ev({values:e,typeName:n.ZodNativeEnum,...$(t)});class e_ extends I{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==c.promise&&!1===t.common.async?(v(t,{code:h.invalid_type,expected:c.promise,received:t.parsedType}),y):b((t.parsedType===c.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}e_.create=(e,t)=>new e_({type:e,typeName:n.ZodPromise,...$(t)});class ey extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===n.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:e=>{v(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===s.type){let e=s.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return y;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?y:"dirty"===a.status||"dirty"===t.value?k(a.value):a});{if("aborted"===t.value)return y;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?y:"dirty"===a.status||"dirty"===t.value?k(a.value):a}}if("refinement"===s.type){let e=e=>{let t=s.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?y:("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?y:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===s.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?y:Promise.resolve(s.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 y;let a=s.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}a.assertNever(s)}}ey.create=(e,t,r)=>new ey({schema:e,typeName:n.ZodEffects,effect:t,...$(r)}),ey.createWithPreprocess=(e,t,r)=>new ey({schema:t,effect:{type:"preprocess",transform:e},typeName:n.ZodEffects,...$(r)});class ek extends I{_parse(e){return this._getType(e)===c.undefined?b(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ek.create=(e,t)=>new ek({innerType:e,typeName:n.ZodOptional,...$(t)});class eb extends I{_parse(e){return this._getType(e)===c.null?b(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eb.create=(e,t)=>new eb({innerType:e,typeName:n.ZodNullable,...$(t)});class ew extends I{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===c.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ew.create=(e,t)=>new ew({innerType:e,typeName:n.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$(t)});class ex extends I{_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 w(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new f(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new f(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ex.create=(e,t)=>new ex({innerType:e,typeName:n.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$(t)});class eT extends I{_parse(e){if(this._getType(e)!==c.nan){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.nan,received:t.parsedType}),y}return{status:"valid",value:e.data}}}eT.create=e=>new eT({typeName:n.ZodNaN,...$(e)}),Symbol("zod_brand");class e$ extends I{_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 eI extends I{_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?y:"dirty"===e.status?(t.dirty(),k(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?y:"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 eI({in:e,out:t,typeName:n.ZodPipeline})}}class ez extends I{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return w(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}ez.create=(e,t)=>new ez({innerType:e,typeName:n.ZodReadonly,...$(t)}),ea.lazycreate,(u=n||(n={})).ZodString="ZodString",u.ZodNumber="ZodNumber",u.ZodNaN="ZodNaN",u.ZodBigInt="ZodBigInt",u.ZodBoolean="ZodBoolean",u.ZodDate="ZodDate",u.ZodSymbol="ZodSymbol",u.ZodUndefined="ZodUndefined",u.ZodNull="ZodNull",u.ZodAny="ZodAny",u.ZodUnknown="ZodUnknown",u.ZodNever="ZodNever",u.ZodVoid="ZodVoid",u.ZodArray="ZodArray",u.ZodObject="ZodObject",u.ZodUnion="ZodUnion",u.ZodDiscriminatedUnion="ZodDiscriminatedUnion",u.ZodIntersection="ZodIntersection",u.ZodTuple="ZodTuple",u.ZodRecord="ZodRecord",u.ZodMap="ZodMap",u.ZodSet="ZodSet",u.ZodFunction="ZodFunction",u.ZodLazy="ZodLazy",u.ZodLiteral="ZodLiteral",u.ZodEnum="ZodEnum",u.ZodEffects="ZodEffects",u.ZodNativeEnum="ZodNativeEnum",u.ZodOptional="ZodOptional",u.ZodNullable="ZodNullable",u.ZodDefault="ZodDefault",u.ZodCatch="ZodCatch",u.ZodPromise="ZodPromise",u.ZodBranded="ZodBranded",u.ZodPipeline="ZodPipeline",u.ZodReadonly="ZodReadonly";let eS=D.create,eO=V.create;eT.create,J.create;let eP=W.create;Y.create,K.create,Q.create,B.create;let eA=G.create;X.create,ee.create,et.create;let eZ=er.create,eE=ea.create;ea.strictCreate;let eR=es.create;en.create,eo.create,el.create;let eN=eu.create;ed.create,ec.create,ep.create,eh.create,ef.create;let eC=eg.create;ev.create,e_.create,ey.create,ek.create,eb.create,ey.createWithPreprocess,eI.create},45830(e,t,r){r.d(t,{DG:()=>g,E6:()=>b,J:()=>k,J_:()=>u,Jk:()=>d,KH:()=>c,Kk:()=>h,NI:()=>v,QP:()=>n,RM:()=>f,Tt:()=>y,Yk:()=>p,kH:()=>_,ql:()=>m,sm:()=>l,v$:()=>w});var a=r(98824),s=r(72512),i=r(18399);let n=a.xI("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),o={number:"number",bigint:"bigint",object:"date"},l=a.xI("$ZodCheckLessThan",(e,t)=>{n.init(e,t);let r=o[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})}}),u=a.xI("$ZodCheckGreaterThan",(e,t)=>{n.init(e,t);let r=o[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})}}),d=a.xI("$ZodCheckMultipleOf",(e,t)=>{n.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===i.LG(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})}}),c=a.xI("$ZodCheckNumberFormat",(e,t)=>{n.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[o,l]=i.zH[t.format];e._zod.onattach.push(e=>{let a=e._zod.bag;a.format=t.format,a.minimum=o,a.maximum=l,r&&(a.pattern=s.nd)}),e._zod.check=s=>{let i=s.value;if(r){if(!Number.isInteger(i))return void s.issues.push({expected:a,format:t.format,code:"invalid_type",input:i,inst:e});if(!Number.isSafeInteger(i))return void(i>0?s.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):s.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}))}i<o&&s.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),i>l&&s.issues.push({origin:"number",input:i,code:"too_big",maximum:l,inst:e})}}),p=a.xI("$ZodCheckMaxLength",(e,t)=>{var r;n.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!i.cl(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 s=i.Rc(a);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),h=a.xI("$ZodCheckMinLength",(e,t)=>{var r;n.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!i.cl(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 s=i.Rc(a);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),f=a.xI("$ZodCheckLengthEquals",(e,t)=>{var r;n.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!i.cl(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,s=a.length;if(s===t.length)return;let n=i.Rc(a),o=s>t.length;r.issues.push({origin:n,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),m=a.xI("$ZodCheckStringFormat",(e,t)=>{var r,a;n.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=()=>{})}),g=a.xI("$ZodCheckRegex",(e,t)=>{m.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})}}),v=a.xI("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=s.AC),m.init(e,t)}),_=a.xI("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=s.Zv),m.init(e,t)}),y=a.xI("$ZodCheckIncludes",(e,t)=>{n.init(e,t);let r=i.$f(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})}}),k=a.xI("$ZodCheckStartsWith",(e,t)=>{n.init(e,t);let r=RegExp(`^${i.$f(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})}}),b=a.xI("$ZodCheckEndsWith",(e,t)=>{n.init(e,t);let r=RegExp(`.*${i.$f(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})}}),w=a.xI("$ZodCheckOverwrite",(e,t)=>{n.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})},98824(e,t,r){function a(e,t,r){function a(r,a){var s;for(let i in Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(s=r._zod).traits??(s.traits=new Set),r._zod.traits.add(e),t(r,a),n.prototype)i in r||Object.defineProperty(r,i,{value:n.prototype[i].bind(r)});r._zod.constr=n,r._zod.def=a}let s=r?.Parent??Object;class i extends s{}function n(e){var t;let s=r?.Parent?new i:this;for(let r of(a(s,e),(t=s._zod).deferred??(t.deferred=[]),s._zod.deferred))r();return s}return Object.defineProperty(i,"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}r.d(t,{$W:()=>n,GT:()=>s,cr:()=>i,xI:()=>a}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class s extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}let i={};function n(e){return e&&Object.assign(i,e),i}},29896(e,t,r){r.d(t,{JM:()=>l,Kd:()=>o,Wk:()=>u,a$:()=>n});var a=r(98824),s=r(18399);let i=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,s.k8,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},n=(0,a.xI)("$ZodError",i),o=(0,a.xI)("$ZodError",i,{Parent:Error});function l(e,t=e=>e.message){let r={},a=[];for(let s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:r}}function u(e,t){let r=t||function(e){return e.message},a={_errors:[]},s=e=>{for(let t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>s({issues:e}));else if("invalid_key"===t.code)s({issues:t.issues});else if("invalid_element"===t.code)s({issues:t.issues});else if(0===t.path.length)a._errors.push(r(t));else{let e=a,s=0;for(;s<t.path.length;){let a=t.path[s];s===t.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(r(t))):e[a]=e[a]||{_errors:[]},e=e[a],s++}}};return s(e),a}},7432(e,t,r){r.d(t,{EJ:()=>u,Od:()=>d,Rb:()=>l,Tj:()=>n,bp:()=>h,qg:()=>o,wG:()=>p,xL:()=>c});var a=r(98824),s=r(29896),i=r(18399);let n=e=>(t,r,s,n)=>{let o=s?Object.assign(s,{async:!1}):{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new a.GT;if(l.issues.length){let t=new(n?.Err??e)(l.issues.map(e=>i.iR(e,o,a.$W())));throw i.gx(t,n?.callee),t}return l.value},o=n(s.Kd),l=e=>async(t,r,s,n)=>{let o=s?Object.assign(s,{async:!0}):{async:!0},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise&&(l=await l),l.issues.length){let t=new(n?.Err??e)(l.issues.map(e=>i.iR(e,o,a.$W())));throw i.gx(t,n?.callee),t}return l.value},u=l(s.Kd),d=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new a.GT;return l.issues.length?{success:!1,error:new(e??s.a$)(l.issues.map(e=>i.iR(e,o,a.$W())))}:{success:!0,data:l.value}},c=d(s.Kd),p=e=>async(t,r,s)=>{let n=s?Object.assign(s,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>i.iR(e,n,a.$W())))}:{success:!0,data:o.value}},h=p(s.Kd)},72512(e,t,r){r.d(t,{AC:()=>Z,Ak:()=>l,Gl:()=>s,K3:()=>_,OI:()=>k,Os:()=>d,Rp:()=>p,Yj:()=>z,Z0:()=>i,Zg:()=>h,Zv:()=>E,ai:()=>O,ch:()=>A,fO:()=>o,gF:()=>a,hQ:()=>b,kB:()=>$,kM:()=>n,l7:()=>v,nd:()=>S,p0:()=>u,p6:()=>x,r0:()=>y,uR:()=>c,uX:()=>f,ug:()=>m,w$:()=>I,zM:()=>P,zr:()=>g});let a=/^[cC][^\s-]{8,}$/,s=/^[0-9a-z]+$/,i=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,n=/^[0-9a-vA-V]{20}$/,o=/^[A-Za-z0-9]{27}$/,l=/^[a-zA-Z0-9_-]{21}$/,u=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,d=/^([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})$/,c=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)$/,p=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function h(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let f=/^(?:(?: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])$/,m=/^(([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})$/,g=/^((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])$/,v=/^(([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])$/,_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,y=/^[A-Za-z0-9_-]*$/,k=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,b=/^\+(?:[0-9]){6,14}[0-9]$/,w="(?:(?:\\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])))",x=RegExp(`^${w}$`);function T(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+)?)?`}function $(e){return RegExp(`^${T(e)}$`)}function I(e){let t=T({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let a=`${t}(?:${r.join("|")})`;return RegExp(`^${w}T(?:${a})$`)}let z=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},S=/^\d+$/,O=/^-?\d+(?:\.\d+)?/i,P=/true|false/i,A=/null/i,Z=/^[^A-Z]*$/,E=/^[^a-z]*$/},1080(e,t,r){r.d(t,{fd:()=>s,rs:()=>a}),Symbol("ZodOutput"),Symbol("ZodInput");class a{constructor(){this._map=new Map,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 Map,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)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}let s=new a},83605(e,t,r){r.d(t,{bl:()=>y,b0:()=>em,Cn:()=>A,Ko:()=>T,h8:()=>C,I:()=>M,$p:()=>D,rv:()=>ei,VF:()=>eo,Py:()=>_,x8:()=>F,L8:()=>W,qG:()=>m,VO:()=>ee,vz:()=>j,VY:()=>g,cG:()=>v,Dq:()=>E,LJ:()=>B,qc:()=>es,Sb:()=>eh,EY:()=>p,N$:()=>el,$v:()=>c,$N:()=>z,P0:()=>Q,Oy:()=>N,Zy:()=>O,Um:()=>H,sF:()=>q,v1:()=>$,W4:()=>d,Zn:()=>f,t$:()=>ed,GY:()=>x,nu:()=>et,g5:()=>b,Ax:()=>I,CI:()=>P,Zc:()=>h,h:()=>X,cu:()=>K,GP:()=>L,Lc:()=>S,Wc:()=>er,TF:()=>w,ig:()=>ea,_m:()=>ec,CQ:()=>R,Zu:()=>k});var a=r(45830),s=r(98824);class i{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"))}}var n=r(7432),o=r(72512),l=r(18399);let u={major:4,minor:0,patch:0},d=s.xI("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=u;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=l.QH(e);for(let n of t){if(n._zod.def.when){if(!n._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=n._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new s.GT;if(a||o instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=l.QH(e,t)))});else{if(e.issues.length===t)continue;i||(i=l.QH(e,t))}}return a?a.then(()=>e):e};e._zod.run=(r,i)=>{let n=e._zod.parse(r,i);if(n instanceof Promise){if(!1===i.async)throw new s.GT;return n.then(e=>t(e,a,i))}return t(n,a,i)}}e["~standard"]={validate:t=>{try{let r=(0,n.xL)(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return(0,n.bp)(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),c=s.xI("$ZodString",(e,t)=>{d.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??o.Yj(e._zod.bag),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}}),p=s.xI("$ZodStringFormat",(e,t)=>{a.ql.init(e,t),c.init(e,t)}),h=s.xI("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=o.Os),p.init(e,t)}),f=s.xI("$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=o.uR(e))}else t.pattern??(t.pattern=o.uR());p.init(e,t)}),m=s.xI("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=o.Rp),p.init(e,t)}),g=s.xI("$ZodURL",(e,t)=>{p.init(e,t),e._zod.check=r=>{try{let a=r.value,s=new URL(a),i=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:o.OI.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!a.endsWith("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),v=s.xI("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=o.Zg()),p.init(e,t)}),_=s.xI("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=o.Ak),p.init(e,t)}),y=s.xI("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=o.gF),p.init(e,t)}),k=s.xI("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=o.Gl),p.init(e,t)}),b=s.xI("$ZodULID",(e,t)=>{t.pattern??(t.pattern=o.Z0),p.init(e,t)}),w=s.xI("$ZodXID",(e,t)=>{t.pattern??(t.pattern=o.kM),p.init(e,t)}),x=s.xI("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=o.fO),p.init(e,t)}),T=s.xI("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=o.w$(t)),p.init(e,t)}),$=s.xI("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=o.p6),p.init(e,t)}),I=s.xI("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=o.kB(t)),p.init(e,t)}),z=s.xI("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=o.p0),p.init(e,t)}),S=s.xI("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=o.uX),p.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),O=s.xI("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=o.ug),p.init(e,t),e._zod.onattach.push(e=>{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})}}}),P=s.xI("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=o.zr),p.init(e,t)}),A=s.xI("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=o.l7),p.init(e,t),e._zod.check=r=>{let[a,s]=r.value.split("/");try{if(!s)throw Error();let e=Number(s);if(`${e}`!==s||e<0||e>128)throw Error();new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Z(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let E=s.xI("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=o.K3),p.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Z(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),R=s.xI("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=o.r0),p.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{!function(e){if(!o.r0.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Z(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})}}),N=s.xI("$ZodE164",(e,t)=>{t.pattern??(t.pattern=o.hQ),p.init(e,t)}),C=s.xI("$ZodJWT",(e,t)=>{p.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 s=JSON.parse(atob(a));if("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.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})}}),j=s.xI("$ZodNumber",(e,t)=>{d.init(e,t),e._zod.pattern=e._zod.bag.pattern??o.ai,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let s=r.value;if("number"==typeof s&&!Number.isNaN(s)&&Number.isFinite(s))return r;let i="number"==typeof s?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...i?{received:i}:{}}),r}}),M=s.xI("$ZodNumber",(e,t)=>{a.KH.init(e,t),j.init(e,t)}),q=s.xI("$ZodBoolean",(e,t)=>{d.init(e,t),e._zod.pattern=o.zM,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let s=r.value;return"boolean"==typeof s||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),F=s.xI("$ZodNull",(e,t)=>{d.init(e,t),e._zod.pattern=o.ch,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}}),L=s.xI("$ZodUnknown",(e,t)=>{d.init(e,t),e._zod.parse=e=>e}),H=s.xI("$ZodNever",(e,t)=>{d.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function U(e,t,r){e.issues.length&&t.issues.push(...l.lQ(r,e.issues)),t.value[r]=e.value}let D=s.xI("$ZodArray",(e,t)=>{d.init(e,t),e._zod.parse=(r,a)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let i=[];for(let e=0;e<s.length;e++){let n=s[e],o=t.element._zod.run({value:n,issues:[]},a);o instanceof Promise?i.push(o.then(t=>U(t,r,e))):U(o,r,e)}return i.length?Promise.all(i).then(()=>r):r}});function V(e,t,r){e.issues.length&&t.issues.push(...l.lQ(r,e.issues)),t.value[r]=e.value}function J(e,t,r,a){e.issues.length?void 0===a[r]?r in a?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...l.lQ(r,e.issues)):void 0===e.value?r in a&&(t.value[r]=void 0):t.value[r]=e.value}let W=s.xI("$ZodObject",(e,t)=>{let r,a;d.init(e,t);let n=l.PO(()=>{let e=Object.keys(t.shape);for(let r of e)if(!(t.shape[r]instanceof d))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=l.NM(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}});l.gJ(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 o=l.Gv,u=!s.cr.jitless,c=l.hI,p=u&&c.value,h=t.catchall;e._zod.parse=(s,d)=>{a??(a=n.value);let c=s.value;if(!o(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),s;let f=[];if(u&&p&&d?.async===!1&&!0!==d.jitless)r||(r=(e=>{let t=new i(["shape","payload","ctx"]),r=n.value,a=e=>{let t=l.UQ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let s=Object.create(null),o=0;for(let e of r.keys)s[e]=`key_${o++}`;for(let e of(t.write("const newResult = {}"),r.keys))if(r.optionalKeys.has(e)){let r=s[e];t.write(`const ${r} = ${a(e)};`);let i=l.UQ(e);t.write(`
7
+ ]`;continue}s+=a[e],"\\"===a[e]?i=!0:n&&"]"===a[e]?n=!1:n||"["!==a[e]||(n=!0)}try{new RegExp(s)}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 s}function K(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===i.kY.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:G(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??S(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:G(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===i.kY.ZodString&&e.keyType._def.checks?.length){let{type:a,...s}=U(e.keyType._def,t);return{...r,propertyNames:s}}if(e.keyType?._def.typeName===i.kY.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===i.kY.ZodBranded&&e.keyType._def.type._def.typeName===i.kY.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...s}=A(e.keyType._def,t);return{...r,propertyNames:s}}return r}let Q={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},B=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>G(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 G(e,t,r=!1){let a=t.seen.get(e);if(t.override){let s=t.override?.(e,t,a,r);if(s!==$)return s}if(a&&!r){let e=X(a,t);if(void 0!==e)return e}let s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);let n=((e,t,r)=>{switch(t){case i.kY.ZodString:return U(e,r);case i.kY.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",O(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?P(a,"minimum",t.value,t.message,r):P(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),P(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?P(a,"maximum",t.value,t.message,r):P(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),P(a,"maximum",t.value,t.message,r));break;case"multipleOf":P(a,"multipleOf",t.value,t.message,r)}return a;case i.kY.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},s=[],i=e.shape();for(let e in i){let n=i[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=G(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,o||s.push(e))}s.length&&(a.required=s);let n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return G(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 i.kY.ZodBigInt:let s={type:"integer",format:"int64"};if(!e.checks)return s;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?P(s,"minimum",t.value,t.message,r):P(s,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(s.exclusiveMinimum=!0),P(s,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?P(s,"maximum",t.value,t.message,r):P(s,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(s.exclusiveMaximum=!0),P(s,"maximum",t.value,t.message,r));break;case"multipleOf":P(s,"multipleOf",t.value,t.message,r)}return s;case i.kY.ZodBoolean:return{type:"boolean"};case i.kY.ZodDate:return function e(t,r,a){let s=a??r.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((a,s)=>e(t,r,a))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var i=t,n=r;let o={type:"integer",format:"unix-time"};if("openApi3"===n.target)return o;for(let e of i.checks)switch(e.kind){case"min":P(o,"minimum",e.value,e.message,n);break;case"max":P(o,"maximum",e.value,e.message,n)}return o}}(e,r);case i.kY.ZodUndefined:return{not:S(r)};case i.kY.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case i.kY.ZodArray:let n;return n={type:"array"},e.type?._def&&e.type?._def?.typeName!==i.kY.ZodAny&&(n.items=G(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&P(n,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&P(n,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(P(n,"minItems",e.exactLength.value,e.exactLength.message,r),P(n,"maxItems",e.exactLength.value,e.exactLength.message,r)),n;case i.kY.ZodUnion:case i.kY.ZodDiscriminatedUnion:if("openApi3"===r.target)return B(e,r);let o=e.options instanceof Map?Array.from(e.options.values()):e.options;if(o.every(e=>e._def.typeName in Q&&(!e._def.checks||!e._def.checks.length))){let e=o.reduce((e,t)=>{let r=Q[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(o.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=o.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===o.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:o.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(o.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:o.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return B(e,r);case i.kY.ZodIntersection:let l,u,d;return l=[G(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),G(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),u="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,d=[],l.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)d.push(...e.allOf),void 0===e.unevaluatedProperties&&(u=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else u=void 0;d.push(t)}}),d.length?{allOf:d,...u}:void 0;case i.kY.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>G(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:G(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>G(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case i.kY.ZodRecord:return K(e,r);case i.kY.ZodLiteral:let c;return"bigint"!=(c=typeof e.value)&&"number"!==c&&"boolean"!==c&&"string"!==c?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===c?"integer":c,enum:[e.value]}:{type:"bigint"===c?"integer":c,const:e.value};case i.kY.ZodEnum:return{type:"string",enum:Array.from(e.values)};case i.kY.ZodNativeEnum:let p,h,m;return p=e.values,{type:1===(m=Array.from(new Set((h=Object.keys(e.values).filter(e=>"number"!=typeof p[p[e]]).map(e=>p[e])).map(e=>typeof e)))).length?"string"===m[0]?"string":"number":["string","number"],enum:h};case i.kY.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:Q[e.innerType._def.typeName],nullable:!0}:{type:[Q[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=G(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let f=G(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return f&&{anyOf:[f,{type:"null"}]};case i.kY.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return G(e.innerType._def,r);let g=G(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return g?{anyOf:[{not:S(r)},g]}:S(r);case i.kY.ZodMap:if("record"===r.mapStrategy)return K(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[G(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||S(r),G(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||S(r)],minItems:2,maxItems:2}};case i.kY.ZodSet:let v;return v={type:"array",uniqueItems:!0,items:G(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&P(v,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&P(v,"maxItems",e.maxSize.value,e.maxSize.message,r),v;case i.kY.ZodLazy:return()=>e.getter()._def;case i.kY.ZodPromise:return G(e.type._def,r);case i.kY.ZodNaN:case i.kY.ZodNever:return"openAi"===r.target?void 0:{not:S({...r,currentPath:[...r.currentPath,"not"]})};case i.kY.ZodEffects:return"input"===r.effectStrategy?G(e.schema._def,r):S(r);case i.kY.ZodAny:case i.kY.ZodUnknown:return S(r);case i.kY.ZodDefault:return{...G(e.innerType._def,r),default:e.defaultValue()};case i.kY.ZodBranded:return A(e,r);case i.kY.ZodReadonly:case i.kY.ZodCatch:return G(e.innerType._def,r);case i.kY.ZodPipeline:if("input"===r.pipeStrategy)return G(e.in._def,r);if("output"===r.pipeStrategy)return G(e.out._def,r);let _=G(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),y=G(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",_?"1":"0"]});return{allOf:[_,y].filter(e=>void 0!==e)};case i.kY.ZodFunction:case i.kY.ZodVoid:case i.kY.ZodSymbol:default:return}})(e,e.typeName,t),o="function"==typeof n?G(n(),t):n;if(o&&ee(e,t,o),t.postProcess){let r=t.postProcess(o,e,t);return s.jsonSchema=o,r}return s.jsonSchema=o,o}let X=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:z(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`),S(t);return"seen"===t.$refStrategy?S(t):void 0}},ee=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function et(e,t){var r,a,s,i;return h(e)?function(e,t){if(e instanceof x.rs){let r=new T(t),a={};for(let t of e._idmap.entries()){let[e,a]=t;r.process(a)}let s={},i={registry:e,uri:t?.uri,defs:a};for(let a of e._idmap.entries()){let[e,n]=a;s[e]=r.emit(n,{...t,external:i})}return Object.keys(a).length>0&&(s.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:s}}let r=new T(t);return r.process(e),r.emit(e,t)}(e,{target:(i=null==t?void 0:t.target)&&"jsonSchema7"!==i&&"draft-7"!==i&&("jsonSchema2019-09"===i||"draft-2020-12"===i)?"draft-2020-12":"draft-7",io:null!=(r=null==t?void 0:t.pipeStrategy)?r:"input"}):((e,t)=>{let r,a,s=(a=void 0!==(r="string"==typeof t?{...I,name:t}:{...I,...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}]))}),i="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:G(r._def,{...s,currentPath:[...s.basePath,s.definitionPath,t]},!0)??S(s)}),{}):void 0,n="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,o=G(e._def,void 0===n?s:{...s,currentPath:[...s.basePath,s.definitionPath,n]},!1)??S(s),l="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==l&&(o.title=l),s.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[s.openAiAnyTypeName]||(i[s.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===s.$refStrategy?"1":[...s.basePath,s.definitionPath,s.openAiAnyTypeName].join("/")}}));let u=void 0===n?i?{...o,[s.definitionPath]:i}:o:{$ref:[..."relative"===s.$refStrategy?[]:s.basePath,s.definitionPath,n].join("/"),[s.definitionPath]:{...i,[n]:o}};return"jsonSchema7"===s.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===s.target||"openAi"===s.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===s.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:null==(a=null==t?void 0:t.strictUnions)||a,pipeStrategy:null!=(s=null==t?void 0:t.pipeStrategy)?s:"input"})}function er(e){let t=v(e),r=null==t?void 0:t.method;if(!r)throw Error("Schema is missing a method literal");let a=k(r);if("string"!=typeof a)throw Error("Schema method literal must be a string");return a}function ea(e,t){let r=f(e,t);if(!r.success)throw r.error;return r.data}class es{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(b.Sq,e=>{this._oncancel(e)}),this.setNotificationHandler(b._r,e=>{this._onprogress(e)}),this.setRequestHandler(b.tC,e=>({})),this._taskStore=null==e?void 0:e.taskStore,this._taskMessageQueue=null==e?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(b.Ql,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new b.Nh(b.O4.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(b.oQ,async(e,t)=>{let r=async()=>{var a;let s=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(s,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 b.Nh(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 (null==(a=this._transport)?void 0:a.send(e.message,{relatedRequestId:t.requestId}))}}let i=await this._taskStore.getTask(s,t.sessionId);if(!i)throw new b.Nh(b.O4.InvalidParams,`Task not found: ${s}`);if(!w(i.status))return await this._waitForTaskUpdate(s,t.signal),await r();if(w(i.status)){let e=await this._taskStore.getTaskResult(s,t.sessionId);return this._clearTaskQueue(s),{...e,_meta:{...e._meta,[b.EV]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(b.zR,async(e,t)=>{var r;try{let{tasks:a,nextCursor:s}=await this._taskStore.listTasks(null==(r=e.params)?void 0:r.cursor,t.sessionId);return{tasks:a,nextCursor:s,_meta:{}}}catch(e){throw new b.Nh(b.O4.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(b.gd,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new b.Nh(b.O4.InvalidParams,`Task not found: ${e.params.taskId}`);if(w(r.status))throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...a}}catch(e){if(e instanceof b.Nh)throw e;throw new b.Nh(b.O4.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){let t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}_setupTimeout(e,t,r,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,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),b.Nh.fromError(b.O4.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){var t,r,a;this._transport=e;let s=null==(t=this.transport)?void 0:t.onclose;this._transport.onclose=()=>{null==s||s(),this._onclose()};let i=null==(r=this.transport)?void 0:r.onerror;this._transport.onerror=e=>{null==i||i(e),this._onerror(e)};let n=null==(a=this._transport)?void 0:a.onmessage;this._transport.onmessage=(e,t)=>{null==n||n(e,t),(0,b.tG)(e)||(0,b.o$)(e)?this._onresponse(e):(0,b.vo)(e)?this._onrequest(e,t):(0,b.lg)(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=b.Nh.fromError(b.O4.ConnectionClosed,"Connection closed");for(let a of(this._transport=void 0,null==(e=this.onclose)||e.call(this),t.values()))a(r)}_onerror(e){var t;null==(t=this.onerror)||t.call(this,e)}_onnotification(e){var t;let r=null!=(t=this._notificationHandlers.get(e.method))?t:this.fallbackNotificationHandler;void 0!==r&&Promise.resolve().then(()=>r(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r,a,s,i,n,o;let l=null!=(r=this._requestHandlers.get(e.method))?r:this.fallbackRequestHandler,u=this._transport,d=null==(i=null==(s=null==(a=e.params)?void 0:a._meta)?void 0:s[b.EV])?void 0:i.taskId;if(void 0===l){let t={jsonrpc:"2.0",id:e.id,error:{code:b.O4.MethodNotFound,message:"Method not found"}};d&&this._taskMessageQueue?this._enqueueTaskMessage(d,{type:"error",message:t,timestamp:Date.now()},null==u?void 0:u.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):null==u||u.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);let p=null==(n=e.params)?void 0:n.task,h=this._taskStore?this.requestTaskStore(e,null==u?void 0:u.sessionId):void 0,m={signal:c.signal,sessionId:null==u?void 0:u.sessionId,_meta:null==(o=e.params)?void 0:o._meta,sendNotification:async t=>{let r={relatedRequestId:e.id};d&&(r.relatedTask={taskId:d}),await this.notification(t,r)},sendRequest:async(t,r,a)=>{var s,i;let n={...a,relatedRequestId:e.id};d&&!n.relatedTask&&(n.relatedTask={taskId:d});let o=null!=(i=null==(s=n.relatedTask)?void 0:s.taskId)?i:d;return o&&h&&await h.updateTaskStatus(o,"input_required"),await this.request(t,r,n)},authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo,taskId:d,taskStore:h,taskRequestedTtl:null==p?void 0:p.ttl,closeSSEStream:null==t?void 0:t.closeSSEStream,closeStandaloneSSEStream:null==t?void 0:t.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(e.method)}).then(()=>l(e,m)).then(async t=>{if(c.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"response",message:r,timestamp:Date.now()},null==u?void 0:u.sessionId):await (null==u?void 0:u.send(r))},async t=>{var r;if(c.signal.aborted)return;let a={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:b.O4.InternalError,message:null!=(r=t.message)?r:"Internal error",...void 0!==t.data&&{data:t.data}}};d&&this._taskMessageQueue?await this._enqueueTaskMessage(d,{type:"error",message:a,timestamp:Date.now()},null==u?void 0:u.sessionId):await (null==u?void 0:u.send(a))}).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),s=this._progressHandlers.get(a);if(!s)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let i=this._responseHandlers.get(a),n=this._timeoutInfo.get(a);if(n&&i&&n.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),i(e);return}s(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r((0,b.tG)(e)?e:new b.Nh(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 s=!1;if((0,b.tG)(e)&&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&&(s=!0,this._taskProgressTokens.set(e.taskId,t))}}s||this._progressHandlers.delete(t),a((0,b.tG)(e)?e:b.Nh.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){var e;await (null==(e=this._transport)?void 0:e.close())}async *requestStream(e,t,r){var a,s,i,n;let o,{task:l}=null!=r?r:{};if(!l){try{let a=await this.request(e,t,r);yield{type:"result",result:a}}catch(e){yield{type:"error",error:e instanceof b.Nh?e:new b.Nh(b.O4.InternalError,String(e))}}return}try{let l=await this.request(e,b.Mg,r);if(l.task)o=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new b.Nh(b.O4.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:e},w(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:o},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new b.Nh(b.O4.InternalError,`Task ${o} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new b.Nh(b.O4.InternalError,`Task ${o} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:o},t,r);yield{type:"result",result:e};return}let l=null!=(i=null!=(a=e.pollInterval)?a:null==(s=this._options)?void 0:s.defaultTaskPollInterval)?i:1e3;await new Promise(e=>setTimeout(e,l)),null==(n=null==r?void 0:r.signal)||n.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof b.Nh?e:new b.Nh(b.O4.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i,task:n,relatedTask:o}=null!=r?r:{};return new Promise((l,u)=>{var d,c,p,h,m,g,v;let _=e=>{u(e)};if(!this._transport)return void _(Error("Not connected"));if((null==(d=this._options)?void 0:d.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),n&&this.assertTaskCapability(e.method)}catch(e){_(e);return}null==(c=null==r?void 0:r.signal)||c.throwIfAborted();let y=this._requestMessageId++,k={...e,jsonrpc:"2.0",id:y};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(y,r.onprogress),k.params={...e.params,_meta:{...(null==(p=e.params)?void 0:p._meta)||{},progressToken:y}}),n&&(k.params={...k.params,task:n}),o&&(k.params={...k.params,_meta:{...(null==(h=k.params)?void 0:h._meta)||{},[b.EV]:o}});let w=e=>{var t;this._responseHandlers.delete(y),this._progressHandlers.delete(y),this._cleanupTimeout(y),null==(t=this._transport)||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(e)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),u(e instanceof b.Nh?e:new b.Nh(b.O4.RequestTimeout,String(e)))};this._responseHandlers.set(y,e=>{var a;if(null==(a=null==r?void 0:r.signal)||!a.aborted){if(e instanceof Error)return u(e);try{let r=f(t,e.result);r.success?l(r.data):u(r.error)}catch(e){u(e)}}}),null==(m=null==r?void 0:r.signal)||m.addEventListener("abort",()=>{var e;w(null==(e=null==r?void 0:r.signal)?void 0:e.reason)});let x=null!=(g=null==r?void 0:r.timeout)?g:6e4;this._setupTimeout(y,x,null==r?void 0:r.maxTotalTimeout,()=>w(b.Nh.fromError(b.O4.RequestTimeout,"Request timed out",{timeout:x})),null!=(v=null==r?void 0:r.resetTimeoutOnProgress)&&v);let T=null==o?void 0:o.taskId;if(T){let e=e=>{let t=this._responseHandlers.get(y);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${y}`))};this._requestResolvers.set(y,e),this._enqueueTaskMessage(T,{type:"request",message:k,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(y),u(e)})}else this._transport.send(k,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>{this._cleanupTimeout(y),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},b.Sc,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},b.a5,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},b.gH,t)}async notification(e,t){var r,a,s,i,n;if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let o=null==(r=null==t?void 0:t.relatedTask)?void 0:r.taskId;if(o){let r={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...(null==(a=e.params)?void 0:a._meta)||{},[b.EV]:t.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:r,timestamp:Date.now()});return}if((null!=(i=null==(s=this._options)?void 0:s.debouncedNotificationMethods)?i:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)&&!(null==t?void 0:t.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var r,a;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(s={...s,params:{...s.params,_meta:{...(null==(r=s.params)?void 0:r._meta)||{},[b.EV]:t.relatedTask}}}),null==(a=this._transport)||a.send(s,t).catch(e=>this._onerror(e))});return}let l={...e,jsonrpc:"2.0"};(null==t?void 0:t.relatedTask)&&(l={...l,params:{...l.params,_meta:{...(null==(n=l.params)?void 0:n._meta)||{},[b.EV]:t.relatedTask}}}),await this._transport.send(l,t)}setRequestHandler(e,t){let r=er(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,a)=>Promise.resolve(t(ea(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=er(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(ea(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){var a;if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=null==(a=this._options)?void 0:a.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,s)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){for(let r of(await this._taskMessageQueue.dequeueAll(e,t)))if("request"===r.type&&(0,b.vo)(r.message)){let t=r.message.id,a=this._requestResolvers.get(t);a?(a(new b.Nh(b.O4.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){var r,a,s;let i=null!=(a=null==(r=this._options)?void 0:r.defaultTaskPollInterval)?a:1e3;try{let t=await (null==(s=this._taskStore)?void 0:s.getTask(e));(null==t?void 0:t.pollInterval)&&(i=t.pollInterval)}catch(e){}return new Promise((e,r)=>{if(t.aborted)return void r(new b.Nh(b.O4.InvalidRequest,"Request cancelled"));let a=setTimeout(e,i);t.addEventListener("abort",()=>{clearTimeout(a),r(new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(e,a,s)=>{await r.storeTaskResult(e,a,s,t);let i=await r.getTask(e,t);if(i){let t=b.ki.parse({method:"notifications/tasks/status",params:i});await this.notification(t),w(i.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,a,s)=>{let i=await r.getTask(e,t);if(!i)throw new b.Nh(b.O4.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(w(i.status))throw new b.Nh(b.O4.InvalidParams,`Cannot update task "${e}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,a,s,t);let n=await r.getTask(e,t);if(n){let t=b.ki.parse({method:"notifications/tasks/status",params:n});await this.notification(t),w(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function ei(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var en=r(11601),eo=r(74421);class el{constructor(e){let t;this._ajv=null!=e?e:(eo(t=new en.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0})),t)}getValidator(e){var t;let r="$id"in e&&"string"==typeof e.$id&&null!=(t=this._ajv.getSchema(e.$id))?t:this._ajv.compile(e);return e=>r(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class eu{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 ed extends es{constructor(e,t){var r,a;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(b.FP.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=null!=(r=null==t?void 0:t.capabilities)?r:{},this._instructions=null==t?void 0:t.instructions,this._jsonSchemaValidator=null!=(a=null==t?void 0:t.jsonSchemaValidator)?a:new el,this.setRequestHandler(b.rk,e=>this._oninitialize(e)),this.setNotificationHandler(b.ZC,()=>{var e;return null==(e=this.oninitialized)?void 0:e.call(this)}),this._capabilities.logging&&this.setRequestHandler(b.b_,async(e,t)=>{var r;let a=t.sessionId||(null==(r=t.requestInfo)?void 0:r.headers["mcp-session-id"])||void 0,{level:s}=e.params,i=b.FP.safeParse(s);return i.success&&this._loggingLevels.set(a,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new eu(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 s=r[e];ei(s)&&ei(a)?r[e]={...s,...a}:r[e]=a}return r}(this._capabilities,e)}setRequestHandler(e,t){var r,a,s;let i,n=v(e),o=null==n?void 0:n.method;if(!o)throw Error("Schema is missing a method literal");if(h(o)){let e=null==(r=o._zod)?void 0:r.def;i=null!=(a=null==e?void 0:e.value)?a:o.value}else{let e=o._def;i=null!=(s=null==e?void 0:e.value)?s:o.value}if("string"!=typeof i)throw Error("Schema method literal must be a string");if("tools/call"===i){let r=async(e,r)=>{let a=f(b.FT,e);if(!a.success){let e=a.error instanceof Error?a.error.message:String(a.error);throw new b.Nh(b.O4.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:s}=a.data,i=await Promise.resolve(t(e,r));if(s.task){let e=f(b.Mg,i);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new b.Nh(b.O4.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=f(b.TF,i);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new b.Nh(b.O4.InvalidParams,`Invalid tools/call result: ${e}`)}return n.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){var t,r,a;switch(e){case"sampling/createMessage":if(!(null==(t=this._clientCapabilities)?void 0:t.sampling))throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null==(r=this._clientCapabilities)?void 0:r.elicitation))throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null==(a=this._clientCapabilities)?void 0:a.roots))throw Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){var t,r;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(!(null==(r=null==(t=this._clientCapabilities)?void 0:t.elicitation)?void 0:r.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,r,a,s,i=null==(r=null==(t=this._clientCapabilities)?void 0:t.tasks)?void 0:r.requests,n="Client";if(!i)throw Error(`${n} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!(null==(a=i.sampling)?void 0:a.createMessage))throw Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!(null==(s=i.elicitation)?void 0:s.create))throw Error(`${n} does not support task creation for elicitation/create (required for ${e})`)}}assertTaskHandlerCapability(e){var t;if(this._capabilities){var r,a=null==(t=this._capabilities.tasks)?void 0:t.requests,s="Server";if(!a)throw Error(`${s} does not support task creation (required for ${e})`);if("tools/call"===e&&!(null==(r=a.tools)?void 0:r.call))throw Error(`${s} 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:b.Iu.includes(t)?t:b.aE,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"},b.wR)}async createMessage(e,t){var r,a;if((e.tools||e.toolChoice)&&!(null==(a=null==(r=this._clientCapabilities)?void 0:r.sampling)?void 0:a.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),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],n=i.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(i.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},b.TI,t):this.request({method:"sampling/createMessage",params:e},b.K1,t)}async elicitInput(e,t){var r,a,s,i,n;switch(null!=(r=e.mode)?r:"form"){case"url":if(!(null==(s=null==(a=this._clientCapabilities)?void 0:a.elicitation)?void 0:s.url))throw Error("Client does not support url elicitation.");return this.request({method:"elicitation/create",params:e},b.n_,t);case"form":{if(!(null==(n=null==(i=this._clientCapabilities)?void 0:i.elicitation)?void 0:n.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},b.n_,t);if("accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new b.Nh(b.O4.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof b.Nh)throw e;throw new b.Nh(b.O4.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){var r,a;if(!(null==(a=null==(r=this._clientCapabilities)?void 0:r.elicitation)?void 0:a.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},b.Cs,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 ec=Symbol.for("mcp.completable");(s||(s={})).Completable="McpCompletable";let ep=/^[A-Za-z0-9._-]{1,128}$/;function eh(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"),!ep.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 em{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 ef{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 ed(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new em(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(ek(b.gW)),this.server.assertCanSetRequestHandler(ek(b.FT)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(b.gW,()=>({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=_(t.inputSchema))?et(r,{strictUnions:!0,pipeStrategy:"input"}):eg,annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=_(t.outputSchema);e&&(a.outputSchema=et(e,{strictUnions:!0,pipeStrategy:"output"}))}return a})})),this.server.setRequestHandler(b.FT,async(e,t)=>{var r;try{let a=this._registeredTools[e.params.name];if(!a)throw new b.Nh(b.O4.InvalidParams,`Tool ${e.params.name} not found`);if(!a.enabled)throw new b.Nh(b.O4.InvalidParams,`Tool ${e.params.name} disabled`);let s=!!e.params.task,i=null==(r=a.execution)?void 0:r.taskSupport,n="createTask"in a.handler;if(("required"===i||"optional"===i)&&!n)throw new b.Nh(b.O4.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if("required"===i&&!s)throw new b.Nh(b.O4.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if("optional"===i&&!s&&n)return await this.handleAutomaticTaskPolling(a,e,t);let o=await this.validateToolInput(a,e.params.arguments,e.params.name),l=await this.executeToolHandler(a,o,t);if(s)return l;return await this.validateToolOutput(a,l,e.params.name),l}catch(e){if(e instanceof b.Nh&&e.code===b.O4.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=_(e.inputSchema),s=null!=a?a:e.inputSchema,i=await g(s,t);if(!i.success){let e=y("error"in i?i.error:"Unknown error");throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=_(e.outputSchema),s=await g(a,t.structuredContent);if(!s.success){let e=y("error"in s?s.error:"Unknown error");throw new b.Nh(b.O4.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 s={...r,taskStore:r.taskStore};return e.inputSchema?await Promise.resolve(a.createTask(t,s)):await Promise.resolve(a.createTask(s))}return e.inputSchema?await Promise.resolve(a(t,r)):await Promise.resolve(a(r))}async handleAutomaticTaskPolling(e,t,r){var a;if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let s=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,n={...r,taskStore:r.taskStore},o=s?await Promise.resolve(i.createTask(s,n)):await Promise.resolve(i.createTask(n)),l=o.task.taskId,u=o.task,d=null!=(a=u.pollInterval)?a:5e3;for(;"completed"!==u.status&&"failed"!==u.status&&"cancelled"!==u.status;){await new Promise(e=>setTimeout(e,d));let e=await r.taskStore.getTask(l);if(!e)throw new b.Nh(b.O4.InternalError,`Task ${l} not found during polling`);u=e}return await r.taskStore.getTaskResult(l)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ek(b.iK)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(b.iK,async e=>{switch(e.params.ref.type){case"ref/prompt":return(0,b.uv)(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return(0,b.X6)(e),this.handleResourceCompletion(e,e.params.ref);default:throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new b.Nh(b.O4.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return ew;let s=v(a.argsSchema),i=null==s?void 0:s[e.params.argument.name];if(!(i&&"object"==typeof i&&ec in i))return ew;let n=null==(r=i[ec])?void 0:r.complete;return n?eb(await n(e.params.argument.value,e.params.context)):ew}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 ew;throw new b.Nh(b.O4.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?eb(await a(e.params.argument.value,e.params.context)):ew}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(ek(b.OI)),this.server.assertCanSetRequestHandler(ek(b.s)),this.server.assertCanSetRequestHandler(ek(b.R6)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(b.OI,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(b.s,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(b.R6,async(e,t)=>{let r=new URL(e.params.uri),a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new b.Nh(b.O4.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 b.Nh(b.O4.InvalidParams,`Resource ${r} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(ek(b.Qq)),this.server.assertCanSetRequestHandler(ek(b.$p)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(b.Qq,()=>({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=v(t.argsSchema))?Object.entries(r).map(([e,t])=>{var r,a,s,i,n,o,l;return{name:e,description:h(t)?null==(a=null==(r=t._zod)?void 0:r.def)?void 0:a.description:null!=(s=t.description)?s:null==(i=t._def)?void 0:i.description,required:!(h(t)?(null==(o=null==(n=t._zod)?void 0:n.def)?void 0:o.type)==="optional":"function"==typeof t.isOptional?t.isOptional():(null==(l=t._def)?void 0:l.typeName)==="ZodOptional")}}):[]:void 0}})})),this.server.setRequestHandler(b.$p,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new b.Nh(b.O4.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new b.Nh(b.O4.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let a=_(r.argsSchema),s=await g(a,e.params.arguments);if(!s.success){let t=y("error"in s?s.error:"Unknown error");throw new b.Nh(b.O4.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}let i=s.data,n=r.callback;return await Promise.resolve(n(i,t))}{let e=r.callback;return await Promise.resolve(e(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...r){let a;"object"==typeof r[0]&&(a=r.shift());let s=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,s);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,s);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 s=this._createRegisteredResource(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,t,r,a,s){let i={name:e,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=i)),void 0!==e.name&&(i.name=e.name),void 0!==e.title&&(i.title=e.title),void 0!==e.metadata&&(i.metadata=e.metadata),void 0!==e.callback&&(i.readCallback=e.callback),void 0!==e.enabled&&(i.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,a,s){let i={resourceTemplate:r,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.template&&(i.resourceTemplate=t.template),void 0!==t.metadata&&(i.metadata=t.metadata),void 0!==t.callback&&(i.readCallback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,t,r,a,s){let i={title:t,description:r,argsSchema:void 0===a?void 0:m(a),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.description&&(i.description=t.description),void 0!==t.argsSchema&&(i.argsSchema=m(t.argsSchema)),void 0!==t.callback&&(i.callback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,t,r,a,s,i,n,o,l){eh(e);let u={title:t,description:r,inputSchema:ey(a),outputSchema:ey(s),annotations:i,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&&eh(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=m(t.paramsSchema)),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,s,i;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];e_(e)?(a=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!e_(t[0])&&(i=t.shift())):"object"==typeof e&&null!==e&&(i=t.shift())}let n=t[0];return this._createRegisteredTool(e,void 0,r,a,s,i,{taskSupport:"forbidden"},void 0,n)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:s,inputSchema:i,outputSchema:n,annotations:o,_meta:l}=t;return this._createRegisteredTool(e,a,s,i,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 s=t[0],i=this._createRegisteredPrompt(e,void 0,r,a,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:s,argsSchema:i}=t,n=this._createRegisteredPrompt(e,a,s,i,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()}}let eg={type:"object",properties:{}};function ev(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function e_(e){return"object"==typeof e&&null!==e&&!("_def"in e||"_zod"in e||ev(e))&&(0===Object.keys(e).length||Object.values(e).some(ev))}function ey(e){if(e)return e_(e)?m(e):e}function ek(e){let t=v(e),r=null==t?void 0:t.method;if(!r)throw Error("Schema is missing a method literal");let a=k(r);if("string"==typeof a)return a;throw Error("Schema method literal must be a string")}function eb(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}let ew={completion:{values:[],hasMore:!1}}},66029(e,t,r){r.d(t,{S:()=>n});var a=r(1708),s=r(82699);class i{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,s.OR.parse(JSON.parse(e))}clear(){this._buffer=void 0}}class n{constructor(e=a.stdin,t=a.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new i,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{var t;null==(t=this.onerror)||t.call(this,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(var e,t;;)try{let t=this._readBuffer.readMessage();if(null===t)break;null==(e=this.onmessage)||e.call(this,t)}catch(e){null==(t=this.onerror)||t.call(this,e)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),null==(e=this.onclose)||e.call(this)}send(e){return new Promise(t=>{let r=JSON.stringify(e)+"\n";this._stdout.write(r)?t():this._stdout.once("drain",t)})}}},82699(e,t,r){let a;r.d(t,{oQ:()=>tH,ZC:()=>tS,ki:()=>tM,uv:()=>r6,X6:()=>r8,Mg:()=>tj,$p:()=>ro,Ql:()=>tF,Iu:()=>eX,tG:()=>tl,R6:()=>t5,rk:()=>t$,gW:()=>rk,K1:()=>rF,aE:()=>eG,b_:()=>rS,Sc:()=>tL,vo:()=>ts,OI:()=>t0,_r:()=>tZ,OR:()=>tc,o$:()=>td,O4:()=>c,Cs:()=>ar,FT:()=>rT,tC:()=>tO,TI:()=>rL,Qq:()=>rs,Nh:()=>as,EV:()=>e0,iK:()=>r3,s:()=>t9,gH:()=>tJ,lg:()=>tn,zR:()=>tU,a5:()=>tD,TF:()=>rw,n_:()=>r9,Sq:()=>tm,gd:()=>tV,FP:()=>rI,wR:()=>tp});var s,i,n,o,l,u,d,c,p=r(98824),h=r(83605),m=r(18399),f=r(1080),g=r(45830);function v(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...m.A2(t)})}function _(e,t){return new g.sm({check:"less_than",...m.A2(t),value:e,inclusive:!1})}function y(e,t){return new g.sm({check:"less_than",...m.A2(t),value:e,inclusive:!0})}function k(e,t){return new g.J_({check:"greater_than",...m.A2(t),value:e,inclusive:!1})}function b(e,t){return new g.J_({check:"greater_than",...m.A2(t),value:e,inclusive:!0})}function w(e,t){return new g.Jk({check:"multiple_of",...m.A2(t),value:e})}function x(e,t){return new g.Yk({check:"max_length",...m.A2(t),maximum:e})}function T(e,t){return new g.Kk({check:"min_length",...m.A2(t),minimum:e})}function $(e,t){return new g.RM({check:"length_equals",...m.A2(t),length:e})}function I(e){return new g.v$({check:"overwrite",tx:e})}let z=p.xI("ZodISODateTime",(e,t)=>{h.Ko.init(e,t),D.init(e,t)});function S(e){return new z({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...m.A2(e)})}let O=p.xI("ZodISODate",(e,t)=>{h.v1.init(e,t),D.init(e,t)}),P=p.xI("ZodISOTime",(e,t)=>{h.Ax.init(e,t),D.init(e,t)}),A=p.xI("ZodISODuration",(e,t)=>{h.$N.init(e,t),D.init(e,t)});var Z=r(7432),E=r(29896);let R=(e,t)=>{E.a$.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>E.Wk(e,t)},flatten:{value:t=>E.JM(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})};p.xI("ZodError",R);let N=p.xI("ZodError",R,{Parent:Error}),C=Z.Tj(N),j=Z.Rb(N),q=Z.Od(N),M=Z.wG(N),F=p.xI("ZodType",(e,t)=>(h.W4.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),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)=>m.o8(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>C(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>q(e,t,r),e.parseAsync=async(t,r)=>j(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>M(e,t,r),e.spa=e.safeParseAsync,e.refine=(t,r)=>e.check(function(e,t={}){return new eB({type:"custom",check:"custom",fn:e,...m.A2(t)})}(t,r)),e.superRefine=t=>{var r,a;let s,i;return e.check((r=t,i=(a=e=>(e.addIssue=t=>{"string"==typeof t?e.issues.push(m.sn(t,e.value,i._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=e.value),t.inst??(t.inst=i),t.continue??(t.continue=!i._zod.def.abort),e.issues.push(m.sn(t)))},r(e.value,e)),(s=new g.QP({check:"custom"}))._zod.check=a,s)))},e.overwrite=t=>e.check(I(t)),e.optional=()=>eL(e),e.nullable=()=>eU(e),e.nullish=()=>eL(eU(e)),e.nonoptional=t=>{var r,a;return r=e,a=t,new eJ({type:"nonoptional",innerType:r,...m.A2(a)})},e.array=()=>ew(e),e.or=t=>ez([e,t]),e.and=t=>eA(e,t),e.transform=t=>eK(e,eM(t)),e.default=t=>{var r,a;return r=e,a=t,new eD({type:"default",innerType:r,get defaultValue(){return"function"==typeof a?a():a}})},e.prefault=t=>{var r,a;return r=e,a=t,new eV({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof a?a():a}})},e.catch=t=>{var r;return new eW({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r})},e.pipe=t=>eK(e,t),e.readonly=()=>new eQ({type:"readonly",innerType:e}),e.describe=t=>{let r=e.clone();return f.fd.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>f.fd.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return f.fd.get(e);let r=e.clone();return f.fd.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),L=p.xI("_ZodString",(e,t)=>{h.$v.init(e,t),F.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 g.DG({check:"string_format",format:"regex",...m.A2(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new g.Tt({check:"string_format",format:"includes",...m.A2(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new g.J({check:"string_format",format:"starts_with",...m.A2(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new g.E6({check:"string_format",format:"ends_with",...m.A2(t),suffix:e})}(...t)),e.min=(...t)=>e.check(T(...t)),e.max=(...t)=>e.check(x(...t)),e.length=(...t)=>e.check($(...t)),e.nonempty=(...t)=>e.check(T(1,...t)),e.lowercase=t=>e.check(new g.NI({check:"string_format",format:"lowercase",...m.A2(t)})),e.uppercase=t=>e.check(new g.kH({check:"string_format",format:"uppercase",...m.A2(t)})),e.trim=()=>e.check(I(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return I(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(I(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(I(e=>e.toUpperCase()))}),H=p.xI("ZodString",(e,t)=>{h.$v.init(e,t),L.init(e,t),e.email=t=>e.check(new V({type:"string",format:"email",check:"string_format",abort:!1,...m.A2(t)})),e.url=t=>e.check(new Y({type:"string",format:"url",check:"string_format",abort:!1,...m.A2(t)})),e.jwt=t=>e.check(new eu({type:"string",format:"jwt",check:"string_format",abort:!1,...m.A2(t)})),e.emoji=t=>e.check(new K({type:"string",format:"emoji",check:"string_format",abort:!1,...m.A2(t)})),e.guid=t=>e.check(v(J,t)),e.uuid=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,...m.A2(t)})),e.uuidv4=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...m.A2(t)})),e.uuidv6=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...m.A2(t)})),e.uuidv7=t=>e.check(new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...m.A2(t)})),e.nanoid=t=>e.check(new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...m.A2(t)})),e.guid=t=>e.check(v(J,t)),e.cuid=t=>e.check(new B({type:"string",format:"cuid",check:"string_format",abort:!1,...m.A2(t)})),e.cuid2=t=>e.check(new G({type:"string",format:"cuid2",check:"string_format",abort:!1,...m.A2(t)})),e.ulid=t=>e.check(new X({type:"string",format:"ulid",check:"string_format",abort:!1,...m.A2(t)})),e.base64=t=>e.check(new en({type:"string",format:"base64",check:"string_format",abort:!1,...m.A2(t)})),e.base64url=t=>e.check(new eo({type:"string",format:"base64url",check:"string_format",abort:!1,...m.A2(t)})),e.xid=t=>e.check(new ee({type:"string",format:"xid",check:"string_format",abort:!1,...m.A2(t)})),e.ksuid=t=>e.check(new et({type:"string",format:"ksuid",check:"string_format",abort:!1,...m.A2(t)})),e.ipv4=t=>e.check(new er({type:"string",format:"ipv4",check:"string_format",abort:!1,...m.A2(t)})),e.ipv6=t=>e.check(new ea({type:"string",format:"ipv6",check:"string_format",abort:!1,...m.A2(t)})),e.cidrv4=t=>e.check(new es({type:"string",format:"cidrv4",check:"string_format",abort:!1,...m.A2(t)})),e.cidrv6=t=>e.check(new ei({type:"string",format:"cidrv6",check:"string_format",abort:!1,...m.A2(t)})),e.e164=t=>e.check(new el({type:"string",format:"e164",check:"string_format",abort:!1,...m.A2(t)})),e.datetime=t=>e.check(S(t)),e.date=t=>e.check(new O({type:"string",format:"date",check:"string_format",...m.A2(t)})),e.time=t=>e.check(new P({type:"string",format:"time",check:"string_format",precision:null,...m.A2(t)})),e.duration=t=>e.check(new A({type:"string",format:"duration",check:"string_format",...m.A2(t)}))});function U(e){return new H({type:"string",...m.A2(e)})}let D=p.xI("ZodStringFormat",(e,t)=>{h.EY.init(e,t),L.init(e,t)}),V=p.xI("ZodEmail",(e,t)=>{h.qG.init(e,t),D.init(e,t)}),J=p.xI("ZodGUID",(e,t)=>{h.Zc.init(e,t),D.init(e,t)}),W=p.xI("ZodUUID",(e,t)=>{h.Zn.init(e,t),D.init(e,t)}),Y=p.xI("ZodURL",(e,t)=>{h.VY.init(e,t),D.init(e,t)}),K=p.xI("ZodEmoji",(e,t)=>{h.cG.init(e,t),D.init(e,t)}),Q=p.xI("ZodNanoID",(e,t)=>{h.Py.init(e,t),D.init(e,t)}),B=p.xI("ZodCUID",(e,t)=>{h.bl.init(e,t),D.init(e,t)}),G=p.xI("ZodCUID2",(e,t)=>{h.Zu.init(e,t),D.init(e,t)}),X=p.xI("ZodULID",(e,t)=>{h.g5.init(e,t),D.init(e,t)}),ee=p.xI("ZodXID",(e,t)=>{h.TF.init(e,t),D.init(e,t)}),et=p.xI("ZodKSUID",(e,t)=>{h.GY.init(e,t),D.init(e,t)}),er=p.xI("ZodIPv4",(e,t)=>{h.Lc.init(e,t),D.init(e,t)}),ea=p.xI("ZodIPv6",(e,t)=>{h.Zy.init(e,t),D.init(e,t)}),es=p.xI("ZodCIDRv4",(e,t)=>{h.CI.init(e,t),D.init(e,t)}),ei=p.xI("ZodCIDRv6",(e,t)=>{h.Cn.init(e,t),D.init(e,t)}),en=p.xI("ZodBase64",(e,t)=>{h.Dq.init(e,t),D.init(e,t)}),eo=p.xI("ZodBase64URL",(e,t)=>{h.CQ.init(e,t),D.init(e,t)}),el=p.xI("ZodE164",(e,t)=>{h.Oy.init(e,t),D.init(e,t)}),eu=p.xI("ZodJWT",(e,t)=>{h.h8.init(e,t),D.init(e,t)}),ed=p.xI("ZodNumber",(e,t)=>{h.vz.init(e,t),F.init(e,t),e.gt=(t,r)=>e.check(k(t,r)),e.gte=(t,r)=>e.check(b(t,r)),e.min=(t,r)=>e.check(b(t,r)),e.lt=(t,r)=>e.check(_(t,r)),e.lte=(t,r)=>e.check(y(t,r)),e.max=(t,r)=>e.check(y(t,r)),e.int=t=>e.check(eh(t)),e.safe=t=>e.check(eh(t)),e.positive=t=>e.check(k(0,t)),e.nonnegative=t=>e.check(b(0,t)),e.negative=t=>e.check(_(0,t)),e.nonpositive=t=>e.check(y(0,t)),e.multipleOf=(t,r)=>e.check(w(t,r)),e.step=(t,r)=>e.check(w(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 ec(e){return new ed({type:"number",checks:[],...m.A2(e)})}let ep=p.xI("ZodNumberFormat",(e,t)=>{h.I.init(e,t),ed.init(e,t)});function eh(e){return new ep({type:"number",check:"number_format",abort:!1,format:"safeint",...m.A2(e)})}let em=p.xI("ZodBoolean",(e,t)=>{h.sF.init(e,t),F.init(e,t)});function ef(e){return new em({type:"boolean",...m.A2(e)})}let eg=p.xI("ZodNull",(e,t)=>{h.x8.init(e,t),F.init(e,t)});function ev(e){return new eg({type:"null",...m.A2(e)})}let e_=p.xI("ZodUnknown",(e,t)=>{h.GP.init(e,t),F.init(e,t)});function ey(){return new e_({type:"unknown"})}let ek=p.xI("ZodNever",(e,t)=>{h.Um.init(e,t),F.init(e,t)}),eb=p.xI("ZodArray",(e,t)=>{h.$p.init(e,t),F.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(T(t,r)),e.nonempty=t=>e.check(T(1,t)),e.max=(t,r)=>e.check(x(t,r)),e.length=(t,r)=>e.check($(t,r)),e.unwrap=()=>e.element});function ew(e,t){return new eb({type:"array",element:e,...m.A2(t)})}let ex=p.xI("ZodObject",(e,t)=>{h.L8.init(e,t),F.init(e,t),m.gJ(e,"shape",()=>t.shape),e.keyof=()=>eN(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ey()}),e.loose=()=>e.clone({...e._zod.def,catchall:ey()}),e.strict=()=>{var t;return e.clone({...e._zod.def,catchall:(t=void 0,new ek({type:"never",...m.A2(t)}))})},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>m.X$(e,t),e.merge=t=>m.h1(e,t),e.pick=t=>m.Up(e,t),e.omit=t=>m.cJ(e,t),e.partial=(...t)=>m.OH(eF,e,t[0]),e.required=(...t)=>m.mw(eJ,e,t[0])});function eT(e,t){return new ex({type:"object",get shape(){return m.Vy(this,"shape",{...e}),this.shape},...m.A2(t)})}function e$(e,t){return new ex({type:"object",get shape(){return m.Vy(this,"shape",{...e}),this.shape},catchall:ey(),...m.A2(t)})}let eI=p.xI("ZodUnion",(e,t)=>{h.cu.init(e,t),F.init(e,t),e.options=t.options});function ez(e,t){return new eI({type:"union",options:e,...m.A2(t)})}let eS=p.xI("ZodDiscriminatedUnion",(e,t)=>{eI.init(e,t),h.P0.init(e,t)});function eO(e,t,r){return new eS({type:"union",options:t,discriminator:e,...m.A2(r)})}let eP=p.xI("ZodIntersection",(e,t)=>{h.LJ.init(e,t),F.init(e,t)});function eA(e,t){return new eP({type:"intersection",left:e,right:t})}let eZ=p.xI("ZodRecord",(e,t)=>{h.h.init(e,t),F.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function eE(e,t,r){return new eZ({type:"record",keyType:e,valueType:t,...m.A2(r)})}let eR=p.xI("ZodEnum",(e,t)=>{h.VO.init(e,t),F.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 s={};for(let a of e)if(r.has(a))s[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new eR({...t,checks:[],...m.A2(a),entries:s})},e.exclude=(e,a)=>{let s={...t.entries};for(let t of e)if(r.has(t))delete s[t];else throw Error(`Key ${t} not found in enum`);return new eR({...t,checks:[],...m.A2(a),entries:s})}});function eN(e,t){return new eR({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...m.A2(t)})}let eC=p.xI("ZodLiteral",(e,t)=>{h.nu.init(e,t),F.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 ej(e,t){return new eC({type:"literal",values:Array.isArray(e)?e:[e],...m.A2(t)})}let eq=p.xI("ZodTransform",(e,t)=>{h.Wc.init(e,t),F.init(e,t),e._zod.parse=(r,a)=>{r.addIssue=a=>{"string"==typeof a?r.issues.push(m.sn(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),a.continue??(a.continue=!0),r.issues.push(m.sn(a)))};let s=t.transform(r.value,r);return s instanceof Promise?s.then(e=>(r.value=e,r)):(r.value=s,r)}});function eM(e){return new eq({type:"transform",transform:e})}let eF=p.xI("ZodOptional",(e,t)=>{h.ig.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eL(e){return new eF({type:"optional",innerType:e})}let eH=p.xI("ZodNullable",(e,t)=>{h.qc.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType});function eU(e){return new eH({type:"nullable",innerType:e})}let eD=p.xI("ZodDefault",(e,t)=>{h.rv.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),eV=p.xI("ZodPrefault",(e,t)=>{h.VF.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType}),eJ=p.xI("ZodNonOptional",(e,t)=>{h.N$.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType}),eW=p.xI("ZodCatch",(e,t)=>{h.t$.init(e,t),F.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),eY=p.xI("ZodPipe",(e,t)=>{h._m.init(e,t),F.init(e,t),e.in=t.in,e.out=t.out});function eK(e,t){return new eY({type:"pipe",in:e,out:t})}let eQ=p.xI("ZodReadonly",(e,t)=>{h.Sb.init(e,t),F.init(e,t)}),eB=p.xI("ZodCustom",(e,t)=>{h.b0.init(e,t),F.init(e,t)}),eG="2025-11-25",eX=[eG,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],e0="io.modelcontextprotocol/related-task",e1=(s=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),i=void 0,(a=m.A2(i)).abort??(a.abort=!0),new eB({type:"custom",check:"custom",fn:s,...a})),e9=ez([U(),ec().int()]),e2=U(),e4=e$({ttl:ez([ec(),ev()]).optional(),pollInterval:ec().optional()}),e5=e$({taskId:U()}),e3=e$({progressToken:e9.optional(),[e0]:e5.optional()}),e6=e$({task:e4.optional(),_meta:e3.optional()}),e8=eT({method:U(),params:e6.optional()}),e7=e$({_meta:eT({[e0]:eL(e5)}).passthrough().optional()}),te=eT({method:U(),params:e7.optional()}),tt=e$({_meta:e$({[e0]:e5.optional()}).optional()}),tr=ez([U(),ec().int()]),ta=eT({jsonrpc:ej("2.0"),id:tr,...e8.shape}).strict(),ts=e=>ta.safeParse(e).success,ti=eT({jsonrpc:ej("2.0"),...te.shape}).strict(),tn=e=>ti.safeParse(e).success,to=eT({jsonrpc:ej("2.0"),id:tr,result:tt}).strict(),tl=e=>to.safeParse(e).success;(n=c||(c={}))[n.ConnectionClosed=-32e3]="ConnectionClosed",n[n.RequestTimeout=-32001]="RequestTimeout",n[n.ParseError=-32700]="ParseError",n[n.InvalidRequest=-32600]="InvalidRequest",n[n.MethodNotFound=-32601]="MethodNotFound",n[n.InvalidParams=-32602]="InvalidParams",n[n.InternalError=-32603]="InternalError",n[n.UrlElicitationRequired=-32042]="UrlElicitationRequired";let tu=eT({jsonrpc:ej("2.0"),id:tr,error:eT({code:ec().int(),message:U(),data:eL(ey())})}).strict(),td=e=>tu.safeParse(e).success,tc=ez([ta,ti,to,tu]),tp=tt.strict(),th=e7.extend({requestId:tr,reason:U().optional()}),tm=te.extend({method:ej("notifications/cancelled"),params:th}),tf=eT({src:U(),mimeType:U().optional(),sizes:ew(U()).optional()}),tg=eT({icons:ew(tf).optional()}),tv=eT({name:U(),title:U().optional()}),t_=tv.extend({...tv.shape,...tg.shape,version:U(),websiteUrl:U().optional()}),ty=eA(eT({applyDefaults:ef().optional()}),eE(U(),ey())),tk=(o=e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,l=eA(eT({form:ty.optional(),url:e1.optional()}),eE(U(),ey()).optional()),eK(eM(o),l)),tb=eT({list:eL(eT({}).passthrough()),cancel:eL(eT({}).passthrough()),requests:eL(eT({sampling:eL(eT({createMessage:eL(eT({}).passthrough())}).passthrough()),elicitation:eL(eT({create:eL(eT({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),tw=eT({list:eL(eT({}).passthrough()),cancel:eL(eT({}).passthrough()),requests:eL(eT({tools:eL(eT({call:eL(eT({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),tx=eT({experimental:eE(U(),e1).optional(),sampling:eT({context:e1.optional(),tools:e1.optional()}).optional(),elicitation:tk.optional(),roots:eT({listChanged:ef().optional()}).optional(),tasks:eL(tb)}),tT=e6.extend({protocolVersion:U(),capabilities:tx,clientInfo:t_}),t$=e8.extend({method:ej("initialize"),params:tT}),tI=eT({experimental:eE(U(),e1).optional(),logging:e1.optional(),completions:e1.optional(),prompts:eL(eT({listChanged:eL(ef())})),resources:eT({subscribe:ef().optional(),listChanged:ef().optional()}).optional(),tools:eT({listChanged:ef().optional()}).optional(),tasks:eL(tw)}).passthrough(),tz=tt.extend({protocolVersion:U(),capabilities:tI,serverInfo:t_,instructions:U().optional()}),tS=te.extend({method:ej("notifications/initialized")}),tO=e8.extend({method:ej("ping")}),tP=eT({progress:ec(),total:eL(ec()),message:eL(U())}),tA=eT({...e7.shape,...tP.shape,progressToken:e9}),tZ=te.extend({method:ej("notifications/progress"),params:tA}),tE=e6.extend({cursor:e2.optional()}),tR=e8.extend({params:tE.optional()}),tN=tt.extend({nextCursor:eL(e2)}),tC=eT({taskId:U(),status:eN(["working","input_required","completed","failed","cancelled"]),ttl:ez([ec(),ev()]),createdAt:U(),lastUpdatedAt:U(),pollInterval:eL(ec()),statusMessage:eL(U())}),tj=tt.extend({task:tC}),tq=e7.merge(tC),tM=te.extend({method:ej("notifications/tasks/status"),params:tq}),tF=e8.extend({method:ej("tasks/get"),params:e6.extend({taskId:U()})}),tL=tt.merge(tC),tH=e8.extend({method:ej("tasks/result"),params:e6.extend({taskId:U()})}),tU=tR.extend({method:ej("tasks/list")}),tD=tN.extend({tasks:ew(tC)}),tV=e8.extend({method:ej("tasks/cancel"),params:e6.extend({taskId:U()})}),tJ=tt.merge(tC),tW=eT({uri:U(),mimeType:eL(U()),_meta:eE(U(),ey()).optional()}),tY=tW.extend({text:U()}),tK=U().refine(e=>{try{return atob(e),!0}catch(e){return!1}},{message:"Invalid Base64 string"}),tQ=tW.extend({blob:tK}),tB=eT({audience:ew(eN(["user","assistant"])).optional(),priority:ec().min(0).max(1).optional(),lastModified:S({offset:!0}).optional()}),tG=eT({...tv.shape,...tg.shape,uri:U(),description:eL(U()),mimeType:eL(U()),annotations:tB.optional(),_meta:eL(e$({}))}),tX=eT({...tv.shape,...tg.shape,uriTemplate:U(),description:eL(U()),mimeType:eL(U()),annotations:tB.optional(),_meta:eL(e$({}))}),t0=tR.extend({method:ej("resources/list")}),t1=tN.extend({resources:ew(tG)}),t9=tR.extend({method:ej("resources/templates/list")}),t2=tN.extend({resourceTemplates:ew(tX)}),t4=e6.extend({uri:U()}),t5=e8.extend({method:ej("resources/read"),params:t4}),t3=tt.extend({contents:ew(ez([tY,tQ]))}),t6=te.extend({method:ej("notifications/resources/list_changed")}),t8=e8.extend({method:ej("resources/subscribe"),params:t4}),t7=e8.extend({method:ej("resources/unsubscribe"),params:t4}),re=e7.extend({uri:U()}),rt=te.extend({method:ej("notifications/resources/updated"),params:re}),rr=eT({name:U(),description:eL(U()),required:eL(ef())}),ra=eT({...tv.shape,...tg.shape,description:eL(U()),arguments:eL(ew(rr)),_meta:eL(e$({}))}),rs=tR.extend({method:ej("prompts/list")}),ri=tN.extend({prompts:ew(ra)}),rn=e6.extend({name:U(),arguments:eE(U(),U()).optional()}),ro=e8.extend({method:ej("prompts/get"),params:rn}),rl=eT({type:ej("text"),text:U(),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),ru=eT({type:ej("image"),data:tK,mimeType:U(),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),rd=eT({type:ej("audio"),data:tK,mimeType:U(),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),rc=eT({type:ej("tool_use"),name:U(),id:U(),input:eT({}).passthrough(),_meta:eL(eT({}).passthrough())}).passthrough(),rp=eT({type:ej("resource"),resource:ez([tY,tQ]),annotations:tB.optional(),_meta:eE(U(),ey()).optional()}),rh=ez([rl,ru,rd,tG.extend({type:ej("resource_link")}),rp]),rm=eT({role:eN(["user","assistant"]),content:rh}),rf=tt.extend({description:eL(U()),messages:ew(rm)}),rg=te.extend({method:ej("notifications/prompts/list_changed")}),rv=eT({title:U().optional(),readOnlyHint:ef().optional(),destructiveHint:ef().optional(),idempotentHint:ef().optional(),openWorldHint:ef().optional()}),r_=eT({taskSupport:eN(["required","optional","forbidden"]).optional()}),ry=eT({...tv.shape,...tg.shape,description:U().optional(),inputSchema:eT({type:ej("object"),properties:eE(U(),e1).optional(),required:ew(U()).optional()}).catchall(ey()),outputSchema:eT({type:ej("object"),properties:eE(U(),e1).optional(),required:ew(U()).optional()}).catchall(ey()).optional(),annotations:eL(rv),execution:eL(r_),_meta:eE(U(),ey()).optional()}),rk=tR.extend({method:ej("tools/list")}),rb=tN.extend({tools:ew(ry)}),rw=tt.extend({content:ew(rh).default([]),structuredContent:eE(U(),ey()).optional(),isError:eL(ef())});rw.or(tt.extend({toolResult:ey()}));let rx=e6.extend({name:U(),arguments:eL(eE(U(),ey()))}),rT=e8.extend({method:ej("tools/call"),params:rx}),r$=te.extend({method:ej("notifications/tools/list_changed")}),rI=eN(["debug","info","notice","warning","error","critical","alert","emergency"]),rz=e6.extend({level:rI}),rS=e8.extend({method:ej("logging/setLevel"),params:rz}),rO=e7.extend({level:rI,logger:U().optional(),data:ey()}),rP=te.extend({method:ej("notifications/message"),params:rO}),rA=eT({name:U().optional()}),rZ=eT({hints:eL(ew(rA)),costPriority:eL(ec().min(0).max(1)),speedPriority:eL(ec().min(0).max(1)),intelligencePriority:eL(ec().min(0).max(1))}),rE=eT({mode:eL(eN(["auto","required","none"]))}),rR=eT({type:ej("tool_result"),toolUseId:U().describe("The unique identifier for the corresponding tool call."),content:ew(rh).default([]),structuredContent:eT({}).passthrough().optional(),isError:eL(ef()),_meta:eL(eT({}).passthrough())}).passthrough(),rN=eO("type",[rl,ru,rd]),rC=eO("type",[rl,ru,rd,rc,rR]),rj=eT({role:eN(["user","assistant"]),content:ez([rC,ew(rC)]),_meta:eL(eT({}).passthrough())}).passthrough(),rq=e6.extend({messages:ew(rj),modelPreferences:rZ.optional(),systemPrompt:U().optional(),includeContext:eN(["none","thisServer","allServers"]).optional(),temperature:ec().optional(),maxTokens:ec().int(),stopSequences:ew(U()).optional(),metadata:e1.optional(),tools:eL(ew(ry)),toolChoice:eL(rE)}),rM=e8.extend({method:ej("sampling/createMessage"),params:rq}),rF=tt.extend({model:U(),stopReason:eL(eN(["endTurn","stopSequence","maxTokens"]).or(U())),role:eN(["user","assistant"]),content:rN}),rL=tt.extend({model:U(),stopReason:eL(eN(["endTurn","stopSequence","maxTokens","toolUse"]).or(U())),role:eN(["user","assistant"]),content:ez([rC,ew(rC)])}),rH=eT({type:ej("boolean"),title:U().optional(),description:U().optional(),default:ef().optional()}),rU=eT({type:ej("string"),title:U().optional(),description:U().optional(),minLength:ec().optional(),maxLength:ec().optional(),format:eN(["email","uri","date","date-time"]).optional(),default:U().optional()}),rD=eT({type:eN(["number","integer"]),title:U().optional(),description:U().optional(),minimum:ec().optional(),maximum:ec().optional(),default:ec().optional()}),rV=eT({type:ej("string"),title:U().optional(),description:U().optional(),enum:ew(U()),default:U().optional()}),rJ=eT({type:ej("string"),title:U().optional(),description:U().optional(),oneOf:ew(eT({const:U(),title:U()})),default:U().optional()}),rW=eT({type:ej("string"),title:U().optional(),description:U().optional(),enum:ew(U()),enumNames:ew(U()).optional(),default:U().optional()}),rY=ez([rV,rJ]),rK=ez([eT({type:ej("array"),title:U().optional(),description:U().optional(),minItems:ec().optional(),maxItems:ec().optional(),items:eT({type:ej("string"),enum:ew(U())}),default:ew(U()).optional()}),eT({type:ej("array"),title:U().optional(),description:U().optional(),minItems:ec().optional(),maxItems:ec().optional(),items:eT({anyOf:ew(eT({const:U(),title:U()}))}),default:ew(U()).optional()})]),rQ=ez([rW,rY,rK]),rB=ez([rQ,rH,rU,rD]),rG=ez([e6.extend({mode:ej("form").optional(),message:U(),requestedSchema:eT({type:ej("object"),properties:eE(U(),rB),required:ew(U()).optional()})}),e6.extend({mode:ej("url"),message:U(),elicitationId:U(),url:U().url()})]),rX=e8.extend({method:ej("elicitation/create"),params:rG}),r0=e7.extend({elicitationId:U()}),r1=te.extend({method:ej("notifications/elicitation/complete"),params:r0}),r9=tt.extend({action:eN(["accept","decline","cancel"]),content:(u=e=>null===e?void 0:e,d=eE(U(),ez([U(),ec(),ef(),ew(U())])).optional(),eK(eM(u),d))}),r2=eT({type:ej("ref/resource"),uri:U()}),r4=eT({type:ej("ref/prompt"),name:U()}),r5=e6.extend({ref:ez([r4,r2]),argument:eT({name:U(),value:U()}),context:eT({arguments:eE(U(),U()).optional()}).optional()}),r3=e8.extend({method:ej("completion/complete"),params:r5});function r6(e){if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function r8(e){if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}let r7=tt.extend({completion:e$({values:ew(U()).max(100),total:eL(ec().int()),hasMore:eL(ef())})}),ae=eT({uri:U().startsWith("file://"),name:U().optional(),_meta:eE(U(),ey()).optional()}),at=e8.extend({method:ej("roots/list")}),ar=tt.extend({roots:ew(ae)}),aa=te.extend({method:ej("notifications/roots/list_changed")});ez([tO,t$,r3,rS,ro,rs,t0,t9,t5,t8,t7,rT,rk,tF,tH,tU]),ez([tm,tZ,tS,aa,tM]),ez([tp,rF,rL,r9,ar,tL,tD,tj]),ez([tO,rM,rX,at,tF,tH,tU]),ez([tm,tZ,rP,rt,t6,r$,rg,tM,r1]),ez([tp,tz,r7,rf,ri,t1,t2,t3,rw,rb,tL,tD,tj]);class as 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===c.UrlElicitationRequired&&r&&r.elicitations?new ai(r.elicitations,t):new as(e,t,r)}}class ai extends as{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(c.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){var e,t;return null!=(t=null==(e=this.data)?void 0:e.elicitations)?t:[]}}},84867(e,t,r){var a,s,i,n,o,l,u;let d;r.d(t,{k5:()=>eC,bz:()=>eA,g1:()=>eN,zM:()=>eP,ai:()=>eO,kY:()=>n,Ik:()=>eE,YO:()=>eZ,Yj:()=>eS,KC:()=>eR}),(o=a||(a={})).assertEqual=e=>{},o.assertIs=function(e){},o.assertNever=function(e){throw Error()},o.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},o.getValidEnumValues=e=>{let t=o.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return o.objectValues(r)},o.objectValues=e=>o.objectKeys(e).map(function(t){return e[t]}),o.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},o.find=(e,t)=>{for(let r of e)if(t(r))return r},o.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,o.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},o.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(s||(s={})).mergeShapes=(e,t)=>({...e,...t});let c=a.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),p=e=>{switch(typeof e){case"undefined":return c.undefined;case"string":return c.string;case"number":return Number.isNaN(e)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":if(Array.isArray(e))return c.array;if(null===e)return c.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return c.promise;if("u">typeof Map&&e instanceof Map)return c.map;if("u">typeof Set&&e instanceof Set)return c.set;if("u">typeof Date&&e instanceof Date)return c.date;return c.object;default:return c.unknown}},h=a.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 m 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]};let 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 s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){let r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof m))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,a.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},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()}}m.create=e=>new m(e);let f=(e,t)=>{let r;switch(e.code){case h.invalid_type:r=e.received===c.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,a.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:r=`Unrecognized key(s) in object: ${a.joinValues(e.keys,", ")}`;break;case h.invalid_union:r="Invalid input";break;case h.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${a.joinValues(e.options)}`;break;case h.invalid_enum_value:r=`Invalid enum value. Expected ${a.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:r="Invalid function arguments";break;case h.invalid_return_type:r="Invalid function return type";break;case h.invalid_date:r="Invalid date";break;case h.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}"`:a.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case h.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 h.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 h.custom:r="Invalid input";break;case h.invalid_intersection_types:r="Intersection results could not be merged";break;case h.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:r="Number must be finite";break;default:r=t.defaultError,a.assertNever(e)}return{message:r}};(l=i||(i={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},l.toString=e=>"string"==typeof e?e:e?.message;let g=e=>{let{data:t,path:r,errorMaps:a,issueData:s}=e,i=[...r,...s.path||[]],n={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";for(let e of a.filter(e=>!!e).slice().reverse())o=e(n,{data:t,defaultError:o}).message;return{...s,path:i,message:o}};function v(e,t){let r=g({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,f,void 0].filter(e=>!!e)});e.common.issues.push(r)}class _{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 y;"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 _.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:s}=a;if("aborted"===t.status||"aborted"===s.status)return y;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==s.value||a.alwaysSet)&&(r[t.value]=s.value)}return{status:e.value,value:r}}}let y=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),b=e=>({status:"valid",value:e}),w=e=>"u">typeof Promise&&e instanceof Promise;class x{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 T=(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 m(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:s}=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:s}:{errorMap:(t,s)=>{let{message:i}=e;return"invalid_enum_value"===t.code?{message:i??s.defaultError}:void 0===s.data?{message:i??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:i??r??s.defaultError}},description:s}}class I{get description(){return this._def.description}_getType(e){return p(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _,ctx:{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(w(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:p(e)},a=this._parseSync({data:e,path:r.path,parent:r});return T(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(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:p(e)},a=this._parse({data:e,path:r.path,parent:r});return T(r,await (w(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let s=e(r),i=()=>a.addIssue({code:h.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&s instanceof Promise?s.then(e=>!!e||(i(),!1)):!!s||(i(),!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 ey({schema:this,typeName:n.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 ek.create(this,this._def)}nullable(){return eb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return er.create(this)}promise(){return e_.create(this,this._def)}or(e){return es.create([this,e],this._def)}and(e){return eo.create(this,e,this._def)}transform(e){return new ey({...$(this._def),schema:this,typeName:n.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ew({...$(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:n.ZodDefault})}brand(){return new e$({typeName:n.ZodBranded,type:this,...$(this._def)})}catch(e){return new ex({...$(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:n.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eI.create(this,e)}readonly(){return ez.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let z=/^c[^\s-]{8,}$/i,S=/^[0-9a-z]+$/,O=/^[0-9A-HJKMNP-TV-Z]{26}$/i,P=/^[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,A=/^[a-z0-9_-]{21}$/i,Z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,E=/^[-+]?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)?)??$/,R=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,N=/^(?:(?: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])$/,C=/^(?:(?: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])$/,j=/^(([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]))$/,q=/^(([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])$/,M=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,F=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L="((\\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])))",H=RegExp(`^${L}$`);function U(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 D extends I{_parse(e){var t,r,s,i;let n;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==c.string){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.string,received:t.parsedType}),y}let o=new _;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(v(n=this._getOrReturnCtx(e,n),{code:h.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&&(v(n=this._getOrReturnCtx(e,n),{code:h.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?v(n,{code:h.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&v(n,{code:h.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)R.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"email",code:h.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)d||(d=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),d.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"emoji",code:h.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)P.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"uuid",code:h.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)A.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"nanoid",code:h.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)z.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"cuid",code:h.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)S.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"cuid2",code:h.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)O.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"ulid",code:h.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{v(n=this._getOrReturnCtx(e,n),{validation:"url",code:h.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"regex",code:h.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)||(v(n=this._getOrReturnCtx(e,n),{code:h.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)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${L}T${U(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)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?H.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${U(l)}$`).test(e.data)||(v(n=this._getOrReturnCtx(e,n),{code:h.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?E.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"duration",code:h.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(t=e.data,!(("v4"===(r=l.version)||!r)&&N.test(t)||("v6"===r||!r)&&j.test(t))&&1&&(v(n=this._getOrReturnCtx(e,n),{validation:"ip",code:h.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!Z.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,"="),s=JSON.parse(atob(a));if("object"!=typeof s||null===s||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)return!1;return!0}catch{return!1}}(e.data,l.alg)&&(v(n=this._getOrReturnCtx(e,n),{validation:"jwt",code:h.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(s=e.data,!(("v4"===(i=l.version)||!i)&&C.test(s)||("v6"===i||!i)&&q.test(s))&&1&&(v(n=this._getOrReturnCtx(e,n),{validation:"cidr",code:h.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?M.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"base64",code:h.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?F.test(e.data)||(v(n=this._getOrReturnCtx(e,n),{validation:"base64url",code:h.invalid_string,message:l.message}),o.dirty()):a.assertNever(l);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:h.invalid_string,...i.errToObj(r)})}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...i.errToObj(e)})}url(e){return this._addCheck({kind:"url",...i.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...i.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...i.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...i.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...i.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...i.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...i.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...i.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...i.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...i.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...i.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...i.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,...i.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,...i.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...i.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...i.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...i.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...i.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...i.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...i.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...i.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...i.errToObj(t)})}nonempty(e){return this.min(1,i.errToObj(e))}trim(){return new D({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new D({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new D({...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}}D.create=e=>new D({checks:[],typeName:n.ZodString,coerce:e?.coerce??!1,...$(e)});class V extends I{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)!==c.number){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.number,received:t.parsedType}),y}let r=new _;for(let s of this._def.checks)"int"===s.kind?a.isInteger(e.data)||(v(t=this._getOrReturnCtx(e,t),{code:h.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):"multipleOf"===s.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(e.data,s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(v(t=this._getOrReturnCtx(e,t),{code:h.not_finite,message:s.message}),r.dirty()):a.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,i.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.toString(t))}setLimit(e,t,r,a){return new V({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:i.toString(a)}]})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:i.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:i.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:i.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:i.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:i.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:i.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:i.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:i.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&&a.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)}}V.create=e=>new V({checks:[],typeName:n.ZodNumber,coerce:e?.coerce||!1,...$(e)});class J extends I{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)!==c.bigint)return this._getInvalidInput(e);let r=new _;for(let s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(v(t=this._getOrReturnCtx(e,t),{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):a.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,i.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.toString(t))}setLimit(e,t,r,a){return new J({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:i.toString(a)}]})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:i.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:i.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:i.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:i.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.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}}J.create=e=>new J({checks:[],typeName:n.ZodBigInt,coerce:e?.coerce??!1,...$(e)});class W extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==c.boolean){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.boolean,received:t.parsedType}),y}return b(e.data)}}W.create=e=>new W({typeName:n.ZodBoolean,coerce:e?.coerce||!1,...$(e)});class Y extends I{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==c.date){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.date,received:t.parsedType}),y}if(Number.isNaN(e.data.getTime()))return v(this._getOrReturnCtx(e),{code:h.invalid_date}),y;let r=new _;for(let s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(v(t=this._getOrReturnCtx(e,t),{code:h.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):a.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:i.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:i.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}}Y.create=e=>new Y({checks:[],coerce:e?.coerce||!1,typeName:n.ZodDate,...$(e)});class K extends I{_parse(e){if(this._getType(e)!==c.symbol){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.symbol,received:t.parsedType}),y}return b(e.data)}}K.create=e=>new K({typeName:n.ZodSymbol,...$(e)});class Q extends I{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.undefined,received:t.parsedType}),y}return b(e.data)}}Q.create=e=>new Q({typeName:n.ZodUndefined,...$(e)});class B extends I{_parse(e){if(this._getType(e)!==c.null){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.null,received:t.parsedType}),y}return b(e.data)}}B.create=e=>new B({typeName:n.ZodNull,...$(e)});class G extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return b(e.data)}}G.create=e=>new G({typeName:n.ZodAny,...$(e)});class X extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return b(e.data)}}X.create=e=>new X({typeName:n.ZodUnknown,...$(e)});class ee extends I{_parse(e){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.never,received:t.parsedType}),y}}ee.create=e=>new ee({typeName:n.ZodNever,...$(e)});class et extends I{_parse(e){if(this._getType(e)!==c.undefined){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.void,received:t.parsedType}),y}return b(e.data)}}et.create=e=>new et({typeName:n.ZodVoid,...$(e)});class er extends I{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==c.array)return v(t,{code:h.invalid_type,expected:c.array,received:t.parsedType}),y;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(v(t,{code:e?h.too_big:h.too_small,minimum:s?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&&(v(t,{code:h.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&&(v(t,{code:h.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 x(t,e,t.path,r)))).then(e=>_.mergeArray(r,e));let s=[...t.data].map((e,r)=>a.type._parseSync(new x(t,e,t.path,r)));return _.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new er({...this._def,minLength:{value:e,message:i.toString(t)}})}max(e,t){return new er({...this._def,maxLength:{value:e,message:i.toString(t)}})}length(e,t){return new er({...this._def,exactLength:{value:e,message:i.toString(t)}})}nonempty(e){return this.min(1,e)}}er.create=(e,t)=>new er({type:e,minLength:null,maxLength:null,exactLength:null,typeName:n.ZodArray,...$(t)});class ea extends I{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=a.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==c.object){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),y}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof ee&&"strip"===this._def.unknownKeys))for(let e in r.data)s.includes(e)||i.push(e);let n=[];for(let e of s){let t=a[e],s=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new x(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ee){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of i)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(v(r,{code:h.unrecognized_keys,keys:i}),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 i){let a=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new x(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=>_.mergeObjectSync(t,e)):_.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return i.errToObj,new ea({...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:i.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new ea({...this._def,unknownKeys:"strip"})}passthrough(){return new ea({...this._def,unknownKeys:"passthrough"})}extend(e){return new ea({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ea({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:n.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ea({...this._def,catchall:e})}pick(e){let t={};for(let r of a.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ea({...this._def,shape:()=>t})}omit(e){let t={};for(let r of a.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ea({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ea){let r={};for(let a in t.shape){let s=t.shape[a];r[a]=ek.create(e(s))}return new ea({...t._def,shape:()=>r})}if(t instanceof er)return new er({...t._def,type:e(t.element)});if(t instanceof ek)return ek.create(e(t.unwrap()));if(t instanceof eb)return eb.create(e(t.unwrap()));if(t instanceof el)return el.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of a.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new ea({...this._def,shape:()=>t})}required(e){let t={};for(let r of a.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ek;)e=e._def.innerType;t[r]=e}return new ea({...this._def,shape:()=>t})}keyof(){return ef(a.objectKeys(this.shape))}}ea.create=(e,t)=>new ea({shape:()=>e,unknownKeys:"strip",catchall:ee.create(),typeName:n.ZodObject,...$(t)}),ea.strictCreate=(e,t)=>new ea({shape:()=>e,unknownKeys:"strict",catchall:ee.create(),typeName:n.ZodObject,...$(t)}),ea.lazycreate=(e,t)=>new ea({shape:e,unknownKeys:"strip",catchall:ee.create(),typeName:n.ZodObject,...$(t)});class es extends I{_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 m(e.ctx.common.issues));return v(t,{code:h.invalid_union,unionErrors:r}),y});{let e,a=[];for(let s of r){let r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,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 s=a.map(e=>new m(e));return v(t,{code:h.invalid_union,unionErrors:s}),y}}get options(){return this._def.options}}es.create=(e,t)=>new es({options:e,typeName:n.ZodUnion,...$(t)});let ei=e=>{if(e instanceof eh)return ei(e.schema);if(e instanceof ey)return ei(e.innerType());if(e instanceof em)return[e.value];if(e instanceof eg)return e.options;if(e instanceof ev)return a.objectValues(e.enum);else if(e instanceof ew)return ei(e._def.innerType);else if(e instanceof Q)return[void 0];else if(e instanceof B)return[null];else if(e instanceof ek)return[void 0,...ei(e.unwrap())];else if(e instanceof eb)return[null,...ei(e.unwrap())];else if(e instanceof e$)return ei(e.unwrap());else if(e instanceof ez)return ei(e.unwrap());else if(e instanceof ex)return ei(e._def.innerType);else return[]};class en extends I{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.object)return v(t,{code:h.invalid_type,expected:c.object,received:t.parsedType}),y;let r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(v(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),y)}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=ei(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of t){if(a.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new en({typeName:n.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$(r)})}}class eo extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if("aborted"===e.status||"aborted"===s.status)return y;let i=function e(t,r){let s=p(t),i=p(r);if(t===r)return{valid:!0,data:t};if(s===c.object&&i===c.object){let s=a.objectKeys(r),i=a.objectKeys(t).filter(e=>-1!==s.indexOf(e)),n={...t,...r};for(let a of i){let s=e(t[a],r[a]);if(!s.valid)return{valid:!1};n[a]=s.data}return{valid:!0,data:n}}if(s===c.array&&i===c.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};a.push(i.data)}return{valid:!0,data:a}}if(s===c.date&&i===c.date&&+t==+r)return{valid:!0,data:t};return{valid:!1}}(e.value,s.value);return i.valid?(("dirty"===e.status||"dirty"===s.status)&&t.dirty(),{status:t.value,value:i.data}):(v(r,{code:h.invalid_intersection_types}),y)};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])=>s(e,t)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eo.create=(e,t,r)=>new eo({left:e,right:t,typeName:n.ZodIntersection,...$(r)});class el extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.array)return v(r,{code:h.invalid_type,expected:c.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return v(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(v(r,{code:h.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 x(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>_.mergeArray(t,e)):_.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new el({...this._def,rest:e})}}el.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new el({items:e,typeName:n.ZodTuple,rest:null,...$(t)})};class eu extends I{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!==c.object)return v(r,{code:h.invalid_type,expected:c.object,received:r.parsedType}),y;let a=[],s=this._def.keyType,i=this._def.valueType;for(let e in r.data)a.push({key:s._parse(new x(r,e,r.path,e)),value:i._parse(new x(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?_.mergeObjectAsync(t,a):_.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new eu(t instanceof I?{keyType:e,valueType:t,typeName:n.ZodRecord,...$(r)}:{keyType:D.create(),valueType:e,typeName:n.ZodRecord,...$(t)})}}class ed extends I{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!==c.map)return v(r,{code:h.invalid_type,expected:c.map,received:r.parsedType}),y;let a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new x(r,e,r.path,[i,"key"])),value:s._parse(new x(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of i){let a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return y;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of i){let a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return y;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}ed.create=(e,t,r)=>new ed({valueType:t,keyType:e,typeName:n.ZodMap,...$(r)});class ec extends I{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==c.set)return v(r,{code:h.invalid_type,expected:c.set,received:r.parsedType}),y;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(v(r,{code:h.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&&(v(r,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function i(e){let r=new Set;for(let a of e){if("aborted"===a.status)return y;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let n=[...r.data.values()].map((e,t)=>s._parse(new x(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>i(e)):i(n)}min(e,t){return new ec({...this._def,minSize:{value:e,message:i.toString(t)}})}max(e,t){return new ec({...this._def,maxSize:{value:e,message:i.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ec.create=(e,t)=>new ec({valueType:e,minSize:null,maxSize:null,typeName:n.ZodSet,...$(t)});class ep extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.function)return v(t,{code:h.invalid_type,expected:c.function,received:t.parsedType}),y;function r(e,r){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f,f].filter(e=>!!e),issueData:{code:h.invalid_arguments,argumentsError:r}})}function a(e,r){return g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f,f].filter(e=>!!e),issueData:{code:h.invalid_return_type,returnTypeError:r}})}let s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof e_){let e=this;return b(async function(...t){let n=new m([]),o=await e._def.args.parseAsync(t,s).catch(e=>{throw n.addIssue(r(t,e)),n}),l=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(l,s).catch(e=>{throw n.addIssue(a(l,e)),n})})}{let e=this;return b(function(...t){let n=e._def.args.safeParse(t,s);if(!n.success)throw new m([r(t,n.error)]);let o=Reflect.apply(i,this,n.data),l=e._def.returns.safeParse(o,s);if(!l.success)throw new m([a(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ep({...this._def,args:el.create(e).rest(X.create())})}returns(e){return new ep({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ep({args:e||el.create([]).rest(X.create()),returns:t||X.create(),typeName:n.ZodFunction,...$(r)})}}class eh extends I{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})}}eh.create=(e,t)=>new eh({getter:e,typeName:n.ZodLazy,...$(t)});class em extends I{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ef(e,t){return new eg({values:e,typeName:n.ZodEnum,...$(t)})}em.create=(e,t)=>new em({value:e,typeName:n.ZodLiteral,...$(t)});class eg extends I{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return v(t,{expected:a.joinValues(r),received:t.parsedType,code:h.invalid_type}),y}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 v(t,{received:t.data,code:h.invalid_enum_value,options:r}),y}return b(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 eg.create(e,{...this._def,...t})}exclude(e,t=this._def){return eg.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}eg.create=ef;class ev extends I{_parse(e){let t=a.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==c.string&&r.parsedType!==c.number){let e=a.objectValues(t);return v(r,{expected:a.joinValues(e),received:r.parsedType,code:h.invalid_type}),y}if(this._cache||(this._cache=new Set(a.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=a.objectValues(t);return v(r,{received:r.data,code:h.invalid_enum_value,options:e}),y}return b(e.data)}get enum(){return this._def.values}}ev.create=(e,t)=>new ev({values:e,typeName:n.ZodNativeEnum,...$(t)});class e_ extends I{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==c.promise&&!1===t.common.async?(v(t,{code:h.invalid_type,expected:c.promise,received:t.parsedType}),y):b((t.parsedType===c.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}e_.create=(e,t)=>new e_({type:e,typeName:n.ZodPromise,...$(t)});class ey extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===n.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:e=>{v(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===s.type){let e=s.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return y;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?y:"dirty"===a.status||"dirty"===t.value?k(a.value):a});{if("aborted"===t.value)return y;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?y:"dirty"===a.status||"dirty"===t.value?k(a.value):a}}if("refinement"===s.type){let e=e=>{let t=s.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?y:("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?y:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===s.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?y:Promise.resolve(s.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 y;let a=s.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}a.assertNever(s)}}ey.create=(e,t,r)=>new ey({schema:e,typeName:n.ZodEffects,effect:t,...$(r)}),ey.createWithPreprocess=(e,t,r)=>new ey({schema:t,effect:{type:"preprocess",transform:e},typeName:n.ZodEffects,...$(r)});class ek extends I{_parse(e){return this._getType(e)===c.undefined?b(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ek.create=(e,t)=>new ek({innerType:e,typeName:n.ZodOptional,...$(t)});class eb extends I{_parse(e){return this._getType(e)===c.null?b(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eb.create=(e,t)=>new eb({innerType:e,typeName:n.ZodNullable,...$(t)});class ew extends I{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===c.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ew.create=(e,t)=>new ew({innerType:e,typeName:n.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$(t)});class ex extends I{_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 w(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new m(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new m(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ex.create=(e,t)=>new ex({innerType:e,typeName:n.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$(t)});class eT extends I{_parse(e){if(this._getType(e)!==c.nan){let t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:c.nan,received:t.parsedType}),y}return{status:"valid",value:e.data}}}eT.create=e=>new eT({typeName:n.ZodNaN,...$(e)}),Symbol("zod_brand");class e$ extends I{_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 eI extends I{_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?y:"dirty"===e.status?(t.dirty(),k(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?y:"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 eI({in:e,out:t,typeName:n.ZodPipeline})}}class ez extends I{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return w(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}ez.create=(e,t)=>new ez({innerType:e,typeName:n.ZodReadonly,...$(t)}),ea.lazycreate,(u=n||(n={})).ZodString="ZodString",u.ZodNumber="ZodNumber",u.ZodNaN="ZodNaN",u.ZodBigInt="ZodBigInt",u.ZodBoolean="ZodBoolean",u.ZodDate="ZodDate",u.ZodSymbol="ZodSymbol",u.ZodUndefined="ZodUndefined",u.ZodNull="ZodNull",u.ZodAny="ZodAny",u.ZodUnknown="ZodUnknown",u.ZodNever="ZodNever",u.ZodVoid="ZodVoid",u.ZodArray="ZodArray",u.ZodObject="ZodObject",u.ZodUnion="ZodUnion",u.ZodDiscriminatedUnion="ZodDiscriminatedUnion",u.ZodIntersection="ZodIntersection",u.ZodTuple="ZodTuple",u.ZodRecord="ZodRecord",u.ZodMap="ZodMap",u.ZodSet="ZodSet",u.ZodFunction="ZodFunction",u.ZodLazy="ZodLazy",u.ZodLiteral="ZodLiteral",u.ZodEnum="ZodEnum",u.ZodEffects="ZodEffects",u.ZodNativeEnum="ZodNativeEnum",u.ZodOptional="ZodOptional",u.ZodNullable="ZodNullable",u.ZodDefault="ZodDefault",u.ZodCatch="ZodCatch",u.ZodPromise="ZodPromise",u.ZodBranded="ZodBranded",u.ZodPipeline="ZodPipeline",u.ZodReadonly="ZodReadonly";let eS=D.create,eO=V.create;eT.create,J.create;let eP=W.create;Y.create,K.create,Q.create,B.create;let eA=G.create;X.create,ee.create,et.create;let eZ=er.create,eE=ea.create;ea.strictCreate;let eR=es.create;en.create,eo.create,el.create;let eN=eu.create;ed.create,ec.create,ep.create,eh.create,em.create;let eC=eg.create;ev.create,e_.create,ey.create,ek.create,eb.create,ey.createWithPreprocess,eI.create},45830(e,t,r){r.d(t,{DG:()=>g,E6:()=>b,J:()=>k,J_:()=>u,Jk:()=>d,KH:()=>c,Kk:()=>h,NI:()=>v,QP:()=>n,RM:()=>m,Tt:()=>y,Yk:()=>p,kH:()=>_,ql:()=>f,sm:()=>l,v$:()=>w});var a=r(98824),s=r(72512),i=r(18399);let n=a.xI("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),o={number:"number",bigint:"bigint",object:"date"},l=a.xI("$ZodCheckLessThan",(e,t)=>{n.init(e,t);let r=o[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})}}),u=a.xI("$ZodCheckGreaterThan",(e,t)=>{n.init(e,t);let r=o[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})}}),d=a.xI("$ZodCheckMultipleOf",(e,t)=>{n.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===i.LG(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})}}),c=a.xI("$ZodCheckNumberFormat",(e,t)=>{n.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[o,l]=i.zH[t.format];e._zod.onattach.push(e=>{let a=e._zod.bag;a.format=t.format,a.minimum=o,a.maximum=l,r&&(a.pattern=s.nd)}),e._zod.check=s=>{let i=s.value;if(r){if(!Number.isInteger(i))return void s.issues.push({expected:a,format:t.format,code:"invalid_type",input:i,inst:e});if(!Number.isSafeInteger(i))return void(i>0?s.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):s.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}))}i<o&&s.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),i>l&&s.issues.push({origin:"number",input:i,code:"too_big",maximum:l,inst:e})}}),p=a.xI("$ZodCheckMaxLength",(e,t)=>{var r;n.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!i.cl(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 s=i.Rc(a);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),h=a.xI("$ZodCheckMinLength",(e,t)=>{var r;n.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!i.cl(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 s=i.Rc(a);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),m=a.xI("$ZodCheckLengthEquals",(e,t)=>{var r;n.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!i.cl(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,s=a.length;if(s===t.length)return;let n=i.Rc(a),o=s>t.length;r.issues.push({origin:n,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),f=a.xI("$ZodCheckStringFormat",(e,t)=>{var r,a;n.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=()=>{})}),g=a.xI("$ZodCheckRegex",(e,t)=>{f.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})}}),v=a.xI("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=s.AC),f.init(e,t)}),_=a.xI("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=s.Zv),f.init(e,t)}),y=a.xI("$ZodCheckIncludes",(e,t)=>{n.init(e,t);let r=i.$f(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})}}),k=a.xI("$ZodCheckStartsWith",(e,t)=>{n.init(e,t);let r=RegExp(`^${i.$f(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})}}),b=a.xI("$ZodCheckEndsWith",(e,t)=>{n.init(e,t);let r=RegExp(`.*${i.$f(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})}}),w=a.xI("$ZodCheckOverwrite",(e,t)=>{n.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})},98824(e,t,r){function a(e,t,r){function a(r,a){var s;for(let i in Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(s=r._zod).traits??(s.traits=new Set),r._zod.traits.add(e),t(r,a),n.prototype)i in r||Object.defineProperty(r,i,{value:n.prototype[i].bind(r)});r._zod.constr=n,r._zod.def=a}let s=r?.Parent??Object;class i extends s{}function n(e){var t;let s=r?.Parent?new i:this;for(let r of(a(s,e),(t=s._zod).deferred??(t.deferred=[]),s._zod.deferred))r();return s}return Object.defineProperty(i,"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}r.d(t,{$W:()=>n,GT:()=>s,cr:()=>i,xI:()=>a}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class s extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}let i={};function n(e){return e&&Object.assign(i,e),i}},29896(e,t,r){r.d(t,{JM:()=>l,Kd:()=>o,Wk:()=>u,a$:()=>n});var a=r(98824),s=r(18399);let i=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,s.k8,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},n=(0,a.xI)("$ZodError",i),o=(0,a.xI)("$ZodError",i,{Parent:Error});function l(e,t=e=>e.message){let r={},a=[];for(let s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:r}}function u(e,t){let r=t||function(e){return e.message},a={_errors:[]},s=e=>{for(let t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>s({issues:e}));else if("invalid_key"===t.code)s({issues:t.issues});else if("invalid_element"===t.code)s({issues:t.issues});else if(0===t.path.length)a._errors.push(r(t));else{let e=a,s=0;for(;s<t.path.length;){let a=t.path[s];s===t.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(r(t))):e[a]=e[a]||{_errors:[]},e=e[a],s++}}};return s(e),a}},7432(e,t,r){r.d(t,{EJ:()=>u,Od:()=>d,Rb:()=>l,Tj:()=>n,bp:()=>h,qg:()=>o,wG:()=>p,xL:()=>c});var a=r(98824),s=r(29896),i=r(18399);let n=e=>(t,r,s,n)=>{let o=s?Object.assign(s,{async:!1}):{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new a.GT;if(l.issues.length){let t=new(n?.Err??e)(l.issues.map(e=>i.iR(e,o,a.$W())));throw i.gx(t,n?.callee),t}return l.value},o=n(s.Kd),l=e=>async(t,r,s,n)=>{let o=s?Object.assign(s,{async:!0}):{async:!0},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise&&(l=await l),l.issues.length){let t=new(n?.Err??e)(l.issues.map(e=>i.iR(e,o,a.$W())));throw i.gx(t,n?.callee),t}return l.value},u=l(s.Kd),d=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new a.GT;return l.issues.length?{success:!1,error:new(e??s.a$)(l.issues.map(e=>i.iR(e,o,a.$W())))}:{success:!0,data:l.value}},c=d(s.Kd),p=e=>async(t,r,s)=>{let n=s?Object.assign(s,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>i.iR(e,n,a.$W())))}:{success:!0,data:o.value}},h=p(s.Kd)},72512(e,t,r){r.d(t,{AC:()=>Z,Ak:()=>l,Gl:()=>s,K3:()=>_,OI:()=>k,Os:()=>d,Rp:()=>p,Yj:()=>z,Z0:()=>i,Zg:()=>h,Zv:()=>E,ai:()=>O,ch:()=>A,fO:()=>o,gF:()=>a,hQ:()=>b,kB:()=>$,kM:()=>n,l7:()=>v,nd:()=>S,p0:()=>u,p6:()=>x,r0:()=>y,uR:()=>c,uX:()=>m,ug:()=>f,w$:()=>I,zM:()=>P,zr:()=>g});let a=/^[cC][^\s-]{8,}$/,s=/^[0-9a-z]+$/,i=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,n=/^[0-9a-vA-V]{20}$/,o=/^[A-Za-z0-9]{27}$/,l=/^[a-zA-Z0-9_-]{21}$/,u=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,d=/^([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})$/,c=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)$/,p=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function h(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let m=/^(?:(?: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])$/,f=/^(([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})$/,g=/^((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])$/,v=/^(([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])$/,_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,y=/^[A-Za-z0-9_-]*$/,k=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,b=/^\+(?:[0-9]){6,14}[0-9]$/,w="(?:(?:\\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])))",x=RegExp(`^${w}$`);function T(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+)?)?`}function $(e){return RegExp(`^${T(e)}$`)}function I(e){let t=T({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let a=`${t}(?:${r.join("|")})`;return RegExp(`^${w}T(?:${a})$`)}let z=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},S=/^\d+$/,O=/^-?\d+(?:\.\d+)?/i,P=/true|false/i,A=/null/i,Z=/^[^A-Z]*$/,E=/^[^a-z]*$/},1080(e,t,r){r.d(t,{fd:()=>s,rs:()=>a}),Symbol("ZodOutput"),Symbol("ZodInput");class a{constructor(){this._map=new Map,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 Map,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)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}let s=new a},83605(e,t,r){r.d(t,{bl:()=>y,b0:()=>ef,Cn:()=>A,Ko:()=>T,h8:()=>C,I:()=>q,$p:()=>D,rv:()=>ei,VF:()=>eo,Py:()=>_,x8:()=>F,L8:()=>W,qG:()=>f,VO:()=>ee,vz:()=>j,VY:()=>g,cG:()=>v,Dq:()=>E,LJ:()=>B,qc:()=>es,Sb:()=>eh,EY:()=>p,N$:()=>el,$v:()=>c,$N:()=>z,P0:()=>Q,Oy:()=>N,Zy:()=>O,Um:()=>H,sF:()=>M,v1:()=>$,W4:()=>d,Zn:()=>m,t$:()=>ed,GY:()=>x,nu:()=>et,g5:()=>b,Ax:()=>I,CI:()=>P,Zc:()=>h,h:()=>X,cu:()=>K,GP:()=>L,Lc:()=>S,Wc:()=>er,TF:()=>w,ig:()=>ea,_m:()=>ec,CQ:()=>R,Zu:()=>k});var a=r(45830),s=r(98824);class i{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"))}}var n=r(7432),o=r(72512),l=r(18399);let u={major:4,minor:0,patch:0},d=s.xI("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=u;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=l.QH(e);for(let n of t){if(n._zod.def.when){if(!n._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,o=n._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new s.GT;if(a||o instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(i||(i=l.QH(e,t)))});else{if(e.issues.length===t)continue;i||(i=l.QH(e,t))}}return a?a.then(()=>e):e};e._zod.run=(r,i)=>{let n=e._zod.parse(r,i);if(n instanceof Promise){if(!1===i.async)throw new s.GT;return n.then(e=>t(e,a,i))}return t(n,a,i)}}e["~standard"]={validate:t=>{try{let r=(0,n.xL)(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return(0,n.bp)(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),c=s.xI("$ZodString",(e,t)=>{d.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??o.Yj(e._zod.bag),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}}),p=s.xI("$ZodStringFormat",(e,t)=>{a.ql.init(e,t),c.init(e,t)}),h=s.xI("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=o.Os),p.init(e,t)}),m=s.xI("$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=o.uR(e))}else t.pattern??(t.pattern=o.uR());p.init(e,t)}),f=s.xI("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=o.Rp),p.init(e,t)}),g=s.xI("$ZodURL",(e,t)=>{p.init(e,t),e._zod.check=r=>{try{let a=r.value,s=new URL(a),i=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:o.OI.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!a.endsWith("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),v=s.xI("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=o.Zg()),p.init(e,t)}),_=s.xI("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=o.Ak),p.init(e,t)}),y=s.xI("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=o.gF),p.init(e,t)}),k=s.xI("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=o.Gl),p.init(e,t)}),b=s.xI("$ZodULID",(e,t)=>{t.pattern??(t.pattern=o.Z0),p.init(e,t)}),w=s.xI("$ZodXID",(e,t)=>{t.pattern??(t.pattern=o.kM),p.init(e,t)}),x=s.xI("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=o.fO),p.init(e,t)}),T=s.xI("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=o.w$(t)),p.init(e,t)}),$=s.xI("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=o.p6),p.init(e,t)}),I=s.xI("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=o.kB(t)),p.init(e,t)}),z=s.xI("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=o.p0),p.init(e,t)}),S=s.xI("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=o.uX),p.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),O=s.xI("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=o.ug),p.init(e,t),e._zod.onattach.push(e=>{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})}}}),P=s.xI("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=o.zr),p.init(e,t)}),A=s.xI("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=o.l7),p.init(e,t),e._zod.check=r=>{let[a,s]=r.value.split("/");try{if(!s)throw Error();let e=Number(s);if(`${e}`!==s||e<0||e>128)throw Error();new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Z(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let E=s.xI("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=o.K3),p.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Z(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),R=s.xI("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=o.r0),p.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{!function(e){if(!o.r0.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Z(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})}}),N=s.xI("$ZodE164",(e,t)=>{t.pattern??(t.pattern=o.hQ),p.init(e,t)}),C=s.xI("$ZodJWT",(e,t)=>{p.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 s=JSON.parse(atob(a));if("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.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})}}),j=s.xI("$ZodNumber",(e,t)=>{d.init(e,t),e._zod.pattern=e._zod.bag.pattern??o.ai,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let s=r.value;if("number"==typeof s&&!Number.isNaN(s)&&Number.isFinite(s))return r;let i="number"==typeof s?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...i?{received:i}:{}}),r}}),q=s.xI("$ZodNumber",(e,t)=>{a.KH.init(e,t),j.init(e,t)}),M=s.xI("$ZodBoolean",(e,t)=>{d.init(e,t),e._zod.pattern=o.zM,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let s=r.value;return"boolean"==typeof s||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),F=s.xI("$ZodNull",(e,t)=>{d.init(e,t),e._zod.pattern=o.ch,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}}),L=s.xI("$ZodUnknown",(e,t)=>{d.init(e,t),e._zod.parse=e=>e}),H=s.xI("$ZodNever",(e,t)=>{d.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function U(e,t,r){e.issues.length&&t.issues.push(...l.lQ(r,e.issues)),t.value[r]=e.value}let D=s.xI("$ZodArray",(e,t)=>{d.init(e,t),e._zod.parse=(r,a)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let i=[];for(let e=0;e<s.length;e++){let n=s[e],o=t.element._zod.run({value:n,issues:[]},a);o instanceof Promise?i.push(o.then(t=>U(t,r,e))):U(o,r,e)}return i.length?Promise.all(i).then(()=>r):r}});function V(e,t,r){e.issues.length&&t.issues.push(...l.lQ(r,e.issues)),t.value[r]=e.value}function J(e,t,r,a){e.issues.length?void 0===a[r]?r in a?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...l.lQ(r,e.issues)):void 0===e.value?r in a&&(t.value[r]=void 0):t.value[r]=e.value}let W=s.xI("$ZodObject",(e,t)=>{let r,a;d.init(e,t);let n=l.PO(()=>{let e=Object.keys(t.shape);for(let r of e)if(!(t.shape[r]instanceof d))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=l.NM(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}});l.gJ(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 o=l.Gv,u=!s.cr.jitless,c=l.hI,p=u&&c.value,h=t.catchall;e._zod.parse=(s,d)=>{a??(a=n.value);let c=s.value;if(!o(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),s;let m=[];if(u&&p&&d?.async===!1&&!0!==d.jitless)r||(r=(e=>{let t=new i(["shape","payload","ctx"]),r=n.value,a=e=>{let t=l.UQ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let s=Object.create(null),o=0;for(let e of r.keys)s[e]=`key_${o++}`;for(let e of(t.write("const newResult = {}"),r.keys))if(r.optionalKeys.has(e)){let r=s[e];t.write(`const ${r} = ${a(e)};`);let i=l.UQ(e);t.write(`
8
8
  if (${r}.issues.length) {
9
9
  if (input[${i}] === undefined) {
10
10
  if (${i} in input) {
@@ -27,4 +27,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
27
27
  if (${r}.issues.length) payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
28
28
  ...iss,
29
29
  path: iss.path ? [${l.UQ(e)}, ...iss.path] : [${l.UQ(e)}]
30
- })));`),t.write(`newResult[${l.UQ(e)}] = ${r}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");let u=t.compile();return(t,r)=>u(e,t,r)})(t.shape)),s=r(s,d);else{s.value={};let e=a.shape;for(let t of a.keys){let r=e[t],a=r._zod.run({value:c[t],issues:[]},d),i="optional"===r._zod.optin&&"optional"===r._zod.optout;a instanceof Promise?f.push(a.then(e=>i?J(e,s,t,c):V(e,s,t))):i?J(a,s,t,c):V(a,s,t)}}if(!h)return f.length?Promise.all(f).then(()=>s):s;let m=[],g=a.keySet,v=h._zod,_=v.def.type;for(let e of Object.keys(c)){if(g.has(e))continue;if("never"===_){m.push(e);continue}let t=v.run({value:c[e],issues:[]},d);t instanceof Promise?f.push(t.then(t=>V(t,s,e))):V(t,s,e)}return(m.length&&s.issues.push({code:"unrecognized_keys",keys:m,input:c,inst:e}),f.length)?Promise.all(f).then(()=>s):s}});function Y(e,t,r,a){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>l.iR(e,a,s.$W())))}),t}let K=s.xI("$ZodUnion",(e,t)=>{d.init(e,t),l.gJ(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),l.gJ(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),l.gJ(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),l.gJ(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=>l.p6(e.source)).join("|")})$`)}}),e._zod.parse=(r,a)=>{let s=!1,i=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},a);if(t instanceof Promise)i.push(t),s=!0;else{if(0===t.issues.length)return t;i.push(t)}}return s?Promise.all(i).then(t=>Y(t,r,e,a)):Y(i,r,e,a)}}),Q=s.xI("$ZodDiscriminatedUnion",(e,t)=>{K.init(e,t);let r=e._zod.parse;l.gJ(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=l.PO(()=>{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=(s,i)=>{let n=s.value;if(!l.Gv(n))return s.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),s;let o=a.value.get(n?.[t.discriminator]);return o?o._zod.run(s,i):t.unionFallback?r(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:n,path:[t.discriminator],inst:e}),s)}}),B=s.xI("$ZodIntersection",(e,t)=>{d.init(e,t),e._zod.parse=(e,r)=>{let a=e.value,s=t.left._zod.run({value:a,issues:[]},r),i=t.right._zod.run({value:a,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([t,r])=>G(e,t,r)):G(e,s,i)}});function G(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),l.QH(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(l.Qd(t)&&l.Qd(r)){let a=Object.keys(r),s=Object.keys(t).filter(e=>-1!==a.indexOf(e)),i={...t,...r};for(let a of s){let s=e(t[a],r[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};i[a]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let s=0;s<t.length;s++){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a.push(i.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 X=s.xI("$ZodRecord",(e,t)=>{d.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!l.Qd(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let n=[];if(t.keyType._zod.values){let s,o=t.keyType._zod.values;for(let e of(r.value={},o))if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){let s=t.valueType._zod.run({value:i[e],issues:[]},a);s instanceof Promise?n.push(s.then(t=>{t.issues.length&&r.issues.push(...l.lQ(e,t.issues)),r.value[e]=t.value})):(s.issues.length&&r.issues.push(...l.lQ(e,s.issues)),r.value[e]=s.value)}for(let e in i)o.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o)continue;let u=t.keyType._zod.run({value:o,issues:[]},a);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(e=>l.iR(e,a,s.$W())),input:o,path:[o],inst:e}),r.value[u.value]=u.value;continue}let d=t.valueType._zod.run({value:i[o],issues:[]},a);d instanceof Promise?n.push(d.then(e=>{e.issues.length&&r.issues.push(...l.lQ(o,e.issues)),r.value[u.value]=e.value})):(d.issues.length&&r.issues.push(...l.lQ(o,d.issues)),r.value[u.value]=d.value)}return n.length?Promise.all(n).then(()=>r):r}}),ee=s.xI("$ZodEnum",(e,t)=>{d.init(e,t);let r=l.w5(t.entries);e._zod.values=new Set(r),e._zod.pattern=RegExp(`^(${r.filter(e=>l.qQ.has(typeof e)).map(e=>"string"==typeof e?l.$f(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{let s=t.value;return e._zod.values.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),et=s.xI("$ZodLiteral",(e,t)=>{d.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?l.$f(e):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(r,a)=>{let s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),er=s.xI("$ZodTransform",(e,t)=>{d.init(e,t),e._zod.parse=(e,r)=>{let a=t.transform(e.value,e);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(t=>(e.value=t,e));if(a instanceof Promise)throw new s.GT;return e.value=a,e}}),ea=s.xI("$ZodOptional",(e,t)=>{d.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l.gJ(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),l.gJ(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l.p6(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>"optional"===t.innerType._zod.optin?t.innerType._zod.run(e,r):void 0===e.value?e:t.innerType._zod.run(e,r)}),es=s.xI("$ZodNullable",(e,t)=>{d.init(e,t),l.gJ(e._zod,"optin",()=>t.innerType._zod.optin),l.gJ(e._zod,"optout",()=>t.innerType._zod.optout),l.gJ(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l.p6(e.source)}|null)$`):void 0}),l.gJ(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)}),ei=s.xI("$ZodDefault",(e,t)=>{d.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(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=>en(e,t)):en(a,t)}});function en(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let eo=s.xI("$ZodPrefault",(e,t)=>{d.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),el=s.xI("$ZodNonOptional",(e,t)=>{d.init(e,t),l.gJ(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 s=t.innerType._zod.run(r,a);return s instanceof Promise?s.then(t=>eu(t,e)):eu(s,e)}});function eu(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 ed=s.xI("$ZodCatch",(e,t)=>{d.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"optout",()=>t.innerType._zod.optout),l.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(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=>l.iR(e,r,s.$W()))},input:e.value}),e.issues=[]),e)):(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>l.iR(e,r,s.$W()))},input:e.value}),e.issues=[]),e)}}),ec=s.xI("$ZodPipe",(e,t)=>{d.init(e,t),l.gJ(e._zod,"values",()=>t.in._zod.values),l.gJ(e._zod,"optin",()=>t.in._zod.optin),l.gJ(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(e,r)=>{let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>ep(e,t,r)):ep(a,t,r)}});function ep(e,t,r){return l.QH(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}let eh=s.xI("$ZodReadonly",(e,t)=>{d.init(e,t),l.gJ(e._zod,"propValues",()=>t.innerType._zod.propValues),l.gJ(e._zod,"values",()=>t.innerType._zod.values),l.gJ(e._zod,"optin",()=>t.innerType._zod.optin),l.gJ(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(ef):ef(a)}});function ef(e){return e.value=Object.freeze(e.value),e}let em=s.xI("$ZodCustom",(e,t)=>{a.QP.init(e,t),d.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let a=r.value,s=t.fn(a);if(s instanceof Promise)return s.then(t=>eg(t,r,a,e));eg(s,r,a,e)}});function eg(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(l.sn(e))}}},18399(e,t,r){function a(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 s(e,t){return"bigint"==typeof t?t.toString():t}function i(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function n(e){return null==e}function o(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function l(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}function u(e,t,r){Object.defineProperty(e,t,{get(){{let a=r();return e[t]=a,a}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function d(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function c(e){return JSON.stringify(e)}r.d(t,{$f:()=>v,A2:()=>y,Gv:()=>h,LG:()=>l,NM:()=>k,OH:()=>I,PO:()=>i,QH:()=>S,Qd:()=>m,Rc:()=>Z,UQ:()=>c,Up:()=>w,Vy:()=>d,X$:()=>T,cJ:()=>x,cl:()=>n,gJ:()=>u,gx:()=>p,h1:()=>$,hI:()=>f,iR:()=>A,k8:()=>s,lQ:()=>O,mw:()=>z,o8:()=>_,p6:()=>o,qQ:()=>g,sn:()=>E,w5:()=>a,zH:()=>b});let p=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function h(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let f=i(()=>{if("u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function m(e){if(!1===h(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!1!==h(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}let g=new Set(["string","number","symbol"]);function v(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function y(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 k(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let b={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 w(e,t){let r={},a=e._zod.def;for(let e in t){if(!(e in a.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(r[e]=a.shape[e])}return _(e,{...e._zod.def,shape:r,checks:[]})}function x(e,t){let r={...e._zod.def.shape},a=e._zod.def;for(let e in t){if(!(e in a.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return _(e,{...e._zod.def,shape:r,checks:[]})}function T(e,t){if(!m(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return d(this,"shape",r),r},checks:[]};return _(e,r)}function $(e,t){return _(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return d(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function I(e,t,r){let a=t._zod.def.shape,s={...a};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=e?new e({type:"optional",innerType:a[t]}):a[t])}else for(let t in a)s[t]=e?new e({type:"optional",innerType:a[t]}):a[t];return _(t,{...t._zod.def,shape:s,checks:[]})}function z(e,t,r){let a=t._zod.def.shape,s={...a};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=new e({type:"nonoptional",innerType:a[t]}))}else for(let t in a)s[t]=new e({type:"nonoptional",innerType:a[t]});return _(t,{...t._zod.def,shape:s,checks:[]})}function S(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function O(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function P(e){return"string"==typeof e?e:e?.message}function A(e,t,r){let a={...e,path:e.path??[]};return e.message||(a.message=P(e.inst?._zod.def?.error?.(e))??P(t?.error?.(e))??P(r.customError?.(e))??P(r.localeError?.(e))??"Invalid input"),delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function Z(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function E(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}}};
30
+ })));`),t.write(`newResult[${l.UQ(e)}] = ${r}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");let u=t.compile();return(t,r)=>u(e,t,r)})(t.shape)),s=r(s,d);else{s.value={};let e=a.shape;for(let t of a.keys){let r=e[t],a=r._zod.run({value:c[t],issues:[]},d),i="optional"===r._zod.optin&&"optional"===r._zod.optout;a instanceof Promise?m.push(a.then(e=>i?J(e,s,t,c):V(e,s,t))):i?J(a,s,t,c):V(a,s,t)}}if(!h)return m.length?Promise.all(m).then(()=>s):s;let f=[],g=a.keySet,v=h._zod,_=v.def.type;for(let e of Object.keys(c)){if(g.has(e))continue;if("never"===_){f.push(e);continue}let t=v.run({value:c[e],issues:[]},d);t instanceof Promise?m.push(t.then(t=>V(t,s,e))):V(t,s,e)}return(f.length&&s.issues.push({code:"unrecognized_keys",keys:f,input:c,inst:e}),m.length)?Promise.all(m).then(()=>s):s}});function Y(e,t,r,a){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>l.iR(e,a,s.$W())))}),t}let K=s.xI("$ZodUnion",(e,t)=>{d.init(e,t),l.gJ(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),l.gJ(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),l.gJ(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),l.gJ(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=>l.p6(e.source)).join("|")})$`)}}),e._zod.parse=(r,a)=>{let s=!1,i=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},a);if(t instanceof Promise)i.push(t),s=!0;else{if(0===t.issues.length)return t;i.push(t)}}return s?Promise.all(i).then(t=>Y(t,r,e,a)):Y(i,r,e,a)}}),Q=s.xI("$ZodDiscriminatedUnion",(e,t)=>{K.init(e,t);let r=e._zod.parse;l.gJ(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=l.PO(()=>{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=(s,i)=>{let n=s.value;if(!l.Gv(n))return s.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),s;let o=a.value.get(n?.[t.discriminator]);return o?o._zod.run(s,i):t.unionFallback?r(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:n,path:[t.discriminator],inst:e}),s)}}),B=s.xI("$ZodIntersection",(e,t)=>{d.init(e,t),e._zod.parse=(e,r)=>{let a=e.value,s=t.left._zod.run({value:a,issues:[]},r),i=t.right._zod.run({value:a,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([t,r])=>G(e,t,r)):G(e,s,i)}});function G(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),l.QH(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(l.Qd(t)&&l.Qd(r)){let a=Object.keys(r),s=Object.keys(t).filter(e=>-1!==a.indexOf(e)),i={...t,...r};for(let a of s){let s=e(t[a],r[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};i[a]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let s=0;s<t.length;s++){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a.push(i.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 X=s.xI("$ZodRecord",(e,t)=>{d.init(e,t),e._zod.parse=(r,a)=>{let i=r.value;if(!l.Qd(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let n=[];if(t.keyType._zod.values){let s,o=t.keyType._zod.values;for(let e of(r.value={},o))if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){let s=t.valueType._zod.run({value:i[e],issues:[]},a);s instanceof Promise?n.push(s.then(t=>{t.issues.length&&r.issues.push(...l.lQ(e,t.issues)),r.value[e]=t.value})):(s.issues.length&&r.issues.push(...l.lQ(e,s.issues)),r.value[e]=s.value)}for(let e in i)o.has(e)||(s=s??[]).push(e);s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:s})}else for(let o of(r.value={},Reflect.ownKeys(i))){if("__proto__"===o)continue;let u=t.keyType._zod.run({value:o,issues:[]},a);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(e=>l.iR(e,a,s.$W())),input:o,path:[o],inst:e}),r.value[u.value]=u.value;continue}let d=t.valueType._zod.run({value:i[o],issues:[]},a);d instanceof Promise?n.push(d.then(e=>{e.issues.length&&r.issues.push(...l.lQ(o,e.issues)),r.value[u.value]=e.value})):(d.issues.length&&r.issues.push(...l.lQ(o,d.issues)),r.value[u.value]=d.value)}return n.length?Promise.all(n).then(()=>r):r}}),ee=s.xI("$ZodEnum",(e,t)=>{d.init(e,t);let r=l.w5(t.entries);e._zod.values=new Set(r),e._zod.pattern=RegExp(`^(${r.filter(e=>l.qQ.has(typeof e)).map(e=>"string"==typeof e?l.$f(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{let s=t.value;return e._zod.values.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),et=s.xI("$ZodLiteral",(e,t)=>{d.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?l.$f(e):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(r,a)=>{let s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),er=s.xI("$ZodTransform",(e,t)=>{d.init(e,t),e._zod.parse=(e,r)=>{let a=t.transform(e.value,e);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(t=>(e.value=t,e));if(a instanceof Promise)throw new s.GT;return e.value=a,e}}),ea=s.xI("$ZodOptional",(e,t)=>{d.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l.gJ(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),l.gJ(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l.p6(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>"optional"===t.innerType._zod.optin?t.innerType._zod.run(e,r):void 0===e.value?e:t.innerType._zod.run(e,r)}),es=s.xI("$ZodNullable",(e,t)=>{d.init(e,t),l.gJ(e._zod,"optin",()=>t.innerType._zod.optin),l.gJ(e._zod,"optout",()=>t.innerType._zod.optout),l.gJ(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${l.p6(e.source)}|null)$`):void 0}),l.gJ(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)}),ei=s.xI("$ZodDefault",(e,t)=>{d.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(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=>en(e,t)):en(a,t)}});function en(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let eo=s.xI("$ZodPrefault",(e,t)=>{d.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),el=s.xI("$ZodNonOptional",(e,t)=>{d.init(e,t),l.gJ(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 s=t.innerType._zod.run(r,a);return s instanceof Promise?s.then(t=>eu(t,e)):eu(s,e)}});function eu(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 ed=s.xI("$ZodCatch",(e,t)=>{d.init(e,t),e._zod.optin="optional",l.gJ(e._zod,"optout",()=>t.innerType._zod.optout),l.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(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=>l.iR(e,r,s.$W()))},input:e.value}),e.issues=[]),e)):(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>l.iR(e,r,s.$W()))},input:e.value}),e.issues=[]),e)}}),ec=s.xI("$ZodPipe",(e,t)=>{d.init(e,t),l.gJ(e._zod,"values",()=>t.in._zod.values),l.gJ(e._zod,"optin",()=>t.in._zod.optin),l.gJ(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(e,r)=>{let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>ep(e,t,r)):ep(a,t,r)}});function ep(e,t,r){return l.QH(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}let eh=s.xI("$ZodReadonly",(e,t)=>{d.init(e,t),l.gJ(e._zod,"propValues",()=>t.innerType._zod.propValues),l.gJ(e._zod,"values",()=>t.innerType._zod.values),l.gJ(e._zod,"optin",()=>t.innerType._zod.optin),l.gJ(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(em):em(a)}});function em(e){return e.value=Object.freeze(e.value),e}let ef=s.xI("$ZodCustom",(e,t)=>{a.QP.init(e,t),d.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let a=r.value,s=t.fn(a);if(s instanceof Promise)return s.then(t=>eg(t,r,a,e));eg(s,r,a,e)}});function eg(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(l.sn(e))}}},18399(e,t,r){function a(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 s(e,t){return"bigint"==typeof t?t.toString():t}function i(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function n(e){return null==e}function o(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function l(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}function u(e,t,r){Object.defineProperty(e,t,{get(){{let a=r();return e[t]=a,a}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function d(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function c(e){return JSON.stringify(e)}r.d(t,{$f:()=>v,A2:()=>y,Gv:()=>h,LG:()=>l,NM:()=>k,OH:()=>I,PO:()=>i,QH:()=>S,Qd:()=>f,Rc:()=>Z,UQ:()=>c,Up:()=>w,Vy:()=>d,X$:()=>T,cJ:()=>x,cl:()=>n,gJ:()=>u,gx:()=>p,h1:()=>$,hI:()=>m,iR:()=>A,k8:()=>s,lQ:()=>O,mw:()=>z,o8:()=>_,p6:()=>o,qQ:()=>g,sn:()=>E,w5:()=>a,zH:()=>b});let p=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function h(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let m=i(()=>{if("u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function f(e){if(!1===h(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!1!==h(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}let g=new Set(["string","number","symbol"]);function v(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function y(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 k(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let b={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 w(e,t){let r={},a=e._zod.def;for(let e in t){if(!(e in a.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(r[e]=a.shape[e])}return _(e,{...e._zod.def,shape:r,checks:[]})}function x(e,t){let r={...e._zod.def.shape},a=e._zod.def;for(let e in t){if(!(e in a.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return _(e,{...e._zod.def,shape:r,checks:[]})}function T(e,t){if(!f(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return d(this,"shape",r),r},checks:[]};return _(e,r)}function $(e,t){return _(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return d(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function I(e,t,r){let a=t._zod.def.shape,s={...a};if(r)for(let t in r){if(!(t in a))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=e?new e({type:"optional",innerType:a[t]}):a[t])}else for(let t in a)s[t]=e?new e({type:"optional",innerType:a[t]}):a[t];return _(t,{...t._zod.def,shape:s,checks:[]})}function z(e,t,r){let a=t._zod.def.shape,s={...a};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=new e({type:"nonoptional",innerType:a[t]}))}else for(let t in a)s[t]=new e({type:"nonoptional",innerType:a[t]});return _(t,{...t._zod.def,shape:s,checks:[]})}function S(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function O(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function P(e){return"string"==typeof e?e:e?.message}function A(e,t,r){let a={...e,path:e.path??[]};return e.message||(a.message=P(e.inst?._zod.def?.error?.(e))??P(t?.error?.(e))??P(r.customError?.(e))??P(r.localeError?.(e))??"Invalid input"),delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function Z(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function E(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}}};