xmcp 0.6.5 → 0.6.7

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 (78) hide show
  1. package/README.md +32 -0
  2. package/dist/cli.js +58 -40
  3. package/dist/compiler/config/index.d.ts +106 -47
  4. package/dist/compiler/config/schemas/template.d.ts +40 -0
  5. package/dist/compiler/config/schemas/transport/http.d.ts +82 -82
  6. package/dist/compiler/config/schemas/transport/stdio.d.ts +5 -0
  7. package/dist/index.d.ts +4 -2
  8. package/dist/index.js +5 -5
  9. package/dist/runtime/adapter-express.js +40 -23
  10. package/dist/runtime/adapter-nestjs.js +40 -23
  11. package/dist/runtime/adapter-nextjs.js +39 -22
  12. package/dist/runtime/contexts/http-request-context.d.ts +3 -1
  13. package/dist/runtime/headers.js +1 -1
  14. package/dist/runtime/http.js +48 -31
  15. package/dist/runtime/stdio.js +19 -13
  16. package/dist/runtime/utils/elicitation.d.ts +4 -0
  17. package/dist/runtime/utils/ext-apps-registry.d.ts +132 -0
  18. package/dist/runtime/utils/path-to-tool-name.d.ts +20 -0
  19. package/dist/runtime/utils/prompt-loader.d.ts +11 -0
  20. package/dist/runtime/utils/prompts.d.ts +8 -0
  21. package/dist/runtime/utils/react/generate-html.d.ts +1 -0
  22. package/dist/runtime/utils/react/index.d.ts +4 -0
  23. package/dist/runtime/utils/resource-loader.d.ts +11 -0
  24. package/dist/runtime/utils/resources.d.ts +4 -0
  25. package/dist/runtime/utils/server.d.ts +35 -0
  26. package/dist/runtime/utils/tool-loader.d.ts +11 -0
  27. package/dist/runtime/utils/tools.d.ts +11 -0
  28. package/dist/runtime/utils/transformers/prompt.d.ts +32 -0
  29. package/dist/runtime/utils/transformers/resource.d.ts +26 -0
  30. package/dist/runtime/utils/transformers/tool.d.ts +30 -0
  31. package/dist/runtime/utils/ui/flatten-meta.d.ts +6 -0
  32. package/dist/runtime/utils/ui/split-meta.d.ts +17 -0
  33. package/dist/runtime/utils/utils/resource-uri-composer.d.ts +60 -0
  34. package/dist/runtime/utils/validators/index.d.ts +13 -0
  35. package/dist/types/client-info.d.ts +12 -0
  36. package/dist/types/tool.d.ts +70 -14
  37. package/dist/utils/context.d.ts +1 -1
  38. package/package.json +9 -1
  39. package/src/client/index.ts +4 -1
  40. package/src/compiler/config/__tests__/config.test.ts +36 -0
  41. package/src/compiler/config/injection.ts +63 -1
  42. package/src/compiler/config/schemas/template.ts +17 -0
  43. package/src/compiler/config/schemas/transport/stdio.ts +1 -0
  44. package/src/compiler/generate-tools-code.ts +24 -6
  45. package/src/compiler/get-bundler-config/get-injected-variables.ts +3 -0
  46. package/src/compiler/get-bundler-config/plugins/index.ts +0 -1
  47. package/src/compiler/index.ts +123 -30
  48. package/src/compiler/start-http-server.ts +11 -4
  49. package/src/compiler/watcher-recovery.ts +72 -0
  50. package/src/index.ts +9 -1
  51. package/src/runtime/adapters/express/index.ts +45 -47
  52. package/src/runtime/adapters/nestjs/xmcp.service.ts +4 -3
  53. package/src/runtime/adapters/nextjs/handler/node-to-web-adapter.ts +40 -6
  54. package/src/runtime/adapters/nextjs/handler/request-converter.ts +20 -0
  55. package/src/runtime/adapters/nextjs/handler/server-lifecycle.ts +8 -5
  56. package/src/runtime/adapters/nextjs/index.ts +41 -25
  57. package/src/runtime/contexts/http-request-context.ts +2 -0
  58. package/src/runtime/headers.ts +37 -2
  59. package/src/runtime/platforms/cloudflare/cors.ts +0 -1
  60. package/src/runtime/platforms/cloudflare/worker.ts +46 -44
  61. package/src/runtime/transports/http/index.ts +0 -4
  62. package/src/runtime/transports/http/stateless-streamable-http.ts +131 -233
  63. package/src/runtime/transports/stdio/index.ts +18 -1
  64. package/src/runtime/utils/__tests__/client-info.test.ts +80 -0
  65. package/src/runtime/utils/__tests__/tool-extra.test.ts +110 -0
  66. package/src/runtime/utils/client-info.ts +71 -0
  67. package/src/runtime/utils/elicitation.ts +396 -0
  68. package/src/runtime/utils/prompt-loader.ts +151 -0
  69. package/src/runtime/utils/resource-loader.ts +151 -0
  70. package/src/runtime/utils/resources.ts +0 -8
  71. package/src/runtime/utils/server.ts +30 -42
  72. package/src/runtime/utils/tool-loader.ts +149 -0
  73. package/src/runtime/utils/tools.ts +31 -9
  74. package/src/runtime/utils/transformers/tool.ts +149 -10
  75. package/src/types/client-info.ts +12 -0
  76. package/src/types/injected.d.ts +62 -0
  77. package/src/types/tool.ts +100 -17
  78. package/src/utils/context.ts +2 -2
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,()=>(()=>{var e,t,r={2058(e,t){"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(a,n),time:r(l(!0),u),"date-time":r(p(!0),f),"iso-time":r(l(),c),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&y.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return g.lastIndex=0,g.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let s=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){var t;let r=s.exec(e);if(!r)return!1;let a=+r[1],n=+r[2],o=+r[3];return n>=1&&n<=12&&o>=1&&o<=(2===n&&(t=a)%4==0&&(t%100!=0||t%400==0)?29:i[n])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(e){return function(t){let r=o.exec(t);if(!r)return!1;let s=+r[1],i=+r[2],a=+r[3],n=r[4],l="-"===r[5]?-1:1,u=+(r[6]||0),c=+(r[7]||0);if(u>23||c>59||e&&!n)return!1;if(s<=23&&i<=59&&a<60)return!0;let d=i-c*l,p=s-u*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&a<61}}function u(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),s=new Date("2020-01-01T"+t).valueOf();if(r&&s)return r-s}function c(e,t){if(!(e&&t))return;let r=o.exec(e),s=o.exec(t);if(r&&s)return(e=r[1]+r[2]+r[3])>(t=s[1]+s[2]+s[3])?1:e<t?-1:0}let d=/t|\s/i;function p(e){let t=l(e);return function(e){let r=e.split(d);return 2===r.length&&a(r[0])&&t(r[1])}}function f(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),s=new Date(t).valueOf();if(r&&s)return r-s}function h(e,t){if(!(e&&t))return;let[r,s]=e.split(d),[i,a]=t.split(d),o=n(r,i);if(void 0!==o)return o||u(s,a)}let m=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let w=/[^\\]\\Z/},494(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(2058),i=r(7122),a=r(6556),n=new a.Name("fullFormats"),o=new a.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,s.fullFormats,n),e;let[r,a]="fast"===t.mode?[s.fastFormats,o]:[s.fullFormats,n];return u(e,t.formats||s.formatNames,r,a),t.keywords&&(0,i.default)(e),e};function u(e,t,r,s){var i;for(let n of(null!=(i=e.opts.code).formats||(i.formats=(0,a._)`require("ajv-formats/dist/formats").${s}`),t))e.addFormat(n,r[n])}l.get=(e,t="full")=>{let r=("fast"===t?s.fastFormats:s.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r},e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l},7122(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let s=r(4319),i=r(6556),a=i.operators,n={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,i.str)`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,i._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:a,data:o,schemaCode:l,keyword:u,it:c}=e,{opts:d,self:p}=c;if(!d.validateFormats)return;let f=new s.KeywordCxt(c,p.RULES.all.format.definition,"format");function h(e){return(0,i._)`${e}.compare(${o}, ${l}) ${n[u].fail} 0`}f.$data?(t=a.scopeValue("formats",{ref:p.formats,code:d.code.formats}),r=a.const("fmt",(0,i._)`${t}[${f.schemaCode}]`),e.fail$data((0,i.or)((0,i._)`typeof ${r} != "object"`,(0,i._)`${r} instanceof RegExp`,(0,i._)`typeof ${r}.compare != "function"`,h(r)))):function(){let t=f.schema,r=p.formats[t];if(!r||!0===r)return;if("object"!=typeof r||r instanceof RegExp||"function"!=typeof r.compare)throw Error(`"${u}": format "${t}" does not define "compare" function`);let s=a.scopeValue("formats",{key:t,ref:r,code:d.code.formats?(0,i._)`${d.code.formats}${(0,i.getProperty)(t)}`:void 0});e.fail$data(h(s))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},4319(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let s=r(7285),i=r(8181),a=r(2278),n=r(7578),o=["/properties"],l="http://json-schema.org/draft-07/schema";class u extends s.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var c=r(6889);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=r(6556);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=r(9645);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=r(218);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})},1175(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=s;class i extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof s&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function a(e,...t){let r=[e[0]],s=0;for(;s<t.length;)l(r,t[s]),r.push(e[++s]);return new i(r)}t._Code=i,t.nil=new i(""),t._=a;let n=new i("+");function o(e,...t){let r=[u(e[0])],a=0;for(;a<t.length;)r.push(n),l(r,t[a]),r.push(n,u(e[++a]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var r,i;let a=(r=e[t-1],'""'===(i=e[t+1])?r:'""'===r?i:"string"==typeof r?i instanceof s||'"'!==r[r.length-1]?void 0:"string"!=typeof i?`${r.slice(0,-1)}${i}"`:'"'===i[0]?r.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||r instanceof s?void 0:`"${r}${i.slice(1)}`);if(void 0!==a){e.splice(t-1,3,a);continue}e[t++]="+"}t++}}(r),new i(r)}function l(e,t){var r;t instanceof i?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:u(Array.isArray(r)?r.join(","):r))}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=o,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},t.stringify=function(e){return new i(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):a`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},6556(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let s=r(1175),i=r(7100);var a=r(1175);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}});var n=r(7100);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends o{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?i.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class u extends o{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,t),this}get names(){return O(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class c extends u{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class f extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class m extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,s=r.length;for(;s--;){let i=r[s];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>I(e,t.names),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class g extends m{}class v extends y{}v.kind="else";class _ extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(R(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&I(e,this.else.names),e}}_.kind="if";class b extends y{}b.kind="for";class w extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return I(super.names,this.iteration.names)}}class $ extends b{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){let t=e.es5?i.varKinds.var:this.varKind,{name:r,from:s,to:a}=this;return`for(${t} ${r}=${s}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=O(super.names,this.from);return O(e,this.to)}}class k extends b{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return I(super.names,this.iterable.names)}}class E extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}E.kind="func";class x extends m{render(e){return"return "+super.render(e)}}x.kind="return";class S extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(s=this.finally)||s.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&I(e,this.catch.names),this.finally&&I(e,this.finally.names),e}}class T extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}T.kind="catch";class P extends y{render(e){return"finally"+super.render(e)}}function I(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function O(e,t){return t instanceof s._CodeOrName?I(e,t.names):e}function j(e,t,r){var i;if(e instanceof s.Name)return a(e);if(!((i=e)instanceof s._Code&&i._items.some(e=>e instanceof s.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new s._Code(e._items.reduce((e,t)=>(t instanceof s.Name&&(t=a(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e),[]));function a(e){let s=r[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,s._)`!${z(e)}`}P.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){let i=this._scope.toName(t);return void 0!==r&&s&&(this._constants[i.str]=r),this._leafNode(new l(e,i,r)),i}const(e,t,r){return this._def(i.varKinds.const,e,t,r)}let(e,t,r){return this._def(i.varKinds.let,e,t,r)}var(e,t,r){return this._def(i.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new c(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new h(e)),this}object(...e){let t=["{"];for(let[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,i));return t.push("}"),new s._Code(t)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(_,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,s,a=this.opts.es5?i.varKinds.var:i.varKinds.let){let n=this._scope.toName(e);return this._for(new $(a,n,t,r),()=>s(n))}forOf(e,t,r,a=i.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,s._)`${e}.length`,t=>{this.var(n,(0,s._)`${e}[${t}]`),r(n)})}return this._for(new k("of",a,n,t),()=>r(n))}forIn(e,t,r,a=this.opts.es5?i.varKinds.var:i.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,s._)`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new k("in",a,n,t),()=>r(n))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new p(e))}return(e){let t=new x;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(x)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let s=new S;if(this._blockNode(s),this.code(e),t){let e=this.name("e");this._currNode=s.catch=new T(e),t(e)}return r&&(this._currNode=s.finally=new P,this.code(r)),this._endBlockNode(T,P)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,r,i){return this._blockNode(new E(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=R;let N=C(t.operators.AND);t.and=function(...e){return e.reduce(N)};let A=C(t.operators.OR);function C(e){return(t,r)=>t===s.nil?r:r===s.nil?t:(0,s._)`${z(t)} ${e} ${z(r)}`}function z(e){return e instanceof s.Name?e:(0,s._)`(${e})`}t.or=function(...e){return e.reduce(A)}},7100(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let a=r(1175);class n extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(i=s||(t.UsedValueState=s={}))[i.Started=0]="Started",i[i.Completed=1]="Completed",t.varKinds={const:new a.Name("const"),let:new a.Name("let"),var:new a.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof a.Name?e:this.name(e)}name(e){return new a.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class l extends a.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,a._)`.${new a.Name(t)}[${r}]`}}t.ValueScopeName=l;let u=(0,a._)`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?u:a.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:i}=s,a=null!=(r=t.key)?r:t.ref,n=this._values[i];if(n){let e=n.get(a);if(e)return e}else n=this._values[i]=new Map;n.set(a,s);let o=this._scope[i]||(this._scope[i]=[]),l=o.length;return o[l]=t.ref,s.setValue(t,{property:i,itemIndex:l}),s}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,a._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,i={},o){let l=a.nil;for(let u in e){let c=e[u];if(!c)continue;let d=i[u]=i[u]||new Map;c.forEach(e=>{if(d.has(e))return;d.set(e,s.Started);let i=r(e);if(i){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,a._)`${l}${r} ${e} = ${i};${this.opts._n}`}else if(i=null==o?void 0:o(e))l=(0,a._)`${l}${i}${this.opts._n}`;else throw new n(e);d.set(e,s.Completed)})}return l}}},7747(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let s=r(6556),i=r(8512),a=r(4614);function n(e,t){let r=e.const("err",t);e.if((0,s._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,s._)`[${r}]`),(0,s._)`${a.default.vErrors}.push(${r})`),e.code((0,s._)`${a.default.errors}++`)}function o(e,t){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,s._)`new ${e.ValidationError}(${t})`):(r.assign((0,s._)`${i}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>(0,s.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,s.str)`"${e}" keyword must be ${t} ($data)`:(0,s.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,i,a){let{it:l}=e,{gen:c,compositeRule:d,allErrors:p}=l,f=u(e,r,i);(null!=a?a:d||p)?n(c,f):o(l,(0,s._)`[${f}]`)},t.reportExtraError=function(e,r=t.keywordError,s){let{it:i}=e,{gen:l,compositeRule:c,allErrors:d}=i;n(l,u(e,r,s)),c||d||o(i,a.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(a.default.errors,t),e.if((0,s._)`${a.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,s._)`${a.default.vErrors}.length`,t),()=>e.assign(a.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(void 0===n)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",n,a.default.errors,n=>{e.const(l,(0,s._)`${a.default.vErrors}[${n}]`),e.if((0,s._)`${l}.instancePath === undefined`,()=>e.assign((0,s._)`${l}.instancePath`,(0,s.strConcat)(a.default.instancePath,o.errorPath))),e.assign((0,s._)`${l}.schemaPath`,(0,s.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,s._)`${l}.schema`,r),e.assign((0,s._)`${l}.data`,i))})};let l={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function u(e,t,r){let{createErrors:n}=e.it;return!1===n?(0,s._)`{}`:function(e,t,r={}){let{gen:n,it:o}=e,u=[function({errorPath:e},{instancePath:t}){let r=t?(0,s.str)`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[a.default.instancePath,(0,s.strConcat)(a.default.instancePath,r)]}(o,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:a}){let n=a?t:(0,s.str)`${t}/${e}`;return r&&(n=(0,s.str)`${n}${(0,i.getErrorPath)(r,i.Type.Str)}`),[l.schemaPath,n]}(e,r)];return function(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:u,it:c}=e,{opts:d,propertyName:p,topSchemaRef:f,schemaPath:h}=c;i.push([l.keyword,n],[l.params,"function"==typeof t?t(e):t||(0,s._)`{}`]),d.messages&&i.push([l.message,"function"==typeof r?r(e):r]),d.verbose&&i.push([l.schema,u],[l.parentSchema,(0,s._)`${f}${h}`],[a.default.data,o]),p&&i.push([l.propertyName,p])}(e,t,u),n.object(...u)}(e,t,r)}},9198(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let s=r(6556),i=r(9645),a=r(4614),n=r(234),o=r(8512),l=r(6889);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function c(e){let t,r,o=p.call(this,e);if(o)return o;let u=(0,n.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:f}=this.opts,h=new s.CodeGen(this.scope,{es5:c,lines:d,ownProperties:f});e.$async&&(t=h.scopeValue("Error",{ref:i.default,code:(0,s._)`require("ajv/dist/runtime/validation_error").default`}));let m=h.scopeName("validate");e.validateName=m;let y={gen:h,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:u,baseId:e.baseId||u,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,s._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(y),h.optimize(this.opts.code.optimize);let t=h.toString();r=`${h.scopeRefs(a.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let i=Function(`${a.default.self}`,`${a.default.scope}`,r)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:m,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:t}=y;i.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},i.source&&(i.source.evaluated=(0,s.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function d(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function p(e){for(let s of this._compilations){var t,r;if(t=s,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return s}}function f(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){let r=this.opts.uriResolver.parse(t),s=(0,n._getFullPath)(this.opts.uriResolver,r),i=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===i)return y.call(this,r,e);let a=(0,n.normalizeId)(s),o=this.refs[a]||this.schemas[a];if("string"==typeof o){let t=h.call(this,e,o);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||c.call(this,o),a===(0,n.normalizeId)(t)){let{schema:t}=o,{schemaId:r}=this.opts,s=t[r];return s&&(i=(0,n.resolveUrl)(this.opts.uriResolver,i,s)),new u({schema:t,schemaId:r,root:e,baseId:i})}return y.call(this,r,o)}}t.SchemaEnv=u,t.compileSchema=c,t.resolveRef=function(e,t,r){var s;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let a=f.call(this,e,r);if(void 0===a){let i=null==(s=e.localRefs)?void 0:s[r],{schemaId:n}=this.opts;i&&(a=new u({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==a)return e.refs[r]=d.call(this,a)},t.getCompilingSchema=p,t.resolveSchema=h;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:s}){var i;let a;if((null==(i=e.fragment)?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,o.unescapeFragment)(s)];if(void 0===e)return;let i="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(s)&&i&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,i))}if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){let e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);a=h.call(this,s,e)}let{schemaId:l}=this.opts;if((a=a||new u({schema:r,schemaId:l,root:s,baseId:t})).schema!==a.root.schema)return a}},4614(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556);t.default={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")}},218(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(234);t.default=class extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,r),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}},234(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let s=r(8512),i=r(7371),a=r(205),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(o.has(r))return!0;let s=t[r];if(Array.isArray(s)&&s.some(e)||"object"==typeof s&&e(s))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let i in t)if("$ref"===i||(r++,!n.has(i)&&("object"==typeof t[i]&&(0,s.eachItem)(t[i],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=d(t));let s=e.parse(t);return u(e,s)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=u;let c=/#\/?$/;function d(e){return e?e.replace(c,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};let p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:s}=this.opts,n=d(e[r]||t),o={"":n},u=l(s,n,!1),c={},f=new Set;return a(e,{allKeys:!0},(e,t,s,i)=>{if(void 0===i)return;let a=u+t,n=o[i];function l(t){let r=this.opts.uriResolver.resolve;if(t=d(n?r(n,t):t),f.has(t))throw m(t);f.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?h(e,s.schema,t):t!==d(a)&&("#"===t[0]?(h(e,c[t],t),c[t]=e):this.refs[t]=a),t}function y(e){if("string"==typeof e){if(!p.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(n=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),o[t]=n}),c;function h(e,t,r){if(void 0!==t&&!i(e,t))throw m(r)}function m(e){return Error(`reference "${e}" resolves to more than one schema`)}}},9881(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},8512(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let a=r(6556),n=r(1175);function o(e,t=e.schema){let{opts:r,self:s}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=s.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function l(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function u(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function d({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:s}){return(i,n,o,l)=>{let u=void 0===o?n:o instanceof a.Name?(n instanceof a.Name?e(i,n,o):t(i,n,o),o):n instanceof a.Name?(t(i,o,n),n):r(n,o);return l!==a.Name||u instanceof a.Name?u:s(i,u)}}function p(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,a._)`{}`);return void 0!==t&&f(e,r,t),r}function f(e,t,r){Object.keys(r).forEach(r=>e.assign((0,a._)`${t}${(0,a.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!l(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=l,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,s,i){if(!i){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,a._)`${r}`}return(0,a._)`${e}${t}${(0,a.getProperty)(s)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(u(e))},t.escapeJsonPointer=u,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:d({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,a._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,a._)`${r} || {}`).code((0,a._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,a._)`${r} || {}`),f(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:p}),items:d({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,a._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>e.assign(r,!0===t||(0,a._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=p,t.setEvaluated=f;let h={};function m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new n._Code(t.code))})},(i=s||(t.Type=s={}))[i.Num=0]="Num",i[i.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof a.Name){let i=t===s.Num;return r?i?(0,a._)`"[" + ${e} + "]"`:(0,a._)`"['" + ${e} + "']"`:i?(0,a._)`"/" + ${e}`:(0,a._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,a.getProperty)(e).toString():"/"+u(e)},t.checkStrictMode=m},4204(e,t){"use strict";function r(e,t){return t.rules.some(t=>s(e,t))}function s(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},s){let i=t.RULES.types[s];return i&&!0!==i&&r(e,i)},t.shouldUseGroup=r,t.shouldUseRule=s},2882(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let s=r(7747),i=r(6556),a=r(4614),n={message:"boolean schema is false"};function o(e,t){let{gen:r,data:i}=e;(0,s.reportError)({gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},n,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:s}=e;!1===r?o(e,!1):"object"==typeof r&&!0===r.$async?t.return(a.default.data):(t.assign((0,i._)`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:s}=e;!1===s?(r.var(t,!1),o(e)):r.var(t,!0)}},4029(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let a=r(9881),n=r(4204),o=r(7747),l=r(6556),u=r(8512);function c(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(i=s||(t.DataType=s={}))[i.Correct=0]="Correct",i[i.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){var r,i;let{gen:a,data:o,opts:u}=e,c=(r=t,(i=u.coerceTypes)?r.filter(e=>d.has(e)||"array"===i&&"array"===e):[]),p=t.length>0&&!(0===c.length&&1===t.length&&(0,n.schemaHasRulesForType)(e,t[0]));if(p){let r=f(t,o,u.strictNumbers,s.Wrong);a.if(r,()=>{c.length?function(e,t,r){let{gen:s,data:i,opts:a}=e,n=s.let("dataType",(0,l._)`typeof ${i}`),o=s.let("coerced",(0,l._)`undefined`);for(let e of("array"===a.coerceTypes&&s.if((0,l._)`${n} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>s.assign(i,(0,l._)`${i}[0]`).assign(n,(0,l._)`typeof ${i}`).if(f(t,i,a.strictNumbers),()=>s.assign(o,i))),s.if((0,l._)`${o} !== undefined`),r))(d.has(e)||"array"===e&&"array"===a.coerceTypes)&&function(e){switch(e){case"string":s.elseIf((0,l._)`${n} == "number" || ${n} == "boolean"`).assign(o,(0,l._)`"" + ${i}`).elseIf((0,l._)`${i} === null`).assign(o,(0,l._)`""`);return;case"number":s.elseIf((0,l._)`${n} == "boolean" || ${i} === null
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,()=>(()=>{var e,t,r={5888(e,t){"use strict";function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(a,n),time:r(l(!0),u),"date-time":r(p(!0),f),"iso-time":r(l(),c),"iso-date-time":r(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return m.test(e)&&y.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return g.lastIndex=0,g.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":r(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);let s=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){var t;let r=s.exec(e);if(!r)return!1;let a=+r[1],n=+r[2],o=+r[3];return n>=1&&n<=12&&o>=1&&o<=(2===n&&(t=a)%4==0&&(t%100!=0||t%400==0)?29:i[n])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(e){return function(t){let r=o.exec(t);if(!r)return!1;let s=+r[1],i=+r[2],a=+r[3],n=r[4],l="-"===r[5]?-1:1,u=+(r[6]||0),c=+(r[7]||0);if(u>23||c>59||e&&!n)return!1;if(s<=23&&i<=59&&a<60)return!0;let d=i-c*l,p=s-u*l-(d<0);return(23===p||-1===p)&&(59===d||-1===d)&&a<61}}function u(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),s=new Date("2020-01-01T"+t).valueOf();if(r&&s)return r-s}function c(e,t){if(!(e&&t))return;let r=o.exec(e),s=o.exec(t);if(r&&s)return(e=r[1]+r[2]+r[3])>(t=s[1]+s[2]+s[3])?1:e<t?-1:0}let d=/t|\s/i;function p(e){let t=l(e);return function(e){let r=e.split(d);return 2===r.length&&a(r[0])&&t(r[1])}}function f(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),s=new Date(t).valueOf();if(r&&s)return r-s}function h(e,t){if(!(e&&t))return;let[r,s]=e.split(d),[i,a]=t.split(d),o=n(r,i);if(void 0!==o)return o||u(s,a)}let m=/\/|:/,y=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x80000000-1;function b(){return!0}let w=/[^\\]\\Z/},1712(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(5888),i=r(9035),a=r(8994),n=new a.Name("fullFormats"),o=new a.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return u(e,t,s.fullFormats,n),e;let[r,a]="fast"===t.mode?[s.fastFormats,o]:[s.fullFormats,n];return u(e,t.formats||s.formatNames,r,a),t.keywords&&(0,i.default)(e),e};function u(e,t,r,s){var i;for(let n of(null!=(i=e.opts.code).formats||(i.formats=(0,a._)`require("ajv-formats/dist/formats").${s}`),t))e.addFormat(n,r[n])}l.get=(e,t="full")=>{let r=("fast"===t?s.fastFormats:s.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r},e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l},9035(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let s=r(8825),i=r(8994),a=i.operators,n={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,i.str)`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,i._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:a,data:o,schemaCode:l,keyword:u,it:c}=e,{opts:d,self:p}=c;if(!d.validateFormats)return;let f=new s.KeywordCxt(c,p.RULES.all.format.definition,"format");function h(e){return(0,i._)`${e}.compare(${o}, ${l}) ${n[u].fail} 0`}f.$data?(t=a.scopeValue("formats",{ref:p.formats,code:d.code.formats}),r=a.const("fmt",(0,i._)`${t}[${f.schemaCode}]`),e.fail$data((0,i.or)((0,i._)`typeof ${r} != "object"`,(0,i._)`${r} instanceof RegExp`,(0,i._)`typeof ${r}.compare != "function"`,h(r)))):function(){let t=f.schema,r=p.formats[t];if(!r||!0===r)return;if("object"!=typeof r||r instanceof RegExp||"function"!=typeof r.compare)throw Error(`"${u}": format "${t}" does not define "compare" function`);let s=a.scopeValue("formats",{key:t,ref:r,code:d.code.formats?(0,i._)`${d.code.formats}${(0,i.getProperty)(t)}`:void 0});e.fail$data(h(s))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},8825(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let s=r(1967),i=r(3959),a=r(9376),n=r(7456),o=["/properties"],l="http://json-schema.org/draft-07/schema";class u extends s.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var c=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=r(8994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=r(4383);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var f=r(4220);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})},8261(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=s;class i extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof s&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function a(e,...t){let r=[e[0]],s=0;for(;s<t.length;)l(r,t[s]),r.push(e[++s]);return new i(r)}t._Code=i,t.nil=new i(""),t._=a;let n=new i("+");function o(e,...t){let r=[u(e[0])],a=0;for(;a<t.length;)r.push(n),l(r,t[a]),r.push(n,u(e[++a]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var r,i;let a=(r=e[t-1],'""'===(i=e[t+1])?r:'""'===r?i:"string"==typeof r?i instanceof s||'"'!==r[r.length-1]?void 0:"string"!=typeof i?`${r.slice(0,-1)}${i}"`:'"'===i[0]?r.slice(0,-1)+i.slice(1):void 0:"string"!=typeof i||'"'!==i[0]||r instanceof s?void 0:`"${r}${i.slice(1)}`);if(void 0!==a){e.splice(t-1,3,a);continue}e[t++]="+"}t++}}(r),new i(r)}function l(e,t){var r;t instanceof i?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(r=t)||"boolean"==typeof r||null===r?r:u(Array.isArray(r)?r.join(","):r))}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=o,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},t.stringify=function(e){return new i(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):a`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},8994(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let s=r(8261),i=r(4490);var a=r(8261);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return a.Name}});var n=r(4490);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends o{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?i.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class u extends o{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,t),this}get names(){return O(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class c extends u{constructor(e,t,r,s){super(e,r,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class f extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class m extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,s=r.length;for(;s--;){let i=r[s];i.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,i.names),r.splice(s,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>I(e,t.names),{})}}class y extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class g extends m{}class v extends y{}v.kind="else";class _ extends y{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(R(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&I(e,this.else.names),e}}_.kind="if";class b extends y{}b.kind="for";class w extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return I(super.names,this.iteration.names)}}class $ extends b{constructor(e,t,r,s){super(),this.varKind=e,this.name=t,this.from=r,this.to=s}render(e){let t=e.es5?i.varKinds.var:this.varKind,{name:r,from:s,to:a}=this;return`for(${t} ${r}=${s}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=O(super.names,this.from);return O(e,this.to)}}class k extends b{constructor(e,t,r,s){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return I(super.names,this.iterable.names)}}class E extends y{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}E.kind="func";class x extends m{render(e){return"return "+super.render(e)}}x.kind="return";class S extends y{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,s;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(s=this.finally)||s.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&I(e,this.catch.names),this.finally&&I(e,this.finally.names),e}}class T extends y{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}T.kind="catch";class P extends y{render(e){return"finally"+super.render(e)}}function I(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function O(e,t){return t instanceof s._CodeOrName?I(e,t.names):e}function j(e,t,r){var i;if(e instanceof s.Name)return a(e);if(!((i=e)instanceof s._Code&&i._items.some(e=>e instanceof s.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new s._Code(e._items.reduce((e,t)=>(t instanceof s.Name&&(t=a(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e),[]));function a(e){let s=r[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function R(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,s._)`!${z(e)}`}P.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){let i=this._scope.toName(t);return void 0!==r&&s&&(this._constants[i.str]=r),this._leafNode(new l(e,i,r)),i}const(e,t,r){return this._def(i.varKinds.const,e,t,r)}let(e,t,r){return this._def(i.varKinds.let,e,t,r)}var(e,t,r){return this._def(i.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new u(e,t,r))}add(e,r){return this._leafNode(new c(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new h(e)),this}object(...e){let t=["{"];for(let[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,i));return t.push("}"),new s._Code(t)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(_,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,s,a=this.opts.es5?i.varKinds.var:i.varKinds.let){let n=this._scope.toName(e);return this._for(new $(a,n,t,r),()=>s(n))}forOf(e,t,r,a=i.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,s._)`${e}.length`,t=>{this.var(n,(0,s._)`${e}[${t}]`),r(n)})}return this._for(new k("of",a,n,t),()=>r(n))}forIn(e,t,r,a=this.opts.es5?i.varKinds.var:i.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,s._)`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new k("in",a,n,t),()=>r(n))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new p(e))}return(e){let t=new x;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(x)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let s=new S;if(this._blockNode(s),this.code(e),t){let e=this.name("e");this._currNode=s.catch=new T(e),t(e)}return r&&(this._currNode=s.finally=new P,this.code(r)),this._endBlockNode(T,P)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,r,i){return this._blockNode(new E(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=R;let N=C(t.operators.AND);t.and=function(...e){return e.reduce(N)};let A=C(t.operators.OR);function C(e){return(t,r)=>t===s.nil?r:r===s.nil?t:(0,s._)`${z(t)} ${e} ${z(r)}`}function z(e){return e instanceof s.Name?e:(0,s._)`(${e})`}t.or=function(...e){return e.reduce(A)}},4490(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let a=r(8261);class n extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(i=s||(t.UsedValueState=s={}))[i.Started=0]="Started",i[i.Completed=1]="Completed",t.varKinds={const:new a.Name("const"),let:new a.Name("let"),var:new a.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof a.Name?e:this.name(e)}name(e){return new a.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class l extends a.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,a._)`.${new a.Name(t)}[${r}]`}}t.ValueScopeName=l;let u=(0,a._)`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?u:a.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:i}=s,a=null!=(r=t.key)?r:t.ref,n=this._values[i];if(n){let e=n.get(a);if(e)return e}else n=this._values[i]=new Map;n.set(a,s);let o=this._scope[i]||(this._scope[i]=[]),l=o.length;return o[l]=t.ref,s.setValue(t,{property:i,itemIndex:l}),s}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,a._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,i={},o){let l=a.nil;for(let u in e){let c=e[u];if(!c)continue;let d=i[u]=i[u]||new Map;c.forEach(e=>{if(d.has(e))return;d.set(e,s.Started);let i=r(e);if(i){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,a._)`${l}${r} ${e} = ${i};${this.opts._n}`}else if(i=null==o?void 0:o(e))l=(0,a._)`${l}${i}${this.opts._n}`;else throw new n(e);d.set(e,s.Completed)})}return l}}},8425(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let s=r(8994),i=r(7218),a=r(6660);function n(e,t){let r=e.const("err",t);e.if((0,s._)`${a.default.vErrors} === null`,()=>e.assign(a.default.vErrors,(0,s._)`[${r}]`),(0,s._)`${a.default.vErrors}.push(${r})`),e.code((0,s._)`${a.default.errors}++`)}function o(e,t){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,s._)`new ${e.ValidationError}(${t})`):(r.assign((0,s._)`${i}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>(0,s.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,s.str)`"${e}" keyword must be ${t} ($data)`:(0,s.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,i,a){let{it:l}=e,{gen:c,compositeRule:d,allErrors:p}=l,f=u(e,r,i);(null!=a?a:d||p)?n(c,f):o(l,(0,s._)`[${f}]`)},t.reportExtraError=function(e,r=t.keywordError,s){let{it:i}=e,{gen:l,compositeRule:c,allErrors:d}=i;n(l,u(e,r,s)),c||d||o(i,a.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(a.default.errors,t),e.if((0,s._)`${a.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,s._)`${a.default.vErrors}.length`,t),()=>e.assign(a.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(void 0===n)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",n,a.default.errors,n=>{e.const(l,(0,s._)`${a.default.vErrors}[${n}]`),e.if((0,s._)`${l}.instancePath === undefined`,()=>e.assign((0,s._)`${l}.instancePath`,(0,s.strConcat)(a.default.instancePath,o.errorPath))),e.assign((0,s._)`${l}.schemaPath`,(0,s.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,s._)`${l}.schema`,r),e.assign((0,s._)`${l}.data`,i))})};let l={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function u(e,t,r){let{createErrors:n}=e.it;return!1===n?(0,s._)`{}`:function(e,t,r={}){let{gen:n,it:o}=e,u=[function({errorPath:e},{instancePath:t}){let r=t?(0,s.str)`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[a.default.instancePath,(0,s.strConcat)(a.default.instancePath,r)]}(o,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:a}){let n=a?t:(0,s.str)`${t}/${e}`;return r&&(n=(0,s.str)`${n}${(0,i.getErrorPath)(r,i.Type.Str)}`),[l.schemaPath,n]}(e,r)];return function(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:u,it:c}=e,{opts:d,propertyName:p,topSchemaRef:f,schemaPath:h}=c;i.push([l.keyword,n],[l.params,"function"==typeof t?t(e):t||(0,s._)`{}`]),d.messages&&i.push([l.message,"function"==typeof r?r(e):r]),d.verbose&&i.push([l.schema,u],[l.parentSchema,(0,s._)`${f}${h}`],[a.default.data,o]),p&&i.push([l.propertyName,p])}(e,t,u),n.object(...u)}(e,t,r)}},1688(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let s=r(8994),i=r(4383),a=r(6660),n=r(9008),o=r(7218),l=r(6023);class u{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function c(e){let t,r,o=p.call(this,e);if(o)return o;let u=(0,n.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:f}=this.opts,h=new s.CodeGen(this.scope,{es5:c,lines:d,ownProperties:f});e.$async&&(t=h.scopeValue("Error",{ref:i.default,code:(0,s._)`require("ajv/dist/runtime/validation_error").default`}));let m=h.scopeName("validate");e.validateName=m;let y={gen:h,allErrors:this.opts.allErrors,data:a.default.data,parentData:a.default.parentData,parentDataProperty:a.default.parentDataProperty,dataNames:[a.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:u,baseId:e.baseId||u,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,s._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(y),h.optimize(this.opts.code.optimize);let t=h.toString();r=`${h.scopeRefs(a.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let i=Function(`${a.default.self}`,`${a.default.scope}`,r)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),!0===this.opts.code.source&&(i.source={validateName:m,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){let{props:e,items:t}=y;i.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},i.source&&(i.source.evaluated=(0,s.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function d(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function p(e){for(let s of this._compilations){var t,r;if(t=s,r=e,t.schema===r.schema&&t.root===r.root&&t.baseId===r.baseId)return s}}function f(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||h.call(this,e,t)}function h(e,t){let r=this.opts.uriResolver.parse(t),s=(0,n._getFullPath)(this.opts.uriResolver,r),i=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===i)return y.call(this,r,e);let a=(0,n.normalizeId)(s),o=this.refs[a]||this.schemas[a];if("string"==typeof o){let t=h.call(this,e,o);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,r,t)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||c.call(this,o),a===(0,n.normalizeId)(t)){let{schema:t}=o,{schemaId:r}=this.opts,s=t[r];return s&&(i=(0,n.resolveUrl)(this.opts.uriResolver,i,s)),new u({schema:t,schemaId:r,root:e,baseId:i})}return y.call(this,r,o)}}t.SchemaEnv=u,t.compileSchema=c,t.resolveRef=function(e,t,r){var s;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let a=f.call(this,e,r);if(void 0===a){let i=null==(s=e.localRefs)?void 0:s[r],{schemaId:n}=this.opts;i&&(a=new u({schema:i,schemaId:n,root:e,baseId:t}))}if(void 0!==a)return e.refs[r]=d.call(this,a)},t.getCompilingSchema=p,t.resolveSchema=h;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:r,root:s}){var i;let a;if((null==(i=e.fragment)?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,o.unescapeFragment)(s)];if(void 0===e)return;let i="object"==typeof(r=e)&&r[this.opts.schemaId];!m.has(s)&&i&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,i))}if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){let e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);a=h.call(this,s,e)}let{schemaId:l}=this.opts;if((a=a||new u({schema:r,schemaId:l,root:s,baseId:t})).schema!==a.root.schema)return a}},6660(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")}},4220(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(9008);t.default=class extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,r),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}},9008(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let s=r(7218),i=r(7371),a=r(205),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(o.has(r))return!0;let s=t[r];if(Array.isArray(s)&&s.some(e)||"object"==typeof s&&e(s))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let i in t)if("$ref"===i||(r++,!n.has(i)&&("object"==typeof t[i]&&(0,s.eachItem)(t[i],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=d(t));let s=e.parse(t);return u(e,s)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=u;let c=/#\/?$/;function d(e){return e?e.replace(c,""):""}t.normalizeId=d,t.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};let p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:s}=this.opts,n=d(e[r]||t),o={"":n},u=l(s,n,!1),c={},f=new Set;return a(e,{allKeys:!0},(e,t,s,i)=>{if(void 0===i)return;let a=u+t,n=o[i];function l(t){let r=this.opts.uriResolver.resolve;if(t=d(n?r(n,t):t),f.has(t))throw m(t);f.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?h(e,s.schema,t):t!==d(a)&&("#"===t[0]?(h(e,c[t],t),c[t]=e):this.refs[t]=a),t}function y(e){if("string"==typeof e){if(!p.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(n=l.call(this,e[r])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),o[t]=n}),c;function h(e,t,r){if(void 0!==t&&!i(e,t))throw m(r)}function m(e){return Error(`reference "${e}" resolves to more than one schema`)}}},6247(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},7218(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let a=r(8994),n=r(8261);function o(e,t=e.schema){let{opts:r,self:s}=e;if(!r.strictSchema||"boolean"==typeof t)return;let i=s.RULES.keywords;for(let r in t)i[r]||m(e,`unknown keyword: "${r}"`)}function l(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function u(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function d({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:s}){return(i,n,o,l)=>{let u=void 0===o?n:o instanceof a.Name?(n instanceof a.Name?e(i,n,o):t(i,n,o),o):n instanceof a.Name?(t(i,o,n),n):r(n,o);return l!==a.Name||u instanceof a.Name?u:s(i,u)}}function p(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,a._)`{}`);return void 0!==t&&f(e,r,t),r}function f(e,t,r){Object.keys(r).forEach(r=>e.assign((0,a._)`${t}${(0,a.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!l(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=l,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,s,i){if(!i){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,a._)`${r}`}return(0,a._)`${e}${t}${(0,a.getProperty)(s)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(u(e))},t.escapeJsonPointer=u,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:d({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,a._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,a._)`${r} || {}`).code((0,a._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,a._)`${r} || {}`),f(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:p}),items:d({mergeNames:(e,t,r)=>e.if((0,a._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,a._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,a._)`${r} !== true`,()=>e.assign(r,!0===t||(0,a._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=p,t.setEvaluated=f;let h={};function m(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:h[t.code]||(h[t.code]=new n._Code(t.code))})},(i=s||(t.Type=s={}))[i.Num=0]="Num",i[i.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof a.Name){let i=t===s.Num;return r?i?(0,a._)`"[" + ${e} + "]"`:(0,a._)`"['" + ${e} + "']"`:i?(0,a._)`"/" + ${e}`:(0,a._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,a.getProperty)(e).toString():"/"+u(e)},t.checkStrictMode=m},238(e,t){"use strict";function r(e,t){return t.rules.some(t=>s(e,t))}function s(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},s){let i=t.RULES.types[s];return i&&!0!==i&&r(e,i)},t.shouldUseGroup=r,t.shouldUseRule=s},564(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let s=r(8425),i=r(8994),a=r(6660),n={message:"boolean schema is false"};function o(e,t){let{gen:r,data:i}=e;(0,s.reportError)({gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},n,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:s}=e;!1===r?o(e,!1):"object"==typeof r&&!0===r.$async?t.return(a.default.data):(t.assign((0,i._)`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:s}=e;!1===s?(r.var(t,!1),o(e)):r.var(t,!0)}},6419(e,t,r){"use strict";var s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let a=r(6247),n=r(238),o=r(8425),l=r(8994),u=r(7218);function c(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(i=s||(t.DataType=s={}))[i.Correct=0]="Correct",i[i.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){var r,i;let{gen:a,data:o,opts:u}=e,c=(r=t,(i=u.coerceTypes)?r.filter(e=>d.has(e)||"array"===i&&"array"===e):[]),p=t.length>0&&!(0===c.length&&1===t.length&&(0,n.schemaHasRulesForType)(e,t[0]));if(p){let r=f(t,o,u.strictNumbers,s.Wrong);a.if(r,()=>{c.length?function(e,t,r){let{gen:s,data:i,opts:a}=e,n=s.let("dataType",(0,l._)`typeof ${i}`),o=s.let("coerced",(0,l._)`undefined`);for(let e of("array"===a.coerceTypes&&s.if((0,l._)`${n} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>s.assign(i,(0,l._)`${i}[0]`).assign(n,(0,l._)`typeof ${i}`).if(f(t,i,a.strictNumbers),()=>s.assign(o,i))),s.if((0,l._)`${o} !== undefined`),r))(d.has(e)||"array"===e&&"array"===a.coerceTypes)&&function(e){switch(e){case"string":s.elseIf((0,l._)`${n} == "number" || ${n} == "boolean"`).assign(o,(0,l._)`"" + ${i}`).elseIf((0,l._)`${i} === null`).assign(o,(0,l._)`""`);return;case"number":s.elseIf((0,l._)`${n} == "boolean" || ${i} === null
2
2
  || (${n} == "string" && ${i} && ${i} == +${i})`).assign(o,(0,l._)`+${i}`);return;case"integer":s.elseIf((0,l._)`${n} === "boolean" || ${i} === null
3
3
  || (${n} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(o,(0,l._)`+${i}`);return;case"boolean":s.elseIf((0,l._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(o,!1).elseIf((0,l._)`${i} === "true" || ${i} === 1`).assign(o,!0);return;case"null":s.elseIf((0,l._)`${i} === "" || ${i} === 0 || ${i} === false`),s.assign(o,null);return;case"array":s.elseIf((0,l._)`${n} === "string" || ${n} === "number"
4
- || ${n} === "boolean" || ${i} === null`).assign(o,(0,l._)`[${i}]`)}}(e);s.else(),m(e),s.endIf(),s.if((0,l._)`${o} !== undefined`,()=>{s.assign(i,o),function({gen:e,parentData:t,parentDataProperty:r},s){e.if((0,l._)`${t} !== undefined`,()=>e.assign((0,l._)`${t}[${r}]`,s))}(e,o)})}(e,t,c):m(e)})}return p};let d=new Set(["string","number","integer","boolean","null"]);function p(e,t,r,i=s.Correct){let a,n=i===s.Correct?l.operators.EQ:l.operators.NEQ;switch(e){case"null":return(0,l._)`${t} ${n} null`;case"array":a=(0,l._)`Array.isArray(${t})`;break;case"object":a=(0,l._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=o((0,l._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=o();break;default:return(0,l._)`typeof ${t} ${n} ${e}`}return i===s.Correct?a:(0,l.not)(a);function o(e=l.nil){return(0,l.and)((0,l._)`typeof ${t} == "number"`,e,r?(0,l._)`isFinite(${t})`:l.nil)}}function f(e,t,r,s){let i;if(1===e.length)return p(e[0],t,r,s);let a=(0,u.toHash)(e);if(a.array&&a.object){let e=(0,l._)`typeof ${t} != "object"`;i=a.null?e:(0,l._)`!${t} || ${e}`,delete a.null,delete a.array,delete a.object}else i=l.nil;for(let e in a.number&&delete a.integer,a)i=(0,l.and)(i,p(e,t,r,s));return i}t.checkDataType=p,t.checkDataTypes=f;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,l._)`{type: ${e}}`:(0,l._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:s}=e,i=(0,u.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:i,schemaValue:i,parentSchema:s,params:{},it:e}}(e);(0,o.reportError)(t,h)}t.reportTypeError=m},6899(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let s=r(6556),i=r(8512);function a(e,t,r){let{gen:a,compositeRule:n,data:o,opts:l}=e;if(void 0===r)return;let u=(0,s._)`${o}${(0,s.getProperty)(t)}`;if(n)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let c=(0,s._)`${u} === undefined`;"empty"===l.useDefaults&&(c=(0,s._)`${c} || ${u} === null || ${u} === ""`),a.if(c,(0,s._)`${u} = ${(0,s.stringify)(r)}`)}t.assignDefaults=function(e,t){let{properties:r,items:s}=e.schema;if("object"===t&&r)for(let t in r)a(e,t,r[t].default);else"array"===t&&Array.isArray(s)&&s.forEach((t,r)=>a(e,r,t.default))}},6889(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let s=r(2882),i=r(4029),a=r(4204),n=r(4029),o=r(6899),l=r(1074),u=r(4456),c=r(6556),d=r(4614),p=r(234),f=r(8512),h=r(7747);function m({gen:e,validateName:t,schema:r,schemaEnv:s,opts:i},a){var n;i.code.es5?e.func(t,(0,c._)`${d.default.data}, ${d.default.valCxt}`,s.$async,()=>{var t,s;e.code((0,c._)`"use strict"; ${y(r,i)}`),t=e,s=i,t.if(d.default.valCxt,()=>{t.var(d.default.instancePath,(0,c._)`${d.default.valCxt}.${d.default.instancePath}`),t.var(d.default.parentData,(0,c._)`${d.default.valCxt}.${d.default.parentData}`),t.var(d.default.parentDataProperty,(0,c._)`${d.default.valCxt}.${d.default.parentDataProperty}`),t.var(d.default.rootData,(0,c._)`${d.default.valCxt}.${d.default.rootData}`),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{t.var(d.default.instancePath,(0,c._)`""`),t.var(d.default.parentData,(0,c._)`undefined`),t.var(d.default.parentDataProperty,(0,c._)`undefined`),t.var(d.default.rootData,d.default.data),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`{}`)}),e.code(a)}):e.func(t,(0,c._)`${d.default.data}, ${(n=i,(0,c._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${n.dynamicRef?(0,c._)`, ${d.default.dynamicAnchors}={}`:c.nil}}={}`)}`,s.$async,()=>e.code(y(r,i)).code(a))}function y(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${r} */`:c.nil}function g({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function _(e){(0,f.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:s,self:i}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return $(e,[],!1,t);let r=(0,i.getSchemaTypes)(e.schema),s=(0,i.coerceAndCheckDataType)(e,r);$(e,r,!s,t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:i}){let a=r.$comment;if(!0===i.$comment)e.code((0,c._)`${d.default.self}.logger.log(${a})`);else if("function"==typeof i.$comment){let r=(0,c.str)`${s}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,c._)`${d.default.self}.opts.$comment(${a}, ${r}, ${i}.schema)`)}}function $(e,t,r,s){var i,o,l,u;let{gen:p,schema:h,data:m,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(h.$ref&&(g.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(h,_)))return void p.block(()=>T(e,"$ref",_.all.$ref.definition));function b(i){(0,a.shouldUseGroup)(h,i)&&(i.type?(p.if((0,n.checkDataType)(i.type,m,g.strictNumbers)),k(e,i),1===t.length&&t[0]===i.type&&r&&(p.else(),(0,n.reportTypeError)(e)),p.endIf()):k(e,i),y||p.if((0,c._)`${d.default.errors} === ${s||0}`))}g.jtd||(i=e,o=t,!i.schemaEnv.meta&&i.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{E(e.dataTypes,t)||x(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let s of e.dataTypes)E(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)}}(i,o),i.opts.allowUnionTypes||(l=i,(u=o).length>1&&!(2===u.length&&u.includes("null"))&&x(l,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let s in r){let i=r[s];if("object"==typeof i&&(0,a.shouldUseRule)(e.schema,i)){let{type:r}=i.definition;r.length&&!r.some(e=>{var r,s;return r=t,s=e,r.includes(s)||"number"===s&&r.includes("integer")})&&x(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}(i,i.dataTypes))),p.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function k(e,t){let{gen:r,schema:s,opts:{useDefaults:i}}=e;i&&(0,o.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,a.shouldUseRule)(s,r)&&T(e,r.keyword,r.definition,t.type)})}function E(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function x(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){v(e)&&(_(e),g(e))?function(e){let{schema:t,opts:r,gen:s}=e;m(e,()=>{r.$comment&&t.$comment&&w(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(d.default.vErrors,null),s.let(d.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,c._)`${r}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}(e),b(e),function(e){let{gen:t,schemaEnv:r,validateName:s,ValidationError:i,opts:a}=e;r.$async?t.if((0,c._)`${d.default.errors} === 0`,()=>t.return(d.default.data),()=>t.throw((0,c._)`new ${i}(${d.default.vErrors})`)):(t.assign((0,c._)`${s}.errors`,d.default.vErrors),a.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof c.Name&&e.assign((0,c._)`${t}.props`,r),s instanceof c.Name&&e.assign((0,c._)`${t}.items`,s)}(e),t.return((0,c._)`${d.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,s.topBoolOrEmptySchema)(e))};class S{constructor(e,t,r){if((0,l.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",O(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,r){this.failResult((0,c.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=c.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:r,schemaCode:s,schemaType:i,def:a}=this;r.if((0,c.or)((0,c._)`${s} === undefined`,t)),e!==c.nil&&r.assign(e,!0),(i.length||a.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:s,it:i}=this;return(0,c.or)(function(){if(r.length){if(!(t instanceof c.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,c._)`${(0,n.checkDataTypes)(e,t,i.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}(),function(){if(s.validateSchema){let r=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,c._)`!${r}(${t})`}return c.nil}())}subschema(e,t){let r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return!function(e,t){if(v(e)&&(_(e),g(e)))return function(e,t){var r;let s,{schema:i,gen:a,opts:n}=e;n.$comment&&i.$comment&&w(e),(s=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,p.resolveUrl)(r.opts.uriResolver,r.baseId,s)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let o=a.const("_errs",d.default.errors);b(e,o),a.var(t,(0,c._)`${o} === ${d.default.errors}`)}(e,t);(0,s.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){let{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=f.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=f.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}}function T(e,t,r,s){let i=new S(e,r,t);"code"in r?r.code(i,s):i.$data&&r.validate?(0,l.funcKeywordCode)(i,r):"macro"in r?(0,l.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,l.funcKeywordCode)(i,r)}t.KeywordCxt=S;let P=/^\/(?:[^~]|~0|~1)*$/,I=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let i,a;if(""===e)return d.default.rootData;if("/"===e[0]){if(!P.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=d.default.rootData}else{let n=I.exec(e);if(!n)throw Error(`Invalid JSON-pointer: ${e}`);let l=+n[1];if("#"===(i=n[2])){if(l>=t)throw Error(o("property/index",l));return s[t-l]}if(l>t)throw Error(o("data",l));if(a=r[t-l],!i)return a}let n=a;for(let e of i.split("/"))e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,f.unescapeJsonPointer)(e))}`,n=(0,c._)`${n} && ${a}`);return n;function o(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=O},1074(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let s=r(6556),i=r(4614),a=r(3716),n=r(7747);function o(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,s._)`${i.parentData}[${i.parentDataProperty}]`))}function l(e,t,r){if(void 0===r)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}t.macroKeywordCode=function(e,t){let{gen:r,keyword:i,schema:a,parentSchema:n,it:o}=e,u=t.macro.call(o.self,a,n,o),c=l(r,i,u);!1!==o.opts.validateSchema&&o.self.validateSchema(u,!0);let d=r.name("valid");e.subschema({schema:u,schemaPath:s.nil,errSchemaPath:`${o.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;let{gen:u,keyword:c,schema:d,parentSchema:p,$data:f,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,t);let m=l(u,c,!f&&t.compile?t.compile.call(h.self,d,p,h):t.validate),y=u.let("valid");function g(r=t.async?(0,s._)`await `:s.nil){let n=h.opts.passContext?i.default.this:i.default.self,o=!("compile"in t&&!f||!1===t.schema);u.assign(y,(0,s._)`${r}${(0,a.callValidateCode)(e,m,n,o)}`,t.modifying)}function v(e){var r;u.if((0,s.not)(null!=(r=t.valid)?r:y),e)}e.block$data(y,function(){if(!1===t.errors)g(),t.modifying&&o(e),v(()=>e.error());else{let r,a,l=t.async?(r=u.let("ruleErrs",null),u.try(()=>g((0,s._)`await `),e=>u.assign(y,!1).if((0,s._)`${e} instanceof ${h.ValidationError}`,()=>u.assign(r,(0,s._)`${e}.errors`),()=>u.throw(e))),r):(a=(0,s._)`${m}.errors`,u.assign(a,null),g(s.nil),a);t.modifying&&o(e),v(()=>(function(e,t){let{gen:r}=e;r.if((0,s._)`Array.isArray(${t})`,()=>{r.assign(i.default.vErrors,(0,s._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,(0,s._)`${i.default.vErrors}.length`),(0,n.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(r=t.valid)?r:y)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error("ajv implementation error");let n=i.dependencies;if(null==n?void 0:n.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${n.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${s}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}},4456(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let s=r(6556),i=r(8512);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:a,schemaPath:n,errSchemaPath:o,topSchemaRef:l}){if(void 0!==t&&void 0!==a)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let a=e.schema[t];return void 0===r?{schema:a,schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(r)}`}}if(void 0!==a){if(void 0===n||void 0===o||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:n,topSchemaRef:l,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:a,data:n,dataTypes:o,propertyName:l}){if(void 0!==n&&void 0!==r)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=t;if(void 0!==r){let{errorPath:n,dataPathArr:o,opts:l}=t;c(u.let("data",(0,s._)`${t.data}${(0,s.getProperty)(r)}`,!0)),e.errorPath=(0,s.str)`${n}${(0,i.getErrorPath)(r,a,l.jsPropertySyntax)}`,e.parentDataProperty=(0,s._)`${r}`,e.dataPathArr=[...o,e.parentDataProperty]}function c(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==n&&(c(n instanceof s.Name?n:u.let("data",n,!0)),void 0!==l&&(e.propertyName=l)),o&&(e.dataTypes=o)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:i,allErrors:a}){void 0!==s&&(e.compositeRule=s),void 0!==i&&(e.createErrors=i),void 0!==a&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r}},7285(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=r(6889);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var i=r(6556);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});let a=r(9645),n=r(218),o=r(9881),l=r(9198),u=r(6556),c=r(234),d=r(4029),p=r(8512),f=r(2200),h=r(8669),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let y=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,s,i,a,n,o,l,u,c,d,p,f,y,g,v,_,b,w,$,k,E,x,S,T;let P=e.strict,I=null==(t=e.code)?void 0:t.optimize,O=!0===I||void 0===I?1:I||0,j=null!=(s=null==(r=e.code)?void 0:r.regExp)?s:m,R=null!=(i=e.uriResolver)?i:h.default;return{strictSchema:null==(n=null!=(a=e.strictSchema)?a:P)||n,strictNumbers:null==(l=null!=(o=e.strictNumbers)?o:P)||l,strictTypes:null!=(c=null!=(u=e.strictTypes)?u:P)?c:"log",strictTuples:null!=(p=null!=(d=e.strictTuples)?d:P)?p:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:P)&&y,code:e.code?{...e.code,optimize:O,regExp:j}:{optimize:O,regExp:j},loopRequired:null!=(g=e.loopRequired)?g:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(w=e.inlineRefs)||w,schemaId:null!=($=e.schemaId)?$:"$id",addUsedSchema:null==(k=e.addUsedSchema)||k,validateSchema:null==(E=e.validateSchema)||E,validateFormats:null==(x=e.validateFormats)||x,unicodeRegExp:null==(S=e.unicodeRegExp)||S,int32range:null==(T=e.int32range)||T,uriResolver:R}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:g,es5:t,lines:r}),this.logger=function(e){if(!1===e)return T;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,v,e,"NOT SUPPORTED"),w.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&x.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),k.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,s=f;"id"===r&&((s={...f}).id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await i.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return o.call(this,t),await l.call(this,t.missingSchema),a.call(this,e)}}function o({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,s);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(r,e);if(!s&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,s=new l.SchemaEnv({schema:{},schemaId:r});if(!(t=l.resolveSchema.call(this,s,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,c.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(I.call(this,r,t),!t)return(0,p.eachItem)(r,e=>O.call(this,e)),this;R.call(this,t);let s={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,p.eachItem)(r,0===s.type.length?e=>O.call(this,e,s):e=>s.type.forEach(t=>O.call(this,e,s,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let s of(e=JSON.parse(JSON.stringify(e)),t)){let t=s.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:s}=t.definition,a=i[e];s&&a&&(i[e]=A(a))}}return e}_removeAllSchemas(e,t){for(let r in e){let s=e[r];(!t||t.test(r))&&("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:n}=this.opts;if("object"==typeof e)a=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let o=this._cache.get(e);if(void 0!==o)return o;r=(0,c.normalizeId)(a||r);let u=c.getSchemaRefs.call(this,e,r);return o=new l.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(o.schema,o),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=o),s&&this.validateSchema(e,!0),o}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,s="error"){for(let i in e)i in t&&this.logger[s](`${r}: option ${i}. ${e[i]}`)}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function k(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function E(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function x(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function S(){let e={...this.opts};for(let t of y)delete e[t];return e}b.ValidationError=a.default,b.MissingRefError=n.default,t.default=b;let T={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function I(e,t){let{RULES:r}=this;if((0,p.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!P.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function O(e,t,r){var s;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,n=i?a.post:a.rules.find(({type:e})=>e===r);if(n||(n={type:r,rules:[]},a.rules.push(n)),a.keywords[e]=!0,!t)return;let o={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?j.call(this,n,o,t.before):n.rules.push(o),a.all[e]=o,null==(s=t.implements)||s.forEach(e=>this.addKeyword(e))}function j(e,t,r){let s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=A(t)),e.validateSchema=this.compile(t,!0))}let N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function A(e){return{anyOf:[e,N]}}},6935(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7371);s.code='require("ajv/dist/runtime/equal").default',t.default=s},5014(e,t){"use strict";function r(e){let t,r=e.length,s=0,i=0;for(;i<r;)s++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},8669(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(5019);s.code='require("ajv/dist/runtime/uri").default',t.default=s},9645(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}},8440(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let s=r(6556),i=r(8512);function a(e,t){let{gen:r,schema:a,data:n,keyword:o,it:l}=e;l.items=!0;let u=r.const("len",(0,s._)`${n}.length`);if(!1===a)e.setParams({len:t.length}),e.pass((0,s._)`${u} <= ${t.length}`);else if("object"==typeof a&&!(0,i.alwaysValidSchema)(l,a)){let a=r.var("valid",(0,s._)`${u} <= ${t.length}`);r.if((0,s.not)(a),()=>{var n;return n=a,void r.forRange("i",t.length,u,t=>{e.subschema({keyword:o,dataProp:t,dataPropType:i.Type.Num},n),l.allErrors||r.if((0,s.not)(n),()=>r.break())})}),e.ok(a)}}t.validateAdditionalItems=a,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:s}=t;Array.isArray(s)?a(e,s):(0,i.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}}},3439(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3716),i=r(6556),a=r(4614),n=r(8512);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,i._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:r,parentSchema:o,data:l,errsCount:u,it:c}=e;if(!u)throw Error("ajv implementation error");let{allErrors:d,opts:p}=c;if(c.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(c,r))return;let f=(0,s.allSchemaProperties)(o.properties),h=(0,s.allSchemaProperties)(o.patternProperties);function m(e){t.code((0,i._)`delete ${l}[${e}]`)}function y(s){if("all"===p.removeAdditional||p.removeAdditional&&!1===r)return void m(s);if(!1===r){e.setParams({additionalProperty:s}),e.error(),d||t.break();return}if("object"==typeof r&&!(0,n.alwaysValidSchema)(c,r)){let r=t.name("valid");"failing"===p.removeAdditional?(g(s,r,!1),t.if((0,i.not)(r),()=>{e.reset(),m(s)})):(g(s,r),d||t.if((0,i.not)(r),()=>t.break()))}}function g(t,r,s){let i={keyword:"additionalProperties",dataProp:t,dataPropType:n.Type.Str};!1===s&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",l,r=>{f.length||h.length?t.if(function(r){let a;if(f.length>8){let e=(0,n.schemaRefOrVal)(c,o.properties,"properties");a=(0,s.isOwnProperty)(t,e,r)}else a=f.length?(0,i.or)(...f.map(e=>(0,i._)`${r} === ${e}`)):i.nil;return h.length&&(a=(0,i.or)(a,...h.map(t=>(0,i._)`${(0,s.usePattern)(e,t)}.test(${r})`))),(0,i.not)(a)}(r),()=>y(r)):y(r)}),e.ok((0,i._)`${u} === ${a.default.errors}`)}}},4741(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8512);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let a=t.name("valid");r.forEach((t,r)=>{if((0,s.alwaysValidSchema)(i,t))return;let n=e.subschema({keyword:"allOf",schemaProp:r},a);e.ok(a),e.mergeEvaluated(n)})}}},5988(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(3716).validateUnion,error:{message:"must match a schema in anyOf"}}},5078(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,s.str)`must contain at least ${e} valid item(s)`:(0,s.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,s._)`{minContains: ${e}}`:(0,s._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,r,{gen:a,schema:n,parentSchema:o,data:l,it:u}=e,{minContains:c,maxContains:d}=o;u.opts.next?(t=void 0===c?1:c,r=d):t=1;let p=a.const("len",(0,s._)`${l}.length`);if(e.setParams({min:t,max:r}),void 0===r&&0===t)return void(0,i.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==r&&t>r){(0,i.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,i.alwaysValidSchema)(u,n)){let i=(0,s._)`${p} >= ${t}`;void 0!==r&&(i=(0,s._)`${i} && ${p} <= ${r}`),e.pass(i);return}u.items=!0;let f=a.name("valid");function h(){let e=a.name("_valid"),i=a.let("count",0);m(e,()=>a.if(e,()=>{var e;return e=i,void(a.code((0,s._)`${e}++`),void 0===r?a.if((0,s._)`${e} >= ${t}`,()=>a.assign(f,!0).break()):(a.if((0,s._)`${e} > ${r}`,()=>a.assign(f,!1).break()),1===t?a.assign(f,!0):a.if((0,s._)`${e} >= ${t}`,()=>a.assign(f,!0))))}))}function m(t,r){a.forRange("i",0,p,s=>{e.subschema({keyword:"contains",dataProp:s,dataPropType:i.Type.Num,compositeRule:!0},t),r()})}void 0===r&&1===t?m(f,()=>a.if(f,()=>a.break())):0===t?(a.let(f,!0),void 0!==r&&a.if((0,s._)`${l}.length > 0`,h)):(a.let(f,!1),h()),e.result(f,()=>e.reset())}}},7394(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let s=r(6556),i=r(8512),a=r(3716);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>(0,s.str)`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,s._)`{property: ${e},
4
+ || ${n} === "boolean" || ${i} === null`).assign(o,(0,l._)`[${i}]`)}}(e);s.else(),m(e),s.endIf(),s.if((0,l._)`${o} !== undefined`,()=>{s.assign(i,o),function({gen:e,parentData:t,parentDataProperty:r},s){e.if((0,l._)`${t} !== undefined`,()=>e.assign((0,l._)`${t}[${r}]`,s))}(e,o)})}(e,t,c):m(e)})}return p};let d=new Set(["string","number","integer","boolean","null"]);function p(e,t,r,i=s.Correct){let a,n=i===s.Correct?l.operators.EQ:l.operators.NEQ;switch(e){case"null":return(0,l._)`${t} ${n} null`;case"array":a=(0,l._)`Array.isArray(${t})`;break;case"object":a=(0,l._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=o((0,l._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=o();break;default:return(0,l._)`typeof ${t} ${n} ${e}`}return i===s.Correct?a:(0,l.not)(a);function o(e=l.nil){return(0,l.and)((0,l._)`typeof ${t} == "number"`,e,r?(0,l._)`isFinite(${t})`:l.nil)}}function f(e,t,r,s){let i;if(1===e.length)return p(e[0],t,r,s);let a=(0,u.toHash)(e);if(a.array&&a.object){let e=(0,l._)`typeof ${t} != "object"`;i=a.null?e:(0,l._)`!${t} || ${e}`,delete a.null,delete a.array,delete a.object}else i=l.nil;for(let e in a.number&&delete a.integer,a)i=(0,l.and)(i,p(e,t,r,s));return i}t.checkDataType=p,t.checkDataTypes=f;let h={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,l._)`{type: ${e}}`:(0,l._)`{type: ${t}}`};function m(e){let t=function(e){let{gen:t,data:r,schema:s}=e,i=(0,u.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:i,schemaValue:i,parentSchema:s,params:{},it:e}}(e);(0,o.reportError)(t,h)}t.reportTypeError=m},6593(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let s=r(8994),i=r(7218);function a(e,t,r){let{gen:a,compositeRule:n,data:o,opts:l}=e;if(void 0===r)return;let u=(0,s._)`${o}${(0,s.getProperty)(t)}`;if(n)return void(0,i.checkStrictMode)(e,`default is ignored for: ${u}`);let c=(0,s._)`${u} === undefined`;"empty"===l.useDefaults&&(c=(0,s._)`${c} || ${u} === null || ${u} === ""`),a.if(c,(0,s._)`${u} = ${(0,s.stringify)(r)}`)}t.assignDefaults=function(e,t){let{properties:r,items:s}=e.schema;if("object"===t&&r)for(let t in r)a(e,t,r[t].default);else"array"===t&&Array.isArray(s)&&s.forEach((t,r)=>a(e,r,t.default))}},6023(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let s=r(564),i=r(6419),a=r(238),n=r(6419),o=r(6593),l=r(9820),u=r(3826),c=r(8994),d=r(6660),p=r(9008),f=r(7218),h=r(8425);function m({gen:e,validateName:t,schema:r,schemaEnv:s,opts:i},a){var n;i.code.es5?e.func(t,(0,c._)`${d.default.data}, ${d.default.valCxt}`,s.$async,()=>{var t,s;e.code((0,c._)`"use strict"; ${y(r,i)}`),t=e,s=i,t.if(d.default.valCxt,()=>{t.var(d.default.instancePath,(0,c._)`${d.default.valCxt}.${d.default.instancePath}`),t.var(d.default.parentData,(0,c._)`${d.default.valCxt}.${d.default.parentData}`),t.var(d.default.parentDataProperty,(0,c._)`${d.default.valCxt}.${d.default.parentDataProperty}`),t.var(d.default.rootData,(0,c._)`${d.default.valCxt}.${d.default.rootData}`),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{t.var(d.default.instancePath,(0,c._)`""`),t.var(d.default.parentData,(0,c._)`undefined`),t.var(d.default.parentDataProperty,(0,c._)`undefined`),t.var(d.default.rootData,d.default.data),s.dynamicRef&&t.var(d.default.dynamicAnchors,(0,c._)`{}`)}),e.code(a)}):e.func(t,(0,c._)`${d.default.data}, ${(n=i,(0,c._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${n.dynamicRef?(0,c._)`, ${d.default.dynamicAnchors}={}`:c.nil}}={}`)}`,s.$async,()=>e.code(y(r,i)).code(a))}function y(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${r} */`:c.nil}function g({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function _(e){(0,f.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:s,self:i}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return $(e,[],!1,t);let r=(0,i.getSchemaTypes)(e.schema),s=(0,i.coerceAndCheckDataType)(e,r);$(e,r,!s,t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:i}){let a=r.$comment;if(!0===i.$comment)e.code((0,c._)`${d.default.self}.logger.log(${a})`);else if("function"==typeof i.$comment){let r=(0,c.str)`${s}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0,c._)`${d.default.self}.opts.$comment(${a}, ${r}, ${i}.schema)`)}}function $(e,t,r,s){var i,o,l,u;let{gen:p,schema:h,data:m,allErrors:y,opts:g,self:v}=e,{RULES:_}=v;if(h.$ref&&(g.ignoreKeywordsWithRef||!(0,f.schemaHasRulesButRef)(h,_)))return void p.block(()=>T(e,"$ref",_.all.$ref.definition));function b(i){(0,a.shouldUseGroup)(h,i)&&(i.type?(p.if((0,n.checkDataType)(i.type,m,g.strictNumbers)),k(e,i),1===t.length&&t[0]===i.type&&r&&(p.else(),(0,n.reportTypeError)(e)),p.endIf()):k(e,i),y||p.if((0,c._)`${d.default.errors} === ${s||0}`))}g.jtd||(i=e,o=t,!i.schemaEnv.meta&&i.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{E(e.dataTypes,t)||x(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let s of e.dataTypes)E(t,s)?r.push(s):t.includes("integer")&&"number"===s&&r.push("integer");e.dataTypes=r}(e,t)}}(i,o),i.opts.allowUnionTypes||(l=i,(u=o).length>1&&!(2===u.length&&u.includes("null"))&&x(l,"use allowUnionTypes to allow union type keyword")),function(e,t){let r=e.self.RULES.all;for(let s in r){let i=r[s];if("object"==typeof i&&(0,a.shouldUseRule)(e.schema,i)){let{type:r}=i.definition;r.length&&!r.some(e=>{var r,s;return r=t,s=e,r.includes(s)||"number"===s&&r.includes("integer")})&&x(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}(i,i.dataTypes))),p.block(()=>{for(let e of _.rules)b(e);b(_.post)})}function k(e,t){let{gen:r,schema:s,opts:{useDefaults:i}}=e;i&&(0,o.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,a.shouldUseRule)(s,r)&&T(e,r.keyword,r.definition,t.type)})}function E(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function x(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){v(e)&&(_(e),g(e))?function(e){let{schema:t,opts:r,gen:s}=e;m(e,()=>{r.$comment&&t.$comment&&w(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(d.default.vErrors,null),s.let(d.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,c._)`${r}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}(e),b(e),function(e){let{gen:t,schemaEnv:r,validateName:s,ValidationError:i,opts:a}=e;r.$async?t.if((0,c._)`${d.default.errors} === 0`,()=>t.return(d.default.data),()=>t.throw((0,c._)`new ${i}(${d.default.vErrors})`)):(t.assign((0,c._)`${s}.errors`,d.default.vErrors),a.unevaluated&&function({gen:e,evaluated:t,props:r,items:s}){r instanceof c.Name&&e.assign((0,c._)`${t}.props`,r),s instanceof c.Name&&e.assign((0,c._)`${t}.items`,s)}(e),t.return((0,c._)`${d.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,s.topBoolOrEmptySchema)(e))};class S{constructor(e,t,r){if((0,l.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",O(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,r){this.failResult((0,c.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=c.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:r,schemaCode:s,schemaType:i,def:a}=this;r.if((0,c.or)((0,c._)`${s} === undefined`,t)),e!==c.nil&&r.assign(e,!0),(i.length||a.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:s,it:i}=this;return(0,c.or)(function(){if(r.length){if(!(t instanceof c.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,c._)`${(0,n.checkDataTypes)(e,t,i.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}(),function(){if(s.validateSchema){let r=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,c._)`!${r}(${t})`}return c.nil}())}subschema(e,t){let r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e),(0,u.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return!function(e,t){if(v(e)&&(_(e),g(e)))return function(e,t){var r;let s,{schema:i,gen:a,opts:n}=e;n.$comment&&i.$comment&&w(e),(s=(r=e).schema[r.opts.schemaId])&&(r.baseId=(0,p.resolveUrl)(r.opts.uriResolver,r.baseId,s)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let o=a.const("_errs",d.default.errors);b(e,o),a.var(t,(0,c._)`${o} === ${d.default.errors}`)}(e,t);(0,s.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){let{it:r,gen:s}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=f.mergeEvaluated.props(s,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=f.mergeEvaluated.items(s,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:s}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return s.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}}function T(e,t,r,s){let i=new S(e,r,t);"code"in r?r.code(i,s):i.$data&&r.validate?(0,l.funcKeywordCode)(i,r):"macro"in r?(0,l.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,l.funcKeywordCode)(i,r)}t.KeywordCxt=S;let P=/^\/(?:[^~]|~0|~1)*$/,I=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let i,a;if(""===e)return d.default.rootData;if("/"===e[0]){if(!P.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=d.default.rootData}else{let n=I.exec(e);if(!n)throw Error(`Invalid JSON-pointer: ${e}`);let l=+n[1];if("#"===(i=n[2])){if(l>=t)throw Error(o("property/index",l));return s[t-l]}if(l>t)throw Error(o("data",l));if(a=r[t-l],!i)return a}let n=a;for(let e of i.split("/"))e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,f.unescapeJsonPointer)(e))}`,n=(0,c._)`${n} && ${a}`);return n;function o(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=O},9820(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let s=r(8994),i=r(6660),a=r(4954),n=r(8425);function o(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,s._)`${i.parentData}[${i.parentDataProperty}]`))}function l(e,t,r){if(void 0===r)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}t.macroKeywordCode=function(e,t){let{gen:r,keyword:i,schema:a,parentSchema:n,it:o}=e,u=t.macro.call(o.self,a,n,o),c=l(r,i,u);!1!==o.opts.validateSchema&&o.self.validateSchema(u,!0);let d=r.name("valid");e.subschema({schema:u,schemaPath:s.nil,errSchemaPath:`${o.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;let{gen:u,keyword:c,schema:d,parentSchema:p,$data:f,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(h,t);let m=l(u,c,!f&&t.compile?t.compile.call(h.self,d,p,h):t.validate),y=u.let("valid");function g(r=t.async?(0,s._)`await `:s.nil){let n=h.opts.passContext?i.default.this:i.default.self,o=!("compile"in t&&!f||!1===t.schema);u.assign(y,(0,s._)`${r}${(0,a.callValidateCode)(e,m,n,o)}`,t.modifying)}function v(e){var r;u.if((0,s.not)(null!=(r=t.valid)?r:y),e)}e.block$data(y,function(){if(!1===t.errors)g(),t.modifying&&o(e),v(()=>e.error());else{let r,a,l=t.async?(r=u.let("ruleErrs",null),u.try(()=>g((0,s._)`await `),e=>u.assign(y,!1).if((0,s._)`${e} instanceof ${h.ValidationError}`,()=>u.assign(r,(0,s._)`${e}.errors`),()=>u.throw(e))),r):(a=(0,s._)`${m}.errors`,u.assign(a,null),g(s.nil),a);t.modifying&&o(e),v(()=>(function(e,t){let{gen:r}=e;r.if((0,s._)`Array.isArray(${t})`,()=>{r.assign(i.default.vErrors,(0,s._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,(0,s._)`${i.default.vErrors}.length`),(0,n.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(r=t.valid)?r:y)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:s},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error("ajv implementation error");let n=i.dependencies;if(null==n?void 0:n.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${n.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${s}": `+r.errorsText(i.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}},3826(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let s=r(8994),i=r(7218);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:a,schemaPath:n,errSchemaPath:o,topSchemaRef:l}){if(void 0!==t&&void 0!==a)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let a=e.schema[t];return void 0===r?{schema:a,schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(r)}`}}if(void 0!==a){if(void 0===n||void 0===o||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:n,topSchemaRef:l,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:a,data:n,dataTypes:o,propertyName:l}){if(void 0!==n&&void 0!==r)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:u}=t;if(void 0!==r){let{errorPath:n,dataPathArr:o,opts:l}=t;c(u.let("data",(0,s._)`${t.data}${(0,s.getProperty)(r)}`,!0)),e.errorPath=(0,s.str)`${n}${(0,i.getErrorPath)(r,a,l.jsPropertySyntax)}`,e.parentDataProperty=(0,s._)`${r}`,e.dataPathArr=[...o,e.parentDataProperty]}function c(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==n&&(c(n instanceof s.Name?n:u.let("data",n,!0)),void 0!==l&&(e.propertyName=l)),o&&(e.dataTypes=o)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:i,allErrors:a}){void 0!==s&&(e.compositeRule=s),void 0!==i&&(e.createErrors=i),void 0!==a&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r}},1967(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=r(6023);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var i=r(8994);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});let a=r(4383),n=r(4220),o=r(6247),l=r(1688),u=r(8994),c=r(9008),d=r(6419),p=r(7218),f=r(114),h=r(8951),m=(e,t)=>new RegExp(e,t);m.code="new RegExp";let y=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,s,i,a,n,o,l,u,c,d,p,f,y,g,v,_,b,w,$,k,E,x,S,T;let P=e.strict,I=null==(t=e.code)?void 0:t.optimize,O=!0===I||void 0===I?1:I||0,j=null!=(s=null==(r=e.code)?void 0:r.regExp)?s:m,R=null!=(i=e.uriResolver)?i:h.default;return{strictSchema:null==(n=null!=(a=e.strictSchema)?a:P)||n,strictNumbers:null==(l=null!=(o=e.strictNumbers)?o:P)||l,strictTypes:null!=(c=null!=(u=e.strictTypes)?u:P)?c:"log",strictTuples:null!=(p=null!=(d=e.strictTuples)?d:P)?p:"log",strictRequired:null!=(y=null!=(f=e.strictRequired)?f:P)&&y,code:e.code?{...e.code,optimize:O,regExp:j}:{optimize:O,regExp:j},loopRequired:null!=(g=e.loopRequired)?g:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(w=e.inlineRefs)||w,schemaId:null!=($=e.schemaId)?$:"$id",addUsedSchema:null==(k=e.addUsedSchema)||k,validateSchema:null==(E=e.validateSchema)||E,validateFormats:null==(x=e.validateFormats)||x,unicodeRegExp:null==(S=e.unicodeRegExp)||S,int32range:null==(T=e.int32range)||T,uriResolver:R}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:g,es5:t,lines:r}),this.logger=function(e){if(!1===e)return T;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,v,e,"NOT SUPPORTED"),w.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&x.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),k.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,s=f;"id"===r&&((s={...f}).id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let s=r(t);return"$async"in r||(this.errors=r.errors),s}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return s.call(this,e,t);async function s(e,t){await i.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await s.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return o.call(this,t),await l.call(this,t.missingSchema),a.call(this,e)}}function o({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await u.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){let i;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,s);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(i=e[t])&&"string"!=typeof i)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,s,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(r,e);if(!s&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,s=new l.SchemaEnv({schema:{},schemaId:r});if(!(t=l.resolveSchema.call(this,s,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,c.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(I.call(this,r,t),!t)return(0,p.eachItem)(r,e=>O.call(this,e)),this;R.call(this,t);let s={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,p.eachItem)(r,0===s.type.length?e=>O.call(this,e,s):e=>s.type.forEach(t=>O.call(this,e,s,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let s of(e=JSON.parse(JSON.stringify(e)),t)){let t=s.split("/").slice(1),i=e;for(let e of t)i=i[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:s}=t.definition,a=i[e];s&&a&&(i[e]=A(a))}}return e}_removeAllSchemas(e,t){for(let r in e){let s=e[r];(!t||t.test(r))&&("string"==typeof s?delete e[r]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[r]))}}_addSchema(e,t,r,s=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:n}=this.opts;if("object"==typeof e)a=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let o=this._cache.get(e);if(void 0!==o)return o;r=(0,c.normalizeId)(a||r);let u=c.getSchemaRefs.call(this,e,r);return o=new l.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:u}),this._cache.set(o.schema,o),i&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=o),s&&this.validateSchema(e,!0),o}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,s="error"){for(let i in e)i in t&&this.logger[s](`${r}: option ${i}. ${e[i]}`)}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function k(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function E(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function x(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function S(){let e={...this.opts};for(let t of y)delete e[t];return e}b.ValidationError=a.default,b.MissingRefError=n.default,t.default=b;let T={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function I(e,t){let{RULES:r}=this;if((0,p.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!P.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function O(e,t,r){var s;let i=null==t?void 0:t.post;if(r&&i)throw Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,n=i?a.post:a.rules.find(({type:e})=>e===r);if(n||(n={type:r,rules:[]},a.rules.push(n)),a.keywords[e]=!0,!t)return;let o={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?j.call(this,n,o,t.before):n.rules.push(o),a.all[e]=o,null==(s=t.implements)||s.forEach(e=>this.addKeyword(e))}function j(e,t,r){let s=e.rules.findIndex(e=>e.keyword===r);s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=A(t)),e.validateSchema=this.compile(t,!0))}let N={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function A(e){return{anyOf:[e,N]}}},6013(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7371);s.code='require("ajv/dist/runtime/equal").default',t.default=s},5532(e,t){"use strict";function r(e){let t,r=e.length,s=0,i=0;for(;i<r;)s++,(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r&&(64512&(t=e.charCodeAt(i)))==56320&&i++;return s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},8951(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(5019);s.code='require("ajv/dist/runtime/uri").default',t.default=s},4383(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}},714(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let s=r(8994),i=r(7218);function a(e,t){let{gen:r,schema:a,data:n,keyword:o,it:l}=e;l.items=!0;let u=r.const("len",(0,s._)`${n}.length`);if(!1===a)e.setParams({len:t.length}),e.pass((0,s._)`${u} <= ${t.length}`);else if("object"==typeof a&&!(0,i.alwaysValidSchema)(l,a)){let a=r.var("valid",(0,s._)`${u} <= ${t.length}`);r.if((0,s.not)(a),()=>{var n;return n=a,void r.forRange("i",t.length,u,t=>{e.subschema({keyword:o,dataProp:t,dataPropType:i.Type.Num},n),l.allErrors||r.if((0,s.not)(n),()=>r.break())})}),e.ok(a)}}t.validateAdditionalItems=a,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:s}=t;Array.isArray(s)?a(e,s):(0,i.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}}},8401(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(8994),a=r(6660),n=r(7218);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,i._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:r,parentSchema:o,data:l,errsCount:u,it:c}=e;if(!u)throw Error("ajv implementation error");let{allErrors:d,opts:p}=c;if(c.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(c,r))return;let f=(0,s.allSchemaProperties)(o.properties),h=(0,s.allSchemaProperties)(o.patternProperties);function m(e){t.code((0,i._)`delete ${l}[${e}]`)}function y(s){if("all"===p.removeAdditional||p.removeAdditional&&!1===r)return void m(s);if(!1===r){e.setParams({additionalProperty:s}),e.error(),d||t.break();return}if("object"==typeof r&&!(0,n.alwaysValidSchema)(c,r)){let r=t.name("valid");"failing"===p.removeAdditional?(g(s,r,!1),t.if((0,i.not)(r),()=>{e.reset(),m(s)})):(g(s,r),d||t.if((0,i.not)(r),()=>t.break()))}}function g(t,r,s){let i={keyword:"additionalProperties",dataProp:t,dataPropType:n.Type.Str};!1===s&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,r)}t.forIn("key",l,r=>{f.length||h.length?t.if(function(r){let a;if(f.length>8){let e=(0,n.schemaRefOrVal)(c,o.properties,"properties");a=(0,s.isOwnProperty)(t,e,r)}else a=f.length?(0,i.or)(...f.map(e=>(0,i._)`${r} === ${e}`)):i.nil;return h.length&&(a=(0,i.or)(a,...h.map(t=>(0,i._)`${(0,s.usePattern)(e,t)}.test(${r})`))),(0,i.not)(a)}(r),()=>y(r)):y(r)}),e.ok((0,i._)`${u} === ${a.default.errors}`)}}},2003(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let a=t.name("valid");r.forEach((t,r)=>{if((0,s.alwaysValidSchema)(i,t))return;let n=e.subschema({keyword:"allOf",schemaProp:r},a);e.ok(a),e.mergeEvaluated(n)})}}},1070(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(4954).validateUnion,error:{message:"must match a schema in anyOf"}}},2692(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,s.str)`must contain at least ${e} valid item(s)`:(0,s.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,s._)`{minContains: ${e}}`:(0,s._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,r,{gen:a,schema:n,parentSchema:o,data:l,it:u}=e,{minContains:c,maxContains:d}=o;u.opts.next?(t=void 0===c?1:c,r=d):t=1;let p=a.const("len",(0,s._)`${l}.length`);if(e.setParams({min:t,max:r}),void 0===r&&0===t)return void(0,i.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==r&&t>r){(0,i.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,i.alwaysValidSchema)(u,n)){let i=(0,s._)`${p} >= ${t}`;void 0!==r&&(i=(0,s._)`${i} && ${p} <= ${r}`),e.pass(i);return}u.items=!0;let f=a.name("valid");function h(){let e=a.name("_valid"),i=a.let("count",0);m(e,()=>a.if(e,()=>{var e;return e=i,void(a.code((0,s._)`${e}++`),void 0===r?a.if((0,s._)`${e} >= ${t}`,()=>a.assign(f,!0).break()):(a.if((0,s._)`${e} > ${r}`,()=>a.assign(f,!1).break()),1===t?a.assign(f,!0):a.if((0,s._)`${e} >= ${t}`,()=>a.assign(f,!0))))}))}function m(t,r){a.forRange("i",0,p,s=>{e.subschema({keyword:"contains",dataProp:s,dataPropType:i.Type.Num,compositeRule:!0},t),r()})}void 0===r&&1===t?m(f,()=>a.if(f,()=>a.break())):0===t?(a.let(f,!0),void 0!==r&&a.if((0,s._)`${l}.length > 0`,h)):(a.let(f,!1),h()),e.result(f,()=>e.reset())}}},5860(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let s=r(8994),i=r(7218),a=r(4954);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>(0,s.str)`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,s._)`{property: ${e},
5
5
  missingProperty: ${i},
6
6
  depsCount: ${t},
7
- deps: ${r}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:r)[s]=e[s]);return[t,r]}(e);o(e,t),l(e,r)}};function o(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(0===Object.keys(t).length)return;let l=r.let("missing");for(let o in t){let u=t[o];if(0===u.length)continue;let c=(0,a.propertyInData)(r,i,o,n.opts.ownProperties);e.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),n.allErrors?r.if(c,()=>{for(let t of u)(0,a.checkReportMissingProp)(e,t)}):(r.if((0,s._)`${c} && (${(0,a.checkMissingProp)(e,u,l)})`),(0,a.reportMissingProp)(e,l),r.else())}}function l(e,t=e.schema){let{gen:r,data:s,keyword:n,it:o}=e,u=r.name("valid");for(let l in t)(0,i.alwaysValidSchema)(o,t[l])||(r.if((0,a.propertyInData)(r,s,l,o.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:l},u);e.mergeValidEvaluated(t,u)},()=>r.var(u,!0)),e.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=l,t.default=n},9352(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512);function a(e,t){let r=e.schema[t];return void 0!==r&&!(0,i.alwaysValidSchema)(e,r)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,s.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,s._)`{failingKeyword: ${e.ifClause}}`},code(e){let t,{gen:r,parentSchema:n,it:o}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let l=a(o,"then"),u=a(o,"else");if(!l&&!u)return;let c=r.let("valid",!0),d=r.name("_valid");if(t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(t),e.reset(),l&&u){let t=r.let("ifClause");e.setParams({ifClause:t}),r.if(d,p("then",t),p("else",t))}else l?r.if(d,p("then")):r.if((0,s.not)(d),p("else"));function p(t,i){return()=>{let a=e.subschema({keyword:t},d);r.assign(c,d),e.mergeValidEvaluated(a,c),i?r.assign(i,(0,s._)`${t}`):e.setParams({ifClause:t})}}e.pass(c,()=>e.error(!0))}}},3591(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8440),i=r(9315),a=r(9135),n=r(6447),o=r(5078),l=r(7394),u=r(508),c=r(3439),d=r(3210),p=r(9880),f=r(3278),h=r(5988),m=r(4218),y=r(4741),g=r(9352),v=r(925);t.default=function(e=!1){let t=[f.default,h.default,m.default,y.default,g.default,v.default,u.default,c.default,l.default,d.default,p.default];return e?t.push(i.default,n.default):t.push(s.default,a.default),t.push(o.default),t}},9135(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let s=r(6556),i=r(8512),a=r(3716);function n(e,t,r=e.schema){let{gen:a,parentSchema:o,data:l,keyword:u,it:c}=e;(function(e){let{opts:s,errSchemaPath:a}=c,n=r.length,o=n===e.minItems&&(n===e.maxItems||!1===e[t]);if(s.strictTuples&&!o){let e=`"${u}" is ${n}-tuple, but minItems or maxItems/${t} are not specified or different at path "${a}"`;(0,i.checkStrictMode)(c,e,s.strictTuples)}})(o),c.opts.unevaluated&&r.length&&!0!==c.items&&(c.items=i.mergeEvaluated.items(a,r.length,c.items));let d=a.name("valid"),p=a.const("len",(0,s._)`${l}.length`);r.forEach((t,r)=>{(0,i.alwaysValidSchema)(c,t)||(a.if((0,s._)`${p} > ${r}`,()=>e.subschema({keyword:u,schemaProp:r,dataProp:r},d)),e.ok(d))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return n(e,"additionalItems",t);r.items=!0,(0,i.alwaysValidSchema)(r,t)||e.ok((0,a.validateArray)(e))}}},6447(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512),a=r(3716),n=r(8440);t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:r,it:s}=e,{prefixItems:o}=r;s.items=!0,(0,i.alwaysValidSchema)(s,t)||(o?(0,n.validateAdditionalItems)(e,o):e.ok((0,a.validateArray)(e)))}}},3278(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8512);t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,s.alwaysValidSchema)(i,r))return void e.fail();let a=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}},4218(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512);t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:t,schema:r,parentSchema:a,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&a.discriminator)return;let o=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block(function(){r.forEach((r,a)=>{let c;(0,i.alwaysValidSchema)(n,r)?t.var(u,!0):c=e.subschema({keyword:"oneOf",schemaProp:a,compositeRule:!0},u),a>0&&t.if((0,s._)`${u} && ${o}`).assign(o,!1).assign(l,(0,s._)`[${l}, ${a}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(l,a),c&&e.mergeEvaluated(c,s.Name)})})}),e.result(o,()=>e.reset(),()=>e.error(!0))}}},9880(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3716),i=r(6556),a=r(8512),n=r(8512);t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:l,it:u}=e,{opts:c}=u,d=(0,s.allSchemaProperties)(r),p=d.filter(e=>(0,a.alwaysValidSchema)(u,r[e]));if(0===d.length||p.length===d.length&&(!u.opts.unevaluated||!0===u.props))return;let f=c.strictSchema&&!c.allowMatchingProperties&&l.properties,h=t.name("valid");!0===u.props||u.props instanceof i.Name||(u.props=(0,n.evaluatedPropsToName)(t,u.props));let{props:m}=u;for(let e of d)f&&function(e){for(let t in f)new RegExp(e).test(t)&&(0,a.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),u.allErrors?y(e):(t.var(h,!0),y(e),t.if(h));function y(r){t.forIn("key",o,a=>{t.if((0,i._)`${(0,s.usePattern)(e,r)}.test(${a})`,()=>{let s=p.includes(r);s||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:a,dataPropType:n.Type.Str},h),u.opts.unevaluated&&!0!==m?t.assign((0,i._)`${m}[${a}]`,!0):s||u.allErrors||t.if((0,i.not)(h),()=>t.break())})})}}}},9315(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(9135);t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")}},3210(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6889),i=r(3716),a=r(8512),n=r(3439);t.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:l,it:u}=e;"all"===u.opts.removeAdditional&&void 0===o.additionalProperties&&n.default.code(new s.KeywordCxt(u,n.default,"additionalProperties"));let c=(0,i.allSchemaProperties)(r);for(let e of c)u.definedProperties.add(e);u.opts.unevaluated&&c.length&&!0!==u.props&&(u.props=a.mergeEvaluated.props(t,(0,a.toHash)(c),u.props));let d=c.filter(e=>!(0,a.alwaysValidSchema)(u,r[e]));if(0===d.length)return;let p=t.name("valid");for(let s of d){var f;(f=s,u.opts.useDefaults&&!u.compositeRule&&void 0!==r[f].default)?h(s):(t.if((0,i.propertyInData)(t,l,s,u.opts.ownProperties)),h(s),u.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(s),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}},508(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512);t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,s._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:t,schema:r,data:a,it:n}=e;if((0,i.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",a,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),t.if((0,s.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}}},925(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8512);t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}},3716(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let s=r(6556),i=r(8512),a=r(4614),n=r(8512);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,s._)`Object.prototype.hasOwnProperty`})}function l(e,t,r){return(0,s._)`${o(e)}.call(${t}, ${r})`}function u(e,t,r,i){let a=(0,s._)`${t}${(0,s.getProperty)(r)} === undefined`;return i?(0,s.or)(a,(0,s.not)(l(e,t,r))):a}function c(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}t.checkReportMissingProp=function(e,t){let{gen:r,data:i,it:a}=e;r.if(u(r,i,t,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,s._)`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},i,a){return(0,s.or)(...i.map(i=>(0,s.and)(u(e,t,i,r.ownProperties),(0,s._)`${a} = ${i}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=l,t.propertyInData=function(e,t,r,i){let a=(0,s._)`${t}${(0,s.getProperty)(r)} !== undefined`;return i?(0,s._)`${a} && ${l(e,t,r)}`:a},t.noPropertyInData=u,t.allSchemaProperties=c,t.schemaProperties=function(e,t){return c(t).filter(r=>!(0,i.alwaysValidSchema)(e,t[r]))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:l},u,c,d){let p=d?(0,s._)`${e}, ${t}, ${i}${n}`:t,f=[[a.default.instancePath,(0,s.strConcat)(a.default.instancePath,o)],[a.default.parentData,l.parentData],[a.default.parentDataProperty,l.parentDataProperty],[a.default.rootData,a.default.rootData]];l.opts.dynamicRef&&f.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);let h=(0,s._)`${p}, ${r.object(...f)}`;return c!==s.nil?(0,s._)`${u}.call(${c}, ${h})`:(0,s._)`${u}(${h})`};let d=(0,s._)`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:a}=t.code,o=a(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,s._)`${"new RegExp"===a.code?d:(0,n.useFunc)(e,a)}(${r}, ${i})`})},t.validateArray=function(e){let{gen:t,data:r,keyword:a,it:n}=e,o=t.name("valid");if(n.allErrors){let e=t.let("valid",!0);return l(()=>t.assign(e,!1)),e}return t.var(o,!0),l(()=>t.break()),o;function l(n){let l=t.const("len",(0,s._)`${r}.length`);t.forRange("i",0,l,r=>{e.subschema({keyword:a,dataProp:r,dataPropType:i.Type.Num},o),t.if((0,s.not)(o),n)})}},t.validateUnion=function(e){let{gen:t,schema:r,keyword:a,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(e=>(0,i.alwaysValidSchema)(n,e))&&!n.opts.unevaluated)return;let o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((r,i)=>{let n=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},l);t.assign(o,(0,s._)`${o} || ${l}`),e.mergeValidEvaluated(n,l)||t.if((0,s.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}},6464(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}},5861(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6464),i=r(5140);t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,i.default]},5140(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let s=r(218),i=r(3716),a=r(6556),n=r(4614),o=r(9198),l=r(8512);function u(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,a._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function c(e,t,r,s){let{gen:o,it:u}=e,{allErrors:c,schemaEnv:d,opts:p}=u,f=p.passContext?n.default.this:a.nil;function h(e){let t=(0,a._)`${e}.errors`;o.assign(n.default.vErrors,(0,a._)`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),o.assign(n.default.errors,(0,a._)`${n.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;let s=null==(t=null==r?void 0:r.validate)?void 0:t.evaluated;if(!0!==u.props)if(s&&!s.dynamicProps)void 0!==s.props&&(u.props=l.mergeEvaluated.props(o,s.props,u.props));else{let t=o.var("props",(0,a._)`${e}.evaluated.props`);u.props=l.mergeEvaluated.props(o,t,u.props,a.Name)}if(!0!==u.items)if(s&&!s.dynamicItems)void 0!==s.items&&(u.items=l.mergeEvaluated.items(o,s.items,u.items));else{let t=o.var("items",(0,a._)`${e}.evaluated.items`);u.items=l.mergeEvaluated.items(o,t,u.items,a.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let r=o.let("valid");o.try(()=>{o.code((0,a._)`await ${(0,i.callValidateCode)(e,t,f)}`),m(t),c||o.assign(r,!0)},e=>{o.if((0,a._)`!(${e} instanceof ${u.ValidationError})`,()=>o.throw(e)),h(e),c||o.assign(r,!1)}),e.ok(r)}():e.result((0,i.callValidateCode)(e,t,f),()=>m(t),()=>h(t))}t.getValidate=u,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(e){var t,r;let i,n,l,d,{gen:p,schema:f,it:h}=e,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===f||"#/"===f)&&m===b.baseId){if(y===b)return c(e,g,y,y.$async);let t=p.scopeValue("root",{ref:b});return c(e,(0,a._)`${t}.validate`,b,b.$async)}let w=o.resolveRef.call(_,b,m,f);if(void 0===w)throw new s.default(h.opts.uriResolver,m,f);return w instanceof o.SchemaEnv?(i=u(e,t=w),void c(e,i,t,t.$async)):(r=w,n=p.scopeValue("schema",!0===v.code.source?{ref:r,code:(0,a.stringify)(r)}:{ref:r}),l=p.name("valid"),d=e.subschema({schema:r,dataTypes:[],schemaPath:a.nil,topSchemaRef:n,errSchemaPath:f},l),void(e.mergeEvaluated(d),e.ok(l)))}}},2278(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(1403),a=r(9198),n=r(218),o=r(8512);t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,s._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){let{gen:t,data:r,schema:l,parentSchema:u,it:c}=e,{oneOf:d}=u;if(!c.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let f=t.let("valid",!1),h=t.const("tag",(0,s._)`${r}${(0,s.getProperty)(p)}`);t.if((0,s._)`typeof ${h} == "string"`,()=>(function(){let r=function(){var e;let t={},r=i(u),s=!0;for(let t=0;t<d.length;t++){let u=d[t];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,c.self.RULES)){let e=u.$ref;if((u=a.resolveRef.call(c.self,c.schemaEnv.root,c.baseId,e))instanceof a.SchemaEnv&&(u=u.schema),void 0===u)throw new n.default(c.opts.uriResolver,c.baseId,e)}let f=null==(e=null==u?void 0:u.properties)?void 0:e[p];if("object"!=typeof f)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||i(u)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(f,t)}if(!s)throw Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let i in t.if(!1),r)t.elseIf((0,s._)`${h} === ${i}`),t.assign(f,function(r){let i=t.name("valid"),a=e.subschema({keyword:"oneOf",schemaProp:r},i);return e.mergeEvaluated(a,s.Name),i}(r[i]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:h,tagName:p}),t.endIf()})(),()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:h,tagName:p})),e.ok(f)}}},1403(e,t){"use strict";var r,s;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(s=r||(t.DiscrError=r={})).Tag="tag",s.Mapping="mapping"},8181(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(5861),i=r(4057),a=r(3591),n=r(9961),o=r(6780);t.default=[s.default,i.default,(0,a.default)(),n.default,o.metadataVocabulary,o.contentVocabulary]},2898(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556);t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,s._)`{format: ${e}}`},code(e,t){let r,i,a,n,o,l,{gen:u,data:c,$data:d,schema:p,schemaCode:f,it:h}=e,{opts:m,errSchemaPath:y,schemaEnv:g,self:v}=h;m.validateFormats&&(d?(r=u.scopeValue("formats",{ref:v.formats,code:m.code.formats}),i=u.const("fDef",(0,s._)`${r}[${f}]`),a=u.let("fType"),n=u.let("format"),u.if((0,s._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(a,(0,s._)`${i}.type || "string"`).assign(n,(0,s._)`${i}.validate`),()=>u.assign(a,(0,s._)`"string"`).assign(n,i)),e.fail$data((0,s.or)(!1===m.strictSchema?s.nil:(0,s._)`${f} && !${n}`,(o=g.$async?(0,s._)`(${i}.async ? await ${n}(${c}) : ${n}(${c}))`:(0,s._)`${n}(${c})`,l=(0,s._)`(typeof ${n} == "function" ? ${o} : ${n}.test(${c}))`,(0,s._)`${n} && ${n} !== true && ${a} === ${t} && !${l}`)))):function(){var r;let i,a,n=v.formats[p];if(!n){if(!1===m.strictSchema)return v.logger.warn(o());throw Error(o());function o(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===n)return;let[l,d,f]=(i=(r=n)instanceof RegExp?(0,s.regexpCode)(r):m.code.formats?(0,s._)`${m.code.formats}${(0,s.getProperty)(p)}`:void 0,a=u.scopeValue("formats",{key:p,ref:r,code:i}),"object"!=typeof r||r instanceof RegExp?["string",r,a]:[r.type||"string",r.validate,(0,s._)`${a}.validate`]);l===t&&e.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!g.$async)throw Error("async format in sync schema");return(0,s._)`await ${f}(${c})`}return"function"==typeof d?(0,s._)`${f}(${c})`:(0,s._)`${f}.test(${c})`}())}())}}},9961(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[r(2898).default]},6780(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},8762(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512),a=r(6935);t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,s._)`{allowedValue: ${e}}`},code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:l}=e;n||l&&"object"==typeof l?e.fail$data((0,s._)`!${(0,i.useFunc)(t,a.default)}(${r}, ${o})`):e.fail((0,s._)`${l} !== ${r}`)}}},5344(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512),a=r(6935);t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,s._)`{allowedValues: ${e}}`},code(e){let t,r,{gen:n,data:o,$data:l,schema:u,schemaCode:c,it:d}=e;if(!l&&0===u.length)throw Error("enum must have non-empty array");let p=u.length>=d.opts.loopEnum,f=()=>null!=t?t:t=(0,i.useFunc)(n,a.default);if(p||l)r=n.let("valid"),e.block$data(r,function(){n.assign(r,!1),n.forOf("v",c,e=>n.if((0,s._)`${f()}(${o}, ${e})`,()=>n.assign(r,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let e=n.const("vSchema",c);r=(0,s.or)(...u.map((t,r)=>{var i,a;let n;return i=e,"object"==typeof(n=u[a=r])&&null!==n?(0,s._)`${f()}(${o}, ${i}[${a}])`:(0,s._)`${o} === ${n}`}))}e.pass(r)}}},4057(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(5579),i=r(9812),a=r(1378),n=r(647),o=r(8079),l=r(9240),u=r(1128),c=r(1628),d=r(8762),p=r(5344);t.default=[s.default,i.default,a.default,n.default,o.default,l.default,u.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,p.default]},1128(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556);t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,a="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`${r}.length ${a} ${i}`)}}},1378(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=r(8512),a=r(5014);t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,l="maxLength"===t?s.operators.GT:s.operators.LT,u=!1===o.opts.unicode?(0,s._)`${r}.length`:(0,s._)`${(0,i.useFunc)(e.gen,a.default)}(${r})`;e.fail$data((0,s._)`${u} ${l} ${n}`)}}},5579(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556),i=s.operators,a={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.default={keyword:Object.keys(a),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must be ${a[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${a[e].okStr}, limit: ${t}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,s._)`${r} ${a[t].fail} ${i} || isNaN(${r})`)}}},8079(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556);t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,a="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`Object.keys(${r}).length ${a} ${i}`)}}},9812(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6556);t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,s._)`{multipleOf: ${e}}`},code(e){let{gen:t,data:r,schemaCode:i,it:a}=e,n=a.opts.multipleOfPrecision,o=t.let("res"),l=n?(0,s._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${n}`:(0,s._)`${o} !== parseInt(${o})`;e.fail$data((0,s._)`(${i} === 0 || (${o} = ${r}/${i}, ${l}))`)}}},647(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3716),i=r(6556);t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,i.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,i._)`{pattern: ${e}}`},code(e){let{data:t,$data:r,schema:a,schemaCode:n,it:o}=e,l=o.opts.unicodeRegExp?"u":"",u=r?(0,i._)`(new RegExp(${n}, ${l}))`:(0,s.usePattern)(e,a);e.fail$data((0,i._)`!${u}.test(${t})`)}}},9240(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3716),i=r(6556),a=r(8512);t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,i.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,i._)`{missingProperty: ${e}}`},code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:l,it:u}=e,{opts:c}=u;if(!l&&0===r.length)return;let d=r.length>=c.loopRequired;if(u.allErrors?function(){if(d||l)e.block$data(i.nil,p);else for(let t of r)(0,s.checkReportMissingProp)(e,t)}():function(){let a=t.let("missing");if(d||l){let r=t.let("valid",!0);e.block$data(r,()=>{var l,u;return l=a,u=r,void(e.setParams({missingProperty:l}),t.forOf(l,n,()=>{t.assign(u,(0,s.propertyInData)(t,o,l,c.ownProperties)),t.if((0,i.not)(u),()=>{e.error(),t.break()})},i.nil))}),e.ok(r)}else t.if((0,s.checkMissingProp)(e,r,a)),(0,s.reportMissingProp)(e,a),t.else()}(),c.strictRequired){let t=e.parentSchema.properties,{definedProperties:s}=e.it;for(let e of r)if((null==t?void 0:t[e])===void 0&&!s.has(e)){let t=u.schemaEnv.baseId+u.errSchemaPath,r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,a.checkStrictMode)(u,r,u.opts.strictRequired)}}function p(){t.forOf("prop",n,r=>{e.setParams({missingProperty:r}),t.if((0,s.noPropertyInData)(t,o,r,c.ownProperties),()=>e.error())})}}}},1628(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4029),i=r(6556),a=r(8512),n=r(6935);t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,i.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,i._)`{i: ${e}, j: ${t}}`},code(e){let{gen:t,data:r,$data:o,schema:l,parentSchema:u,schemaCode:c,it:d}=e;if(!o&&!l)return;let p=t.let("valid"),f=u.items?(0,s.getSchemaTypes)(u.items):[];e.block$data(p,function(){let o=t.let("i",(0,i._)`${r}.length`),l=t.let("j");e.setParams({i:o,j:l}),t.assign(p,!0),t.if((0,i._)`${o} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?function(a,n){let o=t.name("item"),l=(0,s.checkDataTypes)(f,o,d.opts.strictNumbers,s.DataType.Wrong),u=t.const("indices",(0,i._)`{}`);t.for((0,i._)`;${a}--;`,()=>{t.let(o,(0,i._)`${r}[${a}]`),t.if(l,(0,i._)`continue`),f.length>1&&t.if((0,i._)`typeof ${o} == "string"`,(0,i._)`${o} += "_"`),t.if((0,i._)`typeof ${u}[${o}] == "number"`,()=>{t.assign(n,(0,i._)`${u}[${o}]`),e.error(),t.assign(p,!1).break()}).code((0,i._)`${u}[${o}] = ${a}`)})}:function(s,o){let l=(0,a.useFunc)(t,n.default),u=t.name("outer");t.label(u).for((0,i._)`;${s}--;`,()=>t.for((0,i._)`${o} = ${s}; ${o}--;`,()=>t.if((0,i._)`${l}(${r}[${s}], ${r}[${o}])`,()=>{e.error(),t.assign(p,!1).break(u)})))})(o,l))},(0,i._)`${c} === false`),e.ok(p)}}},9454(e,t,r){"use strict";var s=r(181).Buffer,i=r(181).SlowBuffer;function a(e,t){if(!s.isBuffer(e)||!s.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}e.exports=a,a.install=function(){s.prototype.equal=i.prototype.equal=function(e){return a(this,e)}};var n=s.prototype.equal,o=i.prototype.equal;a.restore=function(){s.prototype.equal=n,i.prototype.equal=o}},6507(e,t,r){"use strict";let s=r(5317),i=r(8388),a=r(442);function n(e,t,r){let n=i(e,t,r),o=s.spawn(n.command,n.args,n.options);return a.hookChildProcess(o,n),o}e.exports=n,e.exports.spawn=n,e.exports.sync=function(e,t,r){let n=i(e,t,r),o=s.spawnSync(n.command,n.args,n.options);return o.error=o.error||a.verifyENOENTSync(o.status,n),o},e.exports._parse=i,e.exports._enoent=a},442(e){"use strict";let t="win32"===process.platform;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function s(e,s){return t&&1===e&&!s.file?r(s.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;let i=e.emit;e.emit=function(t,a){if("exit"===t){let t=s(a,r);if(t)return i.call(e,"error",t)}return i.apply(e,arguments)}},verifyENOENT:s,verifyENOENTSync:function(e,s){return t&&1===e&&!s.file?r(s.original,"spawnSync"):null},notFoundError:r}},8388(e,t,r){"use strict";let s=r(6928),i=r(3803),a=r(2077),n=r(1880),o="win32"===process.platform,l=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);let c={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?c:function(e){let t;if(!o)return e;let r=(e.file=i(e),(t=e.file&&n(e.file))?(e.args.unshift(e.file),e.command=t,i(e)):e.file),c=!l.test(r);if(e.options.forceShell||c){let t=u.test(r);e.command=s.normalize(e.command),e.command=a.command(e.command),e.args=e.args.map(e=>a.argument(e,t));let i=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${i}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(c)}},2077(e){"use strict";let t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=(e=`${e}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),e=(e=`"${e}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},1880(e,t,r){"use strict";let s=r(9896),i=r(600);e.exports=function(e){let t,r=Buffer.alloc(150);try{t=s.openSync(e,"r"),s.readSync(t,r,0,150,0),s.closeSync(t)}catch(e){}return i(r.toString())}},3803(e,t,r){"use strict";let s=r(6928),i=r(1905),a=r(9695);function n(e,t){let r,n=e.options.env||process.env,o=process.cwd(),l=null!=e.options.cwd,u=l&&void 0!==process.chdir&&!process.chdir.disabled;if(u)try{process.chdir(e.options.cwd)}catch(e){}try{r=i.sync(e.command,{path:n[a({env:n})],pathExt:t?s.delimiter:void 0})}catch(e){}finally{u&&process.chdir(o)}return r&&(r=s.resolve(l?e.options.cwd:"",r)),r}e.exports=function(e){return n(e)||n(e,!0)}},8583(e,t,r){let s=r(9896),i=r(6928),a=r(857),n=r(6982),o=r(4519).version,l=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(e){console.log(`[dotenv@${o}][DEBUG] ${e}`)}function c(e){console.log(`[dotenv@${o}] ${e}`)}function d(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function p(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)s.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=i.resolve(process.cwd(),".env.vault");return s.existsSync(t)?t:null}function f(e){return"~"===e[0]?i.join(a.homedir(),e.slice(1)):e}let h={configDotenv:function(e){let t,r=i.resolve(process.cwd(),".env"),a="utf8",n=!!(e&&e.debug),o=!e||!("quiet"in e)||e.quiet;e&&e.encoding?a=e.encoding:n&&u("No encoding is specified. UTF-8 is used by default");let l=[r];if(e&&e.path)if(Array.isArray(e.path))for(let t of(l=[],e.path))l.push(f(t));else l=[f(e.path)];let d={};for(let r of l)try{let t=h.parse(s.readFileSync(r,{encoding:a}));h.populate(d,t,e)}catch(e){n&&u(`Failed to load ${r} ${e.message}`),t=e}let p=process.env;if(e&&null!=e.processEnv&&(p=e.processEnv),h.populate(p,d,e),n||!o){let e=Object.keys(d).length,r=[];for(let e of l)try{let t=i.relative(process.cwd(),e);r.push(t)}catch(r){n&&u(`Failed to load ${e} ${r.message}`),t=r}c(`injecting env (${e}) from ${r.join(",")}`)}return t?{parsed:d,error:t}:{parsed:d}},_configVault:function(e){let t=!!(e&&e.debug),r=!e||!("quiet"in e)||e.quiet;(t||!r)&&c("Loading env from encrypted .env.vault");let s=h._parseVault(e),i=process.env;return e&&null!=e.processEnv&&(i=e.processEnv),h.populate(i,s,e),{parsed:s}},_parseVault:function(e){let t,r=p(e=e||{});e.path=r;let s=h.configDotenv(e);if(!s.parsed){let e=Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw e.code="MISSING_DATA",e}let i=d(e).split(","),a=i.length;for(let e=0;e<a;e++)try{let r=i[e].trim(),a=function(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){let e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}let s=r.password;if(!s){let e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}let i=r.searchParams.get("environment");if(!i){let e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}let a=`DOTENV_VAULT_${i.toUpperCase()}`,n=e.parsed[a];if(!n){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:n,key:s}}(s,r);t=h.decrypt(a.ciphertext,a.key);break}catch(t){if(e+1>=a)throw t}return h.parse(t)},config:function(e){if(0===d(e).length)return h.configDotenv(e);let t=p(e);if(!t){var r;return r=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${o}][WARN] ${r}`),h.configDotenv(e)}return h._configVault(e)},decrypt:function(e,t){let r=Buffer.from(t.slice(-64),"hex"),s=Buffer.from(e,"base64"),i=s.subarray(0,12),a=s.subarray(-16);s=s.subarray(12,-16);try{let e=n.createDecipheriv("aes-256-gcm",r,i);return e.setAuthTag(a),`${e.update(s)}${e.final()}`}catch(s){let e=s instanceof RangeError,t="Invalid key length"===s.message,r="Unsupported state or unable to authenticate data"===s.message;if(e||t){let e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){let e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw s}},parse:function(e){let t,r={},s=e.toString();for(s=s.replace(/\r\n?/mg,"\n");null!=(t=l.exec(s));){let e=t[1],s=t[2]||"",i=(s=s.trim())[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(s=(s=s.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),r[e]=s}return r},populate:function(e,t,r={}){let s=!!(r&&r.debug),i=!!(r&&r.override);if("object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===i&&(e[r]=t[r]),s&&(!0===i?u(`"${r}" is already defined and WAS overwritten`):u(`"${r}" is already defined and was NOT overwritten`))):e[r]=t[r]}};e.exports.configDotenv=h.configDotenv,e.exports._configVault=h._configVault,e.exports._parseVault=h._parseVault,e.exports.config=h.config,e.exports.decrypt=h.decrypt,e.exports.parse=h.parse,e.exports.populate=h.populate,e.exports=h},9053(e,t,r){"use strict";var s=r(6608).Buffer,i=r(2188);function a(e){if(s.isBuffer(e))return e;if("string"==typeof e)return s.from(e,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function n(e,t,r){for(var s=0;t+s<r&&0===e[t+s];)++s;return e[t+s]>=128&&--s,s}e.exports={derToJose:function(e,t){e=a(e);var r=i(t),n=r+1,o=e.length,l=0;if(48!==e[l++])throw Error('Could not find expected "seq"');var u=e[l++];if(129===u&&(u=e[l++]),o-l<u)throw Error('"seq" specified length of "'+u+'", only "'+(o-l)+'" remaining');if(2!==e[l++])throw Error('Could not find expected "int" for "r"');var c=e[l++];if(o-l-2<c)throw Error('"r" specified length of "'+c+'", only "'+(o-l-2)+'" available');if(n<c)throw Error('"r" specified length of "'+c+'", max of "'+n+'" is acceptable');var d=l;if(l+=c,2!==e[l++])throw Error('Could not find expected "int" for "s"');var p=e[l++];if(o-l!==p)throw Error('"s" specified length of "'+p+'", expected "'+(o-l)+'"');if(n<p)throw Error('"s" specified length of "'+p+'", max of "'+n+'" is acceptable');var f=l;if((l+=p)!==o)throw Error('Expected to consume entire buffer, but "'+(o-l)+'" bytes remain');var h=r-c,m=r-p,y=s.allocUnsafe(h+c+m+p);for(l=0;l<h;++l)y[l]=0;e.copy(y,l,d+Math.max(-h,0),d+c),l=r;for(var g=l;l<g+m;++l)y[l]=0;return e.copy(y,l,f+Math.max(-m,0),f+p),y=(y=y.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=a(e);var r=i(t),o=e.length;if(o!==2*r)throw TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+o+'"');var l=n(e,0,r),u=n(e,r,e.length),c=r-l,d=r-u,p=2+c+1+1+d,f=p<128,h=s.allocUnsafe((f?2:3)+p),m=0;return h[m++]=48,f?h[m++]=p:(h[m++]=129,h[m++]=255&p),h[m++]=2,h[m++]=c,l<0?(h[m++]=0,m+=e.copy(h,m,0,r)):m+=e.copy(h,m,l,r),h[m++]=2,h[m++]=d,u<0?(h[m++]=0,e.copy(h,m,r)):e.copy(h,m,r+u),h}}},2188(e){"use strict";function t(e){return(e/8|0)+ +(e%8!=0)}var r={ES256:t(256),ES384:t(384),ES512:t(521)};e.exports=function(e){var t=r[e];if(t)return t;throw Error('Unknown algorithm "'+e+'"')}},7371(e){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(i=s;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=s;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=s;0!=i--;){var s,i,a,n=a[i];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}},9344(e,t,r){var s;function i(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(r,s){i(e,t||{},function(e,t){e?s(e):r(t)})})}s(e,t||{},function(e,s){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,s=!1),r(e,s)})}r(9896),s="win32"===process.platform||global.TESTING_WINDOWS?r(8541):r(709),e.exports=i,i.sync=function(e,t){try{return s.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},709(e,t,r){e.exports=i,i.sync=function(e,t){return a(s.statSync(e),t)};var s=r(9896);function i(e,t,r){s.stat(e,function(e,s){r(e,!e&&a(s,t))})}function a(e,t){var r,s,i,a,n,o,l,u,c;return e.isFile()&&(r=e,s=t,i=r.mode,a=r.uid,n=r.gid,o=void 0!==s.uid?s.uid:process.getuid&&process.getuid(),l=void 0!==s.gid?s.gid:process.getgid&&process.getgid(),u=parseInt("100",8),c=parseInt("010",8),i&parseInt("001",8)||i&c&&n===l||i&u&&a===o||i&(u|c)&&0===o)}},8541(e,t,r){e.exports=a,a.sync=function(e,t){return i(s.statSync(e),e,t)};var s=r(9896);function i(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;var s=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!s||-1!==(s=s.split(";")).indexOf(""))return!0;for(var i=0;i<s.length;i++){var a=s[i].toLowerCase();if(a&&t.substr(-a.length).toLowerCase()===a)return!0}return!1}function a(e,t,r){s.stat(e,function(s,a){r(s,!s&&i(a,e,t))})}},205(e){"use strict";var t=e.exports=function(e,r,s){"function"==typeof r&&(s=r,r={});var i="function"==typeof(s=r.cb||s)?s:s.pre||function(){};!function e(r,s,i,a,n,o,l,u,c,d){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var p in s(a,n,o,l,u,c,d),a){var f=a[p];if(Array.isArray(f)){if(p in t.arrayKeywords)for(var h=0;h<f.length;h++)e(r,s,i,f[h],n+"/"+p+"/"+h,o,n,p,a,h)}else if(p in t.propsKeywords){if(f&&"object"==typeof f)for(var m in f)e(r,s,i,f[m],n+"/"+p+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),o,n,p,a,m)}else(p in t.keywords||r.allKeys&&!(p in t.skipKeywords))&&e(r,s,i,f,n+"/"+p,o,n,p,a)}i(a,n,o,l,u,c,d)}}(r,i,s.post||function(){},e,"",e)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},2548(e,t,r){var s=r(3263);e.exports=function(e,t){t=t||{};var r=s.decode(e,t);if(!r)return null;var i=r.payload;if("string"==typeof i)try{var a=JSON.parse(i);null!==a&&"object"==typeof a&&(i=a)}catch(e){}return!0===t.complete?{header:r.header,payload:i,signature:r.signature}:i}},8400(e,t,r){e.exports={decode:r(2548),verify:r(6467),sign:r(9147),JsonWebTokenError:r(1957),NotBeforeError:r(4470),TokenExpiredError:r(7788)}},1957(e){var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},4470(e,t,r){var s=r(1957),i=function(e,t){s.call(this,e),this.name="NotBeforeError",this.date=t};i.prototype=Object.create(s.prototype),i.prototype.constructor=i,e.exports=i},7788(e,t,r){var s=r(1957),i=function(e,t){s.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};i.prototype=Object.create(s.prototype),i.prototype.constructor=i,e.exports=i},5841(e,t,r){e.exports=r(3895).satisfies(process.version,">=15.7.0")},953(e,t,r){e.exports=r(3895).satisfies(process.version,"^6.12.0 || >=8.0.0")},455(e,t,r){e.exports=r(3895).satisfies(process.version,">=16.9.0")},4559(e,t,r){var s=r(3866);e.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var i=s(e);if(void 0===i)return;return Math.floor(r+i/1e3)}if("number"==typeof e)return r+e}},723(e,t,r){let s=r(5841),i=r(455),a={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},n={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};e.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let o=a[r];if(!o)throw Error(`Unknown key type "${r}".`);if(!o.includes(e))throw Error(`"alg" parameter for "${r}" key type must be one of: ${o.join(", ")}.`);if(s)switch(r){case"ec":let l=t.asymmetricKeyDetails.namedCurve,u=n[e];if(l!==u)throw Error(`"alg" parameter "${e}" requires curve "${u}".`);break;case"rsa-pss":if(i){let r=parseInt(e.slice(-3),10),{hashAlgorithm:s,mgf1HashAlgorithm:i,saltLength:a}=t.asymmetricKeyDetails;if(s!==`sha${r}`||i!==s)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==a&&a>r>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}}},9147(e,t,r){let s=r(4559),i=r(953),a=r(723),n=r(3263),o=r(5357),l=r(6782),u=r(5250),c=r(8094),d=r(6052),p=r(1251),f=r(8430),{KeyObject:h,createSecretKey:m,createPrivateKey:y}=r(6982),g=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&g.splice(3,0,"PS256","PS384","PS512");let v={expiresIn:{isValid:function(e){return u(e)||p(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return u(e)||p(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return p(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:o.bind(null,g),message:'"algorithm" must be a valid string enum value'},header:{isValid:d,message:'"header" must be an object'},encoding:{isValid:p,message:'"encoding" must be a string'},issuer:{isValid:p,message:'"issuer" must be a string'},subject:{isValid:p,message:'"subject" must be a string'},jwtid:{isValid:p,message:'"jwtid" must be a string'},noTimestamp:{isValid:l,message:'"noTimestamp" must be a boolean'},keyid:{isValid:p,message:'"keyid" must be a string'},mutatePayload:{isValid:l,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:l,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:l,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},_={iat:{isValid:c,message:'"iat" should be a number of seconds'},exp:{isValid:c,message:'"exp" should be a number of seconds'},nbf:{isValid:c,message:'"nbf" should be a number of seconds'}};function b(e,t,r,s){if(!d(r))throw Error('Expected "'+s+'" to be a plain object.');Object.keys(r).forEach(function(i){let a=e[i];if(!a){if(!t)throw Error('"'+i+'" is not allowed in "'+s+'"');return}if(!a.isValid(r[i]))throw Error(a.message)})}let w={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},$=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e.exports=function(e,t,r,i){var o,l;"function"==typeof r?(i=r,r={}):r=r||{};let u="object"==typeof e&&!Buffer.isBuffer(e),c=Object.assign({alg:r.algorithm||"HS256",typ:u?"JWT":void 0,kid:r.keyid},r.header);function d(e){if(i)return i(e);throw e}if(!t&&"none"!==r.algorithm)return d(Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof h))try{t=y(t)}catch(e){try{t=m("string"==typeof t?Buffer.from(t):t)}catch(e){return d(Error("secretOrPrivateKey is not valid key material"))}}if(c.alg.startsWith("HS")&&"secret"!==t.type)return d(Error(`secretOrPrivateKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)){if("private"!==t.type)return d(Error(`secretOrPrivateKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInsecureKeySizes&&!c.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return d(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`))}if(void 0===e)return d(Error("payload is required"));if(u){try{o=e,b(_,!0,o,"payload")}catch(e){return d(e)}r.mutatePayload||(e=Object.assign({},e))}else{let t=$.filter(function(e){return void 0!==r[e]});if(t.length>0)return d(Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return d(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return d(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{l=r,b(v,!1,l,"options")}catch(e){return d(e)}if(!r.allowInvalidAsymmetricKeyTypes)try{a(c.alg,t)}catch(e){return d(e)}let p=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:u&&(e.iat=p),void 0!==r.notBefore){try{e.nbf=s(r.notBefore,p)}catch(e){return d(e)}if(void 0===e.nbf)return d(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=s(r.expiresIn,p)}catch(e){return d(e)}if(void 0===e.exp)return d(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(w).forEach(function(t){let s=w[t];if(void 0!==r[t]){if(void 0!==e[s])return d(Error('Bad "options.'+t+'" option. The payload already has an "'+s+'" property.'));e[s]=r[t]}});let g=r.encoding||"utf8";if("function"==typeof i)i=i&&f(i),n.createSign({header:c,privateKey:t,payload:e,encoding:g}).once("error",i).once("done",function(e){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&e.length<256)return i(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`));i(null,e)});else{let s=n.sign({header:c,payload:e,secret:t,encoding:g});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&s.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`);return s}}},6467(e,t,r){let s=r(1957),i=r(4470),a=r(7788),n=r(2548),o=r(4559),l=r(723),u=r(953),c=r(3263),{KeyObject:d,createSecretKey:p,createPublicKey:f}=r(6982),h=["RS256","RS384","RS512"],m=["ES256","ES384","ES512"],y=["RS256","RS384","RS512"],g=["HS256","HS384","HS512"];u&&(h.splice(h.length,0,"PS256","PS384","PS512"),y.splice(y.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,r,u){let v,_,b;if("function"!=typeof r||u||(u=r,r={}),r||(r={}),r=Object.assign({},r),v=u||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return v(new s("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return v(new s("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return v(new s("allowInvalidAsymmetricKeyTypes must be a boolean"));let w=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return v(new s("jwt must be provided"));if("string"!=typeof e)return v(new s("jwt must be a string"));let $=e.split(".");if(3!==$.length)return v(new s("jwt malformed"));try{_=n(e,{complete:!0})}catch(e){return v(e)}if(!_)return v(new s("invalid token"));let k=_.header;if("function"==typeof t){if(!u)return v(new s("verify must be called asynchronous if secret or public key is provided as a callback"));b=t}else b=function(e,r){return r(null,t)};return b(k,function(t,n){let u;if(t)return v(new s("error in secret or public key callback: "+t.message));let b=""!==$[2].trim();if(!b&&n)return v(new s("jwt signature is required"));if(b&&!n)return v(new s("secret or public key must be provided"));if(!b&&!r.algorithms)return v(new s('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=n&&!(n instanceof d))try{n=f(n)}catch(e){try{n=p("string"==typeof n?Buffer.from(n):n)}catch(e){return v(new s("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===n.type?r.algorithms=g:["rsa","rsa-pss"].includes(n.asymmetricKeyType)?r.algorithms=y:"ec"===n.asymmetricKeyType?r.algorithms=m:r.algorithms=h),-1===r.algorithms.indexOf(_.header.alg))return v(new s("invalid algorithm"));if(k.alg.startsWith("HS")&&"secret"!==n.type)return v(new s(`secretOrPublicKey must be a symmetric key when using ${k.alg}`));if(/^(?:RS|PS|ES)/.test(k.alg)&&"public"!==n.type)return v(new s(`secretOrPublicKey must be an asymmetric key when using ${k.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{l(k.alg,n)}catch(e){return v(e)}try{u=c.verify(e,_.header.alg,n)}catch(e){return v(e)}if(!u)return v(new s("invalid signature"));let E=_.payload;if(void 0!==E.nbf&&!r.ignoreNotBefore){if("number"!=typeof E.nbf)return v(new s("invalid nbf value"));if(E.nbf>w+(r.clockTolerance||0))return v(new i("jwt not active",new Date(1e3*E.nbf)))}if(void 0!==E.exp&&!r.ignoreExpiration){if("number"!=typeof E.exp)return v(new s("invalid exp value"));if(w>=E.exp+(r.clockTolerance||0))return v(new a("jwt expired",new Date(1e3*E.exp)))}if(r.audience){let e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(E.aud)?E.aud:[E.aud]).some(function(t){return e.some(function(e){return e instanceof RegExp?e.test(t):e===t})}))return v(new s("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&E.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(E.iss)))return v(new s("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&E.sub!==r.subject)return v(new s("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&E.jti!==r.jwtid)return v(new s("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&E.nonce!==r.nonce)return v(new s("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof E.iat)return v(new s("iat required when maxAge is specified"));let e=o(r.maxAge,E.iat);if(void 0===e)return v(new s('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(w>=e+(r.clockTolerance||0))return v(new a("maxAge exceeded",new Date(1e3*e)))}return!0===r.complete?v(null,{header:k,payload:E,signature:_.signature}):v(null,E)})}},2357(e,t,r){var s,i=r(6608).Buffer,a=r(6982),n=r(9053),o=r(9023),l="secret must be a string or buffer",u="key must be a string or a buffer",c="function"==typeof a.createPublicKey;function d(e){if(!i.isBuffer(e)&&"string"!=typeof e&&(!c||"object"!=typeof e||"string"!=typeof e.type||"string"!=typeof e.asymmetricKeyType||"function"!=typeof e.export))throw m(u)}function p(e){if(!i.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw m("key must be a string, a buffer or an object")}function f(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function m(e){var t=[].slice.call(arguments,1);return TypeError(o.format.bind(o,e).apply(null,t))}function y(e){var t;return t=e,i.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function g(e){return function(t,r){!function(e){if(!i.isBuffer(e)){if("string"!=typeof e){if(!c||"object"!=typeof e||"secret"!==e.type||"function"!=typeof e.export)throw m(l)}}}(r),t=y(t);var s=a.createHmac("sha"+e,r);return f((s.update(t),s.digest("base64")))}}c&&(u+=" or a KeyObject",l+="or a KeyObject");var v="timingSafeEqual"in a?function(e,t){return e.byteLength===t.byteLength&&a.timingSafeEqual(e,t)}:function(e,t){return s||(s=r(9454)),s(e,t)};function _(e){return function(t,r,s){var a=g(e)(t,s);return v(i.from(r),i.from(a))}}function b(e){return function(t,r){p(r),t=y(t);var s=a.createSign("RSA-SHA"+e);return f((s.update(t),s.sign(r,"base64")))}}function w(e){return function(t,r,s){d(s),t=y(t),r=h(r);var i=a.createVerify("RSA-SHA"+e);return i.update(t),i.verify(s,r,"base64")}}function $(e){return function(t,r){p(r),t=y(t);var s=a.createSign("RSA-SHA"+e);return f((s.update(t),s.sign({key:r,padding:a.constants.RSA_PKCS1_PSS_PADDING,saltLength:a.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function k(e){return function(t,r,s){d(s),t=y(t),r=h(r);var i=a.createVerify("RSA-SHA"+e);return i.update(t),i.verify({key:s,padding:a.constants.RSA_PKCS1_PSS_PADDING,saltLength:a.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function E(e){var t=b(e);return function(){var r=t.apply(null,arguments);return n.derToJose(r,"ES"+e)}}function x(e){var t=w(e);return function(r,s,i){return t(r,s=n.joseToDer(s,"ES"+e).toString("base64"),i)}}function S(){return function(){return""}}function T(){return function(e,t){return""===t}}e.exports=function(e){var t=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!t)throw m('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var r=(t[1]||t[3]).toLowerCase(),s=t[2];return{sign:({hs:g,rs:b,ps:$,es:E,none:S})[r](s),verify:({hs:_,rs:w,ps:k,es:x,none:T})[r](s)}}},3263(e,t,r){var s=r(9615),i=r(6747);t.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],t.sign=s.sign,t.verify=i.verify,t.decode=i.decode,t.isValid=i.isValid,t.createSign=function(e){return new s(e)},t.createVerify=function(e){return new i(e)}},6360(e,t,r){var s=r(6608).Buffer,i=r(2203);function a(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=s.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=s.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick((function(){this.emit("end",e),this.readable=!1,this.emit("close")}).bind(this)),this;throw TypeError("Unexpected data type ("+typeof e+")")}r(9023).inherits(a,i),a.prototype.write=function(e){this.buffer=s.concat([this.buffer,s.from(e)]),this.emit("data",e)},a.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},e.exports=a},9615(e,t,r){var s=r(6608).Buffer,i=r(6360),a=r(2357),n=r(2203),o=r(5911),l=r(9023);function u(e,t){return s.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(e){var t,r,s,i=e.header,n=e.payload,c=e.secret||e.privateKey,d=e.encoding,p=a(i.alg),f=(t=(t=d)||"utf8",r=u(o(i),"binary"),s=u(o(n),t),l.format("%s.%s",r,s)),h=p.sign(f,c);return l.format("%s.%s",f,h)}function d(e){var t=e.secret;if(t=null==(t=null==t?e.privateKey:t)?e.key:t,!0===/^hs/i.test(e.header.alg)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new i(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new i(e.payload),this.secret.once("close",(function(){!this.payload.writable&&this.readable&&this.sign()}).bind(this)),this.payload.once("close",(function(){!this.secret.writable&&this.readable&&this.sign()}).bind(this))}l.inherits(d,n),d.prototype.sign=function(){try{var e=c({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},d.sign=c,e.exports=d},5911(e,t,r){var s=r(181).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||s.isBuffer(e)?e.toString():JSON.stringify(e)}},6747(e,t,r){var s=r(6608).Buffer,i=r(6360),a=r(2357),n=r(2203),o=r(5911),l=r(9023),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function c(e){var t=e.split(".",1)[0],r=s.from(t,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(r))return r;try{return JSON.parse(r)}catch(e){return}}function d(e){return e.split(".")[2]}function p(e){return u.test(e)&&!!c(e)}function f(e,t,r){if(!t){var s=Error("Missing algorithm parameter for jws.verify");throw s.code="MISSING_ALGORITHM",s}var i=d(e=o(e)),n=e.split(".",2).join(".");return a(t).verify(n,i,r)}function h(e,t){if(t=t||{},!p(e=o(e)))return null;var r,i,a=c(e);if(!a)return null;var n=(r=r||"utf8",i=e.split(".")[1],s.from(i,"base64").toString(r));return("JWT"===a.typ||t.json)&&(n=JSON.parse(n,t.encoding)),{header:a,payload:n,signature:d(e)}}function m(e){var t=(e=e||{}).secret;if(t=null==(t=null==t?e.publicKey:t)?e.key:t,!0===/^hs/i.test(e.algorithm)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new i(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new i(e.signature),this.secret.once("close",(function(){!this.signature.writable&&this.readable&&this.verify()}).bind(this)),this.signature.once("close",(function(){!this.secret.writable&&this.readable&&this.verify()}).bind(this))}l.inherits(m,n),m.prototype.verify=function(){try{var e=f(this.signature.buffer,this.algorithm,this.key.buffer),t=h(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},m.decode=h,m.isValid=p,m.verify=f,e.exports=m},5357(e){var t,r,s=1/0,i=0/0,a=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=/^(?:0|[1-9]\d*)$/,c=parseInt;function d(e){return e!=e}var p=Object.prototype,f=p.hasOwnProperty,h=p.toString,m=p.propertyIsEnumerable,y=(t=Object.keys,r=Object,function(e){return t(r(e))}),g=Math.max,v=Array.isArray;function _(e){var t,r,s;return null!=e&&"number"==typeof(t=e.length)&&t>-1&&t%1==0&&t<=0x1fffffffffffff&&"[object Function]"!=(s=b(r=e)?h.call(r):"")&&"[object GeneratorFunction]"!=s}function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function w(e){return!!e&&"object"==typeof e}e.exports=function(e,t,r,$){e=_(e)?e:function(e){return e?function(e,t){for(var r=-1,s=e?e.length:0,i=Array(s);++r<s;)i[r]=t(e[r],r,e);return i}(_(e)?function(e,t){var r,s,i,a,n=v(e)||w(s=r=e)&&_(s)&&f.call(r,"callee")&&(!m.call(r,"callee")||"[object Arguments]"==h.call(r))?function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],o=n.length,l=!!o;for(var c in e){f.call(e,c)&&!(l&&("length"==c||(i=c,(a=null==(a=o)?0x1fffffffffffff:a)&&("number"==typeof i||u.test(i))&&i>-1&&i%1==0&&i<a)))&&n.push(c)}return n}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||p))return y(e);var t,r,s=[];for(var i in Object(e))f.call(e,i)&&"constructor"!=i&&s.push(i);return s}(e),function(t){return e[t]}):[]}(e),r=r&&!$?(x=(E=(k=r)?(k=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||w(t)&&"[object Symbol]"==h.call(t))return i;if(b(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=b(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var s=o.test(e);return s||l.test(e)?c(e.slice(2),s?2:8):n.test(e)?i:+e}(k))===s||k===-s?(k<0?-1:1)*17976931348623157e292:k==k?k:0:0===k?k:0)%1,E==E?x?E-x:E:0):0;var k,E,x,S,T=e.length;return r<0&&(r=g(T+r,0)),"string"==typeof(S=e)||!v(S)&&w(S)&&"[object String]"==h.call(S)?r<=T&&e.indexOf(t,r)>-1:!!T&&function(e,t,r){if(t!=t){for(var s=e.length,i=r+-1;++i<s;)if(d(e[i],i,e))return i;return -1}for(var a=r-1,n=e.length;++a<n;)if(e[a]===t)return a;return -1}(e,t,r)>-1}},6782(e){var t=Object.prototype.toString;e.exports=function(e){var r;return!0===e||!1===e||!!(r=e)&&"object"==typeof r&&"[object Boolean]"==t.call(e)}},5250(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,n=/^0o[0-7]+$/i,o=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p;return"number"==typeof e&&e==(p=(d=(c=e)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=a.test(e);return d||n.test(e)?o(e.slice(2),d?2:8):i.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,d==d?p?d-p:d:0)}},8094(e){var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||!!e&&"object"==typeof e&&"[object Number]"==t.call(e)}},6052(e){var t,r,s=Object.prototype,i=Function.prototype.toString,a=s.hasOwnProperty,n=i.call(Object),o=s.toString,l=(t=Object.getPrototypeOf,r=Object,function(e){return t(r(e))});e.exports=function(e){if(!(e&&"object"==typeof e)||"[object Object]"!=o.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=l(e);if(null===t)return!0;var r=a.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&i.call(r)==n}},1251(e){var t=Object.prototype.toString,r=Array.isArray;e.exports=function(e){var s;return"string"==typeof e||!r(e)&&!!(s=e)&&"object"==typeof s&&"[object String]"==t.call(e)}},8430(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,n=/^0o[0-7]+$/i,o=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p,f,h=2,m=e;if("function"!=typeof m)throw TypeError("Expected a function");return p=(d=(c=h)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=a.test(e);return d||n.test(e)?o(e.slice(2),d?2:8):i.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,h=d==d?p?d-p:d:0,function(){return--h>0&&(f=m.apply(this,arguments)),h<=1&&(m=void 0),f}}},3866(e){function t(e,t,r,s){return Math.round(e/r)+" "+s+(t>=1.5*r?"s":"")}e.exports=function(e,r){r=r||{};var s,i,a,n,o=typeof e;if("string"===o&&e.length>0){var l=e;if(!((l=String(l)).length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(u){var c=parseFloat(u[1]);switch((u[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return 6048e5*c;case"days":case"day":case"d":return 864e5*c;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*c;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*c;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:break}}}return}if("number"===o&&isFinite(e)){return r.long?(i=Math.abs(s=e))>=864e5?t(s,i,864e5,"day"):i>=36e5?t(s,i,36e5,"hour"):i>=6e4?t(s,i,6e4,"minute"):i>=1e3?t(s,i,1e3,"second"):s+" ms":(n=Math.abs(a=e))>=864e5?Math.round(a/864e5)+"d":n>=36e5?Math.round(a/36e5)+"h":n>=6e4?Math.round(a/6e4)+"m":n>=1e3?Math.round(a/1e3)+"s":a+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},9695(e){"use strict";let t=(e={})=>{let t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path"};e.exports=t,e.exports.default=t},6608(e,t,r){var s=r(181),i=s.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function n(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=s:(a(s,t),t.Buffer=n),n.prototype=Object.create(i.prototype),a(i,n),n.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},n.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var s=i(e);return void 0!==t?"string"==typeof r?s.fill(t,r):s.fill(t):s.fill(0),s},n.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},n.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return s.SlowBuffer(e)}},8610(e,t,r){"use strict";let s=Symbol("SemVer ANY");class i{static get ANY(){return s}constructor(e,t){if(t=a(t),e instanceof i)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===s?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=s}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===s||e===s)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=a(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=i;let a=r(4621),{safeRe:n,t:o}=r(152),l=r(5461),u=r(674),c=r(2398),d=r(2069)},2069(e,t,r){"use strict";let s=/\s+/g;class i{constructor(e,t){if(t=n(t),e instanceof i)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new i(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(s," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!g(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&m)|(this.options.loose&&y))+":"+e,r=a.get(t);if(r)return r;let s=this.options.loose,i=s?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];l("hyphen replace",e=e.replace(i,O(this.options.includePrerelease))),l("comparator trim",e=e.replace(c[d.COMPARATORTRIM],p)),l("tilde trim",e=e.replace(c[d.TILDETRIM],f)),l("caret trim",e=e.replace(c[d.CARETTRIM],h));let n=e.split(" ").map(e=>b(e,this.options)).join(" ").split(/\s+/).map(e=>I(e,this.options));s&&(n=n.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",n);let u=new Map;for(let e of n.map(e=>new o(e,this.options))){if(g(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let v=[...u.values()];return a.set(t,v),v}intersects(e,t){if(!(e instanceof i))throw TypeError("a Range is required");return this.set.some(r=>_(r,t)&&e.set.some(e=>_(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(j(this.set[t],e,this.options))return!0;return!1}}e.exports=i;let a=new(r(2044)),n=r(4621),o=r(8610),l=r(674),u=r(2398),{safeRe:c,t:d,comparatorTrimReplace:p,tildeTrimReplace:f,caretTrimReplace:h}=r(152),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:y}=r(5076),g=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,_=(e,t)=>{let r=!0,s=e.slice(),i=s.pop();for(;r&&s.length;)r=s.every(e=>i.intersects(e,t)),i=s.pop();return r},b=(e,t)=>(l("comp",e=e.replace(c[d.BUILD],""),t),l("caret",e=E(e,t)),l("tildes",e=$(e,t)),l("xrange",e=S(e,t)),l("stars",e=P(e,t)),e),w=e=>!e||"x"===e.toLowerCase()||"*"===e,$=(e,t)=>e.trim().split(/\s+/).map(e=>k(e,t)).join(" "),k=(e,t)=>{let r=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(r,(t,r,s,i,a)=>{let n;return l("tilde",e,t,r,s,i,a),w(r)?n="":w(s)?n=`>=${r}.0.0 <${+r+1}.0.0-0`:w(i)?n=`>=${r}.${s}.0 <${r}.${+s+1}.0-0`:a?(l("replaceTilde pr",a),n=`>=${r}.${s}.${i}-${a} <${r}.${+s+1}.0-0`):n=`>=${r}.${s}.${i} <${r}.${+s+1}.0-0`,l("tilde return",n),n})},E=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(" "),x=(e,t)=>{l("caret",e,t);let r=t.loose?c[d.CARETLOOSE]:c[d.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(t,r,i,a,n)=>{let o;return l("caret",e,t,r,i,a,n),w(r)?o="":w(i)?o=`>=${r}.0.0${s} <${+r+1}.0.0-0`:w(a)?o="0"===r?`>=${r}.${i}.0${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${s} <${+r+1}.0.0-0`:n?(l("replaceCaret pr",n),o="0"===r?"0"===i?`>=${r}.${i}.${a}-${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${n} <${+r+1}.0.0-0`):(l("no pr"),o="0"===r?"0"===i?`>=${r}.${i}.${a}${s} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),l("caret return",o),o})},S=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>T(e,t)).join(" ")),T=(e,t)=>{e=e.trim();let r=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(r,(r,s,i,a,n,o)=>{l("xRange",e,r,s,i,a,n,o);let u=w(i),c=u||w(a),d=c||w(n);return"="===s&&d&&(s=""),o=t.includePrerelease?"-0":"",u?r=">"===s||"<"===s?"<0.0.0-0":"*":s&&d?(c&&(a=0),n=0,">"===s?(s=">=",c?(i=+i+1,a=0):a=+a+1,n=0):"<="===s&&(s="<",c?i=+i+1:a=+a+1),"<"===s&&(o="-0"),r=`${s+i}.${a}.${n}${o}`):c?r=`>=${i}.0.0${o} <${+i+1}.0.0-0`:d&&(r=`>=${i}.${a}.0${o} <${i}.${+a+1}.0-0`),l("xRange return",r),r})},P=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),I=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),O=e=>(t,r,s,i,a,n,o,l,u,c,d,p)=>(r=w(s)?"":w(i)?`>=${s}.0.0${e?"-0":""}`:w(a)?`>=${s}.${i}.0${e?"-0":""}`:n?`>=${r}`:`>=${r}${e?"-0":""}`,l=w(u)?"":w(c)?`<${+u+1}.0.0-0`:w(d)?`<${u}.${+c+1}.0-0`:p?`<=${u}.${c}.${d}-${p}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),j=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){let s=e[r].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}},2398(e,t,r){"use strict";let s=r(674),{MAX_LENGTH:i,MAX_SAFE_INTEGER:a}=r(5076),{safeRe:n,t:o}=r(152),l=r(4621),{compareIdentifiers:u}=r(9101);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw TypeError(`version is longer than ${i} characters`);s("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?n[o.LOOSE]:n[o.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>a||this.major<0)throw TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<a)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(s("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return(e instanceof c||(e=new c(e,this.options)),this.major<e.major)?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:+(this.patch>e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],i=e.prerelease[t];if(s("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return -1;else if(r===i)continue;else return u(r,i)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],i=e.build[t];if(s("build compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return -1;else if(r===i)continue;else return u(r,i)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let s=this.prerelease.length;for(;--s>=0;)"number"==typeof this.prerelease[s]&&(this.prerelease[s]++,s=-2);if(-1===s){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let s=[t,e];!1===r&&(s=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},5608(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},5461(e,t,r){"use strict";let s=r(8271),i=r(733),a=r(1686),n=r(6479),o=r(7257),l=r(5850);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return s(e,r,u);case"!=":return i(e,r,u);case">":return a(e,r,u);case">=":return n(e,r,u);case"<":return o(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},7771(e,t,r){"use strict";let s=r(2398),i=r(6802),{safeRe:a,t:n}=r(152);e.exports=(e,t)=>{if(e instanceof s)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let s,i=t.includePrerelease?a[n.COERCERTLFULL]:a[n.COERCERTL];for(;(s=i.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),i.lastIndex=s.index+s[1].length+s[2].length;i.lastIndex=-1}else r=e.match(t.includePrerelease?a[n.COERCEFULL]:a[n.COERCE]);if(null===r)return null;let o=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return i(`${o}.${l}.${u}${c}${d}`,t)}},8767(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>{let i=new s(e,r),a=new s(t,r);return i.compare(a)||i.compareBuild(a)}},6293(e,t,r){"use strict";let s=r(6958);e.exports=(e,t)=>s(e,t,!0)},6958(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>new s(e,r).compare(new s(t,r))},3086(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,null,!0),i=s(t,null,!0),a=r.compare(i);if(0===a)return null;let n=a>0,o=n?r:i,l=n?i:r,u=!!o.prerelease.length;if(l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(o))return l.minor&&!l.patch?"minor":"patch"}let c=u?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"}},8271(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0===s(e,t,r)},1686(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>0},6479(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>=0},3625(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r,i,a)=>{"string"==typeof r&&(a=i,i=r,r=void 0);try{return new s(e instanceof s?e.version:e,r).inc(t,i,a).version}catch(e){return null}}},7257(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>s(e,t,r)},5850(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>=s(e,t,r)},7744(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).major},4812(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).minor},733(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0!==s(e,t,r)},6802(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r=!1)=>{if(e instanceof s)return e;try{return new s(e,t)}catch(e){if(!r)return null;throw e}}},8643(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).patch},9283(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r&&r.prerelease.length?r.prerelease:null}},7032(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(t,e,r)},9839(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(r,e,t))},4056(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>{try{t=new s(t,r)}catch(e){return!1}return t.test(e)}},7697(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(e,r,t))},6807(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r?r.version:null}},3895(e,t,r){"use strict";let s=r(152),i=r(5076),a=r(2398),n=r(9101),o=r(6802),l=r(6807),u=r(5608),c=r(3625),d=r(3086),p=r(7744),f=r(4812),h=r(8643),m=r(9283),y=r(6958),g=r(7032),v=r(6293),_=r(8767),b=r(7697),w=r(9839),$=r(1686),k=r(7257),E=r(8271),x=r(733),S=r(6479),T=r(5850),P=r(5461),I=r(7771),O=r(8610),j=r(2069),R=r(4056),N=r(6613),A=r(7114),C=r(1008),z=r(203),M=r(5372),D=r(4713),L=r(4497),q=r(9272),U=r(3490);e.exports={parse:o,valid:l,clean:u,inc:c,diff:d,major:p,minor:f,patch:h,prerelease:m,compare:y,rcompare:g,compareLoose:v,compareBuild:_,sort:b,rsort:w,gt:$,lt:k,eq:E,neq:x,gte:S,lte:T,cmp:P,coerce:I,Comparator:O,Range:j,satisfies:R,toComparators:N,maxSatisfying:A,minSatisfying:C,minVersion:z,validRange:M,outside:D,gtr:L,ltr:q,intersects:U,simplifyRange:r(4039),subset:r(22),SemVer:a,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers}},5076(e){"use strict";e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},674(e){"use strict";e.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},9101(e){"use strict";let t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;let s=t.test(e),i=t.test(r);return s&&i&&(e*=1,r*=1),e===r?0:s&&!i?-1:i&&!s?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},2044(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},4621(e){"use strict";let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},152(e,t,r){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:a}=r(5076),n=r(674),o=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},p=0,f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",a],[f,i]],m=(e,t,r)=>{let s=(e=>{for(let[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=p++;n(e,i,t),d[e]=i,u[i]=t,c[i]=s,o[i]=new RegExp(t,r?"g":void 0),l[i]=new RegExp(s,r?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),m("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${f}+`),m("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),m("FULL",`^${u[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),m("LOOSE",`^${u[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),m("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?`),m("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),m("COERCERTL",u[d.COERCE],!0),m("COERCERTLFULL",u[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},4497(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,">",r)},3490(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>(e=new s(e,r),t=new s(t,r),e.intersects(t,r))},9272(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,"<",r)},7114(e,t,r){"use strict";let s=r(2398),i=r(2069);e.exports=(e,t,r)=>{let a=null,n=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!a||-1===n.compare(e))&&(n=new s(a=e,r))}),a}},1008(e,t,r){"use strict";let s=r(2398),i=r(2069);e.exports=(e,t,r)=>{let a=null,n=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!a||1===n.compare(e))&&(n=new s(a=e,r))}),a}},203(e,t,r){"use strict";let s=r(2398),i=r(2069),a=r(1686);e.exports=(e,t)=>{e=new i(e,t);let r=new s("0.0.0");if(e.test(r)||(r=new s("0.0.0-0"),e.test(r)))return r;r=null;for(let t=0;t<e.set.length;++t){let i=e.set[t],n=null;i.forEach(e=>{let t=new s(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":(!n||a(t,n))&&(n=t);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),n&&(!r||a(r,n))&&(r=n)}return r&&e.test(r)?r:null}},4713(e,t,r){"use strict";let s=r(2398),i=r(8610),{ANY:a}=i,n=r(2069),o=r(4056),l=r(1686),u=r(7257),c=r(5850),d=r(6479);e.exports=(e,t,r,p)=>{let f,h,m,y,g;switch(e=new s(e,p),t=new n(t,p),r){case">":f=l,h=c,m=u,y=">",g=">=";break;case"<":f=u,h=d,m=l,y="<",g="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(o(e,t,p))return!1;for(let r=0;r<t.set.length;++r){let s=t.set[r],n=null,o=null;if(s.forEach(e=>{e.semver===a&&(e=new i(">=0.0.0")),n=n||e,o=o||e,f(e.semver,n.semver,p)?n=e:m(e.semver,o.semver,p)&&(o=e)}),n.operator===y||n.operator===g||(!o.operator||o.operator===y)&&h(e,o.semver)||o.operator===g&&m(e,o.semver))return!1}return!0}},4039(e,t,r){"use strict";let s=r(4056),i=r(6958);e.exports=(e,t,r)=>{let a=[],n=null,o=null,l=e.sort((e,t)=>i(e,t,r));for(let e of l)s(e,t,r)?(o=e,n||(n=e)):(o&&a.push([n,o]),o=null,n=null);n&&a.push([n,null]);let u=[];for(let[e,t]of a)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");let c=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return c.length<d.length?c:t}},22(e,t,r){"use strict";let s=r(2069),i=r(8610),{ANY:a}=i,n=r(4056),o=r(6958),l=[new i(">=0.0.0-0")],u=[new i(">=0.0.0")],c=(e,t,r)=>{let s,i,c,f,h,m,y;if(e===t)return!0;if(1===e.length&&e[0].semver===a)if(1===t.length&&t[0].semver===a)return!0;else e=r.includePrerelease?l:u;if(1===t.length&&t[0].semver===a)if(r.includePrerelease)return!0;else t=u;let g=new Set;for(let t of e)">"===t.operator||">="===t.operator?s=d(s,t,r):"<"===t.operator||"<="===t.operator?i=p(i,t,r):g.add(t.semver);if(g.size>1)return null;if(s&&i&&((c=o(s.semver,i.semver,r))>0||0===c&&(">="!==s.operator||"<="!==i.operator)))return null;for(let e of g){if(s&&!n(e,String(s),r)||i&&!n(e,String(i),r))return null;for(let s of t)if(!n(e,String(s),r))return!1;return!0}let v=!!i&&!r.includePrerelease&&!!i.semver.prerelease.length&&i.semver,_=!!s&&!r.includePrerelease&&!!s.semver.prerelease.length&&s.semver;for(let e of(v&&1===v.prerelease.length&&"<"===i.operator&&0===v.prerelease[0]&&(v=!1),t)){if(y=y||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,s){if(_&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===_.major&&e.semver.minor===_.minor&&e.semver.patch===_.patch&&(_=!1),">"===e.operator||">="===e.operator){if((f=d(s,e,r))===e&&f!==s)return!1}else if(">="===s.operator&&!n(s.semver,String(e),r))return!1}if(i){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if((h=p(i,e,r))===e&&h!==i)return!1}else if("<="===i.operator&&!n(i.semver,String(e),r))return!1}if(!e.operator&&(i||s)&&0!==c)return!1}return(!s||!m||!!i||0===c)&&(!i||!y||!!s||0===c)&&!_&&!v&&!0},d=(e,t,r)=>{if(!e)return t;let s=o(e.semver,t.semver,r);return s>0?e:s<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,r)=>{if(!e)return t;let s=o(e.semver,t.semver,r);return s<0?e:s>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new s(e,r),t=new s(t,r);let i=!1;e:for(let s of e.set){for(let e of t.set){let t=c(s,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},6613(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>new s(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},5372(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>{try{return new s(e,t).range||"*"}catch(e){return null}}},600(e,t,r){"use strict";let s=r(9638);e.exports=(e="")=>{let t=e.match(s);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),a=r.split("/").pop();return"env"===a?i:i?`${a} ${i}`:a}},9638(e){"use strict";e.exports=/^#!(.*)/},1905(e,t,r){let s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,i=r(6928),a=s?";":":",n=r(9344),o=e=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),l=(e,t)=>{let r=t.colon||a,i=e.match(/\//)||s&&e.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=s?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=s?n.split(r):[""];return s&&-1!==e.indexOf(".")&&""!==o[0]&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},u=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});let{pathEnv:s,pathExt:a,pathExtExe:u}=l(e,t),c=[],d=r=>new Promise((a,n)=>{if(r===s.length)return t.all&&c.length?a(c):n(o(e));let l=s[r],u=/^".*"$/.test(l)?l.slice(1,-1):l,d=i.join(u,e);a(p(!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,r,0))}),p=(e,r,s)=>new Promise((i,o)=>{if(s===a.length)return i(d(r+1));let l=a[s];n(e+l,{pathExt:u},(a,n)=>{if(!a&&n)if(!t.all)return i(e+l);else c.push(e+l);return i(p(e,r,s+1))})});return r?d(0).then(e=>r(null,e),r):d(0)};e.exports=u,u.sync=(e,t)=>{let{pathEnv:r,pathExt:s,pathExtExe:a}=l(e,t=t||{}),u=[];for(let o=0;o<r.length;o++){let l=r[o],c=/^".*"$/.test(l)?l.slice(1,-1):l,d=i.join(c,e),p=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<s.length;e++){let r=p+s[e];try{if(n.sync(r,{pathExt:a}))if(!t.all)return r;else u.push(r)}catch(e){}}}if(t.all&&u.length)return u;if(t.nothrow)return null;throw o(e)}},181(e){"use strict";e.exports=require("buffer")},5317(e){"use strict";e.exports=require("child_process")},6982(e){"use strict";e.exports=require("crypto")},9896(e){"use strict";e.exports=require("fs")},7598(e){"use strict";e.exports=require("node:crypto")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},2203(e){"use strict";e.exports=require("stream")},9023(e){"use strict";e.exports=require("util")},5019(e,t,r){"use strict";let{normalizeIPv6:s,removeDotSegments:i,recomposeAuthority:a,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:l}=r(6214),{SCHEMES:u,getSchemeHandler:c}=r(1528);function d(e,t,r,s){let a={};return s||(e=h(p(e,r),r),t=h(p(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=i(t.path||""),a.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=i(t.path||""),a.query=t.query):(t.path?("/"===t.path[0]?a.path=i(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path:a.path="/"+t.path,a.path=i(a.path)),a.query=t.query):(a.path=e.path,void 0!==t.query?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),n=[],o=c(s.scheme||r.scheme);o&&o.serialize&&o.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&n.push(r.scheme,":");let l=a(r);if(void 0!==l&&("suffix"!==s.reference&&n.push("//"),n.push(l),r.path&&"/"!==r.path[0]&&n.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||o&&o.absolutePath||(e=i(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),n.push(e)}return void 0!==r.query&&n.push("?",r.query),void 0!==r.fragment&&n.push("#",r.fragment),n.join("")}let f=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},a=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);let n=e.match(f);if(n){if(i.scheme=n[1],i.userinfo=n[3],i.host=n[4],i.port=parseInt(n[5],10),i.path=n[6]||"",i.query=n[7],i.fragment=n[8],isNaN(i.port)&&(i.port=n[5]),i.host)if(!1===o(i.host)){let e=s(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let t=c(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&!1===a&&l(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return i}let m={SCHEMES:u,normalize:function(e,t){return"string"==typeof e?e=p(h(e,t),t):"object"==typeof e&&(e=h(p(e,t),t)),e},resolve:function(e,t,r){let s=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=d(h(e,s),h(t,s),s,!0);return s.skipEscape=!0,p(i,s)},resolveComponent:d,equal:function(e,t,r){return"string"==typeof e?e=p(n(h(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=p(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=p(n(h(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=p(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:p,parse:h};e.exports=m,e.exports.default=m,e.exports.fastUri=m},1528(e,t,r){"use strict";let{isUUID:s}=r(6214),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function l(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let u={scheme:"http",domainHost:!0,parse:o,serialize:l},c={scheme:"https",domainHost:u.domainHost,parse:o,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},f={http:u,https:c,ws:d,wss:p,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(i);if(r){let s=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=h(`${s}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),i=h(`${r}:${t.nid||s}`);i&&(e=i.serialize(e,t));let a=e,n=e.nss;return a.path=`${s||t.nid}:${n}`,t.skipEscape=!0,a},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&s(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function h(e){return e&&(f[e]||f[e.toLowerCase()])||void 0}Object.setPrototypeOf(f,null),e.exports={wsIsSecure:n,SCHEMES:f,isValidSchemeName:function(e){return -1!==a.indexOf(e)},getSchemeHandler:h}},6214(e){"use strict";let t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function s(e){let t="",r=0,s=0;for(s=0;s<e.length;s++)if(48!==(r=e[s].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s];break}for(s+=1;s<e.length;s++){if(!((r=e[s].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s]}return t}function i(e){return e.length=0,!0}function a(e,t,r){if(e.length){let i=s(e);if(""===i)return r.error=!0,!1;t.push(i),e.length=0}return!0}function n(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,":"))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],l=!1,u=!1,c=a;for(let s=0;s<e.length;s++){let a=e[s];if("["!==a&&"]"!==a)if(":"===a){if(!0===l&&(u=!0),!c(o,n,r))break;if(++t>7){r.error=!0;break}s>0&&":"===e[s-1]&&(l=!0),n.push(":");continue}else if("%"===a){if(!c(o,n,r))break;c=i}else{o.push(a);continue}}return o.length&&(c===i?r.zone=o.join(""):u?n.push(o.join("")):n.push(s(o))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}e.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let s=unescape(e.host);if(!r(s)){let t=n(s);s=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(s)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){let r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e,r=[],s=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===i&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(s=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,s)),t=t.slice(s)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:n,stringArrayToHexStripped:s}},2200(e){"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},7578(e){"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},4519(e){"use strict";e.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},8330(e){"use strict";e.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"0.6.5","author":{"name":"xmcp","email":"support@xmcp.dev","url":"https://xmcp.dev"},"contributors":[{"name":"Valentina Bearzotti","email":"valebearzotti1@gmail.com","url":"https://github.com/valebearzotti"},{"name":"Jose Rago","email":"jose@basement.studio","url":"https://github.com/ragojose"}],"license":"MIT","keywords":["mcp","modelcontextprotocol","http","stdio"],"repository":{"type":"git","url":"https://github.com/basementstudio/xmcp"},"homepage":"https://xmcp.dev","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"xmcp":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","default":"./dist/index.js"},"./cloudflare":{"types":"./dist/cloudflare.d.ts","require":"./dist/cloudflare.js","default":"./dist/cloudflare.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"cloudflare":["dist/cloudflare.d.ts"]}},"files":["dist","src"],"scripts":{"dev":"cross-env NODE_ENV=development tsx --watch --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","build":"cross-env NODE_ENV=production tsx --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","analyze":"cross-env GENERATE_STATS=true pnpm build && pnpm tsx scripts/analyze-rspack-stats.ts","test:config":"node --import tsx --test src/compiler/config/__tests__/*.test.ts"},"dependencies":{"@modelcontextprotocol/sdk":"^1.26.0","@rspack/core":"^1.6.7","jose":"^6.1.3","postcss-loader":"^8.2.0","ts-checker-rspack-plugin":"^1.2.1","typescript":"^5.9.3"},"devDependencies":{"@nestjs/common":"^11.1.12","@types/async-retry":"^1.4.9","@types/content-type":"^1.1.9","@types/express":"^5.0.6","@types/fs-extra":"^11.0.4","@types/jsonwebtoken":"^9.0.10","@types/node":"^22.19.2","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","async-retry":"^1.3.3","chalk":"^5.6.2","chokidar":"^3.6.0","ci-info":"^4.3.1","commander":"^11.1.0","content-type":"^1.0.5","cross-env":"^7.0.3","del":"^7.1.0","dotenv":"^16.6.1","express":"^4.22.1","fs-extra":"^11.3.2","glob":"^11.1.0","is-docker":"^4.0.0","is-wsl":"^3.1.0","json5":"^2.2.3","jsonwebtoken":"^9.0.3","memfs":"^4.51.1","raw-body":"^3.0.2","reflect-metadata":"^0.2.2","rxjs":"^7.8.2","tsx":"^4.21.0"},"peerDependencies":{"react":">=19.0.0","react-dom":">=19.0.0","zod":"^3.25.76 || ^4.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}}}')}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var a=s[e]={exports:{}};return r[e](a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,s){if(1&s&&(r=this(r)),8&s||"object"==typeof r&&r&&(4&s&&r.__esModule||16&s&&"function"==typeof r.then))return r;var a=Object.create(null);i.r(a);var n={};e=e||[null,t({}),t([]),t(t)];for(var o=2&s&&r;("object"==typeof o||"function"==typeof o)&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach(e=>{n[e]=()=>r[e]});return n.default=()=>r,i.d(a,n),a},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";let e,t,r,s,n;i.r(a),i.d(a,{disconnectSTDIOClient:()=>lA,apiKeyAuthMiddleware:()=>eJ,isEnvHeader:()=>lx,createContext:()=>e9,listSTDIOClientTools:()=>lR,createSTDIOClient:()=>lj,callSTDIOClientTool:()=>lN,headersToRecord:()=>lS,extractToolNamesFromRequest:()=>lC,jwtAuthMiddleware:()=>eQ,createHTTPClient:()=>lO,completable:()=>e5});var o,l,u,c,d,p,f,h,m,y,g,v,_,b,w,$,k,E=i(8583),x=i.n(E);(o=y||(y={})).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 s of t)r[s]=e[s];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,(g||(g={})).mergeShapes=(e,t)=>({...e,...t});let S=y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),T=e=>{switch(typeof e){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(e)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":if(Array.isArray(e))return S.array;if(null===e)return S.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return S.promise;if("undefined"!=typeof Map&&e instanceof Map)return S.map;if("undefined"!=typeof Set&&e instanceof Set)return S.set;if("undefined"!=typeof Date&&e instanceof Date)return S.date;return S.object;default:return S.unknown}},P=y.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 I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},s=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(s);else if("invalid_return_type"===i.code)s(i.returnTypeError);else if("invalid_arguments"===i.code)s(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,s=0;for(;s<i.path.length;){let r=i.path[s];s===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(this),r}static assert(e){if(!(e instanceof I))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,y.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let r=s.path[0];t[r]=t[r]||[],t[r].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=e=>new I(e);let O=(e,t)=>{let r;switch(e.code){case P.invalid_type:r=e.received===S.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case P.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,y.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:r=`Unrecognized key(s) in object: ${y.joinValues(e.keys,", ")}`;break;case P.invalid_union:r="Invalid input";break;case P.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${y.joinValues(e.options)}`;break;case P.invalid_enum_value:r=`Invalid enum value. Expected ${y.joinValues(e.options)}, received '${e.received}'`;break;case P.invalid_arguments:r="Invalid function arguments";break;case P.invalid_return_type:r="Invalid function return type";break;case P.invalid_date:r="Invalid date";break;case P.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}"`:y.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case P.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 P.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 P.custom:r="Invalid input";break;case P.invalid_intersection_types:r="Intersection results could not be merged";break;case P.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case P.not_finite:r="Number must be finite";break;default:r=t.defaultError,y.assertNever(e)}return{message:r}},j=e=>{let{data:t,path:r,errorMaps:s,issueData:i}=e,a=[...r,...i.path||[]],n={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="";for(let e of s.filter(e=>!!e).slice().reverse())o=e(n,{data:t,defaultError:o}).message;return{...i,path:a,message:o}};function R(e,t){let r=j({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,O,void 0].filter(e=>!!e)});e.common.issues.push(r)}class N{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 s of t){if("aborted"===s.status)return A;"dirty"===s.status&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,s=await e.value;r.push({key:t,value:s})}return N.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let s of t){let{key:t,value:i}=s;if("aborted"===t.status||"aborted"===i.status)return A;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||s.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let A=Object.freeze({status:"aborted"}),C=e=>({status:"dirty",value:e}),z=e=>({status:"valid",value:e}),M=e=>"undefined"!=typeof Promise&&e instanceof Promise;(l=v||(v={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},l.toString=e=>"string"==typeof e?e:e?.message;class D{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}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 L=(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 I(e.common.issues);return this._error=t,this._error}}};function q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:s,description:i}=e;if(t&&(r||s))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??s??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??r??i.defaultError}},description:i}}class U{get description(){return this._def.description}_getType(e){return T(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(M(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:T(e)},s=this._parseSync({data:e,path:r.path,parent:r});return L(r,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(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:T(e)},s=this._parse({data:e,path:r.path,parent:r});return L(r,await (M(s)?s:Promise.resolve(s)))}refine(e,t){return this._refinement((r,s)=>{let i=e(r),a=()=>s.addIssue({code:P.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,s)=>!!e(r)||(s.addIssue("function"==typeof t?t(r,s):t),!1))}_refinement(e){return new eA({schema:this,typeName:_.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 eC.create(this,this._def)}nullable(){return ez.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eg.create(this)}promise(){return eN.create(this,this._def)}or(e){return e_.create([this,e],this._def)}and(e){return e$.create(this,e,this._def)}transform(e){return new eA({...q(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eM({...q(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:_.ZodDefault})}brand(){return new eq({typeName:_.ZodBranded,type:this,...q(this._def)})}catch(e){return new eD({...q(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:_.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eU.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,V=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Z]{26}$/i,K=/^[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,H=/^[a-z0-9_-]{21}$/i,B=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G=/^[-+]?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)?)??$/,W=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,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])$/,X=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Y=/^(([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])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,er="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",es=RegExp(`^${er}$`);function ei(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 ea extends U{_parse(t){var r,s,i,a;let n;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==S.string){let e=this._getOrReturnCtx(t);return R(e,{code:P.invalid_type,expected:S.string,received:e.parsedType}),A}let o=new N;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(R(n=this._getOrReturnCtx(t,n),{code:P.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("max"===l.kind)t.data.length>l.value&&(R(n=this._getOrReturnCtx(t,n),{code:P.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("length"===l.kind){let e=t.data.length>l.value,r=t.data.length<l.value;(e||r)&&(n=this._getOrReturnCtx(t,n),e?R(n,{code:P.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&R(n,{code:P.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)W.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"email",code:P.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)e||(e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),e.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"emoji",code:P.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)K.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"uuid",code:P.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)H.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"nanoid",code:P.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)Z.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"cuid",code:P.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)V.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"cuid2",code:P.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)F.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"ulid",code:P.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{R(n=this._getOrReturnCtx(t,n),{validation:"url",code:P.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"regex",code:P.invalid_string,message:l.message}),o.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${er}T${ei(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(l).test(t.data)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?es.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${ei(l)}$`).test(t.data)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?G.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"duration",code:P.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(s=l.version)||!s)&&J.test(r)||("v6"===s||!s)&&Y.test(r))&&1&&(R(n=this._getOrReturnCtx(t,n),{validation:"ip",code:P.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!B.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(s));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(R(n=this._getOrReturnCtx(t,n),{validation:"jwt",code:P.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(i=t.data,!(("v4"===(a=l.version)||!a)&&X.test(i)||("v6"===a||!a)&&Q.test(i))&&1&&(R(n=this._getOrReturnCtx(t,n),{validation:"cidr",code:P.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?ee.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"base64",code:P.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?et.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"base64url",code:P.invalid_string,message:l.message}),o.dirty()):y.assertNever(l);return{status:o.value,value:t.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:P.invalid_string,...v.errToObj(r)})}_addCheck(e){return new ea({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){return"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,...v.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,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new ea({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ea({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ea({...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}}ea.create=e=>new ea({checks:[],typeName:_.ZodString,coerce:e?.coerce??!1,...q(e)});class en extends U{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)!==S.number){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.number,received:t.parsedType}),A}let r=new N;for(let s of this._def.checks)"int"===s.kind?y.isInteger(e.data)||(R(t=this._getOrReturnCtx(e,t),{code:P.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(R(t=this._getOrReturnCtx(e,t),{code:P.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)&&(R(t=this._getOrReturnCtx(e,t),{code:P.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,s=(t.toString().split(".")[1]||"").length,i=r>s?r:s;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,s.value)&&(R(t=this._getOrReturnCtx(e,t),{code:P.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(R(t=this._getOrReturnCtx(e,t),{code:P.not_finite,message:s.message}),r.dirty()):y.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new en({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new en({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(let 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&&y.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)}}en.create=e=>new en({checks:[],typeName:_.ZodNumber,coerce:e?.coerce||!1,...q(e)});class eo extends U{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)!==S.bigint)return this._getInvalidInput(e);let r=new N;for(let s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(R(t=this._getOrReturnCtx(e,t),{code:P.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)&&(R(t=this._getOrReturnCtx(e,t),{code:P.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(R(t=this._getOrReturnCtx(e,t),{code:P.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):y.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.bigint,received:t.parsedType}),A}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new eo({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new eo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.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}}eo.create=e=>new eo({checks:[],typeName:_.ZodBigInt,coerce:e?.coerce??!1,...q(e)});class el extends U{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.boolean,received:t.parsedType}),A}return z(e.data)}}el.create=e=>new el({typeName:_.ZodBoolean,coerce:e?.coerce||!1,...q(e)});class eu extends U{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.date,received:t.parsedType}),A}if(Number.isNaN(e.data.getTime()))return R(this._getOrReturnCtx(e),{code:P.invalid_date}),A;let r=new N;for(let s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(R(t=this._getOrReturnCtx(e,t),{code:P.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(R(t=this._getOrReturnCtx(e,t),{code:P.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):y.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new eu({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.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}}eu.create=e=>new eu({checks:[],coerce:e?.coerce||!1,typeName:_.ZodDate,...q(e)});class ec extends U{_parse(e){if(this._getType(e)!==S.symbol){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.symbol,received:t.parsedType}),A}return z(e.data)}}ec.create=e=>new ec({typeName:_.ZodSymbol,...q(e)});class ed extends U{_parse(e){if(this._getType(e)!==S.undefined){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.undefined,received:t.parsedType}),A}return z(e.data)}}ed.create=e=>new ed({typeName:_.ZodUndefined,...q(e)});class ep extends U{_parse(e){if(this._getType(e)!==S.null){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.null,received:t.parsedType}),A}return z(e.data)}}ep.create=e=>new ep({typeName:_.ZodNull,...q(e)});class ef extends U{constructor(){super(...arguments),this._any=!0}_parse(e){return z(e.data)}}ef.create=e=>new ef({typeName:_.ZodAny,...q(e)});class eh extends U{constructor(){super(...arguments),this._unknown=!0}_parse(e){return z(e.data)}}eh.create=e=>new eh({typeName:_.ZodUnknown,...q(e)});class em extends U{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.never,received:t.parsedType}),A}}em.create=e=>new em({typeName:_.ZodNever,...q(e)});class ey extends U{_parse(e){if(this._getType(e)!==S.undefined){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.void,received:t.parsedType}),A}return z(e.data)}}ey.create=e=>new ey({typeName:_.ZodVoid,...q(e)});class eg extends U{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==S.array)return R(t,{code:P.invalid_type,expected:S.array,received:t.parsedType}),A;if(null!==s.exactLength){let e=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(e||i)&&(R(t,{code:e?P.too_big:P.too_small,minimum:i?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(R(t,{code:P.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(R(t,{code:P.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>s.type._parseAsync(new D(t,e,t.path,r)))).then(e=>N.mergeArray(r,e));let i=[...t.data].map((e,r)=>s.type._parseSync(new D(t,e,t.path,r)));return N.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new eg({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new eg({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new eg({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}eg.create=(e,t)=>new eg({type:e,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...q(t)});class ev extends U{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=y.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.object,received:t.parsedType}),A}let{status:t,ctx:r}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof em&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let n=[];for(let e of i){let t=s[e],i=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new D(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof em){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(R(r,{code:P.unrecognized_keys,keys:a}),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 a){let s=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new D(r,s,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,s=await t.value;e.push({key:r,value:s,alwaysSet:t.alwaysSet})}return e}).then(e=>N.mergeObjectSync(t,e)):N.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new ev({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let s=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:v.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ev({...this._def,unknownKeys:"strip"})}passthrough(){return new ev({...this._def,unknownKeys:"passthrough"})}extend(e){return new ev({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ev({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ev({...this._def,catchall:e})}pick(e){let t={};for(let r of y.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ev({...this._def,shape:()=>t})}omit(e){let t={};for(let r of y.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ev({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ev){let r={};for(let s in t.shape){let i=t.shape[s];r[s]=eC.create(e(i))}return new ev({...t._def,shape:()=>r})}if(t instanceof eg)return new eg({...t._def,type:e(t.element)});if(t instanceof eC)return eC.create(e(t.unwrap()));if(t instanceof ez)return ez.create(e(t.unwrap()));if(t instanceof ek)return ek.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of y.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}return new ev({...this._def,shape:()=>t})}required(e){let t={};for(let r of y.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eC;)e=e._def.innerType;t[r]=e}return new ev({...this._def,shape:()=>t})}keyof(){return eO(y.objectKeys(this.shape))}}ev.create=(e,t)=>new ev({shape:()=>e,unknownKeys:"strip",catchall:em.create(),typeName:_.ZodObject,...q(t)}),ev.strictCreate=(e,t)=>new ev({shape:()=>e,unknownKeys:"strict",catchall:em.create(),typeName:_.ZodObject,...q(t)}),ev.lazycreate=(e,t)=>new ev({shape:e,unknownKeys:"strip",catchall:em.create(),typeName:_.ZodObject,...q(t)});class e_ extends U{_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 I(e.ctx.common.issues));return R(t,{code:P.invalid_union,unionErrors:r}),A});{let e,s=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&s.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=s.map(e=>new I(e));return R(t,{code:P.invalid_union,unionErrors:i}),A}}get options(){return this._def.options}}e_.create=(e,t)=>new e_({options:e,typeName:_.ZodUnion,...q(t)});let eb=e=>{if(e instanceof eP)return eb(e.schema);if(e instanceof eA)return eb(e.innerType());if(e instanceof eI)return[e.value];if(e instanceof ej)return e.options;if(e instanceof eR)return y.objectValues(e.enum);else if(e instanceof eM)return eb(e._def.innerType);else if(e instanceof ed)return[void 0];else if(e instanceof ep)return[null];else if(e instanceof eC)return[void 0,...eb(e.unwrap())];else if(e instanceof ez)return[null,...eb(e.unwrap())];else if(e instanceof eq)return eb(e.unwrap());else if(e instanceof eZ)return eb(e.unwrap());else if(e instanceof eD)return eb(e._def.innerType);else return[]};class ew extends U{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return R(t,{code:P.invalid_type,expected:S.object,received:t.parsedType}),A;let r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(R(t,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),A)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let s=new Map;for(let r of t){let t=eb(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(s.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,r)}}return new ew({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...q(r)})}}class e$ extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if("aborted"===e.status||"aborted"===s.status)return A;let i=function e(t,r){let s=T(t),i=T(r);if(t===r)return{valid:!0,data:t};if(s===S.object&&i===S.object){let s=y.objectKeys(r),i=y.objectKeys(t).filter(e=>-1!==s.indexOf(e)),a={...t,...r};for(let s of i){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};a[s]=i.data}return{valid:!0,data:a}}if(s===S.array&&i===S.array){if(t.length!==r.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};s.push(a.data)}return{valid:!0,data:s}}if(s===S.date&&i===S.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}):(R(r,{code:P.invalid_intersection_types}),A)};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}))}}e$.create=(e,t,r)=>new e$({left:e,right:t,typeName:_.ZodIntersection,...q(r)});class ek extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return R(r,{code:P.invalid_type,expected:S.array,received:r.parsedType}),A;if(r.data.length<this._def.items.length)return R(r,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;!this._def.rest&&r.data.length>this._def.items.length&&(R(r,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((e,t)=>{let s=this._def.items[t]||this._def.rest;return s?s._parse(new D(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(s).then(e=>N.mergeArray(t,e)):N.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new ek({...this._def,rest:e})}}ek.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ek({items:e,typeName:_.ZodTuple,rest:null,...q(t)})};class eE extends U{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!==S.object)return R(r,{code:P.invalid_type,expected:S.object,received:r.parsedType}),A;let s=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)s.push({key:i._parse(new D(r,e,r.path,e)),value:a._parse(new D(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?N.mergeObjectAsync(t,s):N.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return new eE(t instanceof U?{keyType:e,valueType:t,typeName:_.ZodRecord,...q(r)}:{keyType:ea.create(),valueType:e,typeName:_.ZodRecord,...q(t)})}}class ex extends U{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!==S.map)return R(r,{code:P.invalid_type,expected:S.map,received:r.parsedType}),A;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:s._parse(new D(r,e,r.path,[a,"key"])),value:i._parse(new D(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let s=await r.key,i=await r.value;if("aborted"===s.status||"aborted"===i.status)return A;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let s=r.key,i=r.value;if("aborted"===s.status||"aborted"===i.status)return A;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}}}}ex.create=(e,t,r)=>new ex({valueType:t,keyType:e,typeName:_.ZodMap,...q(r)});class eS extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return R(r,{code:P.invalid_type,expected:S.set,received:r.parsedType}),A;let s=this._def;null!==s.minSize&&r.data.size<s.minSize.value&&(R(r,{code:P.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&r.data.size>s.maxSize.value&&(R(r,{code:P.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let s of e){if("aborted"===s.status)return A;"dirty"===s.status&&t.dirty(),r.add(s.value)}return{status:t.value,value:r}}let n=[...r.data.values()].map((e,t)=>i._parse(new D(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>a(e)):a(n)}min(e,t){return new eS({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new eS({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eS.create=(e,t)=>new eS({valueType:e,minSize:null,maxSize:null,typeName:_.ZodSet,...q(t)});class eT extends U{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return R(t,{code:P.invalid_type,expected:S.function,received:t.parsedType}),A;function r(e,r){return j({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,O,O].filter(e=>!!e),issueData:{code:P.invalid_arguments,argumentsError:r}})}function s(e,r){return j({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,O,O].filter(e=>!!e),issueData:{code:P.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof eN){let e=this;return z(async function(...t){let n=new I([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw n.addIssue(r(t,e)),n}),l=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw n.addIssue(s(l,e)),n})})}{let e=this;return z(function(...t){let n=e._def.args.safeParse(t,i);if(!n.success)throw new I([r(t,n.error)]);let o=Reflect.apply(a,this,n.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new I([s(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new eT({...this._def,args:ek.create(e).rest(eh.create())})}returns(e){return new eT({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new eT({args:e||ek.create([]).rest(eh.create()),returns:t||eh.create(),typeName:_.ZodFunction,...q(r)})}}class eP extends U{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})}}eP.create=(e,t)=>new eP({getter:e,typeName:_.ZodLazy,...q(t)});class eI extends U{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:P.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:e.data}}get value(){return this._def.value}}function eO(e,t){return new ej({values:e,typeName:_.ZodEnum,...q(t)})}eI.create=(e,t)=>new eI({value:e,typeName:_.ZodLiteral,...q(t)});class ej extends U{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{expected:y.joinValues(r),received:t.parsedType,code:P.invalid_type}),A}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 R(t,{received:t.data,code:P.invalid_enum_value,options:r}),A}return z(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 ej.create(e,{...this._def,...t})}exclude(e,t=this._def){return ej.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ej.create=eO;class eR extends U{_parse(e){let t=y.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let e=y.objectValues(t);return R(r,{expected:y.joinValues(e),received:r.parsedType,code:P.invalid_type}),A}if(this._cache||(this._cache=new Set(y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=y.objectValues(t);return R(r,{received:r.data,code:P.invalid_enum_value,options:e}),A}return z(e.data)}get enum(){return this._def.values}}eR.create=(e,t)=>new eR({values:e,typeName:_.ZodNativeEnum,...q(t)});class eN extends U{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==S.promise&&!1===t.common.async?(R(t,{code:P.invalid_type,expected:S.promise,received:t.parsedType}),A):z((t.parsedType===S.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eN.create=(e,t)=>new eN({type:e,typeName:_.ZodPromise,...q(t)});class eA extends U{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.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=>{R(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 A;let s=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===s.status?A:"dirty"===s.status||"dirty"===t.value?C(s.value):s});{if("aborted"===t.value)return A;let s=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===s.status?A:"dirty"===s.status||"dirty"===t.value?C(s.value):s}}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?A:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===s.status?A:("dirty"===s.status&&t.dirty(),e(s.value),{status:t.value,value:s.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?A: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 A;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}}y.assertNever(s)}}eA.create=(e,t,r)=>new eA({schema:e,typeName:_.ZodEffects,effect:t,...q(r)}),eA.createWithPreprocess=(e,t,r)=>new eA({schema:t,effect:{type:"preprocess",transform:e},typeName:_.ZodEffects,...q(r)});class eC extends U{_parse(e){return this._getType(e)===S.undefined?z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eC.create=(e,t)=>new eC({innerType:e,typeName:_.ZodOptional,...q(t)});class ez extends U{_parse(e){return this._getType(e)===S.null?z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ez.create=(e,t)=>new ez({innerType:e,typeName:_.ZodNullable,...q(t)});class eM extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===S.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eM.create=(e,t)=>new eM({innerType:e,typeName:_.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...q(t)});class eD extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return M(s)?s.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eD.create=(e,t)=>new eD({innerType:e,typeName:_.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...q(t)});class eL extends U{_parse(e){if(this._getType(e)!==S.nan){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.nan,received:t.parsedType}),A}return{status:"valid",value:e.data}}}eL.create=e=>new eL({typeName:_.ZodNaN,...q(e)}),Symbol("zod_brand");class eq extends U{_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 eU extends U{_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?A:"dirty"===e.status?(t.dirty(),C(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?A:"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 eU({in:e,out:t,typeName:_.ZodPipeline})}}class eZ extends U{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return M(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}eZ.create=(e,t)=>new eZ({innerType:e,typeName:_.ZodReadonly,...q(t)}),ev.lazycreate,(u=_||(_={})).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 eV=ea.create;en.create,eL.create,eo.create;let eF=el.create;eu.create,ec.create,ed.create,ep.create,ef.create,eh.create,em.create,ey.create,eg.create;let eK=ev.create;ev.strictCreate,e_.create,ew.create,e$.create,ek.create,eE.create,ex.create,eS.create;let eH=eT.create;eP.create,eI.create,ej.create,eR.create;let eB=eN.create;eA.create,eC.create,ez.create,eA.createWithPreprocess,eU.create;let eG=eK({apiKey:eV().optional(),headerName:eV().optional(),validateApiKey:eH().args(eV()).returns(eB(eF())).optional()}).strict().refine(e=>void 0!==e.apiKey||void 0!==e.validateApiKey,{message:"Either 'apiKey' or 'validateApiKey' must be provided"}).refine(e=>void 0===e.apiKey||void 0===e.validateApiKey,{message:"'apiKey' and 'validateApiKey' are mutually exclusive - provide only one"}),eW="Unauthorized: Missing or invalid API key";function eJ(e){let t=eG.safeParse(e);if(!t.success){let r="apiKey"in e,s="validateApiKey"in e;if(r&&s)throw Error("'apiKey' and 'validateApiKey' are mutually exclusive - provide only one");if(r||s)throw Error(`Invalid configuration: ${t.error.message}`);throw Error("Either 'apiKey' or 'validateApiKey' must be provided")}let r=e.headerName??"x-api-key",s="apiKey"in e?e.apiKey:void 0,i="validateApiKey"in e?e.validateApiKey:void 0;return async(t,a,n)=>{let o=t.header(r);!o||"apiKey"in e&&o!==s||i&&!await i(o)?a.status(401).json({error:eW}):n()}}var eX=i(8400),eY=i.n(eX);function eQ(e){return(t,r,s)=>{let i=t.header("Authorization");if(!i||!i.startsWith("Bearer "))return void r.status(401).json({error:"Unauthorized: Missing or malformed Authorization header"});let a=i.slice(7).trim();if(!a)return void r.status(401).json({error:"Unauthorized: Missing access token"});try{let{secret:r,...i}=e;t.user=eY().verify(a,r,i),s()}catch(e){r.status(401).json({error:"Unauthorized: Invalid or expired token"})}}}let e0=require("async_hooks"),e1=(e,t)=>{globalThis[e]=t},e2=e=>globalThis[e];function e9({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if(e2(t))return e2(t);let s=new e0.AsyncLocalStorage,i=globalThis[r]??{current:null};e1(r,i);let a={provider:(e,t)=>(i.current=e,s.run(e,t)),getContext:()=>{let t=s.getStore();if(t)return t;if(i.current)return i.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:t=>{let r=s.getStore()??i.current;if(!r)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(r,t)}};return e1(t,a),a}let e4=Symbol.for("mcp.completable");function e5(e,t){return Object.defineProperty(e,e4,{value:{complete:t},enumerable:!1,writable:!1,configurable:!1}),e}(b||(b={})).Completable="McpCompletable";let e6=Object.freeze({status:"aborted"});function e3(e,t,r){function s(r,s){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:s,constr:n,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,s);let i=n.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function n(e){var t;let i=r?.Parent?new a:this;for(let r of(s(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(n,"init",{value:s}),Object.defineProperty(n,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}Symbol("zod_brand");class e8 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class e7 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}let te={};function tt(e){return e&&Object.assign(te,e),te}function tr(e,t="|"){return e.map(e=>tb(e)).join(t)}function ts(e,t){return"bigint"==typeof t?t.toString():t}function ti(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ta(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let tn=Symbol("evaluating");function to(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==tn)return void 0===s&&(s=tn,s=r()),s},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function tl(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tu(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function tc(e){return JSON.stringify(e)}let td="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tp(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let tf=ti(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function th(e){if(!1===tp(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==tp(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function tm(e){return th(e)?{...e}:Array.isArray(e)?[...e]:e}let ty=new Set(["string","number","symbol"]);function tg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tv(e,t,r){let s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function t_(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 tb(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let tw={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 t$(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function tk(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function tE(e){return"string"==typeof e?e:e?.message}function tx(e,t,r){let s={...e,path:e.path??[]};return e.message||(s.message=tE(e.inst?._zod.def?.error?.(e))??tE(t?.error?.(e))??tE(r.customError?.(e))??tE(r.localeError?.(e))??"Invalid input"),delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function tS(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function tT(...e){let[t,r,s]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:s}:{...t}}let tP=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ts,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tI=e3("$ZodError",tP),tO=e3("$ZodError",tP,{Parent:Error}),tj=e=>(t,r,s,i)=>{let a=s?Object.assign(s,{async:!1}):{async:!1},n=t._zod.run({value:r,issues:[]},a);if(n instanceof Promise)throw new e8;if(n.issues.length){let t=new(i?.Err??e)(n.issues.map(e=>tx(e,a,tt())));throw td(t,i?.callee),t}return n.value},tR=e=>async(t,r,s,i)=>{let a=s?Object.assign(s,{async:!0}):{async:!0},n=t._zod.run({value:r,issues:[]},a);if(n instanceof Promise&&(n=await n),n.issues.length){let t=new(i?.Err??e)(n.issues.map(e=>tx(e,a,tt())));throw td(t,i?.callee),t}return n.value},tN=e=>(t,r,s)=>{let i=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new e8;return a.issues.length?{success:!1,error:new(e??tI)(a.issues.map(e=>tx(e,i,tt())))}:{success:!0,data:a.value}},tA=tN(tO),tC=e=>async(t,r,s)=>{let i=s?Object.assign(s,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>tx(e,i,tt())))}:{success:!0,data:a.value}},tz=tC(tO),tM=/^[cC][^\s-]{8,}$/,tD=/^[0-9a-z]+$/,tL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tq=/^[0-9a-vA-V]{20}$/,tU=/^[A-Za-z0-9]{27}$/,tZ=/^[a-zA-Z0-9_-]{21}$/,tV=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tF=/^([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})$/,tK=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tH=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tB=/^(?:(?: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])$/,tG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tW=/^((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])$/,tJ=/^(([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])$/,tX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tY=/^[A-Za-z0-9_-]*$/,tQ=/^\+(?:[0-9]){6,14}[0-9]$/,t0="(?:(?:\\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])))",t1=RegExp(`^${t0}$`);function t2(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let t9=/^-?\d+n?$/,t4=/^-?\d+$/,t5=/^-?\d+(?:\.\d+)?/,t6=/^(?:true|false)$/i,t3=/^null$/i,t8=/^[^A-Z]*$/,t7=/^[^a-z]*$/,re=e3("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),rt={number:"number",bigint:"bigint",object:"date"},rr=e3("$ZodCheckLessThan",(e,t)=>{re.init(e,t);let r=rt[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rs=e3("$ZodCheckGreaterThan",(e,t)=>{re.init(e,t);let r=rt[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ri=e3("$ZodCheckMultipleOf",(e,t)=>{re.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){let r=(e.toString().split(".")[1]||"").length,s=t.toString(),i=(s.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(s)){let e=s.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=r>i?r:i;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}(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})}}),ra=e3("$ZodCheckNumberFormat",(e,t)=>{re.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),s=r?"int":"number",[i,a]=tw[t.format];e._zod.onattach.push(e=>{let s=e._zod.bag;s.format=t.format,s.minimum=i,s.maximum=a,r&&(s.pattern=t4)}),e._zod.check=n=>{let o=n.value;if(r){if(!Number.isInteger(o))return void n.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?n.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,continue:!t.abort}):n.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,continue:!t.abort}))}o<i&&n.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),o>a&&n.issues.push({origin:"number",input:o,code:"too_big",maximum:a,inst:e})}}),rn=e3("$ZodCheckMaxLength",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let s=r.value;if(s.length<=t.maximum)return;let i=tS(s);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),ro=e3("$ZodCheckMinLength",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let s=r.value;if(s.length>=t.minimum)return;let i=tS(s);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),rl=e3("$ZodCheckLengthEquals",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let s=r.value,i=s.length;if(i===t.length)return;let a=tS(s),n=i>t.length;r.issues.push({origin:a,...n?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ru=e3("$ZodCheckStringFormat",(e,t)=>{var r,s;re.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})}):(s=e._zod).check??(s.check=()=>{})}),rc=e3("$ZodCheckRegex",(e,t)=>{ru.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})}}),rd=e3("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t8),ru.init(e,t)}),rp=e3("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t7),ru.init(e,t)}),rf=e3("$ZodCheckIncludes",(e,t)=>{re.init(e,t);let r=tg(t.includes),s=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(s)}),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})}}),rh=e3("$ZodCheckStartsWith",(e,t)=>{re.init(e,t);let r=RegExp(`^${tg(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})}}),rm=e3("$ZodCheckEndsWith",(e,t)=>{re.init(e,t);let r=RegExp(`.*${tg(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})}}),ry=e3("$ZodCheckOverwrite",(e,t)=>{re.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class rg{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let rv={major:4,minor:1,patch:13},r_=e3("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rv;let s=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&s.unshift(e),s))for(let r of t._zod.onattach)r(e);if(0===s.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let s,i=t$(e);for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,n=a._zod.check(e);if(n instanceof Promise&&r?.async===!1)throw new e8;if(s||n instanceof Promise)s=(s??Promise.resolve()).then(async()=>{await n,e.issues.length!==t&&(i||(i=t$(e,t)))});else{if(e.issues.length===t)continue;i||(i=t$(e,t))}}return s?s.then(()=>e):e},r=(r,i,a)=>{if(t$(r))return r.aborted=!0,r;let n=t(i,s,a);if(n instanceof Promise){if(!1===a.async)throw new e8;return n.then(t=>e._zod.parse(t,a))}return e._zod.parse(n,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let n=e._zod.parse(i,a);if(n instanceof Promise){if(!1===a.async)throw new e8;return n.then(e=>t(e,s,a))}return t(n,s,a)}}e["~standard"]={validate:t=>{try{let r=tA(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return tz(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),rb=e3("$ZodString",(e,t)=>{var r;let s;r_.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(s=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${s}$`)),e._zod.parse=(r,s)=>{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}}),rw=e3("$ZodStringFormat",(e,t)=>{ru.init(e,t),rb.init(e,t)}),r$=e3("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=tF),rw.init(e,t)}),rk=e3("$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=tK(e))}else t.pattern??(t.pattern=tK());rw.init(e,t)}),rE=e3("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tH),rw.init(e,t)}),rx=e3("$ZodURL",(e,t)=>{rw.init(e,t),e._zod.check=r=>{try{let s=r.value.trim(),i=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=s;return}catch(s){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rS=e3("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),rw.init(e,t)}),rT=e3("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=tZ),rw.init(e,t)}),rP=e3("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tM),rw.init(e,t)}),rI=e3("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tD),rw.init(e,t)}),rO=e3("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tL),rw.init(e,t)}),rj=e3("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tq),rw.init(e,t)}),rR=e3("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tU),rw.init(e,t)}),rN=e3("$ZodISODateTime",(e,t)=>{let r,s,i;t.pattern??(r=t2({precision:t.precision}),s=["Z"],t.local&&s.push(""),t.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${r}(?:${s.join("|")})`,t.pattern=RegExp(`^${t0}T(?:${i})$`)),rw.init(e,t)}),rA=e3("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=t1),rw.init(e,t)}),rC=e3("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${t2(t)}$`)),rw.init(e,t)}),rz=e3("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tV),rw.init(e,t)}),rM=e3("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tB),rw.init(e,t),e._zod.bag.format="ipv4"}),rD=e3("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=tG),rw.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),rL=e3("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tW),rw.init(e,t)}),rq=e3("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tJ),rw.init(e,t),e._zod.check=r=>{let s=r.value.split("/");try{if(2!==s.length)throw Error();let[e,t]=s;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function rU(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let rZ=e3("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tX),rw.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{rU(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rV=e3("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tY),rw.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!tY.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return rU(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})}}),rF=e3("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tQ),rw.init(e,t)}),rK=e3("$ZodJWT",(e,t)=>{rw.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[s]=r;if(!s)return!1;let i=JSON.parse(atob(s));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),rH=e3("$ZodNumber",(e,t)=>{r_.init(e,t),e._zod.pattern=e._zod.bag.pattern??t5,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),rB=e3("$ZodNumberFormat",(e,t)=>{ra.init(e,t),rH.init(e,t)}),rG=e3("$ZodBoolean",(e,t)=>{r_.init(e,t),e._zod.pattern=t6,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),rW=((e,t)=>{r_.init(e,t),e._zod.pattern=t9,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}},e3("$ZodNull",(e,t)=>{r_.init(e,t),e._zod.pattern=t3,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let s=t.value;return null===s||t.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),t}})),rJ=e3("$ZodAny",(e,t)=>{r_.init(e,t),e._zod.parse=e=>e}),rX=e3("$ZodUnknown",(e,t)=>{r_.init(e,t),e._zod.parse=e=>e}),rY=e3("$ZodNever",(e,t)=>{r_.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function rQ(e,t,r){e.issues.length&&t.issues.push(...tk(r,e.issues)),t.value[r]=e.value}(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}};let r0=e3("$ZodArray",(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let n=i[e],o=t.element._zod.run({value:n,issues:[]},s);o instanceof Promise?a.push(o.then(t=>rQ(t,r,e))):rQ(o,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function r1(e,t,r,s){e.issues.length&&t.issues.push(...tk(r,e.issues)),void 0===e.value?r in s&&(t.value[r]=void 0):t.value[r]=e.value}function r2(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let s=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(s)}}function r9(e,t,r,s,i,a){let n=[],o=i.keySet,l=i.catchall._zod,u=l.def.type;for(let i in t){if(o.has(i))continue;if("never"===u){n.push(i);continue}let a=l.run({value:t[i],issues:[]},s);a instanceof Promise?e.push(a.then(e=>r1(e,r,i,t))):r1(a,r,i,t)}return(n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let r4=e3("$ZodObject",(e,t)=>{let r;r_.init(e,t);let s=Object.getOwnPropertyDescriptor(t,"shape");if(!s?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=ti(()=>r2(t));to(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let s=e[t]._zod;if(s.values)for(let e of(r[t]??(r[t]=new Set),s.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,s)=>{r??(r=i.value);let n=t.value;if(!tp(n))return t.issues.push({expected:"object",code:"invalid_type",input:n,inst:e}),t;t.value={};let o=[],l=r.shape;for(let e of r.keys){let r=l[e]._zod.run({value:n[e],issues:[]},s);r instanceof Promise?o.push(r.then(r=>r1(r,t,e,n))):r1(r,t,e,n)}return a?r9(o,n,t,s,i.value,e):o.length?Promise.all(o).then(()=>t):t}}),r5=e3("$ZodObjectJIT",(e,t)=>{let r,s;r4.init(e,t);let i=e._zod.parse,a=ti(()=>r2(t)),n=!te.jitless,o=n&&tf.value,l=t.catchall;e._zod.parse=(u,c)=>{s??(s=a.value);let d=u.value;return tp(d)?n&&o&&c?.async===!1&&!0!==c.jitless?(r||(r=(e=>{let t=new rg(["shape","payload","ctx"]),r=a.value,s=e=>{let t=tc(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),n=0;for(let e of r.keys)i[e]=`key_${n++}`;for(let e of(t.write("const newResult = {};"),r.keys)){let r=i[e],a=tc(e);t.write(`const ${r} = ${s(e)};`),t.write(`
7
+ deps: ${r}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:r)[s]=e[s]);return[t,r]}(e);o(e,t),l(e,r)}};function o(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(0===Object.keys(t).length)return;let l=r.let("missing");for(let o in t){let u=t[o];if(0===u.length)continue;let c=(0,a.propertyInData)(r,i,o,n.opts.ownProperties);e.setParams({property:o,depsCount:u.length,deps:u.join(", ")}),n.allErrors?r.if(c,()=>{for(let t of u)(0,a.checkReportMissingProp)(e,t)}):(r.if((0,s._)`${c} && (${(0,a.checkMissingProp)(e,u,l)})`),(0,a.reportMissingProp)(e,l),r.else())}}function l(e,t=e.schema){let{gen:r,data:s,keyword:n,it:o}=e,u=r.name("valid");for(let l in t)(0,i.alwaysValidSchema)(o,t[l])||(r.if((0,a.propertyInData)(r,s,l,o.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:l},u);e.mergeValidEvaluated(t,u)},()=>r.var(u,!0)),e.ok(u))}t.validatePropertyDeps=o,t.validateSchemaDeps=l,t.default=n},8102(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);function a(e,t){let r=e.schema[t];return void 0!==r&&!(0,i.alwaysValidSchema)(e,r)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,s.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,s._)`{failingKeyword: ${e.ifClause}}`},code(e){let t,{gen:r,parentSchema:n,it:o}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let l=a(o,"then"),u=a(o,"else");if(!l&&!u)return;let c=r.let("valid",!0),d=r.name("_valid");if(t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d),e.mergeEvaluated(t),e.reset(),l&&u){let t=r.let("ifClause");e.setParams({ifClause:t}),r.if(d,p("then",t),p("else",t))}else l?r.if(d,p("then")):r.if((0,s.not)(d),p("else"));function p(t,i){return()=>{let a=e.subschema({keyword:t},d);r.assign(c,d),e.mergeValidEvaluated(a,c),i?r.assign(i,(0,s._)`${t}`):e.setParams({ifClause:t})}}e.pass(c,()=>e.error(!0))}}},8313(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(714),i=r(1997),a=r(3665),n=r(5153),o=r(2692),l=r(5860),u=r(374),c=r(8401),d=r(3252),p=r(6398),f=r(4948),h=r(1070),m=r(5368),y=r(2003),g=r(8102),v=r(1871);t.default=function(e=!1){let t=[f.default,h.default,m.default,y.default,g.default,v.default,u.default,c.default,l.default,d.default,p.default];return e?t.push(i.default,n.default):t.push(s.default,a.default),t.push(o.default),t}},3665(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let s=r(8994),i=r(7218),a=r(4954);function n(e,t,r=e.schema){let{gen:a,parentSchema:o,data:l,keyword:u,it:c}=e;(function(e){let{opts:s,errSchemaPath:a}=c,n=r.length,o=n===e.minItems&&(n===e.maxItems||!1===e[t]);if(s.strictTuples&&!o){let e=`"${u}" is ${n}-tuple, but minItems or maxItems/${t} are not specified or different at path "${a}"`;(0,i.checkStrictMode)(c,e,s.strictTuples)}})(o),c.opts.unevaluated&&r.length&&!0!==c.items&&(c.items=i.mergeEvaluated.items(a,r.length,c.items));let d=a.name("valid"),p=a.const("len",(0,s._)`${l}.length`);r.forEach((t,r)=>{(0,i.alwaysValidSchema)(c,t)||(a.if((0,s._)`${p} > ${r}`,()=>e.subschema({keyword:u,schemaProp:r,dataProp:r},d)),e.ok(d))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return n(e,"additionalItems",t);r.items=!0,(0,i.alwaysValidSchema)(r,t)||e.ok((0,a.validateArray)(e))}}},5153(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),a=r(4954),n=r(714);t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:r,it:s}=e,{prefixItems:o}=r;s.items=!0,(0,i.alwaysValidSchema)(s,t)||(o?(0,n.validateAdditionalItems)(e,o):e.ok((0,a.validateArray)(e)))}}},4948(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,s.alwaysValidSchema)(i,r))return void e.fail();let a=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}},5368(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:t,schema:r,parentSchema:a,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&a.discriminator)return;let o=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block(function(){r.forEach((r,a)=>{let c;(0,i.alwaysValidSchema)(n,r)?t.var(u,!0):c=e.subschema({keyword:"oneOf",schemaProp:a,compositeRule:!0},u),a>0&&t.if((0,s._)`${u} && ${o}`).assign(o,!1).assign(l,(0,s._)`[${l}, ${a}]`).else(),t.if(u,()=>{t.assign(o,!0),t.assign(l,a),c&&e.mergeEvaluated(c,s.Name)})})}),e.result(o,()=>e.reset(),()=>e.error(!0))}}},6398(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(8994),a=r(7218),n=r(7218);t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:l,it:u}=e,{opts:c}=u,d=(0,s.allSchemaProperties)(r),p=d.filter(e=>(0,a.alwaysValidSchema)(u,r[e]));if(0===d.length||p.length===d.length&&(!u.opts.unevaluated||!0===u.props))return;let f=c.strictSchema&&!c.allowMatchingProperties&&l.properties,h=t.name("valid");!0===u.props||u.props instanceof i.Name||(u.props=(0,n.evaluatedPropsToName)(t,u.props));let{props:m}=u;for(let e of d)f&&function(e){for(let t in f)new RegExp(e).test(t)&&(0,a.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),u.allErrors?y(e):(t.var(h,!0),y(e),t.if(h));function y(r){t.forIn("key",o,a=>{t.if((0,i._)`${(0,s.usePattern)(e,r)}.test(${a})`,()=>{let s=p.includes(r);s||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:a,dataPropType:n.Type.Str},h),u.opts.unevaluated&&!0!==m?t.assign((0,i._)`${m}[${a}]`,!0):s||u.allErrors||t.if((0,i.not)(h),()=>t.break())})})}}}},1997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3665);t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")}},3252(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6023),i=r(4954),a=r(7218),n=r(8401);t.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:l,it:u}=e;"all"===u.opts.removeAdditional&&void 0===o.additionalProperties&&n.default.code(new s.KeywordCxt(u,n.default,"additionalProperties"));let c=(0,i.allSchemaProperties)(r);for(let e of c)u.definedProperties.add(e);u.opts.unevaluated&&c.length&&!0!==u.props&&(u.props=a.mergeEvaluated.props(t,(0,a.toHash)(c),u.props));let d=c.filter(e=>!(0,a.alwaysValidSchema)(u,r[e]));if(0===d.length)return;let p=t.name("valid");for(let s of d){var f;(f=s,u.opts.useDefaults&&!u.compositeRule&&void 0!==r[f].default)?h(s):(t.if((0,i.propertyInData)(t,l,s,u.opts.ownProperties)),h(s),u.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(s),e.ok(p)}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}},374(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218);t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,s._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:t,schema:r,data:a,it:n}=e;if((0,i.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",a,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),t.if((0,s.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}}},1871(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(7218);t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}},4954(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let s=r(8994),i=r(7218),a=r(6660),n=r(7218);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,s._)`Object.prototype.hasOwnProperty`})}function l(e,t,r){return(0,s._)`${o(e)}.call(${t}, ${r})`}function u(e,t,r,i){let a=(0,s._)`${t}${(0,s.getProperty)(r)} === undefined`;return i?(0,s.or)(a,(0,s.not)(l(e,t,r))):a}function c(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}t.checkReportMissingProp=function(e,t){let{gen:r,data:i,it:a}=e;r.if(u(r,i,t,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,s._)`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},i,a){return(0,s.or)(...i.map(i=>(0,s.and)(u(e,t,i,r.ownProperties),(0,s._)`${a} = ${i}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=l,t.propertyInData=function(e,t,r,i){let a=(0,s._)`${t}${(0,s.getProperty)(r)} !== undefined`;return i?(0,s._)`${a} && ${l(e,t,r)}`:a},t.noPropertyInData=u,t.allSchemaProperties=c,t.schemaProperties=function(e,t){return c(t).filter(r=>!(0,i.alwaysValidSchema)(e,t[r]))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:l},u,c,d){let p=d?(0,s._)`${e}, ${t}, ${i}${n}`:t,f=[[a.default.instancePath,(0,s.strConcat)(a.default.instancePath,o)],[a.default.parentData,l.parentData],[a.default.parentDataProperty,l.parentDataProperty],[a.default.rootData,a.default.rootData]];l.opts.dynamicRef&&f.push([a.default.dynamicAnchors,a.default.dynamicAnchors]);let h=(0,s._)`${p}, ${r.object(...f)}`;return c!==s.nil?(0,s._)`${u}.call(${c}, ${h})`:(0,s._)`${u}(${h})`};let d=(0,s._)`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:a}=t.code,o=a(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,s._)`${"new RegExp"===a.code?d:(0,n.useFunc)(e,a)}(${r}, ${i})`})},t.validateArray=function(e){let{gen:t,data:r,keyword:a,it:n}=e,o=t.name("valid");if(n.allErrors){let e=t.let("valid",!0);return l(()=>t.assign(e,!1)),e}return t.var(o,!0),l(()=>t.break()),o;function l(n){let l=t.const("len",(0,s._)`${r}.length`);t.forRange("i",0,l,r=>{e.subschema({keyword:a,dataProp:r,dataPropType:i.Type.Num},o),t.if((0,s.not)(o),n)})}},t.validateUnion=function(e){let{gen:t,schema:r,keyword:a,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(e=>(0,i.alwaysValidSchema)(n,e))&&!n.opts.unevaluated)return;let o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((r,i)=>{let n=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},l);t.assign(o,(0,s._)`${o} || ${l}`),e.mergeValidEvaluated(n,l)||t.if((0,s.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}},3330(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}},8119(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(3330),i=r(930);t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,i.default]},930(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let s=r(4220),i=r(4954),a=r(8994),n=r(6660),o=r(1688),l=r(7218);function u(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,a._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function c(e,t,r,s){let{gen:o,it:u}=e,{allErrors:c,schemaEnv:d,opts:p}=u,f=p.passContext?n.default.this:a.nil;function h(e){let t=(0,a._)`${e}.errors`;o.assign(n.default.vErrors,(0,a._)`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),o.assign(n.default.errors,(0,a._)`${n.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;let s=null==(t=null==r?void 0:r.validate)?void 0:t.evaluated;if(!0!==u.props)if(s&&!s.dynamicProps)void 0!==s.props&&(u.props=l.mergeEvaluated.props(o,s.props,u.props));else{let t=o.var("props",(0,a._)`${e}.evaluated.props`);u.props=l.mergeEvaluated.props(o,t,u.props,a.Name)}if(!0!==u.items)if(s&&!s.dynamicItems)void 0!==s.items&&(u.items=l.mergeEvaluated.items(o,s.items,u.items));else{let t=o.var("items",(0,a._)`${e}.evaluated.items`);u.items=l.mergeEvaluated.items(o,t,u.items,a.Name)}}s?function(){if(!d.$async)throw Error("async schema referenced by sync schema");let r=o.let("valid");o.try(()=>{o.code((0,a._)`await ${(0,i.callValidateCode)(e,t,f)}`),m(t),c||o.assign(r,!0)},e=>{o.if((0,a._)`!(${e} instanceof ${u.ValidationError})`,()=>o.throw(e)),h(e),c||o.assign(r,!1)}),e.ok(r)}():e.result((0,i.callValidateCode)(e,t,f),()=>m(t),()=>h(t))}t.getValidate=u,t.callRef=c,t.default={keyword:"$ref",schemaType:"string",code(e){var t,r;let i,n,l,d,{gen:p,schema:f,it:h}=e,{baseId:m,schemaEnv:y,validateName:g,opts:v,self:_}=h,{root:b}=y;if(("#"===f||"#/"===f)&&m===b.baseId){if(y===b)return c(e,g,y,y.$async);let t=p.scopeValue("root",{ref:b});return c(e,(0,a._)`${t}.validate`,b,b.$async)}let w=o.resolveRef.call(_,b,m,f);if(void 0===w)throw new s.default(h.opts.uriResolver,m,f);return w instanceof o.SchemaEnv?(i=u(e,t=w),void c(e,i,t,t.$async)):(r=w,n=p.scopeValue("schema",!0===v.code.source?{ref:r,code:(0,a.stringify)(r)}:{ref:r}),l=p.name("valid"),d=e.subschema({schema:r,dataTypes:[],schemaPath:a.nil,topSchemaRef:n,errSchemaPath:f},l),void(e.mergeEvaluated(d),e.ok(l)))}}},9376(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(5141),a=r(1688),n=r(4220),o=r(7218);t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,s._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){let{gen:t,data:r,schema:l,parentSchema:u,it:c}=e,{oneOf:d}=u;if(!c.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!d)throw Error("discriminator: requires oneOf keyword");let f=t.let("valid",!1),h=t.const("tag",(0,s._)`${r}${(0,s.getProperty)(p)}`);t.if((0,s._)`typeof ${h} == "string"`,()=>(function(){let r=function(){var e;let t={},r=i(u),s=!0;for(let t=0;t<d.length;t++){let u=d[t];if((null==u?void 0:u.$ref)&&!(0,o.schemaHasRulesButRef)(u,c.self.RULES)){let e=u.$ref;if((u=a.resolveRef.call(c.self,c.schemaEnv.root,c.baseId,e))instanceof a.SchemaEnv&&(u=u.schema),void 0===u)throw new n.default(c.opts.uriResolver,c.baseId,e)}let f=null==(e=null==u?void 0:u.properties)?void 0:e[p];if("object"!=typeof f)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||i(u)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(f,t)}if(!s)throw Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let i in t.if(!1),r)t.elseIf((0,s._)`${h} === ${i}`),t.assign(f,function(r){let i=t.name("valid"),a=e.subschema({keyword:"oneOf",schemaProp:r},i);return e.mergeEvaluated(a,s.Name),i}(r[i]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:h,tagName:p}),t.endIf()})(),()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:h,tagName:p})),e.ok(f)}}},5141(e,t){"use strict";var r,s;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(s=r||(t.DiscrError=r={})).Tag="tag",s.Mapping="mapping"},3959(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8119),i=r(659),a=r(8313),n=r(8563),o=r(4618);t.default=[s.default,i.default,(0,a.default)(),n.default,o.metadataVocabulary,o.contentVocabulary]},424(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,s._)`{format: ${e}}`},code(e,t){let r,i,a,n,o,l,{gen:u,data:c,$data:d,schema:p,schemaCode:f,it:h}=e,{opts:m,errSchemaPath:y,schemaEnv:g,self:v}=h;m.validateFormats&&(d?(r=u.scopeValue("formats",{ref:v.formats,code:m.code.formats}),i=u.const("fDef",(0,s._)`${r}[${f}]`),a=u.let("fType"),n=u.let("format"),u.if((0,s._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>u.assign(a,(0,s._)`${i}.type || "string"`).assign(n,(0,s._)`${i}.validate`),()=>u.assign(a,(0,s._)`"string"`).assign(n,i)),e.fail$data((0,s.or)(!1===m.strictSchema?s.nil:(0,s._)`${f} && !${n}`,(o=g.$async?(0,s._)`(${i}.async ? await ${n}(${c}) : ${n}(${c}))`:(0,s._)`${n}(${c})`,l=(0,s._)`(typeof ${n} == "function" ? ${o} : ${n}.test(${c}))`,(0,s._)`${n} && ${n} !== true && ${a} === ${t} && !${l}`)))):function(){var r;let i,a,n=v.formats[p];if(!n){if(!1===m.strictSchema)return v.logger.warn(o());throw Error(o());function o(){return`unknown format "${p}" ignored in schema at path "${y}"`}}if(!0===n)return;let[l,d,f]=(i=(r=n)instanceof RegExp?(0,s.regexpCode)(r):m.code.formats?(0,s._)`${m.code.formats}${(0,s.getProperty)(p)}`:void 0,a=u.scopeValue("formats",{key:p,ref:r,code:i}),"object"!=typeof r||r instanceof RegExp?["string",r,a]:[r.type||"string",r.validate,(0,s._)`${a}.validate`]);l===t&&e.pass(function(){if("object"==typeof n&&!(n instanceof RegExp)&&n.async){if(!g.$async)throw Error("async format in sync schema");return(0,s._)`await ${f}(${c})`}return"function"==typeof d?(0,s._)`${f}(${c})`:(0,s._)`${f}.test(${c})`}())}())}}},8563(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=[r(424).default]},4618(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7080(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),a=r(6013);t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,s._)`{allowedValue: ${e}}`},code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:l}=e;n||l&&"object"==typeof l?e.fail$data((0,s._)`!${(0,i.useFunc)(t,a.default)}(${r}, ${o})`):e.fail((0,s._)`${l} !== ${r}`)}}},5358(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),a=r(6013);t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,s._)`{allowedValues: ${e}}`},code(e){let t,r,{gen:n,data:o,$data:l,schema:u,schemaCode:c,it:d}=e;if(!l&&0===u.length)throw Error("enum must have non-empty array");let p=u.length>=d.opts.loopEnum,f=()=>null!=t?t:t=(0,i.useFunc)(n,a.default);if(p||l)r=n.let("valid"),e.block$data(r,function(){n.assign(r,!1),n.forOf("v",c,e=>n.if((0,s._)`${f()}(${o}, ${e})`,()=>n.assign(r,!0).break()))});else{if(!Array.isArray(u))throw Error("ajv implementation error");let e=n.const("vSchema",c);r=(0,s.or)(...u.map((t,r)=>{var i,a;let n;return i=e,"object"==typeof(n=u[a=r])&&null!==n?(0,s._)`${f()}(${o}, ${i}[${a}])`:(0,s._)`${o} === ${n}`}))}e.pass(r)}}},659(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8997),i=r(9190),a=r(4280),n=r(8805),o=r(2189),l=r(3138),u=r(8870),c=r(1858),d=r(7080),p=r(5358);t.default=[s.default,i.default,a.default,n.default,o.default,l.default,u.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,p.default]},8870(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,a="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`${r}.length ${a} ${i}`)}}},4280(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=r(7218),a=r(5532);t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,l="maxLength"===t?s.operators.GT:s.operators.LT,u=!1===o.opts.unicode?(0,s._)`${r}.length`:(0,s._)`${(0,i.useFunc)(e.gen,a.default)}(${r})`;e.fail$data((0,s._)`${u} ${l} ${n}`)}}},8997(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994),i=s.operators,a={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.default={keyword:Object.keys(a),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must be ${a[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${a[e].okStr}, limit: ${t}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,s._)`${r} ${a[t].fail} ${i} || isNaN(${r})`)}}},2189(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:i}=e,a="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`Object.keys(${r}).length ${a} ${i}`)}}},9190(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(8994);t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,s._)`{multipleOf: ${e}}`},code(e){let{gen:t,data:r,schemaCode:i,it:a}=e,n=a.opts.multipleOfPrecision,o=t.let("res"),l=n?(0,s._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${n}`:(0,s._)`${o} !== parseInt(${o})`;e.fail$data((0,s._)`(${i} === 0 || (${o} = ${r}/${i}, ${l}))`)}}},8805(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(7218),a=r(8994);t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,a._)`{pattern: ${e}}`},code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:l,it:u}=e,c=u.opts.unicodeRegExp?"u":"";if(n){let{regExp:s}=u.opts.code,n="new RegExp"===s.code?(0,a._)`new RegExp`:(0,i.useFunc)(t,s),o=t.let("valid");t.try(()=>t.assign(o,(0,a._)`${n}(${l}, ${c}).test(${r})`),()=>t.assign(o,!1)),e.fail$data((0,a._)`!${o}`)}else{let t=(0,s.usePattern)(e,o);e.fail$data((0,a._)`!${t}.test(${r})`)}}}},3138(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(4954),i=r(8994),a=r(7218);t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,i.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,i._)`{missingProperty: ${e}}`},code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:l,it:u}=e,{opts:c}=u;if(!l&&0===r.length)return;let d=r.length>=c.loopRequired;if(u.allErrors?function(){if(d||l)e.block$data(i.nil,p);else for(let t of r)(0,s.checkReportMissingProp)(e,t)}():function(){let a=t.let("missing");if(d||l){let r=t.let("valid",!0);e.block$data(r,()=>{var l,u;return l=a,u=r,void(e.setParams({missingProperty:l}),t.forOf(l,n,()=>{t.assign(u,(0,s.propertyInData)(t,o,l,c.ownProperties)),t.if((0,i.not)(u),()=>{e.error(),t.break()})},i.nil))}),e.ok(r)}else t.if((0,s.checkMissingProp)(e,r,a)),(0,s.reportMissingProp)(e,a),t.else()}(),c.strictRequired){let t=e.parentSchema.properties,{definedProperties:s}=e.it;for(let e of r)if((null==t?void 0:t[e])===void 0&&!s.has(e)){let t=u.schemaEnv.baseId+u.errSchemaPath,r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,a.checkStrictMode)(u,r,u.opts.strictRequired)}}function p(){t.forOf("prop",n,r=>{e.setParams({missingProperty:r}),t.if((0,s.noPropertyInData)(t,o,r,c.ownProperties),()=>e.error())})}}}},1858(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let s=r(6419),i=r(8994),a=r(7218),n=r(6013);t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,i.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,i._)`{i: ${e}, j: ${t}}`},code(e){let{gen:t,data:r,$data:o,schema:l,parentSchema:u,schemaCode:c,it:d}=e;if(!o&&!l)return;let p=t.let("valid"),f=u.items?(0,s.getSchemaTypes)(u.items):[];e.block$data(p,function(){let o=t.let("i",(0,i._)`${r}.length`),l=t.let("j");e.setParams({i:o,j:l}),t.assign(p,!0),t.if((0,i._)`${o} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?function(a,n){let o=t.name("item"),l=(0,s.checkDataTypes)(f,o,d.opts.strictNumbers,s.DataType.Wrong),u=t.const("indices",(0,i._)`{}`);t.for((0,i._)`;${a}--;`,()=>{t.let(o,(0,i._)`${r}[${a}]`),t.if(l,(0,i._)`continue`),f.length>1&&t.if((0,i._)`typeof ${o} == "string"`,(0,i._)`${o} += "_"`),t.if((0,i._)`typeof ${u}[${o}] == "number"`,()=>{t.assign(n,(0,i._)`${u}[${o}]`),e.error(),t.assign(p,!1).break()}).code((0,i._)`${u}[${o}] = ${a}`)})}:function(s,o){let l=(0,a.useFunc)(t,n.default),u=t.name("outer");t.label(u).for((0,i._)`;${s}--;`,()=>t.for((0,i._)`${o} = ${s}; ${o}--;`,()=>t.if((0,i._)`${l}(${r}[${s}], ${r}[${o}])`,()=>{e.error(),t.assign(p,!1).break(u)})))})(o,l))},(0,i._)`${c} === false`),e.ok(p)}}},9454(e,t,r){"use strict";var s=r(181).Buffer,i=r(181).SlowBuffer;function a(e,t){if(!s.isBuffer(e)||!s.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}e.exports=a,a.install=function(){s.prototype.equal=i.prototype.equal=function(e){return a(this,e)}};var n=s.prototype.equal,o=i.prototype.equal;a.restore=function(){s.prototype.equal=n,i.prototype.equal=o}},6507(e,t,r){"use strict";let s=r(5317),i=r(8388),a=r(442);function n(e,t,r){let n=i(e,t,r),o=s.spawn(n.command,n.args,n.options);return a.hookChildProcess(o,n),o}e.exports=n,e.exports.spawn=n,e.exports.sync=function(e,t,r){let n=i(e,t,r),o=s.spawnSync(n.command,n.args,n.options);return o.error=o.error||a.verifyENOENTSync(o.status,n),o},e.exports._parse=i,e.exports._enoent=a},442(e){"use strict";let t="win32"===process.platform;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function s(e,s){return t&&1===e&&!s.file?r(s.original,"spawn"):null}e.exports={hookChildProcess:function(e,r){if(!t)return;let i=e.emit;e.emit=function(t,a){if("exit"===t){let t=s(a,r);if(t)return i.call(e,"error",t)}return i.apply(e,arguments)}},verifyENOENT:s,verifyENOENTSync:function(e,s){return t&&1===e&&!s.file?r(s.original,"spawnSync"):null},notFoundError:r}},8388(e,t,r){"use strict";let s=r(6928),i=r(3803),a=r(2077),n=r(1880),o="win32"===process.platform,l=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;e.exports=function(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null);let c={command:e,args:t=t?t.slice(0):[],options:r=Object.assign({},r),file:void 0,original:{command:e,args:t}};return r.shell?c:function(e){let t;if(!o)return e;let r=(e.file=i(e),(t=e.file&&n(e.file))?(e.args.unshift(e.file),e.command=t,i(e)):e.file),c=!l.test(r);if(e.options.forceShell||c){let t=u.test(r);e.command=s.normalize(e.command),e.command=a.command(e.command),e.args=e.args.map(e=>a.argument(e,t));let i=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${i}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}(c)}},2077(e){"use strict";let t=/([()\][%!^"`<>&|;, *?])/g;e.exports.command=function(e){return e.replace(t,"^$1")},e.exports.argument=function(e,r){return e=(e=(e=`${e}`).replace(/(?=(\\+?)?)\1"/g,'$1$1\\"')).replace(/(?=(\\+?)?)\1$/,"$1$1"),e=(e=`"${e}"`).replace(t,"^$1"),r&&(e=e.replace(t,"^$1")),e}},1880(e,t,r){"use strict";let s=r(9896),i=r(600);e.exports=function(e){let t,r=Buffer.alloc(150);try{t=s.openSync(e,"r"),s.readSync(t,r,0,150,0),s.closeSync(t)}catch(e){}return i(r.toString())}},3803(e,t,r){"use strict";let s=r(6928),i=r(1905),a=r(9695);function n(e,t){let r,n=e.options.env||process.env,o=process.cwd(),l=null!=e.options.cwd,u=l&&void 0!==process.chdir&&!process.chdir.disabled;if(u)try{process.chdir(e.options.cwd)}catch(e){}try{r=i.sync(e.command,{path:n[a({env:n})],pathExt:t?s.delimiter:void 0})}catch(e){}finally{u&&process.chdir(o)}return r&&(r=s.resolve(l?e.options.cwd:"",r)),r}e.exports=function(e){return n(e)||n(e,!0)}},8583(e,t,r){let s=r(9896),i=r(6928),a=r(857),n=r(6982),o=r(4519).version,l=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function u(e){console.log(`[dotenv@${o}][DEBUG] ${e}`)}function c(e){console.log(`[dotenv@${o}] ${e}`)}function d(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function p(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)s.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=i.resolve(process.cwd(),".env.vault");return s.existsSync(t)?t:null}function f(e){return"~"===e[0]?i.join(a.homedir(),e.slice(1)):e}let h={configDotenv:function(e){let t,r=i.resolve(process.cwd(),".env"),a="utf8",n=!!(e&&e.debug),o=!e||!("quiet"in e)||e.quiet;e&&e.encoding?a=e.encoding:n&&u("No encoding is specified. UTF-8 is used by default");let l=[r];if(e&&e.path)if(Array.isArray(e.path))for(let t of(l=[],e.path))l.push(f(t));else l=[f(e.path)];let d={};for(let r of l)try{let t=h.parse(s.readFileSync(r,{encoding:a}));h.populate(d,t,e)}catch(e){n&&u(`Failed to load ${r} ${e.message}`),t=e}let p=process.env;if(e&&null!=e.processEnv&&(p=e.processEnv),h.populate(p,d,e),n||!o){let e=Object.keys(d).length,r=[];for(let e of l)try{let t=i.relative(process.cwd(),e);r.push(t)}catch(r){n&&u(`Failed to load ${e} ${r.message}`),t=r}c(`injecting env (${e}) from ${r.join(",")}`)}return t?{parsed:d,error:t}:{parsed:d}},_configVault:function(e){let t=!!(e&&e.debug),r=!e||!("quiet"in e)||e.quiet;(t||!r)&&c("Loading env from encrypted .env.vault");let s=h._parseVault(e),i=process.env;return e&&null!=e.processEnv&&(i=e.processEnv),h.populate(i,s,e),{parsed:s}},_parseVault:function(e){let t,r=p(e=e||{});e.path=r;let s=h.configDotenv(e);if(!s.parsed){let e=Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw e.code="MISSING_DATA",e}let i=d(e).split(","),a=i.length;for(let e=0;e<a;e++)try{let r=i[e].trim(),a=function(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){let e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}let s=r.password;if(!s){let e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}let i=r.searchParams.get("environment");if(!i){let e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}let a=`DOTENV_VAULT_${i.toUpperCase()}`,n=e.parsed[a];if(!n){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:n,key:s}}(s,r);t=h.decrypt(a.ciphertext,a.key);break}catch(t){if(e+1>=a)throw t}return h.parse(t)},config:function(e){if(0===d(e).length)return h.configDotenv(e);let t=p(e);if(!t){var r;return r=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${o}][WARN] ${r}`),h.configDotenv(e)}return h._configVault(e)},decrypt:function(e,t){let r=Buffer.from(t.slice(-64),"hex"),s=Buffer.from(e,"base64"),i=s.subarray(0,12),a=s.subarray(-16);s=s.subarray(12,-16);try{let e=n.createDecipheriv("aes-256-gcm",r,i);return e.setAuthTag(a),`${e.update(s)}${e.final()}`}catch(s){let e=s instanceof RangeError,t="Invalid key length"===s.message,r="Unsupported state or unable to authenticate data"===s.message;if(e||t){let e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){let e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw s}},parse:function(e){let t,r={},s=e.toString();for(s=s.replace(/\r\n?/mg,"\n");null!=(t=l.exec(s));){let e=t[1],s=t[2]||"",i=(s=s.trim())[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===i&&(s=(s=s.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),r[e]=s}return r},populate:function(e,t,r={}){let s=!!(r&&r.debug),i=!!(r&&r.override);if("object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===i&&(e[r]=t[r]),s&&(!0===i?u(`"${r}" is already defined and WAS overwritten`):u(`"${r}" is already defined and was NOT overwritten`))):e[r]=t[r]}};e.exports.configDotenv=h.configDotenv,e.exports._configVault=h._configVault,e.exports._parseVault=h._parseVault,e.exports.config=h.config,e.exports.decrypt=h.decrypt,e.exports.parse=h.parse,e.exports.populate=h.populate,e.exports=h},9053(e,t,r){"use strict";var s=r(6608).Buffer,i=r(2188);function a(e){if(s.isBuffer(e))return e;if("string"==typeof e)return s.from(e,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function n(e,t,r){for(var s=0;t+s<r&&0===e[t+s];)++s;return e[t+s]>=128&&--s,s}e.exports={derToJose:function(e,t){e=a(e);var r=i(t),n=r+1,o=e.length,l=0;if(48!==e[l++])throw Error('Could not find expected "seq"');var u=e[l++];if(129===u&&(u=e[l++]),o-l<u)throw Error('"seq" specified length of "'+u+'", only "'+(o-l)+'" remaining');if(2!==e[l++])throw Error('Could not find expected "int" for "r"');var c=e[l++];if(o-l-2<c)throw Error('"r" specified length of "'+c+'", only "'+(o-l-2)+'" available');if(n<c)throw Error('"r" specified length of "'+c+'", max of "'+n+'" is acceptable');var d=l;if(l+=c,2!==e[l++])throw Error('Could not find expected "int" for "s"');var p=e[l++];if(o-l!==p)throw Error('"s" specified length of "'+p+'", expected "'+(o-l)+'"');if(n<p)throw Error('"s" specified length of "'+p+'", max of "'+n+'" is acceptable');var f=l;if((l+=p)!==o)throw Error('Expected to consume entire buffer, but "'+(o-l)+'" bytes remain');var h=r-c,m=r-p,y=s.allocUnsafe(h+c+m+p);for(l=0;l<h;++l)y[l]=0;e.copy(y,l,d+Math.max(-h,0),d+c),l=r;for(var g=l;l<g+m;++l)y[l]=0;return e.copy(y,l,f+Math.max(-m,0),f+p),y=(y=y.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=a(e);var r=i(t),o=e.length;if(o!==2*r)throw TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+o+'"');var l=n(e,0,r),u=n(e,r,e.length),c=r-l,d=r-u,p=2+c+1+1+d,f=p<128,h=s.allocUnsafe((f?2:3)+p),m=0;return h[m++]=48,f?h[m++]=p:(h[m++]=129,h[m++]=255&p),h[m++]=2,h[m++]=c,l<0?(h[m++]=0,m+=e.copy(h,m,0,r)):m+=e.copy(h,m,l,r),h[m++]=2,h[m++]=d,u<0?(h[m++]=0,e.copy(h,m,r)):e.copy(h,m,r+u),h}}},2188(e){"use strict";function t(e){return(e/8|0)+ +(e%8!=0)}var r={ES256:t(256),ES384:t(384),ES512:t(521)};e.exports=function(e){var t=r[e];if(t)return t;throw Error('Unknown algorithm "'+e+'"')}},7371(e){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(i=s;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=s;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=s;0!=i--;){var s,i,a,n=a[i];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}},9344(e,t,r){var s;function i(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(r,s){i(e,t||{},function(e,t){e?s(e):r(t)})})}s(e,t||{},function(e,s){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,s=!1),r(e,s)})}r(9896),s="win32"===process.platform||global.TESTING_WINDOWS?r(8541):r(709),e.exports=i,i.sync=function(e,t){try{return s.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||"EACCES"===e.code)return!1;throw e}}},709(e,t,r){e.exports=i,i.sync=function(e,t){return a(s.statSync(e),t)};var s=r(9896);function i(e,t,r){s.stat(e,function(e,s){r(e,!e&&a(s,t))})}function a(e,t){var r,s,i,a,n,o,l,u,c;return e.isFile()&&(r=e,s=t,i=r.mode,a=r.uid,n=r.gid,o=void 0!==s.uid?s.uid:process.getuid&&process.getuid(),l=void 0!==s.gid?s.gid:process.getgid&&process.getgid(),u=parseInt("100",8),c=parseInt("010",8),i&parseInt("001",8)||i&c&&n===l||i&u&&a===o||i&(u|c)&&0===o)}},8541(e,t,r){e.exports=a,a.sync=function(e,t){return i(s.statSync(e),e,t)};var s=r(9896);function i(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;var s=void 0!==r.pathExt?r.pathExt:process.env.PATHEXT;if(!s||-1!==(s=s.split(";")).indexOf(""))return!0;for(var i=0;i<s.length;i++){var a=s[i].toLowerCase();if(a&&t.substr(-a.length).toLowerCase()===a)return!0}return!1}function a(e,t,r){s.stat(e,function(s,a){r(s,!s&&i(a,e,t))})}},205(e){"use strict";var t=e.exports=function(e,r,s){"function"==typeof r&&(s=r,r={});var i="function"==typeof(s=r.cb||s)?s:s.pre||function(){};!function e(r,s,i,a,n,o,l,u,c,d){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var p in s(a,n,o,l,u,c,d),a){var f=a[p];if(Array.isArray(f)){if(p in t.arrayKeywords)for(var h=0;h<f.length;h++)e(r,s,i,f[h],n+"/"+p+"/"+h,o,n,p,a,h)}else if(p in t.propsKeywords){if(f&&"object"==typeof f)for(var m in f)e(r,s,i,f[m],n+"/"+p+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),o,n,p,a,m)}else(p in t.keywords||r.allKeys&&!(p in t.skipKeywords))&&e(r,s,i,f,n+"/"+p,o,n,p,a)}i(a,n,o,l,u,c,d)}}(r,i,s.post||function(){},e,"",e)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},2548(e,t,r){var s=r(3263);e.exports=function(e,t){t=t||{};var r=s.decode(e,t);if(!r)return null;var i=r.payload;if("string"==typeof i)try{var a=JSON.parse(i);null!==a&&"object"==typeof a&&(i=a)}catch(e){}return!0===t.complete?{header:r.header,payload:i,signature:r.signature}:i}},8400(e,t,r){e.exports={decode:r(2548),verify:r(6467),sign:r(9147),JsonWebTokenError:r(1957),NotBeforeError:r(4470),TokenExpiredError:r(7788)}},1957(e){var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},4470(e,t,r){var s=r(1957),i=function(e,t){s.call(this,e),this.name="NotBeforeError",this.date=t};i.prototype=Object.create(s.prototype),i.prototype.constructor=i,e.exports=i},7788(e,t,r){var s=r(1957),i=function(e,t){s.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};i.prototype=Object.create(s.prototype),i.prototype.constructor=i,e.exports=i},5841(e,t,r){e.exports=r(3895).satisfies(process.version,">=15.7.0")},953(e,t,r){e.exports=r(3895).satisfies(process.version,"^6.12.0 || >=8.0.0")},455(e,t,r){e.exports=r(3895).satisfies(process.version,">=16.9.0")},4559(e,t,r){var s=r(3866);e.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var i=s(e);if(void 0===i)return;return Math.floor(r+i/1e3)}if("number"==typeof e)return r+e}},723(e,t,r){let s=r(5841),i=r(455),a={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},n={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};e.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let o=a[r];if(!o)throw Error(`Unknown key type "${r}".`);if(!o.includes(e))throw Error(`"alg" parameter for "${r}" key type must be one of: ${o.join(", ")}.`);if(s)switch(r){case"ec":let l=t.asymmetricKeyDetails.namedCurve,u=n[e];if(l!==u)throw Error(`"alg" parameter "${e}" requires curve "${u}".`);break;case"rsa-pss":if(i){let r=parseInt(e.slice(-3),10),{hashAlgorithm:s,mgf1HashAlgorithm:i,saltLength:a}=t.asymmetricKeyDetails;if(s!==`sha${r}`||i!==s)throw Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==a&&a>r>>3)throw Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}}},9147(e,t,r){let s=r(4559),i=r(953),a=r(723),n=r(3263),o=r(5357),l=r(6782),u=r(5250),c=r(8094),d=r(6052),p=r(1251),f=r(8430),{KeyObject:h,createSecretKey:m,createPrivateKey:y}=r(6982),g=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&g.splice(3,0,"PS256","PS384","PS512");let v={expiresIn:{isValid:function(e){return u(e)||p(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return u(e)||p(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return p(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:o.bind(null,g),message:'"algorithm" must be a valid string enum value'},header:{isValid:d,message:'"header" must be an object'},encoding:{isValid:p,message:'"encoding" must be a string'},issuer:{isValid:p,message:'"issuer" must be a string'},subject:{isValid:p,message:'"subject" must be a string'},jwtid:{isValid:p,message:'"jwtid" must be a string'},noTimestamp:{isValid:l,message:'"noTimestamp" must be a boolean'},keyid:{isValid:p,message:'"keyid" must be a string'},mutatePayload:{isValid:l,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:l,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:l,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},_={iat:{isValid:c,message:'"iat" should be a number of seconds'},exp:{isValid:c,message:'"exp" should be a number of seconds'},nbf:{isValid:c,message:'"nbf" should be a number of seconds'}};function b(e,t,r,s){if(!d(r))throw Error('Expected "'+s+'" to be a plain object.');Object.keys(r).forEach(function(i){let a=e[i];if(!a){if(!t)throw Error('"'+i+'" is not allowed in "'+s+'"');return}if(!a.isValid(r[i]))throw Error(a.message)})}let w={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},$=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e.exports=function(e,t,r,i){var o,l;"function"==typeof r?(i=r,r={}):r=r||{};let u="object"==typeof e&&!Buffer.isBuffer(e),c=Object.assign({alg:r.algorithm||"HS256",typ:u?"JWT":void 0,kid:r.keyid},r.header);function d(e){if(i)return i(e);throw e}if(!t&&"none"!==r.algorithm)return d(Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof h))try{t=y(t)}catch(e){try{t=m("string"==typeof t?Buffer.from(t):t)}catch(e){return d(Error("secretOrPrivateKey is not valid key material"))}}if(c.alg.startsWith("HS")&&"secret"!==t.type)return d(Error(`secretOrPrivateKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)){if("private"!==t.type)return d(Error(`secretOrPrivateKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInsecureKeySizes&&!c.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return d(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`))}if(void 0===e)return d(Error("payload is required"));if(u){try{o=e,b(_,!0,o,"payload")}catch(e){return d(e)}r.mutatePayload||(e=Object.assign({},e))}else{let t=$.filter(function(e){return void 0!==r[e]});if(t.length>0)return d(Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return d(Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return d(Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{l=r,b(v,!1,l,"options")}catch(e){return d(e)}if(!r.allowInvalidAsymmetricKeyTypes)try{a(c.alg,t)}catch(e){return d(e)}let p=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:u&&(e.iat=p),void 0!==r.notBefore){try{e.nbf=s(r.notBefore,p)}catch(e){return d(e)}if(void 0===e.nbf)return d(Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=s(r.expiresIn,p)}catch(e){return d(e)}if(void 0===e.exp)return d(Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(w).forEach(function(t){let s=w[t];if(void 0!==r[t]){if(void 0!==e[s])return d(Error('Bad "options.'+t+'" option. The payload already has an "'+s+'" property.'));e[s]=r[t]}});let g=r.encoding||"utf8";if("function"==typeof i)i=i&&f(i),n.createSign({header:c,privateKey:t,payload:e,encoding:g}).once("error",i).once("done",function(e){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&e.length<256)return i(Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`));i(null,e)});else{let s=n.sign({header:c,payload:e,secret:t,encoding:g});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(c.alg)&&s.length<256)throw Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${c.alg}`);return s}}},6467(e,t,r){let s=r(1957),i=r(4470),a=r(7788),n=r(2548),o=r(4559),l=r(723),u=r(953),c=r(3263),{KeyObject:d,createSecretKey:p,createPublicKey:f}=r(6982),h=["RS256","RS384","RS512"],m=["ES256","ES384","ES512"],y=["RS256","RS384","RS512"],g=["HS256","HS384","HS512"];u&&(h.splice(h.length,0,"PS256","PS384","PS512"),y.splice(y.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,r,u){let v,_,b;if("function"!=typeof r||u||(u=r,r={}),r||(r={}),r=Object.assign({},r),v=u||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return v(new s("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return v(new s("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return v(new s("allowInvalidAsymmetricKeyTypes must be a boolean"));let w=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return v(new s("jwt must be provided"));if("string"!=typeof e)return v(new s("jwt must be a string"));let $=e.split(".");if(3!==$.length)return v(new s("jwt malformed"));try{_=n(e,{complete:!0})}catch(e){return v(e)}if(!_)return v(new s("invalid token"));let k=_.header;if("function"==typeof t){if(!u)return v(new s("verify must be called asynchronous if secret or public key is provided as a callback"));b=t}else b=function(e,r){return r(null,t)};return b(k,function(t,n){let u;if(t)return v(new s("error in secret or public key callback: "+t.message));let b=""!==$[2].trim();if(!b&&n)return v(new s("jwt signature is required"));if(b&&!n)return v(new s("secret or public key must be provided"));if(!b&&!r.algorithms)return v(new s('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=n&&!(n instanceof d))try{n=f(n)}catch(e){try{n=p("string"==typeof n?Buffer.from(n):n)}catch(e){return v(new s("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===n.type?r.algorithms=g:["rsa","rsa-pss"].includes(n.asymmetricKeyType)?r.algorithms=y:"ec"===n.asymmetricKeyType?r.algorithms=m:r.algorithms=h),-1===r.algorithms.indexOf(_.header.alg))return v(new s("invalid algorithm"));if(k.alg.startsWith("HS")&&"secret"!==n.type)return v(new s(`secretOrPublicKey must be a symmetric key when using ${k.alg}`));if(/^(?:RS|PS|ES)/.test(k.alg)&&"public"!==n.type)return v(new s(`secretOrPublicKey must be an asymmetric key when using ${k.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{l(k.alg,n)}catch(e){return v(e)}try{u=c.verify(e,_.header.alg,n)}catch(e){return v(e)}if(!u)return v(new s("invalid signature"));let E=_.payload;if(void 0!==E.nbf&&!r.ignoreNotBefore){if("number"!=typeof E.nbf)return v(new s("invalid nbf value"));if(E.nbf>w+(r.clockTolerance||0))return v(new i("jwt not active",new Date(1e3*E.nbf)))}if(void 0!==E.exp&&!r.ignoreExpiration){if("number"!=typeof E.exp)return v(new s("invalid exp value"));if(w>=E.exp+(r.clockTolerance||0))return v(new a("jwt expired",new Date(1e3*E.exp)))}if(r.audience){let e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(E.aud)?E.aud:[E.aud]).some(function(t){return e.some(function(e){return e instanceof RegExp?e.test(t):e===t})}))return v(new s("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&E.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(E.iss)))return v(new s("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&E.sub!==r.subject)return v(new s("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&E.jti!==r.jwtid)return v(new s("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&E.nonce!==r.nonce)return v(new s("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof E.iat)return v(new s("iat required when maxAge is specified"));let e=o(r.maxAge,E.iat);if(void 0===e)return v(new s('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(w>=e+(r.clockTolerance||0))return v(new a("maxAge exceeded",new Date(1e3*e)))}return!0===r.complete?v(null,{header:k,payload:E,signature:_.signature}):v(null,E)})}},2357(e,t,r){var s,i=r(6608).Buffer,a=r(6982),n=r(9053),o=r(9023),l="secret must be a string or buffer",u="key must be a string or a buffer",c="function"==typeof a.createPublicKey;function d(e){if(!i.isBuffer(e)&&"string"!=typeof e&&(!c||"object"!=typeof e||"string"!=typeof e.type||"string"!=typeof e.asymmetricKeyType||"function"!=typeof e.export))throw m(u)}function p(e){if(!i.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw m("key must be a string, a buffer or an object")}function f(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function h(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function m(e){var t=[].slice.call(arguments,1);return TypeError(o.format.bind(o,e).apply(null,t))}function y(e){var t;return t=e,i.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function g(e){return function(t,r){!function(e){if(!i.isBuffer(e)){if("string"!=typeof e){if(!c||"object"!=typeof e||"secret"!==e.type||"function"!=typeof e.export)throw m(l)}}}(r),t=y(t);var s=a.createHmac("sha"+e,r);return f((s.update(t),s.digest("base64")))}}c&&(u+=" or a KeyObject",l+="or a KeyObject");var v="timingSafeEqual"in a?function(e,t){return e.byteLength===t.byteLength&&a.timingSafeEqual(e,t)}:function(e,t){return s||(s=r(9454)),s(e,t)};function _(e){return function(t,r,s){var a=g(e)(t,s);return v(i.from(r),i.from(a))}}function b(e){return function(t,r){p(r),t=y(t);var s=a.createSign("RSA-SHA"+e);return f((s.update(t),s.sign(r,"base64")))}}function w(e){return function(t,r,s){d(s),t=y(t),r=h(r);var i=a.createVerify("RSA-SHA"+e);return i.update(t),i.verify(s,r,"base64")}}function $(e){return function(t,r){p(r),t=y(t);var s=a.createSign("RSA-SHA"+e);return f((s.update(t),s.sign({key:r,padding:a.constants.RSA_PKCS1_PSS_PADDING,saltLength:a.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function k(e){return function(t,r,s){d(s),t=y(t),r=h(r);var i=a.createVerify("RSA-SHA"+e);return i.update(t),i.verify({key:s,padding:a.constants.RSA_PKCS1_PSS_PADDING,saltLength:a.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function E(e){var t=b(e);return function(){var r=t.apply(null,arguments);return n.derToJose(r,"ES"+e)}}function x(e){var t=w(e);return function(r,s,i){return t(r,s=n.joseToDer(s,"ES"+e).toString("base64"),i)}}function S(){return function(){return""}}function T(){return function(e,t){return""===t}}e.exports=function(e){var t=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!t)throw m('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var r=(t[1]||t[3]).toLowerCase(),s=t[2];return{sign:({hs:g,rs:b,ps:$,es:E,none:S})[r](s),verify:({hs:_,rs:w,ps:k,es:x,none:T})[r](s)}}},3263(e,t,r){var s=r(9615),i=r(6747);t.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],t.sign=s.sign,t.verify=i.verify,t.decode=i.decode,t.isValid=i.isValid,t.createSign=function(e){return new s(e)},t.createVerify=function(e){return new i(e)}},6360(e,t,r){var s=r(6608).Buffer,i=r(2203);function a(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=s.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=s.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick((function(){this.emit("end",e),this.readable=!1,this.emit("close")}).bind(this)),this;throw TypeError("Unexpected data type ("+typeof e+")")}r(9023).inherits(a,i),a.prototype.write=function(e){this.buffer=s.concat([this.buffer,s.from(e)]),this.emit("data",e)},a.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},e.exports=a},9615(e,t,r){var s=r(6608).Buffer,i=r(6360),a=r(2357),n=r(2203),o=r(5911),l=r(9023);function u(e,t){return s.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(e){var t,r,s,i=e.header,n=e.payload,c=e.secret||e.privateKey,d=e.encoding,p=a(i.alg),f=(t=(t=d)||"utf8",r=u(o(i),"binary"),s=u(o(n),t),l.format("%s.%s",r,s)),h=p.sign(f,c);return l.format("%s.%s",f,h)}function d(e){var t=e.secret;if(t=null==(t=null==t?e.privateKey:t)?e.key:t,!0===/^hs/i.test(e.header.alg)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new i(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new i(e.payload),this.secret.once("close",(function(){!this.payload.writable&&this.readable&&this.sign()}).bind(this)),this.payload.once("close",(function(){!this.secret.writable&&this.readable&&this.sign()}).bind(this))}l.inherits(d,n),d.prototype.sign=function(){try{var e=c({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},d.sign=c,e.exports=d},5911(e,t,r){var s=r(181).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||s.isBuffer(e)?e.toString():JSON.stringify(e)}},6747(e,t,r){var s=r(6608).Buffer,i=r(6360),a=r(2357),n=r(2203),o=r(5911),l=r(9023),u=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function c(e){var t=e.split(".",1)[0],r=s.from(t,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(r))return r;try{return JSON.parse(r)}catch(e){return}}function d(e){return e.split(".")[2]}function p(e){return u.test(e)&&!!c(e)}function f(e,t,r){if(!t){var s=Error("Missing algorithm parameter for jws.verify");throw s.code="MISSING_ALGORITHM",s}var i=d(e=o(e)),n=e.split(".",2).join(".");return a(t).verify(n,i,r)}function h(e,t){if(t=t||{},!p(e=o(e)))return null;var r,i,a=c(e);if(!a)return null;var n=(r=r||"utf8",i=e.split(".")[1],s.from(i,"base64").toString(r));return("JWT"===a.typ||t.json)&&(n=JSON.parse(n,t.encoding)),{header:a,payload:n,signature:d(e)}}function m(e){var t=(e=e||{}).secret;if(t=null==(t=null==t?e.publicKey:t)?e.key:t,!0===/^hs/i.test(e.algorithm)&&null==t)throw TypeError("secret must be a string or buffer or a KeyObject");var r=new i(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new i(e.signature),this.secret.once("close",(function(){!this.signature.writable&&this.readable&&this.verify()}).bind(this)),this.signature.once("close",(function(){!this.secret.writable&&this.readable&&this.verify()}).bind(this))}l.inherits(m,n),m.prototype.verify=function(){try{var e=f(this.signature.buffer,this.algorithm,this.key.buffer),t=h(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},m.decode=h,m.isValid=p,m.verify=f,e.exports=m},5357(e){var t,r,s=1/0,i=0/0,a=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=/^(?:0|[1-9]\d*)$/,c=parseInt;function d(e){return e!=e}var p=Object.prototype,f=p.hasOwnProperty,h=p.toString,m=p.propertyIsEnumerable,y=(t=Object.keys,r=Object,function(e){return t(r(e))}),g=Math.max,v=Array.isArray;function _(e){var t,r,s;return null!=e&&"number"==typeof(t=e.length)&&t>-1&&t%1==0&&t<=0x1fffffffffffff&&"[object Function]"!=(s=b(r=e)?h.call(r):"")&&"[object GeneratorFunction]"!=s}function b(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function w(e){return!!e&&"object"==typeof e}e.exports=function(e,t,r,$){e=_(e)?e:function(e){return e?function(e,t){for(var r=-1,s=e?e.length:0,i=Array(s);++r<s;)i[r]=t(e[r],r,e);return i}(_(e)?function(e,t){var r,s,i,a,n=v(e)||w(s=r=e)&&_(s)&&f.call(r,"callee")&&(!m.call(r,"callee")||"[object Arguments]"==h.call(r))?function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],o=n.length,l=!!o;for(var c in e){f.call(e,c)&&!(l&&("length"==c||(i=c,(a=null==(a=o)?0x1fffffffffffff:a)&&("number"==typeof i||u.test(i))&&i>-1&&i%1==0&&i<a)))&&n.push(c)}return n}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||p))return y(e);var t,r,s=[];for(var i in Object(e))f.call(e,i)&&"constructor"!=i&&s.push(i);return s}(e),function(t){return e[t]}):[]}(e),r=r&&!$?(x=(E=(k=r)?(k=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||w(t)&&"[object Symbol]"==h.call(t))return i;if(b(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=b(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var s=o.test(e);return s||l.test(e)?c(e.slice(2),s?2:8):n.test(e)?i:+e}(k))===s||k===-s?(k<0?-1:1)*17976931348623157e292:k==k?k:0:0===k?k:0)%1,E==E?x?E-x:E:0):0;var k,E,x,S,T=e.length;return r<0&&(r=g(T+r,0)),"string"==typeof(S=e)||!v(S)&&w(S)&&"[object String]"==h.call(S)?r<=T&&e.indexOf(t,r)>-1:!!T&&function(e,t,r){if(t!=t){for(var s=e.length,i=r+-1;++i<s;)if(d(e[i],i,e))return i;return -1}for(var a=r-1,n=e.length;++a<n;)if(e[a]===t)return a;return -1}(e,t,r)>-1}},6782(e){var t=Object.prototype.toString;e.exports=function(e){var r;return!0===e||!1===e||!!(r=e)&&"object"==typeof r&&"[object Boolean]"==t.call(e)}},5250(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,n=/^0o[0-7]+$/i,o=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p;return"number"==typeof e&&e==(p=(d=(c=e)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=a.test(e);return d||n.test(e)?o(e.slice(2),d?2:8):i.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,d==d?p?d-p:d:0)}},8094(e){var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||!!e&&"object"==typeof e&&"[object Number]"==t.call(e)}},6052(e){var t,r,s=Object.prototype,i=Function.prototype.toString,a=s.hasOwnProperty,n=i.call(Object),o=s.toString,l=(t=Object.getPrototypeOf,r=Object,function(e){return t(r(e))});e.exports=function(e){if(!(e&&"object"==typeof e)||"[object Object]"!=o.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=l(e);if(null===t)return!0;var r=a.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&i.call(r)==n}},1251(e){var t=Object.prototype.toString,r=Array.isArray;e.exports=function(e){var s;return"string"==typeof e||!r(e)&&!!(s=e)&&"object"==typeof s&&"[object String]"==t.call(e)}},8430(e){var t=1/0,r=0/0,s=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,n=/^0o[0-7]+$/i,o=parseInt,l=Object.prototype.toString;function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){var c,d,p,f,h=2,m=e;if("function"!=typeof m)throw TypeError("Expected a function");return p=(d=(c=h)?(c=function(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==l.call(t))return r;if(u(e)){var t,c="function"==typeof e.valueOf?e.valueOf():e;e=u(c)?c+"":c}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=a.test(e);return d||n.test(e)?o(e.slice(2),d?2:8):i.test(e)?r:+e}(c))===t||c===-t?(c<0?-1:1)*17976931348623157e292:c==c?c:0:0===c?c:0)%1,h=d==d?p?d-p:d:0,function(){return--h>0&&(f=m.apply(this,arguments)),h<=1&&(m=void 0),f}}},3866(e){function t(e,t,r,s){return Math.round(e/r)+" "+s+(t>=1.5*r?"s":"")}e.exports=function(e,r){r=r||{};var s,i,a,n,o=typeof e;if("string"===o&&e.length>0){var l=e;if(!((l=String(l)).length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(u){var c=parseFloat(u[1]);switch((u[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return 6048e5*c;case"days":case"day":case"d":return 864e5*c;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*c;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*c;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:break}}}return}if("number"===o&&isFinite(e)){return r.long?(i=Math.abs(s=e))>=864e5?t(s,i,864e5,"day"):i>=36e5?t(s,i,36e5,"hour"):i>=6e4?t(s,i,6e4,"minute"):i>=1e3?t(s,i,1e3,"second"):s+" ms":(n=Math.abs(a=e))>=864e5?Math.round(a/864e5)+"d":n>=36e5?Math.round(a/36e5)+"h":n>=6e4?Math.round(a/6e4)+"m":n>=1e3?Math.round(a/1e3)+"s":a+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},9695(e){"use strict";let t=(e={})=>{let t=e.env||process.env;return"win32"!==(e.platform||process.platform)?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path"};e.exports=t,e.exports.default=t},6608(e,t,r){var s=r(181),i=s.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function n(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=s:(a(s,t),t.Buffer=n),n.prototype=Object.create(i.prototype),a(i,n),n.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},n.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var s=i(e);return void 0!==t?"string"==typeof r?s.fill(t,r):s.fill(t):s.fill(0),s},n.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},n.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return s.SlowBuffer(e)}},8610(e,t,r){"use strict";let s=Symbol("SemVer ANY");class i{static get ANY(){return s}constructor(e,t){if(t=a(t),e instanceof i)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===s?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=s}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===s||e===s)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=a(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=i;let a=r(4621),{safeRe:n,t:o}=r(152),l=r(5461),u=r(674),c=r(2398),d=r(2069)},2069(e,t,r){"use strict";let s=/\s+/g;class i{constructor(e,t){if(t=n(t),e instanceof i)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new i(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(s," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!g(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&m)|(this.options.loose&&y))+":"+e,r=a.get(t);if(r)return r;let s=this.options.loose,i=s?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];l("hyphen replace",e=e.replace(i,O(this.options.includePrerelease))),l("comparator trim",e=e.replace(c[d.COMPARATORTRIM],p)),l("tilde trim",e=e.replace(c[d.TILDETRIM],f)),l("caret trim",e=e.replace(c[d.CARETTRIM],h));let n=e.split(" ").map(e=>b(e,this.options)).join(" ").split(/\s+/).map(e=>I(e,this.options));s&&(n=n.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",n);let u=new Map;for(let e of n.map(e=>new o(e,this.options))){if(g(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let v=[...u.values()];return a.set(t,v),v}intersects(e,t){if(!(e instanceof i))throw TypeError("a Range is required");return this.set.some(r=>_(r,t)&&e.set.some(e=>_(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(j(this.set[t],e,this.options))return!0;return!1}}e.exports=i;let a=new(r(2044)),n=r(4621),o=r(8610),l=r(674),u=r(2398),{safeRe:c,t:d,comparatorTrimReplace:p,tildeTrimReplace:f,caretTrimReplace:h}=r(152),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:y}=r(5076),g=e=>"<0.0.0-0"===e.value,v=e=>""===e.value,_=(e,t)=>{let r=!0,s=e.slice(),i=s.pop();for(;r&&s.length;)r=s.every(e=>i.intersects(e,t)),i=s.pop();return r},b=(e,t)=>(l("comp",e=e.replace(c[d.BUILD],""),t),l("caret",e=E(e,t)),l("tildes",e=$(e,t)),l("xrange",e=S(e,t)),l("stars",e=P(e,t)),e),w=e=>!e||"x"===e.toLowerCase()||"*"===e,$=(e,t)=>e.trim().split(/\s+/).map(e=>k(e,t)).join(" "),k=(e,t)=>{let r=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(r,(t,r,s,i,a)=>{let n;return l("tilde",e,t,r,s,i,a),w(r)?n="":w(s)?n=`>=${r}.0.0 <${+r+1}.0.0-0`:w(i)?n=`>=${r}.${s}.0 <${r}.${+s+1}.0-0`:a?(l("replaceTilde pr",a),n=`>=${r}.${s}.${i}-${a} <${r}.${+s+1}.0-0`):n=`>=${r}.${s}.${i} <${r}.${+s+1}.0-0`,l("tilde return",n),n})},E=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(" "),x=(e,t)=>{l("caret",e,t);let r=t.loose?c[d.CARETLOOSE]:c[d.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(t,r,i,a,n)=>{let o;return l("caret",e,t,r,i,a,n),w(r)?o="":w(i)?o=`>=${r}.0.0${s} <${+r+1}.0.0-0`:w(a)?o="0"===r?`>=${r}.${i}.0${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${s} <${+r+1}.0.0-0`:n?(l("replaceCaret pr",n),o="0"===r?"0"===i?`>=${r}.${i}.${a}-${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${n} <${+r+1}.0.0-0`):(l("no pr"),o="0"===r?"0"===i?`>=${r}.${i}.${a}${s} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),l("caret return",o),o})},S=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>T(e,t)).join(" ")),T=(e,t)=>{e=e.trim();let r=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(r,(r,s,i,a,n,o)=>{l("xRange",e,r,s,i,a,n,o);let u=w(i),c=u||w(a),d=c||w(n);return"="===s&&d&&(s=""),o=t.includePrerelease?"-0":"",u?r=">"===s||"<"===s?"<0.0.0-0":"*":s&&d?(c&&(a=0),n=0,">"===s?(s=">=",c?(i=+i+1,a=0):a=+a+1,n=0):"<="===s&&(s="<",c?i=+i+1:a=+a+1),"<"===s&&(o="-0"),r=`${s+i}.${a}.${n}${o}`):c?r=`>=${i}.0.0${o} <${+i+1}.0.0-0`:d&&(r=`>=${i}.${a}.0${o} <${i}.${+a+1}.0-0`),l("xRange return",r),r})},P=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),I=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),O=e=>(t,r,s,i,a,n,o,l,u,c,d,p)=>(r=w(s)?"":w(i)?`>=${s}.0.0${e?"-0":""}`:w(a)?`>=${s}.${i}.0${e?"-0":""}`:n?`>=${r}`:`>=${r}${e?"-0":""}`,l=w(u)?"":w(c)?`<${+u+1}.0.0-0`:w(d)?`<${u}.${+c+1}.0-0`:p?`<=${u}.${c}.${d}-${p}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),j=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){let s=e[r].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}return!1}return!0}},2398(e,t,r){"use strict";let s=r(674),{MAX_LENGTH:i,MAX_SAFE_INTEGER:a}=r(5076),{safeRe:n,t:o}=r(152),l=r(4621),{compareIdentifiers:u}=r(9101);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw TypeError(`version is longer than ${i} characters`);s("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?n[o.LOOSE]:n[o.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>a||this.major<0)throw TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<a)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(s("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return(e instanceof c||(e=new c(e,this.options)),this.major<e.major)?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:+(this.patch>e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],i=e.prerelease[t];if(s("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return -1;else if(r===i)continue;else return u(r,i)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],i=e.build[t];if(s("build compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return -1;else if(r===i)continue;else return u(r,i)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let s=this.prerelease.length;for(;--s>=0;)"number"==typeof this.prerelease[s]&&(this.prerelease[s]++,s=-2);if(-1===s){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let s=[t,e];!1===r&&(s=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},5608(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},5461(e,t,r){"use strict";let s=r(8271),i=r(733),a=r(1686),n=r(6479),o=r(7257),l=r(5850);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return s(e,r,u);case"!=":return i(e,r,u);case">":return a(e,r,u);case">=":return n(e,r,u);case"<":return o(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},7771(e,t,r){"use strict";let s=r(2398),i=r(6802),{safeRe:a,t:n}=r(152);e.exports=(e,t)=>{if(e instanceof s)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let s,i=t.includePrerelease?a[n.COERCERTLFULL]:a[n.COERCERTL];for(;(s=i.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),i.lastIndex=s.index+s[1].length+s[2].length;i.lastIndex=-1}else r=e.match(t.includePrerelease?a[n.COERCEFULL]:a[n.COERCE]);if(null===r)return null;let o=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return i(`${o}.${l}.${u}${c}${d}`,t)}},8767(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>{let i=new s(e,r),a=new s(t,r);return i.compare(a)||i.compareBuild(a)}},6293(e,t,r){"use strict";let s=r(6958);e.exports=(e,t)=>s(e,t,!0)},6958(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r)=>new s(e,r).compare(new s(t,r))},3086(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,null,!0),i=s(t,null,!0),a=r.compare(i);if(0===a)return null;let n=a>0,o=n?r:i,l=n?i:r,u=!!o.prerelease.length;if(l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(o))return l.minor&&!l.patch?"minor":"patch"}let c=u?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"}},8271(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0===s(e,t,r)},1686(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>0},6479(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(e,t,r)>=0},3625(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r,i,a)=>{"string"==typeof r&&(a=i,i=r,r=void 0);try{return new s(e instanceof s?e.version:e,r).inc(t,i,a).version}catch(e){return null}}},7257(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>s(e,t,r)},5850(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0>=s(e,t,r)},7744(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).major},4812(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).minor},733(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>0!==s(e,t,r)},6802(e,t,r){"use strict";let s=r(2398);e.exports=(e,t,r=!1)=>{if(e instanceof s)return e;try{return new s(e,t)}catch(e){if(!r)return null;throw e}}},8643(e,t,r){"use strict";let s=r(2398);e.exports=(e,t)=>new s(e,t).patch},9283(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r&&r.prerelease.length?r.prerelease:null}},7032(e,t,r){"use strict";let s=r(6958);e.exports=(e,t,r)=>s(t,e,r)},9839(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(r,e,t))},4056(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>{try{t=new s(t,r)}catch(e){return!1}return t.test(e)}},7697(e,t,r){"use strict";let s=r(8767);e.exports=(e,t)=>e.sort((e,r)=>s(e,r,t))},6807(e,t,r){"use strict";let s=r(6802);e.exports=(e,t)=>{let r=s(e,t);return r?r.version:null}},3895(e,t,r){"use strict";let s=r(152),i=r(5076),a=r(2398),n=r(9101),o=r(6802),l=r(6807),u=r(5608),c=r(3625),d=r(3086),p=r(7744),f=r(4812),h=r(8643),m=r(9283),y=r(6958),g=r(7032),v=r(6293),_=r(8767),b=r(7697),w=r(9839),$=r(1686),k=r(7257),E=r(8271),x=r(733),S=r(6479),T=r(5850),P=r(5461),I=r(7771),O=r(8610),j=r(2069),R=r(4056),N=r(6613),A=r(7114),C=r(1008),z=r(203),M=r(5372),D=r(4713),L=r(4497),q=r(9272),U=r(3490);e.exports={parse:o,valid:l,clean:u,inc:c,diff:d,major:p,minor:f,patch:h,prerelease:m,compare:y,rcompare:g,compareLoose:v,compareBuild:_,sort:b,rsort:w,gt:$,lt:k,eq:E,neq:x,gte:S,lte:T,cmp:P,coerce:I,Comparator:O,Range:j,satisfies:R,toComparators:N,maxSatisfying:A,minSatisfying:C,minVersion:z,validRange:M,outside:D,gtr:L,ltr:q,intersects:U,simplifyRange:r(4039),subset:r(22),SemVer:a,re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers}},5076(e){"use strict";e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},674(e){"use strict";e.exports="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},9101(e){"use strict";let t=/^[0-9]+$/,r=(e,r)=>{if("number"==typeof e&&"number"==typeof r)return e===r?0:e<r?-1:1;let s=t.test(e),i=t.test(r);return s&&i&&(e*=1,r*=1),e===r?0:s&&!i?-1:i&&!s?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},2044(e){"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},4621(e){"use strict";let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},152(e,t,r){"use strict";let{MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:a}=r(5076),n=r(674),o=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},p=0,f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",a],[f,i]],m=(e,t,r)=>{let s=(e=>{for(let[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=p++;n(e,i,t),d[e]=i,u[i]=t,c[i]=s,o[i]=new RegExp(t,r?"g":void 0),l[i]=new RegExp(s,r?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),m("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${f}+`),m("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),m("FULL",`^${u[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),m("LOOSE",`^${u[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),m("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?`),m("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),m("COERCERTL",u[d.COERCE],!0),m("COERCERTLFULL",u[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},4497(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,">",r)},3490(e,t,r){"use strict";let s=r(2069);e.exports=(e,t,r)=>(e=new s(e,r),t=new s(t,r),e.intersects(t,r))},9272(e,t,r){"use strict";let s=r(4713);e.exports=(e,t,r)=>s(e,t,"<",r)},7114(e,t,r){"use strict";let s=r(2398),i=r(2069);e.exports=(e,t,r)=>{let a=null,n=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!a||-1===n.compare(e))&&(n=new s(a=e,r))}),a}},1008(e,t,r){"use strict";let s=r(2398),i=r(2069);e.exports=(e,t,r)=>{let a=null,n=null,o=null;try{o=new i(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!a||1===n.compare(e))&&(n=new s(a=e,r))}),a}},203(e,t,r){"use strict";let s=r(2398),i=r(2069),a=r(1686);e.exports=(e,t)=>{e=new i(e,t);let r=new s("0.0.0");if(e.test(r)||(r=new s("0.0.0-0"),e.test(r)))return r;r=null;for(let t=0;t<e.set.length;++t){let i=e.set[t],n=null;i.forEach(e=>{let t=new s(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":(!n||a(t,n))&&(n=t);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),n&&(!r||a(r,n))&&(r=n)}return r&&e.test(r)?r:null}},4713(e,t,r){"use strict";let s=r(2398),i=r(8610),{ANY:a}=i,n=r(2069),o=r(4056),l=r(1686),u=r(7257),c=r(5850),d=r(6479);e.exports=(e,t,r,p)=>{let f,h,m,y,g;switch(e=new s(e,p),t=new n(t,p),r){case">":f=l,h=c,m=u,y=">",g=">=";break;case"<":f=u,h=d,m=l,y="<",g="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(o(e,t,p))return!1;for(let r=0;r<t.set.length;++r){let s=t.set[r],n=null,o=null;if(s.forEach(e=>{e.semver===a&&(e=new i(">=0.0.0")),n=n||e,o=o||e,f(e.semver,n.semver,p)?n=e:m(e.semver,o.semver,p)&&(o=e)}),n.operator===y||n.operator===g||(!o.operator||o.operator===y)&&h(e,o.semver)||o.operator===g&&m(e,o.semver))return!1}return!0}},4039(e,t,r){"use strict";let s=r(4056),i=r(6958);e.exports=(e,t,r)=>{let a=[],n=null,o=null,l=e.sort((e,t)=>i(e,t,r));for(let e of l)s(e,t,r)?(o=e,n||(n=e)):(o&&a.push([n,o]),o=null,n=null);n&&a.push([n,null]);let u=[];for(let[e,t]of a)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");let c=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return c.length<d.length?c:t}},22(e,t,r){"use strict";let s=r(2069),i=r(8610),{ANY:a}=i,n=r(4056),o=r(6958),l=[new i(">=0.0.0-0")],u=[new i(">=0.0.0")],c=(e,t,r)=>{let s,i,c,f,h,m,y;if(e===t)return!0;if(1===e.length&&e[0].semver===a)if(1===t.length&&t[0].semver===a)return!0;else e=r.includePrerelease?l:u;if(1===t.length&&t[0].semver===a)if(r.includePrerelease)return!0;else t=u;let g=new Set;for(let t of e)">"===t.operator||">="===t.operator?s=d(s,t,r):"<"===t.operator||"<="===t.operator?i=p(i,t,r):g.add(t.semver);if(g.size>1)return null;if(s&&i&&((c=o(s.semver,i.semver,r))>0||0===c&&(">="!==s.operator||"<="!==i.operator)))return null;for(let e of g){if(s&&!n(e,String(s),r)||i&&!n(e,String(i),r))return null;for(let s of t)if(!n(e,String(s),r))return!1;return!0}let v=!!i&&!r.includePrerelease&&!!i.semver.prerelease.length&&i.semver,_=!!s&&!r.includePrerelease&&!!s.semver.prerelease.length&&s.semver;for(let e of(v&&1===v.prerelease.length&&"<"===i.operator&&0===v.prerelease[0]&&(v=!1),t)){if(y=y||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,s){if(_&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===_.major&&e.semver.minor===_.minor&&e.semver.patch===_.patch&&(_=!1),">"===e.operator||">="===e.operator){if((f=d(s,e,r))===e&&f!==s)return!1}else if(">="===s.operator&&!n(s.semver,String(e),r))return!1}if(i){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),"<"===e.operator||"<="===e.operator){if((h=p(i,e,r))===e&&h!==i)return!1}else if("<="===i.operator&&!n(i.semver,String(e),r))return!1}if(!e.operator&&(i||s)&&0!==c)return!1}return(!s||!m||!!i||0===c)&&(!i||!y||!!s||0===c)&&!_&&!v&&!0},d=(e,t,r)=>{if(!e)return t;let s=o(e.semver,t.semver,r);return s>0?e:s<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,r)=>{if(!e)return t;let s=o(e.semver,t.semver,r);return s<0?e:s>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new s(e,r),t=new s(t,r);let i=!1;e:for(let s of e.set){for(let e of t.set){let t=c(s,e,r);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},6613(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>new s(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},5372(e,t,r){"use strict";let s=r(2069);e.exports=(e,t)=>{try{return new s(e,t).range||"*"}catch(e){return null}}},600(e,t,r){"use strict";let s=r(9638);e.exports=(e="")=>{let t=e.match(s);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),a=r.split("/").pop();return"env"===a?i:i?`${a} ${i}`:a}},9638(e){"use strict";e.exports=/^#!(.*)/},1905(e,t,r){let s="win32"===process.platform||"cygwin"===process.env.OSTYPE||"msys"===process.env.OSTYPE,i=r(6928),a=s?";":":",n=r(9344),o=e=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),l=(e,t)=>{let r=t.colon||a,i=e.match(/\//)||s&&e.match(/\\/)?[""]:[...s?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=s?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=s?n.split(r):[""];return s&&-1!==e.indexOf(".")&&""!==o[0]&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},u=(e,t,r)=>{"function"==typeof t&&(r=t,t={}),t||(t={});let{pathEnv:s,pathExt:a,pathExtExe:u}=l(e,t),c=[],d=r=>new Promise((a,n)=>{if(r===s.length)return t.all&&c.length?a(c):n(o(e));let l=s[r],u=/^".*"$/.test(l)?l.slice(1,-1):l,d=i.join(u,e);a(p(!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,r,0))}),p=(e,r,s)=>new Promise((i,o)=>{if(s===a.length)return i(d(r+1));let l=a[s];n(e+l,{pathExt:u},(a,n)=>{if(!a&&n)if(!t.all)return i(e+l);else c.push(e+l);return i(p(e,r,s+1))})});return r?d(0).then(e=>r(null,e),r):d(0)};e.exports=u,u.sync=(e,t)=>{let{pathEnv:r,pathExt:s,pathExtExe:a}=l(e,t=t||{}),u=[];for(let o=0;o<r.length;o++){let l=r[o],c=/^".*"$/.test(l)?l.slice(1,-1):l,d=i.join(c,e),p=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<s.length;e++){let r=p+s[e];try{if(n.sync(r,{pathExt:a}))if(!t.all)return r;else u.push(r)}catch(e){}}}if(t.all&&u.length)return u;if(t.nothrow)return null;throw o(e)}},181(e){"use strict";e.exports=require("buffer")},5317(e){"use strict";e.exports=require("child_process")},6982(e){"use strict";e.exports=require("crypto")},9896(e){"use strict";e.exports=require("fs")},7598(e){"use strict";e.exports=require("node:crypto")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},2203(e){"use strict";e.exports=require("stream")},9023(e){"use strict";e.exports=require("util")},5019(e,t,r){"use strict";let{normalizeIPv6:s,removeDotSegments:i,recomposeAuthority:a,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:l}=r(6214),{SCHEMES:u,getSchemeHandler:c}=r(1528);function d(e,t,r,s){let a={};return s||(e=h(p(e,r),r),t=h(p(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=i(t.path||""),a.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=i(t.path||""),a.query=t.query):(t.path?("/"===t.path[0]?a.path=i(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path:a.path="/"+t.path,a.path=i(a.path)),a.query=t.query):(a.path=e.path,void 0!==t.query?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),n=[],o=c(s.scheme||r.scheme);o&&o.serialize&&o.serialize(r,s),void 0!==r.path&&(s.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==s.reference&&r.scheme&&n.push(r.scheme,":");let l=a(r);if(void 0!==l&&("suffix"!==s.reference&&n.push("//"),n.push(l),r.path&&"/"!==r.path[0]&&n.push("/")),void 0!==r.path){let e=r.path;s.absolutePath||o&&o.absolutePath||(e=i(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),n.push(e)}return void 0!==r.query&&n.push("?",r.query),void 0!==r.fragment&&n.push("#",r.fragment),n.join("")}let f=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},a=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);let n=e.match(f);if(n){if(i.scheme=n[1],i.userinfo=n[3],i.host=n[4],i.port=parseInt(n[5],10),i.path=n[6]||"",i.query=n[7],i.fragment=n[8],isNaN(i.port)&&(i.port=n[5]),i.host)if(!1===o(i.host)){let e=s(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;void 0!==i.scheme||void 0!==i.userinfo||void 0!==i.host||void 0!==i.port||void 0!==i.query||i.path?void 0===i.scheme?i.reference="relative":void 0===i.fragment?i.reference="absolute":i.reference="uri":i.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let t=c(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&!1===a&&l(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==i.scheme&&(i.scheme=unescape(i.scheme)),void 0!==i.host&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return i}let m={SCHEMES:u,normalize:function(e,t){return"string"==typeof e?e=p(h(e,t),t):"object"==typeof e&&(e=h(p(e,t),t)),e},resolve:function(e,t,r){let s=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=d(h(e,s),h(t,s),s,!0);return s.skipEscape=!0,p(i,s)},resolveComponent:d,equal:function(e,t,r){return"string"==typeof e?e=p(n(h(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=p(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=p(n(h(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=p(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:p,parse:h};e.exports=m,e.exports.default=m,e.exports.fastUri=m},1528(e,t,r){"use strict";let{isUUID:s}=r(6214),i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function l(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let u={scheme:"http",domainHost:!0,parse:o,serialize:l},c={scheme:"https",domainHost:u.domainHost,parse:o,serialize:l},d={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},p={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},f={http:u,https:c,ws:d,wss:p,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(i);if(r){let s=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=h(`${s}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",s=e.nid.toLowerCase(),i=h(`${r}:${t.nid||s}`);i&&(e=i.serialize(e,t));let a=e,n=e.nss;return a.path=`${s||t.nid}:${n}`,t.skipEscape=!0,a},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&s(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function h(e){return e&&(f[e]||f[e.toLowerCase()])||void 0}Object.setPrototypeOf(f,null),e.exports={wsIsSecure:n,SCHEMES:f,isValidSchemeName:function(e){return -1!==a.indexOf(e)},getSchemeHandler:h}},6214(e){"use strict";let t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function s(e){let t="",r=0,s=0;for(s=0;s<e.length;s++)if(48!==(r=e[s].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s];break}for(s+=1;s<e.length;s++){if(!((r=e[s].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[s]}return t}function i(e){return e.length=0,!0}function a(e,t,r){if(e.length){let i=s(e);if(""===i)return r.error=!0,!1;t.push(i),e.length=0}return!0}function n(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,":"))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],l=!1,u=!1,c=a;for(let s=0;s<e.length;s++){let a=e[s];if("["!==a&&"]"!==a)if(":"===a){if(!0===l&&(u=!0),!c(o,n,r))break;if(++t>7){r.error=!0;break}s>0&&":"===e[s-1]&&(l=!0),n.push(":");continue}else if("%"===a){if(!c(o,n,r))break;c=i}else{o.push(a);continue}}return o.length&&(c===i?r.zone=o.join(""):u?n.push(o.join("")):n.push(s(o))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}e.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let s=unescape(e.host);if(!r(s)){let t=n(s);s=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(s)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){let r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e,r=[],s=-1,i=0;for(;i=t.length;){if(1===i)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===i){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===i&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(s=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,s)),t=t.slice(s)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:n,stringArrayToHexStripped:s}},114(e){"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},7456(e){"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},4519(e){"use strict";e.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')},8330(e){"use strict";e.exports=JSON.parse('{"name":"xmcp","description":"The MCP framework","version":"0.6.7","author":{"name":"xmcp","email":"support@xmcp.dev","url":"https://xmcp.dev"},"contributors":[{"name":"Valentina Bearzotti","email":"valebearzotti1@gmail.com","url":"https://github.com/valebearzotti"},{"name":"Jose Rago","email":"jose@basement.studio","url":"https://github.com/ragojose"}],"license":"MIT","keywords":["mcp","modelcontextprotocol","http","stdio"],"repository":{"type":"git","url":"https://github.com/basementstudio/xmcp"},"homepage":"https://xmcp.dev","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"xmcp":"dist/cli.js"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","default":"./dist/index.js"},"./headers":{"types":"./dist/runtime/headers.d.ts","require":"./dist/runtime/headers.js","default":"./dist/runtime/headers.js"},"./cloudflare":{"types":"./dist/cloudflare.d.ts","require":"./dist/cloudflare.js","default":"./dist/cloudflare.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"headers":["dist/runtime/headers.d.ts"],"cloudflare":["dist/cloudflare.d.ts"]}},"files":["dist","src"],"scripts":{"dev":"cross-env NODE_ENV=development tsx --watch --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","build":"cross-env NODE_ENV=production tsx --tsconfig ./bundler.tsconfig.json ./bundler/index.ts","analyze":"cross-env GENERATE_STATS=true pnpm build && pnpm tsx scripts/analyze-rspack-stats.ts","test:config":"node --import tsx --test src/compiler/config/__tests__/*.test.ts"},"dependencies":{"@modelcontextprotocol/sdk":"^1.26.0","@rspack/core":"^1.6.7","jose":"^6.1.3","postcss-loader":"^8.2.0","ts-checker-rspack-plugin":"^1.2.1","typescript":"^5.9.3"},"devDependencies":{"@nestjs/common":"^11.1.12","@types/async-retry":"^1.4.9","@types/content-type":"^1.1.9","@types/express":"^5.0.6","@types/fs-extra":"^11.0.4","@types/jsonwebtoken":"^9.0.10","@types/node":"^22.19.2","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","async-retry":"^1.3.3","chalk":"^5.6.2","chokidar":"^3.6.0","ci-info":"^4.3.1","commander":"^11.1.0","content-type":"^1.0.5","cross-env":"^7.0.3","del":"^7.1.0","dotenv":"^16.6.1","express":"^4.22.1","fs-extra":"^11.3.2","glob":"^11.1.0","is-docker":"^4.0.0","is-wsl":"^3.1.0","json5":"^2.2.3","jsonwebtoken":"^9.0.3","memfs":"^4.51.1","raw-body":"^3.0.2","reflect-metadata":"^0.2.2","rxjs":"^7.8.2","tsx":"^4.21.0"},"peerDependencies":{"react":">=19.0.0","react-dom":">=19.0.0","zod":"^3.25.76 || ^4.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}}}')}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var a=s[e]={exports:{}};return r[e](a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,s){if(1&s&&(r=this(r)),8&s||"object"==typeof r&&r&&(4&s&&r.__esModule||16&s&&"function"==typeof r.then))return r;var a=Object.create(null);i.r(a);var n={};e=e||[null,t({}),t([]),t(t)];for(var o=2&s&&r;("object"==typeof o||"function"==typeof o)&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach(e=>{n[e]=()=>r[e]});return n.default=()=>r,i.d(a,n),a},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";let e,t,r,s,n;i.r(a),i.d(a,{apiKeyAuthMiddleware:()=>eJ,disconnectSTDIOClient:()=>lA,UrlElicitationRequiredError:()=>ou,createContext:()=>e9,isEnvHeader:()=>lx,createSTDIOClient:()=>lj,callSTDIOClientTool:()=>lN,headersToRecord:()=>lS,extractToolNamesFromRequest:()=>lC,listSTDIOClientTools:()=>lR,jwtAuthMiddleware:()=>eQ,completable:()=>e6,createHTTPClient:()=>lO});var o,l,u,c,d,p,f,h,m,y,g,v,_,b,w,$,k,E=i(8583),x=i.n(E);(o=y||(y={})).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 s of t)r[s]=e[s];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,(g||(g={})).mergeShapes=(e,t)=>({...e,...t});let S=y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),T=e=>{switch(typeof e){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(e)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":if(Array.isArray(e))return S.array;if(null===e)return S.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return S.promise;if("undefined"!=typeof Map&&e instanceof Map)return S.map;if("undefined"!=typeof Set&&e instanceof Set)return S.set;if("undefined"!=typeof Date&&e instanceof Date)return S.date;return S.object;default:return S.unknown}},P=y.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 I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},s=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(s);else if("invalid_return_type"===i.code)s(i.returnTypeError);else if("invalid_arguments"===i.code)s(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,s=0;for(;s<i.path.length;){let r=i.path[s];s===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(this),r}static assert(e){if(!(e instanceof I))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,y.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let r=s.path[0];t[r]=t[r]||[],t[r].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=e=>new I(e);let O=(e,t)=>{let r;switch(e.code){case P.invalid_type:r=e.received===S.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case P.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,y.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:r=`Unrecognized key(s) in object: ${y.joinValues(e.keys,", ")}`;break;case P.invalid_union:r="Invalid input";break;case P.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${y.joinValues(e.options)}`;break;case P.invalid_enum_value:r=`Invalid enum value. Expected ${y.joinValues(e.options)}, received '${e.received}'`;break;case P.invalid_arguments:r="Invalid function arguments";break;case P.invalid_return_type:r="Invalid function return type";break;case P.invalid_date:r="Invalid date";break;case P.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}"`:y.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case P.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 P.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 P.custom:r="Invalid input";break;case P.invalid_intersection_types:r="Intersection results could not be merged";break;case P.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case P.not_finite:r="Number must be finite";break;default:r=t.defaultError,y.assertNever(e)}return{message:r}},j=e=>{let{data:t,path:r,errorMaps:s,issueData:i}=e,a=[...r,...i.path||[]],n={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="";for(let e of s.filter(e=>!!e).slice().reverse())o=e(n,{data:t,defaultError:o}).message;return{...i,path:a,message:o}};function R(e,t){let r=j({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,O,void 0].filter(e=>!!e)});e.common.issues.push(r)}class N{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 s of t){if("aborted"===s.status)return A;"dirty"===s.status&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,s=await e.value;r.push({key:t,value:s})}return N.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let s of t){let{key:t,value:i}=s;if("aborted"===t.status||"aborted"===i.status)return A;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||s.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let A=Object.freeze({status:"aborted"}),C=e=>({status:"dirty",value:e}),z=e=>({status:"valid",value:e}),M=e=>"undefined"!=typeof Promise&&e instanceof Promise;(l=v||(v={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},l.toString=e=>"string"==typeof e?e:e?.message;class D{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}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 L=(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 I(e.common.issues);return this._error=t,this._error}}};function q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:s,description:i}=e;if(t&&(r||s))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??s??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??r??i.defaultError}},description:i}}class U{get description(){return this._def.description}_getType(e){return T(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(M(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:T(e)},s=this._parseSync({data:e,path:r.path,parent:r});return L(r,s)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(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:T(e)},s=this._parse({data:e,path:r.path,parent:r});return L(r,await (M(s)?s:Promise.resolve(s)))}refine(e,t){return this._refinement((r,s)=>{let i=e(r),a=()=>s.addIssue({code:P.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((r,s)=>!!e(r)||(s.addIssue("function"==typeof t?t(r,s):t),!1))}_refinement(e){return new eA({schema:this,typeName:_.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 eC.create(this,this._def)}nullable(){return ez.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eg.create(this)}promise(){return eN.create(this,this._def)}or(e){return e_.create([this,e],this._def)}and(e){return e$.create(this,e,this._def)}transform(e){return new eA({...q(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eM({...q(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:_.ZodDefault})}brand(){return new eq({typeName:_.ZodBranded,type:this,...q(this._def)})}catch(e){return new eD({...q(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:_.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eU.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,V=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Z]{26}$/i,K=/^[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,H=/^[a-z0-9_-]{21}$/i,B=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G=/^[-+]?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)?)??$/,W=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,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])$/,X=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Y=/^(([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])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,er="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",es=RegExp(`^${er}$`);function ei(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 ea extends U{_parse(t){var r,s,i,a;let n;if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==S.string){let e=this._getOrReturnCtx(t);return R(e,{code:P.invalid_type,expected:S.string,received:e.parsedType}),A}let o=new N;for(let l of this._def.checks)if("min"===l.kind)t.data.length<l.value&&(R(n=this._getOrReturnCtx(t,n),{code:P.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("max"===l.kind)t.data.length>l.value&&(R(n=this._getOrReturnCtx(t,n),{code:P.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("length"===l.kind){let e=t.data.length>l.value,r=t.data.length<l.value;(e||r)&&(n=this._getOrReturnCtx(t,n),e?R(n,{code:P.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&R(n,{code:P.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)W.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"email",code:P.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)e||(e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),e.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"emoji",code:P.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)K.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"uuid",code:P.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)H.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"nanoid",code:P.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)Z.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"cuid",code:P.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)V.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"cuid2",code:P.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)F.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"ulid",code:P.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(t.data)}catch{R(n=this._getOrReturnCtx(t,n),{validation:"url",code:P.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"regex",code:P.invalid_string,message:l.message}),o.dirty())):"trim"===l.kind?t.data=t.data.trim():"includes"===l.kind?t.data.includes(l.value,l.position)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):"toLowerCase"===l.kind?t.data=t.data.toLowerCase():"toUpperCase"===l.kind?t.data=t.data.toUpperCase():"startsWith"===l.kind?t.data.startsWith(l.value)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?t.data.endsWith(l.value)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${er}T${ei(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(l).test(t.data)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?es.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${ei(l)}$`).test(t.data)||(R(n=this._getOrReturnCtx(t,n),{code:P.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?G.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"duration",code:P.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(r=t.data,!(("v4"===(s=l.version)||!s)&&J.test(r)||("v6"===s||!s)&&Y.test(r))&&1&&(R(n=this._getOrReturnCtx(t,n),{validation:"ip",code:P.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!B.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(s));if("object"!=typeof i||null===i||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)return!1;return!0}catch{return!1}}(t.data,l.alg)&&(R(n=this._getOrReturnCtx(t,n),{validation:"jwt",code:P.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(i=t.data,!(("v4"===(a=l.version)||!a)&&X.test(i)||("v6"===a||!a)&&Q.test(i))&&1&&(R(n=this._getOrReturnCtx(t,n),{validation:"cidr",code:P.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?ee.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"base64",code:P.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?et.test(t.data)||(R(n=this._getOrReturnCtx(t,n),{validation:"base64url",code:P.invalid_string,message:l.message}),o.dirty()):y.assertNever(l);return{status:o.value,value:t.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:P.invalid_string,...v.errToObj(r)})}_addCheck(e){return new ea({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){return"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,...v.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,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new ea({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ea({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ea({...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}}ea.create=e=>new ea({checks:[],typeName:_.ZodString,coerce:e?.coerce??!1,...q(e)});class en extends U{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)!==S.number){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.number,received:t.parsedType}),A}let r=new N;for(let s of this._def.checks)"int"===s.kind?y.isInteger(e.data)||(R(t=this._getOrReturnCtx(e,t),{code:P.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(R(t=this._getOrReturnCtx(e,t),{code:P.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)&&(R(t=this._getOrReturnCtx(e,t),{code:P.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,s=(t.toString().split(".")[1]||"").length,i=r>s?r:s;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(e.data,s.value)&&(R(t=this._getOrReturnCtx(e,t),{code:P.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(R(t=this._getOrReturnCtx(e,t),{code:P.not_finite,message:s.message}),r.dirty()):y.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new en({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new en({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(let 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&&y.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)}}en.create=e=>new en({checks:[],typeName:_.ZodNumber,coerce:e?.coerce||!1,...q(e)});class eo extends U{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)!==S.bigint)return this._getInvalidInput(e);let r=new N;for(let s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(R(t=this._getOrReturnCtx(e,t),{code:P.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)&&(R(t=this._getOrReturnCtx(e,t),{code:P.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(R(t=this._getOrReturnCtx(e,t),{code:P.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):y.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.bigint,received:t.parsedType}),A}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,r,s){return new eo({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:v.toString(s)}]})}_addCheck(e){return new eo({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.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}}eo.create=e=>new eo({checks:[],typeName:_.ZodBigInt,coerce:e?.coerce??!1,...q(e)});class el extends U{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.boolean,received:t.parsedType}),A}return z(e.data)}}el.create=e=>new el({typeName:_.ZodBoolean,coerce:e?.coerce||!1,...q(e)});class eu extends U{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.date,received:t.parsedType}),A}if(Number.isNaN(e.data.getTime()))return R(this._getOrReturnCtx(e),{code:P.invalid_date}),A;let r=new N;for(let s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(R(t=this._getOrReturnCtx(e,t),{code:P.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(R(t=this._getOrReturnCtx(e,t),{code:P.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):y.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new eu({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.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}}eu.create=e=>new eu({checks:[],coerce:e?.coerce||!1,typeName:_.ZodDate,...q(e)});class ec extends U{_parse(e){if(this._getType(e)!==S.symbol){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.symbol,received:t.parsedType}),A}return z(e.data)}}ec.create=e=>new ec({typeName:_.ZodSymbol,...q(e)});class ed extends U{_parse(e){if(this._getType(e)!==S.undefined){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.undefined,received:t.parsedType}),A}return z(e.data)}}ed.create=e=>new ed({typeName:_.ZodUndefined,...q(e)});class ep extends U{_parse(e){if(this._getType(e)!==S.null){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.null,received:t.parsedType}),A}return z(e.data)}}ep.create=e=>new ep({typeName:_.ZodNull,...q(e)});class ef extends U{constructor(){super(...arguments),this._any=!0}_parse(e){return z(e.data)}}ef.create=e=>new ef({typeName:_.ZodAny,...q(e)});class eh extends U{constructor(){super(...arguments),this._unknown=!0}_parse(e){return z(e.data)}}eh.create=e=>new eh({typeName:_.ZodUnknown,...q(e)});class em extends U{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.never,received:t.parsedType}),A}}em.create=e=>new em({typeName:_.ZodNever,...q(e)});class ey extends U{_parse(e){if(this._getType(e)!==S.undefined){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.void,received:t.parsedType}),A}return z(e.data)}}ey.create=e=>new ey({typeName:_.ZodVoid,...q(e)});class eg extends U{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==S.array)return R(t,{code:P.invalid_type,expected:S.array,received:t.parsedType}),A;if(null!==s.exactLength){let e=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(e||i)&&(R(t,{code:e?P.too_big:P.too_small,minimum:i?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(R(t,{code:P.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(R(t,{code:P.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>s.type._parseAsync(new D(t,e,t.path,r)))).then(e=>N.mergeArray(r,e));let i=[...t.data].map((e,r)=>s.type._parseSync(new D(t,e,t.path,r)));return N.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new eg({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new eg({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new eg({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}eg.create=(e,t)=>new eg({type:e,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...q(t)});class ev extends U{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=y.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.object,received:t.parsedType}),A}let{status:t,ctx:r}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof em&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||a.push(e);let n=[];for(let e of i){let t=s[e],i=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new D(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof em){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)a.length>0&&(R(r,{code:P.unrecognized_keys,keys:a}),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 a){let s=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new D(r,s,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,s=await t.value;e.push({key:r,value:s,alwaysSet:t.alwaysSet})}return e}).then(e=>N.mergeObjectSync(t,e)):N.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new ev({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let s=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:v.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ev({...this._def,unknownKeys:"strip"})}passthrough(){return new ev({...this._def,unknownKeys:"passthrough"})}extend(e){return new ev({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ev({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ev({...this._def,catchall:e})}pick(e){let t={};for(let r of y.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new ev({...this._def,shape:()=>t})}omit(e){let t={};for(let r of y.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new ev({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ev){let r={};for(let s in t.shape){let i=t.shape[s];r[s]=eC.create(e(i))}return new ev({...t._def,shape:()=>r})}if(t instanceof eg)return new eg({...t._def,type:e(t.element)});if(t instanceof eC)return eC.create(e(t.unwrap()));if(t instanceof ez)return ez.create(e(t.unwrap()));if(t instanceof ek)return ek.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};for(let r of y.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}return new ev({...this._def,shape:()=>t})}required(e){let t={};for(let r of y.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eC;)e=e._def.innerType;t[r]=e}return new ev({...this._def,shape:()=>t})}keyof(){return eO(y.objectKeys(this.shape))}}ev.create=(e,t)=>new ev({shape:()=>e,unknownKeys:"strip",catchall:em.create(),typeName:_.ZodObject,...q(t)}),ev.strictCreate=(e,t)=>new ev({shape:()=>e,unknownKeys:"strict",catchall:em.create(),typeName:_.ZodObject,...q(t)}),ev.lazycreate=(e,t)=>new ev({shape:e,unknownKeys:"strip",catchall:em.create(),typeName:_.ZodObject,...q(t)});class e_ extends U{_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 I(e.ctx.common.issues));return R(t,{code:P.invalid_union,unionErrors:r}),A});{let e,s=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&s.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=s.map(e=>new I(e));return R(t,{code:P.invalid_union,unionErrors:i}),A}}get options(){return this._def.options}}e_.create=(e,t)=>new e_({options:e,typeName:_.ZodUnion,...q(t)});let eb=e=>{if(e instanceof eP)return eb(e.schema);if(e instanceof eA)return eb(e.innerType());if(e instanceof eI)return[e.value];if(e instanceof ej)return e.options;if(e instanceof eR)return y.objectValues(e.enum);else if(e instanceof eM)return eb(e._def.innerType);else if(e instanceof ed)return[void 0];else if(e instanceof ep)return[null];else if(e instanceof eC)return[void 0,...eb(e.unwrap())];else if(e instanceof ez)return[null,...eb(e.unwrap())];else if(e instanceof eq)return eb(e.unwrap());else if(e instanceof eZ)return eb(e.unwrap());else if(e instanceof eD)return eb(e._def.innerType);else return[]};class ew extends U{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return R(t,{code:P.invalid_type,expected:S.object,received:t.parsedType}),A;let r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(R(t,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),A)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let s=new Map;for(let r of t){let t=eb(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(s.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,r)}}return new ew({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...q(r)})}}class e$ extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if("aborted"===e.status||"aborted"===s.status)return A;let i=function e(t,r){let s=T(t),i=T(r);if(t===r)return{valid:!0,data:t};if(s===S.object&&i===S.object){let s=y.objectKeys(r),i=y.objectKeys(t).filter(e=>-1!==s.indexOf(e)),a={...t,...r};for(let s of i){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};a[s]=i.data}return{valid:!0,data:a}}if(s===S.array&&i===S.array){if(t.length!==r.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1};s.push(a.data)}return{valid:!0,data:s}}if(s===S.date&&i===S.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}):(R(r,{code:P.invalid_intersection_types}),A)};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}))}}e$.create=(e,t,r)=>new e$({left:e,right:t,typeName:_.ZodIntersection,...q(r)});class ek extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return R(r,{code:P.invalid_type,expected:S.array,received:r.parsedType}),A;if(r.data.length<this._def.items.length)return R(r,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;!this._def.rest&&r.data.length>this._def.items.length&&(R(r,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((e,t)=>{let s=this._def.items[t]||this._def.rest;return s?s._parse(new D(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(s).then(e=>N.mergeArray(t,e)):N.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new ek({...this._def,rest:e})}}ek.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ek({items:e,typeName:_.ZodTuple,rest:null,...q(t)})};class eE extends U{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!==S.object)return R(r,{code:P.invalid_type,expected:S.object,received:r.parsedType}),A;let s=[],i=this._def.keyType,a=this._def.valueType;for(let e in r.data)s.push({key:i._parse(new D(r,e,r.path,e)),value:a._parse(new D(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?N.mergeObjectAsync(t,s):N.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return new eE(t instanceof U?{keyType:e,valueType:t,typeName:_.ZodRecord,...q(r)}:{keyType:ea.create(),valueType:e,typeName:_.ZodRecord,...q(t)})}}class ex extends U{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!==S.map)return R(r,{code:P.invalid_type,expected:S.map,received:r.parsedType}),A;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([e,t],a)=>({key:s._parse(new D(r,e,r.path,[a,"key"])),value:i._parse(new D(r,t,r.path,[a,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of a){let s=await r.key,i=await r.value;if("aborted"===s.status||"aborted"===i.status)return A;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of a){let s=r.key,i=r.value;if("aborted"===s.status||"aborted"===i.status)return A;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}}}}ex.create=(e,t,r)=>new ex({valueType:t,keyType:e,typeName:_.ZodMap,...q(r)});class eS extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return R(r,{code:P.invalid_type,expected:S.set,received:r.parsedType}),A;let s=this._def;null!==s.minSize&&r.data.size<s.minSize.value&&(R(r,{code:P.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&r.data.size>s.maxSize.value&&(R(r,{code:P.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let r=new Set;for(let s of e){if("aborted"===s.status)return A;"dirty"===s.status&&t.dirty(),r.add(s.value)}return{status:t.value,value:r}}let n=[...r.data.values()].map((e,t)=>i._parse(new D(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>a(e)):a(n)}min(e,t){return new eS({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new eS({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eS.create=(e,t)=>new eS({valueType:e,minSize:null,maxSize:null,typeName:_.ZodSet,...q(t)});class eT extends U{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return R(t,{code:P.invalid_type,expected:S.function,received:t.parsedType}),A;function r(e,r){return j({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,O,O].filter(e=>!!e),issueData:{code:P.invalid_arguments,argumentsError:r}})}function s(e,r){return j({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,O,O].filter(e=>!!e),issueData:{code:P.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof eN){let e=this;return z(async function(...t){let n=new I([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw n.addIssue(r(t,e)),n}),l=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw n.addIssue(s(l,e)),n})})}{let e=this;return z(function(...t){let n=e._def.args.safeParse(t,i);if(!n.success)throw new I([r(t,n.error)]);let o=Reflect.apply(a,this,n.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new I([s(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new eT({...this._def,args:ek.create(e).rest(eh.create())})}returns(e){return new eT({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new eT({args:e||ek.create([]).rest(eh.create()),returns:t||eh.create(),typeName:_.ZodFunction,...q(r)})}}class eP extends U{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})}}eP.create=(e,t)=>new eP({getter:e,typeName:_.ZodLazy,...q(t)});class eI extends U{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:P.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:e.data}}get value(){return this._def.value}}function eO(e,t){return new ej({values:e,typeName:_.ZodEnum,...q(t)})}eI.create=(e,t)=>new eI({value:e,typeName:_.ZodLiteral,...q(t)});class ej extends U{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{expected:y.joinValues(r),received:t.parsedType,code:P.invalid_type}),A}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 R(t,{received:t.data,code:P.invalid_enum_value,options:r}),A}return z(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 ej.create(e,{...this._def,...t})}exclude(e,t=this._def){return ej.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ej.create=eO;class eR extends U{_parse(e){let t=y.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let e=y.objectValues(t);return R(r,{expected:y.joinValues(e),received:r.parsedType,code:P.invalid_type}),A}if(this._cache||(this._cache=new Set(y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=y.objectValues(t);return R(r,{received:r.data,code:P.invalid_enum_value,options:e}),A}return z(e.data)}get enum(){return this._def.values}}eR.create=(e,t)=>new eR({values:e,typeName:_.ZodNativeEnum,...q(t)});class eN extends U{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==S.promise&&!1===t.common.async?(R(t,{code:P.invalid_type,expected:S.promise,received:t.parsedType}),A):z((t.parsedType===S.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eN.create=(e,t)=>new eN({type:e,typeName:_.ZodPromise,...q(t)});class eA extends U{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.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=>{R(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 A;let s=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===s.status?A:"dirty"===s.status||"dirty"===t.value?C(s.value):s});{if("aborted"===t.value)return A;let s=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===s.status?A:"dirty"===s.status||"dirty"===t.value?C(s.value):s}}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?A:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===s.status?A:("dirty"===s.status&&t.dirty(),e(s.value),{status:t.value,value:s.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?A: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 A;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}}y.assertNever(s)}}eA.create=(e,t,r)=>new eA({schema:e,typeName:_.ZodEffects,effect:t,...q(r)}),eA.createWithPreprocess=(e,t,r)=>new eA({schema:t,effect:{type:"preprocess",transform:e},typeName:_.ZodEffects,...q(r)});class eC extends U{_parse(e){return this._getType(e)===S.undefined?z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eC.create=(e,t)=>new eC({innerType:e,typeName:_.ZodOptional,...q(t)});class ez extends U{_parse(e){return this._getType(e)===S.null?z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ez.create=(e,t)=>new ez({innerType:e,typeName:_.ZodNullable,...q(t)});class eM extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===S.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eM.create=(e,t)=>new eM({innerType:e,typeName:_.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...q(t)});class eD extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return M(s)?s.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eD.create=(e,t)=>new eD({innerType:e,typeName:_.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...q(t)});class eL extends U{_parse(e){if(this._getType(e)!==S.nan){let t=this._getOrReturnCtx(e);return R(t,{code:P.invalid_type,expected:S.nan,received:t.parsedType}),A}return{status:"valid",value:e.data}}}eL.create=e=>new eL({typeName:_.ZodNaN,...q(e)}),Symbol("zod_brand");class eq extends U{_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 eU extends U{_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?A:"dirty"===e.status?(t.dirty(),C(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?A:"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 eU({in:e,out:t,typeName:_.ZodPipeline})}}class eZ extends U{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return M(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}eZ.create=(e,t)=>new eZ({innerType:e,typeName:_.ZodReadonly,...q(t)}),ev.lazycreate,(u=_||(_={})).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 eV=ea.create;en.create,eL.create,eo.create;let eF=el.create;eu.create,ec.create,ed.create,ep.create,ef.create,eh.create,em.create,ey.create,eg.create;let eK=ev.create;ev.strictCreate,e_.create,ew.create,e$.create,ek.create,eE.create,ex.create,eS.create;let eH=eT.create;eP.create,eI.create,ej.create,eR.create;let eB=eN.create;eA.create,eC.create,ez.create,eA.createWithPreprocess,eU.create;let eG=eK({apiKey:eV().optional(),headerName:eV().optional(),validateApiKey:eH().args(eV()).returns(eB(eF())).optional()}).strict().refine(e=>void 0!==e.apiKey||void 0!==e.validateApiKey,{message:"Either 'apiKey' or 'validateApiKey' must be provided"}).refine(e=>void 0===e.apiKey||void 0===e.validateApiKey,{message:"'apiKey' and 'validateApiKey' are mutually exclusive - provide only one"}),eW="Unauthorized: Missing or invalid API key";function eJ(e){let t=eG.safeParse(e);if(!t.success){let r="apiKey"in e,s="validateApiKey"in e;if(r&&s)throw Error("'apiKey' and 'validateApiKey' are mutually exclusive - provide only one");if(r||s)throw Error(`Invalid configuration: ${t.error.message}`);throw Error("Either 'apiKey' or 'validateApiKey' must be provided")}let r=e.headerName??"x-api-key",s="apiKey"in e?e.apiKey:void 0,i="validateApiKey"in e?e.validateApiKey:void 0;return async(t,a,n)=>{let o=t.header(r);!o||"apiKey"in e&&o!==s||i&&!await i(o)?a.status(401).json({error:eW}):n()}}var eX=i(8400),eY=i.n(eX);function eQ(e){return(t,r,s)=>{let i=t.header("Authorization");if(!i||!i.startsWith("Bearer "))return void r.status(401).json({error:"Unauthorized: Missing or malformed Authorization header"});let a=i.slice(7).trim();if(!a)return void r.status(401).json({error:"Unauthorized: Missing access token"});try{let{secret:r,...i}=e;t.user=eY().verify(a,r,i),s()}catch(e){r.status(401).json({error:"Unauthorized: Invalid or expired token"})}}}let e0=require("async_hooks"),e1=(e,t)=>{globalThis[e]=t},e2=e=>globalThis[e];function e9({name:e}){let t=Symbol.for(`xmcp-context-${e}`),r=Symbol.for(`xmcp-context-${e}-fallback-store`);if(e2(t))return e2(t);let s=new e0.AsyncLocalStorage,i=globalThis[r]??{current:null};e1(r,i);let a={provider:(e,t)=>(i.current=e,s.run(e,t)),getContext:()=>{let t=s.getStore();if(t)return t;if(i.current)return i.current;throw Error(`getContext() can only be used within the ${e} context.`)},setContext:t=>{let r=s.getStore()??i.current;if(!r)throw Error(`setContext() can only be used within the ${e} context.`);Object.assign(r,t)}};return e1(t,a),a}let e4=Symbol.for("mcp.completable");function e6(e,t){return Object.defineProperty(e,e4,{value:{complete:t},enumerable:!1,writable:!1,configurable:!1}),e}(b||(b={})).Completable="McpCompletable";let e5=Object.freeze({status:"aborted"});function e8(e,t,r){function s(r,s){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:s,constr:n,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,s);let i=n.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in r||(r[t]=i[t].bind(r))}}let i=r?.Parent??Object;class a extends i{}function n(e){var t;let i=r?.Parent?new a:this;for(let r of(s(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))r();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(n,"init",{value:s}),Object.defineProperty(n,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}Symbol("zod_brand");class e3 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class e7 extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}let te={};function tt(e){return e&&Object.assign(te,e),te}function tr(e,t="|"){return e.map(e=>tb(e)).join(t)}function ts(e,t){return"bigint"==typeof t?t.toString():t}function ti(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ta(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let tn=Symbol("evaluating");function to(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==tn)return void 0===s&&(s=tn,s=r()),s},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function tl(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tu(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function tc(e){return JSON.stringify(e)}let td="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tp(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let tf=ti(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function th(e){if(!1===tp(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==tp(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function tm(e){return th(e)?{...e}:Array.isArray(e)?[...e]:e}let ty=new Set(["string","number","symbol"]);function tg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tv(e,t,r){let s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function t_(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 tb(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let tw={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 t$(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function tk(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function tE(e){return"string"==typeof e?e:e?.message}function tx(e,t,r){let s={...e,path:e.path??[]};return e.message||(s.message=tE(e.inst?._zod.def?.error?.(e))??tE(t?.error?.(e))??tE(r.customError?.(e))??tE(r.localeError?.(e))??"Invalid input"),delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function tS(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function tT(...e){let[t,r,s]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:s}:{...t}}let tP=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ts,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},tI=e8("$ZodError",tP),tO=e8("$ZodError",tP,{Parent:Error}),tj=e=>(t,r,s,i)=>{let a=s?Object.assign(s,{async:!1}):{async:!1},n=t._zod.run({value:r,issues:[]},a);if(n instanceof Promise)throw new e3;if(n.issues.length){let t=new(i?.Err??e)(n.issues.map(e=>tx(e,a,tt())));throw td(t,i?.callee),t}return n.value},tR=e=>async(t,r,s,i)=>{let a=s?Object.assign(s,{async:!0}):{async:!0},n=t._zod.run({value:r,issues:[]},a);if(n instanceof Promise&&(n=await n),n.issues.length){let t=new(i?.Err??e)(n.issues.map(e=>tx(e,a,tt())));throw td(t,i?.callee),t}return n.value},tN=e=>(t,r,s)=>{let i=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new e3;return a.issues.length?{success:!1,error:new(e??tI)(a.issues.map(e=>tx(e,i,tt())))}:{success:!0,data:a.value}},tA=tN(tO),tC=e=>async(t,r,s)=>{let i=s?Object.assign(s,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>tx(e,i,tt())))}:{success:!0,data:a.value}},tz=tC(tO),tM=/^[cC][^\s-]{8,}$/,tD=/^[0-9a-z]+$/,tL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tq=/^[0-9a-vA-V]{20}$/,tU=/^[A-Za-z0-9]{27}$/,tZ=/^[a-zA-Z0-9_-]{21}$/,tV=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tF=/^([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})$/,tK=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,tH=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tB=/^(?:(?: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])$/,tG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tW=/^((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])$/,tJ=/^(([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])$/,tX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tY=/^[A-Za-z0-9_-]*$/,tQ=/^\+(?:[0-9]){6,14}[0-9]$/,t0="(?:(?:\\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])))",t1=RegExp(`^${t0}$`);function t2(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let t9=/^-?\d+n?$/,t4=/^-?\d+$/,t6=/^-?\d+(?:\.\d+)?/,t5=/^(?:true|false)$/i,t8=/^null$/i,t3=/^[^A-Z]*$/,t7=/^[^a-z]*$/,re=e8("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),rt={number:"number",bigint:"bigint",object:"date"},rr=e8("$ZodCheckLessThan",(e,t)=>{re.init(e,t);let r=rt[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<s&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rs=e8("$ZodCheckGreaterThan",(e,t)=>{re.init(e,t);let r=rt[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,s=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>s&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ri=e8("$ZodCheckMultipleOf",(e,t)=>{re.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){let r=(e.toString().split(".")[1]||"").length,s=t.toString(),i=(s.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(s)){let e=s.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=r>i?r:i;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}(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})}}),ra=e8("$ZodCheckNumberFormat",(e,t)=>{re.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),s=r?"int":"number",[i,a]=tw[t.format];e._zod.onattach.push(e=>{let s=e._zod.bag;s.format=t.format,s.minimum=i,s.maximum=a,r&&(s.pattern=t4)}),e._zod.check=n=>{let o=n.value;if(r){if(!Number.isInteger(o))return void n.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?n.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,continue:!t.abort}):n.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,continue:!t.abort}))}o<i&&n.issues.push({origin:"number",input:o,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),o>a&&n.issues.push({origin:"number",input:o,code:"too_big",maximum:a,inst:e})}}),rn=e8("$ZodCheckMaxLength",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let s=r.value;if(s.length<=t.maximum)return;let i=tS(s);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),ro=e8("$ZodCheckMinLength",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let s=r.value;if(s.length>=t.minimum)return;let i=tS(s);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),rl=e8("$ZodCheckLengthEquals",(e,t)=>{var r;re.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let s=r.value,i=s.length;if(i===t.length)return;let a=tS(s),n=i>t.length;r.issues.push({origin:a,...n?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ru=e8("$ZodCheckStringFormat",(e,t)=>{var r,s;re.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})}):(s=e._zod).check??(s.check=()=>{})}),rc=e8("$ZodCheckRegex",(e,t)=>{ru.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})}}),rd=e8("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=t3),ru.init(e,t)}),rp=e8("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t7),ru.init(e,t)}),rf=e8("$ZodCheckIncludes",(e,t)=>{re.init(e,t);let r=tg(t.includes),s=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(s)}),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})}}),rh=e8("$ZodCheckStartsWith",(e,t)=>{re.init(e,t);let r=RegExp(`^${tg(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})}}),rm=e8("$ZodCheckEndsWith",(e,t)=>{re.init(e,t);let r=RegExp(`.*${tg(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})}}),ry=e8("$ZodCheckOverwrite",(e,t)=>{re.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class rg{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let rv={major:4,minor:1,patch:13},r_=e8("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rv;let s=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&s.unshift(e),s))for(let r of t._zod.onattach)r(e);if(0===s.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let s,i=t$(e);for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,n=a._zod.check(e);if(n instanceof Promise&&r?.async===!1)throw new e3;if(s||n instanceof Promise)s=(s??Promise.resolve()).then(async()=>{await n,e.issues.length!==t&&(i||(i=t$(e,t)))});else{if(e.issues.length===t)continue;i||(i=t$(e,t))}}return s?s.then(()=>e):e},r=(r,i,a)=>{if(t$(r))return r.aborted=!0,r;let n=t(i,s,a);if(n instanceof Promise){if(!1===a.async)throw new e3;return n.then(t=>e._zod.parse(t,a))}return e._zod.parse(n,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if("backward"===a.direction){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,i,a)):r(t,i,a)}let n=e._zod.parse(i,a);if(n instanceof Promise){if(!1===a.async)throw new e3;return n.then(e=>t(e,s,a))}return t(n,s,a)}}e["~standard"]={validate:t=>{try{let r=tA(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return tz(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),rb=e8("$ZodString",(e,t)=>{var r;let s;r_.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(s=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${s}$`)),e._zod.parse=(r,s)=>{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}}),rw=e8("$ZodStringFormat",(e,t)=>{ru.init(e,t),rb.init(e,t)}),r$=e8("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=tF),rw.init(e,t)}),rk=e8("$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=tK(e))}else t.pattern??(t.pattern=tK());rw.init(e,t)}),rE=e8("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tH),rw.init(e,t)}),rx=e8("$ZodURL",(e,t)=>{rw.init(e,t),e._zod.check=r=>{try{let s=r.value.trim(),i=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=s;return}catch(s){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rS=e8("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),rw.init(e,t)}),rT=e8("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=tZ),rw.init(e,t)}),rP=e8("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tM),rw.init(e,t)}),rI=e8("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tD),rw.init(e,t)}),rO=e8("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tL),rw.init(e,t)}),rj=e8("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tq),rw.init(e,t)}),rR=e8("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tU),rw.init(e,t)}),rN=e8("$ZodISODateTime",(e,t)=>{let r,s,i;t.pattern??(r=t2({precision:t.precision}),s=["Z"],t.local&&s.push(""),t.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),i=`${r}(?:${s.join("|")})`,t.pattern=RegExp(`^${t0}T(?:${i})$`)),rw.init(e,t)}),rA=e8("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=t1),rw.init(e,t)}),rC=e8("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${t2(t)}$`)),rw.init(e,t)}),rz=e8("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tV),rw.init(e,t)}),rM=e8("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tB),rw.init(e,t),e._zod.bag.format="ipv4"}),rD=e8("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=tG),rw.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),rL=e8("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tW),rw.init(e,t)}),rq=e8("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tJ),rw.init(e,t),e._zod.check=r=>{let s=r.value.split("/");try{if(2!==s.length)throw Error();let[e,t]=s;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function rU(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let rZ=e8("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tX),rw.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{rU(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),rV=e8("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tY),rw.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!tY.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return rU(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})}}),rF=e8("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tQ),rw.init(e,t)}),rK=e8("$ZodJWT",(e,t)=>{rw.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[s]=r;if(!s)return!1;let i=JSON.parse(atob(s));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),rH=e8("$ZodNumber",(e,t)=>{r_.init(e,t),e._zod.pattern=e._zod.bag.pattern??t6,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let i=r.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),rB=e8("$ZodNumberFormat",(e,t)=>{ra.init(e,t),rH.init(e,t)}),rG=e8("$ZodBoolean",(e,t)=>{r_.init(e,t),e._zod.pattern=t5,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let i=r.value;return"boolean"==typeof i||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),rW=((e,t)=>{r_.init(e,t),e._zod.pattern=t9,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(e){}return"bigint"==typeof r.value||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}},e8("$ZodNull",(e,t)=>{r_.init(e,t),e._zod.pattern=t8,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let s=t.value;return null===s||t.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),t}})),rJ=e8("$ZodAny",(e,t)=>{r_.init(e,t),e._zod.parse=e=>e}),rX=e8("$ZodUnknown",(e,t)=>{r_.init(e,t),e._zod.parse=e=>e}),rY=e8("$ZodNever",(e,t)=>{r_.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function rQ(e,t,r){e.issues.length&&t.issues.push(...tk(r,e.issues)),t.value[r]=e.value}(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(e){}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}};let r0=e8("$ZodArray",(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let n=i[e],o=t.element._zod.run({value:n,issues:[]},s);o instanceof Promise?a.push(o.then(t=>rQ(t,r,e))):rQ(o,r,e)}return a.length?Promise.all(a).then(()=>r):r}});function r1(e,t,r,s){e.issues.length&&t.issues.push(...tk(r,e.issues)),void 0===e.value?r in s&&(t.value[r]=void 0):t.value[r]=e.value}function r2(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let s=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(s)}}function r9(e,t,r,s,i,a){let n=[],o=i.keySet,l=i.catchall._zod,u=l.def.type;for(let i in t){if(o.has(i))continue;if("never"===u){n.push(i);continue}let a=l.run({value:t[i],issues:[]},s);a instanceof Promise?e.push(a.then(e=>r1(e,r,i,t))):r1(a,r,i,t)}return(n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:a}),e.length)?Promise.all(e).then(()=>r):r}let r4=e8("$ZodObject",(e,t)=>{let r;r_.init(e,t);let s=Object.getOwnPropertyDescriptor(t,"shape");if(!s?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let i=ti(()=>r2(t));to(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let s=e[t]._zod;if(s.values)for(let e of(r[t]??(r[t]=new Set),s.values))r[t].add(e)}return r});let a=t.catchall;e._zod.parse=(t,s)=>{r??(r=i.value);let n=t.value;if(!tp(n))return t.issues.push({expected:"object",code:"invalid_type",input:n,inst:e}),t;t.value={};let o=[],l=r.shape;for(let e of r.keys){let r=l[e]._zod.run({value:n[e],issues:[]},s);r instanceof Promise?o.push(r.then(r=>r1(r,t,e,n))):r1(r,t,e,n)}return a?r9(o,n,t,s,i.value,e):o.length?Promise.all(o).then(()=>t):t}}),r6=e8("$ZodObjectJIT",(e,t)=>{let r,s;r4.init(e,t);let i=e._zod.parse,a=ti(()=>r2(t)),n=!te.jitless,o=n&&tf.value,l=t.catchall;e._zod.parse=(u,c)=>{s??(s=a.value);let d=u.value;return tp(d)?n&&o&&c?.async===!1&&!0!==c.jitless?(r||(r=(e=>{let t=new rg(["shape","payload","ctx"]),r=a.value,s=e=>{let t=tc(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),n=0;for(let e of r.keys)i[e]=`key_${n++}`;for(let e of(t.write("const newResult = {};"),r.keys)){let r=i[e],a=tc(e);t.write(`const ${r} = ${s(e)};`),t.write(`
8
8
  if (${r}.issues.length) {
9
9
  payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
10
10
  ...iss,
@@ -21,8 +21,8 @@
21
21
  newResult[${a}] = ${r}.value;
22
22
  }
23
23
 
24
- `)}t.write("payload.value = newResult;"),t.write("return payload;");let o=t.compile();return(t,r)=>o(e,t,r)})(t.shape)),u=r(u,c),l)?r9([],d,u,c,s,e):u:i(u,c):(u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u)}});function r6(e,t,r,s){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!t$(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>tx(e,s,tt())))}),t)}let r3=e3("$ZodUnion",(e,t)=>{r_.init(e,t),to(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),to(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),to(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),to(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=>ta(e.source)).join("|")})$`)}});let r=1===t.options.length,s=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(r)return s(i,a);let n=!1,o=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)o.push(t),n=!0;else{if(0===t.issues.length)return t;o.push(t)}}return n?Promise.all(o).then(t=>r6(t,i,e,a)):r6(o,i,e,a)}}),r8=e3("$ZodDiscriminatedUnion",(e,t)=>{r3.init(e,t);let r=e._zod.parse;to(e._zod,"propValues",()=>{let e={};for(let r of t.options){let s=r._zod.propValues;if(!s||0===Object.keys(s).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(s))for(let s of(e[t]||(e[t]=new Set),r))e[t].add(s)}return e});let s=ti(()=>{let e=t.options,r=new Map;for(let s of e){let e=s._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,s)}}return r});e._zod.parse=(i,a)=>{let n=i.value;if(!tp(n))return i.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),i;let o=s.value.get(n?.[t.discriminator]);return o?o._zod.run(i,a):t.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:n,path:[t.discriminator],inst:e}),i)}}),r7=e3("$ZodIntersection",(e,t)=>{r_.init(e,t),e._zod.parse=(e,r)=>{let s=e.value,i=t.left._zod.run({value:s,issues:[]},r),a=t.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,r])=>se(e,t,r)):se(e,i,a)}});function se(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),t$(e))return e;let s=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(th(t)&&th(r)){let s=Object.keys(r),i=Object.keys(t).filter(e=>-1!==s.indexOf(e)),a={...t,...r};for(let s of i){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a[s]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let s=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};s.push(a.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}let st=e3("$ZodRecord",(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{let i=r.value;if(!th(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],n=t.keyType._zod.values;if(n){let o;r.value={};let l=new Set;for(let e of n)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){l.add("number"==typeof e?e.toString():e);let n=t.valueType._zod.run({value:i[e],issues:[]},s);n instanceof Promise?a.push(n.then(t=>{t.issues.length&&r.issues.push(...tk(e,t.issues)),r.value[e]=t.value})):(n.issues.length&&r.issues.push(...tk(e,n.issues)),r.value[e]=n.value)}for(let e in i)l.has(e)||(o=o??[]).push(e);o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:o})}else for(let n of(r.value={},Reflect.ownKeys(i))){if("__proto__"===n)continue;let o=t.keyType._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>tx(e,s,tt())),input:n,path:[n],inst:e}),r.value[o.value]=o.value;continue}let l=t.valueType._zod.run({value:i[n],issues:[]},s);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&r.issues.push(...tk(n,e.issues)),r.value[o.value]=e.value})):(l.issues.length&&r.issues.push(...tk(n,l.issues)),r.value[o.value]=l.value)}return a.length?Promise.all(a).then(()=>r):r}}),sr=e3("$ZodEnum",(e,t)=>{var r;let s;r_.init(e,t);let i=(s=Object.values(r=t.entries).filter(e=>"number"==typeof e),Object.entries(r).filter(([e,t])=>-1===s.indexOf(+e)).map(([e,t])=>t)),a=new Set(i);e._zod.values=a,e._zod.pattern=RegExp(`^(${i.filter(e=>ty.has(typeof e)).map(e=>"string"==typeof e?tg(e):e.toString()).join("|")})$`),e._zod.parse=(t,r)=>{let s=t.value;return a.has(s)||t.issues.push({code:"invalid_value",values:i,input:s,inst:e}),t}}),ss=e3("$ZodLiteral",(e,t)=>{if(r_.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?tg(e):e?tg(e.toString()):String(e)).join("|")})$`),e._zod.parse=(s,i)=>{let a=s.value;return r.has(a)||s.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),s}}),si=e3("$ZodTransform",(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new e7(e.constructor.name);let i=t.transform(r.value,r);if(s.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r));if(i instanceof Promise)throw new e8;return r.value=i,r}});function sa(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let sn=e3("$ZodOptional",(e,t)=>{r_.init(e,t),e._zod.optin="optional",e._zod.optout="optional",to(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),to(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ta(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(t=>sa(t,e.value)):sa(s,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),so=e3("$ZodNullable",(e,t)=>{r_.init(e,t),to(e._zod,"optin",()=>t.innerType._zod.optin),to(e._zod,"optout",()=>t.innerType._zod.optout),to(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ta(e.source)}|null)$`):void 0}),to(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)}),sl=e3("$ZodDefault",(e,t)=>{r_.init(e,t),e._zod.optin="optional",to(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(e=>su(e,t)):su(s,t)}});function su(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let sc=e3("$ZodPrefault",(e,t)=>{r_.init(e,t),e._zod.optin="optional",to(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),sd=e3("$ZodNonOptional",(e,t)=>{r_.init(e,t),to(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,s)=>{let i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(t=>sp(t,e)):sp(i,e)}});function sp(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 sf=e3("$ZodCatch",(e,t)=>{r_.init(e,t),to(e._zod,"optin",()=>t.innerType._zod.optin),to(e._zod,"optout",()=>t.innerType._zod.optout),to(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>tx(e,r,tt()))},input:e.value}),e.issues=[]),e)):(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>tx(e,r,tt()))},input:e.value}),e.issues=[]),e)}}),sh=e3("$ZodPipe",(e,t)=>{r_.init(e,t),to(e._zod,"values",()=>t.in._zod.values),to(e._zod,"optin",()=>t.in._zod.optin),to(e._zod,"optout",()=>t.out._zod.optout),to(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let s=t.out._zod.run(e,r);return s instanceof Promise?s.then(e=>sm(e,t.in,r)):sm(s,t.in,r)}let s=t.in._zod.run(e,r);return s instanceof Promise?s.then(e=>sm(e,t.out,r)):sm(s,t.out,r)}});function sm(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}let sy=e3("$ZodReadonly",(e,t)=>{r_.init(e,t),to(e._zod,"propValues",()=>t.innerType._zod.propValues),to(e._zod,"values",()=>t.innerType._zod.values),to(e._zod,"optin",()=>t.innerType?._zod?.optin),to(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(sg):sg(s)}});function sg(e){return e.value=Object.freeze(e.value),e}let sv=e3("$ZodCustom",(e,t)=>{re.init(e,t),r_.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let s=r.value,i=t.fn(s);if(i instanceof Promise)return i.then(t=>s_(t,r,s,e));s_(i,r,s,e)}});function s_(e,t,r,s){if(!e){let e={code:"custom",input:r,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(e.params=s._zod.def.params),t.issues.push(tT(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(w=globalThis).__zod_globalRegistry??(w.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let sb=globalThis.__zod_globalRegistry;function sw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...t_(t)})}function s$(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...t_(t)})}function sk(e,t){return new rr({check:"less_than",...t_(t),value:e,inclusive:!1})}function sE(e,t){return new rr({check:"less_than",...t_(t),value:e,inclusive:!0})}function sx(e,t){return new rs({check:"greater_than",...t_(t),value:e,inclusive:!1})}function sS(e,t){return new rs({check:"greater_than",...t_(t),value:e,inclusive:!0})}function sT(e,t){return new ri({check:"multiple_of",...t_(t),value:e})}function sP(e,t){return new rn({check:"max_length",...t_(t),maximum:e})}function sI(e,t){return new ro({check:"min_length",...t_(t),minimum:e})}function sO(e,t){return new rl({check:"length_equals",...t_(t),length:e})}function sj(e){return new ry({check:"overwrite",tx:e})}function sR(e){return!!e._zod}function sN(e,t){return sR(e)?tA(e,t):e.safeParse(t)}function sA(e){let t;if(e&&(t=sR(e)?e._zod?.def?.shape:e.shape)){if("function"==typeof t)try{return t()}catch{return}return t}}let sC=e3("ZodISODateTime",(e,t)=>{rN.init(e,t),s4.init(e,t)});function sz(e){return new sC({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...t_(e)})}let sM=e3("ZodISODate",(e,t)=>{rA.init(e,t),s4.init(e,t)}),sD=e3("ZodISOTime",(e,t)=>{rC.init(e,t),s4.init(e,t)}),sL=e3("ZodISODuration",(e,t)=>{rz.init(e,t),s4.init(e,t)}),sq=(e,t)=>{tI.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},s=e=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>s({issues:e}));else if("invalid_key"===i.code)s({issues:i.issues});else if("invalid_element"===i.code)s({issues:i.issues});else if(0===i.path.length)r._errors.push(t(i));else{let e=r,s=0;for(;s<i.path.length;){let r=i.path[s];s===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},s=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):s.push(t(i));return{formErrors:s,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ts,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ts,2)}},isEmpty:{get:()=>0===e.issues.length}})};e3("ZodError",sq);let sU=e3("ZodError",sq,{Parent:Error}),sZ=tj(sU),sV=tR(sU),sF=tN(sU),sK=tC(sU),sH=(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tj(sU)(e,t,s)},sB=(e,t,r)=>tj(sU)(e,t,r),sG=async(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tR(sU)(e,t,s)},sW=async(e,t,r)=>tR(sU)(e,t,r),sJ=(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tN(sU)(e,t,s)},sX=(e,t,r)=>tN(sU)(e,t,r),sY=async(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tC(sU)(e,t,s)},sQ=async(e,t,r)=>tC(sU)(e,t,r),s0=e3("ZodType",(e,t)=>(r_.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(tu(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,r)=>tv(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>sZ(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>sF(e,t,r),e.parseAsync=async(t,r)=>sV(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>sK(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>sH(e,t,r),e.decode=(t,r)=>sB(e,t,r),e.encodeAsync=async(t,r)=>sG(e,t,r),e.decodeAsync=async(t,r)=>sW(e,t,r),e.safeEncode=(t,r)=>sJ(e,t,r),e.safeDecode=(t,r)=>sX(e,t,r),e.safeEncodeAsync=async(t,r)=>sY(e,t,r),e.safeDecodeAsync=async(t,r)=>sQ(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return new i4({type:"custom",check:"custom",fn:e,...t_(t)})}(t,r)),e.superRefine=t=>e.check(function(e){var t;let r,s;return t=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(tT(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(tT(e)))},e(t.value,t)),(s=new re({check:"custom",...t_(void 0)}))._zod.check=t,r=s}(t)),e.overwrite=t=>e.check(sj(t)),e.optional=()=>iG(e),e.nullable=()=>iJ(e),e.nullish=()=>iG(iJ(e)),e.nonoptional=t=>new iQ({type:"nonoptional",innerType:e,...t_(t)}),e.array=()=>iI(e),e.or=t=>iA([e,t]),e.and=t=>iD(e,t),e.transform=t=>i2(e,iH(t)),e.default=t=>{var r,s;return r=e,s=t,new iX({type:"default",innerType:r,get defaultValue(){return"function"==typeof s?s():tm(s)}})},e.prefault=t=>{var r,s;return r=e,s=t,new iY({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof s?s():tm(s)}})},e.catch=t=>{var r;return new i0({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r})},e.pipe=t=>i2(e,t),e.readonly=()=>new i9({type:"readonly",innerType:e}),e.describe=t=>{let r=e.clone();return sb.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>sb.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return sb.get(e);let r=e.clone();return sb.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),s1=e3("_ZodString",(e,t)=>{rb.init(e,t),s0.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 rc({check:"string_format",format:"regex",...t_(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new rf({check:"string_format",format:"includes",...t_(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new rh({check:"string_format",format:"starts_with",...t_(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new rm({check:"string_format",format:"ends_with",...t_(t),suffix:e})}(...t)),e.min=(...t)=>e.check(sI(...t)),e.max=(...t)=>e.check(sP(...t)),e.length=(...t)=>e.check(sO(...t)),e.nonempty=(...t)=>e.check(sI(1,...t)),e.lowercase=t=>e.check(new rd({check:"string_format",format:"lowercase",...t_(t)})),e.uppercase=t=>e.check(new rp({check:"string_format",format:"uppercase",...t_(t)})),e.trim=()=>e.check(sj(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return sj(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(sj(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(sj(e=>e.toUpperCase())),e.slugify=()=>e.check(sj(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}),s2=e3("ZodString",(e,t)=>{rb.init(e,t),s1.init(e,t),e.email=t=>e.check(new s5({type:"string",format:"email",check:"string_format",abort:!1,...t_(t)})),e.url=t=>e.check(s$(s8,t)),e.jwt=t=>e.check(new im({type:"string",format:"jwt",check:"string_format",abort:!1,...t_(t)})),e.emoji=t=>e.check(new s7({type:"string",format:"emoji",check:"string_format",abort:!1,...t_(t)})),e.guid=t=>e.check(sw(s6,t)),e.uuid=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,...t_(t)})),e.uuidv4=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...t_(t)})),e.uuidv6=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...t_(t)})),e.uuidv7=t=>e.check(new s3({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...t_(t)})),e.nanoid=t=>e.check(new ie({type:"string",format:"nanoid",check:"string_format",abort:!1,...t_(t)})),e.guid=t=>e.check(sw(s6,t)),e.cuid=t=>e.check(new it({type:"string",format:"cuid",check:"string_format",abort:!1,...t_(t)})),e.cuid2=t=>e.check(new ir({type:"string",format:"cuid2",check:"string_format",abort:!1,...t_(t)})),e.ulid=t=>e.check(new is({type:"string",format:"ulid",check:"string_format",abort:!1,...t_(t)})),e.base64=t=>e.check(new id({type:"string",format:"base64",check:"string_format",abort:!1,...t_(t)})),e.base64url=t=>e.check(new ip({type:"string",format:"base64url",check:"string_format",abort:!1,...t_(t)})),e.xid=t=>e.check(new ii({type:"string",format:"xid",check:"string_format",abort:!1,...t_(t)})),e.ksuid=t=>e.check(new ia({type:"string",format:"ksuid",check:"string_format",abort:!1,...t_(t)})),e.ipv4=t=>e.check(new io({type:"string",format:"ipv4",check:"string_format",abort:!1,...t_(t)})),e.ipv6=t=>e.check(new il({type:"string",format:"ipv6",check:"string_format",abort:!1,...t_(t)})),e.cidrv4=t=>e.check(new iu({type:"string",format:"cidrv4",check:"string_format",abort:!1,...t_(t)})),e.cidrv6=t=>e.check(new ic({type:"string",format:"cidrv6",check:"string_format",abort:!1,...t_(t)})),e.e164=t=>e.check(new ih({type:"string",format:"e164",check:"string_format",abort:!1,...t_(t)})),e.datetime=t=>e.check(sz(t)),e.date=t=>e.check(new sM({type:"string",format:"date",check:"string_format",...t_(t)})),e.time=t=>e.check(new sD({type:"string",format:"time",check:"string_format",precision:null,...t_(t)})),e.duration=t=>e.check(new sL({type:"string",format:"duration",check:"string_format",...t_(t)}))});function s9(e){return new s2({type:"string",...t_(e)})}let s4=e3("ZodStringFormat",(e,t)=>{rw.init(e,t),s1.init(e,t)}),s5=e3("ZodEmail",(e,t)=>{rE.init(e,t),s4.init(e,t)}),s6=e3("ZodGUID",(e,t)=>{r$.init(e,t),s4.init(e,t)}),s3=e3("ZodUUID",(e,t)=>{rk.init(e,t),s4.init(e,t)}),s8=e3("ZodURL",(e,t)=>{rx.init(e,t),s4.init(e,t)}),s7=e3("ZodEmoji",(e,t)=>{rS.init(e,t),s4.init(e,t)}),ie=e3("ZodNanoID",(e,t)=>{rT.init(e,t),s4.init(e,t)}),it=e3("ZodCUID",(e,t)=>{rP.init(e,t),s4.init(e,t)}),ir=e3("ZodCUID2",(e,t)=>{rI.init(e,t),s4.init(e,t)}),is=e3("ZodULID",(e,t)=>{rO.init(e,t),s4.init(e,t)}),ii=e3("ZodXID",(e,t)=>{rj.init(e,t),s4.init(e,t)}),ia=e3("ZodKSUID",(e,t)=>{rR.init(e,t),s4.init(e,t)}),io=e3("ZodIPv4",(e,t)=>{rM.init(e,t),s4.init(e,t)}),il=e3("ZodIPv6",(e,t)=>{rD.init(e,t),s4.init(e,t)}),iu=e3("ZodCIDRv4",(e,t)=>{rL.init(e,t),s4.init(e,t)}),ic=e3("ZodCIDRv6",(e,t)=>{rq.init(e,t),s4.init(e,t)}),id=e3("ZodBase64",(e,t)=>{rZ.init(e,t),s4.init(e,t)}),ip=e3("ZodBase64URL",(e,t)=>{rV.init(e,t),s4.init(e,t)}),ih=e3("ZodE164",(e,t)=>{rF.init(e,t),s4.init(e,t)}),im=e3("ZodJWT",(e,t)=>{rK.init(e,t),s4.init(e,t)}),iy=e3("ZodNumber",(e,t)=>{rH.init(e,t),s0.init(e,t),e.gt=(t,r)=>e.check(sx(t,r)),e.gte=(t,r)=>e.check(sS(t,r)),e.min=(t,r)=>e.check(sS(t,r)),e.lt=(t,r)=>e.check(sk(t,r)),e.lte=(t,r)=>e.check(sE(t,r)),e.max=(t,r)=>e.check(sE(t,r)),e.int=t=>e.check(i_(t)),e.safe=t=>e.check(i_(t)),e.positive=t=>e.check(sx(0,t)),e.nonnegative=t=>e.check(sS(0,t)),e.negative=t=>e.check(sk(0,t)),e.nonpositive=t=>e.check(sE(0,t)),e.multipleOf=(t,r)=>e.check(sT(t,r)),e.step=(t,r)=>e.check(sT(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 ig(e){return new iy({type:"number",checks:[],...t_(e)})}let iv=e3("ZodNumberFormat",(e,t)=>{rB.init(e,t),iy.init(e,t)});function i_(e){return new iv({type:"number",check:"number_format",abort:!1,format:"safeint",...t_(e)})}let ib=e3("ZodBoolean",(e,t)=>{rG.init(e,t),s0.init(e,t)});function iw(e){return new ib({type:"boolean",...t_(e)})}let i$=e3("ZodNull",(e,t)=>{rW.init(e,t),s0.init(e,t)});function ik(e){return new i$({type:"null",...t_(e)})}let iE=e3("ZodAny",(e,t)=>{rJ.init(e,t),s0.init(e,t)}),ix=e3("ZodUnknown",(e,t)=>{rX.init(e,t),s0.init(e,t)});function iS(){return new ix({type:"unknown"})}let iT=e3("ZodNever",(e,t)=>{rY.init(e,t),s0.init(e,t)}),iP=e3("ZodArray",(e,t)=>{r0.init(e,t),s0.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(sI(t,r)),e.nonempty=t=>e.check(sI(1,t)),e.max=(t,r)=>e.check(sP(t,r)),e.length=(t,r)=>e.check(sO(t,r)),e.unwrap=()=>e.element});function iI(e,t){return new iP({type:"array",element:e,...t_(t)})}let iO=e3("ZodObject",(e,t)=>{r5.init(e,t),s0.init(e,t),to(e,"shape",()=>t.shape),e.keyof=()=>iZ(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:iS()}),e.loose=()=>e.clone({...e._zod.def,catchall:iS()}),e.strict=()=>e.clone({...e._zod.def,catchall:new iT({type:"never",...t_(void 0)})}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>(function(e,t){if(!th(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let s=tu(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return tl(this,"shape",r),r},checks:[]});return tv(e,s)})(e,t),e.safeExtend=t=>(function(e,t){if(!th(t))throw Error("Invalid input to safeExtend: expected a plain object");let r={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return tl(this,"shape",r),r},checks:e._zod.def.checks};return tv(e,r)})(e,t),e.merge=t=>{let r;return r=tu(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return tl(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]}),tv(e,r)},e.pick=t=>{let r,s;return r=e._zod.def,s=tu(e._zod.def,{get shape(){let e={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);t[s]&&(e[s]=r.shape[s])}return tl(this,"shape",e),e},checks:[]}),tv(e,s)},e.omit=t=>{let r,s;return r=e._zod.def,s=tu(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete s[e]}return tl(this,"shape",s),s},checks:[]}),tv(e,s)},e.partial=(...t)=>{var r;let s;return r=t[0],s=tu(e._zod.def,{get shape(){let t=e._zod.def.shape,s={...t};if(r)for(let e in r){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);r[e]&&(s[e]=iB?new iB({type:"optional",innerType:t[e]}):t[e])}else for(let e in t)s[e]=iB?new iB({type:"optional",innerType:t[e]}):t[e];return tl(this,"shape",s),s},checks:[]}),tv(e,s)},e.required=(...t)=>{var r;let s;return r=t[0],s=tu(e._zod.def,{get shape(){let t=e._zod.def.shape,s={...t};if(r)for(let e in r){if(!(e in s))throw Error(`Unrecognized key: "${e}"`);r[e]&&(s[e]=new iQ({type:"nonoptional",innerType:t[e]}))}else for(let e in t)s[e]=new iQ({type:"nonoptional",innerType:t[e]});return tl(this,"shape",s),s},checks:[]}),tv(e,s)}});function ij(e,t){return new iO({type:"object",shape:e??{},...t_(t)})}function iR(e,t){return new iO({type:"object",shape:e,catchall:iS(),...t_(t)})}let iN=e3("ZodUnion",(e,t)=>{r3.init(e,t),s0.init(e,t),e.options=t.options});function iA(e,t){return new iN({type:"union",options:e,...t_(t)})}let iC=e3("ZodDiscriminatedUnion",(e,t)=>{iN.init(e,t),r8.init(e,t)});function iz(e,t,r){return new iC({type:"union",options:t,discriminator:e,...t_(r)})}let iM=e3("ZodIntersection",(e,t)=>{r7.init(e,t),s0.init(e,t)});function iD(e,t){return new iM({type:"intersection",left:e,right:t})}let iL=e3("ZodRecord",(e,t)=>{st.init(e,t),s0.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function iq(e,t,r){return new iL({type:"record",keyType:e,valueType:t,...t_(r)})}let iU=e3("ZodEnum",(e,t)=>{sr.init(e,t),s0.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,s)=>{let i={};for(let s of e)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new iU({...t,checks:[],...t_(s),entries:i})},e.exclude=(e,s)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new iU({...t,checks:[],...t_(s),entries:i})}});function iZ(e,t){return new iU({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...t_(t)})}let iV=e3("ZodLiteral",(e,t)=>{ss.init(e,t),s0.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 iF(e,t){return new iV({type:"literal",values:Array.isArray(e)?e:[e],...t_(t)})}let iK=e3("ZodTransform",(e,t)=>{si.init(e,t),s0.init(e,t),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new e7(e.constructor.name);r.addIssue=s=>{"string"==typeof s?r.issues.push(tT(s,r.value,t)):(s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(tT(s)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function iH(e){return new iK({type:"transform",transform:e})}let iB=e3("ZodOptional",(e,t)=>{sn.init(e,t),s0.init(e,t),e.unwrap=()=>e._zod.def.innerType});function iG(e){return new iB({type:"optional",innerType:e})}let iW=e3("ZodNullable",(e,t)=>{so.init(e,t),s0.init(e,t),e.unwrap=()=>e._zod.def.innerType});function iJ(e){return new iW({type:"nullable",innerType:e})}let iX=e3("ZodDefault",(e,t)=>{sl.init(e,t),s0.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),iY=e3("ZodPrefault",(e,t)=>{sc.init(e,t),s0.init(e,t),e.unwrap=()=>e._zod.def.innerType}),iQ=e3("ZodNonOptional",(e,t)=>{sd.init(e,t),s0.init(e,t),e.unwrap=()=>e._zod.def.innerType}),i0=e3("ZodCatch",(e,t)=>{sf.init(e,t),s0.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),i1=e3("ZodPipe",(e,t)=>{sh.init(e,t),s0.init(e,t),e.in=t.in,e.out=t.out});function i2(e,t){return new i1({type:"pipe",in:e,out:t})}let i9=e3("ZodReadonly",(e,t)=>{sy.init(e,t),s0.init(e,t),e.unwrap=()=>e._zod.def.innerType}),i4=e3("ZodCustom",(e,t)=>{sv.init(e,t),s0.init(e,t)});$||($={});tt({localeError:(s={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${e.expected}, received ${(e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}return t})(e.input)}`;case"invalid_value":if(1===e.values.length)return`Invalid input: expected ${tb(e.values[0])}`;return`Invalid option: expected one of ${tr(e.values,"|")}`;case"too_big":{let t=e.inclusive?"<=":"<",r=s[e.origin]??null;if(r)return`Too big: expected ${e.origin??"value"} to have ${t}${e.maximum.toString()} ${r.unit??"elements"}`;return`Too big: expected ${e.origin??"value"} to be ${t}${e.maximum.toString()}`}case"too_small":{let t=e.inclusive?">=":">",r=s[e.origin]??null;if(r)return`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`;return`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case"invalid_format":if("starts_with"===e.format)return`Invalid string: must start with "${e.prefix}"`;if("ends_with"===e.format)return`Invalid string: must end with "${e.suffix}"`;if("includes"===e.format)return`Invalid string: must include "${e.includes}"`;if("regex"===e.format)return`Invalid string: must match pattern ${e.pattern}`;return`Invalid ${n[e.format]??e.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${tr(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}})});let i5="2025-11-25",i6=[i5,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],i3="io.modelcontextprotocol/related-task",i8=(c=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),(r=t_(void 0)).abort??(r.abort=!0),new i4({type:"custom",check:"custom",fn:c,...r})),i7=iA([s9(),ig().int()]),ae=s9();iR({ttl:iA([ig(),ik()]).optional(),pollInterval:ig().optional()});let at=ij({ttl:ig().optional()}),ar=ij({taskId:s9()}),as=iR({progressToken:i7.optional(),[i3]:ar.optional()}),ai=ij({_meta:as.optional()}),aa=ai.extend({task:at.optional()}),an=ij({method:s9(),params:ai.loose().optional()}),ao=ij({_meta:as.optional()}),al=ij({method:s9(),params:ao.loose().optional()}),au=iR({_meta:as.optional()}),ac=iA([s9(),ig().int()]),ad=ij({jsonrpc:iF("2.0"),id:ac,...an.shape}).strict(),ap=e=>ad.safeParse(e).success,af=ij({jsonrpc:iF("2.0"),...al.shape}).strict(),ah=ij({jsonrpc:iF("2.0"),id:ac,result:au}).strict(),am=e=>ah.safeParse(e).success;(d=k||(k={}))[d.ConnectionClosed=-32e3]="ConnectionClosed",d[d.RequestTimeout=-32001]="RequestTimeout",d[d.ParseError=-32700]="ParseError",d[d.InvalidRequest=-32600]="InvalidRequest",d[d.MethodNotFound=-32601]="MethodNotFound",d[d.InvalidParams=-32602]="InvalidParams",d[d.InternalError=-32603]="InternalError",d[d.UrlElicitationRequired=-32042]="UrlElicitationRequired";let ay=ij({jsonrpc:iF("2.0"),id:ac.optional(),error:ij({code:ig().int(),message:s9(),data:iS().optional()})}).strict(),ag=iA([ad,af,ah,ay]);iA([ah,ay]);let av=au.strict(),a_=ao.extend({requestId:ac.optional(),reason:s9().optional()}),ab=al.extend({method:iF("notifications/cancelled"),params:a_}),aw=ij({src:s9(),mimeType:s9().optional(),sizes:iI(s9()).optional(),theme:iZ(["light","dark"]).optional()}),a$=ij({icons:iI(aw).optional()}),ak=ij({name:s9(),title:s9().optional()}),aE=ak.extend({...ak.shape,...a$.shape,version:s9(),websiteUrl:s9().optional(),description:s9().optional()}),ax=iD(ij({applyDefaults:iw().optional()}),iq(s9(),iS())),aS=(p=e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,f=iD(ij({form:ax.optional(),url:i8.optional()}),iq(s9(),iS()).optional()),i2(iH(p),f)),aT=iR({list:i8.optional(),cancel:i8.optional(),requests:iR({sampling:iR({createMessage:i8.optional()}).optional(),elicitation:iR({create:i8.optional()}).optional()}).optional()}),aP=iR({list:i8.optional(),cancel:i8.optional(),requests:iR({tools:iR({call:i8.optional()}).optional()}).optional()}),aI=ij({experimental:iq(s9(),i8).optional(),sampling:ij({context:i8.optional(),tools:i8.optional()}).optional(),elicitation:aS.optional(),roots:ij({listChanged:iw().optional()}).optional(),tasks:aT.optional()}),aO=ai.extend({protocolVersion:s9(),capabilities:aI,clientInfo:aE}),aj=an.extend({method:iF("initialize"),params:aO}),aR=ij({experimental:iq(s9(),i8).optional(),logging:i8.optional(),completions:i8.optional(),prompts:ij({listChanged:iw().optional()}).optional(),resources:ij({subscribe:iw().optional(),listChanged:iw().optional()}).optional(),tools:ij({listChanged:iw().optional()}).optional(),tasks:aP.optional()}),aN=au.extend({protocolVersion:s9(),capabilities:aR,serverInfo:aE,instructions:s9().optional()}),aA=al.extend({method:iF("notifications/initialized"),params:ao.optional()}),aC=an.extend({method:iF("ping"),params:ai.optional()}),az=ij({progress:ig(),total:iG(ig()),message:iG(s9())}),aM=ij({...ao.shape,...az.shape,progressToken:i7}),aD=al.extend({method:iF("notifications/progress"),params:aM}),aL=ai.extend({cursor:ae.optional()}),aq=an.extend({params:aL.optional()}),aU=au.extend({nextCursor:ae.optional()}),aZ=iZ(["working","input_required","completed","failed","cancelled"]),aV=ij({taskId:s9(),status:aZ,ttl:iA([ig(),ik()]),createdAt:s9(),lastUpdatedAt:s9(),pollInterval:iG(ig()),statusMessage:iG(s9())}),aF=au.extend({task:aV}),aK=ao.merge(aV),aH=al.extend({method:iF("notifications/tasks/status"),params:aK}),aB=an.extend({method:iF("tasks/get"),params:ai.extend({taskId:s9()})}),aG=au.merge(aV),aW=an.extend({method:iF("tasks/result"),params:ai.extend({taskId:s9()})});au.loose();let aJ=aq.extend({method:iF("tasks/list")}),aX=aU.extend({tasks:iI(aV)}),aY=an.extend({method:iF("tasks/cancel"),params:ai.extend({taskId:s9()})}),aQ=au.merge(aV),a0=ij({uri:s9(),mimeType:iG(s9()),_meta:iq(s9(),iS()).optional()}),a1=a0.extend({text:s9()}),a2=s9().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),a9=a0.extend({blob:a2}),a4=iZ(["user","assistant"]),a5=ij({audience:iI(a4).optional(),priority:ig().min(0).max(1).optional(),lastModified:sz({offset:!0}).optional()}),a6=ij({...ak.shape,...a$.shape,uri:s9(),description:iG(s9()),mimeType:iG(s9()),annotations:a5.optional(),_meta:iG(iR({}))}),a3=ij({...ak.shape,...a$.shape,uriTemplate:s9(),description:iG(s9()),mimeType:iG(s9()),annotations:a5.optional(),_meta:iG(iR({}))}),a8=aq.extend({method:iF("resources/list")}),a7=aU.extend({resources:iI(a6)}),ne=aq.extend({method:iF("resources/templates/list")}),nt=aU.extend({resourceTemplates:iI(a3)}),nr=ai.extend({uri:s9()}),ns=an.extend({method:iF("resources/read"),params:nr}),ni=au.extend({contents:iI(iA([a1,a9]))}),na=al.extend({method:iF("notifications/resources/list_changed"),params:ao.optional()}),nn=an.extend({method:iF("resources/subscribe"),params:nr}),no=an.extend({method:iF("resources/unsubscribe"),params:nr}),nl=ao.extend({uri:s9()}),nu=al.extend({method:iF("notifications/resources/updated"),params:nl}),nc=ij({name:s9(),description:iG(s9()),required:iG(iw())}),nd=ij({...ak.shape,...a$.shape,description:iG(s9()),arguments:iG(iI(nc)),_meta:iG(iR({}))}),np=aq.extend({method:iF("prompts/list")}),nf=aU.extend({prompts:iI(nd)}),nh=ai.extend({name:s9(),arguments:iq(s9(),s9()).optional()}),nm=an.extend({method:iF("prompts/get"),params:nh}),ny=ij({type:iF("text"),text:s9(),annotations:a5.optional(),_meta:iq(s9(),iS()).optional()}),ng=ij({type:iF("image"),data:a2,mimeType:s9(),annotations:a5.optional(),_meta:iq(s9(),iS()).optional()}),nv=ij({type:iF("audio"),data:a2,mimeType:s9(),annotations:a5.optional(),_meta:iq(s9(),iS()).optional()}),n_=ij({type:iF("tool_use"),name:s9(),id:s9(),input:iq(s9(),iS()),_meta:iq(s9(),iS()).optional()}),nb=ij({type:iF("resource"),resource:iA([a1,a9]),annotations:a5.optional(),_meta:iq(s9(),iS()).optional()}),nw=iA([ny,ng,nv,a6.extend({type:iF("resource_link")}),nb]),n$=ij({role:a4,content:nw}),nk=au.extend({description:s9().optional(),messages:iI(n$)}),nE=al.extend({method:iF("notifications/prompts/list_changed"),params:ao.optional()}),nx=ij({title:s9().optional(),readOnlyHint:iw().optional(),destructiveHint:iw().optional(),idempotentHint:iw().optional(),openWorldHint:iw().optional()}),nS=ij({taskSupport:iZ(["required","optional","forbidden"]).optional()}),nT=ij({...ak.shape,...a$.shape,description:s9().optional(),inputSchema:ij({type:iF("object"),properties:iq(s9(),i8).optional(),required:iI(s9()).optional()}).catchall(iS()),outputSchema:ij({type:iF("object"),properties:iq(s9(),i8).optional(),required:iI(s9()).optional()}).catchall(iS()).optional(),annotations:nx.optional(),execution:nS.optional(),_meta:iq(s9(),iS()).optional()}),nP=aq.extend({method:iF("tools/list")}),nI=aU.extend({tools:iI(nT)}),nO=au.extend({content:iI(nw).default([]),structuredContent:iq(s9(),iS()).optional(),isError:iw().optional()});nO.or(au.extend({toolResult:iS()}));let nj=aa.extend({name:s9(),arguments:iq(s9(),iS()).optional()}),nR=an.extend({method:iF("tools/call"),params:nj}),nN=al.extend({method:iF("notifications/tools/list_changed"),params:ao.optional()}),nA=ij({autoRefresh:iw().default(!0),debounceMs:ig().int().nonnegative().default(300)}),nC=iZ(["debug","info","notice","warning","error","critical","alert","emergency"]),nz=ai.extend({level:nC}),nM=an.extend({method:iF("logging/setLevel"),params:nz}),nD=ao.extend({level:nC,logger:s9().optional(),data:iS()}),nL=al.extend({method:iF("notifications/message"),params:nD}),nq=ij({name:s9().optional()}),nU=ij({hints:iI(nq).optional(),costPriority:ig().min(0).max(1).optional(),speedPriority:ig().min(0).max(1).optional(),intelligencePriority:ig().min(0).max(1).optional()}),nZ=ij({mode:iZ(["auto","required","none"]).optional()}),nV=ij({type:iF("tool_result"),toolUseId:s9().describe("The unique identifier for the corresponding tool call."),content:iI(nw).default([]),structuredContent:ij({}).loose().optional(),isError:iw().optional(),_meta:iq(s9(),iS()).optional()}),nF=iz("type",[ny,ng,nv]),nK=iz("type",[ny,ng,nv,n_,nV]),nH=ij({role:a4,content:iA([nK,iI(nK)]),_meta:iq(s9(),iS()).optional()}),nB=aa.extend({messages:iI(nH),modelPreferences:nU.optional(),systemPrompt:s9().optional(),includeContext:iZ(["none","thisServer","allServers"]).optional(),temperature:ig().optional(),maxTokens:ig().int(),stopSequences:iI(s9()).optional(),metadata:i8.optional(),tools:iI(nT).optional(),toolChoice:nZ.optional()}),nG=an.extend({method:iF("sampling/createMessage"),params:nB}),nW=au.extend({model:s9(),stopReason:iG(iZ(["endTurn","stopSequence","maxTokens"]).or(s9())),role:a4,content:nF}),nJ=au.extend({model:s9(),stopReason:iG(iZ(["endTurn","stopSequence","maxTokens","toolUse"]).or(s9())),role:a4,content:iA([nK,iI(nK)])}),nX=ij({type:iF("boolean"),title:s9().optional(),description:s9().optional(),default:iw().optional()}),nY=ij({type:iF("string"),title:s9().optional(),description:s9().optional(),minLength:ig().optional(),maxLength:ig().optional(),format:iZ(["email","uri","date","date-time"]).optional(),default:s9().optional()}),nQ=ij({type:iZ(["number","integer"]),title:s9().optional(),description:s9().optional(),minimum:ig().optional(),maximum:ig().optional(),default:ig().optional()}),n0=ij({type:iF("string"),title:s9().optional(),description:s9().optional(),enum:iI(s9()),default:s9().optional()}),n1=ij({type:iF("string"),title:s9().optional(),description:s9().optional(),oneOf:iI(ij({const:s9(),title:s9()})),default:s9().optional()}),n2=ij({type:iF("string"),title:s9().optional(),description:s9().optional(),enum:iI(s9()),enumNames:iI(s9()).optional(),default:s9().optional()}),n9=iA([n0,n1]),n4=iA([ij({type:iF("array"),title:s9().optional(),description:s9().optional(),minItems:ig().optional(),maxItems:ig().optional(),items:ij({type:iF("string"),enum:iI(s9())}),default:iI(s9()).optional()}),ij({type:iF("array"),title:s9().optional(),description:s9().optional(),minItems:ig().optional(),maxItems:ig().optional(),items:ij({anyOf:iI(ij({const:s9(),title:s9()}))}),default:iI(s9()).optional()})]),n5=iA([n2,n9,n4]),n6=iA([n5,nX,nY,nQ]),n3=iA([aa.extend({mode:iF("form").optional(),message:s9(),requestedSchema:ij({type:iF("object"),properties:iq(s9(),n6),required:iI(s9()).optional()})}),aa.extend({mode:iF("url"),message:s9(),elicitationId:s9(),url:s9().url()})]),n8=an.extend({method:iF("elicitation/create"),params:n3}),n7=ao.extend({elicitationId:s9()}),oe=al.extend({method:iF("notifications/elicitation/complete"),params:n7}),ot=au.extend({action:iZ(["accept","decline","cancel"]),content:(h=e=>null===e?void 0:e,m=iq(s9(),iA([s9(),ig(),iw(),iI(s9())])).optional(),i2(iH(h),m))}),or=ij({type:iF("ref/resource"),uri:s9()}),os=ij({type:iF("ref/prompt"),name:s9()}),oi=ai.extend({ref:iA([os,or]),argument:ij({name:s9(),value:s9()}),context:ij({arguments:iq(s9(),s9()).optional()}).optional()}),oa=an.extend({method:iF("completion/complete"),params:oi}),on=au.extend({completion:iR({values:iI(s9()).max(100),total:iG(ig().int()),hasMore:iG(iw())})}),oo=ij({uri:s9().startsWith("file://"),name:s9().optional(),_meta:iq(s9(),iS()).optional()}),ol=an.extend({method:iF("roots/list"),params:ai.optional()}),ou=au.extend({roots:iI(oo)}),oc=al.extend({method:iF("notifications/roots/list_changed"),params:ao.optional()});iA([aC,aj,oa,nM,nm,np,a8,ne,ns,nn,no,nR,nP,aB,aW,aJ,aY]),iA([ab,aD,aA,oc,aH]),iA([av,nW,nJ,ot,ou,aG,aX,aF]),iA([aC,nG,n8,ol,aB,aW,aJ,aY]),iA([ab,aD,nL,nu,na,nN,nE,aH,oe]),iA([av,aN,on,nk,nf,a7,nt,ni,nO,nI,aG,aX,aF]);class od 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===k.UrlElicitationRequired&&r&&r.elicitations?new op(r.elicitations,t):new od(e,t,r)}}class op extends od{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(k.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function of(e){return"completed"===e||"failed"===e||"cancelled"===e}function oh(e){let t=sA(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let s=function(e){if(sR(e)){let t=e._zod?.def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(void 0!==r)return r}(r);if("string"!=typeof s)throw Error("Schema method literal must be a string");return s}function om(e,t){let r=sN(e,t);if(!r.success)throw r.error;return r.data}Symbol("Let zodToJsonSchema decide on which parser to use");class oy{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(ab,e=>{this._oncancel(e)}),this.setNotificationHandler(aD,e=>{this._onprogress(e)}),this.setRequestHandler(aC,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(aB,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new od(k.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(aW,async(e,t)=>{let r=async()=>{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,s=this._requestResolvers.get(r);if(s)this._requestResolvers.delete(r),s("response"===e.type?t:new od(t.error.code,t.error.message,t.error.data));else{let t="response"===e.type?"Response":"Error";this._onerror(Error(`${t} handler missing for request ${r}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(s,t.sessionId);if(!i)throw new od(k.InvalidParams,`Task not found: ${s}`);if(!of(i.status))return await this._waitForTaskUpdate(s,t.signal),await r();if(of(i.status)){let e=await this._taskStore.getTaskResult(s,t.sessionId);return this._clearTaskQueue(s),{...e,_meta:{...e._meta,[i3]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(aJ,async(e,t)=>{try{let{tasks:r,nextCursor:s}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:s,_meta:{}}}catch(e){throw new od(k.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(aY,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new od(k.InvalidParams,`Task not found: ${e.params.taskId}`);if(of(r.status))throw new od(k.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 s=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!s)throw new od(k.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...s}}catch(e){if(e instanceof od)throw e;throw new od(k.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;let t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:s})}_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),od.fromError(k.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let s=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(s?.(e,t),am(e)||ay.safeParse(e).success)this._onresponse(e);else if(ap(e))this._onrequest(e,t);else af.safeParse(e).success?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear(),this._requestHandlerAbortControllers.values()))e.abort();this._requestHandlerAbortControllers.clear();let t=od.fromError(k.ConnectionClosed,"Connection closed");for(let r of(this._transport=void 0,this.onclose?.(),e.values()))r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let r,s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,a=e.params?._meta?.[i3]?.taskId;if(void 0===s){let t={jsonrpc:"2.0",id:e.id,error:{code:k.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:t,timestamp:Date.now()},i?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):i?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);let o=(r=e.params,aa.safeParse(r).success)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,u={signal:n.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(n.signal.aborted)return;let r={relatedRequestId:e.id};a&&(r.relatedTask={taskId:a}),await this.notification(t,r)},sendRequest:async(t,r,s)=>{if(n.signal.aborted)throw new od(k.ConnectionClosed,"Request was cancelled");let i={...s,relatedRequestId:e.id};a&&!i.relatedTask&&(i.relatedTask={taskId:a});let o=i.relatedTask?.taskId??a;return o&&l&&await l.updateTaskStatus(o,"input_required"),await this.request(t,r,i)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:a,taskStore:l,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,u)).then(async t=>{if(n.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)},async t=>{if(n.signal.aborted)return;let r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:k.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,s=Number(t),i=this._progressHandlers.get(s);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let a=this._responseHandlers.get(s),n=this._timeoutInfo.get(s);if(n&&a&&n.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(e){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),a(e);return}i(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r(am(e)?e:new od(e.error.code,e.error.message,e.error.data));return}let s=this._responseHandlers.get(t);if(void 0===s)return void this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(am(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&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),s(am(e)?e:od.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async *requestStream(e,t,r){let s,{task:i}=r??{};if(!i){try{let s=await this.request(e,t,r);yield{type:"result",result:s}}catch(e){yield{type:"error",error:e instanceof od?e:new od(k.InternalError,String(e))}}return}try{let i=await this.request(e,aF,r);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new od(k.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:s},r);if(yield{type:"taskStatus",task:e},of(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new od(k.InternalError,`Task ${s} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new od(k.InternalError,`Task ${s} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e};return}let i=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,i)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof od?e:new od(k.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a,task:n,relatedTask:o}=r??{};return new Promise((l,u)=>{let c=e=>{u(e)};if(!this._transport)return void c(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),n&&this.assertTaskCapability(e.method)}catch(e){c(e);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:d};r?.onprogress&&(this._progressHandlers.set(d,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),n&&(p.params={...p.params,task:n}),o&&(p.params={...p.params,_meta:{...p.params?._meta||{},[i3]:o}});let f=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(e)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),u(e instanceof od?e:new od(k.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return u(e);try{let r=sN(t,e.result);r.success?l(r.data):u(r.error)}catch(e){u(e)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let h=r?.timeout??6e4;this._setupTimeout(d,h,r?.maxTotalTimeout,()=>f(od.fromError(k.RequestTimeout,"Request timed out",{timeout:h})),r?.resetTimeoutOnProgress??!1);let m=o?.taskId;if(m){let e=e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,e),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),u(e)})}else this._transport.send(p,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},aG,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},aX,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},aQ,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[i3]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[i3]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))});return}let s={...e,jsonrpc:"2.0"};t?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[i3]:t.relatedTask}}}),await this._transport.send(s,t)}setRequestHandler(e,t){let r=oh(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,s)=>Promise.resolve(t(om(e,r),s)))}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=oh(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(om(e,r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=this._options?.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&&ap(r.message)){let t=r.message.id,s=this._requestResolvers.get(t);s?(s(new od(k.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(t)):this._onerror(Error(`Resolver missing for request ${t} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,s)=>{if(t.aborted)return void s(new od(k.InvalidRequest,"Request cancelled"));let i=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(i),s(new od(k.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async s=>{if(!e)throw Error("No request provided");return await r.createTask(s,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let s=await r.getTask(e,t);if(!s)throw new od(k.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(e,s,i)=>{await r.storeTaskResult(e,s,i,t);let a=await r.getTask(e,t);if(a){let t=aH.parse({method:"notifications/tasks/status",params:a});await this.notification(t),of(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,s,i)=>{let a=await r.getTask(e,t);if(!a)throw new od(k.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(of(a.status))throw new od(k.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,s,i,t);let n=await r.getTask(e,t);if(n){let t=aH.parse({method:"notifications/tasks/status",params:n});await this.notification(t),of(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function og(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var ov=i(4319),o_=i(494);class ob{constructor(e){this._ajv=e??function(){let e=new ov({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return o_(e),e}()}getValidator(e){let t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class ow{constructor(e){this._client=e}async *callToolStream(e,t=nO,r){let s=this._client,i={...r,task:r?.task??(s.isToolTask(e.name)?{}:void 0)},a=s.requestStream({method:"tools/call",params:e},t,i),n=s.getToolOutputValidator(e.name);for await(let t of a){if("result"===t.type&&n){let r=t.result;if(!r.structuredContent&&!r.isError)return void(yield{type:"error",error:new od(k.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)});if(r.structuredContent)try{let e=n(r.structuredContent);if(!e.valid)return void(yield{type:"error",error:new od(k.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)})}catch(e){if(e instanceof od)return void(yield{type:"error",error:e});yield{type:"error",error:new od(k.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)};return}}yield t}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}class o$ extends oy{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new ob,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",nN,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",nE,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",na,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new ow(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 s=t[e];if(void 0===s)continue;let i=r[e];og(i)&&og(s)?r[e]={...i,...s}:r[e]=s}return r}(this._capabilities,e)}setRequestHandler(e,t){let r,s=sA(e),i=s?.method;if(!i)throw Error("Schema is missing a method literal");if(sR(i)){let e=i._zod?.def;r=e?.value??i.value}else{let e=i._def;r=e?.value??i.value}if("string"!=typeof r)throw Error("Schema method literal must be a string");let a=r;if("elicitation/create"===a){let r=async(e,r)=>{let s=sN(n8,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new od(k.InvalidParams,`Invalid elicitation request: ${e}`)}let{params:i}=s.data;i.mode=i.mode??"form";let{supportsFormMode:a,supportsUrlMode:n}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===i.mode&&!a)throw new od(k.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===i.mode&&!n)throw new od(k.InvalidParams,"Client does not support URL-mode elicitation requests");let o=await Promise.resolve(t(e,r));if(i.task){let e=sN(aF,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new od(k.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let l=sN(ot,o);if(!l.success){let e=l.error instanceof Error?l.error.message:String(l.error);throw new od(k.InvalidParams,`Invalid elicitation result: ${e}`)}let u=l.data,c="form"===i.mode?i.requestedSchema:void 0;if("form"===i.mode&&"accept"===u.action&&u.content&&c&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,r){if(t&&null!==r&&"object"==typeof r){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let s=t.properties;for(let t of Object.keys(s)){let i=s[t];void 0===r[t]&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[t]=i.default),void 0!==r[t]&&e(i,r[t])}}if(Array.isArray(t.anyOf))for(let s of t.anyOf)"boolean"!=typeof s&&e(s,r);if(Array.isArray(t.oneOf))for(let s of t.oneOf)"boolean"!=typeof s&&e(s,r)}}(c,u.content)}catch{}return u};return super.setRequestHandler(e,r)}if("sampling/createMessage"===a){let r=async(e,r)=>{let s=sN(nG,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new od(k.InvalidParams,`Invalid sampling request: ${e}`)}let{params:i}=s.data,a=await Promise.resolve(t(e,r));if(i.task){let e=sN(aF,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new od(k.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=sN(i.tools||i.toolChoice?nJ:nW,a);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new od(k.InvalidParams,`Invalid sampling result: ${e}`)}return n.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{let r=await this.request({method:"initialize",params:{protocolVersion:i5,capabilities:this._capabilities,clientInfo:this._clientInfo}},aN,t);if(void 0===r)throw Error(`Server sent invalid initialize result: ${r}`);if(!i6.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t=this._serverCapabilities?.tasks?.requests,r="Server";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);if("tools/call"===e&&!t.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${e})`)}assertTaskHandlerCapability(e){if(this._capabilities){var t=this._capabilities.tasks?.requests,r="Client";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${e})`)}}}async ping(e){return this.request({method:"ping"},av,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},on,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},av,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},nk,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},nf,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},a7,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},nt,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},ni,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},av,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},av,t)}async callTool(e,t=nO,r){if(this.isToolTaskRequired(e.name))throw new od(k.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let s=await this.request({method:"tools/call",params:e},t,r),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new od(k.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{let e=i(s.structuredContent);if(!e.valid)throw new od(k.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof od)throw e;throw new od(k.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return s}isToolTask(e){return!!this._serverCapabilities?.tasks?.requests?.tools?.call&&this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){for(let t of(this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear(),e)){if(t.outputSchema){let e=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}let e=t.execution?.taskSupport;("required"===e||"optional"===e)&&this._cachedKnownTaskTools.add(t.name),"required"===e&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},nI,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,s){let i=nA.safeParse(r);if(!i.success)throw Error(`Invalid ${e} listChanged options: ${i.error.message}`);if("function"!=typeof r.onChanged)throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:n}=i.data,{onChanged:o}=r,l=async()=>{if(!a)return void o(null,null);try{let e=await s();o(null,e)}catch(e){o(e instanceof Error?e:Error(String(e)),null)}},u=()=>{if(n){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let r=setTimeout(l,n);this._listChangedDebounceTimers.set(e,r)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}var ok=i(6507);let oE=require("node:process"),ox=require("node:stream");class oS{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,ag.parse(JSON.parse(e))}clear(){this._buffer=void 0}}let oT="win32"===oE.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];class oP{constructor(e){this._readBuffer=new oS,this._stderrStream=null,this._serverParams=e,("pipe"===e.stderr||"overlapped"===e.stderr)&&(this._stderrStream=new ox.PassThrough)}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{this._process=ok(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let e={};for(let t of oT){let r=oE.env[t];void 0!==r&&(r.startsWith("()")||(e[t]=r))}return e}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===oE.platform&&"type"in process,cwd:this._serverParams.cwd}),this._process.on("error",e=>{t(e),this.onerror?.(e)}),this._process.on("spawn",()=>{e()}),this._process.on("close",e=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",e=>{this.onerror?.(e)}),this._process.stdout?.on("data",e=>{this._readBuffer.append(e),this.processReadBuffer()}),this._process.stdout?.on("error",e=>{this.onerror?.(e)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(t=>{e.once("close",()=>{t()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())]),null===e.exitCode){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())])}if(null===e.exitCode)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw Error("Not connected");let r=JSON.stringify(e)+"\n";this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}}function oI(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}async function oO(e){return(await t).getRandomValues(new Uint8Array(e))}async function oj(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=256-256%t.length,s="";for(;s.length<e;)for(let i of(await oO(e-s.length)))i<r&&(s+=t[i%t.length]);return s}async function oR(e){return await oj(e)}async function oN(e){return btoa(String.fromCharCode(...new Uint8Array(await (await t).subtle.digest("SHA-256",new TextEncoder().encode(e))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function oA(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await oR(e),r=await oN(t);return{code_verifier:t,code_challenge:r}}t=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(i.t.bind(i,7598,19)).then(e=>e.webcrypto);let oC=s$(s8,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),e6}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),oz=iR({resource:s9().url(),authorization_servers:iI(oC).optional(),jwks_uri:s9().url().optional(),scopes_supported:iI(s9()).optional(),bearer_methods_supported:iI(s9()).optional(),resource_signing_alg_values_supported:iI(s9()).optional(),resource_name:s9().optional(),resource_documentation:s9().optional(),resource_policy_uri:s9().url().optional(),resource_tos_uri:s9().url().optional(),tls_client_certificate_bound_access_tokens:iw().optional(),authorization_details_types_supported:iI(s9()).optional(),dpop_signing_alg_values_supported:iI(s9()).optional(),dpop_bound_access_tokens_required:iw().optional()}),oM=iR({issuer:s9(),authorization_endpoint:oC,token_endpoint:oC,registration_endpoint:oC.optional(),scopes_supported:iI(s9()).optional(),response_types_supported:iI(s9()),response_modes_supported:iI(s9()).optional(),grant_types_supported:iI(s9()).optional(),token_endpoint_auth_methods_supported:iI(s9()).optional(),token_endpoint_auth_signing_alg_values_supported:iI(s9()).optional(),service_documentation:oC.optional(),revocation_endpoint:oC.optional(),revocation_endpoint_auth_methods_supported:iI(s9()).optional(),revocation_endpoint_auth_signing_alg_values_supported:iI(s9()).optional(),introspection_endpoint:s9().optional(),introspection_endpoint_auth_methods_supported:iI(s9()).optional(),introspection_endpoint_auth_signing_alg_values_supported:iI(s9()).optional(),code_challenge_methods_supported:iI(s9()).optional(),client_id_metadata_document_supported:iw().optional()}),oD=ij({...iR({issuer:s9(),authorization_endpoint:oC,token_endpoint:oC,userinfo_endpoint:oC.optional(),jwks_uri:oC,registration_endpoint:oC.optional(),scopes_supported:iI(s9()).optional(),response_types_supported:iI(s9()),response_modes_supported:iI(s9()).optional(),grant_types_supported:iI(s9()).optional(),acr_values_supported:iI(s9()).optional(),subject_types_supported:iI(s9()),id_token_signing_alg_values_supported:iI(s9()),id_token_encryption_alg_values_supported:iI(s9()).optional(),id_token_encryption_enc_values_supported:iI(s9()).optional(),userinfo_signing_alg_values_supported:iI(s9()).optional(),userinfo_encryption_alg_values_supported:iI(s9()).optional(),userinfo_encryption_enc_values_supported:iI(s9()).optional(),request_object_signing_alg_values_supported:iI(s9()).optional(),request_object_encryption_alg_values_supported:iI(s9()).optional(),request_object_encryption_enc_values_supported:iI(s9()).optional(),token_endpoint_auth_methods_supported:iI(s9()).optional(),token_endpoint_auth_signing_alg_values_supported:iI(s9()).optional(),display_values_supported:iI(s9()).optional(),claim_types_supported:iI(s9()).optional(),claims_supported:iI(s9()).optional(),service_documentation:s9().optional(),claims_locales_supported:iI(s9()).optional(),ui_locales_supported:iI(s9()).optional(),claims_parameter_supported:iw().optional(),request_parameter_supported:iw().optional(),request_uri_parameter_supported:iw().optional(),require_request_uri_registration:iw().optional(),op_policy_uri:oC.optional(),op_tos_uri:oC.optional(),client_id_metadata_document_supported:iw().optional()}).shape,...oM.pick({code_challenge_methods_supported:!0}).shape}),oL=ij({access_token:s9(),id_token:s9().optional(),token_type:s9(),expires_in:new iy({type:"number",coerce:!0,checks:[],...t_(void 0)}).optional(),scope:s9().optional(),refresh_token:s9().optional()}).strip(),oq=ij({error:s9(),error_description:s9().optional(),error_uri:s9().optional()}),oU=oC.optional().or(iF("").transform(()=>void 0)),oZ=ij({redirect_uris:iI(oC),token_endpoint_auth_method:s9().optional(),grant_types:iI(s9()).optional(),response_types:iI(s9()).optional(),client_name:s9().optional(),client_uri:oC.optional(),logo_uri:oU,scope:s9().optional(),contacts:iI(s9()).optional(),tos_uri:oU,policy_uri:s9().optional(),jwks_uri:oC.optional(),jwks:new iE({type:"any"}).optional(),software_id:s9().optional(),software_version:s9().optional(),software_statement:s9().optional()}).strip(),oV=ij({client_id:s9(),client_secret:s9().optional(),client_id_issued_at:ig().optional(),client_secret_expires_at:ig().optional()}).strip(),oF=oZ.merge(oV);ij({error:s9(),error_description:s9().optional()}).strip(),ij({token:s9(),token_type_hint:s9().optional()}).strip();class oK extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class oH extends oK{}oH.errorCode="invalid_request";class oB extends oK{}oB.errorCode="invalid_client";class oG extends oK{}oG.errorCode="invalid_grant";class oW extends oK{}oW.errorCode="unauthorized_client";class oJ extends oK{}oJ.errorCode="unsupported_grant_type";class oX extends oK{}oX.errorCode="invalid_scope";class oY extends oK{}oY.errorCode="access_denied";class oQ extends oK{}oQ.errorCode="server_error";class o0 extends oK{}o0.errorCode="temporarily_unavailable";class o1 extends oK{}o1.errorCode="unsupported_response_type";class o2 extends oK{}o2.errorCode="unsupported_token_type";class o9 extends oK{}o9.errorCode="invalid_token";class o4 extends oK{}o4.errorCode="method_not_allowed";class o5 extends oK{}o5.errorCode="too_many_requests";class o6 extends oK{}o6.errorCode="invalid_client_metadata";class o3 extends oK{}o3.errorCode="insufficient_scope";class o8 extends oK{}o8.errorCode="invalid_target";let o7={[oH.errorCode]:oH,[oB.errorCode]:oB,[oG.errorCode]:oG,[oW.errorCode]:oW,[oJ.errorCode]:oJ,[oX.errorCode]:oX,[oY.errorCode]:oY,[oQ.errorCode]:oQ,[o0.errorCode]:o0,[o1.errorCode]:o1,[o2.errorCode]:o2,[o9.errorCode]:o9,[o4.errorCode]:o4,[o5.errorCode]:o5,[o6.errorCode]:o6,[o3.errorCode]:o3,[o8.errorCode]:o8};class le extends Error{constructor(e){super(e??"Unauthorized")}}let lt="code",lr="S256";async function ls(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:s}=oq.parse(JSON.parse(r));return new(o7[e]||oQ)(t||"",s)}catch(e){return new oQ(`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${e}. Raw body: ${r}`)}}async function li(e,t){try{return await la(e,t)}catch(r){if(r instanceof oB||r instanceof oW)return await e.invalidateCredentials?.("all"),await la(e,t);if(r instanceof oG)return await e.invalidateCredentials?.("tokens"),await la(e,t);throw r}}async function la(e,{serverUrl:t,authorizationCode:r,scope:s,resourceMetadataUrl:i,fetchFn:a}){let n,o;try{(n=await lu(t,{resourceMetadataUrl:i},a)).authorization_servers&&n.authorization_servers.length>0&&(o=n.authorization_servers[0])}catch{}o||(o=new URL("/",t));let l=await ln(t,e,n),u=await lf(o,{fetchFn:a}),c=await Promise.resolve(e.clientInformation());if(!c){if(void 0!==r)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=u?.client_id_metadata_document_supported===!0,s=e.clientMetadataUrl;if(s&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(s))throw new o6(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${s}`);if(t&&s)c={client_id:s},await e.saveClientInformation?.(c);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let t=await lv(o,{metadata:u,clientMetadata:e.clientMetadata,fetchFn:a});await e.saveClientInformation(t),c=t}}let d=!e.redirectUrl;if(void 0!==r||d){let t=await lg(e,o,{metadata:u,resource:l,authorizationCode:r,fetchFn:a});return await e.saveTokens(t),"AUTHORIZED"}let p=await e.tokens();if(p?.refresh_token)try{let t=await ly(o,{metadata:u,clientInformation:c,refreshToken:p.refresh_token,resource:l,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),"AUTHORIZED"}catch(e){if(!(e instanceof oK)||e instanceof oQ);else throw e}let f=e.state?await e.state():void 0,{authorizationUrl:h,codeVerifier:m}=await lh(o,{metadata:u,clientInformation:c,state:f,redirectUrl:e.redirectUrl,scope:s||n?.scopes_supported?.join(" ")||e.clientMetadata.scope,resource:l});return await e.saveCodeVerifier(m),await e.redirectToAuthorization(h),"REDIRECT"}async function ln(e,t,r){let s,i=((s=new URL("string"==typeof e?e:e.href)).hash="",s);if(t.validateResourceURL)return await t.validateResourceURL(i,r?.resource);if(r){if(!function({requestedResource:e,configuredResource:t}){let r=new URL("string"==typeof e?e:e.href),s=new URL("string"==typeof t?t:t.href);if(r.origin!==s.origin||r.pathname.length<s.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return i.startsWith(a)}({requestedResource:i,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${i} (or origin)`);return new URL(r.resource)}}function lo(e){let t,r=e.headers.get("WWW-Authenticate");if(!r)return{};let[s,i]=r.split(" ");if("bearer"!==s.toLowerCase()||!i)return{};let a=ll(e,"resource_metadata")||void 0;if(a)try{t=new URL(a)}catch{}return{resourceMetadataUrl:t,scope:ll(e,"scope")||void 0,error:ll(e,"error")||void 0}}function ll(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let s=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(s);return i?i[1]||i[2]:null}async function lu(e,t,r=fetch){let s=await lp(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s||404===s.status)throw await s?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await s.body?.cancel(),Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return oz.parse(await s.json())}async function lc(e,t,r=fetch){try{return await r(e,{headers:t})}catch(s){if(s instanceof TypeError)if(t)return lc(e,void 0,r);else return;throw s}}async function ld(e,t,r=fetch){return await lc(e,{"MCP-Protocol-Version":t},r)}async function lp(e,t,r,s){var i,a;let n,o=new URL(e),l=s?.protocolVersion??i5;s?.metadataUrl?n=new URL(s.metadataUrl):(n=new URL(function(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,o.pathname),s?.metadataServerUrl??o)).search=o.search;let u=await ld(n,l,r);if(!s?.metadataUrl&&(i=u,a=o.pathname,!i||i.status>=400&&i.status<500&&"/"!==a)){let e=new URL(`/.well-known/${t}`,o);u=await ld(e,l,r)}return u}async function lf(e,{fetchFn:t=fetch,protocolVersion:r=i5}={}){let s={"MCP-Protocol-Version":r,Accept:"application/json"};for(let{url:r,type:i}of function(e){let t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,s=[];if(!r)return s.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),s;let i=t.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:"oidc"}),s.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:"oidc"}),s}(e)){let e=await lc(r,s,t);if(e){if(!e.ok){if(await e.body?.cancel(),e.status>=400&&e.status<500)continue;throw Error(`HTTP ${e.status} trying to load ${"oauth"===i?"OAuth":"OpenID provider"} metadata from ${r}`)}if("oauth"===i)return oM.parse(await e.json());return oD.parse(await e.json())}}}async function lh(e,{metadata:t,clientInformation:r,redirectUrl:s,scope:i,state:a,resource:n}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(lt))throw Error(`Incompatible auth server: does not support response type ${lt}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(lr))throw Error(`Incompatible auth server: does not support code challenge method ${lr}`)}else o=new URL("/authorize",e);let l=await oA(),u=l.code_verifier,c=l.code_challenge;return o.searchParams.set("response_type",lt),o.searchParams.set("client_id",r.client_id),o.searchParams.set("code_challenge",c),o.searchParams.set("code_challenge_method",lr),o.searchParams.set("redirect_uri",String(s)),a&&o.searchParams.set("state",a),i&&o.searchParams.set("scope",i),i?.includes("offline_access")&&o.searchParams.append("prompt","consent"),n&&o.searchParams.set("resource",n.href),{authorizationUrl:o,codeVerifier:u}}async function lm(e,{metadata:t,tokenRequestParams:r,clientInformation:s,addClientAuthentication:i,resource:a,fetchFn:n}){var o,l;let u,c=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});a&&r.set("resource",a.href),i?await i(d,r,c,t):s&&function(e,t,r,s){let{client_id:i,client_secret:a}=t;switch(e){case"client_secret_basic":var n,o,l,u,c=i,d=a,p=r;if(!d)throw Error("client_secret_basic authentication requires a client_secret");let f=btoa(`${c}:${d}`);p.set("Authorization",`Basic ${f}`);return;case"client_secret_post":n=i,o=a,(l=s).set("client_id",n),o&&l.set("client_secret",o);return;case"none":u=i,s.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((o=s,l=t?.token_endpoint_auth_methods_supported??[],u=void 0!==o.client_secret,0===l.length?u?"client_secret_post":"none":"token_endpoint_auth_method"in o&&o.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(o.token_endpoint_auth_method)&&l.includes(o.token_endpoint_auth_method)?o.token_endpoint_auth_method:u&&l.includes("client_secret_basic")?"client_secret_basic":u&&l.includes("client_secret_post")?"client_secret_post":l.includes("none")?"none":u?"client_secret_post":"none"),s,d,r);let p=await (n??fetch)(c,{method:"POST",headers:d,body:r});if(!p.ok)throw await ls(p);return oL.parse(await p.json())}async function ly(e,{metadata:t,clientInformation:r,refreshToken:s,resource:i,addClientAuthentication:a,fetchFn:n}){let o=new URLSearchParams({grant_type:"refresh_token",refresh_token:s});return{refresh_token:s,...await lm(e,{metadata:t,tokenRequestParams:o,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:n})}}async function lg(e,t,{metadata:r,resource:s,authorizationCode:i,fetchFn:a}={}){let n,o=e.clientMetadata.scope;if(e.prepareTokenRequest&&(n=await e.prepareTokenRequest(o)),!n){if(!i)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");n=new URLSearchParams({grant_type:"authorization_code",code:i,code_verifier:await e.codeVerifier(),redirect_uri:String(e.redirectUrl)})}return lm(t,{metadata:r,tokenRequestParams:n,clientInformation:await e.clientInformation()??void 0,addClientAuthentication:e.addClientAuthentication,resource:s,fetchFn:a})}async function lv(e,{metadata:t,clientMetadata:r,fetchFn:s}){let i;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);let a=await (s??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await ls(a);return oF.parse(await a.json())}class l_ extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function lb(e){}class lw extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let s;super({start(i){s=function(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=lb,onError:r=lb,onRetry:s=lb,onComment:i}=e,a="",n=!0,o,l="",u="";function c(e){if(""===e)return void(l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(`
24
+ `)}t.write("payload.value = newResult;"),t.write("return payload;");let o=t.compile();return(t,r)=>o(e,t,r)})(t.shape)),u=r(u,c),l)?r9([],d,u,c,s,e):u:i(u,c):(u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u)}});function r5(e,t,r,s){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let i=e.filter(e=>!t$(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>tx(e,s,tt())))}),t)}let r8=e8("$ZodUnion",(e,t)=>{r_.init(e,t),to(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),to(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),to(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),to(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=>ta(e.source)).join("|")})$`)}});let r=1===t.options.length,s=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(r)return s(i,a);let n=!1,o=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)o.push(t),n=!0;else{if(0===t.issues.length)return t;o.push(t)}}return n?Promise.all(o).then(t=>r5(t,i,e,a)):r5(o,i,e,a)}}),r3=e8("$ZodDiscriminatedUnion",(e,t)=>{r8.init(e,t);let r=e._zod.parse;to(e._zod,"propValues",()=>{let e={};for(let r of t.options){let s=r._zod.propValues;if(!s||0===Object.keys(s).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(s))for(let s of(e[t]||(e[t]=new Set),r))e[t].add(s)}return e});let s=ti(()=>{let e=t.options,r=new Map;for(let s of e){let e=s._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,s)}}return r});e._zod.parse=(i,a)=>{let n=i.value;if(!tp(n))return i.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),i;let o=s.value.get(n?.[t.discriminator]);return o?o._zod.run(i,a):t.unionFallback?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:n,path:[t.discriminator],inst:e}),i)}}),r7=e8("$ZodIntersection",(e,t)=>{r_.init(e,t),e._zod.parse=(e,r)=>{let s=e.value,i=t.left._zod.run({value:s,issues:[]},r),a=t.right._zod.run({value:s,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,r])=>se(e,t,r)):se(e,i,a)}});function se(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),t$(e))return e;let s=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(th(t)&&th(r)){let s=Object.keys(r),i=Object.keys(t).filter(e=>-1!==s.indexOf(e)),a={...t,...r};for(let s of i){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a[s]=i.data}return{valid:!0,data:a}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let s=[];for(let i=0;i<t.length;i++){let a=e(t[i],r[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};s.push(a.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}let st=e8("$ZodRecord",(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{let i=r.value;if(!th(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],n=t.keyType._zod.values;if(n){let o;r.value={};let l=new Set;for(let e of n)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){l.add("number"==typeof e?e.toString():e);let n=t.valueType._zod.run({value:i[e],issues:[]},s);n instanceof Promise?a.push(n.then(t=>{t.issues.length&&r.issues.push(...tk(e,t.issues)),r.value[e]=t.value})):(n.issues.length&&r.issues.push(...tk(e,n.issues)),r.value[e]=n.value)}for(let e in i)l.has(e)||(o=o??[]).push(e);o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:o})}else for(let n of(r.value={},Reflect.ownKeys(i))){if("__proto__"===n)continue;let o=t.keyType._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>tx(e,s,tt())),input:n,path:[n],inst:e}),r.value[o.value]=o.value;continue}let l=t.valueType._zod.run({value:i[n],issues:[]},s);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&r.issues.push(...tk(n,e.issues)),r.value[o.value]=e.value})):(l.issues.length&&r.issues.push(...tk(n,l.issues)),r.value[o.value]=l.value)}return a.length?Promise.all(a).then(()=>r):r}}),sr=e8("$ZodEnum",(e,t)=>{var r;let s;r_.init(e,t);let i=(s=Object.values(r=t.entries).filter(e=>"number"==typeof e),Object.entries(r).filter(([e,t])=>-1===s.indexOf(+e)).map(([e,t])=>t)),a=new Set(i);e._zod.values=a,e._zod.pattern=RegExp(`^(${i.filter(e=>ty.has(typeof e)).map(e=>"string"==typeof e?tg(e):e.toString()).join("|")})$`),e._zod.parse=(t,r)=>{let s=t.value;return a.has(s)||t.issues.push({code:"invalid_value",values:i,input:s,inst:e}),t}}),ss=e8("$ZodLiteral",(e,t)=>{if(r_.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?tg(e):e?tg(e.toString()):String(e)).join("|")})$`),e._zod.parse=(s,i)=>{let a=s.value;return r.has(a)||s.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),s}}),si=e8("$ZodTransform",(e,t)=>{r_.init(e,t),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new e7(e.constructor.name);let i=t.transform(r.value,r);if(s.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(r.value=e,r));if(i instanceof Promise)throw new e3;return r.value=i,r}});function sa(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let sn=e8("$ZodOptional",(e,t)=>{r_.init(e,t),e._zod.optin="optional",e._zod.optout="optional",to(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),to(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ta(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(t=>sa(t,e.value)):sa(s,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),so=e8("$ZodNullable",(e,t)=>{r_.init(e,t),to(e._zod,"optin",()=>t.innerType._zod.optin),to(e._zod,"optout",()=>t.innerType._zod.optout),to(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ta(e.source)}|null)$`):void 0}),to(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)}),sl=e8("$ZodDefault",(e,t)=>{r_.init(e,t),e._zod.optin="optional",to(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(e=>su(e,t)):su(s,t)}});function su(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let sc=e8("$ZodPrefault",(e,t)=>{r_.init(e,t),e._zod.optin="optional",to(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),sd=e8("$ZodNonOptional",(e,t)=>{r_.init(e,t),to(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,s)=>{let i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(t=>sp(t,e)):sp(i,e)}});function sp(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 sf=e8("$ZodCatch",(e,t)=>{r_.init(e,t),to(e._zod,"optin",()=>t.innerType._zod.optin),to(e._zod,"optout",()=>t.innerType._zod.optout),to(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>tx(e,r,tt()))},input:e.value}),e.issues=[]),e)):(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>tx(e,r,tt()))},input:e.value}),e.issues=[]),e)}}),sh=e8("$ZodPipe",(e,t)=>{r_.init(e,t),to(e._zod,"values",()=>t.in._zod.values),to(e._zod,"optin",()=>t.in._zod.optin),to(e._zod,"optout",()=>t.out._zod.optout),to(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let s=t.out._zod.run(e,r);return s instanceof Promise?s.then(e=>sm(e,t.in,r)):sm(s,t.in,r)}let s=t.in._zod.run(e,r);return s instanceof Promise?s.then(e=>sm(e,t.out,r)):sm(s,t.out,r)}});function sm(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}let sy=e8("$ZodReadonly",(e,t)=>{r_.init(e,t),to(e._zod,"propValues",()=>t.innerType._zod.propValues),to(e._zod,"values",()=>t.innerType._zod.values),to(e._zod,"optin",()=>t.innerType?._zod?.optin),to(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(sg):sg(s)}});function sg(e){return e.value=Object.freeze(e.value),e}let sv=e8("$ZodCustom",(e,t)=>{re.init(e,t),r_.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let s=r.value,i=t.fn(s);if(i instanceof Promise)return i.then(t=>s_(t,r,s,e));s_(i,r,s,e)}});function s_(e,t,r,s){if(!e){let e={code:"custom",input:r,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(e.params=s._zod.def.params),t.issues.push(tT(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(w=globalThis).__zod_globalRegistry??(w.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let s={...r,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let sb=globalThis.__zod_globalRegistry;function sw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...t_(t)})}function s$(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...t_(t)})}function sk(e,t){return new rr({check:"less_than",...t_(t),value:e,inclusive:!1})}function sE(e,t){return new rr({check:"less_than",...t_(t),value:e,inclusive:!0})}function sx(e,t){return new rs({check:"greater_than",...t_(t),value:e,inclusive:!1})}function sS(e,t){return new rs({check:"greater_than",...t_(t),value:e,inclusive:!0})}function sT(e,t){return new ri({check:"multiple_of",...t_(t),value:e})}function sP(e,t){return new rn({check:"max_length",...t_(t),maximum:e})}function sI(e,t){return new ro({check:"min_length",...t_(t),minimum:e})}function sO(e,t){return new rl({check:"length_equals",...t_(t),length:e})}function sj(e){return new ry({check:"overwrite",tx:e})}let sR=e8("ZodISODateTime",(e,t)=>{rN.init(e,t),s1.init(e,t)});function sN(e){return new sR({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...t_(e)})}let sA=e8("ZodISODate",(e,t)=>{rA.init(e,t),s1.init(e,t)}),sC=e8("ZodISOTime",(e,t)=>{rC.init(e,t),s1.init(e,t)}),sz=e8("ZodISODuration",(e,t)=>{rz.init(e,t),s1.init(e,t)}),sM=(e,t)=>{tI.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},s=e=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>s({issues:e}));else if("invalid_key"===i.code)s({issues:i.issues});else if("invalid_element"===i.code)s({issues:i.issues});else if(0===i.path.length)r._errors.push(t(i));else{let e=r,s=0;for(;s<i.path.length;){let r=i.path[s];s===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},s=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):s.push(t(i));return{formErrors:s,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ts,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ts,2)}},isEmpty:{get:()=>0===e.issues.length}})};e8("ZodError",sM);let sD=e8("ZodError",sM,{Parent:Error}),sL=tj(sD),sq=tR(sD),sU=tN(sD),sZ=tC(sD),sV=(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tj(sD)(e,t,s)},sF=(e,t,r)=>tj(sD)(e,t,r),sK=async(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tR(sD)(e,t,s)},sH=async(e,t,r)=>tR(sD)(e,t,r),sB=(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tN(sD)(e,t,s)},sG=(e,t,r)=>tN(sD)(e,t,r),sW=async(e,t,r)=>{let s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tC(sD)(e,t,s)},sJ=async(e,t,r)=>tC(sD)(e,t,r),sX=e8("ZodType",(e,t)=>(r_.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(tu(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,r)=>tv(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>sL(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>sU(e,t,r),e.parseAsync=async(t,r)=>sq(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>sZ(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>sV(e,t,r),e.decode=(t,r)=>sF(e,t,r),e.encodeAsync=async(t,r)=>sK(e,t,r),e.decodeAsync=async(t,r)=>sH(e,t,r),e.safeEncode=(t,r)=>sB(e,t,r),e.safeDecode=(t,r)=>sG(e,t,r),e.safeEncodeAsync=async(t,r)=>sW(e,t,r),e.safeDecodeAsync=async(t,r)=>sJ(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return new i1({type:"custom",check:"custom",fn:e,...t_(t)})}(t,r)),e.superRefine=t=>e.check(function(e){var t;let r,s;return t=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(tT(e,t.value,r._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=r),e.continue??(e.continue=!r._zod.def.abort),t.issues.push(tT(e)))},e(t.value,t)),(s=new re({check:"custom",...t_(void 0)}))._zod.check=t,r=s}(t)),e.overwrite=t=>e.check(sj(t)),e.optional=()=>iK(e),e.nullable=()=>iB(e),e.nullish=()=>iK(iB(e)),e.nonoptional=t=>new iJ({type:"nonoptional",innerType:e,...t_(t)}),e.array=()=>iS(e),e.or=t=>ij([e,t]),e.and=t=>iC(e,t),e.transform=t=>iQ(e,iV(t)),e.default=t=>{var r,s;return r=e,s=t,new iG({type:"default",innerType:r,get defaultValue(){return"function"==typeof s?s():tm(s)}})},e.prefault=t=>{var r,s;return r=e,s=t,new iW({type:"prefault",innerType:r,get defaultValue(){return"function"==typeof s?s():tm(s)}})},e.catch=t=>{var r;return new iX({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r})},e.pipe=t=>iQ(e,t),e.readonly=()=>new i0({type:"readonly",innerType:e}),e.describe=t=>{let r=e.clone();return sb.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>sb.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return sb.get(e);let r=e.clone();return sb.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),sY=e8("_ZodString",(e,t)=>{rb.init(e,t),sX.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 rc({check:"string_format",format:"regex",...t_(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new rf({check:"string_format",format:"includes",...t_(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new rh({check:"string_format",format:"starts_with",...t_(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new rm({check:"string_format",format:"ends_with",...t_(t),suffix:e})}(...t)),e.min=(...t)=>e.check(sI(...t)),e.max=(...t)=>e.check(sP(...t)),e.length=(...t)=>e.check(sO(...t)),e.nonempty=(...t)=>e.check(sI(1,...t)),e.lowercase=t=>e.check(new rd({check:"string_format",format:"lowercase",...t_(t)})),e.uppercase=t=>e.check(new rp({check:"string_format",format:"uppercase",...t_(t)})),e.trim=()=>e.check(sj(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return sj(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(sj(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(sj(e=>e.toUpperCase())),e.slugify=()=>e.check(sj(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}),sQ=e8("ZodString",(e,t)=>{rb.init(e,t),sY.init(e,t),e.email=t=>e.check(new s2({type:"string",format:"email",check:"string_format",abort:!1,...t_(t)})),e.url=t=>e.check(s$(s6,t)),e.jwt=t=>e.check(new id({type:"string",format:"jwt",check:"string_format",abort:!1,...t_(t)})),e.emoji=t=>e.check(new s5({type:"string",format:"emoji",check:"string_format",abort:!1,...t_(t)})),e.guid=t=>e.check(sw(s9,t)),e.uuid=t=>e.check(new s4({type:"string",format:"uuid",check:"string_format",abort:!1,...t_(t)})),e.uuidv4=t=>e.check(new s4({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...t_(t)})),e.uuidv6=t=>e.check(new s4({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...t_(t)})),e.uuidv7=t=>e.check(new s4({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...t_(t)})),e.nanoid=t=>e.check(new s8({type:"string",format:"nanoid",check:"string_format",abort:!1,...t_(t)})),e.guid=t=>e.check(sw(s9,t)),e.cuid=t=>e.check(new s3({type:"string",format:"cuid",check:"string_format",abort:!1,...t_(t)})),e.cuid2=t=>e.check(new s7({type:"string",format:"cuid2",check:"string_format",abort:!1,...t_(t)})),e.ulid=t=>e.check(new ie({type:"string",format:"ulid",check:"string_format",abort:!1,...t_(t)})),e.base64=t=>e.check(new il({type:"string",format:"base64",check:"string_format",abort:!1,...t_(t)})),e.base64url=t=>e.check(new iu({type:"string",format:"base64url",check:"string_format",abort:!1,...t_(t)})),e.xid=t=>e.check(new it({type:"string",format:"xid",check:"string_format",abort:!1,...t_(t)})),e.ksuid=t=>e.check(new ir({type:"string",format:"ksuid",check:"string_format",abort:!1,...t_(t)})),e.ipv4=t=>e.check(new is({type:"string",format:"ipv4",check:"string_format",abort:!1,...t_(t)})),e.ipv6=t=>e.check(new ii({type:"string",format:"ipv6",check:"string_format",abort:!1,...t_(t)})),e.cidrv4=t=>e.check(new ia({type:"string",format:"cidrv4",check:"string_format",abort:!1,...t_(t)})),e.cidrv6=t=>e.check(new io({type:"string",format:"cidrv6",check:"string_format",abort:!1,...t_(t)})),e.e164=t=>e.check(new ic({type:"string",format:"e164",check:"string_format",abort:!1,...t_(t)})),e.datetime=t=>e.check(sN(t)),e.date=t=>e.check(new sA({type:"string",format:"date",check:"string_format",...t_(t)})),e.time=t=>e.check(new sC({type:"string",format:"time",check:"string_format",precision:null,...t_(t)})),e.duration=t=>e.check(new sz({type:"string",format:"duration",check:"string_format",...t_(t)}))});function s0(e){return new sQ({type:"string",...t_(e)})}let s1=e8("ZodStringFormat",(e,t)=>{rw.init(e,t),sY.init(e,t)}),s2=e8("ZodEmail",(e,t)=>{rE.init(e,t),s1.init(e,t)}),s9=e8("ZodGUID",(e,t)=>{r$.init(e,t),s1.init(e,t)}),s4=e8("ZodUUID",(e,t)=>{rk.init(e,t),s1.init(e,t)}),s6=e8("ZodURL",(e,t)=>{rx.init(e,t),s1.init(e,t)}),s5=e8("ZodEmoji",(e,t)=>{rS.init(e,t),s1.init(e,t)}),s8=e8("ZodNanoID",(e,t)=>{rT.init(e,t),s1.init(e,t)}),s3=e8("ZodCUID",(e,t)=>{rP.init(e,t),s1.init(e,t)}),s7=e8("ZodCUID2",(e,t)=>{rI.init(e,t),s1.init(e,t)}),ie=e8("ZodULID",(e,t)=>{rO.init(e,t),s1.init(e,t)}),it=e8("ZodXID",(e,t)=>{rj.init(e,t),s1.init(e,t)}),ir=e8("ZodKSUID",(e,t)=>{rR.init(e,t),s1.init(e,t)}),is=e8("ZodIPv4",(e,t)=>{rM.init(e,t),s1.init(e,t)}),ii=e8("ZodIPv6",(e,t)=>{rD.init(e,t),s1.init(e,t)}),ia=e8("ZodCIDRv4",(e,t)=>{rL.init(e,t),s1.init(e,t)}),io=e8("ZodCIDRv6",(e,t)=>{rq.init(e,t),s1.init(e,t)}),il=e8("ZodBase64",(e,t)=>{rZ.init(e,t),s1.init(e,t)}),iu=e8("ZodBase64URL",(e,t)=>{rV.init(e,t),s1.init(e,t)}),ic=e8("ZodE164",(e,t)=>{rF.init(e,t),s1.init(e,t)}),id=e8("ZodJWT",(e,t)=>{rK.init(e,t),s1.init(e,t)}),ip=e8("ZodNumber",(e,t)=>{rH.init(e,t),sX.init(e,t),e.gt=(t,r)=>e.check(sx(t,r)),e.gte=(t,r)=>e.check(sS(t,r)),e.min=(t,r)=>e.check(sS(t,r)),e.lt=(t,r)=>e.check(sk(t,r)),e.lte=(t,r)=>e.check(sE(t,r)),e.max=(t,r)=>e.check(sE(t,r)),e.int=t=>e.check(iy(t)),e.safe=t=>e.check(iy(t)),e.positive=t=>e.check(sx(0,t)),e.nonnegative=t=>e.check(sS(0,t)),e.negative=t=>e.check(sk(0,t)),e.nonpositive=t=>e.check(sE(0,t)),e.multipleOf=(t,r)=>e.check(sT(t,r)),e.step=(t,r)=>e.check(sT(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 ih(e){return new ip({type:"number",checks:[],...t_(e)})}let im=e8("ZodNumberFormat",(e,t)=>{rB.init(e,t),ip.init(e,t)});function iy(e){return new im({type:"number",check:"number_format",abort:!1,format:"safeint",...t_(e)})}let ig=e8("ZodBoolean",(e,t)=>{rG.init(e,t),sX.init(e,t)});function iv(e){return new ig({type:"boolean",...t_(e)})}let i_=e8("ZodNull",(e,t)=>{rW.init(e,t),sX.init(e,t)});function ib(e){return new i_({type:"null",...t_(e)})}let iw=e8("ZodAny",(e,t)=>{rJ.init(e,t),sX.init(e,t)}),i$=e8("ZodUnknown",(e,t)=>{rX.init(e,t),sX.init(e,t)});function ik(){return new i$({type:"unknown"})}let iE=e8("ZodNever",(e,t)=>{rY.init(e,t),sX.init(e,t)}),ix=e8("ZodArray",(e,t)=>{r0.init(e,t),sX.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(sI(t,r)),e.nonempty=t=>e.check(sI(1,t)),e.max=(t,r)=>e.check(sP(t,r)),e.length=(t,r)=>e.check(sO(t,r)),e.unwrap=()=>e.element});function iS(e,t){return new ix({type:"array",element:e,...t_(t)})}let iT=e8("ZodObject",(e,t)=>{r6.init(e,t),sX.init(e,t),to(e,"shape",()=>t.shape),e.keyof=()=>iL(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ik()}),e.loose=()=>e.clone({...e._zod.def,catchall:ik()}),e.strict=()=>e.clone({...e._zod.def,catchall:new iE({type:"never",...t_(void 0)})}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>(function(e,t){if(!th(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let s=tu(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return tl(this,"shape",r),r},checks:[]});return tv(e,s)})(e,t),e.safeExtend=t=>(function(e,t){if(!th(t))throw Error("Invalid input to safeExtend: expected a plain object");let r={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return tl(this,"shape",r),r},checks:e._zod.def.checks};return tv(e,r)})(e,t),e.merge=t=>{let r;return r=tu(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return tl(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]}),tv(e,r)},e.pick=t=>{let r,s;return r=e._zod.def,s=tu(e._zod.def,{get shape(){let e={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);t[s]&&(e[s]=r.shape[s])}return tl(this,"shape",e),e},checks:[]}),tv(e,s)},e.omit=t=>{let r,s;return r=e._zod.def,s=tu(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete s[e]}return tl(this,"shape",s),s},checks:[]}),tv(e,s)},e.partial=(...t)=>{var r;let s;return r=t[0],s=tu(e._zod.def,{get shape(){let t=e._zod.def.shape,s={...t};if(r)for(let e in r){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);r[e]&&(s[e]=iF?new iF({type:"optional",innerType:t[e]}):t[e])}else for(let e in t)s[e]=iF?new iF({type:"optional",innerType:t[e]}):t[e];return tl(this,"shape",s),s},checks:[]}),tv(e,s)},e.required=(...t)=>{var r;let s;return r=t[0],s=tu(e._zod.def,{get shape(){let t=e._zod.def.shape,s={...t};if(r)for(let e in r){if(!(e in s))throw Error(`Unrecognized key: "${e}"`);r[e]&&(s[e]=new iJ({type:"nonoptional",innerType:t[e]}))}else for(let e in t)s[e]=new iJ({type:"nonoptional",innerType:t[e]});return tl(this,"shape",s),s},checks:[]}),tv(e,s)}});function iP(e,t){return new iT({type:"object",shape:e??{},...t_(t)})}function iI(e,t){return new iT({type:"object",shape:e,catchall:ik(),...t_(t)})}let iO=e8("ZodUnion",(e,t)=>{r8.init(e,t),sX.init(e,t),e.options=t.options});function ij(e,t){return new iO({type:"union",options:e,...t_(t)})}let iR=e8("ZodDiscriminatedUnion",(e,t)=>{iO.init(e,t),r3.init(e,t)});function iN(e,t,r){return new iR({type:"union",options:t,discriminator:e,...t_(r)})}let iA=e8("ZodIntersection",(e,t)=>{r7.init(e,t),sX.init(e,t)});function iC(e,t){return new iA({type:"intersection",left:e,right:t})}let iz=e8("ZodRecord",(e,t)=>{st.init(e,t),sX.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function iM(e,t,r){return new iz({type:"record",keyType:e,valueType:t,...t_(r)})}let iD=e8("ZodEnum",(e,t)=>{sr.init(e,t),sX.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,s)=>{let i={};for(let s of e)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new iD({...t,checks:[],...t_(s),entries:i})},e.exclude=(e,s)=>{let i={...t.entries};for(let t of e)if(r.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new iD({...t,checks:[],...t_(s),entries:i})}});function iL(e,t){return new iD({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...t_(t)})}let iq=e8("ZodLiteral",(e,t)=>{ss.init(e,t),sX.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 iU(e,t){return new iq({type:"literal",values:Array.isArray(e)?e:[e],...t_(t)})}let iZ=e8("ZodTransform",(e,t)=>{si.init(e,t),sX.init(e,t),e._zod.parse=(r,s)=>{if("backward"===s.direction)throw new e7(e.constructor.name);r.addIssue=s=>{"string"==typeof s?r.issues.push(tT(s,r.value,t)):(s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(tT(s)))};let i=t.transform(r.value,r);return i instanceof Promise?i.then(e=>(r.value=e,r)):(r.value=i,r)}});function iV(e){return new iZ({type:"transform",transform:e})}let iF=e8("ZodOptional",(e,t)=>{sn.init(e,t),sX.init(e,t),e.unwrap=()=>e._zod.def.innerType});function iK(e){return new iF({type:"optional",innerType:e})}let iH=e8("ZodNullable",(e,t)=>{so.init(e,t),sX.init(e,t),e.unwrap=()=>e._zod.def.innerType});function iB(e){return new iH({type:"nullable",innerType:e})}let iG=e8("ZodDefault",(e,t)=>{sl.init(e,t),sX.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),iW=e8("ZodPrefault",(e,t)=>{sc.init(e,t),sX.init(e,t),e.unwrap=()=>e._zod.def.innerType}),iJ=e8("ZodNonOptional",(e,t)=>{sd.init(e,t),sX.init(e,t),e.unwrap=()=>e._zod.def.innerType}),iX=e8("ZodCatch",(e,t)=>{sf.init(e,t),sX.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),iY=e8("ZodPipe",(e,t)=>{sh.init(e,t),sX.init(e,t),e.in=t.in,e.out=t.out});function iQ(e,t){return new iY({type:"pipe",in:e,out:t})}let i0=e8("ZodReadonly",(e,t)=>{sy.init(e,t),sX.init(e,t),e.unwrap=()=>e._zod.def.innerType}),i1=e8("ZodCustom",(e,t)=>{sv.init(e,t),sX.init(e,t)});$||($={});tt({localeError:(s={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${e.expected}, received ${(e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}return t})(e.input)}`;case"invalid_value":if(1===e.values.length)return`Invalid input: expected ${tb(e.values[0])}`;return`Invalid option: expected one of ${tr(e.values,"|")}`;case"too_big":{let t=e.inclusive?"<=":"<",r=s[e.origin]??null;if(r)return`Too big: expected ${e.origin??"value"} to have ${t}${e.maximum.toString()} ${r.unit??"elements"}`;return`Too big: expected ${e.origin??"value"} to be ${t}${e.maximum.toString()}`}case"too_small":{let t=e.inclusive?">=":">",r=s[e.origin]??null;if(r)return`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`;return`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case"invalid_format":if("starts_with"===e.format)return`Invalid string: must start with "${e.prefix}"`;if("ends_with"===e.format)return`Invalid string: must end with "${e.suffix}"`;if("includes"===e.format)return`Invalid string: must include "${e.includes}"`;if("regex"===e.format)return`Invalid string: must match pattern ${e.pattern}`;return`Invalid ${n[e.format]??e.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${tr(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}})});let i2="2025-11-25",i9=[i2,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],i4="io.modelcontextprotocol/related-task",i6=(c=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),(r=t_(void 0)).abort??(r.abort=!0),new i1({type:"custom",check:"custom",fn:c,...r})),i5=ij([s0(),ih().int()]),i8=s0();iI({ttl:ij([ih(),ib()]).optional(),pollInterval:ih().optional()});let i3=iP({ttl:ih().optional()}),i7=iP({taskId:s0()}),ae=iI({progressToken:i5.optional(),[i4]:i7.optional()}),at=iP({_meta:ae.optional()}),ar=at.extend({task:i3.optional()}),as=iP({method:s0(),params:at.loose().optional()}),ai=iP({_meta:ae.optional()}),aa=iP({method:s0(),params:ai.loose().optional()}),an=iI({_meta:ae.optional()}),ao=ij([s0(),ih().int()]),al=iP({jsonrpc:iU("2.0"),id:ao,...as.shape}).strict(),au=e=>al.safeParse(e).success,ac=iP({jsonrpc:iU("2.0"),...aa.shape}).strict(),ad=iP({jsonrpc:iU("2.0"),id:ao,result:an}).strict(),ap=e=>ad.safeParse(e).success;(d=k||(k={}))[d.ConnectionClosed=-32e3]="ConnectionClosed",d[d.RequestTimeout=-32001]="RequestTimeout",d[d.ParseError=-32700]="ParseError",d[d.InvalidRequest=-32600]="InvalidRequest",d[d.MethodNotFound=-32601]="MethodNotFound",d[d.InvalidParams=-32602]="InvalidParams",d[d.InternalError=-32603]="InternalError",d[d.UrlElicitationRequired=-32042]="UrlElicitationRequired";let af=iP({jsonrpc:iU("2.0"),id:ao.optional(),error:iP({code:ih().int(),message:s0(),data:ik().optional()})}).strict(),ah=ij([al,ac,ad,af]);ij([ad,af]);let am=an.strict(),ay=ai.extend({requestId:ao.optional(),reason:s0().optional()}),ag=aa.extend({method:iU("notifications/cancelled"),params:ay}),av=iP({src:s0(),mimeType:s0().optional(),sizes:iS(s0()).optional(),theme:iL(["light","dark"]).optional()}),a_=iP({icons:iS(av).optional()}),ab=iP({name:s0(),title:s0().optional()}),aw=ab.extend({...ab.shape,...a_.shape,version:s0(),websiteUrl:s0().optional(),description:s0().optional()}),a$=iC(iP({applyDefaults:iv().optional()}),iM(s0(),ik())),ak=(p=e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,f=iC(iP({form:a$.optional(),url:i6.optional()}),iM(s0(),ik()).optional()),iQ(iV(p),f)),aE=iI({list:i6.optional(),cancel:i6.optional(),requests:iI({sampling:iI({createMessage:i6.optional()}).optional(),elicitation:iI({create:i6.optional()}).optional()}).optional()}),ax=iI({list:i6.optional(),cancel:i6.optional(),requests:iI({tools:iI({call:i6.optional()}).optional()}).optional()}),aS=iP({experimental:iM(s0(),i6).optional(),sampling:iP({context:i6.optional(),tools:i6.optional()}).optional(),elicitation:ak.optional(),roots:iP({listChanged:iv().optional()}).optional(),tasks:aE.optional()}),aT=at.extend({protocolVersion:s0(),capabilities:aS,clientInfo:aw}),aP=as.extend({method:iU("initialize"),params:aT}),aI=iP({experimental:iM(s0(),i6).optional(),logging:i6.optional(),completions:i6.optional(),prompts:iP({listChanged:iv().optional()}).optional(),resources:iP({subscribe:iv().optional(),listChanged:iv().optional()}).optional(),tools:iP({listChanged:iv().optional()}).optional(),tasks:ax.optional()}),aO=an.extend({protocolVersion:s0(),capabilities:aI,serverInfo:aw,instructions:s0().optional()}),aj=aa.extend({method:iU("notifications/initialized"),params:ai.optional()}),aR=as.extend({method:iU("ping"),params:at.optional()}),aN=iP({progress:ih(),total:iK(ih()),message:iK(s0())}),aA=iP({...ai.shape,...aN.shape,progressToken:i5}),aC=aa.extend({method:iU("notifications/progress"),params:aA}),az=at.extend({cursor:i8.optional()}),aM=as.extend({params:az.optional()}),aD=an.extend({nextCursor:i8.optional()}),aL=iL(["working","input_required","completed","failed","cancelled"]),aq=iP({taskId:s0(),status:aL,ttl:ij([ih(),ib()]),createdAt:s0(),lastUpdatedAt:s0(),pollInterval:iK(ih()),statusMessage:iK(s0())}),aU=an.extend({task:aq}),aZ=ai.merge(aq),aV=aa.extend({method:iU("notifications/tasks/status"),params:aZ}),aF=as.extend({method:iU("tasks/get"),params:at.extend({taskId:s0()})}),aK=an.merge(aq),aH=as.extend({method:iU("tasks/result"),params:at.extend({taskId:s0()})});an.loose();let aB=aM.extend({method:iU("tasks/list")}),aG=aD.extend({tasks:iS(aq)}),aW=as.extend({method:iU("tasks/cancel"),params:at.extend({taskId:s0()})}),aJ=an.merge(aq),aX=iP({uri:s0(),mimeType:iK(s0()),_meta:iM(s0(),ik()).optional()}),aY=aX.extend({text:s0()}),aQ=s0().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),a0=aX.extend({blob:aQ}),a1=iL(["user","assistant"]),a2=iP({audience:iS(a1).optional(),priority:ih().min(0).max(1).optional(),lastModified:sN({offset:!0}).optional()}),a9=iP({...ab.shape,...a_.shape,uri:s0(),description:iK(s0()),mimeType:iK(s0()),annotations:a2.optional(),_meta:iK(iI({}))}),a4=iP({...ab.shape,...a_.shape,uriTemplate:s0(),description:iK(s0()),mimeType:iK(s0()),annotations:a2.optional(),_meta:iK(iI({}))}),a6=aM.extend({method:iU("resources/list")}),a5=aD.extend({resources:iS(a9)}),a8=aM.extend({method:iU("resources/templates/list")}),a3=aD.extend({resourceTemplates:iS(a4)}),a7=at.extend({uri:s0()}),ne=as.extend({method:iU("resources/read"),params:a7}),nt=an.extend({contents:iS(ij([aY,a0]))}),nr=aa.extend({method:iU("notifications/resources/list_changed"),params:ai.optional()}),ns=as.extend({method:iU("resources/subscribe"),params:a7}),ni=as.extend({method:iU("resources/unsubscribe"),params:a7}),na=ai.extend({uri:s0()}),nn=aa.extend({method:iU("notifications/resources/updated"),params:na}),no=iP({name:s0(),description:iK(s0()),required:iK(iv())}),nl=iP({...ab.shape,...a_.shape,description:iK(s0()),arguments:iK(iS(no)),_meta:iK(iI({}))}),nu=aM.extend({method:iU("prompts/list")}),nc=aD.extend({prompts:iS(nl)}),nd=at.extend({name:s0(),arguments:iM(s0(),s0()).optional()}),np=as.extend({method:iU("prompts/get"),params:nd}),nf=iP({type:iU("text"),text:s0(),annotations:a2.optional(),_meta:iM(s0(),ik()).optional()}),nh=iP({type:iU("image"),data:aQ,mimeType:s0(),annotations:a2.optional(),_meta:iM(s0(),ik()).optional()}),nm=iP({type:iU("audio"),data:aQ,mimeType:s0(),annotations:a2.optional(),_meta:iM(s0(),ik()).optional()}),ny=iP({type:iU("tool_use"),name:s0(),id:s0(),input:iM(s0(),ik()),_meta:iM(s0(),ik()).optional()}),ng=iP({type:iU("resource"),resource:ij([aY,a0]),annotations:a2.optional(),_meta:iM(s0(),ik()).optional()}),nv=ij([nf,nh,nm,a9.extend({type:iU("resource_link")}),ng]),n_=iP({role:a1,content:nv}),nb=an.extend({description:s0().optional(),messages:iS(n_)}),nw=aa.extend({method:iU("notifications/prompts/list_changed"),params:ai.optional()}),n$=iP({title:s0().optional(),readOnlyHint:iv().optional(),destructiveHint:iv().optional(),idempotentHint:iv().optional(),openWorldHint:iv().optional()}),nk=iP({taskSupport:iL(["required","optional","forbidden"]).optional()}),nE=iP({...ab.shape,...a_.shape,description:s0().optional(),inputSchema:iP({type:iU("object"),properties:iM(s0(),i6).optional(),required:iS(s0()).optional()}).catchall(ik()),outputSchema:iP({type:iU("object"),properties:iM(s0(),i6).optional(),required:iS(s0()).optional()}).catchall(ik()).optional(),annotations:n$.optional(),execution:nk.optional(),_meta:iM(s0(),ik()).optional()}),nx=aM.extend({method:iU("tools/list")}),nS=aD.extend({tools:iS(nE)}),nT=an.extend({content:iS(nv).default([]),structuredContent:iM(s0(),ik()).optional(),isError:iv().optional()});nT.or(an.extend({toolResult:ik()}));let nP=ar.extend({name:s0(),arguments:iM(s0(),ik()).optional()}),nI=as.extend({method:iU("tools/call"),params:nP}),nO=aa.extend({method:iU("notifications/tools/list_changed"),params:ai.optional()}),nj=iP({autoRefresh:iv().default(!0),debounceMs:ih().int().nonnegative().default(300)}),nR=iL(["debug","info","notice","warning","error","critical","alert","emergency"]),nN=at.extend({level:nR}),nA=as.extend({method:iU("logging/setLevel"),params:nN}),nC=ai.extend({level:nR,logger:s0().optional(),data:ik()}),nz=aa.extend({method:iU("notifications/message"),params:nC}),nM=iP({name:s0().optional()}),nD=iP({hints:iS(nM).optional(),costPriority:ih().min(0).max(1).optional(),speedPriority:ih().min(0).max(1).optional(),intelligencePriority:ih().min(0).max(1).optional()}),nL=iP({mode:iL(["auto","required","none"]).optional()}),nq=iP({type:iU("tool_result"),toolUseId:s0().describe("The unique identifier for the corresponding tool call."),content:iS(nv).default([]),structuredContent:iP({}).loose().optional(),isError:iv().optional(),_meta:iM(s0(),ik()).optional()}),nU=iN("type",[nf,nh,nm]),nZ=iN("type",[nf,nh,nm,ny,nq]),nV=iP({role:a1,content:ij([nZ,iS(nZ)]),_meta:iM(s0(),ik()).optional()}),nF=ar.extend({messages:iS(nV),modelPreferences:nD.optional(),systemPrompt:s0().optional(),includeContext:iL(["none","thisServer","allServers"]).optional(),temperature:ih().optional(),maxTokens:ih().int(),stopSequences:iS(s0()).optional(),metadata:i6.optional(),tools:iS(nE).optional(),toolChoice:nL.optional()}),nK=as.extend({method:iU("sampling/createMessage"),params:nF}),nH=an.extend({model:s0(),stopReason:iK(iL(["endTurn","stopSequence","maxTokens"]).or(s0())),role:a1,content:nU}),nB=an.extend({model:s0(),stopReason:iK(iL(["endTurn","stopSequence","maxTokens","toolUse"]).or(s0())),role:a1,content:ij([nZ,iS(nZ)])}),nG=iP({type:iU("boolean"),title:s0().optional(),description:s0().optional(),default:iv().optional()}),nW=iP({type:iU("string"),title:s0().optional(),description:s0().optional(),minLength:ih().optional(),maxLength:ih().optional(),format:iL(["email","uri","date","date-time"]).optional(),default:s0().optional()}),nJ=iP({type:iL(["number","integer"]),title:s0().optional(),description:s0().optional(),minimum:ih().optional(),maximum:ih().optional(),default:ih().optional()}),nX=iP({type:iU("string"),title:s0().optional(),description:s0().optional(),enum:iS(s0()),default:s0().optional()}),nY=iP({type:iU("string"),title:s0().optional(),description:s0().optional(),oneOf:iS(iP({const:s0(),title:s0()})),default:s0().optional()}),nQ=iP({type:iU("string"),title:s0().optional(),description:s0().optional(),enum:iS(s0()),enumNames:iS(s0()).optional(),default:s0().optional()}),n0=ij([nX,nY]),n1=ij([iP({type:iU("array"),title:s0().optional(),description:s0().optional(),minItems:ih().optional(),maxItems:ih().optional(),items:iP({type:iU("string"),enum:iS(s0())}),default:iS(s0()).optional()}),iP({type:iU("array"),title:s0().optional(),description:s0().optional(),minItems:ih().optional(),maxItems:ih().optional(),items:iP({anyOf:iS(iP({const:s0(),title:s0()}))}),default:iS(s0()).optional()})]),n2=ij([nQ,n0,n1]),n9=ij([n2,nG,nW,nJ]),n4=ij([ar.extend({mode:iU("form").optional(),message:s0(),requestedSchema:iP({type:iU("object"),properties:iM(s0(),n9),required:iS(s0()).optional()})}),ar.extend({mode:iU("url"),message:s0(),elicitationId:s0(),url:s0().url()})]),n6=as.extend({method:iU("elicitation/create"),params:n4}),n5=ai.extend({elicitationId:s0()}),n8=aa.extend({method:iU("notifications/elicitation/complete"),params:n5}),n3=an.extend({action:iL(["accept","decline","cancel"]),content:(h=e=>null===e?void 0:e,m=iM(s0(),ij([s0(),ih(),iv(),iS(s0())])).optional(),iQ(iV(h),m))}),n7=iP({type:iU("ref/resource"),uri:s0()}),oe=iP({type:iU("ref/prompt"),name:s0()}),ot=at.extend({ref:ij([oe,n7]),argument:iP({name:s0(),value:s0()}),context:iP({arguments:iM(s0(),s0()).optional()}).optional()}),or=as.extend({method:iU("completion/complete"),params:ot}),os=an.extend({completion:iI({values:iS(s0()).max(100),total:iK(ih().int()),hasMore:iK(iv())})}),oi=iP({uri:s0().startsWith("file://"),name:s0().optional(),_meta:iM(s0(),ik()).optional()}),oa=as.extend({method:iU("roots/list"),params:at.optional()}),on=an.extend({roots:iS(oi)}),oo=aa.extend({method:iU("notifications/roots/list_changed"),params:ai.optional()});ij([aR,aP,or,nA,np,nu,a6,a8,ne,ns,ni,nI,nx,aF,aH,aB,aW]),ij([ag,aC,aj,oo,aV]),ij([am,nH,nB,n3,on,aK,aG,aU]),ij([aR,nK,n6,oa,aF,aH,aB,aW]),ij([ag,aC,nz,nn,nr,nO,nw,aV,n8]),ij([am,aO,os,nb,nc,a5,a3,nt,nT,nS,aK,aG,aU]);class ol 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===k.UrlElicitationRequired&&r&&r.elicitations?new ou(r.elicitations,t):new ol(e,t,r)}}class ou extends ol{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(k.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function oc(e){return!!e._zod}function od(e,t){return oc(e)?tA(e,t):e.safeParse(t)}function op(e){let t;if(e&&(t=oc(e)?e._zod?.def?.shape:e.shape)){if("function"==typeof t)try{return t()}catch{return}return t}}function of(e){return"completed"===e||"failed"===e||"cancelled"===e}function oh(e){let t=op(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let s=function(e){if(oc(e)){let t=e._zod?.def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(void 0!==r)return r}(r);if("string"!=typeof s)throw Error("Schema method literal must be a string");return s}function om(e,t){let r=od(e,t);if(!r.success)throw r.error;return r.data}Symbol("Let zodToJsonSchema decide on which parser to use");class oy{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(ag,e=>{this._oncancel(e)}),this.setNotificationHandler(aC,e=>{this._onprogress(e)}),this.setRequestHandler(aR,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(aF,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new ol(k.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(aH,async(e,t)=>{let r=async()=>{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,s=this._requestResolvers.get(r);if(s)this._requestResolvers.delete(r),s("response"===e.type?t:new ol(t.error.code,t.error.message,t.error.data));else{let t="response"===e.type?"Response":"Error";this._onerror(Error(`${t} handler missing for request ${r}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(s,t.sessionId);if(!i)throw new ol(k.InvalidParams,`Task not found: ${s}`);if(!of(i.status))return await this._waitForTaskUpdate(s,t.signal),await r();if(of(i.status)){let e=await this._taskStore.getTaskResult(s,t.sessionId);return this._clearTaskQueue(s),{...e,_meta:{...e._meta,[i4]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(aB,async(e,t)=>{try{let{tasks:r,nextCursor:s}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:s,_meta:{}}}catch(e){throw new ol(k.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(aW,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new ol(k.InvalidParams,`Task not found: ${e.params.taskId}`);if(of(r.status))throw new ol(k.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 s=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!s)throw new ol(k.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...s}}catch(e){if(e instanceof ol)throw e;throw new ol(k.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;let t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:s})}_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),ol.fromError(k.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let s=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{if(s?.(e,t),ap(e)||af.safeParse(e).success)this._onresponse(e);else if(au(e))this._onrequest(e,t);else ac.safeParse(e).success?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;for(let e of(this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear(),this._requestHandlerAbortControllers.values()))e.abort();this._requestHandlerAbortControllers.clear();let t=ol.fromError(k.ConnectionClosed,"Connection closed");for(let r of(this._transport=void 0,this.onclose?.(),e.values()))r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let r,s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,a=e.params?._meta?.[i4]?.taskId;if(void 0===s){let t={jsonrpc:"2.0",id:e.id,error:{code:k.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:t,timestamp:Date.now()},i?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):i?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);let o=(r=e.params,ar.safeParse(r).success)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,u={signal:n.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(n.signal.aborted)return;let r={relatedRequestId:e.id};a&&(r.relatedTask={taskId:a}),await this.notification(t,r)},sendRequest:async(t,r,s)=>{if(n.signal.aborted)throw new ol(k.ConnectionClosed,"Request was cancelled");let i={...s,relatedRequestId:e.id};a&&!i.relatedTask&&(i.relatedTask={taskId:a});let o=i.relatedTask?.taskId??a;return o&&l&&await l.updateTaskStatus(o,"input_required"),await this.request(t,r,i)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:a,taskStore:l,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,u)).then(async t=>{if(n.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)},async t=>{if(n.signal.aborted)return;let r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:k.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:r,timestamp:Date.now()},i?.sessionId):await i?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,s=Number(t),i=this._progressHandlers.get(s);if(!i)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let a=this._responseHandlers.get(s),n=this._timeoutInfo.get(s);if(n&&a&&n.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(e){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),a(e);return}i(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r(ap(e)?e:new ol(e.error.code,e.error.message,e.error.data));return}let s=this._responseHandlers.get(t);if(void 0===s)return void this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(ap(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&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),s(ap(e)?e:ol.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async *requestStream(e,t,r){let s,{task:i}=r??{};if(!i){try{let s=await this.request(e,t,r);yield{type:"result",result:s}}catch(e){yield{type:"error",error:e instanceof ol?e:new ol(k.InternalError,String(e))}}return}try{let i=await this.request(e,aU,r);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new ol(k.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:s},r);if(yield{type:"taskStatus",task:e},of(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new ol(k.InternalError,`Task ${s} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new ol(k.InternalError,`Task ${s} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:s},t,r);yield{type:"result",result:e};return}let i=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,i)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof ol?e:new ol(k.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a,task:n,relatedTask:o}=r??{};return new Promise((l,u)=>{let c=e=>{u(e)};if(!this._transport)return void c(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),n&&this.assertTaskCapability(e.method)}catch(e){c(e);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:d};r?.onprogress&&(this._progressHandlers.set(d,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),n&&(p.params={...p.params,task:n}),o&&(p.params={...p.params,_meta:{...p.params?._meta||{},[i4]:o}});let f=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(e)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),u(e instanceof ol?e:new ol(k.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return u(e);try{let r=od(t,e.result);r.success?l(r.data):u(r.error)}catch(e){u(e)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let h=r?.timeout??6e4;this._setupTimeout(d,h,r?.maxTotalTimeout,()=>f(ol.fromError(k.RequestTimeout,"Request timed out",{timeout:h})),r?.resetTimeoutOnProgress??!1);let m=o?.taskId;if(m){let e=e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,e),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),u(e)})}else this._transport.send(p,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},aK,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},aG,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},aJ,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[i4]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[i4]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))});return}let s={...e,jsonrpc:"2.0"};t?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[i4]:t.relatedTask}}}),await this._transport.send(s,t)}setRequestHandler(e,t){let r=oh(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,s)=>Promise.resolve(t(om(e,r),s)))}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=oh(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(om(e,r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=this._options?.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&&au(r.message)){let t=r.message.id,s=this._requestResolvers.get(t);s?(s(new ol(k.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(t)):this._onerror(Error(`Resolver missing for request ${t} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,s)=>{if(t.aborted)return void s(new ol(k.InvalidRequest,"Request cancelled"));let i=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(i),s(new ol(k.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async s=>{if(!e)throw Error("No request provided");return await r.createTask(s,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let s=await r.getTask(e,t);if(!s)throw new ol(k.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(e,s,i)=>{await r.storeTaskResult(e,s,i,t);let a=await r.getTask(e,t);if(a){let t=aV.parse({method:"notifications/tasks/status",params:a});await this.notification(t),of(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,s,i)=>{let a=await r.getTask(e,t);if(!a)throw new ol(k.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(of(a.status))throw new ol(k.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,s,i,t);let n=await r.getTask(e,t);if(n){let t=aV.parse({method:"notifications/tasks/status",params:n});await this.notification(t),of(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function og(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var ov=i(8825),o_=i(1712);class ob{constructor(e){this._ajv=e??function(){let e=new ov({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return o_(e),e}()}getValidator(e){let t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class ow{constructor(e){this._client=e}async *callToolStream(e,t=nT,r){let s=this._client,i={...r,task:r?.task??(s.isToolTask(e.name)?{}:void 0)},a=s.requestStream({method:"tools/call",params:e},t,i),n=s.getToolOutputValidator(e.name);for await(let t of a){if("result"===t.type&&n){let r=t.result;if(!r.structuredContent&&!r.isError)return void(yield{type:"error",error:new ol(k.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)});if(r.structuredContent)try{let e=n(r.structuredContent);if(!e.valid)return void(yield{type:"error",error:new ol(k.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)})}catch(e){if(e instanceof ol)return void(yield{type:"error",error:e});yield{type:"error",error:new ol(k.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)};return}}yield t}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}class o$ extends oy{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new ob,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",nO,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",nw,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",nr,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new ow(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 s=t[e];if(void 0===s)continue;let i=r[e];og(i)&&og(s)?r[e]={...i,...s}:r[e]=s}return r}(this._capabilities,e)}setRequestHandler(e,t){let r,s=op(e),i=s?.method;if(!i)throw Error("Schema is missing a method literal");if(oc(i)){let e=i._zod?.def;r=e?.value??i.value}else{let e=i._def;r=e?.value??i.value}if("string"!=typeof r)throw Error("Schema method literal must be a string");let a=r;if("elicitation/create"===a){let r=async(e,r)=>{let s=od(n6,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new ol(k.InvalidParams,`Invalid elicitation request: ${e}`)}let{params:i}=s.data;i.mode=i.mode??"form";let{supportsFormMode:a,supportsUrlMode:n}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===i.mode&&!a)throw new ol(k.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===i.mode&&!n)throw new ol(k.InvalidParams,"Client does not support URL-mode elicitation requests");let o=await Promise.resolve(t(e,r));if(i.task){let e=od(aU,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new ol(k.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let l=od(n3,o);if(!l.success){let e=l.error instanceof Error?l.error.message:String(l.error);throw new ol(k.InvalidParams,`Invalid elicitation result: ${e}`)}let u=l.data,c="form"===i.mode?i.requestedSchema:void 0;if("form"===i.mode&&"accept"===u.action&&u.content&&c&&this._capabilities.elicitation?.form?.applyDefaults)try{!function e(t,r){if(t&&null!==r&&"object"==typeof r){if("object"===t.type&&t.properties&&"object"==typeof t.properties){let s=t.properties;for(let t of Object.keys(s)){let i=s[t];void 0===r[t]&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[t]=i.default),void 0!==r[t]&&e(i,r[t])}}if(Array.isArray(t.anyOf))for(let s of t.anyOf)"boolean"!=typeof s&&e(s,r);if(Array.isArray(t.oneOf))for(let s of t.oneOf)"boolean"!=typeof s&&e(s,r)}}(c,u.content)}catch{}return u};return super.setRequestHandler(e,r)}if("sampling/createMessage"===a){let r=async(e,r)=>{let s=od(nK,e);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new ol(k.InvalidParams,`Invalid sampling request: ${e}`)}let{params:i}=s.data,a=await Promise.resolve(t(e,r));if(i.task){let e=od(aU,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new ol(k.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=od(i.tools||i.toolChoice?nB:nH,a);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new ol(k.InvalidParams,`Invalid sampling result: ${e}`)}return n.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{let r=await this.request({method:"initialize",params:{protocolVersion:i2,capabilities:this._capabilities,clientInfo:this._clientInfo}},aO,t);if(void 0===r)throw Error(`Server sent invalid initialize result: ${r}`);if(!i9.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e&&!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t=this._serverCapabilities?.tasks?.requests,r="Server";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);if("tools/call"===e&&!t.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${e})`)}assertTaskHandlerCapability(e){if(this._capabilities){var t=this._capabilities.tasks?.requests,r="Client";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${e})`)}}}async ping(e){return this.request({method:"ping"},am,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},os,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},am,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},nb,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},nc,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},a5,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},a3,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},nt,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},am,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},am,t)}async callTool(e,t=nT,r){if(this.isToolTaskRequired(e.name))throw new ol(k.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let s=await this.request({method:"tools/call",params:e},t,r),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new ol(k.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{let e=i(s.structuredContent);if(!e.valid)throw new ol(k.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof ol)throw e;throw new ol(k.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return s}isToolTask(e){return!!this._serverCapabilities?.tasks?.requests?.tools?.call&&this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){for(let t of(this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear(),e)){if(t.outputSchema){let e=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}let e=t.execution?.taskSupport;("required"===e||"optional"===e)&&this._cachedKnownTaskTools.add(t.name),"required"===e&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},nS,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,s){let i=nj.safeParse(r);if(!i.success)throw Error(`Invalid ${e} listChanged options: ${i.error.message}`);if("function"!=typeof r.onChanged)throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:n}=i.data,{onChanged:o}=r,l=async()=>{if(!a)return void o(null,null);try{let e=await s();o(null,e)}catch(e){o(e instanceof Error?e:Error(String(e)),null)}},u=()=>{if(n){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let r=setTimeout(l,n);this._listChangedDebounceTimers.set(e,r)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}var ok=i(6507);let oE=require("node:process"),ox=require("node:stream");class oS{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,ah.parse(JSON.parse(e))}clear(){this._buffer=void 0}}let oT="win32"===oE.platform?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];class oP{constructor(e){this._readBuffer=new oS,this._stderrStream=null,this._serverParams=e,("pipe"===e.stderr||"overlapped"===e.stderr)&&(this._stderrStream=new ox.PassThrough)}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{this._process=ok(this._serverParams.command,this._serverParams.args??[],{env:{...function(){let e={};for(let t of oT){let r=oE.env[t];void 0!==r&&(r.startsWith("()")||(e[t]=r))}return e}(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:"win32"===oE.platform&&"type"in process,cwd:this._serverParams.cwd}),this._process.on("error",e=>{t(e),this.onerror?.(e)}),this._process.on("spawn",()=>{e()}),this._process.on("close",e=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",e=>{this.onerror?.(e)}),this._process.stdout?.on("data",e=>{this._readBuffer.append(e),this.processReadBuffer()}),this._process.stdout?.on("error",e=>{this.onerror?.(e)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise(t=>{e.once("close",()=>{t()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())]),null===e.exitCode){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise(e=>setTimeout(e,2e3).unref())])}if(null===e.exitCode)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(t=>{if(!this._process?.stdin)throw Error("Not connected");let r=JSON.stringify(e)+"\n";this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}}function oI(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}async function oO(e){return(await t).getRandomValues(new Uint8Array(e))}async function oj(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=256-256%t.length,s="";for(;s.length<e;)for(let i of(await oO(e-s.length)))i<r&&(s+=t[i%t.length]);return s}async function oR(e){return await oj(e)}async function oN(e){return btoa(String.fromCharCode(...new Uint8Array(await (await t).subtle.digest("SHA-256",new TextEncoder().encode(e))))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function oA(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await oR(e),r=await oN(t);return{code_verifier:t,code_challenge:r}}t=globalThis.crypto?.webcrypto??globalThis.crypto??Promise.resolve().then(i.t.bind(i,7598,19)).then(e=>e.webcrypto);let oC=s$(s6,void 0).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:"custom",message:"URL must be parseable",fatal:!0}),e5}).refine(e=>{let t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),oz=iI({resource:s0().url(),authorization_servers:iS(oC).optional(),jwks_uri:s0().url().optional(),scopes_supported:iS(s0()).optional(),bearer_methods_supported:iS(s0()).optional(),resource_signing_alg_values_supported:iS(s0()).optional(),resource_name:s0().optional(),resource_documentation:s0().optional(),resource_policy_uri:s0().url().optional(),resource_tos_uri:s0().url().optional(),tls_client_certificate_bound_access_tokens:iv().optional(),authorization_details_types_supported:iS(s0()).optional(),dpop_signing_alg_values_supported:iS(s0()).optional(),dpop_bound_access_tokens_required:iv().optional()}),oM=iI({issuer:s0(),authorization_endpoint:oC,token_endpoint:oC,registration_endpoint:oC.optional(),scopes_supported:iS(s0()).optional(),response_types_supported:iS(s0()),response_modes_supported:iS(s0()).optional(),grant_types_supported:iS(s0()).optional(),token_endpoint_auth_methods_supported:iS(s0()).optional(),token_endpoint_auth_signing_alg_values_supported:iS(s0()).optional(),service_documentation:oC.optional(),revocation_endpoint:oC.optional(),revocation_endpoint_auth_methods_supported:iS(s0()).optional(),revocation_endpoint_auth_signing_alg_values_supported:iS(s0()).optional(),introspection_endpoint:s0().optional(),introspection_endpoint_auth_methods_supported:iS(s0()).optional(),introspection_endpoint_auth_signing_alg_values_supported:iS(s0()).optional(),code_challenge_methods_supported:iS(s0()).optional(),client_id_metadata_document_supported:iv().optional()}),oD=iP({...iI({issuer:s0(),authorization_endpoint:oC,token_endpoint:oC,userinfo_endpoint:oC.optional(),jwks_uri:oC,registration_endpoint:oC.optional(),scopes_supported:iS(s0()).optional(),response_types_supported:iS(s0()),response_modes_supported:iS(s0()).optional(),grant_types_supported:iS(s0()).optional(),acr_values_supported:iS(s0()).optional(),subject_types_supported:iS(s0()),id_token_signing_alg_values_supported:iS(s0()),id_token_encryption_alg_values_supported:iS(s0()).optional(),id_token_encryption_enc_values_supported:iS(s0()).optional(),userinfo_signing_alg_values_supported:iS(s0()).optional(),userinfo_encryption_alg_values_supported:iS(s0()).optional(),userinfo_encryption_enc_values_supported:iS(s0()).optional(),request_object_signing_alg_values_supported:iS(s0()).optional(),request_object_encryption_alg_values_supported:iS(s0()).optional(),request_object_encryption_enc_values_supported:iS(s0()).optional(),token_endpoint_auth_methods_supported:iS(s0()).optional(),token_endpoint_auth_signing_alg_values_supported:iS(s0()).optional(),display_values_supported:iS(s0()).optional(),claim_types_supported:iS(s0()).optional(),claims_supported:iS(s0()).optional(),service_documentation:s0().optional(),claims_locales_supported:iS(s0()).optional(),ui_locales_supported:iS(s0()).optional(),claims_parameter_supported:iv().optional(),request_parameter_supported:iv().optional(),request_uri_parameter_supported:iv().optional(),require_request_uri_registration:iv().optional(),op_policy_uri:oC.optional(),op_tos_uri:oC.optional(),client_id_metadata_document_supported:iv().optional()}).shape,...oM.pick({code_challenge_methods_supported:!0}).shape}),oL=iP({access_token:s0(),id_token:s0().optional(),token_type:s0(),expires_in:new ip({type:"number",coerce:!0,checks:[],...t_(void 0)}).optional(),scope:s0().optional(),refresh_token:s0().optional()}).strip(),oq=iP({error:s0(),error_description:s0().optional(),error_uri:s0().optional()}),oU=oC.optional().or(iU("").transform(()=>void 0)),oZ=iP({redirect_uris:iS(oC),token_endpoint_auth_method:s0().optional(),grant_types:iS(s0()).optional(),response_types:iS(s0()).optional(),client_name:s0().optional(),client_uri:oC.optional(),logo_uri:oU,scope:s0().optional(),contacts:iS(s0()).optional(),tos_uri:oU,policy_uri:s0().optional(),jwks_uri:oC.optional(),jwks:new iw({type:"any"}).optional(),software_id:s0().optional(),software_version:s0().optional(),software_statement:s0().optional()}).strip(),oV=iP({client_id:s0(),client_secret:s0().optional(),client_id_issued_at:ih().optional(),client_secret_expires_at:ih().optional()}).strip(),oF=oZ.merge(oV);iP({error:s0(),error_description:s0().optional()}).strip(),iP({token:s0(),token_type_hint:s0().optional()}).strip();class oK extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class oH extends oK{}oH.errorCode="invalid_request";class oB extends oK{}oB.errorCode="invalid_client";class oG extends oK{}oG.errorCode="invalid_grant";class oW extends oK{}oW.errorCode="unauthorized_client";class oJ extends oK{}oJ.errorCode="unsupported_grant_type";class oX extends oK{}oX.errorCode="invalid_scope";class oY extends oK{}oY.errorCode="access_denied";class oQ extends oK{}oQ.errorCode="server_error";class o0 extends oK{}o0.errorCode="temporarily_unavailable";class o1 extends oK{}o1.errorCode="unsupported_response_type";class o2 extends oK{}o2.errorCode="unsupported_token_type";class o9 extends oK{}o9.errorCode="invalid_token";class o4 extends oK{}o4.errorCode="method_not_allowed";class o6 extends oK{}o6.errorCode="too_many_requests";class o5 extends oK{}o5.errorCode="invalid_client_metadata";class o8 extends oK{}o8.errorCode="insufficient_scope";class o3 extends oK{}o3.errorCode="invalid_target";let o7={[oH.errorCode]:oH,[oB.errorCode]:oB,[oG.errorCode]:oG,[oW.errorCode]:oW,[oJ.errorCode]:oJ,[oX.errorCode]:oX,[oY.errorCode]:oY,[oQ.errorCode]:oQ,[o0.errorCode]:o0,[o1.errorCode]:o1,[o2.errorCode]:o2,[o9.errorCode]:o9,[o4.errorCode]:o4,[o6.errorCode]:o6,[o5.errorCode]:o5,[o8.errorCode]:o8,[o3.errorCode]:o3};class le extends Error{constructor(e){super(e??"Unauthorized")}}let lt="code",lr="S256";async function ls(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:s}=oq.parse(JSON.parse(r));return new(o7[e]||oQ)(t||"",s)}catch(e){return new oQ(`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${e}. Raw body: ${r}`)}}async function li(e,t){try{return await la(e,t)}catch(r){if(r instanceof oB||r instanceof oW)return await e.invalidateCredentials?.("all"),await la(e,t);if(r instanceof oG)return await e.invalidateCredentials?.("tokens"),await la(e,t);throw r}}async function la(e,{serverUrl:t,authorizationCode:r,scope:s,resourceMetadataUrl:i,fetchFn:a}){let n,o;try{(n=await lu(t,{resourceMetadataUrl:i},a)).authorization_servers&&n.authorization_servers.length>0&&(o=n.authorization_servers[0])}catch{}o||(o=new URL("/",t));let l=await ln(t,e,n),u=await lf(o,{fetchFn:a}),c=await Promise.resolve(e.clientInformation());if(!c){if(void 0!==r)throw Error("Existing OAuth client information is required when exchanging an authorization code");let t=u?.client_id_metadata_document_supported===!0,s=e.clientMetadataUrl;if(s&&!function(e){if(!e)return!1;try{let t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(s))throw new o5(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${s}`);if(t&&s)c={client_id:s},await e.saveClientInformation?.(c);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let t=await lv(o,{metadata:u,clientMetadata:e.clientMetadata,fetchFn:a});await e.saveClientInformation(t),c=t}}let d=!e.redirectUrl;if(void 0!==r||d){let t=await lg(e,o,{metadata:u,resource:l,authorizationCode:r,fetchFn:a});return await e.saveTokens(t),"AUTHORIZED"}let p=await e.tokens();if(p?.refresh_token)try{let t=await ly(o,{metadata:u,clientInformation:c,refreshToken:p.refresh_token,resource:l,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),"AUTHORIZED"}catch(e){if(!(e instanceof oK)||e instanceof oQ);else throw e}let f=e.state?await e.state():void 0,{authorizationUrl:h,codeVerifier:m}=await lh(o,{metadata:u,clientInformation:c,state:f,redirectUrl:e.redirectUrl,scope:s||n?.scopes_supported?.join(" ")||e.clientMetadata.scope,resource:l});return await e.saveCodeVerifier(m),await e.redirectToAuthorization(h),"REDIRECT"}async function ln(e,t,r){let s,i=((s=new URL("string"==typeof e?e:e.href)).hash="",s);if(t.validateResourceURL)return await t.validateResourceURL(i,r?.resource);if(r){if(!function({requestedResource:e,configuredResource:t}){let r=new URL("string"==typeof e?e:e.href),s=new URL("string"==typeof t?t:t.href);if(r.origin!==s.origin||r.pathname.length<s.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return i.startsWith(a)}({requestedResource:i,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${i} (or origin)`);return new URL(r.resource)}}function lo(e){let t,r=e.headers.get("WWW-Authenticate");if(!r)return{};let[s,i]=r.split(" ");if("bearer"!==s.toLowerCase()||!i)return{};let a=ll(e,"resource_metadata")||void 0;if(a)try{t=new URL(a)}catch{}return{resourceMetadataUrl:t,scope:ll(e,"scope")||void 0,error:ll(e,"error")||void 0}}function ll(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let s=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=r.match(s);return i?i[1]||i[2]:null}async function lu(e,t,r=fetch){let s=await lp(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s||404===s.status)throw await s?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await s.body?.cancel(),Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return oz.parse(await s.json())}async function lc(e,t,r=fetch){try{return await r(e,{headers:t})}catch(s){if(s instanceof TypeError)if(t)return lc(e,void 0,r);else return;throw s}}async function ld(e,t,r=fetch){return await lc(e,{"MCP-Protocol-Version":t},r)}async function lp(e,t,r,s){var i,a;let n,o=new URL(e),l=s?.protocolVersion??i2;s?.metadataUrl?n=new URL(s.metadataUrl):(n=new URL(function(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,o.pathname),s?.metadataServerUrl??o)).search=o.search;let u=await ld(n,l,r);if(!s?.metadataUrl&&(i=u,a=o.pathname,!i||i.status>=400&&i.status<500&&"/"!==a)){let e=new URL(`/.well-known/${t}`,o);u=await ld(e,l,r)}return u}async function lf(e,{fetchFn:t=fetch,protocolVersion:r=i2}={}){let s={"MCP-Protocol-Version":r,Accept:"application/json"};for(let{url:r,type:i}of function(e){let t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,s=[];if(!r)return s.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),s;let i=t.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:"oidc"}),s.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:"oidc"}),s}(e)){let e=await lc(r,s,t);if(e){if(!e.ok){if(await e.body?.cancel(),e.status>=400&&e.status<500)continue;throw Error(`HTTP ${e.status} trying to load ${"oauth"===i?"OAuth":"OpenID provider"} metadata from ${r}`)}if("oauth"===i)return oM.parse(await e.json());return oD.parse(await e.json())}}}async function lh(e,{metadata:t,clientInformation:r,redirectUrl:s,scope:i,state:a,resource:n}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(lt))throw Error(`Incompatible auth server: does not support response type ${lt}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(lr))throw Error(`Incompatible auth server: does not support code challenge method ${lr}`)}else o=new URL("/authorize",e);let l=await oA(),u=l.code_verifier,c=l.code_challenge;return o.searchParams.set("response_type",lt),o.searchParams.set("client_id",r.client_id),o.searchParams.set("code_challenge",c),o.searchParams.set("code_challenge_method",lr),o.searchParams.set("redirect_uri",String(s)),a&&o.searchParams.set("state",a),i&&o.searchParams.set("scope",i),i?.includes("offline_access")&&o.searchParams.append("prompt","consent"),n&&o.searchParams.set("resource",n.href),{authorizationUrl:o,codeVerifier:u}}async function lm(e,{metadata:t,tokenRequestParams:r,clientInformation:s,addClientAuthentication:i,resource:a,fetchFn:n}){var o,l;let u,c=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});a&&r.set("resource",a.href),i?await i(d,r,c,t):s&&function(e,t,r,s){let{client_id:i,client_secret:a}=t;switch(e){case"client_secret_basic":var n,o,l,u,c=i,d=a,p=r;if(!d)throw Error("client_secret_basic authentication requires a client_secret");let f=btoa(`${c}:${d}`);p.set("Authorization",`Basic ${f}`);return;case"client_secret_post":n=i,o=a,(l=s).set("client_id",n),o&&l.set("client_secret",o);return;case"none":u=i,s.set("client_id",u);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}((o=s,l=t?.token_endpoint_auth_methods_supported??[],u=void 0!==o.client_secret,0===l.length?u?"client_secret_post":"none":"token_endpoint_auth_method"in o&&o.token_endpoint_auth_method&&["client_secret_basic","client_secret_post","none"].includes(o.token_endpoint_auth_method)&&l.includes(o.token_endpoint_auth_method)?o.token_endpoint_auth_method:u&&l.includes("client_secret_basic")?"client_secret_basic":u&&l.includes("client_secret_post")?"client_secret_post":l.includes("none")?"none":u?"client_secret_post":"none"),s,d,r);let p=await (n??fetch)(c,{method:"POST",headers:d,body:r});if(!p.ok)throw await ls(p);return oL.parse(await p.json())}async function ly(e,{metadata:t,clientInformation:r,refreshToken:s,resource:i,addClientAuthentication:a,fetchFn:n}){let o=new URLSearchParams({grant_type:"refresh_token",refresh_token:s});return{refresh_token:s,...await lm(e,{metadata:t,tokenRequestParams:o,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:n})}}async function lg(e,t,{metadata:r,resource:s,authorizationCode:i,fetchFn:a}={}){let n,o=e.clientMetadata.scope;if(e.prepareTokenRequest&&(n=await e.prepareTokenRequest(o)),!n){if(!i)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");n=new URLSearchParams({grant_type:"authorization_code",code:i,code_verifier:await e.codeVerifier(),redirect_uri:String(e.redirectUrl)})}return lm(t,{metadata:r,tokenRequestParams:n,clientInformation:await e.clientInformation()??void 0,addClientAuthentication:e.addClientAuthentication,resource:s,fetchFn:a})}async function lv(e,{metadata:t,clientMetadata:r,fetchFn:s}){let i;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);let a=await (s??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await ls(a);return oF.parse(await a.json())}class l_ extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function lb(e){}class lw extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let s;super({start(i){s=function(e){if("function"==typeof e)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=lb,onError:r=lb,onRetry:s=lb,onComment:i}=e,a="",n=!0,o,l="",u="";function c(e){if(""===e)return void(l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(`
25
25
  `)?l.slice(0,-1):l}),o=void 0,l="",u="");if(e.startsWith(":")){i&&i(e.slice(e.startsWith(": ")?2:1));return}let r=e.indexOf(":");if(-1!==r){let t=e.slice(0,r),s=" "===e[r+1]?2:1;d(t,e.slice(r+s),e);return}d(e,"",e)}function d(e,t,i){switch(e){case"event":u=t;break;case"data":l=`${l}${t}
26
26
  `;break;case"id":o=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?s(parseInt(t,10)):r(new l_(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:i}));break;default:r(new l_(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:"unknown-field",field:e,value:t,line:i}))}}return{feed:function(e){let t=n?e.replace(/^\xEF\xBB\xBF/,""):e,[r,s]=function(e){let t=[],r="",s=0;for(;s<e.length;){let i=e.indexOf("\r",s),a=e.indexOf(`
27
27
  `,s),n=-1;if(-1!==i&&-1!==a?n=Math.min(i,a):-1!==i?n=i===e.length-1?-1:i:-1!==a&&(n=a),-1===n){r=e.slice(s);break}{let r=e.slice(s,n);t.push(r),"\r"===e[(s=n+1)-1]&&e[s]===`
28
- `&&s++}}return[t,r]}(`${a}${t}`);for(let e of r)c(e);a=s,n=!1},reset:function(e={}){a&&e.consume&&c(a),n=!0,o=void 0,l="",u="",a=""}}}({onEvent:e=>{i.enqueue(e)},onError(t){"terminate"===e?i.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){s.feed(e)}})}}let l$={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class lk extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}class lE{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=function(e=fetch,t){return t?async(r,s)=>e(r,{...t,...s,headers:s?.headers?{...oI(t.headers),...oI(s.headers)}:t.headers}):e}(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??l$}async _authThenStart(){let e;if(!this._authProvider)throw new le("No auth provider");try{e=await li(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if("AUTHORIZED"!==e)throw new le;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let t=oI(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();r.set("Accept","text/event-stream"),t&&r.set("last-event-id",t);let s=await (this._fetch??fetch)(this._url,{method:"GET",headers:r,signal:this._abortController?.signal});if(!s.ok){if(await s.body?.cancel(),401===s.status&&this._authProvider)return await this._authThenStart();if(405===s.status)return;throw new lk(s.status,`Failed to open SSE stream: ${s.statusText}`)}this._handleSseStream(s.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r)return void this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));let s=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(r=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`)),this._scheduleReconnection(e,t+1)})},s)}_handleSseStream(e,t,r){let s;if(!e)return;let{onresumptiontoken:i,replayMessageId:a}=t,n=!1,o=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new lw({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:r}=await t.read();if(r)break;if((e.id&&(s=e.id,n=!0,i?.(e.id)),e.data)&&(!e.event||"message"===e.event))try{let t=ag.parse(JSON.parse(e.data));am(t)&&(o=!0,void 0!==a&&(t.id=a)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||n)&&!o&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:a},0)}catch(e){if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(r||n)&&!o&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:a},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new le("No auth provider");if("AUTHORIZED"!==await li(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new le("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:s}=t||{};if(r)return void this._startOrAuthSse({resumptionToken:r,replayMessageId:ap(e)?e.id:void 0}).catch(e=>this.onerror?.(e));let i=await this._commonHeaders();i.set("content-type","application/json"),i.set("accept","application/json, text/event-stream");let a={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:this._abortController?.signal},n=await (this._fetch??fetch)(this._url,a),o=n.headers.get("mcp-session-id");if(o&&(this._sessionId=o),!n.ok){let t=await n.text().catch(()=>null);if(401===n.status&&this._authProvider){if(this._hasCompletedAuthFlow)throw new lk(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:t,scope:r}=lo(n);this._resourceMetadataUrl=t,this._scope=r;let s=await li(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==s)throw new le;return this._hasCompletedAuthFlow=!0,this.send(e)}if(403===n.status&&this._authProvider){let{resourceMetadataUrl:t,scope:r,error:s}=lo(n);if("insufficient_scope"===s){let s=n.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===s)throw new lk(403,"Server returned 403 after trying upscoping");r&&(this._scope=r),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=s??void 0;let i=await li(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch});if("AUTHORIZED"!==i)throw new le;return this.send(e)}}throw new lk(n.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,202===n.status){await n.body?.cancel(),aA.safeParse(e).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let l=(Array.isArray(e)?e:[e]).filter(e=>"method"in e&&"id"in e&&void 0!==e.id).length>0,u=n.headers.get("content-type");if(l)if(u?.includes("text/event-stream"))this._handleSseStream(n.body,{onresumptiontoken:s},!1);else if(u?.includes("application/json")){let e=await n.json();for(let t of Array.isArray(e)?e.map(e=>ag.parse(e)):[ag.parse(e)])this.onmessage?.(t)}else throw await n.body?.cancel(),new lk(-1,`Unexpected content type: ${u}`);else await n.body?.cancel()}catch(e){throw this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await (this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&405!==r.status)throw new lk(r.status,`Failed to terminate session: ${r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}let lx=e=>"env"in e&&"string"==typeof e.env,lS=e=>{let t={};return e.forEach(e=>{let r=e.name.trim();if(lx(e)){let s=process.env[e.env];if(void 0===s)throw Error(`Environment variable "${e.env}" is not set (required for header "${r}")`);t[r]=s}else t[r]=e.value.trim()}),t},lT=i(8330),lP={name:lT.name,version:lT.version},lI={capabilities:{sampling:{},elicitation:{},roots:{listChanged:!0}}};async function lO({url:e,headers:t}){let r=new o$(lP,lI),s=t?lS(t):{},i=new lE(new URL(e),{...t?{requestInit:{headers:s}}:{},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});return await r.connect(i),r}async function lj(e){let{onStderrData:t,...r}=e,s=new o$(lP,lI),i=new oP({...r,stderr:r.stderr??"pipe"}),a=i.stderr;if(a){let e=t??(e=>{console.error(`[STDIO MCP Server stderr]: ${e}`)});a.on("data",e)}return await s.connect(i),{client:s,transport:i}}async function lR(e){try{return(await e.client.listTools()).tools.map(e=>e.name)}catch(e){return console.error("Failed to list stdio MCP tools:",e),[]}}async function lN(e,t,r){try{return await e.client.callTool({name:t,arguments:r})}catch(e){throw console.error(`Failed to call stdio MCP tool "${t}":`,e),e}}async function lA(e){try{await e.transport.close(),await e.client.close()}catch(e){throw console.error("Error disconnecting from stdio MCP server:",e),e}}function lC(e){if(e?.body===void 0||null===e.body)return[];let t=Array.isArray(e.body)?e.body:[e.body],r=[];for(let e of t)if("object"==typeof e&&null!==e&&"method"in e&&"tools/call"===e.method){let t=e.params;t&&"object"==typeof t&&"name"in t&&"string"==typeof t.name&&r.push(t.name)}return r}x().config()})(),a})());
28
+ `&&s++}}return[t,r]}(`${a}${t}`);for(let e of r)c(e);a=s,n=!1},reset:function(e={}){a&&e.consume&&c(a),n=!0,o=void 0,l="",u="",a=""}}}({onEvent:e=>{i.enqueue(e)},onError(t){"terminate"===e?i.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){s.feed(e)}})}}let l$={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class lk extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}class lE{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=function(e=fetch,t){return t?async(r,s)=>e(r,{...t,...s,headers:s?.headers?{...oI(t.headers),...oI(s.headers)}:t.headers}):e}(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??l$}async _authThenStart(){let e;if(!this._authProvider)throw new le("No auth provider");try{e=await li(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if("AUTHORIZED"!==e)throw new le;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let t=oI(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();r.set("Accept","text/event-stream"),t&&r.set("last-event-id",t);let s=await (this._fetch??fetch)(this._url,{method:"GET",headers:r,signal:this._abortController?.signal});if(!s.ok){if(await s.body?.cancel(),401===s.status&&this._authProvider)return await this._authThenStart();if(405===s.status)return;throw new lk(s.status,`Failed to open SSE stream: ${s.statusText}`)}this._handleSseStream(s.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){return void 0!==this._serverRetryMs?this._serverRetryMs:Math.min(this._reconnectionOptions.initialReconnectionDelay*Math.pow(this._reconnectionOptions.reconnectionDelayGrowFactor,e),this._reconnectionOptions.maxReconnectionDelay)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r)return void this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));let s=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(r=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`)),this._scheduleReconnection(e,t+1)})},s)}_handleSseStream(e,t,r){let s;if(!e)return;let{onresumptiontoken:i,replayMessageId:a}=t,n=!1,o=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new lw({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:r}=await t.read();if(r)break;if((e.id&&(s=e.id,n=!0,i?.(e.id)),e.data)&&(!e.event||"message"===e.event))try{let t=ah.parse(JSON.parse(e.data));ap(t)&&(o=!0,void 0!==a&&(t.id=a)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||n)&&!o&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:a},0)}catch(e){if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(r||n)&&!o&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:a},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new le("No auth provider");if("AUTHORIZED"!==await li(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new le("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:s}=t||{};if(r)return void this._startOrAuthSse({resumptionToken:r,replayMessageId:au(e)?e.id:void 0}).catch(e=>this.onerror?.(e));let i=await this._commonHeaders();i.set("content-type","application/json"),i.set("accept","application/json, text/event-stream");let a={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:this._abortController?.signal},n=await (this._fetch??fetch)(this._url,a),o=n.headers.get("mcp-session-id");if(o&&(this._sessionId=o),!n.ok){let t=await n.text().catch(()=>null);if(401===n.status&&this._authProvider){if(this._hasCompletedAuthFlow)throw new lk(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:t,scope:r}=lo(n);this._resourceMetadataUrl=t,this._scope=r;let s=await li(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit});if("AUTHORIZED"!==s)throw new le;return this._hasCompletedAuthFlow=!0,this.send(e)}if(403===n.status&&this._authProvider){let{resourceMetadataUrl:t,scope:r,error:s}=lo(n);if("insufficient_scope"===s){let s=n.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===s)throw new lk(403,"Server returned 403 after trying upscoping");r&&(this._scope=r),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=s??void 0;let i=await li(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch});if("AUTHORIZED"!==i)throw new le;return this.send(e)}}throw new lk(n.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,202===n.status){await n.body?.cancel(),aj.safeParse(e).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let l=(Array.isArray(e)?e:[e]).filter(e=>"method"in e&&"id"in e&&void 0!==e.id).length>0,u=n.headers.get("content-type");if(l)if(u?.includes("text/event-stream"))this._handleSseStream(n.body,{onresumptiontoken:s},!1);else if(u?.includes("application/json")){let e=await n.json();for(let t of Array.isArray(e)?e.map(e=>ah.parse(e)):[ah.parse(e)])this.onmessage?.(t)}else throw await n.body?.cancel(),new lk(-1,`Unexpected content type: ${u}`);else await n.body?.cancel()}catch(e){throw this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await (this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&405!==r.status)throw new lk(r.status,`Failed to terminate session: ${r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}let lx=e=>"env"in e&&"string"==typeof e.env,lS=e=>{let t={};return e.forEach(e=>{let r=e.name.trim();if(lx(e)){let s=process.env[e.env];if(void 0===s)throw Error(`Environment variable "${e.env}" is not set (required for header "${r}")`);t[r]=s}else t[r]=e.value.trim()}),t},lT=i(8330),lP={name:lT.name,version:lT.version},lI={capabilities:{sampling:{},elicitation:{form:{},url:{}},roots:{listChanged:!0}}};async function lO({url:e,headers:t}){let r=new o$(lP,lI),s=t?lS(t):{},i=new lE(new URL(e),{...t?{requestInit:{headers:s}}:{},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});return await r.connect(i),r}async function lj(e){let{onStderrData:t,...r}=e,s=new o$(lP,lI),i=new oP({...r,stderr:r.stderr??"pipe"}),a=i.stderr;if(a){let e=t??(e=>{console.error(`[STDIO MCP Server stderr]: ${e}`)});a.on("data",e)}return await s.connect(i),{client:s,transport:i}}async function lR(e){try{return(await e.client.listTools()).tools.map(e=>e.name)}catch(e){return console.error("Failed to list stdio MCP tools:",e),[]}}async function lN(e,t,r){try{return await e.client.callTool({name:t,arguments:r})}catch(e){throw console.error(`Failed to call stdio MCP tool "${t}":`,e),e}}async function lA(e){try{await e.transport.close(),await e.client.close()}catch(e){throw console.error("Error disconnecting from stdio MCP server:",e),e}}function lC(e){if(e?.body===void 0||null===e.body)return[];let t=Array.isArray(e.body)?e.body:[e.body],r=[];for(let e of t)if("object"==typeof e&&null!==e&&"method"in e&&"tools/call"===e.method){let t=e.params;t&&"object"==typeof t&&"name"in t&&"string"==typeof t.name&&r.push(t.name)}return r}x().config()})(),a})());