flowpad-mcp 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "module"; const require = createRequire(import.meta.url);
|
|
2
3
|
var zb=Object.create;var dc=Object.defineProperty;var Ob=Object.getOwnPropertyDescriptor;var Nb=Object.getOwnPropertyNames;var Ab=Object.getPrototypeOf,Cb=Object.prototype.hasOwnProperty;var Ks=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var $=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},pc=(t,e)=>{for(var r in e)dc(t,r,{get:e[r],enumerable:!0})},Mb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Nb(e))!Cb.call(t,o)&&o!==r&&dc(t,o,{get:()=>e[o],enumerable:!(n=Ob(e,o))||n.enumerable});return t};var Ws=(t,e,r)=>(r=t!=null?zb(Ab(t)):{},Mb(e||!t||!t.__esModule?dc(r,"default",{value:t,enumerable:!0}):r,t));var kf=$((PO,ir)=>{var fc=Ks("fs"),Js=Ks("path"),jb=Ks("os"),Db=Ks("crypto"),wf=["\u25C8 encrypted .env [www.dotenvx.com]","\u25C8 secrets for agents [www.dotenvx.com]","\u2301 auth for agents [www.vestauth.com]","\u2318 custom filepath { path: '/custom/path/.env' }","\u2318 enable debugging { debug: true }","\u2318 override existing { override: true }","\u2318 suppress logs { quiet: true }","\u2318 multiple files { path: ['.env.local', '.env'] }"];function Lb(){return wf[Math.floor(Math.random()*wf.length)]}function Dn(t){return typeof t=="string"?!["false","0","no","off",""].includes(t.toLowerCase()):!!t}function Zb(){return process.stdout.isTTY}function Ub(t){return Zb()?`\x1B[2m${t}\x1B[0m`:t}var qb=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Fb(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
|
|
3
4
|
`);let n;for(;(n=qb.exec(r))!=null;){let o=n[1],s=n[2]||"";s=s.trim();let i=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(s=s.replace(/\\n/g,`
|
|
4
5
|
`),s=s.replace(/\\r/g,"\r")),e[o]=s}return e}function Vb(t){t=t||{};let e=Ef(t);t.path=e;let r=Ze.configDotenv(t);if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let n=$f(t).split(","),o=n.length,s;for(let i=0;i<o;i++)try{let a=n[i].trim(),c=Gb(r,a);s=Ze.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=o)throw a}return Ze.parse(s)}function Hb(t){console.error(`\u26A0 ${t}`)}function No(t){console.log(`\u2506 ${t}`)}function Sf(t){console.log(`\u25C7 ${t}`)}function $f(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Gb(t,e){let r;try{r=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let o=r.searchParams.get("environment");if(!o){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${o.toUpperCase()}`,i=t.parsed[s];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:n}}function Ef(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)fc.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=Js.resolve(process.cwd(),".env.vault");return fc.existsSync(e)?e:null}function xf(t){return t[0]==="~"?Js.join(jb.homedir(),t.slice(1)):t}function Bb(t){let e=Dn(process.env.DOTENV_CONFIG_DEBUG||t&&t.debug),r=Dn(process.env.DOTENV_CONFIG_QUIET||t&&t.quiet);(e||!r)&&Sf("loading env from encrypted .env.vault");let n=Ze._parseVault(t),o=process.env;return t&&t.processEnv!=null&&(o=t.processEnv),Ze.populate(o,n,t),{parsed:n}}function Kb(t){let e=Js.resolve(process.cwd(),".env"),r="utf8",n=process.env;t&&t.processEnv!=null&&(n=t.processEnv);let o=Dn(n.DOTENV_CONFIG_DEBUG||t&&t.debug),s=Dn(n.DOTENV_CONFIG_QUIET||t&&t.quiet);t&&t.encoding?r=t.encoding:o&&No("no encoding is specified (UTF-8 is used by default)");let i=[e];if(t&&t.path)if(!Array.isArray(t.path))i=[xf(t.path)];else{i=[];for(let l of t.path)i.push(xf(l))}let a,c={};for(let l of i)try{let d=Ze.parse(fc.readFileSync(l,{encoding:r}));Ze.populate(c,d,t)}catch(d){o&&No(`failed to load ${l} ${d.message}`),a=d}let u=Ze.populate(n,c,t);if(o=Dn(n.DOTENV_CONFIG_DEBUG||o),s=Dn(n.DOTENV_CONFIG_QUIET||s),o||!s){let l=Object.keys(u).length,d=[];for(let h of i)try{let m=Js.relative(process.cwd(),h);d.push(m)}catch(m){o&&No(`failed to load ${h} ${m.message}`),a=m}Sf(`injected env (${l}) from ${d.join(",")} ${Ub(`// tip: ${Lb()}`)}`)}return a?{parsed:c,error:a}:{parsed:c}}function Wb(t){if($f(t).length===0)return Ze.configDotenv(t);let e=Ef(t);return e?Ze._configVault(t):(Hb(`you set DOTENV_KEY but you are missing a .env.vault file at ${e}`),Ze.configDotenv(t))}function Jb(t,e){let r=Buffer.from(e.slice(-64),"hex"),n=Buffer.from(t,"base64"),o=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let i=Db.createDecipheriv("aes-256-gcm",r,o);return i.setAuthTag(s),`${i.update(n)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",u=i.message==="Unsupported state or unable to authenticate data";if(a||c){let l=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw l.code="INVALID_DOTENV_KEY",l}else if(u){let l=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw l.code="DECRYPTION_FAILED",l}else throw i}}function Xb(t,e,r={}){let n=!!(r&&r.debug),o=!!(r&&r.override),s={};if(typeof e!="object"){let i=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw i.code="OBJECT_REQUIRED",i}for(let i of Object.keys(e))Object.prototype.hasOwnProperty.call(t,i)?(o===!0&&(t[i]=e[i],s[i]=e[i]),n&&No(o===!0?`"${i}" is already defined and WAS overwritten`:`"${i}" is already defined and was NOT overwritten`)):(t[i]=e[i],s[i]=e[i]);return s}var Ze={configDotenv:Kb,_configVault:Bb,_parseVault:Vb,config:Wb,decrypt:Jb,parse:Fb,populate:Xb};ir.exports.configDotenv=Ze.configDotenv;ir.exports._configVault=Ze._configVault;ir.exports._parseVault=Ze._parseVault;ir.exports.config=Ze.config;ir.exports.decrypt=Ze.decrypt;ir.exports.parse=Ze.parse;ir.exports.populate=Ze.populate;ir.exports=Ze});var Pf=$((RO,Tf)=>{var Hr={};process.env.DOTENV_CONFIG_ENCODING!=null&&(Hr.encoding=process.env.DOTENV_CONFIG_ENCODING);process.env.DOTENV_CONFIG_PATH!=null&&(Hr.path=process.env.DOTENV_CONFIG_PATH);process.env.DOTENV_CONFIG_QUIET!=null&&(Hr.quiet=process.env.DOTENV_CONFIG_QUIET);process.env.DOTENV_CONFIG_DEBUG!=null&&(Hr.debug=process.env.DOTENV_CONFIG_DEBUG);process.env.DOTENV_CONFIG_OVERRIDE!=null&&(Hr.override=process.env.DOTENV_CONFIG_OVERRIDE);process.env.DOTENV_CONFIG_DOTENV_KEY!=null&&(Hr.DOTENV_KEY=process.env.DOTENV_CONFIG_DOTENV_KEY);Tf.exports=Hr});var If=$((IO,Rf)=>{var Yb=/^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;Rf.exports=function(e){let r=e.reduce(function(n,o){let s=o.match(Yb);return s&&(n[s[1]]=s[2]),n},{});return"quiet"in r||(r.quiet="true"),r}});var ps=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.regexpCode=le.getEsmExportName=le.getProperty=le.safeStringify=le.stringify=le.strConcat=le.addCodeArg=le.str=le._=le.nil=le._Code=le.Name=le.IDENTIFIER=le._CodeOrName=void 0;var ls=class{};le._CodeOrName=ls;le.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var gn=class extends ls{constructor(e){if(super(),!le.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};le.Name=gn;var Rt=class extends ls{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof gn&&(r[n.str]=(r[n.str]||0)+1),r),{})}};le._Code=Rt;le.nil=new Rt("");function zg(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Bl(r,e[n]),r.push(t[++n]);return new Rt(r)}le._=zg;var Gl=new Rt("+");function Og(t,...e){let r=[ds(t[0])],n=0;for(;n<e.length;)r.push(Gl),Bl(r,e[n]),r.push(Gl,ds(t[++n]));return J$(r),new Rt(r)}le.str=Og;function Bl(t,e){e instanceof Rt?t.push(...e._items):e instanceof gn?t.push(e):t.push(Q$(e))}le.addCodeArg=Bl;function J$(t){let e=1;for(;e<t.length-1;){if(t[e]===Gl){let r=X$(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function X$(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof gn||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof gn))return`"${t}${e.slice(1)}`}function Y$(t,e){return e.emptyStr()?t:t.emptyStr()?e:Og`${t}${e}`}le.strConcat=Y$;function Q$(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:ds(Array.isArray(t)?t.join(","):t)}function eE(t){return new Rt(ds(t))}le.stringify=eE;function ds(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}le.safeStringify=ds;function tE(t){return typeof t=="string"&&le.IDENTIFIER.test(t)?new Rt(`.${t}`):zg`[${t}]`}le.getProperty=tE;function rE(t){if(typeof t=="string"&&le.IDENTIFIER.test(t))return new Rt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}le.getEsmExportName=rE;function nE(t){return new Rt(t.toString())}le.regexpCode=nE});var Jl=$(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.ValueScope=ft.ValueScopeName=ft.Scope=ft.varKinds=ft.UsedValueState=void 0;var pt=ps(),Kl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},ea;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(ea||(ft.UsedValueState=ea={}));ft.varKinds={const:new pt.Name("const"),let:new pt.Name("let"),var:new pt.Name("var")};var ta=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof pt.Name?e:this.name(e)}name(e){return new pt.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ft.Scope=ta;var ra=class extends pt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,pt._)`.${new pt.Name(r)}[${n}]`}};ft.ValueScopeName=ra;var oE=(0,pt._)`\n`,Wl=class extends ta{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?oE:pt.nil}}get(){return this._scope}name(e){return new ra(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,pt._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=pt.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ea.Started);let l=r(u);if(l){let d=this.opts.es5?ft.varKinds.var:ft.varKinds.const;s=(0,pt._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,pt._)`${s}${l}${this.opts._n}`;else throw new Kl(u);c.set(u,ea.Completed)})}return s}};ft.ValueScope=Wl});var W=$(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.or=J.and=J.not=J.CodeGen=J.operators=J.varKinds=J.ValueScopeName=J.ValueScope=J.Scope=J.Name=J.regexpCode=J.stringify=J.getProperty=J.nil=J.strConcat=J.str=J._=void 0;var se=ps(),Dt=Jl(),zr=ps();Object.defineProperty(J,"_",{enumerable:!0,get:function(){return zr._}});Object.defineProperty(J,"str",{enumerable:!0,get:function(){return zr.str}});Object.defineProperty(J,"strConcat",{enumerable:!0,get:function(){return zr.strConcat}});Object.defineProperty(J,"nil",{enumerable:!0,get:function(){return zr.nil}});Object.defineProperty(J,"getProperty",{enumerable:!0,get:function(){return zr.getProperty}});Object.defineProperty(J,"stringify",{enumerable:!0,get:function(){return zr.stringify}});Object.defineProperty(J,"regexpCode",{enumerable:!0,get:function(){return zr.regexpCode}});Object.defineProperty(J,"Name",{enumerable:!0,get:function(){return zr.Name}});var ia=Jl();Object.defineProperty(J,"Scope",{enumerable:!0,get:function(){return ia.Scope}});Object.defineProperty(J,"ValueScope",{enumerable:!0,get:function(){return ia.ValueScope}});Object.defineProperty(J,"ValueScopeName",{enumerable:!0,get:function(){return ia.ValueScopeName}});Object.defineProperty(J,"varKinds",{enumerable:!0,get:function(){return ia.varKinds}});J.operators={GT:new se._Code(">"),GTE:new se._Code(">="),LT:new se._Code("<"),LTE:new se._Code("<="),EQ:new se._Code("==="),NEQ:new se._Code("!=="),NOT:new se._Code("!"),OR:new se._Code("||"),AND:new se._Code("&&"),ADD:new se._Code("+")};var fr=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Xl=class extends fr{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Dt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=ao(this.rhs,e,r)),this}get names(){return this.rhs instanceof se._CodeOrName?this.rhs.names:{}}},na=class extends fr{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof se.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ao(this.rhs,e,r),this}get names(){let e=this.lhs instanceof se.Name?{}:{...this.lhs.names};return sa(e,this.rhs)}},Yl=class extends na{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Ql=class extends fr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ed=class extends fr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},td=class extends fr{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},rd=class extends fr{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=ao(this.code,e,r),this}get names(){return this.code instanceof se._CodeOrName?this.code.names:{}}},fs=class extends fr{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(sE(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>vn(e,r.names),{})}},mr=class extends fs{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},nd=class extends fs{},io=class extends mr{};io.kind="else";var _n=class t extends mr{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new io(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Ng(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=ao(this.condition,e,r),this}get names(){let e=super.names;return sa(e,this.condition),this.else&&vn(e,this.else.names),e}};_n.kind="if";var yn=class extends mr{};yn.kind="for";var od=class extends yn{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=ao(this.iteration,e,r),this}get names(){return vn(super.names,this.iteration.names)}},sd=class extends yn{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Dt.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=sa(super.names,this.from);return sa(e,this.to)}},oa=class extends yn{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=ao(this.iterable,e,r),this}get names(){return vn(super.names,this.iterable.names)}},ms=class extends mr{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ms.kind="func";var hs=class extends fs{render(e){return"return "+super.render(e)}};hs.kind="return";var id=class extends mr{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&vn(e,this.catch.names),this.finally&&vn(e,this.finally.names),e}},gs=class extends mr{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};gs.kind="catch";var _s=class extends mr{render(e){return"finally"+super.render(e)}};_s.kind="finally";var ad=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
@@ -37,7 +38,7 @@ var zb=Object.create;var dc=Object.defineProperty;var Ob=Object.getOwnPropertyDe
|
|
|
37
38
|
|
|
38
39
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){i(l);continue}if(n.external){let m=n.external.registry.get(l[0])?.id;if(e!==l[0]&&m){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let h=this.seen.get(l),m=h.def??h.schema,p={...m};if(h.ref===null)return;let f=h.ref;if(h.ref=null,f){a(f,d);let g=this.seen.get(f).schema;g.$ref&&d.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(g)):(Object.assign(m,g),Object.assign(m,p))}h.isParent||this.override({zodSchema:l,jsonSchema:m,path:h.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function ul(t,e){if(t instanceof Fo){let n=new mi(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let s={},i={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;s[c]=n.emit(u,{...e,external:i})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let r=new mi(e);return r.process(t),r.emit(t,e)}function Ue(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Ue(o.element,r);case"object":{for(let s in o.shape)if(Ue(o.shape[s],r))return!0;return!1}case"union":{for(let s of o.options)if(Ue(s,r))return!0;return!1}case"intersection":return Ue(o.left,r)||Ue(o.right,r);case"tuple":{for(let s of o.items)if(Ue(s,r))return!0;return!!(o.rest&&Ue(o.rest,r))}case"record":return Ue(o.keyType,r)||Ue(o.valueType,r);case"map":return Ue(o.keyType,r)||Ue(o.valueType,r);case"set":return Ue(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ue(o.innerType,r);case"lazy":return Ue(o.getter(),r);case"default":return Ue(o.innerType,r);case"prefault":return Ue(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Ue(o.in,r)||Ue(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var Go={};pc(Go,{ZodISODate:()=>Km,ZodISODateTime:()=>Bm,ZodISODuration:()=>Jm,ZodISOTime:()=>Wm,date:()=>dl,datetime:()=>ll,duration:()=>fl,time:()=>pl});var Bm=x("ZodISODateTime",(t,e)=>{Am.init(t,e),Pe.init(t,e)});function ll(t){return Um(Bm,t)}var Km=x("ZodISODate",(t,e)=>{Cm.init(t,e),Pe.init(t,e)});function dl(t){return qm(Km,t)}var Wm=x("ZodISOTime",(t,e)=>{Mm.init(t,e),Pe.init(t,e)});function pl(t){return Fm(Wm,t)}var Jm=x("ZodISODuration",(t,e)=>{jm.init(t,e),Pe.init(t,e)});function fl(t){return Vm(Jm,t)}var Xm=(t,e)=>{ti.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Ec(t,r)},flatten:{value:r=>$c(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},vN=x("ZodError",Xm),Bo=x("ZodError",Xm,{Parent:Error});var Ym=kc(Bo),Qm=Pc(Bo),eh=Ic(Bo),th=zc(Bo);var Ne=x("ZodType",(t,e)=>(he.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>wt(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>Ym(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>eh(t,r,n),t.parseAsync=async(r,n)=>Qm(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>th(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Yx(r,n)),t.superRefine=r=>t.check(Qx(r)),t.overwrite=r=>t.check(Jr(r)),t.optional=()=>Ie(t),t.nullable=()=>oh(t),t.nullish=()=>Ie(oh(t)),t.nonoptional=r=>Hx(t,r),t.array=()=>ne(t),t.or=r=>Ee([t,r]),t.and=r=>gi(t,r),t.transform=r=>hl(t,lh(r)),t.default=r=>qx(t,r),t.prefault=r=>Vx(t,r),t.catch=r=>Bx(t,r),t.pipe=r=>hl(t,r),t.readonly=()=>Jx(t),t.describe=r=>{let n=t.clone();return wr.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return wr.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return wr.get(t);let n=t.clone();return wr.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),sh=x("_ZodString",(t,e)=>{qo.init(t,e),Ne.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Xu(...n)),t.includes=(...n)=>t.check(el(...n)),t.startsWith=(...n)=>t.check(tl(...n)),t.endsWith=(...n)=>t.check(rl(...n)),t.min=(...n)=>t.check(Un(...n)),t.max=(...n)=>t.check(pi(...n)),t.length=(...n)=>t.check(fi(...n)),t.nonempty=(...n)=>t.check(Un(1,...n)),t.lowercase=n=>t.check(Yu(n)),t.uppercase=n=>t.check(Qu(n)),t.trim=()=>t.check(ol()),t.normalize=(...n)=>t.check(nl(...n)),t.toLowerCase=()=>t.check(sl()),t.toUpperCase=()=>t.check(il())}),lx=x("ZodString",(t,e)=>{qo.init(t,e),sh.init(t,e),t.email=r=>t.check($u(dx,r)),t.url=r=>t.check(Ru(px,r)),t.jwt=r=>t.check(Vu(Tx,r)),t.emoji=r=>t.check(Iu(fx,r)),t.guid=r=>t.check(ci(rh,r)),t.uuid=r=>t.check(Eu(hi,r)),t.uuidv4=r=>t.check(ku(hi,r)),t.uuidv6=r=>t.check(Tu(hi,r)),t.uuidv7=r=>t.check(Pu(hi,r)),t.nanoid=r=>t.check(zu(mx,r)),t.guid=r=>t.check(ci(rh,r)),t.cuid=r=>t.check(Ou(hx,r)),t.cuid2=r=>t.check(Nu(gx,r)),t.ulid=r=>t.check(Au(_x,r)),t.base64=r=>t.check(Uu($x,r)),t.base64url=r=>t.check(qu(Ex,r)),t.xid=r=>t.check(Cu(yx,r)),t.ksuid=r=>t.check(Mu(vx,r)),t.ipv4=r=>t.check(ju(bx,r)),t.ipv6=r=>t.check(Du(wx,r)),t.cidrv4=r=>t.check(Lu(xx,r)),t.cidrv6=r=>t.check(Zu(Sx,r)),t.e164=r=>t.check(Fu(kx,r)),t.datetime=r=>t.check(ll(r)),t.date=r=>t.check(dl(r)),t.time=r=>t.check(pl(r)),t.duration=r=>t.check(fl(r))});function w(t){return Su(lx,t)}var Pe=x("ZodStringFormat",(t,e)=>{xe.init(t,e),sh.init(t,e)}),dx=x("ZodEmail",(t,e)=>{Lc.init(t,e),Pe.init(t,e)});var rh=x("ZodGUID",(t,e)=>{jc.init(t,e),Pe.init(t,e)});var hi=x("ZodUUID",(t,e)=>{Dc.init(t,e),Pe.init(t,e)});var px=x("ZodURL",(t,e)=>{Zc.init(t,e),Pe.init(t,e)});var fx=x("ZodEmoji",(t,e)=>{Uc.init(t,e),Pe.init(t,e)});var mx=x("ZodNanoID",(t,e)=>{qc.init(t,e),Pe.init(t,e)});var hx=x("ZodCUID",(t,e)=>{Fc.init(t,e),Pe.init(t,e)});var gx=x("ZodCUID2",(t,e)=>{Vc.init(t,e),Pe.init(t,e)});var _x=x("ZodULID",(t,e)=>{Hc.init(t,e),Pe.init(t,e)});var yx=x("ZodXID",(t,e)=>{Gc.init(t,e),Pe.init(t,e)});var vx=x("ZodKSUID",(t,e)=>{Bc.init(t,e),Pe.init(t,e)});var bx=x("ZodIPv4",(t,e)=>{Kc.init(t,e),Pe.init(t,e)});var wx=x("ZodIPv6",(t,e)=>{Wc.init(t,e),Pe.init(t,e)});var xx=x("ZodCIDRv4",(t,e)=>{Jc.init(t,e),Pe.init(t,e)});var Sx=x("ZodCIDRv6",(t,e)=>{Xc.init(t,e),Pe.init(t,e)});var $x=x("ZodBase64",(t,e)=>{Yc.init(t,e),Pe.init(t,e)});var Ex=x("ZodBase64URL",(t,e)=>{Qc.init(t,e),Pe.init(t,e)});var kx=x("ZodE164",(t,e)=>{eu.init(t,e),Pe.init(t,e)});var Tx=x("ZodJWT",(t,e)=>{tu.init(t,e),Pe.init(t,e)});var ih=x("ZodNumber",(t,e)=>{si.init(t,e),Ne.init(t,e),t.gt=(n,o)=>t.check(li(n,o)),t.gte=(n,o)=>t.check(Ho(n,o)),t.min=(n,o)=>t.check(Ho(n,o)),t.lt=(n,o)=>t.check(ui(n,o)),t.lte=(n,o)=>t.check(Vo(n,o)),t.max=(n,o)=>t.check(Vo(n,o)),t.int=n=>t.check(nh(n)),t.safe=n=>t.check(nh(n)),t.positive=n=>t.check(li(0,n)),t.nonnegative=n=>t.check(Ho(0,n)),t.negative=n=>t.check(ui(0,n)),t.nonpositive=n=>t.check(Vo(0,n)),t.multipleOf=(n,o)=>t.check(di(n,o)),t.step=(n,o)=>t.check(di(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function fe(t){return Hu(ih,t)}var Px=x("ZodNumberFormat",(t,e)=>{ru.init(t,e),ih.init(t,e)});function nh(t){return Gu(Px,t)}var Rx=x("ZodBoolean",(t,e)=>{nu.init(t,e),Ne.init(t,e)});function Fe(t){return Bu(Rx,t)}var Ix=x("ZodNull",(t,e)=>{ou.init(t,e),Ne.init(t,e)});function ah(t){return Ku(Ix,t)}var zx=x("ZodUnknown",(t,e)=>{su.init(t,e),Ne.init(t,e)});function Re(){return Wu(zx)}var Ox=x("ZodNever",(t,e)=>{iu.init(t,e),Ne.init(t,e)});function Nx(t){return Ju(Ox,t)}var Ax=x("ZodArray",(t,e)=>{au.init(t,e),Ne.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Un(r,n)),t.nonempty=r=>t.check(Un(1,r)),t.max=(r,n)=>t.check(pi(r,n)),t.length=(r,n)=>t.check(fi(r,n)),t.unwrap=()=>t.element});function ne(t,e){return Hm(Ax,t,e)}var ch=x("ZodObject",(t,e)=>{ii.init(t,e),Ne.init(t,e),re.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>ct(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Re()}),t.loose=()=>t.clone({...t._zod.def,catchall:Re()}),t.strict=()=>t.clone({...t._zod.def,catchall:Nx()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>re.extend(t,r),t.merge=r=>re.merge(t,r),t.pick=r=>re.pick(t,r),t.omit=r=>re.omit(t,r),t.partial=(...r)=>re.partial(dh,t,r[0]),t.required=(...r)=>re.required(ph,t,r[0])});function I(t,e){let r={type:"object",get shape(){return re.assignProp(this,"shape",{...t}),this.shape},...re.normalizeParams(e)};return new ch(r)}function nt(t,e){return new ch({type:"object",get shape(){return re.assignProp(this,"shape",{...t}),this.shape},catchall:Re(),...re.normalizeParams(e)})}var uh=x("ZodUnion",(t,e)=>{ai.init(t,e),Ne.init(t,e),t.options=e.options});function Ee(t,e){return new uh({type:"union",options:t,...re.normalizeParams(e)})}var Cx=x("ZodDiscriminatedUnion",(t,e)=>{uh.init(t,e),cu.init(t,e)});function gl(t,e,r){return new Cx({type:"union",options:e,discriminator:t,...re.normalizeParams(r)})}var Mx=x("ZodIntersection",(t,e)=>{uu.init(t,e),Ne.init(t,e)});function gi(t,e){return new Mx({type:"intersection",left:t,right:e})}var jx=x("ZodRecord",(t,e)=>{lu.init(t,e),Ne.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Se(t,e,r){return new jx({type:"record",keyType:t,valueType:e,...re.normalizeParams(r)})}var ml=x("ZodEnum",(t,e)=>{du.init(t,e),Ne.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ml({...e,checks:[],...re.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ml({...e,checks:[],...re.normalizeParams(o),entries:s})}});function ct(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new ml({type:"enum",entries:r,...re.normalizeParams(e)})}var Dx=x("ZodLiteral",(t,e)=>{pu.init(t,e),Ne.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function A(t,e){return new Dx({type:"literal",values:Array.isArray(t)?t:[t],...re.normalizeParams(e)})}var Lx=x("ZodTransform",(t,e)=>{fu.init(t,e),Ne.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(re.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(re.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function lh(t){return new Lx({type:"transform",transform:t})}var dh=x("ZodOptional",(t,e)=>{mu.init(t,e),Ne.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ie(t){return new dh({type:"optional",innerType:t})}var Zx=x("ZodNullable",(t,e)=>{hu.init(t,e),Ne.init(t,e),t.unwrap=()=>t._zod.def.innerType});function oh(t){return new Zx({type:"nullable",innerType:t})}var Ux=x("ZodDefault",(t,e)=>{gu.init(t,e),Ne.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function qx(t,e){return new Ux({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Fx=x("ZodPrefault",(t,e)=>{_u.init(t,e),Ne.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Vx(t,e){return new Fx({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var ph=x("ZodNonOptional",(t,e)=>{yu.init(t,e),Ne.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Hx(t,e){return new ph({type:"nonoptional",innerType:t,...re.normalizeParams(e)})}var Gx=x("ZodCatch",(t,e)=>{vu.init(t,e),Ne.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Bx(t,e){return new Gx({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Kx=x("ZodPipe",(t,e)=>{bu.init(t,e),Ne.init(t,e),t.in=e.in,t.out=e.out});function hl(t,e){return new Kx({type:"pipe",in:t,out:e})}var Wx=x("ZodReadonly",(t,e)=>{wu.init(t,e),Ne.init(t,e)});function Jx(t){return new Wx({type:"readonly",innerType:t})}var fh=x("ZodCustom",(t,e)=>{xu.init(t,e),Ne.init(t,e)});function Xx(t){let e=new He({check:"custom"});return e._zod.check=t,e}function mh(t,e){return al(fh,t??(()=>!0),e)}function Yx(t,e={}){return cl(fh,t,e)}function Qx(t){let e=Xx(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(re.issue(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(re.issue(o))}},t(r.value,r)));return e}function _l(t,e){return hl(lh(t),e)}bt(Lm());var vl="2025-11-25",hh="2025-03-26",Fn=[vl,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],xr="io.modelcontextprotocol/related-task",yi="2.0",qe=mh(t=>t!==null&&(typeof t=="object"||typeof t=="function")),gh=Ee([w(),fe().int()]),_h=w(),NN=nt({ttl:fe().optional(),pollInterval:fe().optional()}),e0=I({ttl:fe().optional()}),t0=I({taskId:w()}),bl=nt({progressToken:gh.optional(),[xr]:t0.optional()}),xt=I({_meta:bl.optional()}),Ko=xt.extend({task:e0.optional()}),yh=t=>Ko.safeParse(t).success,Ge=I({method:w(),params:xt.loose().optional()}),$t=I({_meta:bl.optional()}),Et=I({method:w(),params:$t.loose().optional()}),Be=nt({_meta:bl.optional()}),vi=Ee([w(),fe().int()]),vh=I({jsonrpc:A(yi),id:vi,...Ge.shape}).strict(),Sr=t=>vh.safeParse(t).success,bh=I({jsonrpc:A(yi),...Et.shape}).strict(),wh=t=>bh.safeParse(t).success,wl=I({jsonrpc:A(yi),id:vi,result:Be}).strict(),cr=t=>wl.safeParse(t).success;var M;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(M||(M={}));var xl=I({jsonrpc:A(yi),id:vi.optional(),error:I({code:fe().int(),message:w(),data:Re().optional()})}).strict();var Vn=t=>xl.safeParse(t).success;var Wo=Ee([vh,bh,wl,xl]),AN=Ee([wl,xl]),bi=Be.strict(),r0=$t.extend({requestId:vi.optional(),reason:w().optional()}),wi=Et.extend({method:A("notifications/cancelled"),params:r0}),n0=I({src:w(),mimeType:w().optional(),sizes:ne(w()).optional(),theme:ct(["light","dark"]).optional()}),Jo=I({icons:ne(n0).optional()}),qn=I({name:w(),title:w().optional()}),xh=qn.extend({...qn.shape,...Jo.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),o0=gi(I({applyDefaults:Fe().optional()}),Se(w(),Re())),s0=_l(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,gi(I({form:o0.optional(),url:qe.optional()}),Se(w(),Re()).optional())),i0=nt({list:qe.optional(),cancel:qe.optional(),requests:nt({sampling:nt({createMessage:qe.optional()}).optional(),elicitation:nt({create:qe.optional()}).optional()}).optional()}),a0=nt({list:qe.optional(),cancel:qe.optional(),requests:nt({tools:nt({call:qe.optional()}).optional()}).optional()}),c0=I({experimental:Se(w(),qe).optional(),sampling:I({context:qe.optional(),tools:qe.optional()}).optional(),elicitation:s0.optional(),roots:I({listChanged:Fe().optional()}).optional(),tasks:i0.optional(),extensions:Se(w(),qe).optional()}),u0=xt.extend({protocolVersion:w(),capabilities:c0,clientInfo:xh}),xi=Ge.extend({method:A("initialize"),params:u0}),Xo=t=>xi.safeParse(t).success,l0=I({experimental:Se(w(),qe).optional(),logging:qe.optional(),completions:qe.optional(),prompts:I({listChanged:Fe().optional()}).optional(),resources:I({subscribe:Fe().optional(),listChanged:Fe().optional()}).optional(),tools:I({listChanged:Fe().optional()}).optional(),tasks:a0.optional(),extensions:Se(w(),qe).optional()}),d0=Be.extend({protocolVersion:w(),capabilities:l0,serverInfo:xh,instructions:w().optional()}),Sl=Et.extend({method:A("notifications/initialized"),params:$t.optional()});var Si=Ge.extend({method:A("ping"),params:xt.optional()}),p0=I({progress:fe(),total:Ie(fe()),message:Ie(w())}),f0=I({...$t.shape,...p0.shape,progressToken:gh}),$i=Et.extend({method:A("notifications/progress"),params:f0}),m0=xt.extend({cursor:_h.optional()}),Yo=Ge.extend({params:m0.optional()}),Qo=Be.extend({nextCursor:_h.optional()}),h0=ct(["working","input_required","completed","failed","cancelled"]),es=I({taskId:w(),status:h0,ttl:Ee([fe(),ah()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:Ie(fe()),statusMessage:Ie(w())}),Hn=Be.extend({task:es}),g0=$t.merge(es),ts=Et.extend({method:A("notifications/tasks/status"),params:g0}),Ei=Ge.extend({method:A("tasks/get"),params:xt.extend({taskId:w()})}),ki=Be.merge(es),Ti=Ge.extend({method:A("tasks/result"),params:xt.extend({taskId:w()})}),CN=Be.loose(),Pi=Yo.extend({method:A("tasks/list")}),Ri=Qo.extend({tasks:ne(es)}),Ii=Ge.extend({method:A("tasks/cancel"),params:xt.extend({taskId:w()})}),Sh=Be.merge(es),$h=I({uri:w(),mimeType:Ie(w()),_meta:Se(w(),Re()).optional()}),Eh=$h.extend({text:w()}),$l=w().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),kh=$h.extend({blob:$l}),rs=ct(["user","assistant"]),Gn=I({audience:ne(rs).optional(),priority:fe().min(0).max(1).optional(),lastModified:Go.datetime({offset:!0}).optional()}),Th=I({...qn.shape,...Jo.shape,uri:w(),description:Ie(w()),mimeType:Ie(w()),size:Ie(fe()),annotations:Gn.optional(),_meta:Ie(nt({}))}),_0=I({...qn.shape,...Jo.shape,uriTemplate:w(),description:Ie(w()),mimeType:Ie(w()),annotations:Gn.optional(),_meta:Ie(nt({}))}),zi=Yo.extend({method:A("resources/list")}),y0=Qo.extend({resources:ne(Th)}),Oi=Yo.extend({method:A("resources/templates/list")}),v0=Qo.extend({resourceTemplates:ne(_0)}),El=xt.extend({uri:w()}),b0=El,Ni=Ge.extend({method:A("resources/read"),params:b0}),w0=Be.extend({contents:ne(Ee([Eh,kh]))}),x0=Et.extend({method:A("notifications/resources/list_changed"),params:$t.optional()}),S0=El,$0=Ge.extend({method:A("resources/subscribe"),params:S0}),E0=El,k0=Ge.extend({method:A("resources/unsubscribe"),params:E0}),T0=$t.extend({uri:w()}),P0=Et.extend({method:A("notifications/resources/updated"),params:T0}),R0=I({name:w(),description:Ie(w()),required:Ie(Fe())}),I0=I({...qn.shape,...Jo.shape,description:Ie(w()),arguments:Ie(ne(R0)),_meta:Ie(nt({}))}),Ai=Yo.extend({method:A("prompts/list")}),z0=Qo.extend({prompts:ne(I0)}),O0=xt.extend({name:w(),arguments:Se(w(),w()).optional()}),Ci=Ge.extend({method:A("prompts/get"),params:O0}),kl=I({type:A("text"),text:w(),annotations:Gn.optional(),_meta:Se(w(),Re()).optional()}),Tl=I({type:A("image"),data:$l,mimeType:w(),annotations:Gn.optional(),_meta:Se(w(),Re()).optional()}),Pl=I({type:A("audio"),data:$l,mimeType:w(),annotations:Gn.optional(),_meta:Se(w(),Re()).optional()}),N0=I({type:A("tool_use"),name:w(),id:w(),input:Se(w(),Re()),_meta:Se(w(),Re()).optional()}),A0=I({type:A("resource"),resource:Ee([Eh,kh]),annotations:Gn.optional(),_meta:Se(w(),Re()).optional()}),C0=Th.extend({type:A("resource_link")}),Rl=Ee([kl,Tl,Pl,C0,A0]),M0=I({role:rs,content:Rl}),j0=Be.extend({description:w().optional(),messages:ne(M0)}),D0=Et.extend({method:A("notifications/prompts/list_changed"),params:$t.optional()}),L0=I({title:w().optional(),readOnlyHint:Fe().optional(),destructiveHint:Fe().optional(),idempotentHint:Fe().optional(),openWorldHint:Fe().optional()}),Z0=I({taskSupport:ct(["required","optional","forbidden"]).optional()}),Ph=I({...qn.shape,...Jo.shape,description:w().optional(),inputSchema:I({type:A("object"),properties:Se(w(),qe).optional(),required:ne(w()).optional()}).catchall(Re()),outputSchema:I({type:A("object"),properties:Se(w(),qe).optional(),required:ne(w()).optional()}).catchall(Re()).optional(),annotations:L0.optional(),execution:Z0.optional(),_meta:Se(w(),Re()).optional()}),Mi=Yo.extend({method:A("tools/list")}),U0=Qo.extend({tools:ne(Ph)}),ji=Be.extend({content:ne(Rl).default([]),structuredContent:Se(w(),Re()).optional(),isError:Fe().optional()}),MN=ji.or(Be.extend({toolResult:Re()})),q0=Ko.extend({name:w(),arguments:Se(w(),Re()).optional()}),Bn=Ge.extend({method:A("tools/call"),params:q0}),F0=Et.extend({method:A("notifications/tools/list_changed"),params:$t.optional()}),jN=I({autoRefresh:Fe().default(!0),debounceMs:fe().int().nonnegative().default(300)}),ns=ct(["debug","info","notice","warning","error","critical","alert","emergency"]),V0=xt.extend({level:ns}),Il=Ge.extend({method:A("logging/setLevel"),params:V0}),H0=$t.extend({level:ns,logger:w().optional(),data:Re()}),G0=Et.extend({method:A("notifications/message"),params:H0}),B0=I({name:w().optional()}),K0=I({hints:ne(B0).optional(),costPriority:fe().min(0).max(1).optional(),speedPriority:fe().min(0).max(1).optional(),intelligencePriority:fe().min(0).max(1).optional()}),W0=I({mode:ct(["auto","required","none"]).optional()}),J0=I({type:A("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:ne(Rl).default([]),structuredContent:I({}).loose().optional(),isError:Fe().optional(),_meta:Se(w(),Re()).optional()}),X0=gl("type",[kl,Tl,Pl]),_i=gl("type",[kl,Tl,Pl,N0,J0]),Y0=I({role:rs,content:Ee([_i,ne(_i)]),_meta:Se(w(),Re()).optional()}),Q0=Ko.extend({messages:ne(Y0),modelPreferences:K0.optional(),systemPrompt:w().optional(),includeContext:ct(["none","thisServer","allServers"]).optional(),temperature:fe().optional(),maxTokens:fe().int(),stopSequences:ne(w()).optional(),metadata:qe.optional(),tools:ne(Ph).optional(),toolChoice:W0.optional()}),eS=Ge.extend({method:A("sampling/createMessage"),params:Q0}),os=Be.extend({model:w(),stopReason:Ie(ct(["endTurn","stopSequence","maxTokens"]).or(w())),role:rs,content:X0}),zl=Be.extend({model:w(),stopReason:Ie(ct(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:rs,content:Ee([_i,ne(_i)])}),tS=I({type:A("boolean"),title:w().optional(),description:w().optional(),default:Fe().optional()}),rS=I({type:A("string"),title:w().optional(),description:w().optional(),minLength:fe().optional(),maxLength:fe().optional(),format:ct(["email","uri","date","date-time"]).optional(),default:w().optional()}),nS=I({type:ct(["number","integer"]),title:w().optional(),description:w().optional(),minimum:fe().optional(),maximum:fe().optional(),default:fe().optional()}),oS=I({type:A("string"),title:w().optional(),description:w().optional(),enum:ne(w()),default:w().optional()}),sS=I({type:A("string"),title:w().optional(),description:w().optional(),oneOf:ne(I({const:w(),title:w()})),default:w().optional()}),iS=I({type:A("string"),title:w().optional(),description:w().optional(),enum:ne(w()),enumNames:ne(w()).optional(),default:w().optional()}),aS=Ee([oS,sS]),cS=I({type:A("array"),title:w().optional(),description:w().optional(),minItems:fe().optional(),maxItems:fe().optional(),items:I({type:A("string"),enum:ne(w())}),default:ne(w()).optional()}),uS=I({type:A("array"),title:w().optional(),description:w().optional(),minItems:fe().optional(),maxItems:fe().optional(),items:I({anyOf:ne(I({const:w(),title:w()}))}),default:ne(w()).optional()}),lS=Ee([cS,uS]),dS=Ee([iS,aS,lS]),pS=Ee([dS,tS,rS,nS]),fS=Ko.extend({mode:A("form").optional(),message:w(),requestedSchema:I({type:A("object"),properties:Se(w(),pS),required:ne(w()).optional()})}),mS=Ko.extend({mode:A("url"),message:w(),elicitationId:w(),url:w().url()}),hS=Ee([fS,mS]),gS=Ge.extend({method:A("elicitation/create"),params:hS}),_S=$t.extend({elicitationId:w()}),yS=Et.extend({method:A("notifications/elicitation/complete"),params:_S}),Kn=Be.extend({action:ct(["accept","decline","cancel"]),content:_l(t=>t===null?void 0:t,Se(w(),Ee([w(),fe(),Fe(),ne(w())])).optional())}),vS=I({type:A("ref/resource"),uri:w()});var bS=I({type:A("ref/prompt"),name:w()}),wS=xt.extend({ref:Ee([bS,vS]),argument:I({name:w(),value:w()}),context:I({arguments:Se(w(),w()).optional()}).optional()}),Di=Ge.extend({method:A("completion/complete"),params:wS});function Rh(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Ih(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var xS=Be.extend({completion:nt({values:ne(w()).max(100),total:Ie(fe().int()),hasMore:Ie(Fe())})}),SS=I({uri:w().startsWith("file://"),name:w().optional(),_meta:Se(w(),Re()).optional()}),$S=Ge.extend({method:A("roots/list"),params:xt.optional()}),Ol=Be.extend({roots:ne(SS)}),ES=Et.extend({method:A("notifications/roots/list_changed"),params:$t.optional()}),DN=Ee([Si,xi,Di,Il,Ci,Ai,zi,Oi,Ni,$0,k0,Bn,Mi,Ei,Ti,Pi,Ii]),LN=Ee([wi,$i,Sl,ES,ts]),ZN=Ee([bi,os,zl,Kn,Ol,ki,Ri,Hn]),UN=Ee([Si,eS,gS,$S,Ei,Ti,Pi,Ii]),qN=Ee([wi,$i,G0,P0,x0,F0,D0,ts,yS]),FN=Ee([bi,d0,xS,j0,z0,y0,v0,w0,ji,U0,ki,Ri,Hn]),N=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===M.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new yl(o.elicitations,r)}return new t(e,r,n)}},yl=class extends N{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(M.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};var Li=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
39
40
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),kS(r)}clear(){this._buffer=void 0}};function kS(t){return Wo.parse(JSON.parse(t))}function zh(t){return JSON.stringify(t)+`
|
|
40
|
-
`}var Zi=class{constructor(e=Oh.stdin,r=Oh.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Li,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=zh(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var b={};pc(b,{BRAND:()=>YS,DIRTY:()=>Yr,EMPTY_PATH:()=>IS,INVALID:()=>U,NEVER:()=>C$,OK:()=>Ye,ParseStatus:()=>Ke,Schema:()=>K,ZodAny:()=>kr,ZodArray:()=>pr,ZodBigInt:()=>en,ZodBoolean:()=>tn,ZodBranded:()=>is,ZodCatch:()=>fn,ZodDate:()=>rn,ZodDefault:()=>pn,ZodDiscriminatedUnion:()=>Fi,ZodEffects:()=>Tt,ZodEnum:()=>ln,ZodError:()=>ut,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Hi,ZodIntersection:()=>an,ZodIssueCode:()=>E,ZodLazy:()=>cn,ZodLiteral:()=>un,ZodMap:()=>eo,ZodNaN:()=>ro,ZodNativeEnum:()=>dn,ZodNever:()=>Ct,ZodNull:()=>on,ZodNullable:()=>Bt,ZodNumber:()=>Qr,ZodObject:()=>dt,ZodOptional:()=>lt,ZodParsedType:()=>R,ZodPipeline:()=>as,ZodPromise:()=>Tr,ZodReadonly:()=>mn,ZodRecord:()=>Vi,ZodSchema:()=>K,ZodSet:()=>to,ZodString:()=>Er,ZodSymbol:()=>Yn,ZodTransformer:()=>Tt,ZodTuple:()=>Gt,ZodType:()=>K,ZodUndefined:()=>nn,ZodUnion:()=>sn,ZodUnknown:()=>dr,ZodVoid:()=>Qn,addIssueToContext:()=>P,any:()=>a$,array:()=>d$,bigint:()=>r$,boolean:()=>Fh,coerce:()=>A$,custom:()=>Zh,date:()=>n$,datetimeRegex:()=>Dh,defaultErrorMap:()=>ur,discriminatedUnion:()=>m$,effect:()=>k$,enum:()=>S$,function:()=>b$,getErrorMap:()=>Wn,getParsedType:()=>Ht,instanceof:()=>e$,intersection:()=>h$,isAborted:()=>Ui,isAsync:()=>Jn,isDirty:()=>qi,isValid:()=>$r,late:()=>QS,lazy:()=>w$,literal:()=>x$,makeIssue:()=>ss,map:()=>y$,nan:()=>t$,nativeEnum:()=>$$,never:()=>u$,null:()=>i$,nullable:()=>P$,number:()=>qh,object:()=>Ml,objectUtil:()=>Nl,oboolean:()=>N$,onumber:()=>O$,optional:()=>T$,ostring:()=>z$,pipeline:()=>I$,preprocess:()=>R$,promise:()=>E$,quotelessJson:()=>TS,record:()=>_$,set:()=>v$,setErrorMap:()=>RS,strictObject:()=>p$,string:()=>Uh,symbol:()=>o$,transformer:()=>k$,tuple:()=>g$,undefined:()=>s$,union:()=>f$,unknown:()=>c$,util:()=>ee,void:()=>l$});var ee;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ee||(ee={}));var Nl;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Nl||(Nl={}));var R=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map<"u"&&t instanceof Map?R.map:typeof Set<"u"&&t instanceof Set?R.set:typeof Date<"u"&&t instanceof Date?R.date:R.object;default:return R.unknown}};var E=ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),TS=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ut=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=t=>new ut(t);var PS=(t,e)=>{let r;switch(t.code){case E.invalid_type:t.received===R.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case E.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ee.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(t.keys,", ")}`;break;case E.invalid_union:r="Invalid input";break;case E.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(t.options)}`;break;case E.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(t.options)}, received '${t.received}'`;break;case E.invalid_arguments:r="Invalid function arguments";break;case E.invalid_return_type:r="Invalid function return type";break;case E.invalid_date:r="Invalid date";break;case E.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ee.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case E.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case E.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case E.custom:r="Invalid input";break;case E.invalid_intersection_types:r="Intersection results could not be merged";break;case E.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case E.not_finite:r="Number must be finite";break;default:r=e.defaultError,ee.assertNever(t)}return{message:r}},ur=PS;var Nh=ur;function RS(t){Nh=t}function Wn(){return Nh}var ss=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},IS=[];function P(t,e){let r=Wn(),n=ss({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ur?void 0:ur].filter(o=>!!o)});t.common.issues.push(n)}var Ke=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return U;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return U;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},U=Object.freeze({status:"aborted"}),Yr=t=>({status:"dirty",value:t}),Ye=t=>({status:"valid",value:t}),Ui=t=>t.status==="aborted",qi=t=>t.status==="dirty",$r=t=>t.status==="valid",Jn=t=>typeof Promise<"u"&&t instanceof Promise;var O;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(O||(O={}));var kt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ah=(t,e)=>{if($r(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ut(t.common.issues);return this._error=r,this._error}}};function G(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var K=class{get description(){return this._def.description}_getType(e){return Ht(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ke,ctx:{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Jn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Ah(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return $r(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>$r(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(Jn(o)?o:Promise.resolve(o));return Ah(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:E.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Tt({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return lt.create(this,this._def)}nullable(){return Bt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pr.create(this)}promise(){return Tr.create(this,this._def)}or(e){return sn.create([this,e],this._def)}and(e){return an.create(this,e,this._def)}transform(e){return new Tt({...G(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new pn({...G(this._def),innerType:this,defaultValue:r,typeName:k.ZodDefault})}brand(){return new is({typeName:k.ZodBranded,type:this,...G(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new fn({...G(this._def),innerType:this,catchValue:r,typeName:k.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return as.create(this,e)}readonly(){return mn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zS=/^c[^\s-]{8,}$/i,OS=/^[0-9a-z]+$/,NS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,AS=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,CS=/^[a-z0-9_-]{21}$/i,MS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,DS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,LS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Al,ZS=/^(?:(?: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])$/,US=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,qS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,FS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,HS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mh="((\\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])))",GS=new RegExp(`^${Mh}$`);function jh(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function BS(t){return new RegExp(`^${jh(t)}$`)}function Dh(t){let e=`${Mh}T${jh(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function KS(t,e){return!!((e==="v4"||!e)&&ZS.test(t)||(e==="v6"||!e)&&qS.test(t))}function WS(t,e){if(!MS.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function JS(t,e){return!!((e==="v4"||!e)&&US.test(t)||(e==="v6"||!e)&&FS.test(t))}var Er=class t extends K{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_type,expected:R.string,received:s.parsedType}),U}let n=new Ke,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?P(o,{code:E.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&P(o,{code:E.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")DS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"email",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Al||(Al=new RegExp(LS,"u")),Al.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"emoji",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")AS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"uuid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")CS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"nanoid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")zS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"cuid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")OS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"cuid2",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")NS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"ulid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),P(o,{validation:"url",code:E.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"regex",code:E.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Dh(s).test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?GS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?BS(s).test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?jS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"duration",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?KS(e.data,s.version)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"ip",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?WS(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"jwt",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?JS(e.data,s.version)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"cidr",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?VS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"base64",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?HS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"base64url",code:E.invalid_string,message:s.message}),n.dirty()):ee.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:E.invalid_string,...O.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...O.errToObj(e)})}url(e){return this._addCheck({kind:"url",...O.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...O.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...O.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...O.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...O.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...O.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...O.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...O.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...O.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...O.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...O.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...O.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...O.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...O.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...O.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...O.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...O.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...O.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...O.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...O.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...O.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...O.errToObj(r)})}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Er.create=t=>new Er({checks:[],typeName:k.ZodString,coerce:t?.coerce??!1,...G(t)});function XS(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Qr=class t extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_type,expected:R.number,received:s.parsedType}),U}let n,o=new Ke;for(let s of this._def.checks)s.kind==="int"?ee.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?XS(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_finite,message:s.message}),o.dirty()):ee.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ee.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Qr.create=t=>new Qr({checks:[],typeName:k.ZodNumber,coerce:t?.coerce||!1,...G(t)});var en=class t extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let n,o=new Ke;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ee.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:R.bigint,received:r.parsedType}),U}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};en.create=t=>new en({checks:[],typeName:k.ZodBigInt,coerce:t?.coerce??!1,...G(t)});var tn=class extends K{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.boolean,received:n.parsedType}),U}return Ye(e.data)}};tn.create=t=>new tn({typeName:k.ZodBoolean,coerce:t?.coerce||!1,...G(t)});var rn=class t extends K{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_type,expected:R.date,received:s.parsedType}),U}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_date}),U}let n=new Ke,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ee.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};rn.create=t=>new rn({checks:[],coerce:t?.coerce||!1,typeName:k.ZodDate,...G(t)});var Yn=class extends K{_parse(e){if(this._getType(e)!==R.symbol){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.symbol,received:n.parsedType}),U}return Ye(e.data)}};Yn.create=t=>new Yn({typeName:k.ZodSymbol,...G(t)});var nn=class extends K{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.undefined,received:n.parsedType}),U}return Ye(e.data)}};nn.create=t=>new nn({typeName:k.ZodUndefined,...G(t)});var on=class extends K{_parse(e){if(this._getType(e)!==R.null){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.null,received:n.parsedType}),U}return Ye(e.data)}};on.create=t=>new on({typeName:k.ZodNull,...G(t)});var kr=class extends K{constructor(){super(...arguments),this._any=!0}_parse(e){return Ye(e.data)}};kr.create=t=>new kr({typeName:k.ZodAny,...G(t)});var dr=class extends K{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ye(e.data)}};dr.create=t=>new dr({typeName:k.ZodUnknown,...G(t)});var Ct=class extends K{_parse(e){let r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:R.never,received:r.parsedType}),U}};Ct.create=t=>new Ct({typeName:k.ZodNever,...G(t)});var Qn=class extends K{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.void,received:n.parsedType}),U}return Ye(e.data)}};Qn.create=t=>new Qn({typeName:k.ZodVoid,...G(t)});var pr=class t extends K{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==R.array)return P(r,{code:E.invalid_type,expected:R.array,received:r.parsedType}),U;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(P(r,{code:i?E.too_big:E.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(P(r,{code:E.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(P(r,{code:E.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new kt(r,i,r.path,a)))).then(i=>Ke.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new kt(r,i,r.path,a)));return Ke.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:O.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:O.toString(r)}})}nonempty(e){return this.min(1,e)}};pr.create=(t,e)=>new pr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...G(e)});function Xn(t){if(t instanceof dt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=lt.create(Xn(n))}return new dt({...t._def,shape:()=>e})}else return t instanceof pr?new pr({...t._def,type:Xn(t.element)}):t instanceof lt?lt.create(Xn(t.unwrap())):t instanceof Bt?Bt.create(Xn(t.unwrap())):t instanceof Gt?Gt.create(t.items.map(e=>Xn(e))):t}var dt=class t extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ee.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==R.object){let u=this._getOrReturnCtx(e);return P(u,{code:E.invalid_type,expected:R.object,received:u.parsedType}),U}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ct&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new kt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Ct){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(P(o,{code:E.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new kt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,h=await l.value;u.push({key:d,value:h,alwaysSet:l.alwaysSet})}return u}).then(u=>Ke.mergeObjectSync(n,u)):Ke.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ee.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ee.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Xn(this)}partial(e){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ee.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof lt;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return Lh(ee.objectKeys(this.shape))}};dt.create=(t,e)=>new dt({shape:()=>t,unknownKeys:"strip",catchall:Ct.create(),typeName:k.ZodObject,...G(e)});dt.strictCreate=(t,e)=>new dt({shape:()=>t,unknownKeys:"strict",catchall:Ct.create(),typeName:k.ZodObject,...G(e)});dt.lazycreate=(t,e)=>new dt({shape:t,unknownKeys:"strip",catchall:Ct.create(),typeName:k.ZodObject,...G(e)});var sn=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new ut(a.ctx.common.issues));return P(r,{code:E.invalid_union,unionErrors:i}),U}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new ut(c));return P(r,{code:E.invalid_union,unionErrors:a}),U}}get options(){return this._def.options}};sn.create=(t,e)=>new sn({options:t,typeName:k.ZodUnion,...G(e)});var lr=t=>t instanceof cn?lr(t.schema):t instanceof Tt?lr(t.innerType()):t instanceof un?[t.value]:t instanceof ln?t.options:t instanceof dn?ee.objectValues(t.enum):t instanceof pn?lr(t._def.innerType):t instanceof nn?[void 0]:t instanceof on?[null]:t instanceof lt?[void 0,...lr(t.unwrap())]:t instanceof Bt?[null,...lr(t.unwrap())]:t instanceof is||t instanceof mn?lr(t.unwrap()):t instanceof fn?lr(t._def.innerType):[],Fi=class t extends K{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.object)return P(r,{code:E.invalid_type,expected:R.object,received:r.parsedType}),U;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(P(r,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=lr(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...G(n)})}};function Cl(t,e){let r=Ht(t),n=Ht(e);if(t===e)return{valid:!0,data:t};if(r===R.object&&n===R.object){let o=ee.objectKeys(e),s=ee.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=Cl(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===R.array&&n===R.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=Cl(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===R.date&&n===R.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var an=class extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(Ui(s)||Ui(i))return U;let a=Cl(s.value,i.value);return a.valid?((qi(s)||qi(i))&&r.dirty(),{status:r.value,value:a.data}):(P(n,{code:E.invalid_intersection_types}),U)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};an.create=(t,e,r)=>new an({left:t,right:e,typeName:k.ZodIntersection,...G(r)});var Gt=class t extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return P(n,{code:E.invalid_type,expected:R.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return P(n,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new kt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Ke.mergeArray(r,i)):Ke.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Gt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gt({items:t,typeName:k.ZodTuple,rest:null,...G(e)})};var Vi=class t extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.object)return P(n,{code:E.invalid_type,expected:R.object,received:n.parsedType}),U;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new kt(n,a,n.path,a)),value:i._parse(new kt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ke.mergeObjectAsync(r,o):Ke.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof K?new t({keyType:e,valueType:r,typeName:k.ZodRecord,...G(n)}):new t({keyType:Er.create(),valueType:e,typeName:k.ZodRecord,...G(r)})}},eo=class extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.map)return P(n,{code:E.invalid_type,expected:R.map,received:n.parsedType}),U;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new kt(n,a,n.path,[u,"key"])),value:s._parse(new kt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};eo.create=(t,e,r)=>new eo({valueType:e,keyType:t,typeName:k.ZodMap,...G(r)});var to=class t extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return P(n,{code:E.invalid_type,expected:R.set,received:n.parsedType}),U;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(P(n,{code:E.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(P(n,{code:E.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return U;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new kt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:O.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};to.create=(t,e)=>new to({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,...G(e)});var Hi=class t extends K{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.function)return P(r,{code:E.invalid_type,expected:R.function,received:r.parsedType}),U;function n(a,c){return ss({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wn(),ur].filter(u=>!!u),issueData:{code:E.invalid_arguments,argumentsError:c}})}function o(a,c){return ss({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wn(),ur].filter(u=>!!u),issueData:{code:E.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Tr){let a=this;return Ye(async function(...c){let u=new ut([]),l=await a._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let a=this;return Ye(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new ut([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new ut([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Gt.create(e).rest(dr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Gt.create([]).rest(dr.create()),returns:r||dr.create(),typeName:k.ZodFunction,...G(n)})}},cn=class extends K{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};cn.create=(t,e)=>new cn({getter:t,typeName:k.ZodLazy,...G(e)});var un=class extends K{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return P(r,{received:r.data,code:E.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:e.data}}get value(){return this._def.value}};un.create=(t,e)=>new un({value:t,typeName:k.ZodLiteral,...G(e)});function Lh(t,e){return new ln({values:t,typeName:k.ZodEnum,...G(e)})}var ln=class t extends K{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{expected:ee.joinValues(n),received:r.parsedType,code:E.invalid_type}),U}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{received:r.data,code:E.invalid_enum_value,options:n}),U}return Ye(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};ln.create=Lh;var dn=class extends K{_parse(e){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){let o=ee.objectValues(r);return P(n,{expected:ee.joinValues(o),received:n.parsedType,code:E.invalid_type}),U}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=ee.objectValues(r);return P(n,{received:n.data,code:E.invalid_enum_value,options:o}),U}return Ye(e.data)}get enum(){return this._def.values}};dn.create=(t,e)=>new dn({values:t,typeName:k.ZodNativeEnum,...G(e)});var Tr=class extends K{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.promise&&r.common.async===!1)return P(r,{code:E.invalid_type,expected:R.promise,received:r.parsedType}),U;let n=r.parsedType===R.promise?r.data:Promise.resolve(r.data);return Ye(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Tr.create=(t,e)=>new Tr({type:t,typeName:k.ZodPromise,...G(e)});var Tt=class extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{P(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return U;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?U:c.status==="dirty"?Yr(c.value):r.value==="dirty"?Yr(c.value):c});{if(r.value==="aborted")return U;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?U:a.status==="dirty"?Yr(a.value):r.value==="dirty"?Yr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?U:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?U:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$r(i))return U;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>$r(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):U);ee.assertNever(o)}};Tt.create=(t,e,r)=>new Tt({schema:t,typeName:k.ZodEffects,effect:e,...G(r)});Tt.createWithPreprocess=(t,e,r)=>new Tt({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,...G(r)});var lt=class extends K{_parse(e){return this._getType(e)===R.undefined?Ye(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lt.create=(t,e)=>new lt({innerType:t,typeName:k.ZodOptional,...G(e)});var Bt=class extends K{_parse(e){return this._getType(e)===R.null?Ye(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bt.create=(t,e)=>new Bt({innerType:t,typeName:k.ZodNullable,...G(e)});var pn=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pn.create=(t,e)=>new pn({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});var fn=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Jn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fn.create=(t,e)=>new fn({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});var ro=class extends K{_parse(e){if(this._getType(e)!==R.nan){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.nan,received:n.parsedType}),U}return{status:"valid",value:e.data}}};ro.create=t=>new ro({typeName:k.ZodNaN,...G(t)});var YS=Symbol("zod_brand"),is=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},as=class t extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?U:s.status==="dirty"?(r.dirty(),Yr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?U:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:k.ZodPipeline})}},mn=class extends K{_parse(e){let r=this._def.innerType._parse(e),n=o=>($r(o)&&(o.value=Object.freeze(o.value)),o);return Jn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};mn.create=(t,e)=>new mn({innerType:t,typeName:k.ZodReadonly,...G(e)});function Ch(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Zh(t,e={},r){return t?kr.create().superRefine((n,o)=>{let s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){let a=Ch(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=Ch(e,n),a=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:a})}}):kr.create()}var QS={object:dt.lazycreate},k;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(k||(k={}));var e$=(t,e={message:`Input not instance of ${t.name}`})=>Zh(r=>r instanceof t,e),Uh=Er.create,qh=Qr.create,t$=ro.create,r$=en.create,Fh=tn.create,n$=rn.create,o$=Yn.create,s$=nn.create,i$=on.create,a$=kr.create,c$=dr.create,u$=Ct.create,l$=Qn.create,d$=pr.create,Ml=dt.create,p$=dt.strictCreate,f$=sn.create,m$=Fi.create,h$=an.create,g$=Gt.create,_$=Vi.create,y$=eo.create,v$=to.create,b$=Hi.create,w$=cn.create,x$=un.create,S$=ln.create,$$=dn.create,E$=Tr.create,k$=Tt.create,T$=lt.create,P$=Bt.create,R$=Tt.createWithPreprocess,I$=as.create,z$=()=>Uh().optional(),O$=()=>qh().optional(),N$=()=>Fh().optional(),A$={string:(t=>Er.create({...t,coerce:!0})),number:(t=>Qr.create({...t,coerce:!0})),boolean:(t=>tn.create({...t,coerce:!0})),bigint:(t=>en.create({...t,coerce:!0})),date:(t=>rn.create({...t,coerce:!0}))};var C$=U;var Vh=b.object({access_token:b.string().optional()}).passthrough(),Hh=b.object({revision:b.number()}).passthrough(),Gh=b.object({id:b.string(),name:b.string(),version:b.number(),latestData:b.array(b.unknown()).optional()}).passthrough();var cs="0.1.1";var Bh=3e4;function oo(t){return t?.proposed===!0}var Kt=class extends Error{status;constructor(e,r){super(e),this.name="FlowpadError",this.status=r}};function Kh(t,e,r){let n=t.safeParse(e);if(!n.success)throw new Kt(`Backend response for ${r} did not match the expected shape: ${n.error.message}`);return n.data}var no=class{constructor(e){this.cfg=e;if(e.token)this.token=e.token;else if(!e.mcpKey)throw new Kt("Missing credential: provide an OAuth access token, or a FLOWPAD_API_KEY (Settings \u2192 Integrations) for the MCP server env.")}cfg;token;cache=new Map;clientName;updateAdvisory;url(e){return`${this.cfg.baseUrl.replace(/\/$/,"")}${e}`}setClientName(e){let r=e?.trim();this.clientName=r?r.slice(0,64):void 0}getUpdateAdvisory(){return this.updateAdvisory}async login(){if(!this.cfg.mcpKey)throw new Kt("Access token rejected and no MCP key to re-authenticate \u2014 the OAuth token is likely expired; reconnect the connector.",401);let e;try{e=await fetch(this.url("/mcp/auth/login"),{method:"POST",headers:{"Content-Type":"application/json","x-mcp-key":this.cfg.mcpKey,"X-Flowpad-MCP-Version":cs},signal:AbortSignal.timeout(Bh)})}catch(n){throw n instanceof Error&&n.name==="TimeoutError"?new Kt("Backend timed out \u2014 retry"):n}if(!e.ok)throw new Kt(`MCP login failed (${e.status}): ${await e.text()}. Check FLOWPAD_API_KEY is a valid, non-revoked key and FLOWPAD_API_URL points at the right backend.`,e.status);let r=Kh(Vh,await e.json(),"POST /mcp/auth/login");if(!r.access_token)throw new Kt("MCP login response did not contain access_token.");this.token=r.access_token}async guidance(){return(await this.request("/mcp/guidance")).instructions}async request(e,r={},n=!0,o){this.token||await this.login();let s;try{s=await fetch(this.url(e),{...r,headers:{"Content-Type":"application/json","X-Flowpad-MCP-Version":cs,...this.clientName?{"x-mcp-client":this.clientName}:{},...r.headers??{},Authorization:`Bearer ${this.token}`},signal:AbortSignal.timeout(Bh)})}catch(a){throw a instanceof Error&&a.name==="TimeoutError"?new Kt("Backend timed out \u2014 retry"):a}if(s.headers.get("x-flowpad-mcp-update")==="available"&&(this.updateAdvisory=s.headers.get("x-flowpad-mcp-latest")??"newer"),s.status===401&&n&&this.cfg.mcpKey)return this.token=void 0,await this.login(),this.request(e,r,!1,o);if(!s.ok)throw new Kt(`${r.method??"GET"} ${e} failed (${s.status}): ${await s.text()}`,s.status);if(s.status===204)return;let i=await s.json();return o?Kh(o,i,`${r.method??"GET"} ${e}`):i}async listProjects(e){let r=e?`?query=${encodeURIComponent(e)}`:"";return this.request(`/mcp/projects${r}`)}async getProjectRaw(e){return this.request(`/mcp/projects/${e}/raw`,{},!0,Gh)}async getRevision(e){return this.request(`/mcp/projects/${e}/revision`,{},!0,Hh)}async getProjectRawCached(e){let r=this.cache.get(e);if(r)try{let{revision:o}=await this.getRevision(e);if(o===r.version)return r.project}catch{}let n=await this.getProjectRaw(e);return this.cache.set(e,{version:n.version,project:n}),n}invalidate(e){this.cache.delete(e)}async outline(e,r){let n=r!==void 0?`?maxDepth=${r}`:"",{text:o}=await this.request(`/mcp/projects/${e}/outline${n}`);return o}async searchNodes(e,r){let n=new URLSearchParams;for(let[i,a]of Object.entries(r))a!==void 0&&a!==""&&n.set(i,String(a));let o=n.toString()?`?${n.toString()}`:"",{text:s}=await this.request(`/mcp/projects/${e}/search${o}`);return s}async getNode(e,r,n){let o=n!==void 0?`?depth=${n}`:"",{text:s}=await this.request(`/mcp/projects/${e}/nodes/${encodeURIComponent(r)}${o}`);return s}async analyze(e){let{text:r}=await this.request(`/mcp/projects/${e}/analyze`);return r}async connections(e,r={}){let n=new URLSearchParams;r.nodeId&&n.set("nodeId",r.nodeId),r.nodeName&&n.set("nodeName",r.nodeName);let o=n.toString()?`?${n.toString()}`:"",{text:s}=await this.request(`/mcp/projects/${e}/connections${o}`);return s}async updateProject(e,r){let n=await this.request(`/mcp/projects/${e}`,{method:"PUT",body:JSON.stringify(r)});return oo(n)?this.invalidate(e):n&&typeof n.version=="number"&&n.latestData?this.cache.set(e,{version:n.version,project:n}):this.invalidate(e),n}async createProject(e){return this.request("/mcp/projects",{method:"POST",body:JSON.stringify(e)})}async deleteProject(e){return this.request(`/mcp/projects/${e}`,{method:"DELETE"})}async bindTemplate(e,r){return this.request(`/mcp/projects/${e}/bind-template`,{method:"POST",body:JSON.stringify({templateProjectId:r})})}async listTemplates(){return this.request("/mcp/templates")}};var j$=x("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");he.init(t,e),t.def=e,t.parse=(r,n)=>Tc(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Kr(t,r,n),t.parseAsync=async(r,n)=>Rc(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Wr(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>wt(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))});var D$=x("ZodMiniObject",(t,e)=>{ii.init(t,e),j$.init(t,e),re.defineLazy(t,"shape",()=>e.shape)});function jl(t,e){let r={type:"object",get shape(){return re.assignProp(this,"shape",{...t}),this.shape},...re.normalizeParams(e)};return new D$(r)}function Pt(t){return!!t._zod}function hn(t){let e=Object.values(t);if(e.length===0)return jl({});let r=e.every(Pt),n=e.every(o=>!Pt(o));if(r)return jl(t);if(n)return Ml(t);throw new Error("Mixed Zod versions detected in object shape.")}function Pr(t,e){return Pt(t)?Kr(t,e):t.safeParse(e)}async function Gi(t,e){return Pt(t)?await Wr(t,e):await t.safeParseAsync(e)}function Rr(t){if(!t)return;let e;if(Pt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function so(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return hn(t)}}if(Pt(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Bi(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Wh(t){return t.description}function Jh(t){if(Pt(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function Ki(t){if(Pt(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}function Ir(t){return t==="completed"||t==="failed"||t==="cancelled"}var Yh=Symbol("Let zodToJsonSchema decide on which parser to use");var Xh={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Qh=t=>typeof t=="string"?{...Xh,name:t}:{...Xh,...t};var eg=t=>{let e=Qh(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Dl(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function oe(t,e,r,n,o){t[e]=r,Dl(t,e,n,o)}var Wi=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function ze(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Wi(e,t.currentPath):e.join("/")}}function tg(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==k.ZodAny&&(r.items=V(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&oe(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&oe(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(oe(r,"minItems",t.exactLength.value,t.exactLength.message,e),oe(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function rg(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?oe(r,"minimum",n.value,n.message,e):oe(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),oe(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?oe(r,"maximum",n.value,n.message,e):oe(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),oe(r,"maximum",n.value,n.message,e));break;case"multipleOf":oe(r,"multipleOf",n.value,n.message,e);break}return r}function ng(){return{type:"boolean"}}function Ji(t,e){return V(t.type._def,e)}var og=(t,e)=>V(t.innerType._def,e);function Ll(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Ll(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Z$(t,e)}}var Z$=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":oe(r,"minimum",n.value,n.message,e);break;case"max":oe(r,"maximum",n.value,n.message,e);break}return r};function sg(t,e){return{...V(t.innerType._def,e),default:t.defaultValue()}}function ig(t,e){return e.effectStrategy==="input"?V(t.schema._def,e):ze(e)}function ag(t){return{type:"string",enum:Array.from(t.values)}}var U$=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function cg(t,e){let r=[V(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),V(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(U$(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function ug(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Zl,Mt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Zl===void 0&&(Zl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Zl),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Xi(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":oe(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":oe(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":jt(r,"email",n.message,e);break;case"format:idn-email":jt(r,"idn-email",n.message,e);break;case"pattern:zod":ot(r,Mt.email,n.message,e);break}break;case"url":jt(r,"uri",n.message,e);break;case"uuid":jt(r,"uuid",n.message,e);break;case"regex":ot(r,n.regex,n.message,e);break;case"cuid":ot(r,Mt.cuid,n.message,e);break;case"cuid2":ot(r,Mt.cuid2,n.message,e);break;case"startsWith":ot(r,RegExp(`^${Ul(n.value,e)}`),n.message,e);break;case"endsWith":ot(r,RegExp(`${Ul(n.value,e)}$`),n.message,e);break;case"datetime":jt(r,"date-time",n.message,e);break;case"date":jt(r,"date",n.message,e);break;case"time":jt(r,"time",n.message,e);break;case"duration":jt(r,"duration",n.message,e);break;case"length":oe(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),oe(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{ot(r,RegExp(Ul(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&jt(r,"ipv4",n.message,e),n.version!=="v4"&&jt(r,"ipv6",n.message,e);break}case"base64url":ot(r,Mt.base64url,n.message,e);break;case"jwt":ot(r,Mt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&ot(r,Mt.ipv4Cidr,n.message,e),n.version!=="v4"&&ot(r,Mt.ipv6Cidr,n.message,e);break}case"emoji":ot(r,Mt.emoji(),n.message,e);break;case"ulid":{ot(r,Mt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{jt(r,"binary",n.message,e);break}case"contentEncoding:base64":{oe(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{ot(r,Mt.base64,n.message,e);break}}break}case"nanoid":ot(r,Mt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ul(t,e){return e.patternStrategy==="escape"?F$(t):t}var q$=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function F$(t){let e="";for(let r=0;r<t.length;r++)q$.has(t[r])||(e+="\\"),e+=t[r];return e}function jt(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):oe(t,"format",e,r,n)}function ot(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:lg(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):oe(t,"pattern",lg(e,n),r,n)}function lg(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
41
|
+
`}var Zi=class{constructor(e=Oh.stdin,r=Oh.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Li,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=zh(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var b={};pc(b,{BRAND:()=>YS,DIRTY:()=>Yr,EMPTY_PATH:()=>IS,INVALID:()=>U,NEVER:()=>C$,OK:()=>Ye,ParseStatus:()=>Ke,Schema:()=>K,ZodAny:()=>kr,ZodArray:()=>pr,ZodBigInt:()=>en,ZodBoolean:()=>tn,ZodBranded:()=>is,ZodCatch:()=>fn,ZodDate:()=>rn,ZodDefault:()=>pn,ZodDiscriminatedUnion:()=>Fi,ZodEffects:()=>Tt,ZodEnum:()=>ln,ZodError:()=>ut,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Hi,ZodIntersection:()=>an,ZodIssueCode:()=>E,ZodLazy:()=>cn,ZodLiteral:()=>un,ZodMap:()=>eo,ZodNaN:()=>ro,ZodNativeEnum:()=>dn,ZodNever:()=>Ct,ZodNull:()=>on,ZodNullable:()=>Bt,ZodNumber:()=>Qr,ZodObject:()=>dt,ZodOptional:()=>lt,ZodParsedType:()=>R,ZodPipeline:()=>as,ZodPromise:()=>Tr,ZodReadonly:()=>mn,ZodRecord:()=>Vi,ZodSchema:()=>K,ZodSet:()=>to,ZodString:()=>Er,ZodSymbol:()=>Yn,ZodTransformer:()=>Tt,ZodTuple:()=>Gt,ZodType:()=>K,ZodUndefined:()=>nn,ZodUnion:()=>sn,ZodUnknown:()=>dr,ZodVoid:()=>Qn,addIssueToContext:()=>P,any:()=>a$,array:()=>d$,bigint:()=>r$,boolean:()=>Fh,coerce:()=>A$,custom:()=>Zh,date:()=>n$,datetimeRegex:()=>Dh,defaultErrorMap:()=>ur,discriminatedUnion:()=>m$,effect:()=>k$,enum:()=>S$,function:()=>b$,getErrorMap:()=>Wn,getParsedType:()=>Ht,instanceof:()=>e$,intersection:()=>h$,isAborted:()=>Ui,isAsync:()=>Jn,isDirty:()=>qi,isValid:()=>$r,late:()=>QS,lazy:()=>w$,literal:()=>x$,makeIssue:()=>ss,map:()=>y$,nan:()=>t$,nativeEnum:()=>$$,never:()=>u$,null:()=>i$,nullable:()=>P$,number:()=>qh,object:()=>Ml,objectUtil:()=>Nl,oboolean:()=>N$,onumber:()=>O$,optional:()=>T$,ostring:()=>z$,pipeline:()=>I$,preprocess:()=>R$,promise:()=>E$,quotelessJson:()=>TS,record:()=>_$,set:()=>v$,setErrorMap:()=>RS,strictObject:()=>p$,string:()=>Uh,symbol:()=>o$,transformer:()=>k$,tuple:()=>g$,undefined:()=>s$,union:()=>f$,unknown:()=>c$,util:()=>ee,void:()=>l$});var ee;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ee||(ee={}));var Nl;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Nl||(Nl={}));var R=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map<"u"&&t instanceof Map?R.map:typeof Set<"u"&&t instanceof Set?R.set:typeof Date<"u"&&t instanceof Date?R.date:R.object;default:return R.unknown}};var E=ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),TS=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ut=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=t=>new ut(t);var PS=(t,e)=>{let r;switch(t.code){case E.invalid_type:t.received===R.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case E.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ee.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(t.keys,", ")}`;break;case E.invalid_union:r="Invalid input";break;case E.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(t.options)}`;break;case E.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(t.options)}, received '${t.received}'`;break;case E.invalid_arguments:r="Invalid function arguments";break;case E.invalid_return_type:r="Invalid function return type";break;case E.invalid_date:r="Invalid date";break;case E.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ee.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case E.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case E.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case E.custom:r="Invalid input";break;case E.invalid_intersection_types:r="Intersection results could not be merged";break;case E.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case E.not_finite:r="Number must be finite";break;default:r=e.defaultError,ee.assertNever(t)}return{message:r}},ur=PS;var Nh=ur;function RS(t){Nh=t}function Wn(){return Nh}var ss=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},IS=[];function P(t,e){let r=Wn(),n=ss({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ur?void 0:ur].filter(o=>!!o)});t.common.issues.push(n)}var Ke=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return U;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return U;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},U=Object.freeze({status:"aborted"}),Yr=t=>({status:"dirty",value:t}),Ye=t=>({status:"valid",value:t}),Ui=t=>t.status==="aborted",qi=t=>t.status==="dirty",$r=t=>t.status==="valid",Jn=t=>typeof Promise<"u"&&t instanceof Promise;var O;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(O||(O={}));var kt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ah=(t,e)=>{if($r(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ut(t.common.issues);return this._error=r,this._error}}};function G(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var K=class{get description(){return this._def.description}_getType(e){return Ht(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ke,ctx:{common:e.parent.common,data:e.data,parsedType:Ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Jn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Ah(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return $r(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>$r(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ht(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(Jn(o)?o:Promise.resolve(o));return Ah(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:E.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Tt({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return lt.create(this,this._def)}nullable(){return Bt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pr.create(this)}promise(){return Tr.create(this,this._def)}or(e){return sn.create([this,e],this._def)}and(e){return an.create(this,e,this._def)}transform(e){return new Tt({...G(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new pn({...G(this._def),innerType:this,defaultValue:r,typeName:k.ZodDefault})}brand(){return new is({typeName:k.ZodBranded,type:this,...G(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new fn({...G(this._def),innerType:this,catchValue:r,typeName:k.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return as.create(this,e)}readonly(){return mn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zS=/^c[^\s-]{8,}$/i,OS=/^[0-9a-z]+$/,NS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,AS=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,CS=/^[a-z0-9_-]{21}$/i,MS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,DS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,LS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Al,ZS=/^(?:(?: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])$/,US=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,qS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,FS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,HS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mh="((\\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])))",GS=new RegExp(`^${Mh}$`);function jh(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function BS(t){return new RegExp(`^${jh(t)}$`)}function Dh(t){let e=`${Mh}T${jh(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function KS(t,e){return!!((e==="v4"||!e)&&ZS.test(t)||(e==="v6"||!e)&&qS.test(t))}function WS(t,e){if(!MS.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function JS(t,e){return!!((e==="v4"||!e)&&US.test(t)||(e==="v6"||!e)&&FS.test(t))}var Er=class t extends K{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_type,expected:R.string,received:s.parsedType}),U}let n=new Ke,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?P(o,{code:E.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&P(o,{code:E.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")DS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"email",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Al||(Al=new RegExp(LS,"u")),Al.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"emoji",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")AS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"uuid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")CS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"nanoid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")zS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"cuid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")OS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"cuid2",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")NS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"ulid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),P(o,{validation:"url",code:E.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"regex",code:E.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Dh(s).test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?GS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?BS(s).test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{code:E.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?jS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"duration",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?KS(e.data,s.version)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"ip",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?WS(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"jwt",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?JS(e.data,s.version)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"cidr",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?VS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"base64",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?HS.test(e.data)||(o=this._getOrReturnCtx(e,o),P(o,{validation:"base64url",code:E.invalid_string,message:s.message}),n.dirty()):ee.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:E.invalid_string,...O.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...O.errToObj(e)})}url(e){return this._addCheck({kind:"url",...O.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...O.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...O.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...O.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...O.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...O.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...O.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...O.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...O.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...O.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...O.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...O.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...O.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...O.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...O.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...O.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...O.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...O.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...O.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...O.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...O.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...O.errToObj(r)})}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Er.create=t=>new Er({checks:[],typeName:k.ZodString,coerce:t?.coerce??!1,...G(t)});function XS(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Qr=class t extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_type,expected:R.number,received:s.parsedType}),U}let n,o=new Ke;for(let s of this._def.checks)s.kind==="int"?ee.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?XS(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_finite,message:s.message}),o.dirty()):ee.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ee.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Qr.create=t=>new Qr({checks:[],typeName:k.ZodNumber,coerce:t?.coerce||!1,...G(t)});var en=class t extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let n,o=new Ke;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),P(n,{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ee.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:R.bigint,received:r.parsedType}),U}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};en.create=t=>new en({checks:[],typeName:k.ZodBigInt,coerce:t?.coerce??!1,...G(t)});var tn=class extends K{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.boolean,received:n.parsedType}),U}return Ye(e.data)}};tn.create=t=>new tn({typeName:k.ZodBoolean,coerce:t?.coerce||!1,...G(t)});var rn=class t extends K{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_type,expected:R.date,received:s.parsedType}),U}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return P(s,{code:E.invalid_date}),U}let n=new Ke,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),P(o,{code:E.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ee.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};rn.create=t=>new rn({checks:[],coerce:t?.coerce||!1,typeName:k.ZodDate,...G(t)});var Yn=class extends K{_parse(e){if(this._getType(e)!==R.symbol){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.symbol,received:n.parsedType}),U}return Ye(e.data)}};Yn.create=t=>new Yn({typeName:k.ZodSymbol,...G(t)});var nn=class extends K{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.undefined,received:n.parsedType}),U}return Ye(e.data)}};nn.create=t=>new nn({typeName:k.ZodUndefined,...G(t)});var on=class extends K{_parse(e){if(this._getType(e)!==R.null){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.null,received:n.parsedType}),U}return Ye(e.data)}};on.create=t=>new on({typeName:k.ZodNull,...G(t)});var kr=class extends K{constructor(){super(...arguments),this._any=!0}_parse(e){return Ye(e.data)}};kr.create=t=>new kr({typeName:k.ZodAny,...G(t)});var dr=class extends K{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ye(e.data)}};dr.create=t=>new dr({typeName:k.ZodUnknown,...G(t)});var Ct=class extends K{_parse(e){let r=this._getOrReturnCtx(e);return P(r,{code:E.invalid_type,expected:R.never,received:r.parsedType}),U}};Ct.create=t=>new Ct({typeName:k.ZodNever,...G(t)});var Qn=class extends K{_parse(e){if(this._getType(e)!==R.undefined){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.void,received:n.parsedType}),U}return Ye(e.data)}};Qn.create=t=>new Qn({typeName:k.ZodVoid,...G(t)});var pr=class t extends K{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==R.array)return P(r,{code:E.invalid_type,expected:R.array,received:r.parsedType}),U;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(P(r,{code:i?E.too_big:E.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(P(r,{code:E.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(P(r,{code:E.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new kt(r,i,r.path,a)))).then(i=>Ke.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new kt(r,i,r.path,a)));return Ke.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:O.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:O.toString(r)}})}nonempty(e){return this.min(1,e)}};pr.create=(t,e)=>new pr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...G(e)});function Xn(t){if(t instanceof dt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=lt.create(Xn(n))}return new dt({...t._def,shape:()=>e})}else return t instanceof pr?new pr({...t._def,type:Xn(t.element)}):t instanceof lt?lt.create(Xn(t.unwrap())):t instanceof Bt?Bt.create(Xn(t.unwrap())):t instanceof Gt?Gt.create(t.items.map(e=>Xn(e))):t}var dt=class t extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ee.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==R.object){let u=this._getOrReturnCtx(e);return P(u,{code:E.invalid_type,expected:R.object,received:u.parsedType}),U}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ct&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new kt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Ct){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(P(o,{code:E.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new kt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,h=await l.value;u.push({key:d,value:h,alwaysSet:l.alwaysSet})}return u}).then(u=>Ke.mergeObjectSync(n,u)):Ke.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ee.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ee.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Xn(this)}partial(e){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ee.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof lt;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return Lh(ee.objectKeys(this.shape))}};dt.create=(t,e)=>new dt({shape:()=>t,unknownKeys:"strip",catchall:Ct.create(),typeName:k.ZodObject,...G(e)});dt.strictCreate=(t,e)=>new dt({shape:()=>t,unknownKeys:"strict",catchall:Ct.create(),typeName:k.ZodObject,...G(e)});dt.lazycreate=(t,e)=>new dt({shape:t,unknownKeys:"strip",catchall:Ct.create(),typeName:k.ZodObject,...G(e)});var sn=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new ut(a.ctx.common.issues));return P(r,{code:E.invalid_union,unionErrors:i}),U}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new ut(c));return P(r,{code:E.invalid_union,unionErrors:a}),U}}get options(){return this._def.options}};sn.create=(t,e)=>new sn({options:t,typeName:k.ZodUnion,...G(e)});var lr=t=>t instanceof cn?lr(t.schema):t instanceof Tt?lr(t.innerType()):t instanceof un?[t.value]:t instanceof ln?t.options:t instanceof dn?ee.objectValues(t.enum):t instanceof pn?lr(t._def.innerType):t instanceof nn?[void 0]:t instanceof on?[null]:t instanceof lt?[void 0,...lr(t.unwrap())]:t instanceof Bt?[null,...lr(t.unwrap())]:t instanceof is||t instanceof mn?lr(t.unwrap()):t instanceof fn?lr(t._def.innerType):[],Fi=class t extends K{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.object)return P(r,{code:E.invalid_type,expected:R.object,received:r.parsedType}),U;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(P(r,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=lr(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...G(n)})}};function Cl(t,e){let r=Ht(t),n=Ht(e);if(t===e)return{valid:!0,data:t};if(r===R.object&&n===R.object){let o=ee.objectKeys(e),s=ee.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=Cl(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===R.array&&n===R.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=Cl(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===R.date&&n===R.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var an=class extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(Ui(s)||Ui(i))return U;let a=Cl(s.value,i.value);return a.valid?((qi(s)||qi(i))&&r.dirty(),{status:r.value,value:a.data}):(P(n,{code:E.invalid_intersection_types}),U)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};an.create=(t,e,r)=>new an({left:t,right:e,typeName:k.ZodIntersection,...G(r)});var Gt=class t extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return P(n,{code:E.invalid_type,expected:R.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return P(n,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&n.data.length>this._def.items.length&&(P(n,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new kt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Ke.mergeArray(r,i)):Ke.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Gt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gt({items:t,typeName:k.ZodTuple,rest:null,...G(e)})};var Vi=class t extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.object)return P(n,{code:E.invalid_type,expected:R.object,received:n.parsedType}),U;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new kt(n,a,n.path,a)),value:i._parse(new kt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ke.mergeObjectAsync(r,o):Ke.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof K?new t({keyType:e,valueType:r,typeName:k.ZodRecord,...G(n)}):new t({keyType:Er.create(),valueType:e,typeName:k.ZodRecord,...G(r)})}},eo=class extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.map)return P(n,{code:E.invalid_type,expected:R.map,received:n.parsedType}),U;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new kt(n,a,n.path,[u,"key"])),value:s._parse(new kt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};eo.create=(t,e,r)=>new eo({valueType:e,keyType:t,typeName:k.ZodMap,...G(r)});var to=class t extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return P(n,{code:E.invalid_type,expected:R.set,received:n.parsedType}),U;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(P(n,{code:E.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(P(n,{code:E.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return U;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new kt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:O.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:O.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};to.create=(t,e)=>new to({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,...G(e)});var Hi=class t extends K{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.function)return P(r,{code:E.invalid_type,expected:R.function,received:r.parsedType}),U;function n(a,c){return ss({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wn(),ur].filter(u=>!!u),issueData:{code:E.invalid_arguments,argumentsError:c}})}function o(a,c){return ss({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wn(),ur].filter(u=>!!u),issueData:{code:E.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Tr){let a=this;return Ye(async function(...c){let u=new ut([]),l=await a._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let a=this;return Ye(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new ut([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new ut([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Gt.create(e).rest(dr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Gt.create([]).rest(dr.create()),returns:r||dr.create(),typeName:k.ZodFunction,...G(n)})}},cn=class extends K{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};cn.create=(t,e)=>new cn({getter:t,typeName:k.ZodLazy,...G(e)});var un=class extends K{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return P(r,{received:r.data,code:E.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:e.data}}get value(){return this._def.value}};un.create=(t,e)=>new un({value:t,typeName:k.ZodLiteral,...G(e)});function Lh(t,e){return new ln({values:t,typeName:k.ZodEnum,...G(e)})}var ln=class t extends K{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{expected:ee.joinValues(n),received:r.parsedType,code:E.invalid_type}),U}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return P(r,{received:r.data,code:E.invalid_enum_value,options:n}),U}return Ye(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};ln.create=Lh;var dn=class extends K{_parse(e){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){let o=ee.objectValues(r);return P(n,{expected:ee.joinValues(o),received:n.parsedType,code:E.invalid_type}),U}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=ee.objectValues(r);return P(n,{received:n.data,code:E.invalid_enum_value,options:o}),U}return Ye(e.data)}get enum(){return this._def.values}};dn.create=(t,e)=>new dn({values:t,typeName:k.ZodNativeEnum,...G(e)});var Tr=class extends K{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.promise&&r.common.async===!1)return P(r,{code:E.invalid_type,expected:R.promise,received:r.parsedType}),U;let n=r.parsedType===R.promise?r.data:Promise.resolve(r.data);return Ye(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Tr.create=(t,e)=>new Tr({type:t,typeName:k.ZodPromise,...G(e)});var Tt=class extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{P(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return U;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?U:c.status==="dirty"?Yr(c.value):r.value==="dirty"?Yr(c.value):c});{if(r.value==="aborted")return U;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?U:a.status==="dirty"?Yr(a.value):r.value==="dirty"?Yr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?U:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?U:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$r(i))return U;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>$r(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):U);ee.assertNever(o)}};Tt.create=(t,e,r)=>new Tt({schema:t,typeName:k.ZodEffects,effect:e,...G(r)});Tt.createWithPreprocess=(t,e,r)=>new Tt({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,...G(r)});var lt=class extends K{_parse(e){return this._getType(e)===R.undefined?Ye(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lt.create=(t,e)=>new lt({innerType:t,typeName:k.ZodOptional,...G(e)});var Bt=class extends K{_parse(e){return this._getType(e)===R.null?Ye(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bt.create=(t,e)=>new Bt({innerType:t,typeName:k.ZodNullable,...G(e)});var pn=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};pn.create=(t,e)=>new pn({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});var fn=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Jn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fn.create=(t,e)=>new fn({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});var ro=class extends K{_parse(e){if(this._getType(e)!==R.nan){let n=this._getOrReturnCtx(e);return P(n,{code:E.invalid_type,expected:R.nan,received:n.parsedType}),U}return{status:"valid",value:e.data}}};ro.create=t=>new ro({typeName:k.ZodNaN,...G(t)});var YS=Symbol("zod_brand"),is=class extends K{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},as=class t extends K{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?U:s.status==="dirty"?(r.dirty(),Yr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?U:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:k.ZodPipeline})}},mn=class extends K{_parse(e){let r=this._def.innerType._parse(e),n=o=>($r(o)&&(o.value=Object.freeze(o.value)),o);return Jn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};mn.create=(t,e)=>new mn({innerType:t,typeName:k.ZodReadonly,...G(e)});function Ch(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Zh(t,e={},r){return t?kr.create().superRefine((n,o)=>{let s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){let a=Ch(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=Ch(e,n),a=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:a})}}):kr.create()}var QS={object:dt.lazycreate},k;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(k||(k={}));var e$=(t,e={message:`Input not instance of ${t.name}`})=>Zh(r=>r instanceof t,e),Uh=Er.create,qh=Qr.create,t$=ro.create,r$=en.create,Fh=tn.create,n$=rn.create,o$=Yn.create,s$=nn.create,i$=on.create,a$=kr.create,c$=dr.create,u$=Ct.create,l$=Qn.create,d$=pr.create,Ml=dt.create,p$=dt.strictCreate,f$=sn.create,m$=Fi.create,h$=an.create,g$=Gt.create,_$=Vi.create,y$=eo.create,v$=to.create,b$=Hi.create,w$=cn.create,x$=un.create,S$=ln.create,$$=dn.create,E$=Tr.create,k$=Tt.create,T$=lt.create,P$=Bt.create,R$=Tt.createWithPreprocess,I$=as.create,z$=()=>Uh().optional(),O$=()=>qh().optional(),N$=()=>Fh().optional(),A$={string:(t=>Er.create({...t,coerce:!0})),number:(t=>Qr.create({...t,coerce:!0})),boolean:(t=>tn.create({...t,coerce:!0})),bigint:(t=>en.create({...t,coerce:!0})),date:(t=>rn.create({...t,coerce:!0}))};var C$=U;var Vh=b.object({access_token:b.string().optional()}).passthrough(),Hh=b.object({revision:b.number()}).passthrough(),Gh=b.object({id:b.string(),name:b.string(),version:b.number(),latestData:b.array(b.unknown()).optional()}).passthrough();var cs="0.1.2";var Bh=3e4;function oo(t){return t?.proposed===!0}var Kt=class extends Error{status;constructor(e,r){super(e),this.name="FlowpadError",this.status=r}};function Kh(t,e,r){let n=t.safeParse(e);if(!n.success)throw new Kt(`Backend response for ${r} did not match the expected shape: ${n.error.message}`);return n.data}var no=class{constructor(e){this.cfg=e;if(e.token)this.token=e.token;else if(!e.mcpKey)throw new Kt("Missing credential: provide an OAuth access token, or a FLOWPAD_API_KEY (Settings \u2192 Integrations) for the MCP server env.")}cfg;token;cache=new Map;clientName;updateAdvisory;url(e){return`${this.cfg.baseUrl.replace(/\/$/,"")}${e}`}setClientName(e){let r=e?.trim();this.clientName=r?r.slice(0,64):void 0}getUpdateAdvisory(){return this.updateAdvisory}async login(){if(!this.cfg.mcpKey)throw new Kt("Access token rejected and no MCP key to re-authenticate \u2014 the OAuth token is likely expired; reconnect the connector.",401);let e;try{e=await fetch(this.url("/mcp/auth/login"),{method:"POST",headers:{"Content-Type":"application/json","x-mcp-key":this.cfg.mcpKey,"X-Flowpad-MCP-Version":cs},signal:AbortSignal.timeout(Bh)})}catch(n){throw n instanceof Error&&n.name==="TimeoutError"?new Kt("Backend timed out \u2014 retry"):n}if(!e.ok)throw new Kt(`MCP login failed (${e.status}): ${await e.text()}. Check FLOWPAD_API_KEY is a valid, non-revoked key and FLOWPAD_API_URL points at the right backend.`,e.status);let r=Kh(Vh,await e.json(),"POST /mcp/auth/login");if(!r.access_token)throw new Kt("MCP login response did not contain access_token.");this.token=r.access_token}async guidance(){return(await this.request("/mcp/guidance")).instructions}async request(e,r={},n=!0,o){this.token||await this.login();let s;try{s=await fetch(this.url(e),{...r,headers:{"Content-Type":"application/json","X-Flowpad-MCP-Version":cs,...this.clientName?{"x-mcp-client":this.clientName}:{},...r.headers??{},Authorization:`Bearer ${this.token}`},signal:AbortSignal.timeout(Bh)})}catch(a){throw a instanceof Error&&a.name==="TimeoutError"?new Kt("Backend timed out \u2014 retry"):a}if(s.headers.get("x-flowpad-mcp-update")==="available"&&(this.updateAdvisory=s.headers.get("x-flowpad-mcp-latest")??"newer"),s.status===401&&n&&this.cfg.mcpKey)return this.token=void 0,await this.login(),this.request(e,r,!1,o);if(!s.ok)throw new Kt(`${r.method??"GET"} ${e} failed (${s.status}): ${await s.text()}`,s.status);if(s.status===204)return;let i=await s.json();return o?Kh(o,i,`${r.method??"GET"} ${e}`):i}async listProjects(e){let r=e?`?query=${encodeURIComponent(e)}`:"";return this.request(`/mcp/projects${r}`)}async getProjectRaw(e){return this.request(`/mcp/projects/${e}/raw`,{},!0,Gh)}async getRevision(e){return this.request(`/mcp/projects/${e}/revision`,{},!0,Hh)}async getProjectRawCached(e){let r=this.cache.get(e);if(r)try{let{revision:o}=await this.getRevision(e);if(o===r.version)return r.project}catch{}let n=await this.getProjectRaw(e);return this.cache.set(e,{version:n.version,project:n}),n}invalidate(e){this.cache.delete(e)}async outline(e,r){let n=r!==void 0?`?maxDepth=${r}`:"",{text:o}=await this.request(`/mcp/projects/${e}/outline${n}`);return o}async searchNodes(e,r){let n=new URLSearchParams;for(let[i,a]of Object.entries(r))a!==void 0&&a!==""&&n.set(i,String(a));let o=n.toString()?`?${n.toString()}`:"",{text:s}=await this.request(`/mcp/projects/${e}/search${o}`);return s}async getNode(e,r,n){let o=n!==void 0?`?depth=${n}`:"",{text:s}=await this.request(`/mcp/projects/${e}/nodes/${encodeURIComponent(r)}${o}`);return s}async analyze(e){let{text:r}=await this.request(`/mcp/projects/${e}/analyze`);return r}async connections(e,r={}){let n=new URLSearchParams;r.nodeId&&n.set("nodeId",r.nodeId),r.nodeName&&n.set("nodeName",r.nodeName);let o=n.toString()?`?${n.toString()}`:"",{text:s}=await this.request(`/mcp/projects/${e}/connections${o}`);return s}async updateProject(e,r){let n=await this.request(`/mcp/projects/${e}`,{method:"PUT",body:JSON.stringify(r)});return oo(n)?this.invalidate(e):n&&typeof n.version=="number"&&n.latestData?this.cache.set(e,{version:n.version,project:n}):this.invalidate(e),n}async createProject(e){return this.request("/mcp/projects",{method:"POST",body:JSON.stringify(e)})}async deleteProject(e){return this.request(`/mcp/projects/${e}`,{method:"DELETE"})}async bindTemplate(e,r){return this.request(`/mcp/projects/${e}/bind-template`,{method:"POST",body:JSON.stringify({templateProjectId:r})})}async listTemplates(){return this.request("/mcp/templates")}};var j$=x("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");he.init(t,e),t.def=e,t.parse=(r,n)=>Tc(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Kr(t,r,n),t.parseAsync=async(r,n)=>Rc(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Wr(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>wt(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))});var D$=x("ZodMiniObject",(t,e)=>{ii.init(t,e),j$.init(t,e),re.defineLazy(t,"shape",()=>e.shape)});function jl(t,e){let r={type:"object",get shape(){return re.assignProp(this,"shape",{...t}),this.shape},...re.normalizeParams(e)};return new D$(r)}function Pt(t){return!!t._zod}function hn(t){let e=Object.values(t);if(e.length===0)return jl({});let r=e.every(Pt),n=e.every(o=>!Pt(o));if(r)return jl(t);if(n)return Ml(t);throw new Error("Mixed Zod versions detected in object shape.")}function Pr(t,e){return Pt(t)?Kr(t,e):t.safeParse(e)}async function Gi(t,e){return Pt(t)?await Wr(t,e):await t.safeParseAsync(e)}function Rr(t){if(!t)return;let e;if(Pt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function so(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return hn(t)}}if(Pt(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Bi(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Wh(t){return t.description}function Jh(t){if(Pt(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function Ki(t){if(Pt(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}function Ir(t){return t==="completed"||t==="failed"||t==="cancelled"}var Yh=Symbol("Let zodToJsonSchema decide on which parser to use");var Xh={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Qh=t=>typeof t=="string"?{...Xh,name:t}:{...Xh,...t};var eg=t=>{let e=Qh(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Dl(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function oe(t,e,r,n,o){t[e]=r,Dl(t,e,n,o)}var Wi=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function ze(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Wi(e,t.currentPath):e.join("/")}}function tg(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==k.ZodAny&&(r.items=V(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&oe(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&oe(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(oe(r,"minItems",t.exactLength.value,t.exactLength.message,e),oe(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function rg(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?oe(r,"minimum",n.value,n.message,e):oe(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),oe(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?oe(r,"maximum",n.value,n.message,e):oe(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),oe(r,"maximum",n.value,n.message,e));break;case"multipleOf":oe(r,"multipleOf",n.value,n.message,e);break}return r}function ng(){return{type:"boolean"}}function Ji(t,e){return V(t.type._def,e)}var og=(t,e)=>V(t.innerType._def,e);function Ll(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Ll(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Z$(t,e)}}var Z$=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":oe(r,"minimum",n.value,n.message,e);break;case"max":oe(r,"maximum",n.value,n.message,e);break}return r};function sg(t,e){return{...V(t.innerType._def,e),default:t.defaultValue()}}function ig(t,e){return e.effectStrategy==="input"?V(t.schema._def,e):ze(e)}function ag(t){return{type:"string",enum:Array.from(t.values)}}var U$=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function cg(t,e){let r=[V(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),V(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(U$(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function ug(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Zl,Mt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Zl===void 0&&(Zl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Zl),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Xi(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":oe(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":oe(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":jt(r,"email",n.message,e);break;case"format:idn-email":jt(r,"idn-email",n.message,e);break;case"pattern:zod":ot(r,Mt.email,n.message,e);break}break;case"url":jt(r,"uri",n.message,e);break;case"uuid":jt(r,"uuid",n.message,e);break;case"regex":ot(r,n.regex,n.message,e);break;case"cuid":ot(r,Mt.cuid,n.message,e);break;case"cuid2":ot(r,Mt.cuid2,n.message,e);break;case"startsWith":ot(r,RegExp(`^${Ul(n.value,e)}`),n.message,e);break;case"endsWith":ot(r,RegExp(`${Ul(n.value,e)}$`),n.message,e);break;case"datetime":jt(r,"date-time",n.message,e);break;case"date":jt(r,"date",n.message,e);break;case"time":jt(r,"time",n.message,e);break;case"duration":jt(r,"duration",n.message,e);break;case"length":oe(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),oe(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{ot(r,RegExp(Ul(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&jt(r,"ipv4",n.message,e),n.version!=="v4"&&jt(r,"ipv6",n.message,e);break}case"base64url":ot(r,Mt.base64url,n.message,e);break;case"jwt":ot(r,Mt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&ot(r,Mt.ipv4Cidr,n.message,e),n.version!=="v4"&&ot(r,Mt.ipv6Cidr,n.message,e);break}case"emoji":ot(r,Mt.emoji(),n.message,e);break;case"ulid":{ot(r,Mt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{jt(r,"binary",n.message,e);break}case"contentEncoding:base64":{oe(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{ot(r,Mt.base64,n.message,e);break}}break}case"nanoid":ot(r,Mt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ul(t,e){return e.patternStrategy==="escape"?F$(t):t}var q$=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function F$(t){let e="";for(let r=0;r<t.length;r++)q$.has(t[r])||(e+="\\"),e+=t[r];return e}function jt(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):oe(t,"format",e,r,n)}function ot(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:lg(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):oe(t,"pattern",lg(e,n),r,n)}function lg(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
41
42
|
]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
|
|
42
43
|
]))`;continue}}if(r.s&&n[c]==="."){o+=i?`${n[c]}\r
|
|
43
44
|
`:`[${n[c]}\r
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowpad-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "MCP server for Flowpad — lets an external AI (Claude Desktop, Cursor, Claude Code) find projects and edit canvas nodes through flowpad-be.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc",
|
|
19
|
-
"build:bundle": "esbuild src/index.ts --bundle --minify --platform=node --format=esm --target=node18 --outfile=dist/index.js",
|
|
19
|
+
"build:bundle": "esbuild src/index.ts --bundle --minify --platform=node --format=esm --target=node18 --outfile=dist/index.js --banner:js='import { createRequire } from \"module\"; const require = createRequire(import.meta.url);'",
|
|
20
20
|
"prepare": "husky",
|
|
21
21
|
"prepack": "yarn build:bundle",
|
|
22
22
|
"dev": "tsx src/index.ts",
|