@jsrepo/mcp 0.0.16 → 0.0.18

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 (2) hide show
  1. package/dist/index.mjs +17 -17
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import e from"node:process";import{RegistryItemNotFoundError as t,getPathsForItems as n,normalizeItemTypeForPath as r,prepareUpdates as i,promptAddEnvVars as a,resolveAndFetchAllItems as o,updateFiles as s}from"jsrepo";import{loadConfigSearch as c}from"jsrepo/config";import{DEFAULT_PROVIDERS as l}from"jsrepo/providers";import{parseWantedItems as u,promptInstallDependenciesByEcosystem as d,resolveRegistries as f,resolveWantedItems as p}from"jsrepo/utils";import{AsyncLocalStorage as m}from"node:async_hooks";var h=Object.create,ee=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,v=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty,y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),b=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_(t),a=0,o=i.length,s;a<o;a++)s=i[a],!te.call(e,s)&&s!==n&&ee(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=g(t,s))||r.enumerable});return e},x=(e,t,n)=>(n=e==null?{}:h(v(e)),b(t||!e||!e.__esModule?ee(n,`default`,{value:e,enumerable:!0}):n,e)),ne=class{#e;#t=new Set;#n={};#r={resource:[]};constructor(t){this.#e=t,this.#t.add(this.#e.on(`initialize`,({capabilities:t,clientInfo:n})=>{this.#n.clientCapabilities=t,this.#n.clientInfo=n,this.#t.add(this.#e.on(`send`,({request:t})=>{e.stdout.write(JSON.stringify(t)+`
2
+ import e from"node:process";import{RegistryItemNotFoundError as t,getPathsForItems as n,normalizeItemTypeForPath as r,prepareUpdates as i,promptAddEnvVars as a,resolveAndFetchAllItems as o,updateFiles as s}from"jsrepo";import{loadConfigSearch as c}from"jsrepo/config";import{DEFAULT_PROVIDERS as l}from"jsrepo/providers";import{parseWantedItems as u,promptInstallDependenciesByEcosystem as d,resolveRegistries as f,resolveWantedItems as p,resolveWithRoles as m}from"jsrepo/utils";import{AsyncLocalStorage as h}from"node:async_hooks";var g=Object.create,_=Object.defineProperty,v=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,b=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),C=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=y(t),a=0,o=i.length,s;a<o;a++)s=i[a],!x.call(e,s)&&s!==n&&_(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=v(t,s))||r.enumerable});return e},w=(e,t,n)=>(n=e==null?{}:g(b(e)),C(t||!e||!e.__esModule?_(n,`default`,{value:e,enumerable:!0}):n,e)),T=class{#e;#t=new Set;#n={};#r={resource:[]};constructor(t){this.#e=t,this.#t.add(this.#e.on(`initialize`,({capabilities:t,clientInfo:n})=>{this.#n.clientCapabilities=t,this.#n.clientInfo=n,this.#t.add(this.#e.on(`send`,({request:t})=>{e.stdout.write(JSON.stringify(t)+`
3
3
  `)})),this.#t.add(this.#e.on(`broadcast`,({request:t})=>{t.method===`notifications/resources/updated`&&!this.#r.resource.includes(t.params.uri)||e.stdout.write(JSON.stringify(t)+`
4
4
  `)})),this.#t.add(this.#e.on(`loglevelchange`,({level:e})=>{this.#n.logLevel=e})),this.#t.add(this.#e.on(`subscription`,({uri:e,action:t})=>{this.#r??={resource:[]},t===`remove`?this.#r.resource=this.#r.resource?.filter(t=>t!==e):this.#r.resource?.push(e)}))}))}#i(){for(let e of this.#t)e();e.exit(0)}listen(t){e.stdin.setEncoding(`utf8`);let n=``;e.stdin.on(`data`,async r=>{n+=r;let i=n.split(`
5
5
  `);n=i.pop()||``;for(let n of i)if(n.trim())try{let r=JSON.parse(n),i=await this.#e.receive(r,{custom:t,sessionInfo:this.#n});i&&e.stdout.write(JSON.stringify(i)+`
6
- `)}catch{}}),e.stdin.on(`end`,()=>{this.#i()}),e.on(`SIGINT`,()=>{this.#i()}),e.on(`SIGTERM`,()=>{this.#i()})}},S=x(y(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}))(),1),C=class{toJsonSchema(e){throw Error(`toJsonSchema method not implemented`)}};Object.freeze({status:`aborted`});function w(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var T=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},re=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const ie={};function E(e){return e&&Object.assign(ie,e),ie}function ae(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function D(e,t){return typeof t==`bigint`?t.toString():t}function oe(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function O(e){return e==null}function se(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ce(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const k=Symbol(`evaluating`);function A(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==k)return r===void 0&&(r=k,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function le(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function j(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function M(e){return JSON.stringify(e)}function ue(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const de=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const pe=oe(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function me(e){if(fe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(fe(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function he(e){return me(e)?{...e}:Array.isArray(e)?[...e]:e}const ge=new Set([`string`,`number`,`symbol`]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ve(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ye(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const be={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function xe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ve(e,j(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return le(this,`shape`,e),e},checks:[]}))}function Se(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ve(e,j(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return le(this,`shape`,r),r},checks:[]}))}function Ce(e,t){if(!me(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ve(e,j(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return le(this,`shape`,n),n}}))}function we(e,t){if(!me(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ve(e,j(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return le(this,`shape`,n),n}}))}function Te(e,t){return ve(e,j(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return le(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Ee(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return ve(t,j(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return le(this,`shape`,i),i},checks:[]}))}function De(e,t,n){return ve(t,j(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return le(this,`shape`,i),i}}))}function Oe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ke(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ae(e){return typeof e==`string`?e:e?.message}function je(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Ae(e.inst?._zod.def?.error?.(e))??Ae(t?.error?.(e))??Ae(n.customError?.(e))??Ae(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Me(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ne(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const Pe=(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,D,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Fe=w(`$ZodError`,Pe),Ie=w(`$ZodError`,Pe,{Parent:Error});function Le(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Re(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}const ze=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new T;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>je(e,a,E())));throw de(t,i?.callee),t}return o.value},Be=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>je(e,a,E())));throw de(t,i?.callee),t}return o.value},Ve=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new T;return a.issues.length?{success:!1,error:new(e??Fe)(a.issues.map(e=>je(e,i,E())))}:{success:!0,data:a.value}},He=Ve(Ie),Ue=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>je(e,i,E())))}:{success:!0,data:a.value}},We=Ue(Ie),Ge=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ze(e)(t,n,i)},Ke=e=>(t,n,r)=>ze(e)(t,n,r),qe=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Be(e)(t,n,i)},Je=e=>async(t,n,r)=>Be(e)(t,n,r),Ye=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ve(e)(t,n,i)},Xe=e=>(t,n,r)=>Ve(e)(t,n,r),Ze=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ue(e)(t,n,i)},Qe=e=>async(t,n,r)=>Ue(e)(t,n,r),$e=/^[cC][^\s-]{8,}$/,et=/^[0-9a-z]+$/,tt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nt=/^[0-9a-vA-V]{20}$/,rt=/^[A-Za-z0-9]{27}$/,it=/^[a-zA-Z0-9_-]{21}$/,at=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ot=/^([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})$/,st=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)$/,ct=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function lt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const ut=/^(?:(?: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])$/,dt=/^(([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}|:))$/,ft=/^((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])$/,pt=/^(([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])$/,mt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ht=/^[A-Za-z0-9_-]*$/,gt=/^\+[1-9]\d{6,14}$/,_t=`(?:(?:\\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])))`,vt=RegExp(`^${_t}$`);function yt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function bt(e){return RegExp(`^${yt(e)}$`)}function xt(e){let t=yt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${_t}T(?:${r})$`)}const St=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ct=/^-?\d+$/,wt=/^-?\d+(?:\.\d+)?$/,Tt=/^(?:true|false)$/i,Et=/^[^A-Z]*$/,Dt=/^[^a-z]*$/,P=w(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ot={number:`number`,bigint:`bigint`,object:`date`},kt=w(`$ZodCheckLessThan`,(e,t)=>{P.init(e,t);let n=Ot[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),At=w(`$ZodCheckGreaterThan`,(e,t)=>{P.init(e,t);let n=Ot[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jt=w(`$ZodCheckMultipleOf`,(e,t)=>{P.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ce(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Mt=w(`$ZodCheckNumberFormat`,(e,t)=>{P.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=be[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ct)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Nt=w(`$ZodCheckMaxLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!O(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Me(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pt=w(`$ZodCheckMinLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!O(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Me(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ft=w(`$ZodCheckLengthEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!O(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Me(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),It=w(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Lt=w(`$ZodCheckRegex`,(e,t)=>{It.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Rt=w(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Et,It.init(e,t)}),zt=w(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Dt,It.init(e,t)}),Bt=w(`$ZodCheckIncludes`,(e,t)=>{P.init(e,t);let n=_e(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Vt=w(`$ZodCheckStartsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`^${_e(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ht=w(`$ZodCheckEndsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`.*${_e(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ut=w(`$ZodCheckOverwrite`,(e,t)=>{P.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Wt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
6
+ `)}catch{}}),e.stdin.on(`end`,()=>{this.#i()}),e.on(`SIGINT`,()=>{this.#i()}),e.on(`SIGTERM`,()=>{this.#i()})}},E=w(S(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}))(),1),D=class{toJsonSchema(e){throw Error(`toJsonSchema method not implemented`)}};Object.freeze({status:`aborted`});function O(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var k=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ee=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const te={};function A(e){return e&&Object.assign(te,e),te}function j(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ne(e,t){return typeof t==`bigint`?t.toString():t}function M(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function re(e){return e==null}function ie(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function N(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const ae=Symbol(`evaluating`);function P(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ae)return r===void 0&&(r=ae,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function F(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function I(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function oe(e){return JSON.stringify(e)}function se(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const ce=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function le(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ue=M(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function de(e){if(le(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(le(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function fe(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e}const pe=new Set([`string`,`number`,`symbol`]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function he(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const _e={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ve(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return he(e,I(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return F(this,`shape`,e),e},checks:[]}))}function ye(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return he(e,I(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return F(this,`shape`,r),r},checks:[]}))}function be(e,t){if(!de(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return he(e,I(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return F(this,`shape`,n),n}}))}function xe(e,t){if(!de(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return he(e,I(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return F(this,`shape`,n),n}}))}function Se(e,t){return he(e,I(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return F(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Ce(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return he(t,I(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return F(this,`shape`,i),i},checks:[]}))}function we(e,t,n){return he(t,I(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return F(this,`shape`,i),i}}))}function Te(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ee(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function De(e){return typeof e==`string`?e:e?.message}function Oe(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=De(e.inst?._zod.def?.error?.(e))??De(t?.error?.(e))??De(n.customError?.(e))??De(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ke(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ae(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const je=(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,ne,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Me=O(`$ZodError`,je),Ne=O(`$ZodError`,je,{Parent:Error});function Pe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Fe(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}const Ie=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new k;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Oe(e,a,A())));throw ce(t,i?.callee),t}return o.value},Le=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Oe(e,a,A())));throw ce(t,i?.callee),t}return o.value},Re=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new k;return a.issues.length?{success:!1,error:new(e??Me)(a.issues.map(e=>Oe(e,i,A())))}:{success:!0,data:a.value}},ze=Re(Ne),Be=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Oe(e,i,A())))}:{success:!0,data:a.value}},Ve=Be(Ne),He=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ie(e)(t,n,i)},Ue=e=>(t,n,r)=>Ie(e)(t,n,r),We=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Le(e)(t,n,i)},Ge=e=>async(t,n,r)=>Le(e)(t,n,r),Ke=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Re(e)(t,n,i)},qe=e=>(t,n,r)=>Re(e)(t,n,r),Je=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Be(e)(t,n,i)},Ye=e=>async(t,n,r)=>Be(e)(t,n,r),Xe=/^[cC][^\s-]{8,}$/,Ze=/^[0-9a-z]+$/,Qe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$e=/^[0-9a-vA-V]{20}$/,et=/^[A-Za-z0-9]{27}$/,tt=/^[a-zA-Z0-9_-]{21}$/,nt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rt=/^([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})$/,it=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)$/,at=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function ot(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const st=/^(?:(?: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])$/,ct=/^(([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}|:))$/,lt=/^((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])$/,ut=/^(([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])$/,dt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ft=/^[A-Za-z0-9_-]*$/,pt=/^\+[1-9]\d{6,14}$/,mt=`(?:(?:\\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])))`,ht=RegExp(`^${mt}$`);function gt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _t(e){return RegExp(`^${gt(e)}$`)}function vt(e){let t=gt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${mt}T(?:${r})$`)}const yt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},bt=/^-?\d+$/,xt=/^-?\d+(?:\.\d+)?$/,St=/^(?:true|false)$/i,Ct=/^[^A-Z]*$/,wt=/^[^a-z]*$/,R=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tt={number:`number`,bigint:`bigint`,object:`date`},Et=O(`$ZodCheckLessThan`,(e,t)=>{R.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dt=O(`$ZodCheckGreaterThan`,(e,t)=>{R.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ot=O(`$ZodCheckMultipleOf`,(e,t)=>{R.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):N(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kt=O(`$ZodCheckNumberFormat`,(e,t)=>{R.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=_e[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=bt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),At=O(`$ZodCheckMaxLength`,(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!re(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ke(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jt=O(`$ZodCheckMinLength`,(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!re(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ke(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mt=O(`$ZodCheckLengthEquals`,(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!re(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ke(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nt=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;R.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pt=O(`$ZodCheckRegex`,(e,t)=>{Nt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ft=O(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ct,Nt.init(e,t)}),It=O(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wt,Nt.init(e,t)}),Lt=O(`$ZodCheckIncludes`,(e,t)=>{R.init(e,t);let n=me(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rt=O(`$ZodCheckStartsWith`,(e,t)=>{R.init(e,t);let n=RegExp(`^${me(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zt=O(`$ZodCheckEndsWith`,(e,t)=>{R.init(e,t);let n=RegExp(`.*${me(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bt=O(`$ZodCheckOverwrite`,(e,t)=>{R.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Vt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
7
7
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
8
- `))}};const Gt={major:4,minor:3,patch:6},F=w(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gt;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Oe(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new T;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Oe(e,t))});else{if(e.issues.length===t)continue;r||=Oe(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Oe(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new T;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new T;return o.then(e=>t(e,r,a))}return t(o,r,a)}}A(e,`~standard`,()=>({validate:t=>{try{let n=He(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return We(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Kt=w(`$ZodString`,(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??St(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),I=w(`$ZodStringFormat`,(e,t)=>{It.init(e,t),Kt.init(e,t)}),qt=w(`$ZodGUID`,(e,t)=>{t.pattern??=ot,I.init(e,t)}),Jt=w(`$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(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=st(e)}else t.pattern??=st();I.init(e,t)}),Yt=w(`$ZodEmail`,(e,t)=>{t.pattern??=ct,I.init(e,t)}),Xt=w(`$ZodURL`,(e,t)=>{I.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.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)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Zt=w(`$ZodEmoji`,(e,t)=>{t.pattern??=lt(),I.init(e,t)}),Qt=w(`$ZodNanoID`,(e,t)=>{t.pattern??=it,I.init(e,t)}),$t=w(`$ZodCUID`,(e,t)=>{t.pattern??=$e,I.init(e,t)}),en=w(`$ZodCUID2`,(e,t)=>{t.pattern??=et,I.init(e,t)}),tn=w(`$ZodULID`,(e,t)=>{t.pattern??=tt,I.init(e,t)}),nn=w(`$ZodXID`,(e,t)=>{t.pattern??=nt,I.init(e,t)}),rn=w(`$ZodKSUID`,(e,t)=>{t.pattern??=rt,I.init(e,t)}),an=w(`$ZodISODateTime`,(e,t)=>{t.pattern??=xt(t),I.init(e,t)}),on=w(`$ZodISODate`,(e,t)=>{t.pattern??=vt,I.init(e,t)}),sn=w(`$ZodISOTime`,(e,t)=>{t.pattern??=bt(t),I.init(e,t)}),cn=w(`$ZodISODuration`,(e,t)=>{t.pattern??=at,I.init(e,t)}),ln=w(`$ZodIPv4`,(e,t)=>{t.pattern??=ut,I.init(e,t),e._zod.bag.format=`ipv4`}),un=w(`$ZodIPv6`,(e,t)=>{t.pattern??=dt,I.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),dn=w(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ft,I.init(e,t)}),fn=w(`$ZodCIDRv6`,(e,t)=>{t.pattern??=pt,I.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function pn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const mn=w(`$ZodBase64`,(e,t)=>{t.pattern??=mt,I.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{pn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function hn(e){if(!ht.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return pn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const gn=w(`$ZodBase64URL`,(e,t)=>{t.pattern??=ht,I.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{hn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),_n=w(`$ZodE164`,(e,t)=>{t.pattern??=gt,I.init(e,t)});function vn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const yn=w(`$ZodJWT`,(e,t)=>{I.init(e,t),e._zod.check=n=>{vn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),bn=w(`$ZodNumber`,(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??wt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),xn=w(`$ZodNumberFormat`,(e,t)=>{Mt.init(e,t),bn.init(e,t)}),Sn=w(`$ZodBoolean`,(e,t)=>{F.init(e,t),e._zod.pattern=Tt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Cn=w(`$ZodUnknown`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),wn=w(`$ZodNever`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Tn(e,t,n){e.issues.length&&t.issues.push(...ke(n,e.issues)),t.value[n]=e.value}const En=w(`$ZodArray`,(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Tn(t,n,e))):Tn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Dn(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...ke(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function On(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ye(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function kn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Dn(e,n,i,t,u))):Dn(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const An=w(`$ZodObject`,(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=oe(()=>On(t));A(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=fe,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Dn(n,t,e,s,r))):Dn(i,t,e,s,r)}return i?kn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),jn=w(`$ZodObjectJIT`,(e,t)=>{An.init(e,t);let n=e._zod.parse,r=oe(()=>On(t)),i=e=>{let t=new Wt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=M(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=M(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
8
+ `))}};const Ht={major:4,minor:3,patch:6},z=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ht;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Te(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new k;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Te(e,t))});else{if(e.issues.length===t)continue;r||=Te(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Te(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(e=>t(e,r,a))}return t(o,r,a)}}P(e,`~standard`,()=>({validate:t=>{try{let n=ze(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ve(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ut=O(`$ZodString`,(e,t)=>{z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),B=O(`$ZodStringFormat`,(e,t)=>{Nt.init(e,t),Ut.init(e,t)}),Wt=O(`$ZodGUID`,(e,t)=>{t.pattern??=rt,B.init(e,t)}),Gt=O(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=it(e)}else t.pattern??=it();B.init(e,t)}),Kt=O(`$ZodEmail`,(e,t)=>{t.pattern??=at,B.init(e,t)}),qt=O(`$ZodURL`,(e,t)=>{B.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.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)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Jt=O(`$ZodEmoji`,(e,t)=>{t.pattern??=ot(),B.init(e,t)}),Yt=O(`$ZodNanoID`,(e,t)=>{t.pattern??=tt,B.init(e,t)}),Xt=O(`$ZodCUID`,(e,t)=>{t.pattern??=Xe,B.init(e,t)}),Zt=O(`$ZodCUID2`,(e,t)=>{t.pattern??=Ze,B.init(e,t)}),Qt=O(`$ZodULID`,(e,t)=>{t.pattern??=Qe,B.init(e,t)}),$t=O(`$ZodXID`,(e,t)=>{t.pattern??=$e,B.init(e,t)}),en=O(`$ZodKSUID`,(e,t)=>{t.pattern??=et,B.init(e,t)}),tn=O(`$ZodISODateTime`,(e,t)=>{t.pattern??=vt(t),B.init(e,t)}),nn=O(`$ZodISODate`,(e,t)=>{t.pattern??=ht,B.init(e,t)}),rn=O(`$ZodISOTime`,(e,t)=>{t.pattern??=_t(t),B.init(e,t)}),an=O(`$ZodISODuration`,(e,t)=>{t.pattern??=nt,B.init(e,t)}),on=O(`$ZodIPv4`,(e,t)=>{t.pattern??=st,B.init(e,t),e._zod.bag.format=`ipv4`}),sn=O(`$ZodIPv6`,(e,t)=>{t.pattern??=ct,B.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),cn=O(`$ZodCIDRv4`,(e,t)=>{t.pattern??=lt,B.init(e,t)}),ln=O(`$ZodCIDRv6`,(e,t)=>{t.pattern??=ut,B.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function un(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const dn=O(`$ZodBase64`,(e,t)=>{t.pattern??=dt,B.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{un(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function fn(e){if(!ft.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return un(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const pn=O(`$ZodBase64URL`,(e,t)=>{t.pattern??=ft,B.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{fn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),mn=O(`$ZodE164`,(e,t)=>{t.pattern??=pt,B.init(e,t)});function hn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const gn=O(`$ZodJWT`,(e,t)=>{B.init(e,t),e._zod.check=n=>{hn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),_n=O(`$ZodNumber`,(e,t)=>{z.init(e,t),e._zod.pattern=e._zod.bag.pattern??xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),vn=O(`$ZodNumberFormat`,(e,t)=>{kt.init(e,t),_n.init(e,t)}),yn=O(`$ZodBoolean`,(e,t)=>{z.init(e,t),e._zod.pattern=St,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),bn=O(`$ZodUnknown`,(e,t)=>{z.init(e,t),e._zod.parse=e=>e}),xn=O(`$ZodNever`,(e,t)=>{z.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Sn(e,t,n){e.issues.length&&t.issues.push(...Ee(n,e.issues)),t.value[n]=e.value}const Cn=O(`$ZodArray`,(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Sn(t,n,e))):Sn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function wn(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...Ee(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Tn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function En(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>wn(e,n,i,t,u))):wn(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Dn=O(`$ZodObject`,(e,t)=>{if(z.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=M(()=>Tn(t));P(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=le,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>wn(n,t,e,s,r))):wn(i,t,e,s,r)}return i?En(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),On=O(`$ZodObjectJIT`,(e,t)=>{Dn.init(e,t);let n=e._zod.parse,r=M(()=>Tn(t)),i=e=>{let t=new Vt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=oe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=oe(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
9
9
  if (${n}.issues.length) {
10
10
  if (${o} in input) {
11
11
  payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
@@ -39,15 +39,15 @@ import e from"node:process";import{RegistryItemNotFoundError as t,getPathsForIte
39
39
  newResult[${o}] = ${n}.value;
40
40
  }
41
41
 
42
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=fe,s=!ie.jitless,c=s&&pe.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?kn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Mn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Oe(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>je(e,r,E())))}),t)}const Nn=w(`$ZodUnion`,(e,t)=>{F.init(e,t),A(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),A(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),A(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),A(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=>se(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Mn(t,i,e,a)):Mn(s,i,e,a)}}),Pn=w(`$ZodIntersection`,(e,t)=>{F.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>In(e,t,n)):In(e,i,a)}});function Fn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(me(e)&&me(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Fn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Fn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function In(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Oe(e))return e;let o=Fn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Ln=w(`$ZodEnum`,(e,t)=>{F.init(e,t);let n=ae(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ge.has(typeof e)).map(e=>typeof e==`string`?_e(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Rn=w(`$ZodTransform`,(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new re(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new T;return n.value=i,n}});function zn(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Bn=w(`$ZodOptional`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,A(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),A(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${se(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>zn(t,e.value)):zn(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Vn=w(`$ZodExactOptional`,(e,t)=>{Bn.init(e,t),A(e._zod,`values`,()=>t.innerType._zod.values),A(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Hn=w(`$ZodNullable`,(e,t)=>{F.init(e,t),A(e._zod,`optin`,()=>t.innerType._zod.optin),A(e._zod,`optout`,()=>t.innerType._zod.optout),A(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${se(e.source)}|null)$`):void 0}),A(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Un=w(`$ZodDefault`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,A(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Wn(e,t)):Wn(r,t)}});function Wn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Gn=w(`$ZodPrefault`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,A(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Kn=w(`$ZodNonOptional`,(e,t)=>{F.init(e,t),A(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>qn(t,e)):qn(i,e)}});function qn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Jn=w(`$ZodCatch`,(e,t)=>{F.init(e,t),A(e._zod,`optin`,()=>t.innerType._zod.optin),A(e._zod,`optout`,()=>t.innerType._zod.optout),A(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>je(e,n,E()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>je(e,n,E()))},input:e.value}),e.issues=[]),e)}}),Yn=w(`$ZodPipe`,(e,t)=>{F.init(e,t),A(e._zod,`values`,()=>t.in._zod.values),A(e._zod,`optin`,()=>t.in._zod.optin),A(e._zod,`optout`,()=>t.out._zod.optout),A(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Xn(e,t.in,n)):Xn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Xn(e,t.out,n)):Xn(r,t.out,n)}});function Xn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Zn=w(`$ZodReadonly`,(e,t)=>{F.init(e,t),A(e._zod,`propValues`,()=>t.innerType._zod.propValues),A(e._zod,`values`,()=>t.innerType._zod.values),A(e._zod,`optin`,()=>t.innerType?._zod?.optin),A(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Qn):Qn(r)}});function Qn(e){return e.value=Object.freeze(e.value),e}const $n=w(`$ZodCustom`,(e,t)=>{P.init(e,t),F.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>er(t,n,r,e));er(i,n,r,e)}});function er(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ne(e))}}var tr,nr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function rr(){return new nr}(tr=globalThis).__zod_globalRegistry??(tr.__zod_globalRegistry=rr());const ir=globalThis.__zod_globalRegistry;function ar(e,t){return new e({type:`string`,...N(t)})}function or(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}function sr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}function lr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}function ur(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}function dr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}function fr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}function pr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}function mr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}function hr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}function gr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}function _r(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}function vr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}function yr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}function br(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}function xr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}function Sr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}function Cr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}function wr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}function Tr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}function Er(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}function Dr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(t)})}function Or(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...N(t)})}function kr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}function Ar(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}function jr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}function Mr(e,t){return new e({type:`number`,checks:[],...N(t)})}function Nr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...N(t)})}function Pr(e,t){return new e({type:`boolean`,...N(t)})}function Fr(e){return new e({type:`unknown`})}function Ir(e,t){return new e({type:`never`,...N(t)})}function Lr(e,t){return new kt({check:`less_than`,...N(t),value:e,inclusive:!1})}function Rr(e,t){return new kt({check:`less_than`,...N(t),value:e,inclusive:!0})}function zr(e,t){return new At({check:`greater_than`,...N(t),value:e,inclusive:!1})}function Br(e,t){return new At({check:`greater_than`,...N(t),value:e,inclusive:!0})}function Vr(e,t){return new jt({check:`multiple_of`,...N(t),value:e})}function Hr(e,t){return new Nt({check:`max_length`,...N(t),maximum:e})}function Ur(e,t){return new Pt({check:`min_length`,...N(t),minimum:e})}function Wr(e,t){return new Ft({check:`length_equals`,...N(t),length:e})}function Gr(e,t){return new Lt({check:`string_format`,format:`regex`,...N(t),pattern:e})}function Kr(e){return new Rt({check:`string_format`,format:`lowercase`,...N(e)})}function qr(e){return new zt({check:`string_format`,format:`uppercase`,...N(e)})}function Jr(e,t){return new Bt({check:`string_format`,format:`includes`,...N(t),includes:e})}function Yr(e,t){return new Vt({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}function Xr(e,t){return new Ht({check:`string_format`,format:`ends_with`,...N(t),suffix:e})}function Zr(e){return new Ut({check:`overwrite`,tx:e})}function Qr(e){return Zr(t=>t.normalize(e))}function $r(){return Zr(e=>e.trim())}function ei(){return Zr(e=>e.toLowerCase())}function ti(){return Zr(e=>e.toUpperCase())}function ni(){return Zr(e=>ue(e))}function ri(e,t,n){return new e({type:`array`,element:t,...N(n)})}function ii(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...N(n)})}function ai(e){let t=oi(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Ne(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Ne(r))}},e(n.value,n)));return t}function oi(e,t){let n=new P({check:`custom`,...N(t)});return n._zod.check=e,n}function si(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ir,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function L(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,L(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&R(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ci(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
42
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=le,s=!te.jitless,c=s&&ue.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?En([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function kn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Te(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Oe(e,r,A())))}),t)}const An=O(`$ZodUnion`,(e,t)=>{z.init(e,t),P(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),P(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),P(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),P(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=>ie(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>kn(t,i,e,a)):kn(s,i,e,a)}}),jn=O(`$ZodIntersection`,(e,t)=>{z.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Nn(e,t,n)):Nn(e,i,a)}});function Mn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(de(e)&&de(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Mn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Mn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Nn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Te(e))return e;let o=Mn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Pn=O(`$ZodEnum`,(e,t)=>{z.init(e,t);let n=j(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>pe.has(typeof e)).map(e=>typeof e==`string`?me(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Fn=O(`$ZodTransform`,(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ee(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new k;return n.value=i,n}});function In(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ln=O(`$ZodOptional`,(e,t)=>{z.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,P(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ie(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>In(t,e.value)):In(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Rn=O(`$ZodExactOptional`,(e,t)=>{Ln.init(e,t),P(e._zod,`values`,()=>t.innerType._zod.values),P(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),zn=O(`$ZodNullable`,(e,t)=>{z.init(e,t),P(e._zod,`optin`,()=>t.innerType._zod.optin),P(e._zod,`optout`,()=>t.innerType._zod.optout),P(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ie(e.source)}|null)$`):void 0}),P(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Bn=O(`$ZodDefault`,(e,t)=>{z.init(e,t),e._zod.optin=`optional`,P(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Vn(e,t)):Vn(r,t)}});function Vn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Hn=O(`$ZodPrefault`,(e,t)=>{z.init(e,t),e._zod.optin=`optional`,P(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Un=O(`$ZodNonOptional`,(e,t)=>{z.init(e,t),P(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Wn(t,e)):Wn(i,e)}});function Wn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Gn=O(`$ZodCatch`,(e,t)=>{z.init(e,t),P(e._zod,`optin`,()=>t.innerType._zod.optin),P(e._zod,`optout`,()=>t.innerType._zod.optout),P(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Oe(e,n,A()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Oe(e,n,A()))},input:e.value}),e.issues=[]),e)}}),Kn=O(`$ZodPipe`,(e,t)=>{z.init(e,t),P(e._zod,`values`,()=>t.in._zod.values),P(e._zod,`optin`,()=>t.in._zod.optin),P(e._zod,`optout`,()=>t.out._zod.optout),P(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>qn(e,t.in,n)):qn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>qn(e,t.out,n)):qn(r,t.out,n)}});function qn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Jn=O(`$ZodReadonly`,(e,t)=>{z.init(e,t),P(e._zod,`propValues`,()=>t.innerType._zod.propValues),P(e._zod,`values`,()=>t.innerType._zod.values),P(e._zod,`optin`,()=>t.innerType?._zod?.optin),P(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Yn):Yn(r)}});function Yn(e){return e.value=Object.freeze(e.value),e}const Xn=O(`$ZodCustom`,(e,t)=>{R.init(e,t),z.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Zn(t,n,r,e));Zn(i,n,r,e)}});function Zn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ae(e))}}var Qn,$n=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function er(){return new $n}(Qn=globalThis).__zod_globalRegistry??(Qn.__zod_globalRegistry=er());const tr=globalThis.__zod_globalRegistry;function nr(e,t){return new e({type:`string`,...L(t)})}function rr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function ir(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function lr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function ur(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function dr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function fr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function pr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function mr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function hr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function gr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function _r(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function vr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function yr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function br(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function xr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function Sr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function Cr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function wr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function Tr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function Er(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function Dr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function Or(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function kr(e,t){return new e({type:`number`,checks:[],...L(t)})}function Ar(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function jr(e,t){return new e({type:`boolean`,...L(t)})}function Mr(e){return new e({type:`unknown`})}function Nr(e,t){return new e({type:`never`,...L(t)})}function Pr(e,t){return new Et({check:`less_than`,...L(t),value:e,inclusive:!1})}function Fr(e,t){return new Et({check:`less_than`,...L(t),value:e,inclusive:!0})}function Ir(e,t){return new Dt({check:`greater_than`,...L(t),value:e,inclusive:!1})}function Lr(e,t){return new Dt({check:`greater_than`,...L(t),value:e,inclusive:!0})}function Rr(e,t){return new Ot({check:`multiple_of`,...L(t),value:e})}function zr(e,t){return new At({check:`max_length`,...L(t),maximum:e})}function Br(e,t){return new jt({check:`min_length`,...L(t),minimum:e})}function Vr(e,t){return new Mt({check:`length_equals`,...L(t),length:e})}function Hr(e,t){return new Pt({check:`string_format`,format:`regex`,...L(t),pattern:e})}function Ur(e){return new Ft({check:`string_format`,format:`lowercase`,...L(e)})}function Wr(e){return new It({check:`string_format`,format:`uppercase`,...L(e)})}function Gr(e,t){return new Lt({check:`string_format`,format:`includes`,...L(t),includes:e})}function Kr(e,t){return new Rt({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function qr(e,t){return new zt({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function Jr(e){return new Bt({check:`overwrite`,tx:e})}function Yr(e){return Jr(t=>t.normalize(e))}function Xr(){return Jr(e=>e.trim())}function Zr(){return Jr(e=>e.toLowerCase())}function Qr(){return Jr(e=>e.toUpperCase())}function $r(){return Jr(e=>se(e))}function ei(e,t,n){return new e({type:`array`,element:t,...L(n)})}function ti(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function ni(e){let t=ri(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Ae(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Ae(r))}},e(n.value,n)));return t}function ri(e,t){let n=new R({check:`custom`,...L(t)});return n._zod.check=e,n}function ii(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??tr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function V(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,V(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&H(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ai(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
43
43
 
44
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function li(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:di(t,`input`,e.processors),output:di(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function R(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return R(r.element,n);if(r.type===`set`)return R(r.valueType,n);if(r.type===`lazy`)return R(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return R(r.innerType,n);if(r.type===`intersection`)return R(r.left,n)||R(r.right,n);if(r.type===`record`||r.type===`map`)return R(r.keyType,n)||R(r.valueType,n);if(r.type===`pipe`)return R(r.in,n)||R(r.out,n);if(r.type===`object`){for(let e in r.shape)if(R(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(R(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(R(e,n))return!0;return!!(r.rest&&R(r.rest,n))}return!1}const ui=(e,t={})=>n=>{let r=si({...n,processors:t});return L(e,r),ci(r,e),li(r,e)},di=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=si({...i??{},target:a,io:t,processors:n});return L(e,o),ci(o,e),li(o,e)},fi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},pi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=fi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},mi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},hi=(e,t,n,r)=>{n.type=`boolean`},gi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},_i=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},vi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},yi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{n.not={}},Si=(e,t,n,r)=>{},Ci=(e,t,n,r)=>{},wi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Ti=(e,t,n,r)=>{let i=e._zod.def,a=ae(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ei=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Oi=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},ki=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Ai=(e,t,n,r)=>{n.type=`boolean`},ji=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Mi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Ni=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Pi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Fi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Ii=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=L(a.element,t,{...r,path:[...r.path,`items`]})},Li=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=L(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=L(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ri=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>L(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},zi=(e,t,n,r)=>{let i=e._zod.def,a=L(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Bi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>L(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?L(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Vi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=L(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=L(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=L(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Hi=(e,t,n,r)=>{let i=e._zod.def,a=L(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ui=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wi=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Gi=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ki=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},qi=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;L(a,t,r);let o=t.seen.get(e);o.ref=a},Ji=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Yi=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xi=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zi={string:pi,number:mi,boolean:hi,bigint:gi,symbol:_i,null:vi,undefined:yi,void:bi,never:xi,any:Si,unknown:Ci,date:wi,enum:Ti,literal:Ei,nan:Di,template_literal:Oi,file:ki,success:Ai,custom:ji,function:Mi,transform:Ni,map:Pi,set:Fi,array:Ii,object:Li,union:Ri,intersection:zi,tuple:Bi,record:Vi,nullable:Hi,nonoptional:Ui,default:Wi,prefault:Gi,catch:Ki,pipe:qi,readonly:Ji,promise:Yi,optional:Xi,lazy:(e,t,n,r)=>{let i=e._zod.innerType;L(i,t,r);let a=t.seen.get(e);a.ref=i}};function Qi(e,t){if(`_idmap`in e){let n=e,r=si({...t,processors:Zi}),i={};for(let e of n._idmap.entries()){let[t,n]=e;L(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;ci(r,n),a[t]=li(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=si({...t,processors:Zi});return L(e,n),ci(n,e),li(n,e)}const $i=w(`ZodISODateTime`,(e,t)=>{an.init(e,t),V.init(e,t)});function ea(e){return Or($i,e)}const ta=w(`ZodISODate`,(e,t)=>{on.init(e,t),V.init(e,t)});function na(e){return kr(ta,e)}const ra=w(`ZodISOTime`,(e,t)=>{sn.init(e,t),V.init(e,t)});function ia(e){return Ar(ra,e)}const aa=w(`ZodISODuration`,(e,t)=>{cn.init(e,t),V.init(e,t)});function oa(e){return jr(aa,e)}const sa=(e,t)=>{Fe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Re(e,t)},flatten:{value:t=>Le(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,D,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,D,2)}},isEmpty:{get(){return e.issues.length===0}}})};w(`ZodError`,sa);const z=w(`ZodError`,sa,{Parent:Error}),ca=ze(z),la=Be(z),ua=Ve(z),da=Ue(z),fa=Ge(z),pa=Ke(z),ma=qe(z),ha=Je(z),ga=Ye(z),_a=Xe(z),va=Ze(z),ya=Qe(z),B=w(`ZodType`,(e,t)=>(F.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:di(e,`input`),output:di(e,`output`)}}),e.toJSONSchema=ui(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(j(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>ve(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ca(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ua(e,t,n),e.parseAsync=async(t,n)=>la(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>da(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>fa(e,t,n),e.decode=(t,n)=>pa(e,t,n),e.encodeAsync=async(t,n)=>ma(e,t,n),e.decodeAsync=async(t,n)=>ha(e,t,n),e.safeEncode=(t,n)=>ga(e,t,n),e.safeDecode=(t,n)=>_a(e,t,n),e.safeEncodeAsync=async(t,n)=>va(e,t,n),e.safeDecodeAsync=async(t,n)=>ya(e,t,n),e.refine=(t,n)=>e.check(Ao(t,n)),e.superRefine=t=>e.check(jo(t)),e.overwrite=t=>e.check(Zr(t)),e.optional=()=>fo(e),e.exactOptional=()=>mo(e),e.nullable=()=>go(e),e.nullish=()=>fo(go(e)),e.nonoptional=t=>So(e,t),e.array=()=>$a(e),e.or=t=>ro([e,t]),e.and=t=>ao(e,t),e.transform=t=>Eo(e,lo(t)),e.default=t=>vo(e,t),e.prefault=t=>bo(e,t),e.catch=t=>wo(e,t),e.pipe=t=>Eo(e,t),e.readonly=()=>Oo(e),e.describe=t=>{let n=e.clone();return ir.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return ir.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return ir.get(e);let n=e.clone();return ir.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ba=w(`_ZodString`,(e,t)=>{Kt.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Gr(...t)),e.includes=(...t)=>e.check(Jr(...t)),e.startsWith=(...t)=>e.check(Yr(...t)),e.endsWith=(...t)=>e.check(Xr(...t)),e.min=(...t)=>e.check(Ur(...t)),e.max=(...t)=>e.check(Hr(...t)),e.length=(...t)=>e.check(Wr(...t)),e.nonempty=(...t)=>e.check(Ur(1,...t)),e.lowercase=t=>e.check(Kr(t)),e.uppercase=t=>e.check(qr(t)),e.trim=()=>e.check($r()),e.normalize=(...t)=>e.check(Qr(...t)),e.toLowerCase=()=>e.check(ei()),e.toUpperCase=()=>e.check(ti()),e.slugify=()=>e.check(ni())}),xa=w(`ZodString`,(e,t)=>{Kt.init(e,t),ba.init(e,t),e.email=t=>e.check(or(Ca,t)),e.url=t=>e.check(fr(Ea,t)),e.jwt=t=>e.check(Dr(Va,t)),e.emoji=t=>e.check(pr(Da,t)),e.guid=t=>e.check(sr(wa,t)),e.uuid=t=>e.check(cr(Ta,t)),e.uuidv4=t=>e.check(lr(Ta,t)),e.uuidv6=t=>e.check(ur(Ta,t)),e.uuidv7=t=>e.check(dr(Ta,t)),e.nanoid=t=>e.check(mr(Oa,t)),e.guid=t=>e.check(sr(wa,t)),e.cuid=t=>e.check(hr(ka,t)),e.cuid2=t=>e.check(gr(Aa,t)),e.ulid=t=>e.check(_r(ja,t)),e.base64=t=>e.check(wr(Ra,t)),e.base64url=t=>e.check(Tr(za,t)),e.xid=t=>e.check(vr(Ma,t)),e.ksuid=t=>e.check(yr(Na,t)),e.ipv4=t=>e.check(br(Pa,t)),e.ipv6=t=>e.check(xr(Fa,t)),e.cidrv4=t=>e.check(Sr(Ia,t)),e.cidrv6=t=>e.check(Cr(La,t)),e.e164=t=>e.check(Er(Ba,t)),e.datetime=t=>e.check(ea(t)),e.date=t=>e.check(na(t)),e.time=t=>e.check(ia(t)),e.duration=t=>e.check(oa(t))});function Sa(e){return ar(xa,e)}const V=w(`ZodStringFormat`,(e,t)=>{I.init(e,t),ba.init(e,t)}),Ca=w(`ZodEmail`,(e,t)=>{Yt.init(e,t),V.init(e,t)}),wa=w(`ZodGUID`,(e,t)=>{qt.init(e,t),V.init(e,t)}),Ta=w(`ZodUUID`,(e,t)=>{Jt.init(e,t),V.init(e,t)}),Ea=w(`ZodURL`,(e,t)=>{Xt.init(e,t),V.init(e,t)}),Da=w(`ZodEmoji`,(e,t)=>{Zt.init(e,t),V.init(e,t)}),Oa=w(`ZodNanoID`,(e,t)=>{Qt.init(e,t),V.init(e,t)}),ka=w(`ZodCUID`,(e,t)=>{$t.init(e,t),V.init(e,t)}),Aa=w(`ZodCUID2`,(e,t)=>{en.init(e,t),V.init(e,t)}),ja=w(`ZodULID`,(e,t)=>{tn.init(e,t),V.init(e,t)}),Ma=w(`ZodXID`,(e,t)=>{nn.init(e,t),V.init(e,t)}),Na=w(`ZodKSUID`,(e,t)=>{rn.init(e,t),V.init(e,t)}),Pa=w(`ZodIPv4`,(e,t)=>{ln.init(e,t),V.init(e,t)}),Fa=w(`ZodIPv6`,(e,t)=>{un.init(e,t),V.init(e,t)}),Ia=w(`ZodCIDRv4`,(e,t)=>{dn.init(e,t),V.init(e,t)}),La=w(`ZodCIDRv6`,(e,t)=>{fn.init(e,t),V.init(e,t)}),Ra=w(`ZodBase64`,(e,t)=>{mn.init(e,t),V.init(e,t)}),za=w(`ZodBase64URL`,(e,t)=>{gn.init(e,t),V.init(e,t)}),Ba=w(`ZodE164`,(e,t)=>{_n.init(e,t),V.init(e,t)}),Va=w(`ZodJWT`,(e,t)=>{yn.init(e,t),V.init(e,t)}),Ha=w(`ZodNumber`,(e,t)=>{bn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),e.gt=(t,n)=>e.check(zr(t,n)),e.gte=(t,n)=>e.check(Br(t,n)),e.min=(t,n)=>e.check(Br(t,n)),e.lt=(t,n)=>e.check(Lr(t,n)),e.lte=(t,n)=>e.check(Rr(t,n)),e.max=(t,n)=>e.check(Rr(t,n)),e.int=t=>e.check(Ga(t)),e.safe=t=>e.check(Ga(t)),e.positive=t=>e.check(zr(0,t)),e.nonnegative=t=>e.check(Br(0,t)),e.negative=t=>e.check(Lr(0,t)),e.nonpositive=t=>e.check(Rr(0,t)),e.multipleOf=(t,n)=>e.check(Vr(t,n)),e.step=(t,n)=>e.check(Vr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ua(e){return Mr(Ha,e)}const Wa=w(`ZodNumberFormat`,(e,t)=>{xn.init(e,t),Ha.init(e,t)});function Ga(e){return Nr(Wa,e)}const Ka=w(`ZodBoolean`,(e,t)=>{Sn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function qa(e){return Pr(Ka,e)}const Ja=w(`ZodUnknown`,(e,t)=>{Cn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ya(){return Fr(Ja)}const Xa=w(`ZodNever`,(e,t)=>{wn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function Za(e){return Ir(Xa,e)}const Qa=w(`ZodArray`,(e,t)=>{En.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Ur(t,n)),e.nonempty=t=>e.check(Ur(1,t)),e.max=(t,n)=>e.check(Hr(t,n)),e.length=(t,n)=>e.check(Wr(t,n)),e.unwrap=()=>e.element});function $a(e,t){return ri(Qa,e,t)}const eo=w(`ZodObject`,(e,t)=>{jn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),A(e,`shape`,()=>t.shape),e.keyof=()=>so(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ya()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ya()}),e.strict=()=>e.clone({...e._zod.def,catchall:Za()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Ce(e,t),e.safeExtend=t=>we(e,t),e.merge=t=>Te(e,t),e.pick=t=>xe(e,t),e.omit=t=>Se(e,t),e.partial=(...t)=>Ee(uo,e,t[0]),e.required=(...t)=>De(xo,e,t[0])});function to(e,t){return new eo({type:`object`,shape:e??{},...N(t)})}const no=w(`ZodUnion`,(e,t)=>{Nn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.options=t.options});function ro(e,t){return new no({type:`union`,options:e,...N(t)})}const io=w(`ZodIntersection`,(e,t)=>{Pn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r)});function ao(e,t){return new io({type:`intersection`,left:e,right:t})}const oo=w(`ZodEnum`,(e,t)=>{Ln.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new oo({...t,checks:[],...N(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new oo({...t,checks:[],...N(r),entries:i})}});function so(e,t){return new oo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...N(t)})}const co=w(`ZodTransform`,(e,t)=>{Rn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new re(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ne(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ne(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function lo(e){return new co({type:`transform`,transform:e})}const uo=w(`ZodOptional`,(e,t)=>{Bn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fo(e){return new uo({type:`optional`,innerType:e})}const po=w(`ZodExactOptional`,(e,t)=>{Vn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mo(e){return new po({type:`optional`,innerType:e})}const ho=w(`ZodNullable`,(e,t)=>{Hn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function go(e){return new ho({type:`nullable`,innerType:e})}const _o=w(`ZodDefault`,(e,t)=>{Un.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vo(e,t){return new _o({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():he(t)}})}const yo=w(`ZodPrefault`,(e,t)=>{Gn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bo(e,t){return new yo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():he(t)}})}const xo=w(`ZodNonOptional`,(e,t)=>{Kn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function So(e,t){return new xo({type:`nonoptional`,innerType:e,...N(t)})}const Co=w(`ZodCatch`,(e,t)=>{Jn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wo(e,t){return new Co({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const To=w(`ZodPipe`,(e,t)=>{Yn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.in=t.in,e.out=t.out});function Eo(e,t){return new To({type:`pipe`,in:e,out:t})}const Do=w(`ZodReadonly`,(e,t)=>{Zn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e){return new Do({type:`readonly`,innerType:e})}const ko=w(`ZodCustom`,(e,t)=>{$n.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r)});function Ao(e,t={}){return ii(ko,e,t)}function jo(e){return ai(e)}var Mo=class extends C{async toJsonSchema(e){return Qi(e,{target:`draft-7`})}};function No(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Po(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?No(Object(n),!0).forEach(function(t){Fo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):No(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fo(e,t,n){return t=Io(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Io(e){var t=Lo(e,`string`);return typeof t==`symbol`?t:String(t)}function Lo(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Ro=zo({});function zo(e){return t.withOptions=t=>zo(Po(Po({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Bo(n[e],s):n[e];s+=t}}let c=s.split(`
44
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function oi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ci(t,`input`,e.processors),output:ci(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function H(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return H(r.element,n);if(r.type===`set`)return H(r.valueType,n);if(r.type===`lazy`)return H(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return H(r.innerType,n);if(r.type===`intersection`)return H(r.left,n)||H(r.right,n);if(r.type===`record`||r.type===`map`)return H(r.keyType,n)||H(r.valueType,n);if(r.type===`pipe`)return H(r.in,n)||H(r.out,n);if(r.type===`object`){for(let e in r.shape)if(H(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(H(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(H(e,n))return!0;return!!(r.rest&&H(r.rest,n))}return!1}const si=(e,t={})=>n=>{let r=ii({...n,processors:t});return V(e,r),ai(r,e),oi(r,e)},ci=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ii({...i??{},target:a,io:t,processors:n});return V(e,o),ai(o,e),oi(o,e)},li={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ui=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=li[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},di=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},fi=(e,t,n,r)=>{n.type=`boolean`},pi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},mi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},hi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},gi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},_i=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},vi=(e,t,n,r)=>{n.not={}},yi=(e,t,n,r)=>{},bi=(e,t,n,r)=>{},xi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Si=(e,t,n,r)=>{let i=e._zod.def,a=j(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Ci=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},wi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Ti=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ei=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Di=(e,t,n,r)=>{n.type=`boolean`},Oi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ki=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Ai=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ji=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Mi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Ni=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=V(a.element,t,{...r,path:[...r.path,`items`]})},Pi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=V(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=V(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>V(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ii=(e,t,n,r)=>{let i=e._zod.def,a=V(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=V(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Li=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>V(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?V(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Ri=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=V(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=V(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=V(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},zi=(e,t,n,r)=>{let i=e._zod.def,a=V(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Bi=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Vi=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Hi=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ui=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Wi=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;V(a,t,r);let o=t.seen.get(e);o.ref=a},Gi=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ki=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qi=(e,t,n,r)=>{let i=e._zod.def;V(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ji={string:ui,number:di,boolean:fi,bigint:pi,symbol:mi,null:hi,undefined:gi,void:_i,never:vi,any:yi,unknown:bi,date:xi,enum:Si,literal:Ci,nan:wi,template_literal:Ti,file:Ei,success:Di,custom:Oi,function:ki,transform:Ai,map:ji,set:Mi,array:Ni,object:Pi,union:Fi,intersection:Ii,tuple:Li,record:Ri,nullable:zi,nonoptional:Bi,default:Vi,prefault:Hi,catch:Ui,pipe:Wi,readonly:Gi,promise:Ki,optional:qi,lazy:(e,t,n,r)=>{let i=e._zod.innerType;V(i,t,r);let a=t.seen.get(e);a.ref=i}};function Yi(e,t){if(`_idmap`in e){let n=e,r=ii({...t,processors:Ji}),i={};for(let e of n._idmap.entries()){let[t,n]=e;V(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;ai(r,n),a[t]=oi(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ii({...t,processors:Ji});return V(e,n),ai(n,e),oi(n,e)}const Xi=O(`ZodISODateTime`,(e,t)=>{tn.init(e,t),G.init(e,t)});function Zi(e){return Tr(Xi,e)}const Qi=O(`ZodISODate`,(e,t)=>{nn.init(e,t),G.init(e,t)});function $i(e){return Er(Qi,e)}const ea=O(`ZodISOTime`,(e,t)=>{rn.init(e,t),G.init(e,t)});function ta(e){return Dr(ea,e)}const na=O(`ZodISODuration`,(e,t)=>{an.init(e,t),G.init(e,t)});function ra(e){return Or(na,e)}const ia=(e,t)=>{Me.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Fe(e,t)},flatten:{value:t=>Pe(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ne,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ne,2)}},isEmpty:{get(){return e.issues.length===0}}})};O(`ZodError`,ia);const U=O(`ZodError`,ia,{Parent:Error}),aa=Ie(U),oa=Le(U),sa=Re(U),ca=Be(U),la=He(U),ua=Ue(U),da=We(U),fa=Ge(U),pa=Ke(U),ma=qe(U),ha=Je(U),ga=Ye(U),W=O(`ZodType`,(e,t)=>(z.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ci(e,`input`),output:ci(e,`output`)}}),e.toJSONSchema=si(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(I(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>he(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>aa(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>sa(e,t,n),e.parseAsync=async(t,n)=>oa(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ca(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>la(e,t,n),e.decode=(t,n)=>ua(e,t,n),e.encodeAsync=async(t,n)=>da(e,t,n),e.decodeAsync=async(t,n)=>fa(e,t,n),e.safeEncode=(t,n)=>pa(e,t,n),e.safeDecode=(t,n)=>ma(e,t,n),e.safeEncodeAsync=async(t,n)=>ha(e,t,n),e.safeDecodeAsync=async(t,n)=>ga(e,t,n),e.refine=(t,n)=>e.check(Do(t,n)),e.superRefine=t=>e.check(Oo(t)),e.overwrite=t=>e.check(Jr(t)),e.optional=()=>co(e),e.exactOptional=()=>uo(e),e.nullable=()=>po(e),e.nullish=()=>co(po(e)),e.nonoptional=t=>yo(e,t),e.array=()=>Xa(e),e.or=t=>eo([e,t]),e.and=t=>no(e,t),e.transform=t=>Co(e,oo(t)),e.default=t=>ho(e,t),e.prefault=t=>_o(e,t),e.catch=t=>xo(e,t),e.pipe=t=>Co(e,t),e.readonly=()=>To(e),e.describe=t=>{let n=e.clone();return tr.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return tr.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return tr.get(e);let n=e.clone();return tr.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),_a=O(`_ZodString`,(e,t)=>{Ut.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Hr(...t)),e.includes=(...t)=>e.check(Gr(...t)),e.startsWith=(...t)=>e.check(Kr(...t)),e.endsWith=(...t)=>e.check(qr(...t)),e.min=(...t)=>e.check(Br(...t)),e.max=(...t)=>e.check(zr(...t)),e.length=(...t)=>e.check(Vr(...t)),e.nonempty=(...t)=>e.check(Br(1,...t)),e.lowercase=t=>e.check(Ur(t)),e.uppercase=t=>e.check(Wr(t)),e.trim=()=>e.check(Xr()),e.normalize=(...t)=>e.check(Yr(...t)),e.toLowerCase=()=>e.check(Zr()),e.toUpperCase=()=>e.check(Qr()),e.slugify=()=>e.check($r())}),va=O(`ZodString`,(e,t)=>{Ut.init(e,t),_a.init(e,t),e.email=t=>e.check(rr(ba,t)),e.url=t=>e.check(lr(Ca,t)),e.jwt=t=>e.check(wr(Ra,t)),e.emoji=t=>e.check(ur(wa,t)),e.guid=t=>e.check(ir(xa,t)),e.uuid=t=>e.check(ar(Sa,t)),e.uuidv4=t=>e.check(or(Sa,t)),e.uuidv6=t=>e.check(sr(Sa,t)),e.uuidv7=t=>e.check(cr(Sa,t)),e.nanoid=t=>e.check(dr(Ta,t)),e.guid=t=>e.check(ir(xa,t)),e.cuid=t=>e.check(fr(Ea,t)),e.cuid2=t=>e.check(pr(Da,t)),e.ulid=t=>e.check(mr(Oa,t)),e.base64=t=>e.check(xr(Fa,t)),e.base64url=t=>e.check(Sr(Ia,t)),e.xid=t=>e.check(hr(ka,t)),e.ksuid=t=>e.check(gr(Aa,t)),e.ipv4=t=>e.check(_r(ja,t)),e.ipv6=t=>e.check(vr(Ma,t)),e.cidrv4=t=>e.check(yr(Na,t)),e.cidrv6=t=>e.check(br(Pa,t)),e.e164=t=>e.check(Cr(La,t)),e.datetime=t=>e.check(Zi(t)),e.date=t=>e.check($i(t)),e.time=t=>e.check(ta(t)),e.duration=t=>e.check(ra(t))});function ya(e){return nr(va,e)}const G=O(`ZodStringFormat`,(e,t)=>{B.init(e,t),_a.init(e,t)}),ba=O(`ZodEmail`,(e,t)=>{Kt.init(e,t),G.init(e,t)}),xa=O(`ZodGUID`,(e,t)=>{Wt.init(e,t),G.init(e,t)}),Sa=O(`ZodUUID`,(e,t)=>{Gt.init(e,t),G.init(e,t)}),Ca=O(`ZodURL`,(e,t)=>{qt.init(e,t),G.init(e,t)}),wa=O(`ZodEmoji`,(e,t)=>{Jt.init(e,t),G.init(e,t)}),Ta=O(`ZodNanoID`,(e,t)=>{Yt.init(e,t),G.init(e,t)}),Ea=O(`ZodCUID`,(e,t)=>{Xt.init(e,t),G.init(e,t)}),Da=O(`ZodCUID2`,(e,t)=>{Zt.init(e,t),G.init(e,t)}),Oa=O(`ZodULID`,(e,t)=>{Qt.init(e,t),G.init(e,t)}),ka=O(`ZodXID`,(e,t)=>{$t.init(e,t),G.init(e,t)}),Aa=O(`ZodKSUID`,(e,t)=>{en.init(e,t),G.init(e,t)}),ja=O(`ZodIPv4`,(e,t)=>{on.init(e,t),G.init(e,t)}),Ma=O(`ZodIPv6`,(e,t)=>{sn.init(e,t),G.init(e,t)}),Na=O(`ZodCIDRv4`,(e,t)=>{cn.init(e,t),G.init(e,t)}),Pa=O(`ZodCIDRv6`,(e,t)=>{ln.init(e,t),G.init(e,t)}),Fa=O(`ZodBase64`,(e,t)=>{dn.init(e,t),G.init(e,t)}),Ia=O(`ZodBase64URL`,(e,t)=>{pn.init(e,t),G.init(e,t)}),La=O(`ZodE164`,(e,t)=>{mn.init(e,t),G.init(e,t)}),Ra=O(`ZodJWT`,(e,t)=>{gn.init(e,t),G.init(e,t)}),za=O(`ZodNumber`,(e,t)=>{_n.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r),e.gt=(t,n)=>e.check(Ir(t,n)),e.gte=(t,n)=>e.check(Lr(t,n)),e.min=(t,n)=>e.check(Lr(t,n)),e.lt=(t,n)=>e.check(Pr(t,n)),e.lte=(t,n)=>e.check(Fr(t,n)),e.max=(t,n)=>e.check(Fr(t,n)),e.int=t=>e.check(Ha(t)),e.safe=t=>e.check(Ha(t)),e.positive=t=>e.check(Ir(0,t)),e.nonnegative=t=>e.check(Lr(0,t)),e.negative=t=>e.check(Pr(0,t)),e.nonpositive=t=>e.check(Fr(0,t)),e.multipleOf=(t,n)=>e.check(Rr(t,n)),e.step=(t,n)=>e.check(Rr(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ba(e){return kr(za,e)}const Va=O(`ZodNumberFormat`,(e,t)=>{vn.init(e,t),za.init(e,t)});function Ha(e){return Ar(Va,e)}const Ua=O(`ZodBoolean`,(e,t)=>{yn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r)});function Wa(e){return jr(Ua,e)}const Ga=O(`ZodUnknown`,(e,t)=>{bn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ka(){return Mr(Ga)}const qa=O(`ZodNever`,(e,t)=>{xn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r)});function Ja(e){return Nr(qa,e)}const Ya=O(`ZodArray`,(e,t)=>{Cn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Br(t,n)),e.nonempty=t=>e.check(Br(1,t)),e.max=(t,n)=>e.check(zr(t,n)),e.length=(t,n)=>e.check(Vr(t,n)),e.unwrap=()=>e.element});function Xa(e,t){return ei(Ya,e,t)}const Za=O(`ZodObject`,(e,t)=>{On.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),P(e,`shape`,()=>t.shape),e.keyof=()=>io(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ka()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ka()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ja()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>be(e,t),e.safeExtend=t=>xe(e,t),e.merge=t=>Se(e,t),e.pick=t=>ve(e,t),e.omit=t=>ye(e,t),e.partial=(...t)=>Ce(so,e,t[0]),e.required=(...t)=>we(vo,e,t[0])});function Qa(e,t){return new Za({type:`object`,shape:e??{},...L(t)})}const $a=O(`ZodUnion`,(e,t)=>{An.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.options=t.options});function eo(e,t){return new $a({type:`union`,options:e,...L(t)})}const to=O(`ZodIntersection`,(e,t)=>{jn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r)});function no(e,t){return new to({type:`intersection`,left:e,right:t})}const ro=O(`ZodEnum`,(e,t)=>{Pn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ro({...t,checks:[],...L(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ro({...t,checks:[],...L(r),entries:i})}});function io(e,t){return new ro({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}const ao=O(`ZodTransform`,(e,t)=>{Fn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ee(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ae(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ae(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function oo(e){return new ao({type:`transform`,transform:e})}const so=O(`ZodOptional`,(e,t)=>{Ln.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function co(e){return new so({type:`optional`,innerType:e})}const lo=O(`ZodExactOptional`,(e,t)=>{Rn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new lo({type:`optional`,innerType:e})}const fo=O(`ZodNullable`,(e,t)=>{zn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function po(e){return new fo({type:`nullable`,innerType:e})}const mo=O(`ZodDefault`,(e,t)=>{Bn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ho(e,t){return new mo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():fe(t)}})}const go=O(`ZodPrefault`,(e,t)=>{Hn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e,t){return new go({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():fe(t)}})}const vo=O(`ZodNonOptional`,(e,t)=>{Un.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yo(e,t){return new vo({type:`nonoptional`,innerType:e,...L(t)})}const bo=O(`ZodCatch`,(e,t)=>{Gn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xo(e,t){return new bo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const So=O(`ZodPipe`,(e,t)=>{Kn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.in=t.in,e.out=t.out});function Co(e,t){return new So({type:`pipe`,in:e,out:t})}const wo=O(`ZodReadonly`,(e,t)=>{Jn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function To(e){return new wo({type:`readonly`,innerType:e})}const Eo=O(`ZodCustom`,(e,t)=>{Xn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r)});function Do(e,t={}){return ti(Eo,e,t)}function Oo(e){return ni(e)}var ko=class extends D{async toJsonSchema(e){return Yi(e,{target:`draft-7`})}};function Ao(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ao(Object(n),!0).forEach(function(t){Mo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ao(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mo(e,t,n){return t=No(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function No(e){var t=Po(e,`string`);return typeof t==`symbol`?t:String(t)}function Po(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Fo=Io({});function Io(e){return t.withOptions=t=>Io(jo(jo({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Lo(n[e],s):n[e];s+=t}}let c=s.split(`
45
45
  `),l=null;for(let e of c){let t=e.match(/^(\s+)\S+/);if(t){let e=t[1].length;l=l?Math.min(l,e):e}}if(l!==null){let e=l;s=c.map(t=>t[0]===` `||t[0]===` `?t.slice(e):t).join(`
46
46
  `)}return o&&(s=s.trim()),a&&(s=s.replace(/\\n/g,`
47
- `)),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function Bo(e,t){if(typeof e!=`string`||!e.includes(`
47
+ `)),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function Lo(e,t){if(typeof e!=`string`||!e.includes(`
48
48
  `))return e;let n=t.slice(t.lastIndexOf(`
49
- `)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}var Vo=y(((e,t)=>{((e,n)=>{typeof define==`function`&&define.amd?define([],n):typeof t==`object`&&t.exports?t.exports=n():e.fuzzysort=n()})(e,e=>{var t=(e,t)=>{if(!e||!t)return O;var n=p(e);E(t)||(t=f(t));var r=n.bitflags;return(r&t._bitflags)===r?h(n,t):O},n=(e,t,n)=>{if(!e)return n?.all?m(t,n):oe;var r=p(e),i=r.bitflags,a=r.containsSpace,o=u(n?.threshold||0),c=n?.limit||ae,l=0,d=0,ee=t.length;function g(e){l<c?(ce.add(e),++l):(++d,e._score>ce.peek()._score&&ce.replaceTop(e))}if(n?.key)for(var _=n.key,v=0;v<ee;++v){var te=t[v],y=ie(te,_);if(y&&(E(y)||(y=f(y)),(i&y._bitflags)===i)){var b=h(r,y);b!==O&&(b._score<o||(b.obj=te,g(b)))}}else if(n?.keys){var x=n.keys,ne=x.length;outer:for(var v=0;v<ee;++v){for(var te=t[v],S=0,k=0;k<ne;++k){var _=x[k],y=ie(te,_);if(!y){T[k]=se;continue}E(y)||(y=f(y)),T[k]=y,S|=y._bitflags}if((i&S)===i){if(a)for(let e=0;e<r.spaceSearches.length;e++)C[e]=D;for(var k=0;k<ne;++k){if(y=T[k],y===se){re[k]=se;continue}if(re[k]=h(r,y,!1,a),re[k]===O){re[k]=se;continue}if(a)for(let e=0;e<r.spaceSearches.length;e++){if(w[e]>-1e3&&C[e]>D){var A=(C[e]+w[e])/4;A>C[e]&&(C[e]=A)}w[e]>C[e]&&(C[e]=w[e])}}if(a){for(let e=0;e<r.spaceSearches.length;e++)if(C[e]===D)continue outer}else{var le=!1;for(let e=0;e<ne;e++)if(re[e]._score!==D){le=!0;break}if(!le)continue}var j=new s(ne);for(let e=0;e<ne;e++)j[e]=re[e];if(a){var M=0;for(let e=0;e<r.spaceSearches.length;e++)M+=C[e]}else{var M=D;for(let e=0;e<ne;e++){var b=j[e];if(b._score>-1e3&&M>D){var A=(M+b._score)/4;A>M&&(M=A)}b._score>M&&(M=b._score)}}if(j.obj=te,j._score=M,n?.scoreFn){if(M=n.scoreFn(j),!M)continue;M=u(M),j._score=M}M<o||g(j)}}}else for(var v=0;v<ee;++v){var y=t[v];if(y&&(E(y)||(y=f(y)),(i&y._bitflags)===i)){var b=h(r,y);b!==O&&(b._score<o||g(b))}}if(l===0)return oe;for(var ue=Array(l),v=l-1;v>=0;--v)ue[v]=ce.poll();return ue.total=l+d,ue},r=(e,t=`<b>`,n=`</b>`)=>{for(var r=typeof t==`function`?t:void 0,i=e.target,a=i.length,o=e.indexes,s=``,c=0,l=0,u=!1,d=[],f=0;f<a;++f){var p=i[f];if(o[l]===f){if(++l,u||(u=!0,r?(d.push(s),s=``):s+=t),l===o.length){r?(s+=p,d.push(r(s,c++)),s=``,d.push(i.substr(f+1))):s+=p+n+i.substr(f+1);break}}else u&&(u=!1,r?(d.push(r(s,c++)),s=``):s+=n);s+=p}return r?d:s},i=e=>{typeof e==`number`?e=``+e:typeof e!=`string`&&(e=``);var t=_(e);return c(e,{_targetLower:t._lower,_targetLowerCodes:t.lowerCodes,_bitflags:t.bitflags})},a=()=>{y.clear(),b.clear()};class o{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((e,t)=>e-t)}set indexes(e){return this._indexes=e}highlight(e,t){return r(this,e,t)}get score(){return l(this._score)}set score(e){this._score=u(e)}}class s extends Array{get score(){return l(this._score)}set score(e){this._score=u(e)}}var c=(e,t)=>{let n=new o;return n.target=e,n.obj=t.obj??O,n._score=t._score??D,n._indexes=t._indexes??[],n._targetLower=t._targetLower??``,n._targetLowerCodes=t._targetLowerCodes??O,n._nextBeginningIndexes=t._nextBeginningIndexes??O,n._bitflags=t._bitflags??0,n},l=e=>e===D?0:e>1?e:Math.E**(((-e+1)**.04307-1)*-2),u=e=>e===0?D:e>1?e:1-(Math.log(e)/-2+1)**(1/.04307),d=e=>{typeof e==`number`?e=``+e:typeof e!=`string`&&(e=``),e=e.trim();var t=_(e),n=[];if(t.containsSpace){var r=e.split(/\s+/);r=[...new Set(r)];for(var i=0;i<r.length;i++)if(r[i]!==``){var a=_(r[i]);n.push({lowerCodes:a.lowerCodes,_lower:r[i].toLowerCase(),containsSpace:!1})}}return{lowerCodes:t.lowerCodes,_lower:t._lower,containsSpace:t.containsSpace,bitflags:t.bitflags,spaceSearches:n}},f=e=>{if(e.length>999)return i(e);var t=y.get(e);return t===void 0?(t=i(e),y.set(e,t),t):t},p=e=>{if(e.length>999)return d(e);var t=b.get(e);return t===void 0?(t=d(e),b.set(e,t),t):t},m=(e,t)=>{var n=[];n.total=e.length;var r=t?.limit||ae;if(t?.key)for(var i=0;i<e.length;i++){var a=e[i],o=ie(a,t.key);if(o!=O){E(o)||(o=f(o));var l=c(o.target,{_score:o._score,obj:a});if(n.push(l),n.length>=r)return n}}else if(t?.keys)for(var i=0;i<e.length;i++){for(var a=e[i],u=new s(t.keys.length),d=t.keys.length-1;d>=0;--d){var o=ie(a,t.keys[d]);if(!o){u[d]=se;continue}E(o)||(o=f(o)),o._score=D,o._indexes.len=0,u[d]=o}if(u.obj=a,u._score=D,n.push(u),n.length>=r)return n}else for(var i=0;i<e.length;i++){var o=e[i];if(o!=O&&(E(o)||(o=f(o)),o._score=D,o._indexes.len=0,n.push(o),n.length>=r))return n}return n},h=(e,t,n=!1,r=!1)=>{if(n===!1&&e.containsSpace)return ee(e,t,r);for(var i=e._lower,a=e.lowerCodes,s=a[0],c=t._targetLowerCodes,l=a.length,u=c.length,d=0,f=0,p=0;;){var m=s===c[f];if(m){if(x[p++]=f,++d,d===l)break;s=a[d]}if(++f,f>=u)return O}var d=0,h=!1,g=0,_=t._nextBeginningIndexes;_===O&&(_=t._nextBeginningIndexes=te(t.target)),f=x[0]===0?0:_[x[0]-1];var v=0;if(f!==u)for(;;)if(f>=u){if(d<=0||(++v,v>200))break;--d;var y=ne[--g];f=_[y]}else{var m=a[d]===c[f];if(m){if(ne[g++]=f,++d,d===l){h=!0;break}++f}else f=_[f]}var b=l<=1?-1:t._targetLower.indexOf(i,x[0]),S=!!~b,C=S?b===0||t._nextBeginningIndexes[b-1]===b:!1;if(S&&!C){for(var w=0;w<_.length;w=_[w])if(!(w<=b)){for(var T=0;T<l&&a[T]===t._targetLowerCodes[w+T];T++);if(T===l){b=w,C=!0;break}}}var re=e=>{for(var t=0,n=0,r=1;r<l;++r)e[r]-e[r-1]!==1&&(t-=e[r],++n);var i=e[l-1]-e[0]-(l-1);if(t-=(12+i)*n,e[0]!==0&&(t-=e[0]*e[0]*.2),!h)t*=1e3;else{for(var a=1,r=_[0];r<u;r=_[r])++a;a>24&&(t*=(a-24)*10)}return t-=(u-l)/2,S&&(t/=1+l*l*1),C&&(t/=1+l*l*1),t-=(u-l)/2,t};if(h)if(C){for(var w=0;w<l;++w)x[w]=b+w;var ie=x,E=re(x)}else var ie=ne,E=re(ne);else{if(S)for(var w=0;w<l;++w)x[w]=b+w;var ie=x,E=re(ie)}t._score=E;for(var w=0;w<l;++w)t._indexes[w]=ie[w];t._indexes.len=l;let ae=new o;return ae.target=t.target,ae._score=t._score,ae._indexes=t._indexes,ae},ee=(e,t,n)=>{for(var r=new Set,i=0,a=O,o=0,s=e.spaceSearches,c=s.length,l=0,u=()=>{for(let e=l-1;e>=0;e--)t._nextBeginningIndexes[S[e*2+0]]=S[e*2+1]},d=!1,f=0;f<c;++f){w[f]=D;var p=s[f];if(a=h(p,t),n){if(a===O)continue;d=!0}else if(a===O)return u(),O;if(f!==c-1){var m=a._indexes,ee=!0;for(let e=0;e<m.len-1;e++)if(m[e+1]-m[e]!==1){ee=!1;break}if(ee){var g=m[m.len-1]+1,_=t._nextBeginningIndexes[g-1];for(let e=g-1;e>=0&&_===t._nextBeginningIndexes[e];e--)t._nextBeginningIndexes[e]=g,S[l*2+0]=e,S[l*2+1]=_,l++}}i+=a._score/c,w[f]=a._score/c,a._indexes[0]<o&&(i-=(o-a._indexes[0])*2),o=a._indexes[0];for(var v=0;v<a._indexes.len;++v)r.add(a._indexes[v])}if(n&&!d)return O;u();var te=h(e,t,!0);if(te!==O&&te._score>i){if(n)for(var f=0;f<c;++f)w[f]=te._score/c;return te}n&&(a=t),a._score=i;var f=0;for(let e of r)a._indexes[f++]=e;return a._indexes.len=f,a},g=e=>e.replace(/\p{Script=Latin}+/gu,e=>e.normalize(`NFD`)).replace(/[\u0300-\u036f]/g,``),_=e=>{e=g(e);for(var t=e.length,n=e.toLowerCase(),r=[],i=0,a=!1,o=0;o<t;++o){var s=r[o]=n.charCodeAt(o);if(s===32){a=!0;continue}var c=s>=97&&s<=122?s-97:s>=48&&s<=57?26:s<=127?30:31;i|=1<<c}return{lowerCodes:r,bitflags:i,containsSpace:a,_lower:n}},v=e=>{for(var t=e.length,n=[],r=0,i=!1,a=!1,o=0;o<t;++o){var s=e.charCodeAt(o),c=s>=65&&s<=90,l=c||s>=97&&s<=122||s>=48&&s<=57,u=c&&!i||!a||!l;i=c,a=l,u&&(n[r++]=o)}return n},te=e=>{e=g(e);for(var t=e.length,n=v(e),r=[],i=n[0],a=0,o=0;o<t;++o)i>o?r[o]=i:(i=n[++a],r[o]=i===void 0?t:i);return r},y=new Map,b=new Map,x=[],ne=[],S=[],C=[],w=[],T=[],re=[],ie=(e,t)=>{var n=e[t];if(n!==void 0)return n;if(typeof t==`function`)return t(e);var r=t;Array.isArray(t)||(r=t.split(`.`));for(var i=r.length,a=-1;e&&++a<i;)e=e[r[a]];return e},E=e=>typeof e==`object`&&typeof e._bitflags==`number`,ae=1/0,D=-ae,oe=[];oe.total=0;var O=null,se=i(``),ce=(e=>{var t=[],n=0,r={},i=e=>{for(var r=0,i=t[r],a=1;a<n;){var o=a+1;r=a,o<n&&t[o]._score<t[a]._score&&(r=o),t[r-1>>1]=t[r],a=1+(r<<1)}for(var s=r-1>>1;r>0&&i._score<t[s]._score;s=(r=s)-1>>1)t[r]=t[s];t[r]=i};return r.add=(e=>{var r=n;t[n++]=e;for(var i=r-1>>1;r>0&&e._score<t[i]._score;i=(r=i)-1>>1)t[r]=t[i];t[r]=e}),r.poll=(e=>{if(n!==0){var r=t[0];return t[0]=t[--n],i(),r}}),r.peek=(e=>{if(n!==0)return t[0]}),r.replaceTop=(e=>{t[0]=e,i()}),r})();return{single:t,go:n,prepare:i,cleanup:a}})})),Ho=y((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.createJSONRPCNotification=e.createJSONRPCRequest=e.createJSONRPCSuccessResponse=e.createJSONRPCErrorResponse=e.JSONRPCErrorCode=e.JSONRPCErrorException=e.isJSONRPCResponses=e.isJSONRPCResponse=e.isJSONRPCRequests=e.isJSONRPCRequest=e.isJSONRPCID=e.JSONRPC=void 0,e.JSONRPC=`2.0`,e.isJSONRPCID=function(e){return typeof e==`string`||typeof e==`number`||e===null},e.isJSONRPCRequest=function(t){return t.jsonrpc===e.JSONRPC&&t.method!==void 0&&t.result===void 0&&t.error===void 0},e.isJSONRPCRequests=function(t){return Array.isArray(t)&&t.every(e.isJSONRPCRequest)},e.isJSONRPCResponse=function(t){return t.jsonrpc===e.JSONRPC&&t.id!==void 0&&(t.result!==void 0||t.error!==void 0)},e.isJSONRPCResponses=function(t){return Array.isArray(t)&&t.every(e.isJSONRPCResponse)};var n=function(e,t,n){var r={code:e,message:t};return n!=null&&(r.data=n),r};e.JSONRPCErrorException=function(e){t(r,e);function r(t,n,i){var a=e.call(this,t)||this;return Object.setPrototypeOf(a,r.prototype),a.code=n,a.data=i,a}return r.prototype.toObject=function(){return n(this.code,this.message,this.data)},r}(Error),(function(e){e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`})(e.JSONRPCErrorCode||={}),e.createJSONRPCErrorResponse=function(t,r,i,a){return{jsonrpc:e.JSONRPC,id:t,error:n(r,i,a)}},e.createJSONRPCSuccessResponse=function(t,n){return{jsonrpc:e.JSONRPC,id:t,result:n??null}},e.createJSONRPCRequest=function(t,n,r){return{jsonrpc:e.JSONRPC,id:t,method:n,params:r}},e.createJSONRPCNotification=function(t,n){return{jsonrpc:e.JSONRPC,method:t,params:n}}})),Uo=y((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DefaultErrorCode=void 0,e.DefaultErrorCode=0})),Wo=y((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0}),e.JSONRPCClient=void 0;var r=Ho(),i=Uo();e.JSONRPCClient=function(){function e(e,t){this._send=e,this.createID=t,this.idToResolveMap=new Map,this.id=0}return e.prototype._createID=function(){return this.createID?this.createID():++this.id},e.prototype.timeout=function(e,t){var n=this;t===void 0&&(t=function(e){return(0,r.createJSONRPCErrorResponse)(e,i.DefaultErrorCode,`Request timeout`)});var o=function(r,i){var a=setTimeout(function(){r.forEach(function(e){var r=n.idToResolveMap.get(e);r&&(n.idToResolveMap.delete(e),r(t(e)))})},e);return i().then(function(e){return clearTimeout(a),e},function(e){return clearTimeout(a),Promise.reject(e)})},s=function(e,t){return o((Array.isArray(e)?e:[e]).map(function(e){return e.id}).filter(a),function(){return n.requestAdvanced(e,t)})};return{request:function(e,t,r){var i=n._createID();return o([i],function(){return n.requestWithID(e,t,r,i)})},requestAdvanced:function(e,t){return s(e,t)}}},e.prototype.request=function(e,t,n){return this.requestWithID(e,t,n,this._createID())},e.prototype.requestWithID=function(e,i,a,o){return t(this,void 0,void 0,function(){var t,s;return n(this,function(n){switch(n.label){case 0:return t=(0,r.createJSONRPCRequest)(o,e,i),[4,this.requestAdvanced(t,a)];case 1:return s=n.sent(),s.result!==void 0&&!s.error?[2,s.result]:s.result===void 0&&s.error?[2,Promise.reject(new r.JSONRPCErrorException(s.error.message,s.error.code,s.error.data))]:[2,Promise.reject(Error(`An unexpected error occurred`))]}})})},e.prototype.requestAdvanced=function(e,t){var n=this,o=Array.isArray(e);Array.isArray(e)||(e=[e]);var s=e.filter(function(e){return a(e.id)}),c=s.map(function(e){return new Promise(function(t){return n.idToResolveMap.set(e.id,t)})}),l=Promise.all(c).then(function(e){return o||!e.length?e:e[0]});return this.send(o?e:e[0],t).then(function(){return l},function(e){return s.forEach(function(t){n.receive((0,r.createJSONRPCErrorResponse)(t.id,i.DefaultErrorCode,e&&e.message||`Failed to send a request`))}),l})},e.prototype.notify=function(e,t,n){var i=(0,r.createJSONRPCNotification)(e,t);this.send(i,n).then(void 0,function(){})},e.prototype.send=function(e,r){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this._send(e,r)]})})},e.prototype.rejectAllPendingRequests=function(e){this.idToResolveMap.forEach(function(t,n){return t((0,r.createJSONRPCErrorResponse)(n,i.DefaultErrorCode,e))}),this.idToResolveMap.clear()},e.prototype.receive=function(e){var t=this;Array.isArray(e)||(e=[e]),e.forEach(function(e){var n=t.idToResolveMap.get(e.id);n&&(t.idToResolveMap.delete(e.id),n(e))})},e}();var a=function(e){return e!=null}})),Go=y((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),Ko=y((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},r=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}},i=e&&e.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(e,`__esModule`,{value:!0}),e.JSONRPCServer=void 0;var a=Ho(),o=Uo(),s=function(){return(0,a.createJSONRPCErrorResponse)(null,a.JSONRPCErrorCode.ParseError,`Parse error`)},c=function(e){return(0,a.createJSONRPCErrorResponse)((0,a.isJSONRPCID)(e.id)?e.id:null,a.JSONRPCErrorCode.InvalidRequest,`Invalid Request`)},l=function(e){return(0,a.createJSONRPCErrorResponse)(e,a.JSONRPCErrorCode.MethodNotFound,`Method not found`)};e.JSONRPCServer=function(){function e(e){e===void 0&&(e={}),this.mapErrorToJSONRPCErrorResponse=p,this.nameToMethodDictionary={},this.middleware=null,this.errorListener=e.errorListener??console.warn}return e.prototype.hasMethod=function(e){return!!this.nameToMethodDictionary[e]},e.prototype.addMethod=function(e,t){this.addMethodAdvanced(e,this.toJSONRPCMethod(t))},e.prototype.removeMethod=function(e){delete this.nameToMethodDictionary[e]},e.prototype.toJSONRPCMethod=function(e){return function(t,n){var r=e(t.params,n);return Promise.resolve(r).then(function(e){return f(t.id,e)})}},e.prototype.addMethodAdvanced=function(e,n){var r;this.nameToMethodDictionary=t(t({},this.nameToMethodDictionary),(r={},r[e]=n,r))},e.prototype.receiveJSON=function(e,t){var n=this.tryParseRequestJSON(e);return n?this.receive(n,t):Promise.resolve(s())},e.prototype.tryParseRequestJSON=function(e){try{return JSON.parse(e)}catch{return null}},e.prototype.receive=function(e,t){return Array.isArray(e)?this.receiveMultiple(e,t):this.receiveSingle(e,t)},e.prototype.receiveMultiple=function(e,t){return n(this,void 0,void 0,function(){var n,i=this;return r(this,function(r){switch(r.label){case 0:return[4,Promise.all(e.map(function(e){return i.receiveSingle(e,t)}))];case 1:return n=r.sent().filter(u),n.length===1?[2,n[0]]:n.length?[2,n]:[2,null]}})})},e.prototype.receiveSingle=function(e,t){return n(this,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return n=this.nameToMethodDictionary[e.method],(0,a.isJSONRPCRequest)(e)?[3,1]:[2,c(e)];case 1:return[4,this.callMethod(n,e,t)];case 2:return i=r.sent(),[2,m(e,i)]}})})},e.prototype.applyMiddleware=function(){var e=[...arguments];this.middleware?this.middleware=this.combineMiddlewares(i([this.middleware],e,!0)):this.middleware=this.combineMiddlewares(e)},e.prototype.combineMiddlewares=function(e){return e.length?e.reduce(this.middlewareReducer):null},e.prototype.middlewareReducer=function(e,t){return function(n,r,i){return e(function(e,r){return t(n,e,r)},r,i)}},e.prototype.callMethod=function(e,t,n){var r=this,i=function(t,n){return e?e(t,n):t.id===void 0?Promise.resolve(null):Promise.resolve(l(t.id))},a=function(e){return r.errorListener(`An unexpected error occurred while executing "${t.method}" JSON-RPC method:`,e),Promise.resolve(r.mapErrorToJSONRPCErrorResponseIfNecessary(t.id,e))};try{return(this.middleware||d)(i,t,n).then(void 0,a)}catch(e){return a(e)}},e.prototype.mapErrorToJSONRPCErrorResponseIfNecessary=function(e,t){return e===void 0?null:this.mapErrorToJSONRPCErrorResponse(e,t)},e}();var u=function(e){return e!==null},d=function(e,t,n){return e(t,n)},f=function(e,t){return e===void 0?null:(0,a.createJSONRPCSuccessResponse)(e,t)},p=function(e,t){var n=t?.message??`An unexpected error occurred`,r=o.DefaultErrorCode,i;return t instanceof a.JSONRPCErrorException&&(r=t.code,i=t.data),(0,a.createJSONRPCErrorResponse)(e,r,n,i)},m=function(e,t){return t||(e.id===void 0?null:(0,a.createJSONRPCErrorResponse)(e.id,a.JSONRPCErrorCode.InternalError,`Internal error`))}})),qo=y((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0}),e.JSONRPCServerAndClient=void 0;var r=Ho();e.JSONRPCServerAndClient=function(){function e(e,t,n){n===void 0&&(n={}),this.server=e,this.client=t,this.errorListener=n.errorListener??console.warn}return e.prototype.applyServerMiddleware=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this.server).applyMiddleware.apply(e,t)},e.prototype.hasMethod=function(e){return this.server.hasMethod(e)},e.prototype.addMethod=function(e,t){this.server.addMethod(e,t)},e.prototype.addMethodAdvanced=function(e,t){this.server.addMethodAdvanced(e,t)},e.prototype.removeMethod=function(e){this.server.removeMethod(e)},e.prototype.timeout=function(e){return this.client.timeout(e)},e.prototype.request=function(e,t,n){return this.client.request(e,t,n)},e.prototype.requestAdvanced=function(e,t){return this.client.requestAdvanced(e,t)},e.prototype.notify=function(e,t,n){this.client.notify(e,t,n)},e.prototype.rejectAllPendingRequests=function(e){this.client.rejectAllPendingRequests(e)},e.prototype.receiveAndSend=function(e,i,a){return t(this,void 0,void 0,function(){var t,o;return n(this,function(n){switch(n.label){case 0:return(0,r.isJSONRPCResponse)(e)||(0,r.isJSONRPCResponses)(e)?(this.client.receive(e),[3,4]):[3,1];case 1:return(0,r.isJSONRPCRequest)(e)||(0,r.isJSONRPCRequests)(e)?[4,this.server.receive(e,i)]:[3,3];case 2:return t=n.sent(),t?[2,this.client.send(t,a)]:[3,4];case 3:return o=`Received an invalid JSON-RPC message`,this.errorListener(o,e),[2,Promise.reject(Error(o))];case 4:return[2]}})})},e}()})),Jo=y((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(Wo(),e),n(Go(),e),n(Ho(),e),n(Ko(),e),n(qo(),e)}));function Yo(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`{`){n&&=(t.push({type:`literal`,value:n}),``);let i=r+1,a=i,o=1;for(;a<e.length&&o>0;)e[a]===`{`?o++:e[a]===`}`&&o--,a++;if(o>0)throw Error(`Unclosed expression in template: ${e}`);let s=Xo(e.slice(i,a-1));t.push(s),r=a}else n+=i,r++}return n&&t.push({type:`literal`,value:n}),{template:e,parts:t}}function Xo(e){if(!e.trim())throw Error(`Empty expression`);let t=e[0],n=[`+`,`#`,`.`,`/`,`;`,`?`,`&`],r,i=e;return n.includes(t)&&(r=t,i=e.slice(1)),{type:`expression`,expressions:Zo(i).map(Qo),operator:r}}function Zo(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];i===`,`?n.trim()&&(t.push(n.trim()),n=``):n+=i,r++}return n.trim()&&t.push(n.trim()),t}function Qo(e){let t=e,n,r=!1;t.endsWith(`*`)&&(r=!0,t=t.slice(0,-1));let i=t.indexOf(`:`);if(i!==-1){let e=t.slice(i+1);if(n=parseInt(e,10),isNaN(n)||n<0)throw Error(`Invalid prefix length: ${e}`);t=t.slice(0,i)}if(!t)throw Error(`Empty variable name`);return{name:t,prefix:n,explode:r}}function $o(e,t){let n={},r=es(e,0,t.parts,0,n);return!r||r.uri_index!==e.length?null:n}function es(e,t,n,r,i){if(r>=n.length)return{uri_index:t};let a=n[r];if(a.type===`literal`)return e.slice(t).startsWith(a.value)?es(e,t+a.value.length,n,r+1,i):null;{let o=n[r+1],s=ts(e,t,o).sort((e,t)=>o&&o.type===`expression`&&!o.operator?t-e:e-t);for(let o of s){let s=e.slice(t,o),c={...i};if(ns(s,a,c,e,t)){let t=es(e,o,n,r+1,c);if(t)return Object.assign(i,c),t}}return null}}function ts(e,t,n){let r=[];if(n&&n.type===`literal`){let i=t;for(;i<e.length;){let t=e.indexOf(n.value,i);if(t===-1)break;r.push(t),i=t+1}if(r.length===0)return[]}else if(n&&n.type===`expression`){let i=n;if(i.operator===`.`){for(let n=t;n<e.length;n++)e[n]===`.`&&r.push(n);r.push(e.length)}else if(i.operator===`/`)for(let n=t;n<e.length;n++)e[n]===`/`&&r.push(n);else for(let n=t;n<=e.length;n++)r.push(n)}else r.push(e.length);return r.sort((e,t)=>e-t)}function ns(e,t,n,r,i){if(t.type!==`expression`)return!1;switch(t.operator){case`+`:return is(e,t,n);case`#`:return rs(e,t,n);case`.`:return os(e,t,n);case`/`:return ss(e,t,n);case`;`:return cs(e,t,n);case`?`:case`&`:return ls(e,t,n);default:return as(e,t,n,r,i)}}function rs(e,t,n){if(t.type!==`expression`)return!1;if(!e.startsWith(`#`)){for(let e of t.expressions)n[e.name]=``;return e===``}let r=e.slice(1);if(t.expressions.length===1){let e=t.expressions[0],i=r;return e.prefix&&i.length>e.prefix&&(i=i.slice(0,e.prefix)),n[e.name]=decodeURIComponent(i),!0}else{let e=r.split(`,`);for(let r=0;r<t.expressions.length;r++){let i=t.expressions[r],a=e[r]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function is(e,t,n){if(t.type!==`expression`)return!1;if(t.expressions.length===1){let r=t.expressions[0],i=e;return r.prefix&&i.length>r.prefix&&(i=i.slice(0,r.prefix)),n[r.name]=decodeURIComponent(i),!0}else{let r=e.split(`,`);for(let e=0;e<t.expressions.length;e++){let i=t.expressions[e],a=r[e]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function as(e,t,n,r,i){if(t.type!==`expression`)return!1;if(t.expressions.length===1){let a=t.expressions[0],o=e;return o.includes(`/`)||o===``&&i+e.length===r.length&&r.endsWith(`/`)?!1:(a.prefix&&o.length>a.prefix&&(o=o.slice(0,a.prefix)),n[a.name]=decodeURIComponent(o),!0)}else{let r=e.split(`,`);for(let e=0;e<t.expressions.length;e++){let i=t.expressions[e],a=r[e]||``;if(a.includes(`/`))return!1;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function os(e,t,n){if(t.type!==`expression`)return!1;if(e===``){for(let e of t.expressions)n[e.name]=``;return!0}let r=e.startsWith(`.`)?e.slice(1):e;if(t.expressions.length===1){let e=t.expressions[0];if(e.explode){let t=r.split(`.`);n[e.name]=t.map(e=>decodeURIComponent(e))}else n[e.name]=decodeURIComponent(r);return!0}else{let e=r.split(`.`);for(let r=0;r<t.expressions.length;r++){let i=t.expressions[r],a=e[r]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function ss(e,t,n){if(t.type!==`expression`)return!1;let r=e.startsWith(`/`)?e.slice(1):e;if(t.expressions.length===1){let e=t.expressions[0];return n[e.name]=decodeURIComponent(r),!0}else{let e=r.split(`,`);for(let r=0;r<t.expressions.length;r++){let i=t.expressions[r],a=e[r]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function cs(e,t,n){if(t.type!==`expression`)return!1;let r=e.split(`;`).filter(e=>e);for(let e of r){let r=e.indexOf(`=`);if(r!==-1){let i=e.slice(0,r),a=e.slice(r+1),o=t.expressions.find(e=>e.name===i);o&&(n[o.name]=decodeURIComponent(a))}}return!0}function ls(e,t,n){if(t.type!==`expression`)return!1;let r=e.replace(/^[?&]/,``);if(t.expressions.length===1){let e=t.expressions[0];if(e.explode){let t=r.split(`&`);n[e.name]=t.map(e=>decodeURIComponent(e))}else{let t=r.split(`&`);for(let r of t){let t=r.indexOf(`=`);if(t!==-1){let i=r.slice(0,t),a=r.slice(t+1);i===e.name&&(n[e.name]=decodeURIComponent(a))}}}}else{let e=r.split(`&`);for(let r of e){let e=r.indexOf(`=`);if(e!==-1){let i=r.slice(0,e),a=r.slice(e+1),o=t.expressions.find(e=>e.name===i);o&&(n[o.name]=decodeURIComponent(a))}}}return!0}var us=class{constructor(){this.templates=[]}add(e){if(typeof e!=`string`)throw Error(`Template must be a string`);if(e!==``&&e.trim()===``)throw Error(`Template cannot be empty`);try{let t=Yo(e);this.templates.push(t)}catch(t){throw Error(`Invalid template: ${e} - ${t instanceof Error?t.message:String(t)}`)}}match(e){if(typeof e!=`string`)throw Error(`URI must be a string`);for(let t of this.templates){let n=$o(e,t);if(n!==null)return{template:t.template,params:n}}return null}clear(){this.templates=[]}all(){return this.templates.map(e=>e.template)}},ds=Jo(),fs=x(Vo(),1),ps;function ms(e){return{lang:e?.lang??ps?.lang,message:e?.message,abortEarly:e?.abortEarly??ps?.abortEarly,abortPipeEarly:e?.abortPipeEarly??ps?.abortPipeEarly}}var hs;function gs(e){return hs?.get(e)}var _s;function vs(e){return _s?.get(e)}var ys;function bs(e,t){return ys?.get(e)?.get(t)}function xs(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function H(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??xs(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??bs(e.reference,c.lang)??(l?vs(c.lang):null)??r.message??gs(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function U(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},ms())}}}function Ss(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function Cs(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var ws=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}},Ts=/^(?:[\da-z+/]{4})*(?:[\da-z+/]{2}==|[\da-z+/]{3}=)?$/iu;function Es(e){return{kind:`validation`,type:`base64`,reference:Es,async:!1,expects:null,requirement:Ts,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&H(this,`Base64`,e,t),e}}}function Ds(e,t){return{kind:`validation`,type:`check`,reference:Ds,async:!1,expects:null,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&H(this,`input`,e,t),e}}}function Os(e){return{kind:`validation`,type:`integer`,reference:Os,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&H(this,`integer`,e,t),e}}}function ks(e,t){return{kind:`validation`,type:`max_length`,reference:ks,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length>this.requirement&&H(this,`length`,e,t,{received:`${e.value.length}`}),e}}}function As(e,t){return{kind:`validation`,type:`max_value`,reference:As,async:!1,expects:`<=${e instanceof Date?e.toJSON():xs(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value<=this.requirement)&&H(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():xs(e.value)}),e}}}function js(e,t){return{kind:`validation`,type:`min_value`,reference:js,async:!1,expects:`>=${e instanceof Date?e.toJSON():xs(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value>=this.requirement)&&H(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():xs(e.value)}),e}}}function Ms(e,t){return{kind:`validation`,type:`regex`,reference:Ms,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&H(this,`format`,e,t),e}}}function Ns(e,t){return{kind:`validation`,type:`starts_with`,reference:Ns,async:!1,expects:`"${e}"`,requirement:e,message:t,"~run"(e,t){return e.typed&&!e.value.startsWith(this.requirement)&&H(this,`start`,e,t,{received:`"${e.value.slice(0,this.requirement.length)}"`}),e}}}function Ps(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Fs(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function Is(e,t){return{kind:`schema`,type:`array`,reference:Is,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return U(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else H(this,`type`,e,t);return e}}}function Ls(e){return{kind:`schema`,type:`boolean`,reference:Ls,expects:`boolean`,async:!1,message:e,get"~standard"(){return U(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:H(this,`type`,e,t),e}}}function Rs(e,t){return{kind:`schema`,type:`literal`,reference:Rs,expects:xs(e),async:!1,literal:e,message:t,get"~standard"(){return U(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:H(this,`type`,e,t),e}}}function W(e,t){return{kind:`schema`,type:`loose_object`,reference:W,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return U(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Fs(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=Ps(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(H(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(let t in n)Ss(n,t)&&!(t in this.entries)&&(e.value[t]=n[t])}else H(this,`type`,e,t);return e}}}function G(e){return{kind:`schema`,type:`number`,reference:G,expects:`number`,async:!1,message:e,get"~standard"(){return U(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:H(this,`type`,e,t),e}}}function K(e,t){return{kind:`schema`,type:`object`,reference:K,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return U(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`)for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Fs(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=Ps(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(H(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}else H(this,`type`,e,t);return e}}}function q(e,t){return{kind:`schema`,type:`optional`,reference:q,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return U(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=Fs(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function zs(e,t){return{kind:`schema`,type:`picklist`,reference:zs,expects:Cs(e.map(xs),`|`),async:!1,options:e,message:t,get"~standard"(){return U(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:H(this,`type`,e,t),e}}}function Bs(e,t,n){return{kind:`schema`,type:`record`,reference:Bs,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return U(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},n)if(Ss(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else H(this,`type`,e,t);return e}}}function Vs(e,t){return{kind:`schema`,type:`strict_object`,reference:Vs,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return U(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Fs(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=Ps(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(H(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly){for(let r in n)if(!(r in this.entries)){H(this,`key`,e,t,{input:r,expected:`never`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]});break}}}else H(this,`type`,e,t);return e}}}function J(e){return{kind:`schema`,type:`string`,reference:J,expects:`string`,async:!1,message:e,get"~standard"(){return U(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:H(this,`type`,e,t),e}}}function Hs(e){let t;if(e)for(let n of e)t?t.push(...n.issues):t=n.issues;return t}function Us(e,t){return{kind:`schema`,type:`union`,reference:Us,expects:Cs(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,get"~standard"(){return U(this)},"~run"(e,t){let n,r,i;for(let a of this.options){let o=a[`~run`]({value:e.value},t);if(o.typed)if(o.issues)r?r.push(o):r=[o];else{n=o;break}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];H(this,`type`,e,t,{issues:Hs(r)}),e.typed=!0}else if(i?.length===1)return i[0];else H(this,`type`,e,t,{issues:Hs(i)});return e}}}function Ws(){return{kind:`schema`,type:`unknown`,reference:Ws,expects:`unknown`,async:!1,get"~standard"(){return U(this)},"~run"(e){return e.typed=!0,e}}}function Gs(e,t,n){return{kind:`schema`,type:`variant`,reference:Gs,expects:`Object`,async:!1,key:e,options:t,message:n,get"~standard"(){return U(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){let r,i=0,a=this.key,o=[],s=(e,c)=>{for(let l of e.options){if(l.type===`variant`)s(l,new Set(c).add(l.key));else{let e=!0,s=0;for(let t of c){let r=l.entries[t];if(t in n?r[`~run`]({typed:!1,value:n[t]},{abortEarly:!0}).issues:r.type!==`exact_optional`&&r.type!==`optional`&&r.type!==`nullish`){e=!1,a!==t&&(i<s||i===s&&t in n&&!(a in n))&&(i=s,a=t,o=[]),a===t&&o.push(l.entries[t].expects);break}s++}if(e){let e=l[`~run`]({value:n},t);(!r||!r.typed&&e.typed)&&(r=e)}}if(r&&!r.issues)break}};if(s(this,new Set([this.key])),r)return r;H(this,`type`,e,t,{input:n[a],expected:Cs(o,`|`),path:[{type:`object`,origin:`value`,input:n,key:a,value:n[a]}]})}else H(this,`type`,e,t);return e}}}function Ks(e,t,n){let r=e[`~run`]({value:t},ms(n));if(r.issues)throw new ws(r.issues);return r.value}function Y(...e){return{...e[0],pipe:e,get"~standard"(){return U(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}function qs(e,t,n){let r=e[`~run`]({value:t},ms(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var X=class extends Error{constructor(e,t){super(`MCP error ${e}: ${t}`),this.name=`McpError`}};const Js=Us([J(),Y(G(),Os())]),Ys=J(),Z=W({_meta:q(W({progressToken:q(Js)}))}),Q=K({method:J(),params:q(Z)}),Xs=W({_meta:q(W({}))}),Zs=K({method:J(),params:q(Xs)}),$=W({_meta:q(W({}))}),Qs=Us([J(),Y(G(),Os())]),$s=K({jsonrpc:Rs(`2.0`),id:Qs,...Q.entries}),ec=K({jsonrpc:Rs(`2.0`),...Zs.entries}),tc=Vs({jsonrpc:Rs(`2.0`),id:Qs,result:$}),nc=Vs({jsonrpc:Rs(`2.0`),id:Qs,error:K({code:Y(G(),Os()),message:J(),data:q(Ws())})});({...$.entries}),{...Zs.entries},{...Xs.entries};const rc=K({name:J(),title:q(J())}),ic=K({icons:q(Is(K({src:J(),mimeType:q(J()),sizes:q(Is(J()))})))}),ac=K({...rc.entries,version:J(),websiteUrl:q(J()),...ic.entries}),oc=K({experimental:q(K({})),sampling:q(K({})),elicitation:q(K({})),roots:q(K({listChanged:q(Ls())}))}),sc=K({...Z.entries,protocolVersion:J(),capabilities:oc,clientInfo:ac});({...Q.entries}),{...$.entries},{...Zs.entries},{...Q.entries};const cc=K({progress:G(),total:q(G()),message:q(J())});({...Zs.entries}),{...Xs.entries,...cc.entries};const lc=K({...Q.entries,params:q(K({...Z.entries,cursor:q(Ys)}))}),uc=K({...$.entries,nextCursor:q(Ys)}),dc=K({uri:J(),mimeType:q(J()),_meta:q(W({}))}),fc=K({...dc.entries,text:J()}),pc=K({...dc.entries,blob:Y(J(),Es())}),mc=K({...rc.entries,uri:J(),description:q(J()),mimeType:q(J()),_meta:q(W({})),...ic.entries});({...rc.entries}),{...ic.entries},{...lc.entries},{...uc.entries},{...lc.entries},{...uc.entries},{...Q.entries},{...Z.entries};const hc=K({...$.entries,contents:Is(Us([fc,pc]))});({...Zs.entries}),{...Q.entries},{...Z.entries},{...Q.entries},{...Z.entries},{...Zs.entries},{...Xs.entries},{...rc.entries},{...ic.entries},{...lc.entries},{...uc.entries},{...Q.entries},{...Z.entries};const gc=K({type:Rs(`text`),text:J(),_meta:q(W({}))}),_c=K({type:Rs(`image`),data:Y(J(),Es()),mimeType:J(),_meta:q(W({}))}),vc=K({type:Rs(`audio`),data:Y(J(),Es()),mimeType:J(),_meta:q(W({}))}),yc=K({type:Rs(`resource`),resource:Us([fc,pc]),_meta:q(W({}))}),bc=Us([gc,_c,vc,K({...mc.entries,type:Rs(`resource_link`)}),yc]),xc=K({role:zs([`user`,`assistant`]),content:bc}),Sc=K({...$.entries,description:q(J()),messages:Is(xc)});({...Zs.entries}),{...rc.entries},{...ic.entries},{...lc.entries},{...uc.entries};const Cc=K({...$.entries,content:q(Is(bc),[]),structuredContent:q(W({})),isError:q(Ls())});({...$.entries}),{...Q.entries},{...Z.entries},{...Zs.entries},{...Q.entries},{...Z.entries},{...Zs.entries},{...Xs.entries};const wc=K({hints:q(Is(K({name:q(J())}))),costPriority:q(Y(G(),js(0),As(1))),speedPriority:q(Y(G(),js(0),As(1))),intelligencePriority:q(Y(G(),js(0),As(1)))}),Tc=K({role:zs([`user`,`assistant`]),content:Us([gc,_c,vc])}),Ec=K({...Z.entries,messages:Is(Tc),systemPrompt:q(J()),includeContext:q(zs([`none`,`thisServer`,`allServers`])),temperature:q(G()),maxTokens:Y(G(),Os()),stopSequences:q(Is(J())),metadata:q(K({})),modelPreferences:q(wc)});({...Q.entries});const Dc=K({...$.entries,model:J(),stopReason:q(Us([zs([`endTurn`,`stopSequence`,`maxTokens`]),J()])),role:zs([`user`,`assistant`]),content:Gs(`type`,[gc,_c,vc])});({...Q.entries}),{...Z.entries};const Oc=K({...$.entries,action:zs([`accept`,`decline`,`cancel`]),content:q(Bs(J(),Ws()))});({...Q.entries}),{...Z.entries};const kc=K({...$.entries,completion:K({values:Y(Is(J()),ks(100)),total:q(Y(G(),Os())),hasMore:q(Ls())})});({...Q.entries}),{...$.entries},{...Zs.entries};const Ac=[`2025-06-18`,`2025-03-26`,`2024-11-05`],jc=Ac[0];function Mc(e){return Ac.includes(e)}function Nc(){return jc}function Pc(){return[...Ac]}function Fc(e){return Mc(e)?e:Nc()}function Ic(e){try{let t=new Date(e);return!/^\d{4}-\d{2}-\d{2}$/.test(e)||isNaN(t.getTime())}catch{return!0}}function Lc(e,t){return new CustomEvent(e,{detail:t})}let Rc;async function zc(){return Rc||=new(await(import(`./sqids-BiDaWurc.mjs`))).default,Rc}async function Bc(e){return(await zc()).encode([e])}async function Vc(e){let[t]=(await zc()).decode(e);return t}async function Hc(e){try{return await e()}catch{return!1}}var Uc=class{#e=new ds.JSONRPCServer;#t;#n;#r=new Map;#i=new Map;#a=new Map;#o=new us;roots=[];#s={"ref/prompt":new Map,"ref/resource":new Map};#c=new EventTarget;#l=new m;constructor(e,t){this.#n=t,this.#e.addMethod(`initialize`,n=>{try{let r=Ks(sc,n);if(Ic(r.protocolVersion))throw new X(-32602,`Invalid protocol version format`);let i=Fc(r.protocolVersion);return this.#c.dispatchEvent(Lc(`initialize`,r)),{protocolVersion:i,...t,serverInfo:e}}catch(e){throw e instanceof X?e:e.message?.includes(`Protocol version`)?new X(-32602,`Protocol version validation failed: ${e.message}. Server supports: ${Pc().join(`, `)}`):new X(-32603,`Initialization failed: ${e.message}`)}}),this.#e.addMethod(`ping`,()=>({})),this.#e.addMethod(`notifications/initialized`,()=>null),this.#m(),this.#h(),this.#g(),this.#_(),this.#y(),this.#b()}withContext(){return this}get#u(){return this.#l.getStore()?.progress_token}get ctx(){let{progress_token:e,...t}=this.#l.getStore()??{};return t}get#d(){return this.#l.getStore()?.sessionInfo?.clientCapabilities}currentClientInfo(){return this.#l.getStore()?.sessionInfo?.clientInfo}currentClientCapabilities(){return this.#d}#f(){this.#t||=new ds.JSONRPCClient((e,t)=>{if(t===`broadcast`){this.#c.dispatchEvent(Lc(`broadcast`,{request:e}));return}this.#c.dispatchEvent(Lc(`send`,{request:e}))})}on(e,t,n){(e===`send`||e===`broadcast`)&&this.#f();let r=e=>{t(e.detail)};return this.#c.addEventListener(e,r,n),()=>{this.#c.removeEventListener(e,r,n)}}#p(e,t,n=`standalone`){this.#t?.notify(e,t,n)}#m(){this.#n.capabilities?.tools&&(this.#e.addMethod(`tools/list`,async({cursor:e}={})=>{let t=(await Promise.all([...this.#r].map(async([e,t])=>t.enabled!=null&&await Hc(t.enabled)===!1?null:{name:e,title:t.title||t.description,description:t.description,icons:t.icons,_meta:t._meta,inputSchema:t.schema&&this.#n.adapter?await this.#n.adapter.toJsonSchema(t.schema):{type:`object`,properties:{}},...t.outputSchema&&this.#n.adapter?{outputSchema:await this.#n.adapter.toJsonSchema(t.outputSchema)}:{},...t.annotations?{annotations:t.annotations}:{}}))).filter(e=>e!==null),n=this.#n.pagination?.tools;if(!n||n.size==null)return{tools:t};let r=n.size,i=e?await Vc(e):0,a=i+r,o=t.slice(i,a),s=a<t.length?await Bc(a):null;return{tools:o,...s&&{nextCursor:s}}}),this.#e.addMethod(`tools/call`,async({name:e,arguments:t})=>{let n=this.#r.get(e);if(!n)return{isError:!0,content:[{type:`text`,text:`Tool ${e} not found`}]};let r=t;if(n.schema){let i=n.schema[`~standard`].validate(t);if(i instanceof Promise&&(i=await i),i.issues)return{isError:!0,content:[{type:`text`,text:`Invalid arguments for tool ${e}: ${JSON.stringify(i.issues)}`}]};r=i.value}let i=Ks(Cc,n.schema?await n.execute(r):await n.execute());if(n.outputSchema&&i.structuredContent!==void 0){let t=n.outputSchema[`~standard`].validate(i.structuredContent);if(t instanceof Promise&&(t=await t),t.issues)return{isError:!0,content:[{type:`text`,text:`Tool ${e} returned invalid structured content: ${JSON.stringify(t.issues)}`}]};i.structuredContent=t.value}return i}))}#h(){this.#n.capabilities?.prompts&&(this.#e.addMethod(`prompts/list`,async({cursor:e}={})=>{let t=(await Promise.all([...this.#i].map(async([e,t])=>{if(t.enabled!=null&&await Hc(t.enabled)===!1)return null;let n=t.schema&&this.#n.adapter?await this.#n.adapter.toJsonSchema(t.schema):{type:`object`,properties:{},required:[]},r=Object.keys(n.properties??{}),i=n.required??[];return{name:e,title:t.title||t.description,icons:t.icons,description:t.description,arguments:r.map(e=>{let t=n.properties?.[e],r=t&&t!==!0?t.description:e;return{name:e,required:i.includes(e),description:r}})}}))).filter(e=>e!==null),n=this.#n.pagination?.prompts;if(!n||n.size==null)return{prompts:t};let r=n.size,i=e?await Vc(e):0,a=i+r,o=t.slice(i,a),s=a<t.length?await Bc(a):null;return{prompts:o,...s&&{nextCursor:s}}}),this.#e.addMethod(`prompts/get`,async({name:e,arguments:t})=>{let n=this.#i.get(e);if(!n)throw new X(-32601,`Prompt ${e} not found`);if(!n.schema)return Ks(Sc,await n.execute());let r=n.schema[`~standard`].validate(t);if(r instanceof Promise&&(r=await r),r.issues)throw new X(-32602,`Invalid arguments for prompt ${e}: ${JSON.stringify(r.issues)}`);return Ks(Sc,await n.execute(r.value))}))}#g(){this.#n.capabilities?.resources&&(this.#n.capabilities?.resources?.subscribe&&(this.#e.addMethod(`resources/subscribe`,async({uri:e})=>(this.#c.dispatchEvent(Lc(`subscription`,{uri:e,action:`add`})),{})),this.#e.addMethod(`resources/unsubscribe`,async({uri:e})=>(this.#c.dispatchEvent(Lc(`subscription`,{uri:e,action:`remove`})),{}))),this.#e.addMethod(`resources/list`,async({cursor:e}={})=>{let t=[];for(let[e,n]of this.#a)if(n.template){if(n.list_resources){if(n.enabled!=null&&await Hc(n.enabled)===!1)continue;let e=await n.list_resources();t.push(...e)}}else{if(n.enabled!=null&&await Hc(n.enabled)===!1)continue;t.push({name:n.name,title:n.title||n.description,description:n.description,uri:e,mimeType:n.mimeType,icons:n.icons})}let n=this.#n.pagination?.resources;if(!n||n.size==null)return{resources:t};let r=n.size,i=e?await Vc(e):0,a=i+r,o=t.slice(i,a),s=a<t.length?await Bc(a):null;return{resources:o,...s&&{nextCursor:s}}}),this.#e.addMethod(`resources/templates/list`,async()=>({resourceTemplates:(await Promise.all([...this.#a].map(async([e,t])=>!t.template||t.enabled!=null&&await Hc(t.enabled)===!1?null:{name:t.name,icons:t.icons,title:t.title||t.description,description:t.description,mimeType:t.mimeType,uriTemplate:e}))).filter(e=>e!=null)})),this.#e.addMethod(`resources/read`,async({uri:e})=>{let t=this.#a.get(e),n;if(!t){let r=this.#o.match(e);if(r&&(t=this.#a.get(r.template),n=r.params),!t)throw new X(-32601,`Resource ${e} not found`)}if(t.template){if(!n)throw new X(-32602,`Missing parameters for template resource`);return Ks(hc,await t.execute(e,n))}return Ks(hc,await t.execute(e))}))}#_(){this.#e.addMethod(`notifications/roots/list_changed`,()=>(this.#v(),null))}async#v(){if(this.#d?.roots){this.#f();try{this.roots=(await this.#t?.request(`roots/list`,void 0,`standalone`))?.roots||[]}catch{this.roots=[]}}}#y(){this.#e.addMethod(`completion/complete`,async({argument:e,ref:t,context:n})=>{let r=this.#s[t.type];if(!r)return null;let i=r.get(t.uri??t.name);if(!i)return null;let a=i[e.name];return a?Ks(kc,await a(e.value,n)):null})}#b(){this.#n.capabilities?.logging&&this.#e.addMethod(`logging/setLevel`,({level:e})=>(this.#c.dispatchEvent(Lc(`loglevelchange`,{level:e})),{}))}#x(){this.#n.capabilities?.tools?.listChanged&&this.#p(`notifications/tools/list_changed`,{},`broadcast`)}#S(){this.#n.capabilities?.prompts?.listChanged&&this.#p(`notifications/prompts/list_changed`,{},`broadcast`)}#C(){this.#n.capabilities?.resources?.listChanged&&this.#p(`notifications/resources/list_changed`,{},`broadcast`)}tools(e){for(let t of e)this.tool(t)}prompts(e){for(let t of e)this.prompt(t)}resources(e){for(let t of e)this.resource(t)}templates(e){for(let t of e)this.template(t)}tool(e,t){`execute`in e&&(t=e.execute),this.#x();let n=e;n.execute=t,this.#r.set(e.name,n)}prompt(e,t){`execute`in e&&(t=e.execute),e.complete&&this.#s[`ref/prompt`].set(e.name,e.complete),this.#S();let n=e;n.execute=t,this.#i.set(e.name,n)}#w(e){e.template&&e.complete&&this.#s[`ref/resource`].set(e.uri,e.complete),e.template&&this.#o.add(e.uri),this.#C(),this.#a.set(e.uri,e)}resource(e,t){`execute`in e&&(t=e.execute);let n=e;n.execute=t,n.template=!1,this.#w(n)}template(e,t){`execute`in e&&(t=e.execute);let n=e;n.execute=t,n.list_resources=e.list,n.template=!0,this.#w(n)}receive(e,t){let n=qs(Us([$s,ec]),e);if(n.success){let e=n.output.params?._meta?.progressToken;return this.#l.run({...t??{},progress_token:e},async()=>await this.#e.receive(n.output))}let r=Ks(Us([tc,nc]),e);return this.#f(),this.#l.run(t??{},async()=>this.#t?.receive(r))}async request({method:e,params:t}){return this.#f(),this.#t?.request(e,t,`standalone`)}changed(...e){let[t,n]=e;if(t===`prompts`)this.#S();else if(t===`tools`)this.#x();else if(t===`resources`)this.#C();else{let e=this.#a.get(n);if(!e)return;this.#p(`notifications/resources/updated`,{uri:n,title:e.name},`broadcast`)}}async refreshRoots(){await this.#v()}async elicitation(e,t){if(!this.#d?.elicitation)throw new X(-32601,`Client doesn't support elicitation`);this.#f();let n=Ks(Oc,await this.#t?.request(`elicitation/create`,{message:e,requestedSchema:await this.#n.adapter?.toJsonSchema(t)},`standalone`)),r=t[`~standard`].validate(n.content);if(r instanceof Promise&&(r=await r),r.issues)throw new X(-32603,`Invalid elicitation result: ${JSON.stringify(r.issues)}`);return{...n,content:r.value}}async message(e){if(!this.#d?.sampling)throw new X(-32601,`Client doesn't support sampling`);this.#f();let t=Ks(Ec,e);return Ks(Dc,await this.#t?.request(`sampling/createMessage`,t,`standalone`))}progress(e,t=1,n=void 0){this.#u!=null&&this.#p(`notifications/progress`,{progress:e,total:t,message:n,progressToken:this.#u})}log(e,t,n){if(!this.#n.capabilities?.logging)throw new X(-32601,`The server doesn't support logging, please enable it in capabilities`);let r=this.#l.getStore()?.sessionInfo?.logLevel??this.#n.logging?.default??`info`;r&&this.#T(e,r)&&this.#p(`notifications/message`,{level:e,data:t,logger:n})}#T(e,t){let n=[`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`];return n.indexOf(e)>=n.indexOf(t)}},Wc=`0.0.16`;const Gc={cwd:Sa().describe(`The path of the current working directory. Used to find the jsrepo.config file.`)},Kc=new Mo,qc=new Uc({name:`jsrepo`,version:Wc,description:`An MCP server for adding, viewing, and searching items from jsrepo registries.`},{adapter:Kc,capabilities:{tools:{listChanged:!0}}});qc.tool({name:`add_item_to_project`,description:`Add a registry item or items to the users project.`,schema:to({cwd:Gc.cwd,itemNames:$a(Sa().describe('The registry and name of the item to add `<registry>/<item-name>`. i.e. "github/ieedan/std/math", "@ieedan/std/math", "https://example.com/registry/math"')).describe(`Fully qualifed registry items to add. i.e. ["github/ieedan/std/math", "@ieedan/std/math", "https://example.com/registry/math"]`),withExamples:qa().optional().describe(`Add items with examples.`),withDocs:qa().optional().describe(`Add items with docs.`),withTests:qa().optional().describe(`Add items with tests.`)})},async({itemNames:e,...t})=>{let m=await c({cwd:t.cwd,promptForContinueIfNull:!1}),h=m?.config?.providers??l,{wantedItems:ee,neededRegistries:g}=u(e,{providers:h,registries:m?.config?.registries??[]}).match(e=>e,e=>{throw e}),_=(await o((await p(ee,{resolvedRegistries:(await f(g,{cwd:t.cwd,providers:h})).match(e=>e,e=>{throw e}),nonInteractive:!0})).match(e=>e,e=>{throw e}),{options:{withExamples:t.withExamples??!1,withDocs:t.withDocs??!1,withTests:t.withTests??!1}})).match(e=>e,e=>{throw e}),v=await n({items:_,config:m?.config,options:{cwd:t.cwd,yes:!0}});if(v.isErr())return{content:[{type:`text`,text:Ro`
50
- Failed to get paths for items: ${v.error.message}.
49
+ `)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}var Ro=S(((e,t)=>{((e,n)=>{typeof define==`function`&&define.amd?define([],n):typeof t==`object`&&t.exports?t.exports=n():e.fuzzysort=n()})(e,e=>{var t=(e,t)=>{if(!e||!t)return M;var n=p(e);te(t)||(t=f(t));var r=n.bitflags;return(r&t._bitflags)===r?h(n,t):M},n=(e,t,n)=>{if(!e)return n?.all?m(t,n):ne;var r=p(e),i=r.bitflags,a=r.containsSpace,o=u(n?.threshold||0),c=n?.limit||A,l=0,d=0,g=t.length;function _(e){l<c?(ie.add(e),++l):(++d,e._score>ie.peek()._score&&ie.replaceTop(e))}if(n?.key)for(var v=n.key,y=0;y<g;++y){var b=t[y],x=ee(b,v);if(x&&(te(x)||(x=f(x)),(i&x._bitflags)===i)){var S=h(r,x);S!==M&&(S._score<o||(S.obj=b,_(S)))}}else if(n?.keys){var C=n.keys,w=C.length;outer:for(var y=0;y<g;++y){for(var b=t[y],T=0,N=0;N<w;++N){var v=C[N],x=ee(b,v);if(!x){O[N]=re;continue}te(x)||(x=f(x)),O[N]=x,T|=x._bitflags}if((i&T)===i){if(a)for(let e=0;e<r.spaceSearches.length;e++)E[e]=j;for(var N=0;N<w;++N){if(x=O[N],x===re){k[N]=re;continue}if(k[N]=h(r,x,!1,a),k[N]===M){k[N]=re;continue}if(a)for(let e=0;e<r.spaceSearches.length;e++){if(D[e]>-1e3&&E[e]>j){var ae=(E[e]+D[e])/4;ae>E[e]&&(E[e]=ae)}D[e]>E[e]&&(E[e]=D[e])}}if(a){for(let e=0;e<r.spaceSearches.length;e++)if(E[e]===j)continue outer}else{var P=!1;for(let e=0;e<w;e++)if(k[e]._score!==j){P=!0;break}if(!P)continue}var F=new s(w);for(let e=0;e<w;e++)F[e]=k[e];if(a){var I=0;for(let e=0;e<r.spaceSearches.length;e++)I+=E[e]}else{var I=j;for(let e=0;e<w;e++){var S=F[e];if(S._score>-1e3&&I>j){var ae=(I+S._score)/4;ae>I&&(I=ae)}S._score>I&&(I=S._score)}}if(F.obj=b,F._score=I,n?.scoreFn){if(I=n.scoreFn(F),!I)continue;I=u(I),F._score=I}I<o||_(F)}}}else for(var y=0;y<g;++y){var x=t[y];if(x&&(te(x)||(x=f(x)),(i&x._bitflags)===i)){var S=h(r,x);S!==M&&(S._score<o||_(S))}}if(l===0)return ne;for(var oe=Array(l),y=l-1;y>=0;--y)oe[y]=ie.poll();return oe.total=l+d,oe},r=(e,t=`<b>`,n=`</b>`)=>{for(var r=typeof t==`function`?t:void 0,i=e.target,a=i.length,o=e.indexes,s=``,c=0,l=0,u=!1,d=[],f=0;f<a;++f){var p=i[f];if(o[l]===f){if(++l,u||(u=!0,r?(d.push(s),s=``):s+=t),l===o.length){r?(s+=p,d.push(r(s,c++)),s=``,d.push(i.substr(f+1))):s+=p+n+i.substr(f+1);break}}else u&&(u=!1,r?(d.push(r(s,c++)),s=``):s+=n);s+=p}return r?d:s},i=e=>{typeof e==`number`?e=``+e:typeof e!=`string`&&(e=``);var t=v(e);return c(e,{_targetLower:t._lower,_targetLowerCodes:t.lowerCodes,_bitflags:t.bitflags})},a=()=>{x.clear(),S.clear()};class o{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((e,t)=>e-t)}set indexes(e){return this._indexes=e}highlight(e,t){return r(this,e,t)}get score(){return l(this._score)}set score(e){this._score=u(e)}}class s extends Array{get score(){return l(this._score)}set score(e){this._score=u(e)}}var c=(e,t)=>{let n=new o;return n.target=e,n.obj=t.obj??M,n._score=t._score??j,n._indexes=t._indexes??[],n._targetLower=t._targetLower??``,n._targetLowerCodes=t._targetLowerCodes??M,n._nextBeginningIndexes=t._nextBeginningIndexes??M,n._bitflags=t._bitflags??0,n},l=e=>e===j?0:e>1?e:Math.E**(((-e+1)**.04307-1)*-2),u=e=>e===0?j:e>1?e:1-(Math.log(e)/-2+1)**(1/.04307),d=e=>{typeof e==`number`?e=``+e:typeof e!=`string`&&(e=``),e=e.trim();var t=v(e),n=[];if(t.containsSpace){var r=e.split(/\s+/);r=[...new Set(r)];for(var i=0;i<r.length;i++)if(r[i]!==``){var a=v(r[i]);n.push({lowerCodes:a.lowerCodes,_lower:r[i].toLowerCase(),containsSpace:!1})}}return{lowerCodes:t.lowerCodes,_lower:t._lower,containsSpace:t.containsSpace,bitflags:t.bitflags,spaceSearches:n}},f=e=>{if(e.length>999)return i(e);var t=x.get(e);return t===void 0?(t=i(e),x.set(e,t),t):t},p=e=>{if(e.length>999)return d(e);var t=S.get(e);return t===void 0?(t=d(e),S.set(e,t),t):t},m=(e,t)=>{var n=[];n.total=e.length;var r=t?.limit||A;if(t?.key)for(var i=0;i<e.length;i++){var a=e[i],o=ee(a,t.key);if(o!=M){te(o)||(o=f(o));var l=c(o.target,{_score:o._score,obj:a});if(n.push(l),n.length>=r)return n}}else if(t?.keys)for(var i=0;i<e.length;i++){for(var a=e[i],u=new s(t.keys.length),d=t.keys.length-1;d>=0;--d){var o=ee(a,t.keys[d]);if(!o){u[d]=re;continue}te(o)||(o=f(o)),o._score=j,o._indexes.len=0,u[d]=o}if(u.obj=a,u._score=j,n.push(u),n.length>=r)return n}else for(var i=0;i<e.length;i++){var o=e[i];if(o!=M&&(te(o)||(o=f(o)),o._score=j,o._indexes.len=0,n.push(o),n.length>=r))return n}return n},h=(e,t,n=!1,r=!1)=>{if(n===!1&&e.containsSpace)return g(e,t,r);for(var i=e._lower,a=e.lowerCodes,s=a[0],c=t._targetLowerCodes,l=a.length,u=c.length,d=0,f=0,p=0;;){var m=s===c[f];if(m){if(C[p++]=f,++d,d===l)break;s=a[d]}if(++f,f>=u)return M}var d=0,h=!1,_=0,v=t._nextBeginningIndexes;v===M&&(v=t._nextBeginningIndexes=b(t.target)),f=C[0]===0?0:v[C[0]-1];var y=0;if(f!==u)for(;;)if(f>=u){if(d<=0||(++y,y>200))break;--d;var x=w[--_];f=v[x]}else{var m=a[d]===c[f];if(m){if(w[_++]=f,++d,d===l){h=!0;break}++f}else f=v[f]}var S=l<=1?-1:t._targetLower.indexOf(i,C[0]),T=!!~S,E=T?S===0||t._nextBeginningIndexes[S-1]===S:!1;if(T&&!E){for(var D=0;D<v.length;D=v[D])if(!(D<=S)){for(var O=0;O<l&&a[O]===t._targetLowerCodes[D+O];O++);if(O===l){S=D,E=!0;break}}}var k=e=>{for(var t=0,n=0,r=1;r<l;++r)e[r]-e[r-1]!==1&&(t-=e[r],++n);var i=e[l-1]-e[0]-(l-1);if(t-=(12+i)*n,e[0]!==0&&(t-=e[0]*e[0]*.2),!h)t*=1e3;else{for(var a=1,r=v[0];r<u;r=v[r])++a;a>24&&(t*=(a-24)*10)}return t-=(u-l)/2,T&&(t/=1+l*l*1),E&&(t/=1+l*l*1),t-=(u-l)/2,t};if(h)if(E){for(var D=0;D<l;++D)C[D]=S+D;var ee=C,te=k(C)}else var ee=w,te=k(w);else{if(T)for(var D=0;D<l;++D)C[D]=S+D;var ee=C,te=k(ee)}t._score=te;for(var D=0;D<l;++D)t._indexes[D]=ee[D];t._indexes.len=l;let A=new o;return A.target=t.target,A._score=t._score,A._indexes=t._indexes,A},g=(e,t,n)=>{for(var r=new Set,i=0,a=M,o=0,s=e.spaceSearches,c=s.length,l=0,u=()=>{for(let e=l-1;e>=0;e--)t._nextBeginningIndexes[T[e*2+0]]=T[e*2+1]},d=!1,f=0;f<c;++f){D[f]=j;var p=s[f];if(a=h(p,t),n){if(a===M)continue;d=!0}else if(a===M)return u(),M;if(f!==c-1){var m=a._indexes,g=!0;for(let e=0;e<m.len-1;e++)if(m[e+1]-m[e]!==1){g=!1;break}if(g){var _=m[m.len-1]+1,v=t._nextBeginningIndexes[_-1];for(let e=_-1;e>=0&&v===t._nextBeginningIndexes[e];e--)t._nextBeginningIndexes[e]=_,T[l*2+0]=e,T[l*2+1]=v,l++}}i+=a._score/c,D[f]=a._score/c,a._indexes[0]<o&&(i-=(o-a._indexes[0])*2),o=a._indexes[0];for(var y=0;y<a._indexes.len;++y)r.add(a._indexes[y])}if(n&&!d)return M;u();var b=h(e,t,!0);if(b!==M&&b._score>i){if(n)for(var f=0;f<c;++f)D[f]=b._score/c;return b}n&&(a=t),a._score=i;var f=0;for(let e of r)a._indexes[f++]=e;return a._indexes.len=f,a},_=e=>e.replace(/\p{Script=Latin}+/gu,e=>e.normalize(`NFD`)).replace(/[\u0300-\u036f]/g,``),v=e=>{e=_(e);for(var t=e.length,n=e.toLowerCase(),r=[],i=0,a=!1,o=0;o<t;++o){var s=r[o]=n.charCodeAt(o);if(s===32){a=!0;continue}var c=s>=97&&s<=122?s-97:s>=48&&s<=57?26:s<=127?30:31;i|=1<<c}return{lowerCodes:r,bitflags:i,containsSpace:a,_lower:n}},y=e=>{for(var t=e.length,n=[],r=0,i=!1,a=!1,o=0;o<t;++o){var s=e.charCodeAt(o),c=s>=65&&s<=90,l=c||s>=97&&s<=122||s>=48&&s<=57,u=c&&!i||!a||!l;i=c,a=l,u&&(n[r++]=o)}return n},b=e=>{e=_(e);for(var t=e.length,n=y(e),r=[],i=n[0],a=0,o=0;o<t;++o)i>o?r[o]=i:(i=n[++a],r[o]=i===void 0?t:i);return r},x=new Map,S=new Map,C=[],w=[],T=[],E=[],D=[],O=[],k=[],ee=(e,t)=>{var n=e[t];if(n!==void 0)return n;if(typeof t==`function`)return t(e);var r=t;Array.isArray(t)||(r=t.split(`.`));for(var i=r.length,a=-1;e&&++a<i;)e=e[r[a]];return e},te=e=>typeof e==`object`&&typeof e._bitflags==`number`,A=1/0,j=-A,ne=[];ne.total=0;var M=null,re=i(``),ie=(e=>{var t=[],n=0,r={},i=e=>{for(var r=0,i=t[r],a=1;a<n;){var o=a+1;r=a,o<n&&t[o]._score<t[a]._score&&(r=o),t[r-1>>1]=t[r],a=1+(r<<1)}for(var s=r-1>>1;r>0&&i._score<t[s]._score;s=(r=s)-1>>1)t[r]=t[s];t[r]=i};return r.add=(e=>{var r=n;t[n++]=e;for(var i=r-1>>1;r>0&&e._score<t[i]._score;i=(r=i)-1>>1)t[r]=t[i];t[r]=e}),r.poll=(e=>{if(n!==0){var r=t[0];return t[0]=t[--n],i(),r}}),r.peek=(e=>{if(n!==0)return t[0]}),r.replaceTop=(e=>{t[0]=e,i()}),r})();return{single:t,go:n,prepare:i,cleanup:a}})})),zo=S((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.createJSONRPCNotification=e.createJSONRPCRequest=e.createJSONRPCSuccessResponse=e.createJSONRPCErrorResponse=e.JSONRPCErrorCode=e.JSONRPCErrorException=e.isJSONRPCResponses=e.isJSONRPCResponse=e.isJSONRPCRequests=e.isJSONRPCRequest=e.isJSONRPCID=e.JSONRPC=void 0,e.JSONRPC=`2.0`,e.isJSONRPCID=function(e){return typeof e==`string`||typeof e==`number`||e===null},e.isJSONRPCRequest=function(t){return t.jsonrpc===e.JSONRPC&&t.method!==void 0&&t.result===void 0&&t.error===void 0},e.isJSONRPCRequests=function(t){return Array.isArray(t)&&t.every(e.isJSONRPCRequest)},e.isJSONRPCResponse=function(t){return t.jsonrpc===e.JSONRPC&&t.id!==void 0&&(t.result!==void 0||t.error!==void 0)},e.isJSONRPCResponses=function(t){return Array.isArray(t)&&t.every(e.isJSONRPCResponse)};var n=function(e,t,n){var r={code:e,message:t};return n!=null&&(r.data=n),r};e.JSONRPCErrorException=function(e){t(r,e);function r(t,n,i){var a=e.call(this,t)||this;return Object.setPrototypeOf(a,r.prototype),a.code=n,a.data=i,a}return r.prototype.toObject=function(){return n(this.code,this.message,this.data)},r}(Error),(function(e){e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`})(e.JSONRPCErrorCode||={}),e.createJSONRPCErrorResponse=function(t,r,i,a){return{jsonrpc:e.JSONRPC,id:t,error:n(r,i,a)}},e.createJSONRPCSuccessResponse=function(t,n){return{jsonrpc:e.JSONRPC,id:t,result:n??null}},e.createJSONRPCRequest=function(t,n,r){return{jsonrpc:e.JSONRPC,id:t,method:n,params:r}},e.createJSONRPCNotification=function(t,n){return{jsonrpc:e.JSONRPC,method:t,params:n}}})),Bo=S((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DefaultErrorCode=void 0,e.DefaultErrorCode=0})),Vo=S((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0}),e.JSONRPCClient=void 0;var r=zo(),i=Bo();e.JSONRPCClient=function(){function e(e,t){this._send=e,this.createID=t,this.idToResolveMap=new Map,this.id=0}return e.prototype._createID=function(){return this.createID?this.createID():++this.id},e.prototype.timeout=function(e,t){var n=this;t===void 0&&(t=function(e){return(0,r.createJSONRPCErrorResponse)(e,i.DefaultErrorCode,`Request timeout`)});var o=function(r,i){var a=setTimeout(function(){r.forEach(function(e){var r=n.idToResolveMap.get(e);r&&(n.idToResolveMap.delete(e),r(t(e)))})},e);return i().then(function(e){return clearTimeout(a),e},function(e){return clearTimeout(a),Promise.reject(e)})},s=function(e,t){return o((Array.isArray(e)?e:[e]).map(function(e){return e.id}).filter(a),function(){return n.requestAdvanced(e,t)})};return{request:function(e,t,r){var i=n._createID();return o([i],function(){return n.requestWithID(e,t,r,i)})},requestAdvanced:function(e,t){return s(e,t)}}},e.prototype.request=function(e,t,n){return this.requestWithID(e,t,n,this._createID())},e.prototype.requestWithID=function(e,i,a,o){return t(this,void 0,void 0,function(){var t,s;return n(this,function(n){switch(n.label){case 0:return t=(0,r.createJSONRPCRequest)(o,e,i),[4,this.requestAdvanced(t,a)];case 1:return s=n.sent(),s.result!==void 0&&!s.error?[2,s.result]:s.result===void 0&&s.error?[2,Promise.reject(new r.JSONRPCErrorException(s.error.message,s.error.code,s.error.data))]:[2,Promise.reject(Error(`An unexpected error occurred`))]}})})},e.prototype.requestAdvanced=function(e,t){var n=this,o=Array.isArray(e);Array.isArray(e)||(e=[e]);var s=e.filter(function(e){return a(e.id)}),c=s.map(function(e){return new Promise(function(t){return n.idToResolveMap.set(e.id,t)})}),l=Promise.all(c).then(function(e){return o||!e.length?e:e[0]});return this.send(o?e:e[0],t).then(function(){return l},function(e){return s.forEach(function(t){n.receive((0,r.createJSONRPCErrorResponse)(t.id,i.DefaultErrorCode,e&&e.message||`Failed to send a request`))}),l})},e.prototype.notify=function(e,t,n){var i=(0,r.createJSONRPCNotification)(e,t);this.send(i,n).then(void 0,function(){})},e.prototype.send=function(e,r){return t(this,void 0,void 0,function(){return n(this,function(t){return[2,this._send(e,r)]})})},e.prototype.rejectAllPendingRequests=function(e){this.idToResolveMap.forEach(function(t,n){return t((0,r.createJSONRPCErrorResponse)(n,i.DefaultErrorCode,e))}),this.idToResolveMap.clear()},e.prototype.receive=function(e){var t=this;Array.isArray(e)||(e=[e]),e.forEach(function(e){var n=t.idToResolveMap.get(e.id);n&&(t.idToResolveMap.delete(e.id),n(e))})},e}();var a=function(e){return e!=null}})),Ho=S((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),Uo=S((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},r=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}},i=e&&e.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(e,`__esModule`,{value:!0}),e.JSONRPCServer=void 0;var a=zo(),o=Bo(),s=function(){return(0,a.createJSONRPCErrorResponse)(null,a.JSONRPCErrorCode.ParseError,`Parse error`)},c=function(e){return(0,a.createJSONRPCErrorResponse)((0,a.isJSONRPCID)(e.id)?e.id:null,a.JSONRPCErrorCode.InvalidRequest,`Invalid Request`)},l=function(e){return(0,a.createJSONRPCErrorResponse)(e,a.JSONRPCErrorCode.MethodNotFound,`Method not found`)};e.JSONRPCServer=function(){function e(e){e===void 0&&(e={}),this.mapErrorToJSONRPCErrorResponse=p,this.nameToMethodDictionary={},this.middleware=null,this.errorListener=e.errorListener??console.warn}return e.prototype.hasMethod=function(e){return!!this.nameToMethodDictionary[e]},e.prototype.addMethod=function(e,t){this.addMethodAdvanced(e,this.toJSONRPCMethod(t))},e.prototype.removeMethod=function(e){delete this.nameToMethodDictionary[e]},e.prototype.toJSONRPCMethod=function(e){return function(t,n){var r=e(t.params,n);return Promise.resolve(r).then(function(e){return f(t.id,e)})}},e.prototype.addMethodAdvanced=function(e,n){var r;this.nameToMethodDictionary=t(t({},this.nameToMethodDictionary),(r={},r[e]=n,r))},e.prototype.receiveJSON=function(e,t){var n=this.tryParseRequestJSON(e);return n?this.receive(n,t):Promise.resolve(s())},e.prototype.tryParseRequestJSON=function(e){try{return JSON.parse(e)}catch{return null}},e.prototype.receive=function(e,t){return Array.isArray(e)?this.receiveMultiple(e,t):this.receiveSingle(e,t)},e.prototype.receiveMultiple=function(e,t){return n(this,void 0,void 0,function(){var n,i=this;return r(this,function(r){switch(r.label){case 0:return[4,Promise.all(e.map(function(e){return i.receiveSingle(e,t)}))];case 1:return n=r.sent().filter(u),n.length===1?[2,n[0]]:n.length?[2,n]:[2,null]}})})},e.prototype.receiveSingle=function(e,t){return n(this,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return n=this.nameToMethodDictionary[e.method],(0,a.isJSONRPCRequest)(e)?[3,1]:[2,c(e)];case 1:return[4,this.callMethod(n,e,t)];case 2:return i=r.sent(),[2,m(e,i)]}})})},e.prototype.applyMiddleware=function(){var e=[...arguments];this.middleware?this.middleware=this.combineMiddlewares(i([this.middleware],e,!0)):this.middleware=this.combineMiddlewares(e)},e.prototype.combineMiddlewares=function(e){return e.length?e.reduce(this.middlewareReducer):null},e.prototype.middlewareReducer=function(e,t){return function(n,r,i){return e(function(e,r){return t(n,e,r)},r,i)}},e.prototype.callMethod=function(e,t,n){var r=this,i=function(t,n){return e?e(t,n):t.id===void 0?Promise.resolve(null):Promise.resolve(l(t.id))},a=function(e){return r.errorListener(`An unexpected error occurred while executing "${t.method}" JSON-RPC method:`,e),Promise.resolve(r.mapErrorToJSONRPCErrorResponseIfNecessary(t.id,e))};try{return(this.middleware||d)(i,t,n).then(void 0,a)}catch(e){return a(e)}},e.prototype.mapErrorToJSONRPCErrorResponseIfNecessary=function(e,t){return e===void 0?null:this.mapErrorToJSONRPCErrorResponse(e,t)},e}();var u=function(e){return e!==null},d=function(e,t,n){return e(t,n)},f=function(e,t){return e===void 0?null:(0,a.createJSONRPCSuccessResponse)(e,t)},p=function(e,t){var n=t?.message??`An unexpected error occurred`,r=o.DefaultErrorCode,i;return t instanceof a.JSONRPCErrorException&&(r=t.code,i=t.data),(0,a.createJSONRPCErrorResponse)(e,r,n,i)},m=function(e,t){return t||(e.id===void 0?null:(0,a.createJSONRPCErrorResponse)(e.id,a.JSONRPCErrorCode.InternalError,`Internal error`))}})),Wo=S((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0}),e.JSONRPCServerAndClient=void 0;var r=zo();e.JSONRPCServerAndClient=function(){function e(e,t,n){n===void 0&&(n={}),this.server=e,this.client=t,this.errorListener=n.errorListener??console.warn}return e.prototype.applyServerMiddleware=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this.server).applyMiddleware.apply(e,t)},e.prototype.hasMethod=function(e){return this.server.hasMethod(e)},e.prototype.addMethod=function(e,t){this.server.addMethod(e,t)},e.prototype.addMethodAdvanced=function(e,t){this.server.addMethodAdvanced(e,t)},e.prototype.removeMethod=function(e){this.server.removeMethod(e)},e.prototype.timeout=function(e){return this.client.timeout(e)},e.prototype.request=function(e,t,n){return this.client.request(e,t,n)},e.prototype.requestAdvanced=function(e,t){return this.client.requestAdvanced(e,t)},e.prototype.notify=function(e,t,n){this.client.notify(e,t,n)},e.prototype.rejectAllPendingRequests=function(e){this.client.rejectAllPendingRequests(e)},e.prototype.receiveAndSend=function(e,i,a){return t(this,void 0,void 0,function(){var t,o;return n(this,function(n){switch(n.label){case 0:return(0,r.isJSONRPCResponse)(e)||(0,r.isJSONRPCResponses)(e)?(this.client.receive(e),[3,4]):[3,1];case 1:return(0,r.isJSONRPCRequest)(e)||(0,r.isJSONRPCRequests)(e)?[4,this.server.receive(e,i)]:[3,3];case 2:return t=n.sent(),t?[2,this.client.send(t,a)]:[3,4];case 3:return o=`Received an invalid JSON-RPC message`,this.errorListener(o,e),[2,Promise.reject(Error(o))];case 4:return[2]}})})},e}()})),Go=S((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(Vo(),e),n(Ho(),e),n(zo(),e),n(Uo(),e),n(Wo(),e)}));function Ko(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`{`){n&&=(t.push({type:`literal`,value:n}),``);let i=r+1,a=i,o=1;for(;a<e.length&&o>0;)e[a]===`{`?o++:e[a]===`}`&&o--,a++;if(o>0)throw Error(`Unclosed expression in template: ${e}`);let s=qo(e.slice(i,a-1));t.push(s),r=a}else n+=i,r++}return n&&t.push({type:`literal`,value:n}),{template:e,parts:t}}function qo(e){if(!e.trim())throw Error(`Empty expression`);let t=e[0],n=[`+`,`#`,`.`,`/`,`;`,`?`,`&`],r,i=e;return n.includes(t)&&(r=t,i=e.slice(1)),{type:`expression`,expressions:Jo(i).map(Yo),operator:r}}function Jo(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];i===`,`?n.trim()&&(t.push(n.trim()),n=``):n+=i,r++}return n.trim()&&t.push(n.trim()),t}function Yo(e){let t=e,n,r=!1;t.endsWith(`*`)&&(r=!0,t=t.slice(0,-1));let i=t.indexOf(`:`);if(i!==-1){let e=t.slice(i+1);if(n=parseInt(e,10),isNaN(n)||n<0)throw Error(`Invalid prefix length: ${e}`);t=t.slice(0,i)}if(!t)throw Error(`Empty variable name`);return{name:t,prefix:n,explode:r}}function Xo(e,t){let n={},r=Zo(e,0,t.parts,0,n);return!r||r.uri_index!==e.length?null:n}function Zo(e,t,n,r,i){if(r>=n.length)return{uri_index:t};let a=n[r];if(a.type===`literal`)return e.slice(t).startsWith(a.value)?Zo(e,t+a.value.length,n,r+1,i):null;{let o=n[r+1],s=Qo(e,t,o).sort((e,t)=>o&&o.type===`expression`&&!o.operator?t-e:e-t);for(let o of s){let s=e.slice(t,o),c={...i};if($o(s,a,c,e,t)){let t=Zo(e,o,n,r+1,c);if(t)return Object.assign(i,c),t}}return null}}function Qo(e,t,n){let r=[];if(n&&n.type===`literal`){let i=t;for(;i<e.length;){let t=e.indexOf(n.value,i);if(t===-1)break;r.push(t),i=t+1}if(r.length===0)return[]}else if(n&&n.type===`expression`){let i=n;if(i.operator===`.`){for(let n=t;n<e.length;n++)e[n]===`.`&&r.push(n);r.push(e.length)}else if(i.operator===`/`)for(let n=t;n<e.length;n++)e[n]===`/`&&r.push(n);else for(let n=t;n<=e.length;n++)r.push(n)}else r.push(e.length);return r.sort((e,t)=>e-t)}function $o(e,t,n,r,i){if(t.type!==`expression`)return!1;switch(t.operator){case`+`:return ts(e,t,n);case`#`:return es(e,t,n);case`.`:return rs(e,t,n);case`/`:return is(e,t,n);case`;`:return as(e,t,n);case`?`:case`&`:return os(e,t,n);default:return ns(e,t,n,r,i)}}function es(e,t,n){if(t.type!==`expression`)return!1;if(!e.startsWith(`#`)){for(let e of t.expressions)n[e.name]=``;return e===``}let r=e.slice(1);if(t.expressions.length===1){let e=t.expressions[0],i=r;return e.prefix&&i.length>e.prefix&&(i=i.slice(0,e.prefix)),n[e.name]=decodeURIComponent(i),!0}else{let e=r.split(`,`);for(let r=0;r<t.expressions.length;r++){let i=t.expressions[r],a=e[r]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function ts(e,t,n){if(t.type!==`expression`)return!1;if(t.expressions.length===1){let r=t.expressions[0],i=e;return r.prefix&&i.length>r.prefix&&(i=i.slice(0,r.prefix)),n[r.name]=decodeURIComponent(i),!0}else{let r=e.split(`,`);for(let e=0;e<t.expressions.length;e++){let i=t.expressions[e],a=r[e]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function ns(e,t,n,r,i){if(t.type!==`expression`)return!1;if(t.expressions.length===1){let a=t.expressions[0],o=e;return o.includes(`/`)||o===``&&i+e.length===r.length&&r.endsWith(`/`)?!1:(a.prefix&&o.length>a.prefix&&(o=o.slice(0,a.prefix)),n[a.name]=decodeURIComponent(o),!0)}else{let r=e.split(`,`);for(let e=0;e<t.expressions.length;e++){let i=t.expressions[e],a=r[e]||``;if(a.includes(`/`))return!1;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function rs(e,t,n){if(t.type!==`expression`)return!1;if(e===``){for(let e of t.expressions)n[e.name]=``;return!0}let r=e.startsWith(`.`)?e.slice(1):e;if(t.expressions.length===1){let e=t.expressions[0];if(e.explode){let t=r.split(`.`);n[e.name]=t.map(e=>decodeURIComponent(e))}else n[e.name]=decodeURIComponent(r);return!0}else{let e=r.split(`.`);for(let r=0;r<t.expressions.length;r++){let i=t.expressions[r],a=e[r]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function is(e,t,n){if(t.type!==`expression`)return!1;let r=e.startsWith(`/`)?e.slice(1):e;if(t.expressions.length===1){let e=t.expressions[0];return n[e.name]=decodeURIComponent(r),!0}else{let e=r.split(`,`);for(let r=0;r<t.expressions.length;r++){let i=t.expressions[r],a=e[r]||``;i.prefix&&a.length>i.prefix&&(a=a.slice(0,i.prefix)),n[i.name]=decodeURIComponent(a)}return!0}}function as(e,t,n){if(t.type!==`expression`)return!1;let r=e.split(`;`).filter(e=>e);for(let e of r){let r=e.indexOf(`=`);if(r!==-1){let i=e.slice(0,r),a=e.slice(r+1),o=t.expressions.find(e=>e.name===i);o&&(n[o.name]=decodeURIComponent(a))}}return!0}function os(e,t,n){if(t.type!==`expression`)return!1;let r=e.replace(/^[?&]/,``);if(t.expressions.length===1){let e=t.expressions[0];if(e.explode){let t=r.split(`&`);n[e.name]=t.map(e=>decodeURIComponent(e))}else{let t=r.split(`&`);for(let r of t){let t=r.indexOf(`=`);if(t!==-1){let i=r.slice(0,t),a=r.slice(t+1);i===e.name&&(n[e.name]=decodeURIComponent(a))}}}}else{let e=r.split(`&`);for(let r of e){let e=r.indexOf(`=`);if(e!==-1){let i=r.slice(0,e),a=r.slice(e+1),o=t.expressions.find(e=>e.name===i);o&&(n[o.name]=decodeURIComponent(a))}}}return!0}var ss=class{constructor(){this.templates=[]}add(e){if(typeof e!=`string`)throw Error(`Template must be a string`);if(e!==``&&e.trim()===``)throw Error(`Template cannot be empty`);try{let t=Ko(e);this.templates.push(t)}catch(t){throw Error(`Invalid template: ${e} - ${t instanceof Error?t.message:String(t)}`)}}match(e){if(typeof e!=`string`)throw Error(`URI must be a string`);for(let t of this.templates){let n=Xo(e,t);if(n!==null)return{template:t.template,params:n}}return null}clear(){this.templates=[]}all(){return this.templates.map(e=>e.template)}},cs=Go(),ls=w(Ro(),1),us;function ds(e){return{lang:e?.lang??us?.lang,message:e?.message,abortEarly:e?.abortEarly??us?.abortEarly,abortPipeEarly:e?.abortPipeEarly??us?.abortPipeEarly}}var fs;function ps(e){return fs?.get(e)}var ms;function hs(e){return ms?.get(e)}var gs;function _s(e,t){return gs?.get(e)?.get(t)}function vs(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function K(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??vs(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??_s(e.reference,c.lang)??(l?hs(c.lang):null)??r.message??ps(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function q(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},ds())}}}function ys(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function bs(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var xs=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}},Ss=/^(?:[\da-z+/]{4})*(?:[\da-z+/]{2}==|[\da-z+/]{3}=)?$/iu;function Cs(e){return{kind:`validation`,type:`base64`,reference:Cs,async:!1,expects:null,requirement:Ss,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&K(this,`Base64`,e,t),e}}}function ws(e,t){return{kind:`validation`,type:`check`,reference:ws,async:!1,expects:null,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&K(this,`input`,e,t),e}}}function Ts(e){return{kind:`validation`,type:`integer`,reference:Ts,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&K(this,`integer`,e,t),e}}}function Es(e,t){return{kind:`validation`,type:`max_length`,reference:Es,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length>this.requirement&&K(this,`length`,e,t,{received:`${e.value.length}`}),e}}}function Ds(e,t){return{kind:`validation`,type:`max_value`,reference:Ds,async:!1,expects:`<=${e instanceof Date?e.toJSON():vs(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value<=this.requirement)&&K(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():vs(e.value)}),e}}}function Os(e,t){return{kind:`validation`,type:`min_value`,reference:Os,async:!1,expects:`>=${e instanceof Date?e.toJSON():vs(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value>=this.requirement)&&K(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():vs(e.value)}),e}}}function ks(e,t){return{kind:`validation`,type:`regex`,reference:ks,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&K(this,`format`,e,t),e}}}function As(e,t){return{kind:`validation`,type:`starts_with`,reference:As,async:!1,expects:`"${e}"`,requirement:e,message:t,"~run"(e,t){return e.typed&&!e.value.startsWith(this.requirement)&&K(this,`start`,e,t,{received:`"${e.value.slice(0,this.requirement.length)}"`}),e}}}function js(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Ms(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function Ns(e,t){return{kind:`schema`,type:`array`,reference:Ns,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return q(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else K(this,`type`,e,t);return e}}}function Ps(e){return{kind:`schema`,type:`boolean`,reference:Ps,expects:`boolean`,async:!1,message:e,get"~standard"(){return q(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:K(this,`type`,e,t),e}}}function Fs(e,t){return{kind:`schema`,type:`literal`,reference:Fs,expects:vs(e),async:!1,literal:e,message:t,get"~standard"(){return q(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:K(this,`type`,e,t),e}}}function J(e,t){return{kind:`schema`,type:`loose_object`,reference:J,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return q(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Ms(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=js(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(K(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(let t in n)ys(n,t)&&!(t in this.entries)&&(e.value[t]=n[t])}else K(this,`type`,e,t);return e}}}function Is(e){return{kind:`schema`,type:`number`,reference:Is,expects:`number`,async:!1,message:e,get"~standard"(){return q(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:K(this,`type`,e,t),e}}}function Y(e,t){return{kind:`schema`,type:`object`,reference:Y,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return q(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`)for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Ms(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=js(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(K(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}else K(this,`type`,e,t);return e}}}function X(e,t){return{kind:`schema`,type:`optional`,reference:X,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return q(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=Ms(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Ls(e,t){return{kind:`schema`,type:`picklist`,reference:Ls,expects:bs(e.map(vs),`|`),async:!1,options:e,message:t,get"~standard"(){return q(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:K(this,`type`,e,t),e}}}function Rs(e,t,n){return{kind:`schema`,type:`record`,reference:Rs,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return q(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},n)if(ys(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else K(this,`type`,e,t);return e}}}function zs(e,t){return{kind:`schema`,type:`strict_object`,reference:zs,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return q(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Ms(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=js(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(K(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly){for(let r in n)if(!(r in this.entries)){K(this,`key`,e,t,{input:r,expected:`never`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]});break}}}else K(this,`type`,e,t);return e}}}function Z(e){return{kind:`schema`,type:`string`,reference:Z,expects:`string`,async:!1,message:e,get"~standard"(){return q(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:K(this,`type`,e,t),e}}}function Bs(e){let t;if(e)for(let n of e)t?t.push(...n.issues):t=n.issues;return t}function Vs(e,t){return{kind:`schema`,type:`union`,reference:Vs,expects:bs(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,get"~standard"(){return q(this)},"~run"(e,t){let n,r,i;for(let a of this.options){let o=a[`~run`]({value:e.value},t);if(o.typed)if(o.issues)r?r.push(o):r=[o];else{n=o;break}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];K(this,`type`,e,t,{issues:Bs(r)}),e.typed=!0}else if(i?.length===1)return i[0];else K(this,`type`,e,t,{issues:Bs(i)});return e}}}function Hs(){return{kind:`schema`,type:`unknown`,reference:Hs,expects:`unknown`,async:!1,get"~standard"(){return q(this)},"~run"(e){return e.typed=!0,e}}}function Us(e,t,n){return{kind:`schema`,type:`variant`,reference:Us,expects:`Object`,async:!1,key:e,options:t,message:n,get"~standard"(){return q(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){let r,i=0,a=this.key,o=[],s=(e,c)=>{for(let l of e.options){if(l.type===`variant`)s(l,new Set(c).add(l.key));else{let e=!0,s=0;for(let t of c){let r=l.entries[t];if(t in n?r[`~run`]({typed:!1,value:n[t]},{abortEarly:!0}).issues:r.type!==`exact_optional`&&r.type!==`optional`&&r.type!==`nullish`){e=!1,a!==t&&(i<s||i===s&&t in n&&!(a in n))&&(i=s,a=t,o=[]),a===t&&o.push(l.entries[t].expects);break}s++}if(e){let e=l[`~run`]({value:n},t);(!r||!r.typed&&e.typed)&&(r=e)}}if(r&&!r.issues)break}};if(s(this,new Set([this.key])),r)return r;K(this,`type`,e,t,{input:n[a],expected:bs(o,`|`),path:[{type:`object`,origin:`value`,input:n,key:a,value:n[a]}]})}else K(this,`type`,e,t);return e}}}function Ws(e,t,n){let r=e[`~run`]({value:t},ds(n));if(r.issues)throw new xs(r.issues);return r.value}function Gs(...e){return{...e[0],pipe:e,get"~standard"(){return q(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}function Ks(e,t,n){let r=e[`~run`]({value:t},ds(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var qs=class extends Error{constructor(e,t){super(`MCP error ${e}: ${t}`),this.name=`McpError`}};const Js=Vs([Z(),Gs(Is(),Ts())]),Ys=Z(),Q=J({_meta:X(J({progressToken:X(Js)}))}),$=Y({method:Z(),params:X(Q)}),Xs=J({_meta:X(J({}))}),Zs=Y({method:Z(),params:X(Xs)}),Qs=J({_meta:X(J({}))}),$s=Vs([Z(),Gs(Is(),Ts())]),ec=Y({jsonrpc:Fs(`2.0`),id:$s,...$.entries}),tc=Y({jsonrpc:Fs(`2.0`),...Zs.entries}),nc=zs({jsonrpc:Fs(`2.0`),id:$s,result:Qs}),rc=zs({jsonrpc:Fs(`2.0`),id:$s,error:Y({code:Gs(Is(),Ts()),message:Z(),data:X(Hs())})});({...Qs.entries}),{...Zs.entries},{...Xs.entries};const ic=Y({name:Z(),title:X(Z())}),ac=Y({icons:X(Ns(Y({src:Z(),mimeType:X(Z()),sizes:X(Ns(Z()))})))}),oc=Y({...ic.entries,version:Z(),websiteUrl:X(Z()),...ac.entries}),sc=Y({experimental:X(Y({})),sampling:X(Y({})),elicitation:X(Y({})),roots:X(Y({listChanged:X(Ps())}))}),cc=Y({...Q.entries,protocolVersion:Z(),capabilities:sc,clientInfo:oc});({...$.entries}),{...Qs.entries},{...Zs.entries},{...$.entries};const lc=Y({progress:Is(),total:X(Is()),message:X(Z())});({...Zs.entries}),{...Xs.entries,...lc.entries};const uc=Y({...$.entries,params:X(Y({...Q.entries,cursor:X(Ys)}))}),dc=Y({...Qs.entries,nextCursor:X(Ys)}),fc=Y({uri:Z(),mimeType:X(Z()),_meta:X(J({}))}),pc=Y({...fc.entries,text:Z()}),mc=Y({...fc.entries,blob:Gs(Z(),Cs())}),hc=Y({...ic.entries,uri:Z(),description:X(Z()),mimeType:X(Z()),_meta:X(J({})),...ac.entries});({...ic.entries}),{...ac.entries},{...uc.entries},{...dc.entries},{...uc.entries},{...dc.entries},{...$.entries},{...Q.entries};const gc=Y({...Qs.entries,contents:Ns(Vs([pc,mc]))});({...Zs.entries}),{...$.entries},{...Q.entries},{...$.entries},{...Q.entries},{...Zs.entries},{...Xs.entries},{...ic.entries},{...ac.entries},{...uc.entries},{...dc.entries},{...$.entries},{...Q.entries};const _c=Y({type:Fs(`text`),text:Z(),_meta:X(J({}))}),vc=Y({type:Fs(`image`),data:Gs(Z(),Cs()),mimeType:Z(),_meta:X(J({}))}),yc=Y({type:Fs(`audio`),data:Gs(Z(),Cs()),mimeType:Z(),_meta:X(J({}))}),bc=Y({type:Fs(`resource`),resource:Vs([pc,mc]),_meta:X(J({}))}),xc=Vs([_c,vc,yc,Y({...hc.entries,type:Fs(`resource_link`)}),bc]),Sc=Y({role:Ls([`user`,`assistant`]),content:xc}),Cc=Y({...Qs.entries,description:X(Z()),messages:Ns(Sc)});({...Zs.entries}),{...ic.entries},{...ac.entries},{...uc.entries},{...dc.entries};const wc=Y({...Qs.entries,content:X(Ns(xc),[]),structuredContent:X(J({})),isError:X(Ps())});({...Qs.entries}),{...$.entries},{...Q.entries},{...Zs.entries},{...$.entries},{...Q.entries},{...Zs.entries},{...Xs.entries};const Tc=Y({hints:X(Ns(Y({name:X(Z())}))),costPriority:X(Gs(Is(),Os(0),Ds(1))),speedPriority:X(Gs(Is(),Os(0),Ds(1))),intelligencePriority:X(Gs(Is(),Os(0),Ds(1)))}),Ec=Y({role:Ls([`user`,`assistant`]),content:Vs([_c,vc,yc])}),Dc=Y({...Q.entries,messages:Ns(Ec),systemPrompt:X(Z()),includeContext:X(Ls([`none`,`thisServer`,`allServers`])),temperature:X(Is()),maxTokens:Gs(Is(),Ts()),stopSequences:X(Ns(Z())),metadata:X(Y({})),modelPreferences:X(Tc)});({...$.entries});const Oc=Y({...Qs.entries,model:Z(),stopReason:X(Vs([Ls([`endTurn`,`stopSequence`,`maxTokens`]),Z()])),role:Ls([`user`,`assistant`]),content:Us(`type`,[_c,vc,yc])});({...$.entries}),{...Q.entries};const kc=Y({...Qs.entries,action:Ls([`accept`,`decline`,`cancel`]),content:X(Rs(Z(),Hs()))});({...$.entries}),{...Q.entries};const Ac=Y({...Qs.entries,completion:Y({values:Gs(Ns(Z()),Es(100)),total:X(Gs(Is(),Ts())),hasMore:X(Ps())})});({...$.entries}),{...Qs.entries},{...Zs.entries};const jc=[`2025-06-18`,`2025-03-26`,`2024-11-05`],Mc=jc[0];function Nc(e){return jc.includes(e)}function Pc(){return Mc}function Fc(){return[...jc]}function Ic(e){return Nc(e)?e:Pc()}function Lc(e){try{let t=new Date(e);return!/^\d{4}-\d{2}-\d{2}$/.test(e)||isNaN(t.getTime())}catch{return!0}}function Rc(e,t){return new CustomEvent(e,{detail:t})}let zc;async function Bc(){return zc||=new(await(import(`./sqids-BiDaWurc.mjs`))).default,zc}async function Vc(e){return(await Bc()).encode([e])}async function Hc(e){let[t]=(await Bc()).decode(e);return t}async function Uc(e){try{return await e()}catch{return!1}}var Wc=class{#e=new cs.JSONRPCServer;#t;#n;#r=new Map;#i=new Map;#a=new Map;#o=new ss;roots=[];#s={"ref/prompt":new Map,"ref/resource":new Map};#c=new EventTarget;#l=new h;constructor(e,t){this.#n=t,this.#e.addMethod(`initialize`,n=>{try{let r=Ws(cc,n);if(Lc(r.protocolVersion))throw new qs(-32602,`Invalid protocol version format`);let i=Ic(r.protocolVersion);return this.#c.dispatchEvent(Rc(`initialize`,r)),{protocolVersion:i,...t,serverInfo:e}}catch(e){throw e instanceof qs?e:e.message?.includes(`Protocol version`)?new qs(-32602,`Protocol version validation failed: ${e.message}. Server supports: ${Fc().join(`, `)}`):new qs(-32603,`Initialization failed: ${e.message}`)}}),this.#e.addMethod(`ping`,()=>({})),this.#e.addMethod(`notifications/initialized`,()=>null),this.#m(),this.#h(),this.#g(),this.#_(),this.#y(),this.#b()}withContext(){return this}get#u(){return this.#l.getStore()?.progress_token}get ctx(){let{progress_token:e,...t}=this.#l.getStore()??{};return t}get#d(){return this.#l.getStore()?.sessionInfo?.clientCapabilities}currentClientInfo(){return this.#l.getStore()?.sessionInfo?.clientInfo}currentClientCapabilities(){return this.#d}#f(){this.#t||=new cs.JSONRPCClient((e,t)=>{if(t===`broadcast`){this.#c.dispatchEvent(Rc(`broadcast`,{request:e}));return}this.#c.dispatchEvent(Rc(`send`,{request:e}))})}on(e,t,n){(e===`send`||e===`broadcast`)&&this.#f();let r=e=>{t(e.detail)};return this.#c.addEventListener(e,r,n),()=>{this.#c.removeEventListener(e,r,n)}}#p(e,t,n=`standalone`){this.#t?.notify(e,t,n)}#m(){this.#n.capabilities?.tools&&(this.#e.addMethod(`tools/list`,async({cursor:e}={})=>{let t=(await Promise.all([...this.#r].map(async([e,t])=>t.enabled!=null&&await Uc(t.enabled)===!1?null:{name:e,title:t.title||t.description,description:t.description,icons:t.icons,_meta:t._meta,inputSchema:t.schema&&this.#n.adapter?await this.#n.adapter.toJsonSchema(t.schema):{type:`object`,properties:{}},...t.outputSchema&&this.#n.adapter?{outputSchema:await this.#n.adapter.toJsonSchema(t.outputSchema)}:{},...t.annotations?{annotations:t.annotations}:{}}))).filter(e=>e!==null),n=this.#n.pagination?.tools;if(!n||n.size==null)return{tools:t};let r=n.size,i=e?await Hc(e):0,a=i+r,o=t.slice(i,a),s=a<t.length?await Vc(a):null;return{tools:o,...s&&{nextCursor:s}}}),this.#e.addMethod(`tools/call`,async({name:e,arguments:t})=>{let n=this.#r.get(e);if(!n)return{isError:!0,content:[{type:`text`,text:`Tool ${e} not found`}]};let r=t;if(n.schema){let i=n.schema[`~standard`].validate(t);if(i instanceof Promise&&(i=await i),i.issues)return{isError:!0,content:[{type:`text`,text:`Invalid arguments for tool ${e}: ${JSON.stringify(i.issues)}`}]};r=i.value}let i=Ws(wc,n.schema?await n.execute(r):await n.execute());if(n.outputSchema&&i.structuredContent!==void 0){let t=n.outputSchema[`~standard`].validate(i.structuredContent);if(t instanceof Promise&&(t=await t),t.issues)return{isError:!0,content:[{type:`text`,text:`Tool ${e} returned invalid structured content: ${JSON.stringify(t.issues)}`}]};i.structuredContent=t.value}return i}))}#h(){this.#n.capabilities?.prompts&&(this.#e.addMethod(`prompts/list`,async({cursor:e}={})=>{let t=(await Promise.all([...this.#i].map(async([e,t])=>{if(t.enabled!=null&&await Uc(t.enabled)===!1)return null;let n=t.schema&&this.#n.adapter?await this.#n.adapter.toJsonSchema(t.schema):{type:`object`,properties:{},required:[]},r=Object.keys(n.properties??{}),i=n.required??[];return{name:e,title:t.title||t.description,icons:t.icons,description:t.description,arguments:r.map(e=>{let t=n.properties?.[e],r=t&&t!==!0?t.description:e;return{name:e,required:i.includes(e),description:r}})}}))).filter(e=>e!==null),n=this.#n.pagination?.prompts;if(!n||n.size==null)return{prompts:t};let r=n.size,i=e?await Hc(e):0,a=i+r,o=t.slice(i,a),s=a<t.length?await Vc(a):null;return{prompts:o,...s&&{nextCursor:s}}}),this.#e.addMethod(`prompts/get`,async({name:e,arguments:t})=>{let n=this.#i.get(e);if(!n)throw new qs(-32601,`Prompt ${e} not found`);if(!n.schema)return Ws(Cc,await n.execute());let r=n.schema[`~standard`].validate(t);if(r instanceof Promise&&(r=await r),r.issues)throw new qs(-32602,`Invalid arguments for prompt ${e}: ${JSON.stringify(r.issues)}`);return Ws(Cc,await n.execute(r.value))}))}#g(){this.#n.capabilities?.resources&&(this.#n.capabilities?.resources?.subscribe&&(this.#e.addMethod(`resources/subscribe`,async({uri:e})=>(this.#c.dispatchEvent(Rc(`subscription`,{uri:e,action:`add`})),{})),this.#e.addMethod(`resources/unsubscribe`,async({uri:e})=>(this.#c.dispatchEvent(Rc(`subscription`,{uri:e,action:`remove`})),{}))),this.#e.addMethod(`resources/list`,async({cursor:e}={})=>{let t=[];for(let[e,n]of this.#a)if(n.template){if(n.list_resources){if(n.enabled!=null&&await Uc(n.enabled)===!1)continue;let e=await n.list_resources();t.push(...e)}}else{if(n.enabled!=null&&await Uc(n.enabled)===!1)continue;t.push({name:n.name,title:n.title||n.description,description:n.description,uri:e,mimeType:n.mimeType,icons:n.icons})}let n=this.#n.pagination?.resources;if(!n||n.size==null)return{resources:t};let r=n.size,i=e?await Hc(e):0,a=i+r,o=t.slice(i,a),s=a<t.length?await Vc(a):null;return{resources:o,...s&&{nextCursor:s}}}),this.#e.addMethod(`resources/templates/list`,async()=>({resourceTemplates:(await Promise.all([...this.#a].map(async([e,t])=>!t.template||t.enabled!=null&&await Uc(t.enabled)===!1?null:{name:t.name,icons:t.icons,title:t.title||t.description,description:t.description,mimeType:t.mimeType,uriTemplate:e}))).filter(e=>e!=null)})),this.#e.addMethod(`resources/read`,async({uri:e})=>{let t=this.#a.get(e),n;if(!t){let r=this.#o.match(e);if(r&&(t=this.#a.get(r.template),n=r.params),!t)throw new qs(-32601,`Resource ${e} not found`)}if(t.template){if(!n)throw new qs(-32602,`Missing parameters for template resource`);return Ws(gc,await t.execute(e,n))}return Ws(gc,await t.execute(e))}))}#_(){this.#e.addMethod(`notifications/roots/list_changed`,()=>(this.#v(),null))}async#v(){if(this.#d?.roots){this.#f();try{this.roots=(await this.#t?.request(`roots/list`,void 0,`standalone`))?.roots||[]}catch{this.roots=[]}}}#y(){this.#e.addMethod(`completion/complete`,async({argument:e,ref:t,context:n})=>{let r=this.#s[t.type];if(!r)return null;let i=r.get(t.uri??t.name);if(!i)return null;let a=i[e.name];return a?Ws(Ac,await a(e.value,n)):null})}#b(){this.#n.capabilities?.logging&&this.#e.addMethod(`logging/setLevel`,({level:e})=>(this.#c.dispatchEvent(Rc(`loglevelchange`,{level:e})),{}))}#x(){this.#n.capabilities?.tools?.listChanged&&this.#p(`notifications/tools/list_changed`,{},`broadcast`)}#S(){this.#n.capabilities?.prompts?.listChanged&&this.#p(`notifications/prompts/list_changed`,{},`broadcast`)}#C(){this.#n.capabilities?.resources?.listChanged&&this.#p(`notifications/resources/list_changed`,{},`broadcast`)}tools(e){for(let t of e)this.tool(t)}prompts(e){for(let t of e)this.prompt(t)}resources(e){for(let t of e)this.resource(t)}templates(e){for(let t of e)this.template(t)}tool(e,t){`execute`in e&&(t=e.execute),this.#x();let n=e;n.execute=t,this.#r.set(e.name,n)}prompt(e,t){`execute`in e&&(t=e.execute),e.complete&&this.#s[`ref/prompt`].set(e.name,e.complete),this.#S();let n=e;n.execute=t,this.#i.set(e.name,n)}#w(e){e.template&&e.complete&&this.#s[`ref/resource`].set(e.uri,e.complete),e.template&&this.#o.add(e.uri),this.#C(),this.#a.set(e.uri,e)}resource(e,t){`execute`in e&&(t=e.execute);let n=e;n.execute=t,n.template=!1,this.#w(n)}template(e,t){`execute`in e&&(t=e.execute);let n=e;n.execute=t,n.list_resources=e.list,n.template=!0,this.#w(n)}receive(e,t){let n=Ks(Vs([ec,tc]),e);if(n.success){let e=n.output.params?._meta?.progressToken;return this.#l.run({...t??{},progress_token:e},async()=>await this.#e.receive(n.output))}let r=Ws(Vs([nc,rc]),e);return this.#f(),this.#l.run(t??{},async()=>this.#t?.receive(r))}async request({method:e,params:t}){return this.#f(),this.#t?.request(e,t,`standalone`)}changed(...e){let[t,n]=e;if(t===`prompts`)this.#S();else if(t===`tools`)this.#x();else if(t===`resources`)this.#C();else{let e=this.#a.get(n);if(!e)return;this.#p(`notifications/resources/updated`,{uri:n,title:e.name},`broadcast`)}}async refreshRoots(){await this.#v()}async elicitation(e,t){if(!this.#d?.elicitation)throw new qs(-32601,`Client doesn't support elicitation`);this.#f();let n=Ws(kc,await this.#t?.request(`elicitation/create`,{message:e,requestedSchema:await this.#n.adapter?.toJsonSchema(t)},`standalone`)),r=t[`~standard`].validate(n.content);if(r instanceof Promise&&(r=await r),r.issues)throw new qs(-32603,`Invalid elicitation result: ${JSON.stringify(r.issues)}`);return{...n,content:r.value}}async message(e){if(!this.#d?.sampling)throw new qs(-32601,`Client doesn't support sampling`);this.#f();let t=Ws(Dc,e);return Ws(Oc,await this.#t?.request(`sampling/createMessage`,t,`standalone`))}progress(e,t=1,n=void 0){this.#u!=null&&this.#p(`notifications/progress`,{progress:e,total:t,message:n,progressToken:this.#u})}log(e,t,n){if(!this.#n.capabilities?.logging)throw new qs(-32601,`The server doesn't support logging, please enable it in capabilities`);let r=this.#l.getStore()?.sessionInfo?.logLevel??this.#n.logging?.default??`info`;r&&this.#T(e,r)&&this.#p(`notifications/message`,{level:e,data:t,logger:n})}#T(e,t){let n=[`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`];return n.indexOf(e)>=n.indexOf(t)}},Gc=`0.0.18`;const Kc={cwd:ya().describe(`The path of the current working directory. Used to find the jsrepo.config file.`)},qc=new ko,Jc=new Wc({name:`jsrepo`,version:Gc,description:`An MCP server for adding, viewing, and searching items from jsrepo registries.`},{adapter:qc,capabilities:{tools:{listChanged:!0}}});Jc.tool({name:`add_item_to_project`,description:`Add a registry item or items to the users project.`,schema:Qa({cwd:Kc.cwd,itemNames:Xa(ya().describe('The registry and name of the item to add `<registry>/<item-name>`. i.e. "github/ieedan/std/math", "@ieedan/std/math", "https://example.com/registry/math"')).describe(`Fully qualifed registry items to add. i.e. ["github/ieedan/std/math", "@ieedan/std/math", "https://example.com/registry/math"]`),with:Xa(ya()).optional().describe(`Include files with these roles. Built-in optional roles: example, doc, test. Custom roles are also supported.`),withExamples:Wa().optional().describe(`Add items with examples.`),withDocs:Wa().optional().describe(`Add items with docs.`),withTests:Wa().optional().describe(`Add items with tests.`)})},async({itemNames:e,...t})=>{let h=m(t),g=await c({cwd:t.cwd,promptForContinueIfNull:!1}),_=g?.config?.providers??l,{wantedItems:v,neededRegistries:y}=u(e,{providers:_,registries:g?.config?.registries??[]}).match(e=>e,e=>{throw e}),b=(await o((await p(v,{resolvedRegistries:(await f(y,{cwd:t.cwd,providers:_})).match(e=>e,e=>{throw e}),nonInteractive:!0})).match(e=>e,e=>{throw e}),{withRoles:h})).match(e=>e,e=>{throw e}),x=await n({items:b,config:g?.config,options:{cwd:t.cwd,yes:!0}});if(x.isErr())return{content:[{type:`text`,text:Fo`
50
+ Failed to get paths for items: ${x.error.message}.
51
51
  You will need to add the paths to the users config file (if they aren't already added) like so:
52
52
  \`\`\`
53
53
  import { defineConfig } from "jsrepo";
@@ -56,30 +56,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
56
56
  // ...
57
57
  paths: {
58
58
  // ...
59
- ${_.map(e=>`"${r(e.type)}": "put the expected path here",`).join(`
59
+ ${b.map(e=>`"${r(e.type)}": "put the expected path here",`).join(`
60
60
  `)}
61
61
  },
62
62
  });
63
63
  \`\`\`
64
- `}]};let{itemPaths:te}=v.value,{neededDependencies:y,neededEnvVars:b,neededFiles:x}=(await i({configResult:m,options:{cwd:t.cwd,yes:!0,withExamples:t.withExamples??!1,withDocs:t.withDocs??!1,withTests:t.withTests??!1},itemPaths:te,items:_})).match(e=>e,e=>{throw e});return await s({files:x,options:{overwrite:!0,cwd:t.cwd,expand:!1,maxUnchanged:10}}),b&&await a(b,{options:{cwd:t.cwd,yes:!0}}),await d(y,{options:{cwd:t.cwd,yes:!0},config:m?.config}),{content:[{type:`text`,text:Ro`Added ${_.length} items to the users project:
65
- ${_.map(e=>Jc(e)).join(`
66
- `)}`}]}}),qc.tool({name:`view_registry_item`,description:`View the code and information about a registry item.`,schema:to({cwd:Gc.cwd,item:Sa().describe('The registry and name of the item to add `<registry>/<item-name>`. i.e. "github/ieedan/std/math", "@ieedan/std/math", "https://example.com/registry/math"')})},async({cwd:e,item:n})=>{let r=await c({cwd:e,promptForContinueIfNull:!1}),i=r?.config?.providers??l,a=r?.config?.registries??[],{wantedItems:s,neededRegistries:d}=u([n],{providers:i,registries:a}).match(e=>e,e=>{throw e}),m=(await o((await p(s,{resolvedRegistries:(await f(d,{cwd:e,providers:i})).match(e=>e,e=>{throw e}),nonInteractive:!0})).match(e=>e,e=>{throw e}),{options:{withExamples:!1,withDocs:!1,withTests:!1}})).match(e=>e,e=>{throw e}),h=s[0],ee=m.find(e=>e.name===h.itemName);if(!ee)throw new t(h.itemName,h.registryUrl);return{content:[{type:`text`,text:Jc(ee)}]}}),qc.tool({name:`list_items_in_registry`,description:`List items in a registry. You can optionally provide a query to filter the results.`,schema:to({cwd:Gc.cwd,registries:$a(Sa()).describe(`The registries to search for items in. i.e. ["github/ieedan/std", "@ieedan/std"]`),query:Sa().optional().describe(`The query to search for. i.e. "math"`),limit:Ua().optional().describe(`The maximum number of items to return. Defaults to 10.`),offset:Ua().optional().describe(`The numbers to skip for pagination.`)})},async({cwd:e,registries:t,query:n,limit:r,offset:i})=>{let a=r??10,o=i??0,s=(await f(t,{cwd:e,providers:(await c({cwd:e,promptForContinueIfNull:!1}))?.config?.providers??l})).match(e=>e,e=>{throw e}),u=Array.from(s.values()).flatMap(e=>e.manifest.items.map(t=>({item:t,registry:e}))),d;if(n){let e=fs.default.go(n,u,{keys:[`item.name`,`item.description`,`item.type`,`item.categories`]});if(e.length===0)return{content:[{type:`text`,text:Ro`
64
+ `}]};let{itemPaths:S}=x.value,{neededDependencies:C,neededEnvVars:w,neededFiles:T}=(await i({configResult:g,options:{cwd:t.cwd,yes:!0,withRoles:h},itemPaths:S,items:b})).match(e=>e,e=>{throw e});return await s({files:T,options:{overwrite:!0,cwd:t.cwd,expand:!1,maxUnchanged:10}}),w&&await a(w,{options:{cwd:t.cwd,yes:!0}}),await d(C,{options:{cwd:t.cwd,yes:!0},config:g?.config}),{content:[{type:`text`,text:Fo`Added ${b.length} items to the users project:
65
+ ${b.map(e=>Yc(e)).join(`
66
+ `)}`}]}}),Jc.tool({name:`view_registry_item`,description:`View the code and information about a registry item.`,schema:Qa({cwd:Kc.cwd,item:ya().describe('The registry and name of the item to add `<registry>/<item-name>`. i.e. "github/ieedan/std/math", "@ieedan/std/math", "https://example.com/registry/math"')})},async({cwd:e,item:n})=>{let r=await c({cwd:e,promptForContinueIfNull:!1}),i=r?.config?.providers??l,a=r?.config?.registries??[],{wantedItems:s,neededRegistries:d}=u([n],{providers:i,registries:a}).match(e=>e,e=>{throw e}),m=(await o((await p(s,{resolvedRegistries:(await f(d,{cwd:e,providers:i})).match(e=>e,e=>{throw e}),nonInteractive:!0})).match(e=>e,e=>{throw e}))).match(e=>e,e=>{throw e}),h=s[0],g=m.find(e=>e.name===h.itemName);if(!g)throw new t(h.itemName,h.registryUrl);return{content:[{type:`text`,text:Yc(g)}]}}),Jc.tool({name:`list_items_in_registry`,description:`List items in a registry. You can optionally provide a query to filter the results.`,schema:Qa({cwd:Kc.cwd,registries:Xa(ya()).describe(`The registries to search for items in. i.e. ["github/ieedan/std", "@ieedan/std"]`),query:ya().optional().describe(`The query to search for. i.e. "math"`),limit:Ba().optional().describe(`The maximum number of items to return. Defaults to 10.`),offset:Ba().optional().describe(`The numbers to skip for pagination.`)})},async({cwd:e,registries:t,query:n,limit:r,offset:i})=>{let a=r??10,o=i??0,s=(await f(t,{cwd:e,providers:(await c({cwd:e,promptForContinueIfNull:!1}))?.config?.providers??l})).match(e=>e,e=>{throw e}),u=Array.from(s.values()).flatMap(e=>e.manifest.items.map(t=>({item:t,registry:e}))),d;if(n){let e=ls.default.go(n,u,{keys:[`item.name`,`item.description`,`item.type`,`item.categories`]});if(e.length===0)return{content:[{type:`text`,text:Fo`
67
67
  No results found for "${n}".
68
- `}]};d=e.map(e=>e.obj)}else d=u;let p=d.slice(o,Math.min(o+a,d.length));function m(e){return Ro`
68
+ `}]};d=e.map(e=>e.obj)}else d=u;let p=d.slice(o,Math.min(o+a,d.length));function m(e){return Fo`
69
69
  ## ${e.registry.url}/${e.item.name} - ${e.item.type}
70
70
  ${e.item.description??``}
71
71
 
72
72
  Files:
73
73
  ${e.item.files.map(e=>`- ${e.path}`).join(`
74
74
  `)}
75
- `}return{content:[{type:`text`,text:Ro`
75
+ `}return{content:[{type:`text`,text:Fo`
76
76
  # Search results
77
77
  Found ${d.length} results for "${n}".
78
78
  Showing ${p.length} results.
79
79
 
80
80
  ${p.map(m).join(`
81
81
  `)}
82
- `}]}});function Jc(e){return Ro`
82
+ `}]}});function Yc(e){return Fo`
83
83
  # ${e.name} - ${e.type}${e.categories?` (Categories: ${e.categories.join(`, `)})`:``}
84
84
  ${e.description??``}
85
85
 
@@ -113,6 +113,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
113
113
  Additional info:
114
114
  ${Object.entries(e.meta??{}).map(([e,t])=>`- ${e}: ${t}`).join(`
115
115
  `)}
116
- `}new ne(qc).listen(),process.stdout.write(`Server running...
117
- `),process.stdout.write(S.default.dim(`Press ${S.default.bold(`Ctrl+C`)} to exit\n`));export{};
116
+ `}new T(Jc).listen(),process.stdout.write(`Server running...
117
+ `),process.stdout.write(E.default.dim(`Press ${E.default.bold(`Ctrl+C`)} to exit\n`));export{};
118
118
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jsrepo/mcp",
3
3
  "description": "An MCP server for jsrepo.",
4
- "version": "0.0.16",
4
+ "version": "0.0.18",
5
5
  "license": "MIT",
6
6
  "homepage": "https://jsrepo.dev/docs/mcp",
7
7
  "author": {
@@ -29,7 +29,7 @@
29
29
  "!dist/**/*.map"
30
30
  ],
31
31
  "dependencies": {
32
- "jsrepo": "3.2.1"
32
+ "jsrepo": "3.4.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@tmcp/adapter-zod": "^0.1.7",